Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into master #10

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ assignees: ''

---

#### Priority + Rationale
<!--
(To be filled out after bug submission by a product owner)
- Add stats if available on % of customers impacted
- Is this visible by all customers, or in a high traffic area?
- Is this tech debt?
- If applicable, what % of revenue is possibly impacted by this?
-->

#### Describe the bug
<!--
A clear and concise description of what the bug is.
Expand All @@ -38,26 +29,12 @@ A clear and concise description of what you expected to happen.
#### Relevant screenshots
<!--
If applicable, add screenshots to help explain your problem.
-->

#### Platform details
<!--
Where is this occurring and more details about the environment
(computer setup) of the customer.
-->

**Desktop (please complete the following information):**
<!--
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22 or web app]
-->

**Mobile (please complete the following information):**
<!--
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
(computer / mobile / wallet setup).
-->

## Additional context
Expand Down
41 changes: 25 additions & 16 deletions .github/ISSUE_TEMPLATE/epic.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@ assignees: ''

---

#### Description
## Description
<!--
Brief summary of what this Epic is, whether it's a larger project, goal,
or user story. Describe the job to be done, which persona this Epic is
mainly for, or if more multiple, break it down by user and job story.
-->

#### Frontend:
- [ ]
- [ ]
- [ ]
- [ ]
## Initiative / goal
<!--
Describe what this Epic is attempting to accomplish.
-->

#### Backend:
- [ ]
- [ ]
- [ ]
- [ ]
## Acceptance criteria and must have scope
<!--
Define what is a must-have for launch and in-scope.
-->

#### Marketing:
- [ ]
- [ ]
- [ ]
- [ ]
## Stakeholders
<!--
Describe who needs to be kept up-to-date about this Epic, included
in discussions, or updated along the way.
-->

## Timeline
<!--
What's the timeline for this Epic, what resources are needed, and
what might potentially block this from hitting the projected end date.
-->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature Request
about: Suggest a feature for this project
title: ''
labels: ''
assignees: ''

---

#### Describe the ideal solution or feature request
<!--
A clear and concise description of what you want.
-->

#### Who's asking?
<!--
Add more on who asked for this if it's not just you. If it's just you, who are you?
Brief bio please...
-->
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/new-issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

<!--
Provide a general summary of the issue in the title above and use relevant
Provide a general summary of the issue in the title above and use relevant
fields below to define the problem.
-->

Expand All @@ -17,6 +17,9 @@ fields below to define the problem.
- Audience or user can include a person or system, i.e. dev, user, api.
- An action or task this issue will accomplish.
- What is the desired outcome or goal?

NOTE: Feel free to replace this with a general description if a user story doesn't make sense, but
be willing to defend your choice to exclude a user story.
-->
- As an <audience/user>:
- I want to <action/task>:
Expand All @@ -35,16 +38,13 @@ fields below to define the problem.
- Describe the problem and why this task is needed.
-->

#### Solution
<!--
- If known, provide a summary of the solution and a task list of what
needs to be added, changed, or fixed.
-->

#### Definition of Done
<!--
- How do you know when this issue is completed?
- List acceptance criteria, bullet points are always preferred.
-->

- [ ] Thing One...
- [ ] Thing Two...

#### Attach files or screenshots if it's helpful for this issue.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] Linter status: 100% pass
- [ ] Changes don't break existing behavior
- [ ] Tests coverage hasn't decreased
- [ ] Test coverage hasn't decreased

##### Testing
<!-- Why should the PR reviewer trust that this change doesn't break
Expand Down
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Generic proxy pattern which can be used with any smart contract.

