You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/README.md
+25-28Lines changed: 25 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,68 +13,65 @@ These files will be used to programatically generate the proposal calldata for s
13
13
14
14
Make sure these files are up to date and approved by the Fei Core smart contracts team before continuing development.
15
15
16
-
###Updating Permissions
16
+
##Step 2 (Optional): Updating Permissions
17
17
If your proposal updates the access control permissions of a contract, you need to list/remove the address key in the appropriate sections of `/contract-addresses/permissions.json`
18
18
19
19
The key names are the same as the ones in `/contract-addresses/mainnet-addresses.json`
20
20
21
21
These permissiones are validated against on-chain state in the last e2e test
22
22
23
+
## Step 3: Proposal Mocking and Integration Test
24
+
Write a script following the template of `proposals/dao/fip_x.js`. See below for descriptions of each of the `deploy`, `setup`,`teardown`, and `validate` functions. Only `validate` is required.
23
25
24
-
## Optional Step 2: Does Proposal Require New Contract Deployments?
26
+
Add an object with the key `fip_x` to `end-to-end/proposals_config.json`,
25
27
26
-
Whether a deployment of a new instance of a pre-exisiting or new contract, if your proposal requires a new contract deployment you'll need to write a deploy script.
28
+
Your proposal will be run before any integration tests via `npm run test:e2e`. Fill in the following parameters:
29
+
* deploy - set to true only if you added a deploy script for your proposal in the optional step, otherwise false. This will run your deploy script before the integration tests and add the contract objects as keys in `contracts` parameter of each of the hooks.
30
+
* exec - When true, the e2e tests will run the actual proposal through the dao instead of the `run` hook which mocks the behavior. It imports the proposal steps from the `proposals/description/fip_x.json` file
27
31
28
-
See examples in the `deploy` folder, name your file `fip_x.js`
Whether a deployment of a new instance of a pre-exisiting or new contract, if your proposal requires a new contract deployment you'll need to write a deploy script.
29
34
30
-
The deploy script is automatically run before any e2e tests if it is present in the `end-to-end/proposals_config.json`. The contract objects will be present in the setup, run, teardown and validate hooks as keys in the `contracts` parameter.
35
+
The deploy script is automatically run before any e2e tests if the deploy flag is set to true in the `end-to-end/proposals_config.json`. The contract objects will be present in the setup, run, teardown and validate hooks as keys in the `contracts` parameter.
31
36
32
37
This is useful for fully testing the deploy script against a mainnet fork before deploying to mainnet.
33
38
34
-
To execute the deployment run:
35
-
* mainnet - `DEPLOY_FILE=fip_x npm run deploy:main`
36
-
* local - `DEPLOY_FILE=fip_x npm run deploy:localhost`
37
-
38
39
If your proposal requires new code additions to succeed, these need to be developed and reviewed. It should first be reviewed by the Fei Core smart contracts team and the team of any relevant integrations before sending to audit.
39
40
40
-
## Step 3: Proposal Mocking and Integration Test
41
-
Write a script following the template of `proposals/dao/fip_x.js`. The script should use the injected `addresses`, `contracts`, and `oldContracts` parameters to trigger the appropriate governor functions with the intended inputs.
41
+
### Step 3b (Optional): setup() - Pre-DAO steps
42
+
The setup hook should contain operational actions from third parties including any address impersonation that occur BEFORE the DAO proposal executes. See `test/helpers.ts#getImpersonatedSigner` and `test/helpers.ts#forceETH`.
43
+
44
+
The script should use the injected `addresses`, `contracts`, and `oldContracts` parameters to trigger the appropriate governor functions with the intended inputs.
42
45
43
46
*`addresses` contains a flat mapping of address names to addresses found in `contract-addresses/mainnetAddresses`
44
47
*`contracts` contains a flat mapping of contract names to contract objects using the specified artifact and contract from `contract-addresses/mainnetAddresses` AFTER all of the deploy and upgrade steps have taken place
45
48
46
49
*`oldContracts` contains a flat mapping of contract names to contract objects using the specified artifact and contract from `contract-addresses/mainnetAddresses` from BEFORE all of the deploy and upgrade steps have taken place, in case actions need to be taken on the prior versions of upgraded contracts
47
50
48
-
The setup, teardown, and validation hooks are used to compare the output of the dao script to the actual on-chain calldata proposed to the governor.
The teardown hook should contain operational actions from third parties including any address impersonation that occur AFTER the DAO proposal executes.
49
53
50
-
Add an object with the key `fip_x` to `end-to-end/proposals_config.json`,
54
+
Uses the same `addresses`, `contracts`, and `oldContracts` parameters as `setup()`.
51
55
52
-
Your proposal will be run before any integration tests via `npm run test:e2e`. Fill in the following parameters:
53
-
* deploy - set to true only if you added a deploy script for your proposal in the optional step, otherwise false. This will run your deploy script before the integration tests and add the contract objects as keys in `contracts` parameter of each of the hooks.
54
-
* exec - When true, the e2e tests will run the actual proposal through the dao instead of the `run` hook which mocks the behavior. It imports the proposal steps from the `proposals/description/fip_x.json` file
The validate hook should contain any invariant checks that all parameters, roles, and funds are as expected post-DAO and teardown.
58
+
59
+
Use the mocha testing assertions such as `expect()` to make sure errors fail loudly.
55
60
56
61
## Optional Step 4: Deploying and Updating Addresses
57
62
If your contract has an optional deployment step from above, you need to deploy your new contracts to mainnet before moving on to Step 5.
58
63
64
+
Run `DEPLOY_FILE=fip_x npm run deploy:fip`
65
+
59
66
Run your deploy script if you had one from step 2. Update `/contract-addresses/mainnet-addresses.json` with the new contract addresses.
60
67
61
68
Update the fork block inside the hardhat config and set the deploy flag to false in the config entry for `fip_x` in `end-to-end/proposals_config.json`
62
69
63
70
Finally rerun `npm run test:e2e` and make sure everything passes as expected.
64
71
65
-
## Step 5: Testing Exact Proposal
66
-
67
-
This script does a full end-to-end DAO proposal, vote, queue, and execution on the exact proposal to be submitted to the DAO.
68
-
69
-
The goal of this step is to compare the execution results of the calldata to the mock script from step 3. Any setup and teardown calls in the `proposals/dao/fip_x.js` file will still execute, but the run step is replaced by the execution of the proposal steps in `proposals/description/fip_x.json`.
70
-
71
-
Set the exec flag to true into the config entry for `fip_x` in `end-to-end/proposals_config.json`
72
-
73
-
Then run `npm run test:e2e`
74
-
75
-
## Step 6: Propose on-chain
72
+
## Step 5: Propose on-chain
76
73
Construct the calldata by running `DEPLOY_FILE=fip_x npm run calldata`
77
74
78
-
Send a transaction to the Fei DAO (0xE087F94c3081e1832dC7a22B48c6f2b5fAaE579B) using the calldata
75
+
Send a transaction to the Fei DAO [0x0BEF27FEB58e857046d630B2c03dFb7bae567494](https://etherscan.io/address/0x0bef27feb58e857046d630b2c03dfb7bae567494) using the calldata
79
76
80
77
Verify on https://www.withtally.com/governance/fei/ that your proposal submitted and everything looks as expected
0 commit comments