@gooddollar/goodprotocol 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hardhat.config.ts +8 -5
- package/package.json +2 -1
- package/releases/deployment.json +64 -58
- package/scripts/deployFullDAO.ts +90 -46
- package/scripts/test/simulateInterest.ts +3 -3
- package/scripts/upgradeToV2/upgradeToV2.ts +49 -32
- package/yarn.lock +14 -0
package/hardhat.config.ts
CHANGED
|
@@ -117,19 +117,22 @@ const hhconfig: HardhatUserConfig = {
|
|
|
117
117
|
"fuse-mainnet": {
|
|
118
118
|
accounts: { mnemonic },
|
|
119
119
|
url: "https://ropsten.infura.io/v3/" + infura_api,
|
|
120
|
-
|
|
120
|
+
gasPrice: 20000000000,
|
|
121
|
+
gas: 5000000,
|
|
121
122
|
chainId: 3
|
|
122
123
|
},
|
|
123
124
|
staging: {
|
|
124
125
|
accounts: { mnemonic },
|
|
125
126
|
url: "https://rpc.fuse.io/",
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
chainId: 122,
|
|
128
|
+
gas: 6000000,
|
|
129
|
+
gasPrice: 1000000000
|
|
128
130
|
},
|
|
129
131
|
"staging-mainnet": {
|
|
130
132
|
accounts: { mnemonic },
|
|
131
133
|
url: "https://ropsten.infura.io/v3/" + infura_api,
|
|
132
|
-
|
|
134
|
+
gasPrice: 20000000000,
|
|
135
|
+
gas: 5000000,
|
|
133
136
|
chainId: 3
|
|
134
137
|
},
|
|
135
138
|
production: {
|
|
@@ -143,7 +146,7 @@ const hhconfig: HardhatUserConfig = {
|
|
|
143
146
|
accounts: [deployerPrivateKey],
|
|
144
147
|
url: "https://mainnet.infura.io/v3/" + infura_api,
|
|
145
148
|
gas: 3000000,
|
|
146
|
-
gasPrice:
|
|
149
|
+
gasPrice: 50000000000,
|
|
147
150
|
chainId: 1
|
|
148
151
|
}
|
|
149
152
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "scripts/build.sh deploy",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"ethers-multicall": "^0.2.1",
|
|
61
61
|
"openzeppelin-solidity": "^4.3.2",
|
|
62
62
|
"patch-package": "latest",
|
|
63
|
+
"press-any-key": "^0.1.1",
|
|
63
64
|
"truffle-plugin-verify": "^0.5.11",
|
|
64
65
|
"truffle-source-verify": "^0.0.6"
|
|
65
66
|
},
|
package/releases/deployment.json
CHANGED
|
@@ -146,41 +146,42 @@
|
|
|
146
146
|
"COMP": "0x0000000000000000000000000000000000000000"
|
|
147
147
|
},
|
|
148
148
|
"fuse-mainnet": {
|
|
149
|
-
"NameService": "
|
|
150
|
-
"GReputation": "
|
|
151
|
-
"CompoundVotingMachine": "
|
|
152
|
-
"GoodMarketMaker": "
|
|
153
|
-
"GoodReserveCDai": "
|
|
154
|
-
"ExchangeHelper": "
|
|
155
|
-
"GoodFundManager": "
|
|
156
|
-
"StakersDistribution": "
|
|
157
|
-
"ProtocolUpgrade": "
|
|
158
|
-
"CompoundStakingFactory": "
|
|
149
|
+
"NameService": "0x3baeEff20Cb02a5b8eF413C611c015E69221663e",
|
|
150
|
+
"GReputation": "0x30A5Ba8ED4864bf3B1fa30c78Ac774fA9D5C62CC",
|
|
151
|
+
"CompoundVotingMachine": "0xE2C57968b52A417132511fBDCAB1763D41a4F270",
|
|
152
|
+
"GoodMarketMaker": "0xD2cf3205EA36AEFf3CF0e8e8701EAe40AA3f6E4F",
|
|
153
|
+
"GoodReserveCDai": "0x2AEe03Bb8b182AF876B9d008AF9416D2A3dF6dB3",
|
|
154
|
+
"ExchangeHelper": "0xeFF1EfCf1F0247f82B0d8406f32831b00Bfdf729",
|
|
155
|
+
"GoodFundManager": "0x3419945657B6Bd89DaFD7F2bafC75FF46511298F",
|
|
156
|
+
"StakersDistribution": "0xe8C67A909d3231ddD97E4CC2c1B17a8FFA94475E",
|
|
157
|
+
"ProtocolUpgrade": "0x1a521868ED7B4d8835f1F52172d38C1C3e630E92",
|
|
158
|
+
"CompoundStakingFactory": "0xE1193dE8716400ee5aD7b4B96CBdf0dABaF7d088",
|
|
159
159
|
"StakingContracts": [
|
|
160
160
|
[
|
|
161
|
-
"
|
|
161
|
+
"0x98867484E2F0c902F64bCdEDc2e289307c988214",
|
|
162
162
|
13888
|
|
163
163
|
]
|
|
164
164
|
],
|
|
165
|
-
"DonationsStaking": "
|
|
166
|
-
"Contribution": "
|
|
165
|
+
"DonationsStaking": "0x2aAd517DE8256ee6DC7ce31Ae09EBb99F17F9975",
|
|
166
|
+
"Contribution": "0x2250c5131bf9DdCbD55F9bEFc999D691c419ad93",
|
|
167
167
|
"DAI": "0xB5E5D0F8C0cbA267CD3D7035d6AdC8eBA7Df7Cdd",
|
|
168
168
|
"cDAI": "0x6ce27497a64fffb5517aa4aee908b1e7eb63b9ff",
|
|
169
|
-
"ForeignBridge": "
|
|
170
|
-
"GoodDollar": "
|
|
169
|
+
"ForeignBridge": "0x18F2a22Aa6420D06C079e70838a21a3c75322834",
|
|
170
|
+
"GoodDollar": "0x22A4720e32e3419e809731E7114042D6C3055845",
|
|
171
171
|
"Reputation": "0x5925F6Bf62147D2b14B85e6dCB979e3D1A81Dbb1",
|
|
172
|
-
"Identity": "
|
|
173
|
-
"Avatar": "
|
|
174
|
-
"Controller": "
|
|
172
|
+
"Identity": "0x4D347bda25BEf041BfCB5205deECD1A33ab46db9",
|
|
173
|
+
"Avatar": "0x11655e9D725Fc1f8D1410C03f136aC586f7161ee",
|
|
174
|
+
"Controller": "0xD458BAEC7E8864A2c9c2e1261D87A4FAf77002B7",
|
|
175
175
|
"AbsoluteVote": "0x57312053C36A226Df13B01089218A5f9951D3f9c",
|
|
176
176
|
"ProxyAdmin": "0xE383e9D08e3e4f76CBb4a6953aF343E7bbcc6e98",
|
|
177
177
|
"COMP": "0xf76d4a441e4ba86a923ce32b89aff89dbccaa075",
|
|
178
178
|
"network": "fuse-mainnet",
|
|
179
179
|
"networkId": 3,
|
|
180
180
|
"ProxyFactory": "0x163b69fA3a7d3e5347a29A5A49b282c35d17C87A",
|
|
181
|
-
"UniswapV2SwapHelper": "
|
|
182
|
-
"AaveStakingFactory": "
|
|
183
|
-
"BancorFormula": "0x57b2c85934Ef1A891eC9b9945f3fdbcf1104c302"
|
|
181
|
+
"UniswapV2SwapHelper": "0x28b3Bc8F2a1E5cf3BfE06d22971955a53a0F52d8",
|
|
182
|
+
"AaveStakingFactory": "0xfC32F09b85aB3134195bC237C2b69001B5c609dB",
|
|
183
|
+
"BancorFormula": "0x57b2c85934Ef1A891eC9b9945f3fdbcf1104c302",
|
|
184
|
+
"FeeFormula": "0x416B5A5e12235De6838D62Fd053e7Ce59E944426"
|
|
184
185
|
},
|
|
185
186
|
"dapptest": {
|
|
186
187
|
"NameService": "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc",
|
|
@@ -242,65 +243,70 @@
|
|
|
242
243
|
"network": "dapptest-mainnet"
|
|
243
244
|
},
|
|
244
245
|
"staging-mainnet": {
|
|
245
|
-
"NameService": "
|
|
246
|
-
"GReputation": "
|
|
247
|
-
"CompoundVotingMachine": "
|
|
248
|
-
"GoodMarketMaker": "
|
|
249
|
-
"GoodReserveCDai": "
|
|
250
|
-
"ExchangeHelper": "
|
|
251
|
-
"GoodFundManager": "
|
|
252
|
-
"StakersDistribution": "
|
|
253
|
-
"ProtocolUpgrade": "
|
|
254
|
-
"UniswapV2SwapHelper": "
|
|
255
|
-
"CompoundStakingFactory": "
|
|
256
|
-
"AaveStakingFactory": "
|
|
257
|
-
"DonationsStaking": "
|
|
246
|
+
"NameService": "0xC87FAb8A8CDD346079ca6177e47408Ba18066104",
|
|
247
|
+
"GReputation": "0xD50604E530fF36B2747aE8574b37B21B9f779d37",
|
|
248
|
+
"CompoundVotingMachine": "0x40f42698A07B19Ac431Cc115a7B9CddD294d248b",
|
|
249
|
+
"GoodMarketMaker": "0x78a76Ad9A5d4a1d0c9FABcA20083442160840d0C",
|
|
250
|
+
"GoodReserveCDai": "0x6D728DE2Be4b3d7c6B50E6F3bF46CA1F64dF7820",
|
|
251
|
+
"ExchangeHelper": "0x6BC7a1310DfE3EfE7401Aff3C598C9d948f8b245",
|
|
252
|
+
"GoodFundManager": "0x1A231e22BE9923EE4C453095A7a94820D930A553",
|
|
253
|
+
"StakersDistribution": "0xF24Ef005134208Ac62aD50EafD052Ddb2C3e7bb5",
|
|
254
|
+
"ProtocolUpgrade": "0xC60411d3Bc9F36946a6de1f3890c214192255497",
|
|
255
|
+
"UniswapV2SwapHelper": "0x24D19000790fD11e244E76fA4D86FDd92e57c144",
|
|
256
|
+
"CompoundStakingFactory": "0xf22EF80a76f41424b813C9b38b3064dBfa87cf79",
|
|
257
|
+
"AaveStakingFactory": "0x9093B908b35C08f2E8DEABA352D5C319952a7e55",
|
|
258
|
+
"DonationsStaking": "0x66Fb63cB6c4E2800db9d1691B3d00361Ada9dE61",
|
|
258
259
|
"network": "staging-mainnet",
|
|
259
260
|
"networkId": 3,
|
|
260
|
-
"ForeignBridge": "
|
|
261
|
-
"Contribution": "
|
|
261
|
+
"ForeignBridge": "0xDaAc9A734242C2D99dD1cb3680770ACA26A25CeB",
|
|
262
|
+
"Contribution": "0x27816e32270a413AF676A2E3a25dB93C7F565a80",
|
|
262
263
|
"StakingContracts": [
|
|
263
264
|
[
|
|
264
265
|
"0x61b36EcaEd25c4EE3017905B5Dd006129a4dfb0B",
|
|
265
266
|
13888
|
|
266
267
|
]
|
|
267
268
|
],
|
|
268
|
-
"Identity": "
|
|
269
|
-
"GoodDollar": "
|
|
270
|
-
"Controller": "
|
|
271
|
-
"Avatar": "
|
|
269
|
+
"Identity": "0x7599F95677cb14d7D8834a58B3b0545a13870A56",
|
|
270
|
+
"GoodDollar": "0x2e975e7711088aAfb38119454fF7fb99bAA9142F",
|
|
271
|
+
"Controller": "0x52F0584bfB6F55cc4a3E351427fACbA7e23A3fd4",
|
|
272
|
+
"Avatar": "0xFCF6029bD177370C79173D48e05AAFf3c5f0C0bC",
|
|
272
273
|
"BancorFormula": "0x57b2c85934Ef1A891eC9b9945f3fdbcf1104c302",
|
|
273
274
|
"DAI": "0xB5E5D0F8C0cbA267CD3D7035d6AdC8eBA7Df7Cdd",
|
|
274
275
|
"cDAI": "0x6ce27497a64fffb5517aa4aee908b1e7eb63b9ff",
|
|
275
276
|
"COMP": "0xf76d4a441e4ba86a923ce32b89aff89dbccaa075",
|
|
276
|
-
"ProxyFactory": "
|
|
277
|
+
"ProxyFactory": "0x33D3712b90ade5d7363F3548650e508ad8eACfAA",
|
|
278
|
+
"FeeFormula": "0xc43514e62190A6253C56C7c50DAdb907e3eda666"
|
|
277
279
|
},
|
|
278
280
|
"staging": {
|
|
279
|
-
"FuseFaucet": "
|
|
281
|
+
"FuseFaucet": "0x70f361EDB97B245E8A68573637A31886A427fe2a",
|
|
280
282
|
"ProxyAdmin": "0x2Ea4aAA8351CfE63B537E81Cd4a13c435B945C1D",
|
|
281
|
-
"Invites": "
|
|
283
|
+
"Invites": "0x763b49F901DC894F2dEc1c7d19e46250B4452679",
|
|
282
284
|
"ProxyAdmin2": "0x23D8492444DA663fcb2bDa8cA9A0e84989D1f59e",
|
|
283
|
-
"GoodDollar": "
|
|
284
|
-
"NameService": "
|
|
285
|
-
"GReputation": "
|
|
286
|
-
"CompoundVotingMachine": "
|
|
287
|
-
"ClaimersDistribution": "
|
|
288
|
-
"GovernanceStaking": "
|
|
289
|
-
"UBIScheme": "
|
|
290
|
-
"ProtocolUpgradeFuse": "
|
|
291
|
-
"Identity": "
|
|
292
|
-
"Avatar": "
|
|
293
|
-
"Controller": "
|
|
285
|
+
"GoodDollar": "0xe39236a9Cf13f65DB8adD06BD4b834C65c523d2b",
|
|
286
|
+
"NameService": "0xE63402A7dc11AB4D03c477cc92209463a55A5134",
|
|
287
|
+
"GReputation": "0x80312bad9dd71d3a159e794B7fb1B2386F82F07F",
|
|
288
|
+
"CompoundVotingMachine": "0xcF624DfdA707De7C7a5669A472F81dAc130264c3",
|
|
289
|
+
"ClaimersDistribution": "0x86d43F93eD9AD1182981C19567f83BAc1DC1513B",
|
|
290
|
+
"GovernanceStaking": "0x18525875Bd0259d3efE1c04927A027fAd8cA0b86",
|
|
291
|
+
"UBIScheme": "0x54469071Ca82B46A2C01C09D38ca6Ca4347EB21d",
|
|
292
|
+
"ProtocolUpgradeFuse": "0x1495D6f5434376981778F64c63d2E15dA25B0541",
|
|
293
|
+
"Identity": "0x0af5eF8cdCeddDD9033cEf1E83B0Ae54f3a793A5",
|
|
294
|
+
"Avatar": "0x28523b680d4ffBd6e4FC95c3c12F5485F9635E00",
|
|
295
|
+
"Controller": "0xb6808120fB648c0bdc483Ec423d933a7eBf6BB0a",
|
|
294
296
|
"AbsoluteVote": "0x7b58A5737440Bc05ca3972fDeFf8ac3bA984536B",
|
|
295
297
|
"SchemeRegistrar": "0x0E79f80809180aB8FAE189D4e76fC814672d9a40",
|
|
296
|
-
"AdminWallet": "
|
|
298
|
+
"AdminWallet": "0x2961a6C2Fe39F0FFC4f4b1D9E037CD95f4e9C993",
|
|
297
299
|
"UpgradeScheme": "0xfC9F6F5E3ff7BAAB3fEf82e66f56917D625ba38B",
|
|
298
|
-
"OneTimePayments": "
|
|
300
|
+
"OneTimePayments": "0x7912636D68E5d92708862b38698f764BF1EC297C",
|
|
299
301
|
"network": "staging",
|
|
300
302
|
"networkId": 122,
|
|
301
303
|
"ProxyFactory": "0x240d844AdA767bE0AB08F9BcCcB6D8a04aE370EC",
|
|
302
|
-
"HomeBridge": "
|
|
303
|
-
"FirstClaimPool": "
|
|
304
|
+
"HomeBridge": "0x3B25860174ECb3a0962bA3A5065b1f4063253419",
|
|
305
|
+
"FirstClaimPool": "0x5D007A7633D05b0dDD068B71E8448CD1fcdbd823",
|
|
306
|
+
"FeeFormula": "0x05eb1C46bd539Fd2A098b06D83a5bB81E5a58e63",
|
|
307
|
+
"DAI": "0x0000000000000000000000000000000000000000",
|
|
308
|
+
"cDAI": "0x0000000000000000000000000000000000000000",
|
|
309
|
+
"COMP": "0x0000000000000000000000000000000000000000"
|
|
304
310
|
},
|
|
305
311
|
"test": {
|
|
306
312
|
"ProxyFactory": "0x36dE29DB57062A583436Ae071e141404dFE2311C",
|
package/scripts/deployFullDAO.ts
CHANGED
|
@@ -22,6 +22,7 @@ import ProtocolSettings from "../releases/deploy-settings.json";
|
|
|
22
22
|
import dao from "../releases/deployment.json";
|
|
23
23
|
import { main as deployV2 } from "./upgradeToV2/upgradeToV2";
|
|
24
24
|
import { TransactionResponse } from "@ethersproject/providers";
|
|
25
|
+
import pressAnyKey from "press-any-key";
|
|
25
26
|
|
|
26
27
|
const { name } = network;
|
|
27
28
|
|
|
@@ -41,6 +42,9 @@ const printDeploy = async (
|
|
|
41
42
|
|
|
42
43
|
export const createDAO = async () => {
|
|
43
44
|
const fusedao = dao[network.name.split("-")[0]];
|
|
45
|
+
let release: { [key: string]: any } = {};
|
|
46
|
+
// let release: { [key: string]: any } = dao[network.name];
|
|
47
|
+
|
|
44
48
|
let [root, ...signers] = await ethers.getSigners();
|
|
45
49
|
//generic call permissions
|
|
46
50
|
let schemeMock = root;
|
|
@@ -79,7 +83,9 @@ export const createDAO = async () => {
|
|
|
79
83
|
|
|
80
84
|
const BancorFormula = (await (
|
|
81
85
|
await ethers.getContractFactory("BancorFormula")
|
|
82
|
-
)
|
|
86
|
+
)
|
|
87
|
+
.deploy()
|
|
88
|
+
.then(printDeploy)) as Contract;
|
|
83
89
|
|
|
84
90
|
const AddFounders = (await AddFoundersFactory.deploy().then(
|
|
85
91
|
printDeploy
|
|
@@ -94,7 +100,7 @@ export const createDAO = async () => {
|
|
|
94
100
|
)) as Contract;
|
|
95
101
|
// const Identity = await ethers.getContractAt(
|
|
96
102
|
// IdentityABI.abi,
|
|
97
|
-
//
|
|
103
|
+
// release.Identity
|
|
98
104
|
// );
|
|
99
105
|
|
|
100
106
|
const daoCreator = (await DAOCreatorFactory.deploy(AddFounders.address).then(
|
|
@@ -129,6 +135,15 @@ export const createDAO = async () => {
|
|
|
129
135
|
root
|
|
130
136
|
);
|
|
131
137
|
|
|
138
|
+
// const Avatar = new ethers.Contract(
|
|
139
|
+
// release.Avatar,
|
|
140
|
+
// [
|
|
141
|
+
// "function owner() view returns (address)",
|
|
142
|
+
// "function nativeToken() view returns (address)"
|
|
143
|
+
// ],
|
|
144
|
+
// root
|
|
145
|
+
// );
|
|
146
|
+
|
|
132
147
|
await Identity.setAvatar(Avatar.address).then(printDeploy);
|
|
133
148
|
|
|
134
149
|
console.log("Done deploying DAO, setting schemes permissions");
|
|
@@ -158,13 +173,22 @@ export const createDAO = async () => {
|
|
|
158
173
|
);
|
|
159
174
|
|
|
160
175
|
let mainnet: { [key: string]: Contract } = {};
|
|
176
|
+
release = {
|
|
177
|
+
...release,
|
|
178
|
+
Avatar: Avatar.address,
|
|
179
|
+
Controller: controller,
|
|
180
|
+
GoodDollar: gd,
|
|
181
|
+
Identity: Identity.address,
|
|
182
|
+
FeeFormula: FeeFormula.address
|
|
183
|
+
};
|
|
161
184
|
|
|
162
185
|
if (isMainnet) {
|
|
163
186
|
mainnet = await deployMainnet(Avatar, Identity);
|
|
187
|
+
Object.entries(mainnet).forEach(([k, v]) => (release[k] = v.address));
|
|
164
188
|
}
|
|
165
189
|
|
|
166
190
|
let sidechain: { [key: string]: any } = {};
|
|
167
|
-
|
|
191
|
+
|
|
168
192
|
if (false === isMainnet) {
|
|
169
193
|
sidechain = await deploySidechain(
|
|
170
194
|
setSchemes,
|
|
@@ -175,25 +199,23 @@ export const createDAO = async () => {
|
|
|
175
199
|
);
|
|
176
200
|
schemes.push(sidechain.OneTimePayments.address);
|
|
177
201
|
const adminWallet = await deployAdminWallet(Identity.address);
|
|
178
|
-
await root
|
|
179
|
-
.sendTransaction({
|
|
180
|
-
to: adminWallet.address,
|
|
181
|
-
value: ethers.utils.parseUnits("0.1", "ether")
|
|
182
|
-
})
|
|
183
|
-
.then(printDeploy);
|
|
184
202
|
Object.entries(sidechain).forEach(([k, v]) => (release[k] = v.address));
|
|
185
203
|
release["AdminWallet"] = adminWallet.address;
|
|
186
204
|
}
|
|
187
205
|
|
|
206
|
+
await releaser(release, network.name);
|
|
207
|
+
|
|
188
208
|
const bridgeRelease = await deployBridge(Avatar, gd, setSchemes, isMainnet);
|
|
189
209
|
release = { ...release, ...bridgeRelease };
|
|
210
|
+
await releaser(release, network.name);
|
|
190
211
|
|
|
191
|
-
|
|
212
|
+
await pressAnyKey();
|
|
213
|
+
// deploy v2 mainnet/sidechain contracts, returns their addresses
|
|
192
214
|
const v2 = await deployV2(network.name, false, {
|
|
193
|
-
FirstClaimPool:
|
|
194
|
-
BancorFormula: BancorFormula
|
|
195
|
-
Avatar: Avatar
|
|
196
|
-
Controller:
|
|
215
|
+
FirstClaimPool: release.FirstClaimPool,
|
|
216
|
+
BancorFormula: release.BancorFormula,
|
|
217
|
+
Avatar: release.Avatar,
|
|
218
|
+
Controller: release.Controller,
|
|
197
219
|
DAIUsdOracle: ethers.constants.AddressZero,
|
|
198
220
|
COMPUsdOracle: ethers.constants.AddressZero,
|
|
199
221
|
USDCUsdOracle: ethers.constants.AddressZero,
|
|
@@ -201,20 +223,22 @@ export const createDAO = async () => {
|
|
|
201
223
|
AaveLendingPool: ethers.constants.AddressZero,
|
|
202
224
|
AaveIncentiveController: ethers.constants.AddressZero,
|
|
203
225
|
GasPriceOracle: ethers.constants.AddressZero,
|
|
204
|
-
cDAI:
|
|
205
|
-
DAI:
|
|
206
|
-
COMP:
|
|
226
|
+
cDAI: release.cDAI || ethers.constants.AddressZero,
|
|
227
|
+
DAI: release.DAI || ethers.constants.AddressZero,
|
|
228
|
+
COMP: release.COMP || ethers.constants.AddressZero,
|
|
207
229
|
USDC: ethers.constants.AddressZero,
|
|
208
|
-
Identity: Identity
|
|
209
|
-
GoodDollar:
|
|
210
|
-
Contribution:
|
|
230
|
+
Identity: release.Identity,
|
|
231
|
+
GoodDollar: release.GoodDollar,
|
|
232
|
+
Contribution: release.Contribution,
|
|
211
233
|
UniswapRouter: "0x0000000000000000000000000000000000000001",
|
|
212
|
-
|
|
234
|
+
HomeBridge: release.HomeBridge,
|
|
235
|
+
ForeignBridge: release.ForeignBridge,
|
|
213
236
|
SchemeRegistrar: ethers.constants.AddressZero,
|
|
214
237
|
UpgradeScheme: ethers.constants.AddressZero
|
|
215
238
|
});
|
|
216
239
|
release = { ...v2, ...release };
|
|
217
|
-
|
|
240
|
+
await releaser(release, network.name);
|
|
241
|
+
await pressAnyKey();
|
|
218
242
|
if (isMainnet) {
|
|
219
243
|
await setSchemes([release.ProtocolUpgrade]);
|
|
220
244
|
await performUpgrade(release, fusedao.UBIScheme);
|
|
@@ -233,28 +257,16 @@ export const createDAO = async () => {
|
|
|
233
257
|
|
|
234
258
|
if (false === isMainnet) {
|
|
235
259
|
let encoded = (
|
|
236
|
-
await ethers.getContractAt("IGoodDollar",
|
|
260
|
+
await ethers.getContractAt("IGoodDollar", release.GoodDollar)
|
|
237
261
|
).interface.encodeFunctionData("mint", [release.UBIScheme, 1000000]);
|
|
238
262
|
|
|
239
|
-
await genericCall(
|
|
263
|
+
await genericCall(release.GoodDollar, encoded);
|
|
240
264
|
|
|
241
265
|
await setSchemes([release.ProtocolUpgradeFuse]);
|
|
242
266
|
await performUpgradeFuse(release);
|
|
243
267
|
}
|
|
244
268
|
|
|
245
269
|
await releaser(release, network.name);
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
...mainnet,
|
|
249
|
-
...sidechain,
|
|
250
|
-
daoCreator,
|
|
251
|
-
controller,
|
|
252
|
-
avatar: await daoCreator.avatar(),
|
|
253
|
-
gd: await Avatar.nativeToken(),
|
|
254
|
-
identity: Identity.address,
|
|
255
|
-
bancorFormula: BancorFormula.address
|
|
256
|
-
// bridge: Bridge.address,
|
|
257
|
-
};
|
|
258
270
|
};
|
|
259
271
|
|
|
260
272
|
const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
|
|
@@ -281,7 +293,7 @@ const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
|
|
|
281
293
|
.then(printDeploy)) as Contract;
|
|
282
294
|
await setSchemes([scheme.address]);
|
|
283
295
|
|
|
284
|
-
if (network.name.includes("develop")) {
|
|
296
|
+
if (network.name.includes("develop") || network.name.includes("dapptest")) {
|
|
285
297
|
const mockBridge = (await new ethers.ContractFactory(
|
|
286
298
|
BridgeMock.abi,
|
|
287
299
|
BridgeMock.bytecode,
|
|
@@ -318,7 +330,7 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
318
330
|
const cdaiAddr = ProtocolSettings[network.name]?.compound?.cdai;
|
|
319
331
|
const COMPAddr = ProtocolSettings[network.name]?.compound?.comp;
|
|
320
332
|
|
|
321
|
-
let
|
|
333
|
+
let DAI = daiAddr
|
|
322
334
|
? await ethers.getContractAt("DAIMock", daiAddr)
|
|
323
335
|
: ((await daiFactory.deploy().then(printDeploy)) as Contract);
|
|
324
336
|
|
|
@@ -328,7 +340,7 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
328
340
|
|
|
329
341
|
let cDAI = cdaiAddr
|
|
330
342
|
? await ethers.getContractAt("DAIMock", cdaiAddr)
|
|
331
|
-
: ((await cdaiFactory.deploy(
|
|
343
|
+
: ((await cdaiFactory.deploy(DAI.address).then(printDeploy)) as Contract);
|
|
332
344
|
|
|
333
345
|
const ccFactory = new ethers.ContractFactory(
|
|
334
346
|
ContributionCalculation.abi,
|
|
@@ -336,7 +348,7 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
336
348
|
root
|
|
337
349
|
);
|
|
338
350
|
|
|
339
|
-
const
|
|
351
|
+
const Contribution = (await ccFactory
|
|
340
352
|
.deploy(Avatar.address, 0, 1e15)
|
|
341
353
|
.then(printDeploy)) as Contract;
|
|
342
354
|
// const contribution = await ethers.getContractAt(
|
|
@@ -345,8 +357,8 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
345
357
|
// );
|
|
346
358
|
|
|
347
359
|
return {
|
|
348
|
-
|
|
349
|
-
|
|
360
|
+
Contribution,
|
|
361
|
+
DAI,
|
|
350
362
|
COMP,
|
|
351
363
|
cDAI
|
|
352
364
|
};
|
|
@@ -416,6 +428,13 @@ export const deploySidechain = async (
|
|
|
416
428
|
.deployProxy(faucetf, [identity])
|
|
417
429
|
.then(printDeploy)) as Contract;
|
|
418
430
|
|
|
431
|
+
await root
|
|
432
|
+
.sendTransaction({
|
|
433
|
+
to: faucet.address,
|
|
434
|
+
value: ethers.utils.parseEther("5")
|
|
435
|
+
})
|
|
436
|
+
.then(printDeploy);
|
|
437
|
+
|
|
419
438
|
console.log("setting firstclaim and otp schemes...");
|
|
420
439
|
await setSchemes([firstClaim.address, otp.address]);
|
|
421
440
|
await firstClaim.start().then(printDeploy);
|
|
@@ -554,10 +573,35 @@ const performUpgrade = async (release, ubiScheme) => {
|
|
|
554
573
|
console.log("performing protocol v2 upgrade on Mainnet...", {
|
|
555
574
|
release
|
|
556
575
|
});
|
|
557
|
-
console.log(
|
|
576
|
+
console.log(
|
|
577
|
+
"upgrading nameservice + staking rewards...",
|
|
578
|
+
release.NameService,
|
|
579
|
+
[
|
|
580
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("RESERVE")),
|
|
581
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MARKET_MAKER")),
|
|
582
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("FUND_MANAGER")),
|
|
583
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
584
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKERS")),
|
|
585
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
586
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBI_RECIPIENT")),
|
|
587
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("EXCHANGE_HELPER"))
|
|
588
|
+
],
|
|
589
|
+
[
|
|
590
|
+
release.GoodReserveCDai,
|
|
591
|
+
release.GoodMarketMaker,
|
|
592
|
+
release.GoodFundManager,
|
|
593
|
+
release.GReputation,
|
|
594
|
+
release.StakersDistribution,
|
|
595
|
+
release.ForeignBridge || ethers.constants.AddressZero,
|
|
596
|
+
ubiScheme,
|
|
597
|
+
release.ExchangeHelper
|
|
598
|
+
],
|
|
599
|
+
release.StakingContracts.map((_: any) => _[0]),
|
|
600
|
+
release.StakingContracts.map((_: any) => _[1])
|
|
601
|
+
);
|
|
558
602
|
let tx;
|
|
559
|
-
tx = await
|
|
560
|
-
|
|
603
|
+
tx = await upgrade
|
|
604
|
+
.upgradeBasic(
|
|
561
605
|
release.NameService,
|
|
562
606
|
[
|
|
563
607
|
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("RESERVE")),
|
|
@@ -582,7 +626,7 @@ const performUpgrade = async (release, ubiScheme) => {
|
|
|
582
626
|
release.StakingContracts.map((_: any) => _[0]),
|
|
583
627
|
release.StakingContracts.map((_: any) => _[1])
|
|
584
628
|
)
|
|
585
|
-
|
|
629
|
+
.then(printDeploy);
|
|
586
630
|
|
|
587
631
|
console.log("upgrading reserve...", {
|
|
588
632
|
params: [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fse from "fs-extra";
|
|
2
2
|
import { ethers, network as networkData } from "hardhat";
|
|
3
|
-
import settings from "
|
|
4
|
-
import deployment from "
|
|
5
|
-
import { increaseTime, advanceBlocks } from "
|
|
3
|
+
import settings from "../../releases/deploy-settings.json";
|
|
4
|
+
import deployment from "../../releases/deployment.json";
|
|
5
|
+
import { increaseTime, advanceBlocks } from "../../test/helpers";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* helper script to simulate enough days of interest transfer and claiming
|
|
@@ -11,7 +11,7 @@ import { network, ethers, upgrades, run } from "hardhat";
|
|
|
11
11
|
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
12
12
|
import { isFunction, get, omitBy } from "lodash";
|
|
13
13
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
14
|
-
|
|
14
|
+
import pressAnyKey from "press-any-key";
|
|
15
15
|
import {
|
|
16
16
|
AaveStakingFactory,
|
|
17
17
|
CompoundStakingFactory,
|
|
@@ -80,6 +80,12 @@ export const main = async (
|
|
|
80
80
|
gasLimit: 6000000,
|
|
81
81
|
gasPrice: ethers.utils.parseUnits("1", "gwei")
|
|
82
82
|
};
|
|
83
|
+
} else if (network.config.chainId === 3 || network.config.chainId === 42) {
|
|
84
|
+
GAS_SETTINGS = {
|
|
85
|
+
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
|
|
86
|
+
maxFeePerGas: ethers.utils.parseUnits("10", "gwei"),
|
|
87
|
+
gasLimit: 6000000
|
|
88
|
+
};
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
const isBackendTest = networkName.startsWith("dapptest");
|
|
@@ -619,7 +625,7 @@ export const main = async (
|
|
|
619
625
|
dao.Reserve,
|
|
620
626
|
dao.MarketMaker,
|
|
621
627
|
dao.FundManager,
|
|
622
|
-
|
|
628
|
+
release.COMP
|
|
623
629
|
]
|
|
624
630
|
});
|
|
625
631
|
tx = await upgrade.upgradeReserve(
|
|
@@ -627,7 +633,8 @@ export const main = async (
|
|
|
627
633
|
dao.Reserve,
|
|
628
634
|
dao.MarketMaker,
|
|
629
635
|
dao.FundManager,
|
|
630
|
-
|
|
636
|
+
release.COMP,
|
|
637
|
+
GAS_SETTINGS
|
|
631
638
|
);
|
|
632
639
|
await countTotalGas(tx, "call upgrade reserve");
|
|
633
640
|
console.log("upgrading donationstaking...", {
|
|
@@ -641,7 +648,8 @@ export const main = async (
|
|
|
641
648
|
release.NameService,
|
|
642
649
|
dao.DonationsStaking, //old
|
|
643
650
|
release.DonationsStaking, //new
|
|
644
|
-
dao.DAIStaking
|
|
651
|
+
dao.DAIStaking,
|
|
652
|
+
GAS_SETTINGS
|
|
645
653
|
);
|
|
646
654
|
await countTotalGas(tx, "call upgrade donations");
|
|
647
655
|
console.log("Donation staking upgraded");
|
|
@@ -671,31 +679,34 @@ export const main = async (
|
|
|
671
679
|
)) as unknown as ProtocolUpgradeFuse;
|
|
672
680
|
|
|
673
681
|
console.log("performing protocol v2 upgrade on Fuse...", { release, dao });
|
|
674
|
-
await upgrade
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
[
|
|
685
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
686
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
687
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
688
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
689
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
690
|
-
],
|
|
691
|
-
[
|
|
692
|
-
release.GReputation,
|
|
693
|
-
dao.HomeBridge,
|
|
682
|
+
await upgrade
|
|
683
|
+
.upgrade(
|
|
684
|
+
release.NameService,
|
|
685
|
+
//old contracts
|
|
686
|
+
[
|
|
687
|
+
dao.SchemeRegistrar || ethers.constants.AddressZero,
|
|
688
|
+
dao.UpgradeScheme,
|
|
689
|
+
dao.UBIScheme,
|
|
690
|
+
dao.FirstClaimPool
|
|
691
|
+
],
|
|
694
692
|
release.UBIScheme,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
693
|
+
[
|
|
694
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
695
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
696
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
697
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
698
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
699
|
+
],
|
|
700
|
+
[
|
|
701
|
+
release.GReputation,
|
|
702
|
+
dao.HomeBridge,
|
|
703
|
+
release.UBIScheme,
|
|
704
|
+
release.GovernanceStaking,
|
|
705
|
+
release.ClaimersDistribution
|
|
706
|
+
],
|
|
707
|
+
GAS_SETTINGS
|
|
708
|
+
)
|
|
709
|
+
.then(_ => countTotalGas(_, "fuse basic upgrade"));
|
|
699
710
|
|
|
700
711
|
if (isProduction || isBackendTest) {
|
|
701
712
|
console.log(
|
|
@@ -707,7 +718,8 @@ export const main = async (
|
|
|
707
718
|
await upgrade.upgradeGovernance(
|
|
708
719
|
dao.SchemeRegistrar,
|
|
709
720
|
dao.UpgradeScheme,
|
|
710
|
-
release.CompoundVotingMachine
|
|
721
|
+
release.CompoundVotingMachine,
|
|
722
|
+
GAS_SETTINGS
|
|
711
723
|
);
|
|
712
724
|
}
|
|
713
725
|
};
|
|
@@ -757,10 +769,13 @@ export const main = async (
|
|
|
757
769
|
founders
|
|
758
770
|
});
|
|
759
771
|
await Promise.all(
|
|
760
|
-
founders.slice(
|
|
772
|
+
founders.slice(1).map(f =>
|
|
761
773
|
absoluteVote
|
|
762
774
|
.connect(f)
|
|
763
|
-
.vote(proposalId, 1, 0, f.address, {
|
|
775
|
+
.vote(proposalId, 1, 0, f.address, {
|
|
776
|
+
...GAS_SETTINGS,
|
|
777
|
+
gasLimit: 300000
|
|
778
|
+
})
|
|
764
779
|
.then(_ => countTotalGas(_.wait(), "vote"))
|
|
765
780
|
.catch(e => console.log("founder vote failed:", f.address, e.message))
|
|
766
781
|
)
|
|
@@ -946,8 +961,10 @@ export const main = async (
|
|
|
946
961
|
await deployContracts();
|
|
947
962
|
|
|
948
963
|
if (isPerformUpgrade) {
|
|
949
|
-
console.log("deployed contracts", { totalGas });
|
|
964
|
+
console.log("deployed contracts", { totalGas, dao, release });
|
|
965
|
+
if (isTest === false) await pressAnyKey();
|
|
950
966
|
await voteProtocolUpgrade(release);
|
|
967
|
+
if (isTest === false) await pressAnyKey();
|
|
951
968
|
console.log("voted contracts", { totalGas });
|
|
952
969
|
isMainnet && (await performUpgrade(release));
|
|
953
970
|
!isMainnet && (await performUpgradeFuse(release));
|
package/yarn.lock
CHANGED
|
@@ -13647,6 +13647,13 @@ preserve@^0.2.0:
|
|
|
13647
13647
|
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
|
13648
13648
|
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
|
|
13649
13649
|
|
|
13650
|
+
press-any-key@^0.1.1:
|
|
13651
|
+
version "0.1.1"
|
|
13652
|
+
resolved "https://registry.yarnpkg.com/press-any-key/-/press-any-key-0.1.1.tgz#97cf184ae84f25858fe3d83ab824e9d1dce2cde8"
|
|
13653
|
+
integrity sha512-TR722R9UpZjvOtyVcmS7hx2/1KzKIyeizIqHJ7sRcfXvCDzeSknS3UNLhmQMN7075Jd9gGUBdq98sHw2eqb86Q==
|
|
13654
|
+
dependencies:
|
|
13655
|
+
single-line-log "^1.1.2"
|
|
13656
|
+
|
|
13650
13657
|
prettier@^1.14.3:
|
|
13651
13658
|
version "1.19.1"
|
|
13652
13659
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
|
@@ -15022,6 +15029,13 @@ simple-get@^2.7.0:
|
|
|
15022
15029
|
once "^1.3.1"
|
|
15023
15030
|
simple-concat "^1.0.0"
|
|
15024
15031
|
|
|
15032
|
+
single-line-log@^1.1.2:
|
|
15033
|
+
version "1.1.2"
|
|
15034
|
+
resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364"
|
|
15035
|
+
integrity sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=
|
|
15036
|
+
dependencies:
|
|
15037
|
+
string-width "^1.0.1"
|
|
15038
|
+
|
|
15025
15039
|
slash@^1.0.0:
|
|
15026
15040
|
version "1.0.0"
|
|
15027
15041
|
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
|