@gooddollar/goodprotocol 1.0.0-beta.32 → 1.0.0-beta.42
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/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +60 -21
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
- package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.json +2 -2
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.json +2 -2
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.json +2 -2
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.json +2 -2
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.json +2 -2
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.json +2 -2
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.json +2 -2
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +6 -6
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.json +2 -2
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.json +2 -2
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.json +2 -2
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +4 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +224 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +4 -0
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +198 -0
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.json +2 -2
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.json +2 -2
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.json +2 -2
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.json +2 -2
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.json +2 -2
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.json +2 -2
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.json +2 -2
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.json +2 -2
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +3 -3
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +4 -4
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +4 -4
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +6 -6
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.json +2 -2
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.json +2 -2
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.json +2 -2
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.json +7 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +7 -2
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +4 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +95 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +4 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.json +185 -0
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
- package/contracts/governance/CompoundVotingMachine.sol +99 -83
- package/contracts/governance/GovarnanceStaking.sol +3 -5
- package/contracts/mocks/UpgradableMocks.sol +31 -0
- package/contracts/utils/DAOUpgradeableContract.sol +1 -1
- package/contracts/utils/ProtocolUpgrade.sol +7 -14
- package/contracts/utils/ProtocolUpgradeFuse.sol +2 -2
- package/contracts/utils/ProxyFactory1967.sol +153 -0
- package/hardhat.config.ts +1 -1
- package/package.json +8 -8
- package/releases/deploy-settings.json +3 -3
- package/releases/deployment.json +1 -1
- package/releases/olddao.json +1 -1
- package/scripts/gdx/gdxAirdropCalculation.ts +11 -10
- package/scripts/governance/airdropCalculation.ts +235 -65
- package/scripts/releaser.js +11 -5
- package/scripts/upgradeToV2/upgradeToV2.ts +353 -228
- package/test/governance/CompoundVotingMachine.daoscheme.ts +124 -10
- package/test/governance/CompoundVotingMachine.guardian.test.ts +38 -7
- package/test/localOldDaoDeploy.ts +24 -24
- package/test/staking/DonationsStaking.test.ts +13 -12
- package/test/utils/ProxyFactory.test.ts +102 -0
- package/tsconfig.json +1 -1
- package/yarn.lock +253 -32
- package/test/simulateInterest.ts +0 -85
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
import { network, ethers, upgrades } from "hardhat";
|
|
11
11
|
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
12
12
|
import { isFunction, get } from "lodash";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
AaveStakingFactory,
|
|
15
|
+
CompoundStakingFactory,
|
|
16
|
+
ProxyFactory1967
|
|
17
|
+
} from "../../types";
|
|
14
18
|
import SchemeRegistrarABI from "@gooddollar/goodcontracts/build/contracts/SchemeRegistrar.json";
|
|
15
19
|
import releaser from "../releaser";
|
|
16
20
|
import {
|
|
@@ -26,6 +30,26 @@ import { fetchOrDeployProxyFactory } from "../fetchOrDeployProxyFactory";
|
|
|
26
30
|
import OldDAO from "../../releases/olddao.json";
|
|
27
31
|
|
|
28
32
|
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
33
|
+
import { keccak256 } from "@ethersproject/keccak256";
|
|
34
|
+
|
|
35
|
+
const GAS_SETTINGS = {
|
|
36
|
+
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
|
|
37
|
+
maxFeePerGas: ethers.utils.parseUnits("50", "gwei"),
|
|
38
|
+
gasLimit: 30000000
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
let totalGas = 0;
|
|
42
|
+
const gasUsage = {};
|
|
43
|
+
const countTotalGas = async (tx, name) => {
|
|
44
|
+
let res = tx;
|
|
45
|
+
if (tx.deployTransaction) tx = tx.deployTransaction;
|
|
46
|
+
if (tx.wait) res = await tx.wait();
|
|
47
|
+
if (res.gasUsed) {
|
|
48
|
+
totalGas += parseInt(res.gasUsed);
|
|
49
|
+
gasUsage[name] = gasUsage[name] || 0;
|
|
50
|
+
gasUsage[name] += parseInt(res.gasUsed);
|
|
51
|
+
} else console.log("no gas data", { res, tx });
|
|
52
|
+
};
|
|
29
53
|
|
|
30
54
|
console.log({
|
|
31
55
|
networkNames,
|
|
@@ -34,7 +58,11 @@ console.log({
|
|
|
34
58
|
});
|
|
35
59
|
const { name } = network;
|
|
36
60
|
|
|
37
|
-
export const main = async (
|
|
61
|
+
export const main = async (
|
|
62
|
+
networkName = name,
|
|
63
|
+
isPerformUpgrade = true,
|
|
64
|
+
olddao?
|
|
65
|
+
) => {
|
|
38
66
|
if (networkName.startsWith("dapptest") === false) {
|
|
39
67
|
networkNames[1] = networkName;
|
|
40
68
|
networkNames[122] = networkName;
|
|
@@ -42,7 +70,12 @@ export const main = async (networkName = name) => {
|
|
|
42
70
|
}
|
|
43
71
|
|
|
44
72
|
const isProduction = networkName.startsWith("production");
|
|
73
|
+
if (isProduction) {
|
|
74
|
+
GAS_SETTINGS.gasLimit = 7000000;
|
|
75
|
+
}
|
|
45
76
|
const isBackendTest = networkName.startsWith("dapptest");
|
|
77
|
+
const isTest = network.name === "hardhat";
|
|
78
|
+
const isCoverage = process.env.CODE_COVERAGE;
|
|
46
79
|
const isDevelop = !isProduction;
|
|
47
80
|
const isMainnet = networkName.includes("mainnet");
|
|
48
81
|
let protocolSettings = {
|
|
@@ -50,7 +83,7 @@ export const main = async (networkName = name) => {
|
|
|
50
83
|
...ProtocolSettings[networkName]
|
|
51
84
|
};
|
|
52
85
|
console.log(`networkName ${networkName}`);
|
|
53
|
-
const dao = OldDAO[networkName];
|
|
86
|
+
const dao = olddao || OldDAO[networkName];
|
|
54
87
|
const fse = require("fs-extra");
|
|
55
88
|
const ProtocolAddresses = await fse.readJson("releases/deployment.json");
|
|
56
89
|
const newfusedao = await ProtocolAddresses[
|
|
@@ -58,14 +91,12 @@ export const main = async (networkName = name) => {
|
|
|
58
91
|
];
|
|
59
92
|
const newdao = ProtocolAddresses[networkName] || {};
|
|
60
93
|
|
|
61
|
-
let [root] = await ethers.getSigners();
|
|
94
|
+
let [root, proxyDeployer] = await ethers.getSigners();
|
|
62
95
|
|
|
63
96
|
let avatar = dao.Avatar;
|
|
64
97
|
let controller = dao.Controller;
|
|
65
98
|
let repStateId = isMainnet ? "fuse" : "rootState";
|
|
66
|
-
let oldVotingMachine = dao.SchemeRegistrar;
|
|
67
99
|
|
|
68
|
-
let grep: GReputation, vm: CompoundVotingMachine;
|
|
69
100
|
const founders = await getFounders(networkName);
|
|
70
101
|
|
|
71
102
|
const compoundTokens = [
|
|
@@ -100,187 +131,286 @@ export const main = async (networkName = name) => {
|
|
|
100
131
|
}
|
|
101
132
|
];
|
|
102
133
|
|
|
103
|
-
let
|
|
104
|
-
const countTotalGas = async tx => {
|
|
105
|
-
let res = tx;
|
|
106
|
-
if (tx.deployTransaction) tx = tx.deployTransaction;
|
|
107
|
-
if (tx.wait) res = await tx.wait();
|
|
108
|
-
if (res.gasUsed) totalGas += parseInt(res.gasUsed);
|
|
109
|
-
else console.log("no gas data", { res, tx });
|
|
110
|
-
};
|
|
134
|
+
let release = {};
|
|
111
135
|
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"DAI_ETH_ORACLE",
|
|
136
|
-
"ETH_USD_ORACLE"
|
|
137
|
-
].map(_ => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(_))),
|
|
138
|
-
[
|
|
139
|
-
controller,
|
|
140
|
-
avatar,
|
|
141
|
-
dao.Identity,
|
|
142
|
-
dao.GoodDollar,
|
|
143
|
-
dao.Contribution,
|
|
144
|
-
protocolSettings.bancor || dao.BancorFormula,
|
|
145
|
-
get(protocolSettings, "compound.dai", dao.DAI),
|
|
146
|
-
get(protocolSettings, "compound.cdai", dao.cDAI),
|
|
147
|
-
get(protocolSettings, "compound.comp", dao.COMP),
|
|
148
|
-
dao.ForeignBridge,
|
|
149
|
-
protocolSettings.uniswapRouter || dao.UniswapRouter,
|
|
150
|
-
!isMainnet ||
|
|
151
|
-
dao.GasPriceOracle ||
|
|
152
|
-
protocolSettings.chainlink.gasPrice, //should fail if missing only on mainnet
|
|
153
|
-
!isMainnet ||
|
|
154
|
-
dao.DAIEthOracle ||
|
|
155
|
-
protocolSettings.chainlink.dai_eth,
|
|
156
|
-
!isMainnet || dao.ETHUsdOracle || protocolSettings.chainlink.eth_usd
|
|
157
|
-
]
|
|
158
|
-
]
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
network: "fuse",
|
|
162
|
-
name: "NameService",
|
|
163
|
-
args: [
|
|
136
|
+
const toDeployUpgradable = [
|
|
137
|
+
{
|
|
138
|
+
network: "mainnet",
|
|
139
|
+
name: "NameService",
|
|
140
|
+
args: [
|
|
141
|
+
controller,
|
|
142
|
+
[
|
|
143
|
+
"CONTROLLER",
|
|
144
|
+
"AVATAR",
|
|
145
|
+
"IDENTITY",
|
|
146
|
+
"GOODDOLLAR",
|
|
147
|
+
"CONTRIBUTION_CALCULATION",
|
|
148
|
+
"BANCOR_FORMULA",
|
|
149
|
+
"DAI",
|
|
150
|
+
"CDAI",
|
|
151
|
+
"COMP",
|
|
152
|
+
"BRIDGE_CONTRACT",
|
|
153
|
+
"UNISWAP_ROUTER",
|
|
154
|
+
"GAS_PRICE_ORACLE",
|
|
155
|
+
"DAI_ETH_ORACLE",
|
|
156
|
+
"ETH_USD_ORACLE"
|
|
157
|
+
].map(_ => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(_))),
|
|
158
|
+
[
|
|
164
159
|
controller,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
() => get(release, "NameService", newdao.NameService),
|
|
181
|
-
repStateId,
|
|
182
|
-
protocolSettings.governance.gdaoAirdrop, //should fail on real deploy if not set
|
|
183
|
-
protocolSettings.governance.gdaoTotalSupply //should fail on real deploy if not set
|
|
184
|
-
]
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
network: "both",
|
|
188
|
-
name: "CompoundVotingMachine",
|
|
189
|
-
args: [
|
|
190
|
-
() => get(release, "NameService", newdao.NameService),
|
|
191
|
-
protocolSettings.governance.proposalVotingPeriod
|
|
192
|
-
]
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
network: "mainnet",
|
|
196
|
-
name: "GoodMarketMaker",
|
|
197
|
-
args: [
|
|
198
|
-
() => get(release, "NameService", newdao.NameService),
|
|
199
|
-
protocolSettings.expansionRatio.nom,
|
|
200
|
-
protocolSettings.expansionRatio.denom
|
|
201
|
-
]
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
network: "mainnet",
|
|
205
|
-
name: "GoodReserveCDai",
|
|
206
|
-
initializer: "initialize(address, bytes32)",
|
|
207
|
-
args: [
|
|
208
|
-
() => get(release, "NameService", newdao.NameService),
|
|
209
|
-
protocolSettings.gdxAirdrop
|
|
210
|
-
]
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
network: "mainnet",
|
|
214
|
-
name: "ExchangeHelper",
|
|
215
|
-
initializer: "initialize(address)",
|
|
216
|
-
args: [() => get(release, "NameService", newdao.NameService)]
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
network: "mainnet",
|
|
220
|
-
name: "GoodFundManager",
|
|
221
|
-
args: [() => get(release, "NameService", newdao.NameService)]
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
network: "mainnet",
|
|
225
|
-
name: "StakersDistribution",
|
|
226
|
-
args: [() => get(release, "NameService", newdao.NameService)]
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
network: "fuse",
|
|
230
|
-
name: "ClaimersDistribution",
|
|
231
|
-
args: [() => get(release, "NameService", newdao.NameService)]
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
network: "fuse",
|
|
235
|
-
name: "GovernanceStaking",
|
|
236
|
-
args: [() => get(release, "NameService", newdao.NameService)],
|
|
237
|
-
isUpgradable: false
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
network: "fuse",
|
|
241
|
-
name: "UBIScheme",
|
|
242
|
-
initializer: "initialize(address, address, uint256)",
|
|
243
|
-
args: [
|
|
244
|
-
() => get(release, "NameService", newdao.NameService),
|
|
245
|
-
dao.FirstClaimPool,
|
|
246
|
-
14
|
|
160
|
+
avatar,
|
|
161
|
+
dao.Identity,
|
|
162
|
+
dao.GoodDollar,
|
|
163
|
+
dao.Contribution,
|
|
164
|
+
protocolSettings.bancor || dao.BancorFormula,
|
|
165
|
+
get(protocolSettings, "compound.dai", dao.DAI),
|
|
166
|
+
get(protocolSettings, "compound.cdai", dao.cDAI),
|
|
167
|
+
get(protocolSettings, "compound.comp", dao.COMP),
|
|
168
|
+
dao.ForeignBridge,
|
|
169
|
+
protocolSettings.uniswapRouter || dao.UniswapRouter,
|
|
170
|
+
!isMainnet ||
|
|
171
|
+
dao.GasPriceOracle ||
|
|
172
|
+
protocolSettings.chainlink.gasPrice, //should fail if missing only on mainnet
|
|
173
|
+
!isMainnet || dao.DAIEthOracle || protocolSettings.chainlink.dai_eth,
|
|
174
|
+
!isMainnet || dao.ETHUsdOracle || protocolSettings.chainlink.eth_usd
|
|
247
175
|
]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
network: "fuse",
|
|
180
|
+
name: "NameService",
|
|
181
|
+
args: [
|
|
182
|
+
controller,
|
|
183
|
+
[
|
|
184
|
+
"CONTROLLER",
|
|
185
|
+
"AVATAR",
|
|
186
|
+
"IDENTITY",
|
|
187
|
+
"GOODDOLLAR",
|
|
188
|
+
"BRIDGE_CONTRACT"
|
|
189
|
+
].map(_ => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(_))),
|
|
190
|
+
[controller, avatar, dao.Identity, dao.GoodDollar, dao.HomeBridge]
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
network: "both",
|
|
195
|
+
name: "GReputation",
|
|
196
|
+
initializer: "initialize(address, string, bytes32, uint256)",
|
|
197
|
+
args: [
|
|
198
|
+
() => get(release, "NameService", newdao.NameService),
|
|
199
|
+
repStateId,
|
|
200
|
+
protocolSettings.governance.gdaoAirdrop, //should fail on real deploy if not set
|
|
201
|
+
protocolSettings.governance.gdaoTotalSupply //should fail on real deploy if not set
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
network: "both",
|
|
206
|
+
name: "CompoundVotingMachine",
|
|
207
|
+
args: [
|
|
208
|
+
() => get(release, "NameService", newdao.NameService),
|
|
209
|
+
protocolSettings.governance.proposalVotingPeriod
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
network: "mainnet",
|
|
214
|
+
name: "GoodMarketMaker",
|
|
215
|
+
args: [
|
|
216
|
+
() => get(release, "NameService", newdao.NameService),
|
|
217
|
+
protocolSettings.expansionRatio.nom,
|
|
218
|
+
protocolSettings.expansionRatio.denom
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
network: "mainnet",
|
|
223
|
+
name: "GoodReserveCDai",
|
|
224
|
+
initializer: "initialize(address, bytes32)",
|
|
225
|
+
args: [
|
|
226
|
+
() => get(release, "NameService", newdao.NameService),
|
|
227
|
+
protocolSettings.gdxAirdrop
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
network: "mainnet",
|
|
232
|
+
name: "ExchangeHelper",
|
|
233
|
+
initializer: "initialize(address)",
|
|
234
|
+
args: [() => get(release, "NameService", newdao.NameService)]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
network: "mainnet",
|
|
238
|
+
name: "GoodFundManager",
|
|
239
|
+
args: [() => get(release, "NameService", newdao.NameService)]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
network: "mainnet",
|
|
243
|
+
name: "StakersDistribution",
|
|
244
|
+
args: [() => get(release, "NameService", newdao.NameService)]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
network: "fuse",
|
|
248
|
+
name: "ClaimersDistribution",
|
|
249
|
+
args: [() => get(release, "NameService", newdao.NameService)]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
network: "fuse",
|
|
253
|
+
name: "GovernanceStaking",
|
|
254
|
+
args: [() => get(release, "NameService", newdao.NameService)],
|
|
255
|
+
isUpgradable: false
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
network: "fuse",
|
|
259
|
+
name: "UBIScheme",
|
|
260
|
+
initializer: "initialize(address, address, uint256)",
|
|
261
|
+
args: [
|
|
262
|
+
() => get(release, "NameService", newdao.NameService),
|
|
263
|
+
dao.FirstClaimPool,
|
|
264
|
+
14
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
network: "mainnet",
|
|
269
|
+
name: "ProtocolUpgrade",
|
|
270
|
+
args: [dao.Controller, root.address],
|
|
271
|
+
isUpgradable: false,
|
|
272
|
+
initializer: null
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
network: "fuse",
|
|
276
|
+
name: "ProtocolUpgradeFuse",
|
|
277
|
+
args: [dao.Controller, root.address],
|
|
278
|
+
isUpgradable: false
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
network: "mainnet",
|
|
282
|
+
name: "UniswapV2SwapHelper",
|
|
283
|
+
args: [],
|
|
284
|
+
isUpgradable: false
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
network: "mainnet",
|
|
288
|
+
name: "CompoundStakingFactory",
|
|
289
|
+
args: [],
|
|
290
|
+
isUpgradable: false,
|
|
291
|
+
libraries: ["UniswapV2SwapHelper"]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
network: "mainnet",
|
|
295
|
+
name: "AaveStakingFactory",
|
|
296
|
+
args: [],
|
|
297
|
+
isUpgradable: false,
|
|
298
|
+
libraries: ["UniswapV2SwapHelper"]
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
|
|
302
|
+
let proxyFactory: ProxyFactory1967;
|
|
303
|
+
const getProxyFactory = async () => {
|
|
304
|
+
if (isDevelop === false && newdao.ProxyFactory) {
|
|
305
|
+
console.info("deploying ProxyFactory1967");
|
|
306
|
+
return (proxyFactory = ethers.getContractAt(
|
|
307
|
+
"ProxyFactory1967",
|
|
308
|
+
newdao.ProxyFactory
|
|
309
|
+
) as unknown as ProxyFactory1967);
|
|
310
|
+
} else {
|
|
311
|
+
const pf = await (
|
|
312
|
+
await ethers.getContractFactory("ProxyFactory1967", proxyDeployer)
|
|
313
|
+
).deploy(GAS_SETTINGS);
|
|
314
|
+
await pf.deployed();
|
|
315
|
+
await releaser(
|
|
316
|
+
{ ProxyFactory: pf.address },
|
|
317
|
+
networkName,
|
|
318
|
+
"deployment",
|
|
319
|
+
false
|
|
320
|
+
);
|
|
321
|
+
return (proxyFactory = pf.connect(root) as unknown as ProxyFactory1967);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const deployDeterministic = async (
|
|
326
|
+
contract,
|
|
327
|
+
args: any[],
|
|
328
|
+
factoryOpts = {}
|
|
329
|
+
) => {
|
|
330
|
+
try {
|
|
331
|
+
const Contract = await ethers.getContractFactory(
|
|
332
|
+
contract.name,
|
|
333
|
+
factoryOpts
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
const salt = ethers.BigNumber.from(
|
|
337
|
+
keccak256(ethers.utils.toUtf8Bytes(contract.name))
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
if (contract.isUpgradable !== false) {
|
|
341
|
+
if (isCoverage) {
|
|
342
|
+
//coverage has large contracts doesnt work with proxy factory
|
|
343
|
+
const tx = await upgrades.deployProxy(Contract, args, {
|
|
344
|
+
initializer: contract.initializer,
|
|
345
|
+
kind: "uups"
|
|
346
|
+
});
|
|
347
|
+
await countTotalGas(tx, contract.name);
|
|
348
|
+
return tx;
|
|
349
|
+
}
|
|
350
|
+
const encoded = Contract.interface.encodeFunctionData(
|
|
351
|
+
contract.initializer || "initialize",
|
|
352
|
+
args
|
|
353
|
+
);
|
|
354
|
+
const tx = await Contract.deploy(GAS_SETTINGS);
|
|
355
|
+
const impl = await tx.deployed();
|
|
356
|
+
await countTotalGas(tx, contract.name);
|
|
357
|
+
|
|
358
|
+
const tx2 = await proxyFactory.deployProxy(
|
|
359
|
+
salt,
|
|
360
|
+
impl.address,
|
|
361
|
+
encoded,
|
|
362
|
+
GAS_SETTINGS
|
|
363
|
+
);
|
|
364
|
+
await countTotalGas(tx2, contract.name);
|
|
365
|
+
const deployTx = await tx2
|
|
366
|
+
.wait()
|
|
367
|
+
.catch(e =>
|
|
368
|
+
console.error("failed to deploy proxy, assuming it exists...", e)
|
|
369
|
+
);
|
|
370
|
+
return ethers.getContractAt(
|
|
371
|
+
contract.name,
|
|
372
|
+
await proxyFactory["getDeploymentAddress(uint256,address)"](
|
|
373
|
+
salt,
|
|
374
|
+
root.address
|
|
375
|
+
)
|
|
376
|
+
);
|
|
377
|
+
} else {
|
|
378
|
+
//for some reason deploying with link library via proxy doesnt work on hardhat test env
|
|
379
|
+
if (isTest === false) {
|
|
380
|
+
const constructor = Contract.interface.encodeDeploy(args);
|
|
381
|
+
const bytecode = ethers.utils.solidityPack(
|
|
382
|
+
["bytes", "bytes"],
|
|
383
|
+
[Contract.bytecode, constructor]
|
|
384
|
+
);
|
|
385
|
+
const deployTx = await (
|
|
386
|
+
await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)
|
|
387
|
+
).wait();
|
|
388
|
+
return ethers.getContractAt(
|
|
389
|
+
contract.name,
|
|
390
|
+
await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](
|
|
391
|
+
salt,
|
|
392
|
+
root.address,
|
|
393
|
+
keccak256(bytecode)
|
|
394
|
+
)
|
|
395
|
+
);
|
|
396
|
+
} else {
|
|
397
|
+
const tx = await Contract.deploy(...args, GAS_SETTINGS);
|
|
398
|
+
await countTotalGas(tx, contract.name);
|
|
399
|
+
const impl = await tx.deployed();
|
|
400
|
+
return impl;
|
|
401
|
+
}
|
|
281
402
|
}
|
|
282
|
-
|
|
403
|
+
} catch (e) {
|
|
404
|
+
console.log("Failed deploying contract:", { contract });
|
|
405
|
+
throw e;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const deployContracts = async () => {
|
|
410
|
+
console.log({ dao, newdao, protocolSettings });
|
|
283
411
|
|
|
412
|
+
await getProxyFactory();
|
|
413
|
+
console.info("got proxyfactory at:", proxyFactory.address);
|
|
284
414
|
for (let contract of toDeployUpgradable) {
|
|
285
415
|
if (
|
|
286
416
|
contract.network !== "both" &&
|
|
@@ -310,8 +440,8 @@ export const main = async (networkName = name) => {
|
|
|
310
440
|
);
|
|
311
441
|
|
|
312
442
|
console.log(`deploying contract upgrade ${contract.name}`, {
|
|
313
|
-
args
|
|
314
|
-
release
|
|
443
|
+
args
|
|
444
|
+
// release
|
|
315
445
|
// pf: ProxyFactory.factory.address
|
|
316
446
|
});
|
|
317
447
|
let opts = {};
|
|
@@ -321,19 +451,11 @@ export const main = async (networkName = name) => {
|
|
|
321
451
|
opts = { libraries };
|
|
322
452
|
}
|
|
323
453
|
const Contract = await ethers.getContractFactory(contract.name, opts);
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (contract.isUpgradable !== false)
|
|
328
|
-
deployed = await upgrades.deployProxy(Contract, args, {
|
|
329
|
-
// proxyFactory: ProxyFactory,
|
|
330
|
-
initializer: contract.initializer,
|
|
331
|
-
kind: "uups"
|
|
332
|
-
});
|
|
333
|
-
else deployed = await Contract.deploy(...args);
|
|
334
|
-
deployed.deployed();
|
|
335
|
-
countTotalGas(deployed);
|
|
454
|
+
|
|
455
|
+
let deployed = await deployDeterministic(contract, args, opts);
|
|
456
|
+
|
|
336
457
|
console.log(`${contract.name} deployed to: ${deployed.address}`);
|
|
458
|
+
await releaser(release, networkName, "deployment", false);
|
|
337
459
|
release[contract.name] = deployed.address;
|
|
338
460
|
}
|
|
339
461
|
|
|
@@ -371,7 +493,7 @@ export const main = async (networkName = name) => {
|
|
|
371
493
|
});
|
|
372
494
|
let res = Object.assign(newdao, release);
|
|
373
495
|
await releaser(release, networkName);
|
|
374
|
-
return
|
|
496
|
+
return release;
|
|
375
497
|
};
|
|
376
498
|
|
|
377
499
|
// const proveNewRep = async () => {
|
|
@@ -457,7 +579,7 @@ export const main = async (networkName = name) => {
|
|
|
457
579
|
release.StakingContracts.map((_: any) => _[1])
|
|
458
580
|
)
|
|
459
581
|
).wait();
|
|
460
|
-
await countTotalGas(tx);
|
|
582
|
+
await countTotalGas(tx, "call upgrade basic");
|
|
461
583
|
|
|
462
584
|
console.log("upgrading reserve...", {
|
|
463
585
|
params: [
|
|
@@ -475,7 +597,7 @@ export const main = async (networkName = name) => {
|
|
|
475
597
|
dao.FundManager,
|
|
476
598
|
dao.COMP
|
|
477
599
|
);
|
|
478
|
-
await countTotalGas(tx);
|
|
600
|
+
await countTotalGas(tx, "call upgrade reserve");
|
|
479
601
|
console.log("upgrading donationstaking...", {
|
|
480
602
|
params: [
|
|
481
603
|
release.NameService,
|
|
@@ -489,7 +611,7 @@ export const main = async (networkName = name) => {
|
|
|
489
611
|
release.DonationsStaking, //new
|
|
490
612
|
dao.DAIStaking
|
|
491
613
|
);
|
|
492
|
-
await countTotalGas(tx);
|
|
614
|
+
await countTotalGas(tx, "call upgrade donations");
|
|
493
615
|
console.log("Donation staking upgraded");
|
|
494
616
|
//extract just the addresses without the rewards
|
|
495
617
|
// release.StakingContracts = release.StakingContracts.map((_) => _[0]);
|
|
@@ -506,7 +628,7 @@ export const main = async (networkName = name) => {
|
|
|
506
628
|
dao.UpgradeScheme,
|
|
507
629
|
release.CompoundVotingMachine
|
|
508
630
|
);
|
|
509
|
-
await countTotalGas(tx);
|
|
631
|
+
await countTotalGas(tx, "call upgrade gov");
|
|
510
632
|
}
|
|
511
633
|
};
|
|
512
634
|
|
|
@@ -585,7 +707,7 @@ export const main = async (networkName = name) => {
|
|
|
585
707
|
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("ProtocolUpgrade"))
|
|
586
708
|
)
|
|
587
709
|
).wait();
|
|
588
|
-
await countTotalGas(proposal);
|
|
710
|
+
await countTotalGas(proposal, "propose upgrade");
|
|
589
711
|
|
|
590
712
|
console.log("proposal tx:", proposal.transactionHash);
|
|
591
713
|
let proposalId = proposal.events.find(_ => _.event === "NewSchemeProposal")
|
|
@@ -609,7 +731,7 @@ export const main = async (networkName = name) => {
|
|
|
609
731
|
absoluteVote
|
|
610
732
|
.connect(f)
|
|
611
733
|
.vote(proposalId, 1, 0, f.address, { gasLimit: 300000 })
|
|
612
|
-
.then(_ => countTotalGas(_.wait()))
|
|
734
|
+
.then(_ => countTotalGas(_.wait(), "vote"))
|
|
613
735
|
.catch(e => console.log("founder vote failed:", f.address, e.message))
|
|
614
736
|
)
|
|
615
737
|
);
|
|
@@ -655,7 +777,7 @@ export const main = async (networkName = name) => {
|
|
|
655
777
|
token.swapPath
|
|
656
778
|
)
|
|
657
779
|
).wait();
|
|
658
|
-
countTotalGas(tx);
|
|
780
|
+
await countTotalGas(tx, "deploy comp staking");
|
|
659
781
|
const log = tx.events.find(_ => _.event === "Deployed");
|
|
660
782
|
if (!log.args.proxy)
|
|
661
783
|
throw new Error(`staking contract deploy failed ${token}`);
|
|
@@ -693,7 +815,7 @@ export const main = async (networkName = name) => {
|
|
|
693
815
|
token.swapPath
|
|
694
816
|
)
|
|
695
817
|
).wait();
|
|
696
|
-
await countTotalGas(tx);
|
|
818
|
+
await countTotalGas(tx, "deploy aave staking");
|
|
697
819
|
const log = tx.events.find(_ => _.event === "Deployed");
|
|
698
820
|
if (!log.args.proxy)
|
|
699
821
|
throw new Error(`staking contract deploy failed ${token}`);
|
|
@@ -710,14 +832,15 @@ export const main = async (networkName = name) => {
|
|
|
710
832
|
}
|
|
711
833
|
|
|
712
834
|
console.log("deploying donation staking");
|
|
713
|
-
const deployedDonationsStaking = await
|
|
714
|
-
await ethers.getContractFactory("DonationsStaking"),
|
|
715
|
-
[release.NameService, deployed[0][0]],
|
|
835
|
+
const deployedDonationsStaking = await deployDeterministic(
|
|
716
836
|
{
|
|
717
|
-
|
|
718
|
-
|
|
837
|
+
network: "mainnet",
|
|
838
|
+
name: "DonationsStaking",
|
|
839
|
+
isUpgradable: true
|
|
840
|
+
},
|
|
841
|
+
[release.NameService, deployed[0][0]]
|
|
719
842
|
);
|
|
720
|
-
await countTotalGas(deployedDonationsStaking);
|
|
843
|
+
// await countTotalGas(deployedDonationsStaking);
|
|
721
844
|
|
|
722
845
|
console.log(
|
|
723
846
|
`DonationsStaking deployed to: ${deployedDonationsStaking.address}`
|
|
@@ -727,26 +850,28 @@ export const main = async (networkName = name) => {
|
|
|
727
850
|
DonationsStaking: deployedDonationsStaking.address,
|
|
728
851
|
StakingContracts: deployed
|
|
729
852
|
};
|
|
730
|
-
|
|
731
|
-
// return {
|
|
732
|
-
// DonationsStaking: release["DonationsStaking"],
|
|
733
|
-
// StakingContracts: deployed
|
|
734
|
-
// };
|
|
735
853
|
};
|
|
736
854
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
855
|
+
await deployContracts();
|
|
856
|
+
if (isPerformUpgrade) {
|
|
857
|
+
console.log("deployed contracts", { totalGas });
|
|
858
|
+
await voteProtocolUpgrade(release);
|
|
859
|
+
console.log("voted contracts", { totalGas });
|
|
860
|
+
isMainnet && (await performUpgrade(release));
|
|
861
|
+
!isMainnet && (await performUpgradeFuse(release));
|
|
862
|
+
console.log("upgraded contracts", { totalGas });
|
|
863
|
+
}
|
|
744
864
|
await releaser(release, networkName);
|
|
865
|
+
return release;
|
|
745
866
|
// await proveNewRep();
|
|
746
867
|
};
|
|
747
|
-
if (
|
|
748
|
-
main(name)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
868
|
+
if (network.name !== "hardhat") {
|
|
869
|
+
main(name)
|
|
870
|
+
.catch(e => {
|
|
871
|
+
console.log(e);
|
|
872
|
+
throw e;
|
|
873
|
+
})
|
|
874
|
+
.finally(() => {
|
|
875
|
+
console.log({ totalGas, gasUsage });
|
|
876
|
+
});
|
|
752
877
|
}
|