@gooddollar/goodprotocol 1.0.4-beta.1 → 1.0.6

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 CHANGED
@@ -124,13 +124,15 @@ const hhconfig: HardhatUserConfig = {
124
124
  staging: {
125
125
  accounts: { mnemonic },
126
126
  url: "https://rpc.fuse.io/",
127
-
128
- chainId: 122
127
+ chainId: 122,
128
+ gas: 6000000,
129
+ gasPrice: 1000000000
129
130
  },
130
131
  "staging-mainnet": {
131
132
  accounts: { mnemonic },
132
133
  url: "https://ropsten.infura.io/v3/" + infura_api,
133
-
134
+ gasPrice: 20000000000,
135
+ gas: 5000000,
134
136
  chainId: 3
135
137
  },
136
138
  production: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "1.0.4-beta.1",
3
+ "version": "1.0.6",
4
4
  "description": "GoodDollar Protocol",
5
5
  "scripts": {
6
6
  "build": "scripts/build.sh deploy",
@@ -16,7 +16,8 @@
16
16
  "runNode": "hardhat node &",
17
17
  "testDAOUpgrade": "yarn runNode && yarn compile && yarn deployOldDAO --network develop-mainnet && yarn daoUpgrade --network develop-mainnet",
18
18
  "testDAOUpgradeFuse": "yarn runNode && yarn compile && yarn deployOldDAO --network develop && yarn daoUpgrade --network develop",
19
- "deployTest": "yarn runNode && yarn compile && hardhat run scripts/test/singleOldDaoDeploy.ts --network dapptest && yarn daoUpgrade --network dapptest && yarn daoUpgrade --network dapptest-mainnet && hardhat run scripts/test/simulateInterest.ts --network dapptest"
19
+ "deployTestOld": "yarn runNode && yarn compile && hardhat run scripts/test/singleOldDaoDeploy.ts --network dapptest && yarn daoUpgrade --network dapptest && yarn daoUpgrade --network dapptest-mainnet && hardhat run scripts/test/simulateInterest.ts --network dapptest",
20
+ "deployTest": "yarn runNode && yarn compile && hardhat run scripts/deployFullDAO.ts --network dapptest && hardhat run scripts/deployFullDAO.ts --network dapptest-mainnet && hardhat run scripts/test/simulateInterest.ts --network dapptest"
20
21
  },
21
22
  "files": [
22
23
  "artifacts/contracts",
@@ -146,41 +146,42 @@
146
146
  "COMP": "0x0000000000000000000000000000000000000000"
147
147
  },
148
148
  "fuse-mainnet": {
149
- "NameService": "0x5e8bF25c75787e9fa17e2321266b0cbE95c830d0",
150
- "GReputation": "0x8be7F5a424240e828F937f7dB92A4b4B44708410",
151
- "CompoundVotingMachine": "0x31e831f7950F1d127856974AeE594f796c84af11",
152
- "GoodMarketMaker": "0xdd9A6822745d017E42d976FF791E9d6Bed396C00",
153
- "GoodReserveCDai": "0x8ECd5577aAf386806C2724CcEdB168B369BeFa99",
154
- "ExchangeHelper": "0xA5C33Eb014267DA1dd69d7c0E1d3be7AAC2640e1",
155
- "GoodFundManager": "0xb51CF5c8aeaa85fBB86cFF6175Bc31e8256686b1",
156
- "StakersDistribution": "0xC5E509eE778E4A1Ca1D141Dd381A12A608bE71f1",
157
- "ProtocolUpgrade": "0x6d3037CfBE39854744CE98469bee1837364B3286",
158
- "CompoundStakingFactory": "0xF115708be5dF1D069EED031117bA7969c925F69A",
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
- "0x235fEd3D403CDbC7CC78E58744f823F7c738476F",
161
+ "0x98867484E2F0c902F64bCdEDc2e289307c988214",
162
162
  13888
163
163
  ]
164
164
  ],
