@gooddollar/goodprotocol 2.0.23 → 2.0.25-beta.0
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/abis/BuyGDClone.min.json +1 -1
- package/artifacts/abis/BuyGDCloneFactory.min.json +1 -1
- package/artifacts/abis/DonateGDClone.min.json +1 -1
- 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/IAdminWallet.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/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.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/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- 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/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- 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/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.json +2 -2
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.json +48 -5
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.json +41 -2
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.json +79 -5
- package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- 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/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/token/MultichainFeeFormula.sol +5 -2
- package/contracts/ubi/UBISchemeV2.sol +3 -3
- package/contracts/utils/BuyGDClone.sol +82 -14
- package/package.json +1 -1
- package/releases/deploy-settings.json +1 -1
- package/releases/deployment.json +3 -3
- package/scripts/analytics/activeWalletsStats.ts +53 -23
- package/scripts/analytics/faucetStats.ts +19 -15
- package/scripts/multichain-deploy/helpers.ts +42 -113
- package/scripts/proposals/hack-ubi-recovery.ts +414 -0
- package/scripts/upgrades/multichain-formula-upgrade.ts +4 -1
- package/types/contracts/utils/BuyGDClone.sol/BuyGDClone.ts +28 -3
- package/types/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.ts +52 -2
- package/types/contracts/utils/BuyGDClone.sol/DonateGDClone.ts +56 -3
- package/types/factories/contracts/token/MultichainFeeFormula__factory.ts +1 -1
- package/types/factories/contracts/ubi/UBISchemeV2__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory__factory.ts +40 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDClone__factory.ts +47 -4
- package/types/factories/contracts/utils/BuyGDClone.sol/DonateGDClone__factory.ts +78 -4
|
@@ -12,18 +12,14 @@ import dao from "../../releases/deployment.json";
|
|
|
12
12
|
|
|
13
13
|
const exec = util.promisify(require("child_process").exec);
|
|
14
14
|
|
|
15
|
-
const networkName =
|
|
16
|
-
network.name === "localhost" ? "production-mainnet" : network.name;
|
|
15
|
+
const networkName = network.name === "localhost" ? "production-mainnet" : network.name;
|
|
17
16
|
let totalGas = 0;
|
|
18
17
|
const gasUsage = {};
|
|
19
18
|
const GAS_SETTINGS = { gasLimit: 10000000 };
|
|
20
19
|
let release: { [key: string]: any } = dao[networkName];
|
|
21
20
|
|
|
22
21
|
export const verifyProductionSigner = signer => {
|
|
23
|
-
if (
|
|
24
|
-
signer.address.toLowerCase() !==
|
|
25
|
-
"0x5128E3C1f8846724cc1007Af9b4189713922E4BB".toLowerCase()
|
|
26
|
-
) {
|
|
22
|
+
if (signer.address.toLowerCase() !== "0x5128E3C1f8846724cc1007Af9b4189713922E4BB".toLowerCase()) {
|
|
27
23
|
throw new Error(
|
|
28
24
|
"signer not 0x5128E3C1f8846724cc1007Af9b4189713922E4BB to get same deployed addresses on production"
|
|
29
25
|
);
|
|
@@ -77,9 +73,7 @@ export const deploySuperGoodDollar = async (
|
|
|
77
73
|
[]
|
|
78
74
|
).then(printDeploy)) as Contract;
|
|
79
75
|
|
|
80
|
-
await GoodDollarProxy.initializeProxy(SuperGoodDollar.address).then(
|
|
81
|
-
printDeploy
|
|
82
|
-
);
|
|
76
|
+
await GoodDollarProxy.initializeProxy(SuperGoodDollar.address).then(printDeploy);
|
|
83
77
|
|
|
84
78
|
const OutFlowNFT = (await deployDeterministic(
|
|
85
79
|
{
|
|
@@ -104,20 +98,11 @@ export const deploySuperGoodDollar = async (
|
|
|
104
98
|
"initialize(string,string,uint256,address,address,address,address,address,address)"
|
|
105
99
|
](...tokenArgs, OutFlowNFT.address, InFlowNFT.address);
|
|
106
100
|
|
|
107
|
-
const GoodDollar = await ethers.getContractAt(
|
|
108
|
-
"ISuperGoodDollar",
|
|
109
|
-
GoodDollarProxy.address
|
|
110
|
-
);
|
|
101
|
+
const GoodDollar = await ethers.getContractAt("ISuperGoodDollar", GoodDollarProxy.address);
|
|
111
102
|
|
|
112
|
-
const constantInflowNFT = await ethers.getContractAt(
|
|
113
|
-
"ConstantInflowNFT",
|
|
114
|
-
InFlowNFT.address
|
|
115
|
-
);
|
|
103
|
+
const constantInflowNFT = await ethers.getContractAt("ConstantInflowNFT", InFlowNFT.address);
|
|
116
104
|
|
|
117
|
-
const constantOutflowNFT = await ethers.getContractAt(
|
|
118
|
-
"ConstantOutflowNFT",
|
|
119
|
-
OutFlowNFT.address
|
|
120
|
-
);
|
|
105
|
+
const constantOutflowNFT = await ethers.getContractAt("ConstantOutflowNFT", OutFlowNFT.address);
|
|
121
106
|
|
|
122
107
|
await constantOutflowNFT
|
|
123
108
|
.attach(OutFlowNFT.address)
|
|
@@ -137,31 +122,17 @@ export const deploySuperGoodDollar = async (
|
|
|
137
122
|
return GoodDollar;
|
|
138
123
|
};
|
|
139
124
|
|
|
140
|
-
export const deployDeterministic = async (
|
|
141
|
-
contract,
|
|
142
|
-
args: any[],
|
|
143
|
-
factoryOpts = {},
|
|
144
|
-
redeployProxyFactory = false
|
|
145
|
-
) => {
|
|
125
|
+
export const deployDeterministic = async (contract, args: any[], factoryOpts = {}, redeployProxyFactory = false) => {
|
|
146
126
|
try {
|
|
147
127
|
let proxyFactory;
|
|
148
128
|
if (networkName.startsWith("develop") && redeployProxyFactory) {
|
|
149
|
-
proxyFactory = await (
|
|
150
|
-
|
|
151
|
-
).deploy();
|
|
152
|
-
} else
|
|
153
|
-
proxyFactory = await ethers.getContractAt(
|
|
154
|
-
"ProxyFactory1967",
|
|
155
|
-
release.ProxyFactory
|
|
156
|
-
);
|
|
129
|
+
proxyFactory = await (await ethers.getContractFactory("ProxyFactory1967")).deploy();
|
|
130
|
+
} else proxyFactory = await ethers.getContractAt("ProxyFactory1967", release.ProxyFactory);
|
|
157
131
|
const Contract =
|
|
158
|
-
(contract.factory as ContractFactory) ||
|
|
159
|
-
(await ethers.getContractFactory(contract.name, factoryOpts));
|
|
132
|
+
(contract.factory as ContractFactory) || (await ethers.getContractFactory(contract.name, factoryOpts));
|
|
160
133
|
|
|
161
134
|
const salt = ethers.BigNumber.from(
|
|
162
|
-
ethers.utils.keccak256(
|
|
163
|
-
ethers.utils.toUtf8Bytes(contract.salt || contract.name)
|
|
164
|
-
)
|
|
135
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes(contract.salt || contract.name))
|
|
165
136
|
);
|
|
166
137
|
|
|
167
138
|
if (contract.isUpgradeable === true) {
|
|
@@ -169,30 +140,19 @@ export const deployDeterministic = async (
|
|
|
169
140
|
args,
|
|
170
141
|
proxyFactory: proxyFactory.address
|
|
171
142
|
});
|
|
172
|
-
const encoded = Contract.interface.encodeFunctionData(
|
|
173
|
-
contract.initializer || "initialize",
|
|
174
|
-
args
|
|
175
|
-
);
|
|
143
|
+
const encoded = Contract.interface.encodeFunctionData(contract.initializer || "initialize", args);
|
|
176
144
|
const tx = await Contract.deploy(GAS_SETTINGS);
|
|
177
145
|
const impl = await tx.deployed();
|
|
178
146
|
console.log("implementation deployed:", contract.name, impl.address);
|
|
179
147
|
await countTotalGas(tx, contract.name);
|
|
180
148
|
|
|
181
|
-
const tx2 = await proxyFactory.deployProxy(
|
|
149
|
+
const tx2 = await proxyFactory.deployProxy(salt, impl.address, encoded, GAS_SETTINGS);
|
|
150
|
+
await countTotalGas(tx2, contract.name);
|
|
151
|
+
const deployTx = await tx2.wait().catch(e => console.error("failed to deploy proxy, assuming it exists...", e));
|
|
152
|
+
const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address)"](
|
|
182
153
|
salt,
|
|
183
|
-
|
|
184
|
-
encoded,
|
|
185
|
-
GAS_SETTINGS
|
|
154
|
+
await proxyFactory.signer.getAddress()
|
|
186
155
|
);
|
|
187
|
-
await countTotalGas(tx2, contract.name);
|
|
188
|
-
const deployTx = await tx2
|
|
189
|
-
.wait()
|
|
190
|
-
.catch(e =>
|
|
191
|
-
console.error("failed to deploy proxy, assuming it exists...", e)
|
|
192
|
-
);
|
|
193
|
-
const proxyAddr = await proxyFactory[
|
|
194
|
-
"getDeploymentAddress(uint256,address)"
|
|
195
|
-
](salt, await proxyFactory.signer.getAddress());
|
|
196
156
|
console.log("proxy deployed:", contract.name, proxyAddr);
|
|
197
157
|
return Contract.attach(proxyAddr);
|
|
198
158
|
} else {
|
|
@@ -201,17 +161,10 @@ export const deployDeterministic = async (
|
|
|
201
161
|
args
|
|
202
162
|
});
|
|
203
163
|
const constructor = Contract.interface.encodeDeploy(args);
|
|
204
|
-
const bytecode = ethers.utils.solidityPack(
|
|
205
|
-
|
|
206
|
-
[Contract.bytecode, constructor]
|
|
207
|
-
);
|
|
208
|
-
const deployTx = await (
|
|
209
|
-
await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)
|
|
210
|
-
).wait();
|
|
164
|
+
const bytecode = ethers.utils.solidityPack(["bytes", "bytes"], [Contract.bytecode, constructor]);
|
|
165
|
+
const deployTx = await (await proxyFactory.deployCode(salt, bytecode, GAS_SETTINGS)).wait();
|
|
211
166
|
|
|
212
|
-
const proxyAddr = await proxyFactory[
|
|
213
|
-
"getDeploymentAddress(uint256,address,bytes32)"
|
|
214
|
-
](
|
|
167
|
+
const proxyAddr = await proxyFactory["getDeploymentAddress(uint256,address,bytes32)"](
|
|
215
168
|
salt,
|
|
216
169
|
await proxyFactory.signer.getAddress(),
|
|
217
170
|
ethers.utils.keccak256(bytecode)
|
|
@@ -235,9 +188,7 @@ export const executeViaGuardian = async (
|
|
|
235
188
|
network?: string
|
|
236
189
|
) => {
|
|
237
190
|
let release: { [key: string]: any } = dao[network || networkName];
|
|
238
|
-
const ctrl = await (
|
|
239
|
-
await ethers.getContractAt("Controller", release.Controller)
|
|
240
|
-
).connect(guardian);
|
|
191
|
+
const ctrl = await (await ethers.getContractAt("Controller", release.Controller)).connect(guardian);
|
|
241
192
|
|
|
242
193
|
const results = [];
|
|
243
194
|
for (let i = 0; i < contracts.length; i++) {
|
|
@@ -258,23 +209,21 @@ export const executeViaGuardian = async (
|
|
|
258
209
|
|
|
259
210
|
results.push(tx);
|
|
260
211
|
} else {
|
|
261
|
-
const simulationResult = await ctrl.callStatic.genericCall(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
release.Avatar,
|
|
265
|
-
ethValues[i],
|
|
266
|
-
{
|
|
267
|
-
from: await guardian.getAddress(),
|
|
268
|
-
value: ethValues[i]
|
|
269
|
-
}
|
|
270
|
-
);
|
|
212
|
+
const simulationResult = await ctrl.callStatic.genericCall(contract, encoded, release.Avatar, ethValues[i], {
|
|
213
|
+
from: await guardian.getAddress()
|
|
214
|
+
});
|
|
271
215
|
console.log("executing genericCall:", {
|
|
272
216
|
sigHash,
|
|
217
|
+
contract,
|
|
273
218
|
encoded,
|
|
274
219
|
simulationResult
|
|
275
220
|
});
|
|
276
221
|
if (simulationResult[0] === false) throw new Error("simulation failed:" + contract);
|
|
277
|
-
const tx = await ctrl
|
|
222
|
+
const tx = await ctrl
|
|
223
|
+
.genericCall(contract, encoded, release.Avatar, ethValues[i], {
|
|
224
|
+
gasLimit: 8000000
|
|
225
|
+
})
|
|
226
|
+
.then(printDeploy);
|
|
278
227
|
// console.log("generic call events:", tx.events);
|
|
279
228
|
results.push(tx);
|
|
280
229
|
}
|
|
@@ -291,32 +240,24 @@ export const executeViaSafe = async (
|
|
|
291
240
|
safeSignerOrNetwork?: Signer | string,
|
|
292
241
|
isSimulation = false
|
|
293
242
|
) => {
|
|
294
|
-
if (
|
|
295
|
-
typeof safeSignerOrNetwork !== "object" &&
|
|
296
|
-
!process.env.SAFEOWNER_PRIVATE_KEY
|
|
297
|
-
) {
|
|
243
|
+
if (typeof safeSignerOrNetwork !== "object" && !process.env.SAFEOWNER_PRIVATE_KEY) {
|
|
298
244
|
throw new Error("safe signer is missing");
|
|
299
245
|
}
|
|
300
246
|
|
|
301
|
-
let safeSigner = new ethers.Wallet(
|
|
302
|
-
process.env.SAFEOWNER_PRIVATE_KEY,
|
|
303
|
-
new ethers.providers.CloudflareProvider()
|
|
304
|
-
);
|
|
247
|
+
let safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY, new ethers.providers.CloudflareProvider());
|
|
305
248
|
if (typeof safeSignerOrNetwork === "string") {
|
|
306
249
|
switch (safeSignerOrNetwork) {
|
|
307
250
|
case "mainnet":
|
|
308
251
|
break;
|
|
309
252
|
case "celo":
|
|
310
|
-
safeSigner = new ethers.Wallet(
|
|
311
|
-
process.env.SAFEOWNER_PRIVATE_KEY
|
|
312
|
-
).connect(
|
|
253
|
+
safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
|
|
313
254
|
new ethers.providers.JsonRpcProvider("https://forno.celo.org")
|
|
314
255
|
);
|
|
315
256
|
break;
|
|
316
257
|
case "fuse":
|
|
317
|
-
safeSigner = new ethers.Wallet(
|
|
318
|
-
|
|
319
|
-
)
|
|
258
|
+
safeSigner = new ethers.Wallet(process.env.SAFEOWNER_PRIVATE_KEY).connect(
|
|
259
|
+
new ethers.providers.JsonRpcProvider("https://rpc.fuse.io")
|
|
260
|
+
);
|
|
320
261
|
break;
|
|
321
262
|
}
|
|
322
263
|
} else if (safeSignerOrNetwork) {
|
|
@@ -351,11 +292,7 @@ export const executeViaSafe = async (
|
|
|
351
292
|
const safeSdk = await Safe.create({ ethAdapter, safeAddress });
|
|
352
293
|
|
|
353
294
|
let release: { [key: string]: any } = dao[networkName];
|
|
354
|
-
const ctrl = await ethers.getContractAt(
|
|
355
|
-
"Controller",
|
|
356
|
-
release.Controller,
|
|
357
|
-
null
|
|
358
|
-
);
|
|
295
|
+
const ctrl = await ethers.getContractAt("Controller", release.Controller, null);
|
|
359
296
|
|
|
360
297
|
const safeTransactionData: MetaTransactionData[] = [];
|
|
361
298
|
|
|
@@ -418,8 +355,7 @@ export const executeViaSafe = async (
|
|
|
418
355
|
sigHash,
|
|
419
356
|
simulationResult
|
|
420
357
|
});
|
|
421
|
-
if (isSimulation === true && simulationResult[0] === false)
|
|
422
|
-
throw new Error("simulation failed:" + contract);
|
|
358
|
+
if (isSimulation === true && simulationResult[0] === false) throw new Error("simulation failed:" + contract);
|
|
423
359
|
const genericEncode = ctrl.interface.encodeFunctionData("genericCall", [
|
|
424
360
|
contract,
|
|
425
361
|
encoded,
|
|
@@ -465,19 +401,12 @@ export const verifyContract = async (
|
|
|
465
401
|
proxyName?: string,
|
|
466
402
|
forcedConstructorArguments?: string
|
|
467
403
|
) => {
|
|
468
|
-
let networkProvider = networkName.includes("-")
|
|
469
|
-
|
|
470
|
-
: "fuse";
|
|
471
|
-
networkProvider =
|
|
472
|
-
networkProvider === "mainnet" ? "ethereum" : networkProvider;
|
|
404
|
+
let networkProvider = networkName.includes("-") ? networkName.split("-")[1] : "fuse";
|
|
405
|
+
networkProvider = networkProvider === "mainnet" ? "ethereum" : networkProvider;
|
|
473
406
|
console.log("truffle compile...");
|
|
474
407
|
await exec("npx truffle compile");
|
|
475
|
-
const cmd = `npx truffle run verify ${
|
|
476
|
-
|
|
477
|
-
} ${contractName}@${address} ${
|
|
478
|
-
forcedConstructorArguments
|
|
479
|
-
? "--forceConstructorArgs string:" + forcedConstructorArguments.slice(2)
|
|
480
|
-
: ""
|
|
408
|
+
const cmd = `npx truffle run verify ${proxyName ? "--custom-proxy " + proxyName : ""} ${contractName}@${address} ${
|
|
409
|
+
forcedConstructorArguments ? "--forceConstructorArgs string:" + forcedConstructorArguments.slice(2) : ""
|
|
481
410
|
} --network ${networkProvider}`;
|
|
482
411
|
console.log("running...:", cmd);
|
|
483
412
|
await exec(cmd).then(({ stdout, stderr }) => {
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Bring UBI distribution to a temporary working state
|
|
3
|
+
* Celo:
|
|
4
|
+
* - upgrade bridge to be able to prevent UBI bridge transfers as result of the hack
|
|
5
|
+
* - mark unexecuted bridge transfers as executed
|
|
6
|
+
* - set UBI with new cycle params
|
|
7
|
+
* - unpause ubi contract
|
|
8
|
+
* Fuse:
|
|
9
|
+
* - withdraw ubi to avatar and bridge ubi to contract on celo
|
|
10
|
+
* - burn excess UBI tokens
|
|
11
|
+
* - set UBI with new cycle params
|
|
12
|
+
* - unpause ubi contract
|
|
13
|
+
* Mainnet:
|
|
14
|
+
* - withdraw excess UBI from bridge to avatar
|
|
15
|
+
* - burn excess UBI from bridge
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { network, ethers } from "hardhat";
|
|
20
|
+
import { defaultsDeep, last } from "lodash";
|
|
21
|
+
import prompt from "prompt";
|
|
22
|
+
|
|
23
|
+
import { executeViaGuardian, executeViaSafe, verifyProductionSigner } from "../multichain-deploy/helpers";
|
|
24
|
+
|
|
25
|
+
import ProtocolSettings from "../../releases/deploy-settings.json";
|
|
26
|
+
|
|
27
|
+
import dao from "../../releases/deployment.json";
|
|
28
|
+
import { BigNumber } from "ethers";
|
|
29
|
+
let { name: networkName } = network;
|
|
30
|
+
|
|
31
|
+
export const upgradeCelo = async () => {
|
|
32
|
+
const isProduction = networkName.includes("production");
|
|
33
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
34
|
+
|
|
35
|
+
if (isProduction) verifyProductionSigner(root);
|
|
36
|
+
|
|
37
|
+
let guardian = root;
|
|
38
|
+
|
|
39
|
+
//simulate produciton on fork
|
|
40
|
+
if (network.name === "hardhat" || network.name === "fork" || network.name === "localhost") {
|
|
41
|
+
networkName = "production-celo";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
45
|
+
let protocolSettings = defaultsDeep({}, ProtocolSettings[networkName], ProtocolSettings["default"]);
|
|
46
|
+
|
|
47
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
48
|
+
if (network.name === "hardhat" || network.name === "fork" || network.name === "localhost") {
|
|
49
|
+
guardian = await ethers.getImpersonatedSigner(protocolSettings.guardiansSafe);
|
|
50
|
+
|
|
51
|
+
await root.sendTransaction({
|
|
52
|
+
value: ethers.constants.WeiPerEther.mul(3),
|
|
53
|
+
to: protocolSettings.guardiansSafe
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const rootBalance = await ethers.provider.getBalance(root.address).then(_ => _.toString());
|
|
58
|
+
const guardianBalance = await ethers.provider.getBalance(guardian.address).then(_ => _.toString());
|
|
59
|
+
|
|
60
|
+
const NEWBRIDGE_IMPL = "0x691dE730D97d545c141D13ED5e9c12b7cB384a73";
|
|
61
|
+
|
|
62
|
+
const ubiImpl = await ethers.deployContract("UBISchemeV2");
|
|
63
|
+
|
|
64
|
+
console.log("got signers:", {
|
|
65
|
+
networkName,
|
|
66
|
+
root: root.address,
|
|
67
|
+
guardian: guardian.address,
|
|
68
|
+
balance: rootBalance,
|
|
69
|
+
guardianBalance: guardianBalance
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
console.log("executing proposals");
|
|
73
|
+
|
|
74
|
+
const proposalContracts = [
|
|
75
|
+
release.MpbBridge, //controller -> upgrade bridge contract
|
|
76
|
+
release.MpbBridge, //mark request 0x3d959d3438182af92242207591931a28de09296035c08e355167c1f9aae0f7ab as executed
|
|
77
|
+
release.MpbBridge, //mark request 0x73dff6aa07a76330c9dbcb0920d9cbb67489e22d9dd452aaf867f4008f4e7598 as executed
|
|
78
|
+
release.MpbBridge, //mark request 0x8bf2c3df2954005b4ce077b68fce35f80b0e94efee349db5a417cdc8e2c52ba2 as executed
|
|
79
|
+
release.MpbBridge, //mark request 0x06d2ae5f6b7943c6d36da248512dfad48ace22c9447c3cacb9b403907678e5a2 as executed
|
|
80
|
+
release.UBIScheme, //set new ubi contract
|
|
81
|
+
release.UBIScheme, //set cycle length to 60 days
|
|
82
|
+
release.UBIScheme //unpause ubi
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
86
|
+
|
|
87
|
+
const proposalFunctionSignatures = [
|
|
88
|
+
"upgradeTo(address)", // set new bridge name
|
|
89
|
+
"preventRequest(uint256)", //prevent bridge hack ubi request
|
|
90
|
+
"preventRequest(uint256)", //prevent bridge hack ubi request
|
|
91
|
+
"preventRequest(uint256)", //prevent bridge hack ubi request
|
|
92
|
+
"preventRequest(uint256)", //prevent bridge hack ubi request
|
|
93
|
+
"upgradeTo(address)", // set new ubi contract
|
|
94
|
+
"setCycleLength(uint256)", //set new cycle length
|
|
95
|
+
"pause(bool)" // unpause ubi
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const proposalFunctionInputs = [
|
|
99
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [NEWBRIDGE_IMPL]),
|
|
100
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
101
|
+
["uint256"],
|
|
102
|
+
["0x3d959d3438182af92242207591931a28de09296035c08e355167c1f9aae0f7ab"]
|
|
103
|
+
),
|
|
104
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
105
|
+
["uint256"],
|
|
106
|
+
["0x73dff6aa07a76330c9dbcb0920d9cbb67489e22d9dd452aaf867f4008f4e7598"]
|
|
107
|
+
),
|
|
108
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
109
|
+
["uint256"],
|
|
110
|
+
["0x8bf2c3df2954005b4ce077b68fce35f80b0e94efee349db5a417cdc8e2c52ba2"]
|
|
111
|
+
),
|
|
112
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
113
|
+
["uint256"],
|
|
114
|
+
["0x06d2ae5f6b7943c6d36da248512dfad48ace22c9447c3cacb9b403907678e5a2"]
|
|
115
|
+
),
|
|
116
|
+
ethers.utils.defaultAbiCoder.encode(["address"], [ubiImpl.address]),
|
|
117
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [60]),
|
|
118
|
+
ethers.utils.defaultAbiCoder.encode(["bool"], [false])
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
if (isProduction) {
|
|
122
|
+
await executeViaSafe(
|
|
123
|
+
proposalContracts,
|
|
124
|
+
proposalEthValues,
|
|
125
|
+
proposalFunctionSignatures,
|
|
126
|
+
proposalFunctionInputs,
|
|
127
|
+
protocolSettings.guardiansSafe,
|
|
128
|
+
"celo"
|
|
129
|
+
);
|
|
130
|
+
} else {
|
|
131
|
+
//simulation or dev envs
|
|
132
|
+
await executeViaGuardian(
|
|
133
|
+
proposalContracts,
|
|
134
|
+
proposalEthValues,
|
|
135
|
+
proposalFunctionSignatures,
|
|
136
|
+
proposalFunctionInputs,
|
|
137
|
+
guardian,
|
|
138
|
+
networkName
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//perform sanity checks on fork, for production we need to wait until everything executed
|
|
143
|
+
if (!isProduction) {
|
|
144
|
+
let ubi = await ethers.getContractAt("UBISchemeV2", release.UBIScheme);
|
|
145
|
+
let bridge = await ethers.getContractAt(
|
|
146
|
+
["function executedRequests(uint256) view returns (bool)"],
|
|
147
|
+
release.MpbBridge
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
console.log(await bridge.executedRequests("0x3d959d3438182af92242207591931a28de09296035c08e355167c1f9aae0f7ab"));
|
|
151
|
+
console.log(await bridge.executedRequests("0x73dff6aa07a76330c9dbcb0920d9cbb67489e22d9dd452aaf867f4008f4e7598"));
|
|
152
|
+
console.log(await bridge.executedRequests("0x8bf2c3df2954005b4ce077b68fce35f80b0e94efee349db5a417cdc8e2c52ba2"));
|
|
153
|
+
console.log(await bridge.executedRequests("0x06d2ae5f6b7943c6d36da248512dfad48ace22c9447c3cacb9b403907678e5a2"));
|
|
154
|
+
|
|
155
|
+
console.log("cycle length", await ubi.cycleLength(), "ubi pause:", await ubi.paused());
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const upgradeFuse = async () => {
|
|
160
|
+
let [root] = await ethers.getSigners();
|
|
161
|
+
|
|
162
|
+
const isProduction = networkName.includes("production");
|
|
163
|
+
|
|
164
|
+
const isForkSimulation = networkName === "localhost";
|
|
165
|
+
|
|
166
|
+
let networkEnv = networkName.split("-")[0];
|
|
167
|
+
if (isForkSimulation) networkEnv = "production";
|
|
168
|
+
|
|
169
|
+
if (networkEnv === "fuse") networkEnv = "development";
|
|
170
|
+
|
|
171
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
172
|
+
|
|
173
|
+
let guardian = root;
|
|
174
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
175
|
+
if (network.name === "localhost" || network.name === "fork") {
|
|
176
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
177
|
+
|
|
178
|
+
await root.sendTransaction({
|
|
179
|
+
value: ethers.constants.WeiPerEther.mul(3),
|
|
180
|
+
to: guardian.address
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const NEWBRIDGE = release["MpbBridge"];
|
|
185
|
+
const gd = await ethers.getContractAt("IERC20", release["GoodDollar"]);
|
|
186
|
+
const ubiGdBalance = await gd.balanceOf(release.UBIScheme);
|
|
187
|
+
const CELO_UBI_BALANCE = 1444008974;
|
|
188
|
+
const KEEP_UBI = 11e2 * 60 * 70000; // to keep on fuse 11 G$ for 60 days for 70k users
|
|
189
|
+
const EXCESS_UBI = ubiGdBalance.sub(BigNumber.from(KEEP_UBI));
|
|
190
|
+
const BRIDGE_UBI = 40e2 * 60 * 70000 - CELO_UBI_BALANCE; // out of excess ubi to bridge to celo 40 G$ for 60 days for 70k users
|
|
191
|
+
const BURN_UBI = EXCESS_UBI.sub(BigNumber.from(BRIDGE_UBI)).toString(); // out of excess ubi to burn
|
|
192
|
+
|
|
193
|
+
console.log({ EXCESS_UBI, KEEP_UBI, BURN_UBI, BRIDGE_UBI });
|
|
194
|
+
const gdTotalSupply = await gd.totalSupply();
|
|
195
|
+
|
|
196
|
+
console.log({
|
|
197
|
+
networkEnv,
|
|
198
|
+
NEWBRIDGE,
|
|
199
|
+
guardian: guardian.address,
|
|
200
|
+
isForkSimulation,
|
|
201
|
+
isProduction,
|
|
202
|
+
avatarBalance: await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const proposalContracts = [
|
|
206
|
+
release.UBIScheme, //withdraw ubi
|
|
207
|
+
release.GoodDollar, // burn
|
|
208
|
+
release.GoodDollar, // approve to bridge
|
|
209
|
+
release.MpbBridge, // execute bridge (needs value)
|
|
210
|
+
release.UBIScheme, //set cycle length to 60 days
|
|
211
|
+
release.UBIScheme //unpause ubi
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
const proposalEthValues = proposalContracts.map(_ => ethers.constants.Zero);
|
|
215
|
+
proposalEthValues[3] = ethers.utils.parseEther("0.8");
|
|
216
|
+
|
|
217
|
+
const proposalFunctionSignatures = [
|
|
218
|
+
"withdraw(uint256,address)", // withdraw excess ubi
|
|
219
|
+
"burn(uint256)", // burn excess ubi
|
|
220
|
+
"approve(address,uint256)", // approve bridge of excess ubi
|
|
221
|
+
"bridgeTo(address,uint256,uint256,uint8)", // bridge request to celo ubi
|
|
222
|
+
"setCycleLength(uint256)", //set new cycle length
|
|
223
|
+
"pause(bool)" // unpause ubi
|
|
224
|
+
];
|
|
225
|
+
|
|
226
|
+
const proposalFunctionInputs = [
|
|
227
|
+
ethers.utils.defaultAbiCoder.encode(["uint256", "address"], [EXCESS_UBI, release.Avatar]), //setAddresses(bytes32[],address[])"
|
|
228
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [BURN_UBI]),
|
|
229
|
+
ethers.utils.defaultAbiCoder.encode(["address", "uint256"], [release.MpbBridge, BRIDGE_UBI]),
|
|
230
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
231
|
+
["address", "uint256", "uint256", "uint8"],
|
|
232
|
+
[dao["production-celo"].UBIScheme, 42220, BRIDGE_UBI, 1]
|
|
233
|
+
),
|
|
234
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [60]),
|
|
235
|
+
ethers.utils.defaultAbiCoder.encode(["bool"], [false])
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
// make sure avatar has enough Fuse for bridge tx
|
|
239
|
+
await root.sendTransaction({
|
|
240
|
+
value: ethers.utils.parseEther("0.8"),
|
|
241
|
+
to: release.Avatar
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
console.log(
|
|
245
|
+
"bridge before allowance:",
|
|
246
|
+
await gd.allowance(release.Avatar, release.MpbBridge),
|
|
247
|
+
"avatarBalance",
|
|
248
|
+
await ethers.provider.getBalance(root.address).then(_ => _.toString())
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
if (isProduction) {
|
|
252
|
+
await executeViaSafe(
|
|
253
|
+
proposalContracts,
|
|
254
|
+
proposalEthValues,
|
|
255
|
+
proposalFunctionSignatures,
|
|
256
|
+
proposalFunctionInputs,
|
|
257
|
+
release.GuardiansSafe,
|
|
258
|
+
"fuse"
|
|
259
|
+
);
|
|
260
|
+
} else {
|
|
261
|
+
await executeViaGuardian(
|
|
262
|
+
proposalContracts,
|
|
263
|
+
proposalEthValues,
|
|
264
|
+
proposalFunctionSignatures,
|
|
265
|
+
proposalFunctionInputs,
|
|
266
|
+
guardian,
|
|
267
|
+
networkEnv
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (!isProduction) {
|
|
272
|
+
let ubi = await ethers.getContractAt("UBISchemeV2", release.UBIScheme);
|
|
273
|
+
let bridge = await ethers.getContractAt(
|
|
274
|
+
[
|
|
275
|
+
"event BridgeRequest(address indexed from, address indexed to, uint256 targetChainId, uint256 normalizedAmount, uint256 timestamp, uint8 bridge, uint256 indexed id)"
|
|
276
|
+
],
|
|
277
|
+
release.MpbBridge
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
const finalAvatarBalance = await gd.balanceOf(release.Avatar);
|
|
281
|
+
|
|
282
|
+
const finalgdTotalSupply = await gd.totalSupply();
|
|
283
|
+
const finalubiGdBalance = await gd.balanceOf(release.UBIScheme);
|
|
284
|
+
console.log("burned:", gdTotalSupply.sub(finalgdTotalSupply), "to burn:", EXCESS_UBI);
|
|
285
|
+
console.log("ubi balance change:", ubiGdBalance.sub(finalubiGdBalance));
|
|
286
|
+
|
|
287
|
+
console.log("cycle length", await ubi.cycleLength(), "ubi pause:", await ubi.paused());
|
|
288
|
+
console.log("avatar balance:", finalAvatarBalance);
|
|
289
|
+
console.log("bridge allowance:", await gd.allowance(release.Avatar, release.MpbBridge));
|
|
290
|
+
const f = bridge.filters.BridgeRequest();
|
|
291
|
+
const events = await bridge.queryFilter(f);
|
|
292
|
+
console.log(last(events));
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const upgradeMainnet = async () => {
|
|
297
|
+
const isProduction = networkName.includes("production");
|
|
298
|
+
let [root, ...signers] = await ethers.getSigners();
|
|
299
|
+
|
|
300
|
+
if (isProduction) verifyProductionSigner(root);
|
|
301
|
+
|
|
302
|
+
let guardian = root;
|
|
303
|
+
|
|
304
|
+
//simulate produciton on fork
|
|
305
|
+
if (network.name === "hardhat" || network.name === "fork" || network.name === "localhost") {
|
|
306
|
+
networkName = "production-mainnet";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
let release: { [key: string]: any } = dao[networkName];
|
|
310
|
+
let protocolSettings = defaultsDeep({}, ProtocolSettings[networkName], ProtocolSettings["default"]);
|
|
311
|
+
|
|
312
|
+
//simulate on fork, make sure safe has enough eth to simulate txs
|
|
313
|
+
if (network.name === "hardhat" || network.name === "fork" || network.name === "localhost") {
|
|
314
|
+
guardian = await ethers.getImpersonatedSigner(protocolSettings.guardiansSafe);
|
|
315
|
+
|
|
316
|
+
await root.sendTransaction({
|
|
317
|
+
value: ethers.constants.WeiPerEther.mul(3),
|
|
318
|
+
to: protocolSettings.guardiansSafe
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const rootBalance = await ethers.provider.getBalance(root.address).then(_ => _.toString());
|
|
323
|
+
const guardianBalance = await ethers.provider.getBalance(guardian.address).then(_ => _.toString());
|
|
324
|
+
|
|
325
|
+
console.log("got signers:", {
|
|
326
|
+
networkName,
|
|
327
|
+
root: root.address,
|
|
328
|
+
guardian: guardian.address,
|
|
329
|
+
balance: rootBalance,
|
|
330
|
+
guardianBalance: guardianBalance
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
const CELO_UBI_BURN = 20193470562 + 161547764498 + 146346390158 + 18293298769; //hacker minted ubi
|
|
334
|
+
const FUSE_UBI_BURN = 20336841183; //hacker minted ubi, not including ubi left for 60 days
|
|
335
|
+
const TOTAL_BURN = CELO_UBI_BURN + FUSE_UBI_BURN;
|
|
336
|
+
|
|
337
|
+
const gd = await ethers.getContractAt("IERC20", release["GoodDollar"]);
|
|
338
|
+
const [bridgeBalance, totalSupply] = await Promise.all([gd.balanceOf(release.MpbBridge), gd.totalSupply()]);
|
|
339
|
+
console.log("executing proposals");
|
|
340
|
+
|
|
341
|
+
const proposalContracts = [
|
|
342
|
+
release.MpbBridge, //controller -> withdraw extra ubi funds from bridge
|
|
343
|
+
release.GoodDollar //burn
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
const proposalEthValues = proposalContracts.map(_ => 0);
|
|
347
|
+
|
|
348
|
+
const proposalFunctionSignatures = [
|
|
349
|
+
"withdraw(address,uint256)", // withdraw ubi
|
|
350
|
+
"burn(uint256)" //burn ubi
|
|
351
|
+
];
|
|
352
|
+
|
|
353
|
+
const proposalFunctionInputs = [
|
|
354
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
355
|
+
["address", "uint256"],
|
|
356
|
+
["0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B", TOTAL_BURN]
|
|
357
|
+
),
|
|
358
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [TOTAL_BURN])
|
|
359
|
+
];
|
|
360
|
+
|
|
361
|
+
if (isProduction) {
|
|
362
|
+
await executeViaSafe(
|
|
363
|
+
proposalContracts,
|
|
364
|
+
proposalEthValues,
|
|
365
|
+
proposalFunctionSignatures,
|
|
366
|
+
proposalFunctionInputs,
|
|
367
|
+
protocolSettings.guardiansSafe,
|
|
368
|
+
"mainnet"
|
|
369
|
+
);
|
|
370
|
+
} else {
|
|
371
|
+
//simulation or dev envs
|
|
372
|
+
await executeViaGuardian(
|
|
373
|
+
proposalContracts,
|
|
374
|
+
proposalEthValues,
|
|
375
|
+
proposalFunctionSignatures,
|
|
376
|
+
proposalFunctionInputs,
|
|
377
|
+
guardian,
|
|
378
|
+
networkName
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//perform sanity checks on fork, for production we need to wait until everything executed
|
|
383
|
+
if (!isProduction) {
|
|
384
|
+
const [bridgeBalanceAfter, totalSupplyAfter] = await Promise.all([
|
|
385
|
+
gd.balanceOf(release.MpbBridge),
|
|
386
|
+
gd.totalSupply()
|
|
387
|
+
]);
|
|
388
|
+
console.log("bridge balance before:", bridgeBalance.toString());
|
|
389
|
+
console.log("bridge balance before:", bridgeBalanceAfter.toString());
|
|
390
|
+
console.log("total supply before:", totalSupply.toString());
|
|
391
|
+
console.log("total supply after:", totalSupplyAfter.toString());
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
export const main = async () => {
|
|
396
|
+
prompt.start();
|
|
397
|
+
const { network } = await prompt.get(["network"]);
|
|
398
|
+
|
|
399
|
+
console.log("running step:", { network });
|
|
400
|
+
switch (network) {
|
|
401
|
+
case "celo":
|
|
402
|
+
await upgradeCelo();
|
|
403
|
+
break;
|
|
404
|
+
case "fuse":
|
|
405
|
+
await upgradeFuse();
|
|
406
|
+
break;
|
|
407
|
+
case "mainnet":
|
|
408
|
+
await upgradeMainnet();
|
|
409
|
+
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
main().catch(console.log);
|