This project uses [Buidler](https://buidler.dev) and [Ethers](https://docs.ethers.io/ethers.js/html/index.html).

# 🚨Reserved Memory Slots 🚨
# 🚨Reserved Storage Slots 🚨

Using these slots in the implementation by accident would be an issue.
```
bytes32 constant IMPLEMENTATION_SLOT = keccak256(abi.encodePacked("IMPLEMENTATION_SLOT"));
bytes32 constant OWNER_SLOT = keccak256(abi.encodePacked("OWNER_SLOT"));
bytes32 constant PAUSED_SLOT = keccak256(abi.encodePacked("PAUSED_SLOT"));
bytes32 constant PAUZER_SLOT = keccak256(abi.encodePacked("PAUZER_SLOT"));
bytes32 constant PAUSED_SLOT = keccak256(abi.encodePacked("PAUSED_SLOT")); (DEPRECATED)
bytes32 constant PAUZER_SLOT = keccak256(abi.encodePacked("PAUZER_SLOT")); (DEPRECATED)
```

## Features
Expand Down Expand Up @@ -58,3 +58,29 @@ Modify network config in `buidler.config.ts` and add API key and private key, th
Add Etherscan API key to `buidler.config.ts`, then run:

`npx buidler verify-contract --contract-name Counter --address <DEPLOYED ADDRESS>`


### Interacting with the proxy

#### Changing the owner

The proxy owner is able to set the address of the implementation contract.
To change the proxy owner you can call this function from the current proxyOwner:

```
function setProxyOwner(address _newOwner) onlyProxyOwner public;
```

### Updating the implementation

To change the implementation contract you can call this function from the proxyOwner:

```
function setImplementation(address _newImplementation) onlyProxyOwner public;
```

### Considerations when upgrading implementations

When using a diamond standard contract often its not needed to upgrade the diamond but the upgrade can be carried out through upgrading the diamond facets.

When upgrading a "normal" contract you have to make sure to only append to the storage vars to not corrupt storage. Changing the inheritance can corrupt your storage.
2 changes: 1 addition & 1 deletion buidler.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ExtendedBuidlerConfig extends BuidlerConfig {
const config: ExtendedBuidlerConfig = {
defaultNetwork: "buidlerevm",
solc: {
version: "0.6.2"
version: "0.8.9"
},
networks: {
mainnet: {
Expand Down
2 changes: 1 addition & 1 deletion contracts/PProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.6.2;
pragma solidity ^0.8.0;

import "./PProxyStorage.sol";

Expand Down
48 changes: 0 additions & 48 deletions contracts/PProxyPausable.sol

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/PProxyStorage.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.6.2;
pragma solidity ^0.8.0;

contract PProxyStorage {

Expand Down Expand Up @@ -45,7 +45,7 @@ contract PProxyStorage {
}

function addressToBytes32(address _value) public pure returns(bytes32) {
return bytes32(uint256(_value));
return bytes32(uint256(uint160(_value)));
}

}
5 changes: 0 additions & 5 deletions contracts/interfaces/IPProxyOverrides.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/test/TestImplementation.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.6.2;
pragma solidity ^0.8.0;


contract TestImplementation {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@pie-dao/proxy",
"version": "0.0.6",
"version": "1.0.0",
"description": "Generic proxy pattern which can be used with any smart contract.",
"main": "index.js",
"scripts": {
"build": "npm run compile && npx buidler typechain",
"compile": "npx buidler compile",
"test": "npx buidler test",
"coverage": "npm run build && npx buidler coverage --temp artifacts --network coverage"
"coverage": "npm run build && npx buidler coverage --temp artifacts --network coverage",
"remix": "remixd -s . --remix-ide https://remix.ethereum.org"
},
"repository": {
"type": "git",
Expand All @@ -20,7 +21,6 @@
},
"homepage": "https://github.com/pie-dao/pie-proxy#readme",
"devDependencies": {
"@nomiclabs/buidler": "^1.1.2",
"@nomiclabs/buidler-ethers": "^1.1.2",
"@nomiclabs/buidler-etherscan": "^1.1.2",
"@nomiclabs/buidler-waffle": "^1.1.2",
Expand All @@ -41,6 +41,7 @@
"typescript": "^3.7.5"
},
"dependencies": {
"@nomiclabs/buidler": "1.3.0",
"dotenv": "^8.2.0"
},
"directories": {
Expand Down
Loading