165
- "DonationsStaking": "0x0A53e103E65deB1Ba18F374f6A2Bc6660305fd9C",
166
- "Contribution": "0xd9dD31139a544Df145cf10cC73e7FC1Db33971Fa",
165
+ "DonationsStaking": "0x2aAd517DE8256ee6DC7ce31Ae09EBb99F17F9975",
166
+ "Contribution": "0x2250c5131bf9DdCbD55F9bEFc999D691c419ad93",
167
167
  "DAI": "0xB5E5D0F8C0cbA267CD3D7035d6AdC8eBA7Df7Cdd",
168
168
  "cDAI": "0x6ce27497a64fffb5517aa4aee908b1e7eb63b9ff",
169
- "ForeignBridge": "0xEE0756A5394721e54A092F9aEbd525DD3A2Ace8d",
170
- "GoodDollar": "0xd76135e33B9ee4F1bF1D57Ec18bBBC11AFf30941",
169
+ "ForeignBridge": "0x18F2a22Aa6420D06C079e70838a21a3c75322834",
170
+ "GoodDollar": "0x22A4720e32e3419e809731E7114042D6C3055845",
171
171
  "Reputation": "0x5925F6Bf62147D2b14B85e6dCB979e3D1A81Dbb1",
172
- "Identity": "0x13973e242C75091E605844F816b9a8E211929559",
173
- "Avatar": "0xB7D068E9e4235176FA51c5971081117DFE5e7F75",
174
- "Controller": "0xd6513d7145a208d94E508BAB2E4bE31f6dce5147",
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": "0x9aed4D407EAc930B00CB19072D4ea477e98Ae397",
182
- "AaveStakingFactory": "0xfACb3efbFd5E4d7511b233D0d5d6CA96CFa97578",
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": "0x1C8F3CE77a6958fF2F4b422851b6Ce9C09dcAF8A",
246
- "GReputation": "0xd398951013E1bd097B82Df94159e219455DA4fC5",
247
- "CompoundVotingMachine": "0xB301e738A8A2c8c95BE0822b264653bBcd265362",
248
- "GoodMarketMaker": "0x9B276580B1694143F59a853B47D9b4a72504A686",
249
- "GoodReserveCDai": "0x17a399CdC103490E561b3CBFf5E4263C26f3000D",
250
- "ExchangeHelper": "0xed768F4C9184cAead84679af39AEed9Fe542F59e",
251
- "GoodFundManager": "0xCB67BCFEA070eF05533168A59DC1181FD6b39990",
252
- "StakersDistribution": "0x56a8fA4a1F793fac39c7749F5ddF0ACDcaD4b951",
253
- "ProtocolUpgrade": "0xc3069547cDAf7d7F8A9916B24702Da3CBbefFC78",
254
- "UniswapV2SwapHelper": "0xCdDe99dDD1bf4fa22d808697F306DfC59412F46f",
255
- "CompoundStakingFactory": "0x6049e33E3179a22cf79057B2C8E7dCDc775710ed",
256
- "AaveStakingFactory": "0xFA3E3BD1149CeB820dbcaB6472e36d663C4F9066",
257
- "DonationsStaking": "0x431B770626546153593E1576F8E66fa9E01E7b40",
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": "0xEDA39475415f1A2944a467Aa6359CB4C1c3ed50f",
261
- "Contribution": "0x7cC2CcDA5483e721778C4040B1DbD23B3Ab1B4A5",
261
+ "ForeignBridge": "0xDaAc9A734242C2D99dD1cb3680770ACA26A25CeB",
262
+ "Contribution": "0x27816e32270a413AF676A2E3a25dB93C7F565a80",
262
263
  "StakingContracts": [
263
264
  [
264
265
  "0x61b36EcaEd25c4EE3017905B5Dd006129a4dfb0B",
265
266
  13888
266
267
  ]
267
268
  ],
