@gooddollar/goodprotocol 2.0.5-beta.9 → 2.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/package.json +4 -3
- package/scripts/upgradeToV2/upgradeToV2.ts +54 -208
- package/yarn.lock +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "2.0.5
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepack": "npm run minimize",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"runNode": "hardhat node &",
|
|
18
18
|
"testDAOUpgrade": "yarn runNode & yarn compile && yarn deployOldDAO --network develop-mainnet && yarn daoUpgrade --network develop-mainnet",
|
|
19
19
|
"testDAOUpgradeFuse": "yarn runNode & yarn compile && yarn deployOldDAO --network develop && yarn daoUpgrade --network develop",
|
|
20
|
-
"deployTestOld": "yarn
|
|
21
|
-
"deployTest": "yarn
|
|
20
|
+
"deployTestOld": "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",
|
|
21
|
+
"deployTest": "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"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"artifacts/contracts",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@jsier/retrier": "^1.2.4",
|
|
61
61
|
"@openzeppelin/contracts": "^4.8.0",
|
|
62
62
|
"@openzeppelin/contracts-upgradeable": "^4.8.0",
|
|
63
|
+
"@openzeppelin/upgrades-core": "1.18.0",
|
|
63
64
|
"@superfluid-finance/ethereum-contracts": "^1.4.3",
|
|
64
65
|
"@superfluid-finance/sdk-core": "^0.5.8",
|
|
65
66
|
"@typechain/hardhat": "^6.1.5",
|
|
@@ -11,11 +11,7 @@ import { network, ethers, upgrades, run } from "hardhat";
|
|
|
11
11
|
import { isFunction, get, omitBy } from "lodash";
|
|
12
12
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
13
13
|
import pressAnyKey from "press-any-key";
|
|
14
|
-
import {
|
|
15
|
-
AaveStakingFactory,
|
|
16
|
-
CompoundStakingFactory,
|
|
17
|
-
ProxyFactory1967
|
|
18
|
-
} from "../../types";
|
|
14
|
+
import { AaveStakingFactory, CompoundStakingFactory, ProxyFactory1967 } from "../../types";
|
|
19
15
|
import SchemeRegistrarABI from "@gooddollar/goodcontracts/build/contracts/SchemeRegistrar.json";
|
|
20
16
|
import releaser from "../releaser";
|
|
21
17
|
import {
|
|
@@ -30,7 +26,7 @@ import { getFounders } from "../getFounders";
|
|
|
30
26
|
import OldDAO from "../../releases/olddao.json";
|
|
31
27
|
|
|
32
28
|
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
33
|
-
import { keccak256 } from "
|
|
29
|
+
import { keccak256 } from "ethers/lib/utils";
|
|
34
30
|
|
|
35
31
|
let GAS_SETTINGS: any = {
|
|
36
32
|
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
|
|
@@ -57,11 +53,7 @@ console.log({
|
|
|
57
53
|
});
|
|
58
54
|
const { name } = network;
|
|
59
55
|
|
|
60
|
-
export const main = async (
|
|
61
|
-
networkName = name,
|
|
62
|
-
isPerformUpgrade = true,
|
|
63
|
-
olddao?
|
|
64
|
-
): Promise<{ [key: string]: any }> => {
|
|
56
|
+
export const main = async (networkName = name, isPerformUpgrade = true, olddao?): Promise<{ [key: string]: any }> => {
|
|
65
57
|
const isProduction = networkName.startsWith("production");
|
|
66
58
|
if (isProduction && networkName.includes("mainnet")) {
|
|
67
59
|
GAS_SETTINGS.gasLimit = 6000000;
|
|
@@ -99,9 +91,7 @@ export const main = async (
|
|
|
99
91
|
const dao = olddao || OldDAO[networkName];
|
|
100
92
|
const fse = require("fs-extra");
|
|
101
93
|
const ProtocolAddresses = await fse.readJson("releases/deployment.json");
|
|
102
|
-
const newfusedao = await ProtocolAddresses[
|
|
103
|
-
networkName.replace(/\-mainnet/, "")
|
|
104
|
-
];
|
|
94
|
+
const newfusedao = await ProtocolAddresses[networkName.replace(/\-mainnet/, "")];
|
|
105
95
|
const newdao = ProtocolAddresses[networkName] || {};
|
|
106
96
|
|
|
107
97
|
let [root, proxyDeployer] = await ethers.getSigners();
|
|
@@ -112,25 +102,15 @@ export const main = async (
|
|
|
112
102
|
|
|
113
103
|
const founders = await getFounders(networkName);
|
|
114
104
|
|
|
115
|
-
console.log(
|
|
116
|
-
`root: ${root.address} founders: ${founders.map(_ => _.address)}`
|
|
117
|
-
);
|
|
105
|
+
console.log(`root: ${root.address} founders: ${founders.map(_ => _.address)}`);
|
|
118
106
|
|
|
119
107
|
const compoundTokens = [
|
|
120
108
|
{
|
|
121
109
|
name: "cdai",
|
|
122
|
-
address:
|
|
123
|
-
|
|
124
|
-
protocolSettings.compound.cdai) ||
|
|
125
|
-
dao.cDAI,
|
|
126
|
-
usdOracle:
|
|
127
|
-
(protocolSettings.compound != undefined &&
|
|
128
|
-
protocolSettings.compound.daiUsdOracle) ||
|
|
129
|
-
dao.DAIUsdOracle,
|
|
110
|
+
address: (protocolSettings.compound != undefined && protocolSettings.compound.cdai) || dao.cDAI,
|
|
111
|
+
usdOracle: (protocolSettings.compound != undefined && protocolSettings.compound.daiUsdOracle) || dao.DAIUsdOracle,
|
|
130
112
|
compUsdOracle:
|
|
131
|
-
(protocolSettings.compound != undefined &&
|
|
132
|
-
protocolSettings.compound.compUsdOracle) ||
|
|
133
|
-
dao.COMPUsdOracle,
|
|
113
|
+
(protocolSettings.compound != undefined && protocolSettings.compound.compUsdOracle) || dao.COMPUsdOracle,
|
|
134
114
|
swapPath: []
|
|
135
115
|
}
|
|
136
116
|
];
|
|
@@ -141,10 +121,7 @@ export const main = async (
|
|
|
141
121
|
address: protocolSettings.aave.usdc || dao.USDC,
|
|
142
122
|
usdOracle: protocolSettings.aave.usdcUsdOracle || dao.USDCUsdOracle,
|
|
143
123
|
aaveUsdOracle: protocolSettings.aave.aaveUsdOracle || dao.AAVEUsdOracle,
|
|
144
|
-
swapPath: [
|
|
145
|
-
get(protocolSettings, "aave.usdc", dao.USDC),
|
|
146
|
-
get(protocolSettings, "compound.dai", dao.DAI)
|
|
147
|
-
]
|
|
124
|
+
swapPath: [get(protocolSettings, "aave.usdc", dao.USDC), get(protocolSettings, "compound.dai", dao.DAI)]
|
|
148
125
|
}
|
|
149
126
|
];
|
|
150
127
|
|
|
@@ -184,9 +161,7 @@ export const main = async (
|
|
|
184
161
|
get(protocolSettings, "compound.comp", dao.COMP),
|
|
185
162
|
dao.ForeignBridge,
|
|
186
163
|
protocolSettings.uniswapRouter || dao.UniswapRouter,
|
|
187
|
-
!isMainnet ||
|
|
188
|
-
dao.GasPriceOracle ||
|
|
189
|
-
protocolSettings.chainlink.gasPrice, //should fail if missing only on mainnet
|
|
164
|
+
!isMainnet || dao.GasPriceOracle || protocolSettings.chainlink.gasPrice, //should fail if missing only on mainnet
|
|
190
165
|
!isMainnet || dao.DAIEthOracle || protocolSettings.chainlink.dai_eth,
|
|
191
166
|
!isMainnet || dao.ETHUsdOracle || protocolSettings.chainlink.eth_usd
|
|
192
167
|
]
|
|
@@ -197,13 +172,9 @@ export const main = async (
|
|
|
197
172
|
name: "NameService",
|
|
198
173
|
args: [
|
|
199
174
|
controller,
|
|
200
|
-
[
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"IDENTITY",
|
|
204
|
-
"GOODDOLLAR",
|
|
205
|
-
"BRIDGE_CONTRACT"
|
|
206
|
-
].map(_ => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(_))),
|
|
175
|
+
["CONTROLLER", "AVATAR", "IDENTITY", "GOODDOLLAR", "BRIDGE_CONTRACT"].map(_ =>
|
|
176
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes(_))
|
|
177
|
+
),
|
|
207
178
|
[controller, avatar, dao.Identity, dao.GoodDollar, dao.HomeBridge]
|
|
208
179
|
]
|
|
209
180
|
},
|
|
@@ -241,10 +212,7 @@ export const main = async (
|
|
|
241
212
|
network: "mainnet",
|
|
242
213
|
name: "GoodReserveCDai",
|
|
243
214
|
initializer: "initialize(address, bytes32)",
|
|
244
|
-
args: [
|
|
245
|
-
() => get(release, "NameService", newdao.NameService),
|
|
246
|
-
protocolSettings.gdxAirdrop
|
|
247
|
-
]
|
|
215
|
+
args: [() => get(release, "NameService", newdao.NameService), protocolSettings.gdxAirdrop]
|
|
248
216
|
},
|
|
249
217
|
{
|
|
250
218
|
network: "mainnet",
|
|
@@ -277,11 +245,7 @@ export const main = async (
|
|
|
277
245
|
network: "fuse",
|
|
278
246
|
name: "UBIScheme",
|
|
279
247
|
initializer: "initialize(address, address, uint256)",
|
|
280
|
-
args: [
|
|
281
|
-
() => get(release, "NameService", newdao.NameService),
|
|
282
|
-
dao.FirstClaimPool,
|
|
283
|
-
14
|
|
284
|
-
]
|
|
248
|
+
args: [() => get(release, "NameService", newdao.NameService), dao.FirstClaimPool, 14]
|
|
285
249
|
},
|
|
286
250
|
{
|
|
287
251
|
network: "mainnet",
|
|
@@ -326,41 +290,21 @@ export const main = async (
|
|
|
326
290
|
newdao.ProxyFactory
|
|
327
291
|
)) as unknown as ProxyFactory1967);
|
|
328
292
|
} else {
|
|
329
|
-
console.info(
|
|
330
|
-
"deploying ProxyFactory1967",
|
|
331
|
-
isDevelop,
|
|
332
|
-
newdao.ProxyFactory
|
|
333
|
-
);
|
|
293
|
+
console.info("deploying ProxyFactory1967", isDevelop, newdao.ProxyFactory);
|
|
334
294
|
// await pressAnyKey();
|
|
335
295
|
|
|
336
|
-
const pf = await (
|
|
337
|
-
await ethers.getContractFactory("ProxyFactory1967", root)
|
|
338
|
-
).deploy(GAS_SETTINGS);
|
|
296
|
+
const pf = await (await ethers.getContractFactory("ProxyFactory1967", root)).deploy(GAS_SETTINGS);
|
|
339
297
|
await pf.deployed();
|
|
340
|
-
await releaser(
|
|
341
|
-
{ ProxyFactory: pf.address },
|
|
342
|
-
networkName,
|
|
343
|
-
"deployment",
|
|
344
|
-
false
|
|
345
|
-
);
|
|
298
|
+
await releaser({ ProxyFactory: pf.address }, networkName, "deployment", false);
|
|
346
299
|
return (proxyFactory = pf.connect(root) as unknown as ProxyFactory1967);
|
|
347
300
|
}
|
|
348
301
|
};
|
|
349
302
|
|
|
350
|
-
const deployDeterministic = async (
|
|
351
|
-
contract,
|
|
352
|
-
args: any[],
|
|
353
|
-
factoryOpts = {}
|
|
354
|
-
) => {
|
|
303
|
+
const deployDeterministic = async (contract, args: any[], factoryOpts = {}) => {
|
|
355
304
|
try {
|
|
356
|
-
const Contract = await ethers.getContractFactory(
|
|
357
|
-
contract.name,
|
|
358
|
-
factoryOpts
|
|
359
|
-
);
|
|
305
|
+
const Contract = await ethers.getContractFactory(contract.name, factoryOpts);
|
|
360
306
|
|
|
361
|
-
const salt = ethers.BigNumber.from(
|
|
362
|
-
keccak256(ethers.utils.toUtf8Bytes(contract.name))
|
|
363
|
-
);
|
|
307
|
+
const salt = ethers.BigNumber.from(keccak256(ethers.utils.toUtf8Bytes(contract.name)));
|
|
364
308
|
|
|
365
309
|
if (contract.isUpgradable !== false) {
|
|
366
310
|
if (isCoverage) {
|
|
@@ -375,52 +319,28 @@ export const main = async (
|
|
|
375
319
|
return tx;
|
|
376
320
|
}
|
|
377
321
|
console.log("Deploying:", contract.name, "using proxyfactory");
|
|
378
|
-
const encoded = Contract.interface.encodeFunctionData(
|
|
379
|
-
contract.initializer || "initialize",
|
|
380
|
-
args
|
|
381
|
-
);
|
|
322
|
+
const encoded = Contract.interface.encodeFunctionData(contract.initializer || "initialize", args);
|
|
382
323
|
const tx = await Contract.deploy(GAS_SETTINGS);
|
|
383
324
|
const impl = await tx.deployed();
|
|
384
325
|
await countTotalGas(tx, contract.name);
|
|
385
326
|
|
|
386
|
-
const tx2 = await proxyFactory.deployProxy(
|
|
387
|
-
salt,
|
|
388
|
-
impl.address,
|
|
389
|
-
encoded,
|
|
390
|
-
GAS_SETTINGS
|
|
391
|
-
);
|
|
327
|
+
const tx2 = await proxyFactory.deployProxy(salt, impl.address, encoded, GAS_SETTINGS);
|
|
392
328
|
await countTotalGas(tx2, contract.name);
|
|
393
|
-
const deployTx = await tx2
|
|
394
|
-
.wait()
|
|
395
|
-
.catch(e =>
|
|
396
|
-
console.error("failed to deploy proxy, assuming it exists...", e)
|
|
397
|
-
);
|
|
329
|
+
const deployTx = await tx2.wait().catch(e => console.error("failed to deploy proxy, assuming it exists...", e));
|
|
398
330
|
return ethers.getContractAt(
|
|
399
331
|
contract.name,
|
|
400
|
-
await proxyFactory["getDeploymentAddress(uint256,address)"](
|
|
401
|
-
salt,
|
|
402
|
-
root.address
|
|
403
|
-
)
|
|
332
|
+
await proxyFactory["getDeploymentAddress(uint256,address)"](salt, root.address)
|
|
404
333
|
);
|
|
405
334
|
} else {
|
|
406
335
|
//for some reason deploying with link library via proxy doesnt work on hardhat test env
|
|
407
336
|
if (isTest === false) {
|
|
408
337
|
console.log("Deploying:", contract.name, "using proxyfactory code");
|
|
409
338
|
const constructor = Contract.interface.encodeDeploy(args);
|
|
410
|
-
const bytecode = ethers.utils.solidityPack(
|
|
411
|
-
|
|
412
|
-
[Contract.bytecode, constructor]
|
|
413
|
-
);
|
|
414
|
-
const deployTx = await (
|
|
415
|
-
await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)
|
|
416
|
-
).wait();
|
|
339
|
+
const bytecode = ethers.utils.solidityPack(["bytes", "bytes"], [Contract.bytecode, constructor]);
|
|
340
|
+
const deployTx = await (await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)).wait();
|
|
417
341
|
return ethers.getContractAt(
|
|
418
342
|
contract.name,
|
|
419
|
-
await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](
|
|
420
|
-
salt,
|
|
421
|
-
root.address,
|
|
422
|
-
keccak256(bytecode)
|
|
423
|
-
)
|
|
343
|
+
await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](salt, root.address, keccak256(bytecode))
|
|
424
344
|
);
|
|
425
345
|
} else {
|
|
426
346
|
console.log("Deploying:", contract.name, "using regular");
|
|
@@ -442,16 +362,8 @@ export const main = async (
|
|
|
442
362
|
await getProxyFactory();
|
|
443
363
|
console.info("got proxyfactory at:", proxyFactory.address);
|
|
444
364
|
for (let contract of toDeployUpgradable) {
|
|
445
|
-
if (
|
|
446
|
-
contract
|
|
447
|
-
(contract.network === "mainnet") !== isMainnet
|
|
448
|
-
) {
|
|
449
|
-
console.log(
|
|
450
|
-
contract,
|
|
451
|
-
" Skipping non mainnet/sidechain contract:",
|
|
452
|
-
contract.network,
|
|
453
|
-
contract.name
|
|
454
|
-
);
|
|
365
|
+
if (contract.network !== "both" && (contract.network === "mainnet") !== isMainnet) {
|
|
366
|
+
console.log(contract, " Skipping non mainnet/sidechain contract:", contract.network, contract.name);
|
|
455
367
|
continue;
|
|
456
368
|
}
|
|
457
369
|
if (isDevelop === false && newdao[contract.name]) {
|
|
@@ -465,9 +377,7 @@ export const main = async (
|
|
|
465
377
|
continue;
|
|
466
378
|
}
|
|
467
379
|
|
|
468
|
-
const args = await Promise.all(
|
|
469
|
-
contract.args.map(async _ => await (isFunction(_) ? _() : _))
|
|
470
|
-
);
|
|
380
|
+
const args = await Promise.all(contract.args.map(async _ => await (isFunction(_) ? _() : _)));
|
|
471
381
|
|
|
472
382
|
console.log(`deploying contract upgrade ${contract.name}`, {
|
|
473
383
|
args
|
|
@@ -491,8 +401,7 @@ export const main = async (
|
|
|
491
401
|
}
|
|
492
402
|
|
|
493
403
|
if (!isProduction || get(release, "StakingContracts", []).length == 0) {
|
|
494
|
-
const { DonationsStaking, StakingContracts } =
|
|
495
|
-
isMainnet && (await deployStakingContracts(release));
|
|
404
|
+
const { DonationsStaking, StakingContracts } = isMainnet && (await deployStakingContracts(release));
|
|
496
405
|
release["StakingContracts"] = StakingContracts;
|
|
497
406
|
release["DonationsStaking"] = DonationsStaking;
|
|
498
407
|
console.log("staking contracts result:", {
|
|
@@ -618,13 +527,7 @@ export const main = async (
|
|
|
618
527
|
await countTotalGas(tx, "call upgrade basic");
|
|
619
528
|
|
|
620
529
|
console.log("upgrading reserve...", {
|
|
621
|
-
params: [
|
|
622
|
-
release.NameService,
|
|
623
|
-
dao.Reserve,
|
|
624
|
-
dao.MarketMaker,
|
|
625
|
-
dao.FundManager,
|
|
626
|
-
release.COMP
|
|
627
|
-
]
|
|
530
|
+
params: [release.NameService, dao.Reserve, dao.MarketMaker, dao.FundManager, release.COMP]
|
|
628
531
|
});
|
|
629
532
|
tx = await upgrade.upgradeReserve(
|
|
630
533
|
release.NameService,
|
|
@@ -655,17 +558,11 @@ export const main = async (
|
|
|
655
558
|
// release.StakingContracts = release.StakingContracts.map((_) => _[0]);
|
|
656
559
|
|
|
657
560
|
if (isProduction) {
|
|
658
|
-
console.log(
|
|
659
|
-
"SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY"
|
|
660
|
-
);
|
|
561
|
+
console.log("SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY");
|
|
661
562
|
} else {
|
|
662
563
|
console.log("upgrading governance...");
|
|
663
564
|
|
|
664
|
-
tx = await upgrade.upgradeGovernance(
|
|
665
|
-
dao.SchemeRegistrar,
|
|
666
|
-
dao.UpgradeScheme,
|
|
667
|
-
release.CompoundVotingMachine
|
|
668
|
-
);
|
|
565
|
+
tx = await upgrade.upgradeGovernance(dao.SchemeRegistrar, dao.UpgradeScheme, release.CompoundVotingMachine);
|
|
669
566
|
await countTotalGas(tx, "call upgrade gov");
|
|
670
567
|
}
|
|
671
568
|
};
|
|
@@ -681,12 +578,7 @@ export const main = async (
|
|
|
681
578
|
.upgrade(
|
|
682
579
|
release.NameService,
|
|
683
580
|
//old contracts
|
|
684
|
-
[
|
|
685
|
-
dao.SchemeRegistrar || ethers.constants.AddressZero,
|
|
686
|
-
dao.UpgradeScheme,
|
|
687
|
-
dao.UBIScheme,
|
|
688
|
-
dao.FirstClaimPool
|
|
689
|
-
],
|
|
581
|
+
[dao.SchemeRegistrar || ethers.constants.AddressZero, dao.UpgradeScheme, dao.UBIScheme, dao.FirstClaimPool],
|
|
690
582
|
release.UBIScheme,
|
|
691
583
|
[
|
|
692
584
|
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
@@ -707,9 +599,7 @@ export const main = async (
|
|
|
707
599
|
.then(_ => countTotalGas(_, "fuse basic upgrade"));
|
|
708
600
|
|
|
709
601
|
if (isProduction) {
|
|
710
|
-
console.log(
|
|
711
|
-
"SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY"
|
|
712
|
-
);
|
|
602
|
+
console.log("SKIPPING GOVERNANCE UPGRADE FOR PRODUCTION. RUN IT MANUALLY");
|
|
713
603
|
} else {
|
|
714
604
|
console.log("upgrading governance...");
|
|
715
605
|
|
|
@@ -726,11 +616,7 @@ export const main = async (
|
|
|
726
616
|
const voteProtocolUpgrade = async release => {
|
|
727
617
|
const Upgrade = release.ProtocolUpgrade || release.ProtocolUpgradeFuse;
|
|
728
618
|
|
|
729
|
-
console.log(
|
|
730
|
-
"approve upgrade scheme in dao...",
|
|
731
|
-
Upgrade,
|
|
732
|
-
dao.SchemeRegistrar
|
|
733
|
-
);
|
|
619
|
+
console.log("approve upgrade scheme in dao...", Upgrade, dao.SchemeRegistrar);
|
|
734
620
|
|
|
735
621
|
const schemeRegistrar: SchemeRegistrar = (await ethers.getContractAt(
|
|
736
622
|
"SchemeRegistrar",
|
|
@@ -750,8 +636,7 @@ export const main = async (
|
|
|
750
636
|
await countTotalGas(proposal, "propose upgrade");
|
|
751
637
|
|
|
752
638
|
console.log("proposal tx:", proposal.transactionHash);
|
|
753
|
-
let proposalId = proposal.events.find(_ => _.event === "NewSchemeProposal")
|
|
754
|
-
.args._proposalId;
|
|
639
|
+
let proposalId = proposal.events.find(_ => _.event === "NewSchemeProposal").args._proposalId;
|
|
755
640
|
|
|
756
641
|
console.log("proposal", { scheme: Upgrade, proposalId });
|
|
757
642
|
|
|
@@ -781,20 +666,13 @@ export const main = async (
|
|
|
781
666
|
};
|
|
782
667
|
|
|
783
668
|
const deployStakingContracts = async release => {
|
|
784
|
-
const isRopsten =
|
|
785
|
-
networkName === "fuse-mainnet" || networkName === "staging-mainnet";
|
|
669
|
+
const isRopsten = networkName === "fuse-mainnet" || networkName === "staging-mainnet";
|
|
786
670
|
console.log("deployStakingContracts", {
|
|
787
671
|
factory: release.CompoundStakingFactory,
|
|
788
672
|
ns: release.NameService
|
|
789
673
|
});
|
|
790
|
-
const compfactory = await ethers.getContractAt(
|
|
791
|
-
|
|
792
|
-
release.CompoundStakingFactory
|
|
793
|
-
);
|
|
794
|
-
const aavefactory = await ethers.getContractAt(
|
|
795
|
-
"AaveStakingFactory",
|
|
796
|
-
release.AaveStakingFactory
|
|
797
|
-
);
|
|
674
|
+
const compfactory = await ethers.getContractAt("CompoundStakingFactory", release.CompoundStakingFactory);
|
|
675
|
+
const aavefactory = await ethers.getContractAt("AaveStakingFactory", release.AaveStakingFactory);
|
|
798
676
|
const compps = compoundTokens.map(async token => {
|
|
799
677
|
let rewardsPerBlock = protocolSettings.staking.rewardsPerBlock;
|
|
800
678
|
console.log("deployStakingContracts", {
|
|
@@ -811,9 +689,7 @@ export const main = async (
|
|
|
811
689
|
]
|
|
812
690
|
});
|
|
813
691
|
const tx = await (
|
|
814
|
-
await compfactory[
|
|
815
|
-
"cloneAndInit(address,address,uint64,address,address,address[])"
|
|
816
|
-
](
|
|
692
|
+
await compfactory["cloneAndInit(address,address,uint64,address,address,address[])"](
|
|
817
693
|
token.address,
|
|
818
694
|
release.NameService,
|
|
819
695
|
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
@@ -825,8 +701,7 @@ export const main = async (
|
|
|
825
701
|
).wait();
|
|
826
702
|
await countTotalGas(tx, "deploy comp staking");
|
|
827
703
|
const log = tx.events.find(_ => _.event === "Deployed");
|
|
828
|
-
if (!log.args.proxy)
|
|
829
|
-
throw new Error(`staking contract deploy failed ${token}`);
|
|
704
|
+
if (!log.args.proxy) throw new Error(`staking contract deploy failed ${token}`);
|
|
830
705
|
return [log.args.proxy, rewardsPerBlock];
|
|
831
706
|
});
|
|
832
707
|
|
|
@@ -850,30 +725,20 @@ export const main = async (
|
|
|
850
725
|
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
851
726
|
token.usdOracle,
|
|
852
727
|
|
|
853
|
-
get(
|
|
854
|
-
protocolSettings,
|
|
855
|
-
"aave.incentiveController",
|
|
856
|
-
dao.AaveIncentiveController
|
|
857
|
-
),
|
|
728
|
+
get(protocolSettings, "aave.incentiveController", dao.AaveIncentiveController),
|
|
858
729
|
token.aaveUsdOracle,
|
|
859
730
|
token.swapPath,
|
|
860
731
|
GAS_SETTINGS
|
|
861
732
|
]
|
|
862
733
|
});
|
|
863
734
|
const tx = await (
|
|
864
|
-
await aavefactory[
|
|
865
|
-
"cloneAndInit(address,address,address,uint64,address,address,address,address[])"
|
|
866
|
-
](
|
|
735
|
+
await aavefactory["cloneAndInit(address,address,address,uint64,address,address,address,address[])"](
|
|
867
736
|
token.address,
|
|
868
737
|
get(protocolSettings, "aave.lendingPool", dao.AaveLendingPool),
|
|
869
738
|
release.NameService,
|
|
870
739
|
protocolSettings.staking.fullRewardsThreshold, //blocks before switching for 0.5x rewards to 1x multiplier
|
|
871
740
|
token.usdOracle,
|
|
872
|
-
get(
|
|
873
|
-
protocolSettings,
|
|
874
|
-
"aave.incentiveController",
|
|
875
|
-
dao.AaveIncentiveController
|
|
876
|
-
),
|
|
741
|
+
get(protocolSettings, "aave.incentiveController", dao.AaveIncentiveController),
|
|
877
742
|
token.aaveUsdOracle,
|
|
878
743
|
token.swapPath,
|
|
879
744
|
GAS_SETTINGS
|
|
@@ -881,8 +746,7 @@ export const main = async (
|
|
|
881
746
|
).wait();
|
|
882
747
|
await countTotalGas(tx, "deploy aave staking");
|
|
883
748
|
const log = tx.events.find(_ => _.event === "Deployed");
|
|
884
|
-
if (!log.args.proxy)
|
|
885
|
-
throw new Error(`staking contract deploy failed ${token}`);
|
|
749
|
+
if (!log.args.proxy) throw new Error(`staking contract deploy failed ${token}`);
|
|
886
750
|
return [log.args.proxy, rewardsPerBlock];
|
|
887
751
|
});
|
|
888
752
|
|
|
@@ -906,22 +770,14 @@ export const main = async (
|
|
|
906
770
|
[
|
|
907
771
|
release.NameService,
|
|
908
772
|
deployed[0][0],
|
|
909
|
-
[
|
|
910
|
-
|
|
911
|
-
get(protocolSettings, "compound.dai", dao.DAI)
|
|
912
|
-
],
|
|
913
|
-
[
|
|
914
|
-
get(protocolSettings, "compound.dai", dao.DAI),
|
|
915
|
-
"0x0000000000000000000000000000000000000000"
|
|
916
|
-
]
|
|
773
|
+
["0x0000000000000000000000000000000000000000", get(protocolSettings, "compound.dai", dao.DAI)],
|
|
774
|
+
[get(protocolSettings, "compound.dai", dao.DAI), "0x0000000000000000000000000000000000000000"]
|
|
917
775
|
],
|
|
918
776
|
{ libraries: { UniswapV2SwapHelper: release["UniswapV2SwapHelper"] } }
|
|
919
777
|
);
|
|
920
778
|
// await countTotalGas(deployedDonationsStaking);
|
|
921
779
|
|
|
922
|
-
console.log(
|
|
923
|
-
`DonationsStaking deployed to: ${deployedDonationsStaking.address}`
|
|
924
|
-
);
|
|
780
|
+
console.log(`DonationsStaking deployed to: ${deployedDonationsStaking.address}`);
|
|
925
781
|
|
|
926
782
|
return {
|
|
927
783
|
DonationsStaking: deployedDonationsStaking.address,
|
|
@@ -930,10 +786,7 @@ export const main = async (
|
|
|
930
786
|
};
|
|
931
787
|
const verifyContracts = async release => {
|
|
932
788
|
for (let contract of toDeployUpgradable) {
|
|
933
|
-
if (
|
|
934
|
-
contract.network !== "both" &&
|
|
935
|
-
(contract.network === "mainnet") !== isMainnet
|
|
936
|
-
) {
|
|
789
|
+
if (contract.network !== "both" && (contract.network === "mainnet") !== isMainnet) {
|
|
937
790
|
console.log(
|
|
938
791
|
contract,
|
|
939
792
|
" Skipping verification non mainnet/sidechain contract:",
|
|
@@ -942,16 +795,9 @@ export const main = async (
|
|
|
942
795
|
);
|
|
943
796
|
continue;
|
|
944
797
|
}
|
|
945
|
-
console.log(
|
|
946
|
-
"Running contract verification:",
|
|
947
|
-
{ contract },
|
|
948
|
-
release[contract.name]
|
|
949
|
-
);
|
|
798
|
+
console.log("Running contract verification:", { contract }, release[contract.name]);
|
|
950
799
|
if (contract.isUpgradable !== false) {
|
|
951
|
-
const implementationAddress = await getImplementationAddress(
|
|
952
|
-
network.provider,
|
|
953
|
-
release[contract.name]
|
|
954
|
-
);
|
|
800
|
+
const implementationAddress = await getImplementationAddress(network.provider, release[contract.name]);
|
|
955
801
|
try {
|
|
956
802
|
await run("verify:verify", {
|
|
957
803
|
address: implementationAddress
|
package/yarn.lock
CHANGED
|
@@ -2337,6 +2337,7 @@ __metadata:
|
|
|
2337
2337
|
"@openzeppelin/contracts": ^4.8.0
|
|
2338
2338
|
"@openzeppelin/contracts-upgradeable": ^4.8.0
|
|
2339
2339
|
"@openzeppelin/hardhat-upgrades": ^1.20.0
|
|
2340
|
+
"@openzeppelin/upgrades-core": 1.18.0
|
|
2340
2341
|
"@superfluid-finance/ethereum-contracts": ^1.4.3
|
|
2341
2342
|
"@superfluid-finance/sdk-core": ^0.5.8
|
|
2342
2343
|
"@swc/core": ^1.2.196
|
|
@@ -3008,7 +3009,7 @@ __metadata:
|
|
|
3008
3009
|
languageName: node
|
|
3009
3010
|
linkType: hard
|
|
3010
3011
|
|
|
3011
|
-
"@openzeppelin/upgrades-core@npm:^1.18.0":
|
|
3012
|
+
"@openzeppelin/upgrades-core@npm:1.18.0, @openzeppelin/upgrades-core@npm:^1.18.0":
|
|
3012
3013
|
version: 1.18.0
|
|
3013
3014
|
resolution: "@openzeppelin/upgrades-core@npm:1.18.0"
|
|
3014
3015
|
dependencies:
|