@gooddollar/goodprotocol 2.1.0 → 2.1.2
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/README.md +12 -0
- package/artifacts/abis/AdminWallet.min.json +1 -1
- package/artifacts/abis/AdminWalletFuse.min.json +1 -1
- package/artifacts/abis/GenericDistributionHelperTest.min.json +1 -0
- package/artifacts/abis/GenericDistributionHelperTestHelper.min.json +1 -0
- package/artifacts/abis/IBancorExchangeProvider.min.json +1 -1
- package/artifacts/abis/IUniswapV3Pool.min.json +1 -1
- package/artifacts/abis/IdentityV3.min.json +1 -1
- package/artifacts/abis/MentoExchange.min.json +1 -1
- package/artifacts/abis/UpdateReserveRatioAfterXDC.min.json +1 -0
- package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.json +13 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.json +13 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +40 -2
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.json +931 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +4 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.json +957 -0
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +36 -2
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.json +36 -2
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.json +2 -2
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.json +2 -2
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.json +2 -2
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.dbg.json +4 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.json +24 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.dbg.json +4 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.json +50 -0
- package/contracts/IUniswapV3.sol +2 -0
- package/contracts/identity/IdentityV3.sol +2 -0
- package/contracts/mocks/GenericDistributionHelperTest.sol +31 -0
- package/contracts/reserve/GenericDistributionHelper.sol +43 -21
- package/contracts/utils/AdminWallet.sol +27 -0
- package/contracts/utils/AdminWalletFuse.sol +27 -0
- package/contracts/utils/UpdateReserveRatioAfterXDC.sol +64 -0
- package/hardhat.config.ts +9 -12
- package/package.json +3 -2
- package/releases/deployment.json +4 -1
- package/scripts/bulkWhitelist.ts +31 -0
- package/scripts/multichain-deploy/helpers.ts +13 -6
- package/scripts/proposals/gip-25-xdc-deploy-reserve.ts +425 -0
- package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +334 -31
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/reserve/GenericDistributionHelper.test.ts +315 -0
- package/test/ubi/UBISchemeCycle.test.ts +30 -63
- package/types/contracts/IUniswapV3.sol/IUniswapV3Pool.ts +14 -1
- package/types/contracts/MentoInterfaces.sol/IBancorExchangeProvider.ts +14 -0
- package/types/contracts/fuseFaucet/Faucet copy.sol/DebugFaucet.ts +1439 -0
- package/types/contracts/fuseFaucet/Faucet copy.sol/index.ts +4 -0
- package/types/contracts/identity/IdentityV3.ts +46 -0
- package/types/contracts/index.ts +0 -2
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/CeloDistributionHelperTestHelper.ts +1357 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.ts +1305 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.ts +1357 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/index.ts +5 -0
- package/types/contracts/mocks/index.ts +2 -0
- package/types/contracts/utils/AdminWallet.ts +45 -0
- package/types/contracts/utils/AdminWalletFuse.ts +45 -0
- package/types/contracts/utils/BuyGDClone.sol/BuyGDCloneV2.ts +464 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +117 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/index.ts +5 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/UpdateReserveRatioAfterXDC.ts +122 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/index.ts +5 -0
- package/types/contracts/utils/index.ts +4 -0
- package/types/factories/contracts/IUniswapV3.sol/IUniswapV3Pool__factory.ts +13 -0
- package/types/factories/contracts/MentoInterfaces.sol/IBancorExchangeProvider__factory.ts +13 -0
- package/types/factories/contracts/fuseFaucet/Faucet copy.sol/DebugFaucet__factory.ts +945 -0
- package/types/factories/contracts/fuseFaucet/Faucet copy.sol/index.ts +4 -0
- package/types/factories/contracts/identity/IdentityV3__factory.ts +39 -1
- package/types/factories/contracts/index.ts +0 -1
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/CeloDistributionHelperTestHelper__factory.ts +1017 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper__factory.ts +1021 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest__factory.ts +989 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/index.ts +5 -0
- package/types/factories/contracts/mocks/index.ts +1 -0
- package/types/factories/contracts/reserve/GenericDistributionHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/AdminWalletFuse__factory.ts +35 -1
- package/types/factories/contracts/utils/AdminWallet__factory.ts +35 -1
- package/types/factories/contracts/utils/BulkWhitelist__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyFromReserveHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDCloneV2__factory.ts +415 -0
- package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento__factory.ts +1 -1
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +110 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/index.ts +5 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/UpdateReserveRatioAfterXDC__factory.ts +115 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/index.ts +5 -0
- package/types/factories/contracts/utils/index.ts +2 -0
- package/types/hardhat.d.ts +54 -9
- package/types/index.ts +6 -0
- package/artifacts/contracts/IQuoter.sol/IQuoterV2.dbg.json +0 -4
- package/artifacts/contracts/IQuoter.sol/IQuoterV2.json +0 -211
|
@@ -15,40 +15,30 @@
|
|
|
15
15
|
// deploy distribution helper
|
|
16
16
|
// transfer usdc to xdc reserve
|
|
17
17
|
// update celo reserve parameters accordingly
|
|
18
|
+
// upgrade celo's distribution helper to genericdistributionhelper (simulate it is working)
|
|
18
19
|
|
|
19
20
|
import { network, ethers, upgrades } from "hardhat";
|
|
20
21
|
import { reset } from "@nomicfoundation/hardhat-network-helpers";
|
|
21
22
|
import { defaultsDeep, last } from "lodash";
|
|
22
23
|
import prompt from "prompt";
|
|
23
24
|
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
import {
|
|
26
|
+
executeViaGuardian,
|
|
27
|
+
executeViaSafe,
|
|
28
|
+
verifyContract,
|
|
29
|
+
verifyProductionSigner
|
|
30
|
+
} from "../multichain-deploy/helpers";
|
|
27
31
|
|
|
28
32
|
import dao from "../../releases/deployment.json";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
Controller,
|
|
32
|
-
FuseOldBridgeKill,
|
|
33
|
-
GoodMarketMaker,
|
|
34
|
-
IBancorExchangeProvider,
|
|
35
|
-
IBroker,
|
|
36
|
-
IdentityV3,
|
|
37
|
-
IGoodDollar,
|
|
38
|
-
IGoodDollarExchangeProvider,
|
|
39
|
-
IGoodDollarExpansionController,
|
|
40
|
-
IMentoReserve,
|
|
41
|
-
IMessagePassingBridge,
|
|
42
|
-
ProtocolUpgradeV4Mento,
|
|
43
|
-
UBISchemeV2
|
|
44
|
-
} from "../../types";
|
|
45
|
-
import releaser from "../releaser";
|
|
33
|
+
import { Controller, IdentityV3, IGoodDollar, IMessagePassingBridge, UBISchemeV2 } from "../../types";
|
|
34
|
+
import { upgrade } from "./gip-15";
|
|
46
35
|
let { name: networkName } = network;
|
|
47
36
|
const isSimulation = network.name === "hardhat" || network.name === "fork" || network.name === "localhost";
|
|
48
37
|
const bridgeUpgradeImpl = {
|
|
49
|
-
"production-celo": "
|
|
50
|
-
production: "
|
|
51
|
-
"production-mainnet": "
|
|
38
|
+
"production-celo": "0xF3eAB7018d74E7Df95A5d8dC70987C0539bDF48f",
|
|
39
|
+
production: "0xFB62aA509a7B260b6697B671C969a184d6c39E90",
|
|
40
|
+
"production-mainnet": "0x12ab702f015D3302f3cc0c4AbA0626A127D06A07",
|
|
41
|
+
"production-xdc": "0xe4CFA18A3d0a7d77fAA42961ee943c9221d61937"
|
|
52
42
|
};
|
|
53
43
|
export const upgradeCeloStep1 = async (network, checksOnly) => {
|
|
54
44
|
let [root] = await ethers.getSigners();
|
|
@@ -109,6 +99,15 @@ export const upgradeCeloStep1 = async (network, checksOnly) => {
|
|
|
109
99
|
ethers.utils.defaultAbiCoder.encode(["address", "bytes"], [bridgeImpl, upgradeCall]),
|
|
110
100
|
"0"
|
|
111
101
|
], //upgrade bridge
|
|
102
|
+
[
|
|
103
|
+
release.MpbBridge,
|
|
104
|
+
"setConfig(uint16,uint16,uint256,bytes)",
|
|
105
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
106
|
+
["uint16", "uint16", "uint256", "bytes"],
|
|
107
|
+
[0, 365, 5, "0x000000000000000000000000000000000000000000000000000000000000000f"]
|
|
108
|
+
),
|
|
109
|
+
"0"
|
|
110
|
+
], //fix xdc bridge setting of outbound blocks confirmations
|
|
112
111
|
[
|
|
113
112
|
release.MpbBridge,
|
|
114
113
|
"withdraw(address,uint256)",
|
|
@@ -160,10 +159,9 @@ export const upgradeCeloStep1 = async (network, checksOnly) => {
|
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
if (isSimulation || !isProduction) {
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
).balanceOf(release.MpbBridge);
|
|
162
|
+
const gd = await ethers.getContractAt("IGoodDollar", release.GoodDollar);
|
|
163
|
+
const supplyAfter = await gd.totalSupply();
|
|
164
|
+
const bridgeBalanceAfter = await gd.balanceOf(release.MpbBridge);
|
|
167
165
|
console.log("Bridge balance after upgrade:", { bridgeBalanceAfter });
|
|
168
166
|
console.log("Supply after upgrade:", { supplyAfter });
|
|
169
167
|
|
|
@@ -182,6 +180,297 @@ export const upgradeCeloStep1 = async (network, checksOnly) => {
|
|
|
182
180
|
console.log("UBI claim from connected account tx:", claimTx.events);
|
|
183
181
|
}
|
|
184
182
|
};
|
|
183
|
+
export const upgradeCeloFix = async (network, checksOnly) => {
|
|
184
|
+
let [root] = await ethers.getSigners();
|
|
185
|
+
|
|
186
|
+
const isProduction = networkName.includes("production");
|
|
187
|
+
|
|
188
|
+
if (isProduction) verifyProductionSigner(root);
|
|
189
|
+
|
|
190
|
+
let networkEnv = networkName;
|
|
191
|
+
let guardian = root;
|
|
192
|
+
if (isSimulation) {
|
|
193
|
+
networkEnv = network;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
197
|
+
|
|
198
|
+
console.log("signer:", root.address, { networkEnv, isSimulation, isProduction, release });
|
|
199
|
+
|
|
200
|
+
if (isSimulation) {
|
|
201
|
+
networkEnv = network;
|
|
202
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
203
|
+
|
|
204
|
+
await root.sendTransaction({
|
|
205
|
+
value: ethers.utils.parseEther("1"),
|
|
206
|
+
to: release.GuardiansSafe
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const bridgeImpl = bridgeUpgradeImpl[networkEnv];
|
|
211
|
+
const toBurn = "5515965554075495700269228267";
|
|
212
|
+
const proposalActions = [
|
|
213
|
+
[release.MpbBridge, "upgradeTo(address)", ethers.utils.defaultAbiCoder.encode(["address"], [bridgeImpl]), "0"], //upgrade bridge
|
|
214
|
+
[release.GoodDollar, "burn(uint256)", ethers.utils.defaultAbiCoder.encode(["uint256"], [toBurn.toString()]), "0"] //burn locked supply on celo bridge
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
console.log({
|
|
218
|
+
networkEnv,
|
|
219
|
+
guardian: guardian.address,
|
|
220
|
+
isSimulation,
|
|
221
|
+
isProduction,
|
|
222
|
+
release
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const proposalContracts = proposalActions.map(a => a[0]);
|
|
226
|
+
const proposalFunctionSignatures = proposalActions.map(a => a[1]);
|
|
227
|
+
const proposalFunctionInputs = proposalActions.map(a => a[2]);
|
|
228
|
+
const proposalEthValues = proposalActions.map(a => a[3]);
|
|
229
|
+
if (isProduction && !checksOnly) {
|
|
230
|
+
await executeViaSafe(
|
|
231
|
+
proposalContracts,
|
|
232
|
+
proposalEthValues,
|
|
233
|
+
proposalFunctionSignatures,
|
|
234
|
+
proposalFunctionInputs,
|
|
235
|
+
release.GuardiansSafe,
|
|
236
|
+
"celo",
|
|
237
|
+
{ nonce: 5 }
|
|
238
|
+
);
|
|
239
|
+
} else if (!checksOnly) {
|
|
240
|
+
await executeViaGuardian(
|
|
241
|
+
proposalContracts,
|
|
242
|
+
proposalEthValues,
|
|
243
|
+
proposalFunctionSignatures,
|
|
244
|
+
proposalFunctionInputs,
|
|
245
|
+
guardian,
|
|
246
|
+
networkEnv
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
export const upgradeXdcFix = async (network, checksOnly) => {
|
|
251
|
+
let [root] = await ethers.getSigners();
|
|
252
|
+
|
|
253
|
+
const isProduction = networkName.includes("production");
|
|
254
|
+
|
|
255
|
+
if (isProduction) verifyProductionSigner(root);
|
|
256
|
+
|
|
257
|
+
let networkEnv = networkName;
|
|
258
|
+
let guardian = root;
|
|
259
|
+
if (isSimulation) {
|
|
260
|
+
networkEnv = network;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
264
|
+
|
|
265
|
+
console.log("signer:", root.address, { networkEnv, isSimulation, isProduction, release });
|
|
266
|
+
|
|
267
|
+
if (isSimulation) {
|
|
268
|
+
networkEnv = network;
|
|
269
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
270
|
+
|
|
271
|
+
await root.sendTransaction({
|
|
272
|
+
value: ethers.utils.parseEther("1"),
|
|
273
|
+
to: release.GuardiansSafe
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const bridgeImpl = bridgeUpgradeImpl[networkEnv];
|
|
278
|
+
const proposalActions = [
|
|
279
|
+
[release.MpbBridge, "upgradeTo(address)", ethers.utils.defaultAbiCoder.encode(["address"], [bridgeImpl]), "0"] //upgrade bridge
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
console.log({
|
|
283
|
+
networkEnv,
|
|
284
|
+
guardian: guardian.address,
|
|
285
|
+
isSimulation,
|
|
286
|
+
isProduction,
|
|
287
|
+
release
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const proposalContracts = proposalActions.map(a => a[0]);
|
|
291
|
+
const proposalFunctionSignatures = proposalActions.map(a => a[1]);
|
|
292
|
+
const proposalFunctionInputs = proposalActions.map(a => a[2]);
|
|
293
|
+
const proposalEthValues = proposalActions.map(a => a[3]);
|
|
294
|
+
if (isProduction && !checksOnly) {
|
|
295
|
+
await executeViaSafe(
|
|
296
|
+
proposalContracts,
|
|
297
|
+
proposalEthValues,
|
|
298
|
+
proposalFunctionSignatures,
|
|
299
|
+
proposalFunctionInputs,
|
|
300
|
+
release.GuardiansSafe,
|
|
301
|
+
"xdc"
|
|
302
|
+
);
|
|
303
|
+
} else if (!checksOnly) {
|
|
304
|
+
await executeViaGuardian(
|
|
305
|
+
proposalContracts,
|
|
306
|
+
proposalEthValues,
|
|
307
|
+
proposalFunctionSignatures,
|
|
308
|
+
proposalFunctionInputs,
|
|
309
|
+
guardian,
|
|
310
|
+
networkEnv
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
export const upgradeFuseFix = async (network, checksOnly) => {
|
|
315
|
+
let [root] = await ethers.getSigners();
|
|
316
|
+
|
|
317
|
+
const isProduction = networkName.includes("production");
|
|
318
|
+
|
|
319
|
+
if (isProduction) verifyProductionSigner(root);
|
|
320
|
+
|
|
321
|
+
let networkEnv = networkName;
|
|
322
|
+
let guardian = root;
|
|
323
|
+
if (isSimulation) {
|
|
324
|
+
networkEnv = network;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
328
|
+
|
|
329
|
+
console.log("signer:", root.address, { networkEnv, isSimulation, isProduction, release });
|
|
330
|
+
|
|
331
|
+
if (isSimulation) {
|
|
332
|
+
networkEnv = network;
|
|
333
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
334
|
+
|
|
335
|
+
await root.sendTransaction({
|
|
336
|
+
value: ethers.utils.parseEther("1"),
|
|
337
|
+
to: release.GuardiansSafe
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const bridgeImpl = bridgeUpgradeImpl[networkEnv];
|
|
342
|
+
const proposalActions = [
|
|
343
|
+
[release.MpbBridge, "upgradeTo(address)", ethers.utils.defaultAbiCoder.encode(["address"], [bridgeImpl]), "0"] //upgrade bridge
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
console.log({
|
|
347
|
+
networkEnv,
|
|
348
|
+
guardian: guardian.address,
|
|
349
|
+
isSimulation,
|
|
350
|
+
isProduction,
|
|
351
|
+
release
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
const proposalContracts = proposalActions.map(a => a[0]);
|
|
355
|
+
const proposalFunctionSignatures = proposalActions.map(a => a[1]);
|
|
356
|
+
const proposalFunctionInputs = proposalActions.map(a => a[2]);
|
|
357
|
+
const proposalEthValues = proposalActions.map(a => a[3]);
|
|
358
|
+
if (isProduction && !checksOnly) {
|
|
359
|
+
await executeViaSafe(
|
|
360
|
+
proposalContracts,
|
|
361
|
+
proposalEthValues,
|
|
362
|
+
proposalFunctionSignatures,
|
|
363
|
+
proposalFunctionInputs,
|
|
364
|
+
release.GuardiansSafe,
|
|
365
|
+
"fuse"
|
|
366
|
+
);
|
|
367
|
+
} else if (!checksOnly) {
|
|
368
|
+
await executeViaGuardian(
|
|
369
|
+
proposalContracts,
|
|
370
|
+
proposalEthValues,
|
|
371
|
+
proposalFunctionSignatures,
|
|
372
|
+
proposalFunctionInputs,
|
|
373
|
+
guardian,
|
|
374
|
+
networkEnv
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
export const upgradeEthFix = async (network, checksOnly) => {
|
|
379
|
+
let [root] = await ethers.getSigners();
|
|
380
|
+
|
|
381
|
+
const isProduction = networkName.includes("production");
|
|
382
|
+
|
|
383
|
+
if (isProduction) verifyProductionSigner(root);
|
|
384
|
+
|
|
385
|
+
let networkEnv = networkName;
|
|
386
|
+
let guardian = root;
|
|
387
|
+
if (isSimulation) {
|
|
388
|
+
networkEnv = network;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
392
|
+
|
|
393
|
+
console.log("signer:", root.address, { networkEnv, isSimulation, isProduction, release });
|
|
394
|
+
|
|
395
|
+
if (isSimulation) {
|
|
396
|
+
networkEnv = network;
|
|
397
|
+
guardian = await ethers.getImpersonatedSigner(release.GuardiansSafe);
|
|
398
|
+
|
|
399
|
+
await root.sendTransaction({
|
|
400
|
+
value: ethers.utils.parseEther("1"),
|
|
401
|
+
to: release.GuardiansSafe
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const bridgeImpl = bridgeUpgradeImpl[networkEnv];
|
|
406
|
+
const upgradeCall = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("upgrade()")).substring(0, 10);
|
|
407
|
+
|
|
408
|
+
const proposalActions = [
|
|
409
|
+
[
|
|
410
|
+
release.MpbBridge,
|
|
411
|
+
"upgradeToAndCall(address,bytes)",
|
|
412
|
+
ethers.utils.defaultAbiCoder.encode(["address", "bytes"], [bridgeImpl, upgradeCall]),
|
|
413
|
+
"0"
|
|
414
|
+
] //upgrade bridge
|
|
415
|
+
];
|
|
416
|
+
|
|
417
|
+
console.log({
|
|
418
|
+
networkEnv,
|
|
419
|
+
guardian: guardian.address,
|
|
420
|
+
isSimulation,
|
|
421
|
+
isProduction,
|
|
422
|
+
release
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
const proposalContracts = proposalActions.map(a => a[0]);
|
|
426
|
+
const proposalFunctionSignatures = proposalActions.map(a => a[1]);
|
|
427
|
+
const proposalFunctionInputs = proposalActions.map(a => a[2]);
|
|
428
|
+
const proposalEthValues = proposalActions.map(a => a[3]);
|
|
429
|
+
if (isProduction && !checksOnly) {
|
|
430
|
+
await executeViaSafe(
|
|
431
|
+
proposalContracts,
|
|
432
|
+
proposalEthValues,
|
|
433
|
+
proposalFunctionSignatures,
|
|
434
|
+
proposalFunctionInputs,
|
|
435
|
+
release.GuardiansSafe,
|
|
436
|
+
"mainnet",
|
|
437
|
+
{ nonce: 15 }
|
|
438
|
+
);
|
|
439
|
+
} else if (!checksOnly) {
|
|
440
|
+
await executeViaGuardian(
|
|
441
|
+
proposalContracts,
|
|
442
|
+
proposalEthValues,
|
|
443
|
+
proposalFunctionSignatures,
|
|
444
|
+
proposalFunctionInputs,
|
|
445
|
+
guardian,
|
|
446
|
+
networkEnv
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (isSimulation || !isProduction) {
|
|
451
|
+
const ctrl = (await ethers.getContractAt("Controller", release.Controller)) as Controller;
|
|
452
|
+
const isMinterScheme = await ctrl.getSchemePermissions(release.MpbBridge, release.Avatar);
|
|
453
|
+
console.log("Bridge minter permissions on avatar:", isMinterScheme);
|
|
454
|
+
// check xdc chainid in bridge
|
|
455
|
+
const mpb = (await ethers.getContractAt("IMessagePassingBridge", release.MpbBridge)) as IMessagePassingBridge;
|
|
456
|
+
console.log("xdc lz chainid:", await mpb.toLzChainId(50));
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export const verifyUpgradeCeloStep1 = async networkEnv => {
|
|
461
|
+
let release: { [key: string]: any } = dao[networkEnv];
|
|
462
|
+
const ctrl = (await ethers.getContractAt("Controller", release.Controller)) as Controller;
|
|
463
|
+
const isMinterScheme = await ctrl.getSchemePermissions(release.MpbBridge, release.Avatar);
|
|
464
|
+
console.log("Bridge minter permissions on avatar:", isMinterScheme);
|
|
465
|
+
// check xdc chainid in bridge
|
|
466
|
+
const mpb = (await ethers.getContractAt("IMessagePassingBridge", release.MpbBridge)) as IMessagePassingBridge;
|
|
467
|
+
console.log("xdc lz chainid:", await mpb.toLzChainId(50));
|
|
468
|
+
const gd = await ethers.getContractAt("IGoodDollar", release.GoodDollar);
|
|
469
|
+
const supplyAfter = await gd.totalSupply();
|
|
470
|
+
const bridgeBalanceAfter = await gd.balanceOf(release.MpbBridge);
|
|
471
|
+
const avatarBalanceAfter = await gd.balanceOf(release.Avatar);
|
|
472
|
+
console.log({ bridgeBalanceAfter, avatarBalanceAfter, supplyAfter });
|
|
473
|
+
};
|
|
185
474
|
|
|
186
475
|
export const upgradeFuseStep1 = async (network, checksOnly) => {
|
|
187
476
|
let [root] = await ethers.getSigners();
|
|
@@ -231,7 +520,16 @@ export const upgradeFuseStep1 = async (network, checksOnly) => {
|
|
|
231
520
|
"upgradeToAndCall(address,bytes)",
|
|
232
521
|
ethers.utils.defaultAbiCoder.encode(["address", "bytes"], [bridgeImpl, upgradeCall]),
|
|
233
522
|
"0"
|
|
234
|
-
] //upgrade bridge
|
|
523
|
+
], //upgrade bridge
|
|
524
|
+
[
|
|
525
|
+
release.MpbBridge,
|
|
526
|
+
"setConfig(uint16,uint16,uint256,bytes)",
|
|
527
|
+
ethers.utils.defaultAbiCoder.encode(
|
|
528
|
+
["uint16", "uint16", "uint256", "bytes"],
|
|
529
|
+
[0, 365, 5, "0x000000000000000000000000000000000000000000000000000000000000000f"]
|
|
530
|
+
),
|
|
531
|
+
"0"
|
|
532
|
+
] //fix xdc bridge setting of outbound blocks confirmations
|
|
235
533
|
];
|
|
236
534
|
|
|
237
535
|
console.log({
|
|
@@ -253,7 +551,7 @@ export const upgradeFuseStep1 = async (network, checksOnly) => {
|
|
|
253
551
|
proposalFunctionSignatures,
|
|
254
552
|
proposalFunctionInputs,
|
|
255
553
|
release.GuardiansSafe,
|
|
256
|
-
"
|
|
554
|
+
"fuse"
|
|
257
555
|
);
|
|
258
556
|
} else if (!checksOnly) {
|
|
259
557
|
await executeViaGuardian(
|
|
@@ -341,7 +639,7 @@ export const upgradeEthStep1 = async (network, checksOnly) => {
|
|
|
341
639
|
proposalFunctionSignatures,
|
|
342
640
|
proposalFunctionInputs,
|
|
343
641
|
release.GuardiansSafe,
|
|
344
|
-
"
|
|
642
|
+
"mainnet"
|
|
345
643
|
);
|
|
346
644
|
} else if (!checksOnly) {
|
|
347
645
|
await executeViaGuardian(
|
|
@@ -440,4 +738,9 @@ export const main = async () => {
|
|
|
440
738
|
}
|
|
441
739
|
};
|
|
442
740
|
|
|
443
|
-
|
|
741
|
+
// upgradeCeloFix("production-celo", false).catch(console.log);
|
|
742
|
+
// upgradeEthFix("production-mainnet", false).catch(console.log);
|
|
743
|
+
upgradeFuseFix("production", false).catch(console.log);
|
|
744
|
+
// upgradeXdcFix("production-xdc", false).catch(console.log);
|
|
745
|
+
// verifyUpgradeCeloStep1("production-celo");
|
|
746
|
+
// main().catch(console.log);
|
|
@@ -257,6 +257,6 @@ describe("ClaimersDistribution", () => {
|
|
|
257
257
|
// console.log({ totalGas }, tx.gasUsed.toNumber(), tx2.gasUsed.toNumber());
|
|
258
258
|
}
|
|
259
259
|
console.log(Object.keys(gasCosts));
|
|
260
|
-
expect(totalGas / 30).lt(
|
|
260
|
+
expect(totalGas / 30).lt(316000);
|
|
261
261
|
});
|
|
262
262
|
});
|