268
- "Identity": "0xfb5dAF44cd18Db7b96DB3F9c6E411D65fcf4f372",
269
- "GoodDollar": "0x4738C5e91C4F809da21DD0Df4B5aD5f699878C1c",
270
- "Controller": "0x589F7ae100a7dbd80DC512208b7a0F457A041BE6",
271
- "Avatar": "0x3BC91a65f53dACBd2336C04AC060741f70dCd187",
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": "0x1268c5d249746546f95E2cE8Bf7477C9729EbaBE"
277
+ "ProxyFactory": "0x33D3712b90ade5d7363F3548650e508ad8eACfAA",
278
+ "FeeFormula": "0xc43514e62190A6253C56C7c50DAdb907e3eda666"
277
279
  },
278
280
  "staging": {
279
- "FuseFaucet": "0xDfCb356c9bd420263aC56D7980f409AcE9050896",
281
+ "FuseFaucet": "0x70f361EDB97B245E8A68573637A31886A427fe2a",
280
282
  "ProxyAdmin": "0x2Ea4aAA8351CfE63B537E81Cd4a13c435B945C1D",
281
- "Invites": "0x7d5FC799dE6fB6a30161684f27320BAcAdBf4126",
283
+ "Invites": "0x763b49F901DC894F2dEc1c7d19e46250B4452679",
282
284
  "ProxyAdmin2": "0x23D8492444DA663fcb2bDa8cA9A0e84989D1f59e",
283
- "GoodDollar": "0x100b8fd10ff8DC43fda45E636B4BB1eE6088270a",
284
- "NameService": "0xd6D206e19Aab34761E62dC30FA37b8D3d071Dd1D",
285
- "GReputation": "0xF5e5098e070c6798b84ca2742cC9d4EEf9d110Fc",
286
- "CompoundVotingMachine": "0xde3CbD2823E5f541457f63854e400a375016c7F9",
287
- "ClaimersDistribution": "0x74C2665E988b7b4559F7401Aa7AAEcB9440d31AE",
288
- "GovernanceStaking": "0xa04865a50dF03607fB17Aa00bf00Dd2A02EC8A6B",
289
- "UBIScheme": "0x65D36106C057263939a6BddaA02D4DF6BB2df5C5",
290
- "ProtocolUpgradeFuse": "0x34c0770400f5F8F22B6fB59b5785A5bEA37af9c5",
291
- "Identity": "0x104efFcBDddae9cd4813b8A05Ecd6A17BaBfE6d9",
292
- "Avatar": "0xcA9E4D51bc496F0b661E9fa02d25E4f67Dd88870",
293
- "Controller": "0x7CBA0778748960145F3E56b3285255064D86709D",
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": "0x8b0Ec4aFaEE9974233c29fa52cC5D2493FB81D45",
298
+ "AdminWallet": "0x2961a6C2Fe39F0FFC4f4b1D9E037CD95f4e9C993",
297
299
  "UpgradeScheme": "0xfC9F6F5E3ff7BAAB3fEf82e66f56917D625ba38B",
298
- "OneTimePayments": "0x2b5Ef42bc3D1BEfCbA20E3233DeDadD2439B8Ac2",
300
+ "OneTimePayments": "0x7912636D68E5d92708862b38698f764BF1EC297C",
299
301
  "network": "staging",
300
302
  "networkId": 122,
301
303
  "ProxyFactory": "0x240d844AdA767bE0AB08F9BcCcB6D8a04aE370EC",
302
- "HomeBridge": "0x53f6Bd6Da1564f5B00D2069d8E0F316AF859fb99",
303
- "FirstClaimPool": "0x1EA5564a28F34107b99dC591f142537404329762"
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",
@@ -42,7 +42,9 @@ const printDeploy = async (
42
42
 
43
43
  export const createDAO = async () => {
44
44
  const fusedao = dao[network.name.split("-")[0]];
45
- let release: { [key: string]: any } = {}; //dao[network.name];
45
+ let release: { [key: string]: any } = {};
46
+ // let release: { [key: string]: any } = dao[network.name];
47
+
46
48
  let [root, ...signers] = await ethers.getSigners();
47
49
  //generic call permissions
48
50
  let schemeMock = root;
@@ -177,12 +179,15 @@ export const createDAO = async () => {
177
179
  Controller: controller,
178
180
  GoodDollar: gd,
179
181
  Identity: Identity.address,
180
- FeeFormula: FeeFormula.address
182
+ FeeFormula: FeeFormula.address,
183
+ BancorFormula: BancorFormula.address
181
184
  };
182
185
 
183
186
  if (isMainnet) {
184
187
  mainnet = await deployMainnet(Avatar, Identity);
185
- Object.entries(mainnet).forEach(([k, v]) => (release[k] = v.address));
188
+ Object.entries(mainnet)
189
+ .filter(([k, v]) => v)
190
+ .forEach(([k, v]) => (release[k] = v.address));
186
191
  }
187
192
 
188
193
  let sidechain: { [key: string]: any } = {};
@@ -203,29 +208,30 @@ export const createDAO = async () => {
203
208
 
204
209
  await releaser(release, network.name);
205
210
 
206
- await pressAnyKey();
207
211
  const bridgeRelease = await deployBridge(Avatar, gd, setSchemes, isMainnet);
208
212
  release = { ...release, ...bridgeRelease };
209
213
  await releaser(release, network.name);
210
214
 
211
- await pressAnyKey();
215
+ // await pressAnyKey();
212
216
  // deploy v2 mainnet/sidechain contracts, returns their addresses
213
- const v2 = await deployV2(network.name, false, {
217
+ const olddao = {
214
218
  FirstClaimPool: release.FirstClaimPool,
215
219
  BancorFormula: release.BancorFormula,
216
220
  Avatar: release.Avatar,
217
221
  Controller: release.Controller,
218
- DAIUsdOracle: ethers.constants.AddressZero,
219
- COMPUsdOracle: ethers.constants.AddressZero,
220
- USDCUsdOracle: ethers.constants.AddressZero,
221
- AAVEUsdOracle: ethers.constants.AddressZero,
222
+ DAIUsdOracle: release.DAIUsdOracle || ethers.constants.AddressZero,
223
+ COMPUsdOracle: release.COMPUsdOracle || ethers.constants.AddressZero,
224
+ USDCUsdOracle: release.USDCUsdOracle || ethers.constants.AddressZero,
225
+ AAVEUsdOracle: release.AAVEUsdOracle || ethers.constants.AddressZero,
222
226
  AaveLendingPool: ethers.constants.AddressZero,
223
227
  AaveIncentiveController: ethers.constants.AddressZero,
224
- GasPriceOracle: ethers.constants.AddressZero,
228
+ GasPriceOracle: release.GasPriceOracle || ethers.constants.AddressZero,
225
229
  cDAI: release.cDAI || ethers.constants.AddressZero,
226
230
  DAI: release.DAI || ethers.constants.AddressZero,
227
231
  COMP: release.COMP || ethers.constants.AddressZero,
228
232
  USDC: ethers.constants.AddressZero,
233
+ DAIEthOracle: release.DAIEthOracle || ethers.constants.AddressZero,
234
+ ETHUsdOracle: release.ETHUsdOracle || ethers.constants.AddressZero,
229
235
  Identity: release.Identity,
230
236
  GoodDollar: release.GoodDollar,
231
237
  Contribution: release.Contribution,
@@ -234,10 +240,12 @@ export const createDAO = async () => {
234
240
  ForeignBridge: release.ForeignBridge,
235
241
  SchemeRegistrar: ethers.constants.AddressZero,
236
242
  UpgradeScheme: ethers.constants.AddressZero
237
- });
243
+ };
244
+
245
+ const v2 = await deployV2(network.name, false, olddao);
238
246
  release = { ...v2, ...release };
239
247
  await releaser(release, network.name);
240
- await pressAnyKey();
248
+ // await pressAnyKey();
241
249
  if (isMainnet) {
242
250
  await setSchemes([release.ProtocolUpgrade]);
243
251
  await performUpgrade(release, fusedao.UBIScheme);
@@ -292,7 +300,7 @@ const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
292
300
  .then(printDeploy)) as Contract;
293
301
  await setSchemes([scheme.address]);
294
302
 
295
- if (network.name.includes("develop")) {
303
+ if (network.name.includes("develop") || network.name.includes("dapptest")) {
296
304
  const mockBridge = (await new ethers.ContractFactory(
297
305
  BridgeMock.abi,
298
306
  BridgeMock.bytecode,
@@ -328,6 +336,27 @@ const deployMainnet = async (Avatar, Identity) => {
328
336
  const daiAddr = ProtocolSettings[network.name]?.compound?.dai;
329
337
  const cdaiAddr = ProtocolSettings[network.name]?.compound?.cdai;
330
338
  const COMPAddr = ProtocolSettings[network.name]?.compound?.comp;
339
+ const daiEthOracleAddr = ProtocolSettings[network.name]?.chainlink?.dai_eth;
340
+ const ethUsdOracleAddr = ProtocolSettings[network.name]?.chainlink?.eth_usd;
341
+
342
+ let DAIUsdOracle, COMPUsdOracle, USDCUsdOracle, AAVEUsdOracle, GasPriceOracle;
343
+ if (name.includes("test")) {
344
+ const tokenUsdOracleFactory = await ethers.getContractFactory(
345
+ "BatUSDMockOracle"
346
+ );
347
+ DAIUsdOracle = await tokenUsdOracleFactory.deploy();
348
+ USDCUsdOracle = await tokenUsdOracleFactory.deploy();
349
+
350
+ COMPUsdOracle = await (
351
+ await ethers.getContractFactory("CompUSDMockOracle")
352
+ ).deploy();
353
+ AAVEUsdOracle = await (
354
+ await ethers.getContractFactory("AaveUSDMockOracle")
355
+ ).deploy();
356
+ GasPriceOracle = await (
357
+ await ethers.getContractFactory("GasPriceMockOracle")
358
+ ).deploy();
359
+ }
331
360
 
332
361
  let DAI = daiAddr
333
362
  ? await ethers.getContractAt("DAIMock", daiAddr)
@@ -350,16 +379,31 @@ const deployMainnet = async (Avatar, Identity) => {
350
379
  const Contribution = (await ccFactory
351
380
  .deploy(Avatar.address, 0, 1e15)
352
381
  .then(printDeploy)) as Contract;
353
- // const contribution = await ethers.getContractAt(
354
- // ContributionCalculation.abi,
355
- // "0xc3171409dB6827A68294B3A0D40a31310E83eD6B"
356
- // );
382
+
383
+ let DAIEthOracle = daiEthOracleAddr
384
+ ? await ethers.getContractAt("DaiEthPriceMockOracle", daiEthOracleAddr)
385
+ : ((await (await ethers.getContractFactory("DaiEthPriceMockOracle"))
386
+ .deploy()
387
+ .then(printDeploy)) as Contract);
388
+
389
+ let ETHUsdOracle = ethUsdOracleAddr
390
+ ? await ethers.getContractAt("EthUSDMockOracle", ethUsdOracleAddr)
391
+ : ((await (await ethers.getContractFactory("EthUSDMockOracle"))
392
+ .deploy()
393
+ .then(printDeploy)) as Contract);
357
394
 
358
395
  return {
359
396
  Contribution,
360
397
  DAI,
361
398
  COMP,
362
- cDAI
399
+ cDAI,
400
+ ETHUsdOracle,
401
+ DAIEthOracle,
402
+ DAIUsdOracle,
403
+ COMPUsdOracle,
404
+ USDCUsdOracle,
405
+ AAVEUsdOracle,
406
+ GasPriceOracle
363
407
  };
364
408
  };
365
409
 
@@ -1,8 +1,8 @@
1
1
  import fse from "fs-extra";
2
2
  import { ethers, network as networkData } from "hardhat";
3
- import settings from "../releases/deploy-settings.json";
4
- import deployment from "../releases/deployment.json";
5
- import { increaseTime, advanceBlocks } from "../test/helpers";
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
@@ -14,12 +14,11 @@ const waitTX = async tx => {
14
14
  };
15
15
  const simulate = async function () {
16
16
  const network = networkData.name;
17
- const networkSettings = { ...settings["default"], ...settings[network] };
18
17
  const accounts = await ethers.getSigners();
19
18
 
20
19
  let addresses = deployment[network];
21
20
  let mainnetAddresses = deployment[`${network}-mainnet`];
22
- console.log({ addresses, network });
21
+ console.log({ addresses, mainnetAddresses, network });
23
22
  const identity = await ethers.getContractAt("IIdentity", addresses.Identity);
24
23
  await Promise.all(
25
24
  accounts.slice(0, 10).map(a =>
@@ -66,7 +65,11 @@ const simulate = async function () {
66
65
  .balanceOf(simpleStaking)
67
66
  .then(_ => _.toString());
68
67
 
69
- console.log("collecting interest...", { stakingBalance });
68
+ console.log("collecting interest...", {
69
+ stakingBalance,
70
+ gfm: goodFundManager.address,
71
+ simpleStaking
72
+ });
70
73
 
71
74
  await goodFundManager.collectInterest([simpleStaking], false);
72
75
 
@@ -89,7 +89,7 @@ export const main = async (
89
89
  }
90
90
 
91
91
  const isBackendTest = networkName.startsWith("dapptest");
92
- const isTest = network.name === "hardhat";
92
+ const isTest = network.name === "hardhat" || isBackendTest;
93
93
  const isCoverage = process.env.CODE_COVERAGE;
94
94
  const isDevelop = !isProduction;
95
95
  const isMainnet = networkName.includes("mainnet");
@@ -97,7 +97,13 @@ export const main = async (
97
97
  ...ProtocolSettings["default"],
98
98
  ...ProtocolSettings[networkName]
99
99
  };
100
- console.log(`networkName ${networkName}`);
100
+ console.log(`networkName ${networkName}`, {
101
+ isTest,
102
+ isBackendTest,
103
+ isCoverage,
104
+ isMainnet,
105
+ isDevelop
106
+ });
101
107
  const dao = olddao || OldDAO[networkName];
102
108
  const fse = require("fs-extra");
103
109
  const ProtocolAddresses = await fse.readJson("releases/deployment.json");
@@ -656,7 +662,7 @@ export const main = async (
656
662
  //extract just the addresses without the rewards
657
663
  // release.StakingContracts = release.StakingContracts.map((_) => _[0]);
658
664
 
659
- if (isProduction || isBackendTest) {
665
+ if (isProduction) {
660
666
  console.log(
661
667
  "SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY"
662
668
  );
@@ -708,7 +714,7 @@ export const main = async (
708
714
  )
709
715
  .then(_ => countTotalGas(_, "fuse basic upgrade"));
710
716
 
711
- if (isProduction || isBackendTest) {
717
+ if (isProduction) {
712
718
  console.log(
713
719
  "SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY"
714
720
  );
@@ -17,14 +17,8 @@ describe("ClaimersDistribution", () => {
17
17
  cd: ClaimersDistribution;
18
18
 
19
19
  before(async () => {
20
- [
21
- root,
22
- acct,
23
- claimer1,
24
- claimer2,
25
- claimer3,
26
- ...signers
27
- ] = await ethers.getSigners();
20
+ [root, acct, claimer1, claimer2, claimer3, ...signers] =
21
+ await ethers.getSigners();
28
22
 
29
23
  const deployedDAO = await createDAO();
30
24
  let {
@@ -202,4 +196,15 @@ describe("ClaimersDistribution", () => {
202
196
 
203
197
  expect(endCount).to.be.equal(startCount.add(2));
204
198
  });
199
+
200
+ it("should not cost alot of gas to claim with reputation distribution", async () => {
201
+ let totalGas = 0;
202
+ for (let i = 0; i < 31; i++) {
203
+ await increaseTime(60 * 60 * 24);
204
+ const tx = await (await ubiScheme.connect(claimer3).claim()).wait();
205
+ totalGas += tx.gasUsed.toNumber();
206
+ console.log({ totalGas }, tx.gasUsed.toNumber());
207
+ }
208
+ expect(totalGas / 30).lt(300000);
209
+ });
205
210
  });