77// calculate how much G$s each reserve is backing - V
88// deploy distribution helper on xdc - V
99// set distribution helper on xdc expansion controller - V
10- // create exchange on mento reserve xdc with calculated parameters - V
1110// give mento broker minting rights on xdc - V
1211// give expansion controller minting rights - V
1312// give genericcall permissions to circuit breaker on all networks - V
1413// deploy identity v4 on all chains - V
1514
1615// Before upgrade:
17- // verify bridge impl are the latest
18- // verify exchange provider and broker impl on celo are the latest
19- // deploy circuti breaker on all chains and update address in deployment.json
20- // deploy mento contracts on xdc before upgrade
16+ // verify bridge impl are the latest - V
17+ // deploy circuti breaker on all chains and update address in deployment.json - V
18+ // verify exchange provider and broker impl on celo are the latest - V
19+ // deploy mento contracts on xdc before upgrade - V
2120
2221// Post upgrade:
2322// run script update celo reserve parameters accordingly
@@ -51,13 +50,13 @@ import { keccak256, toUtf8Bytes } from "ethers/lib/utils";
5150let { name : networkName } = network ;
5251const isSimulation = network . name === "hardhat" || network . name === "fork" || network . name === "localhost" ;
5352const bridgeUpgradeImpl = {
54- "production-celo" : "0xF3eAB7018d74E7Df95A5d8dC70987C0539bDF48f " ,
53+ "production-celo" : "0x3eDD30A1Cd94dd6D3329B5EbafF5Aa4E0a4E4a55 " ,
5554 production : "0xCaC4215c57ef199210E759AF92bcaD012f61E7A1" ,
56- "production-mainnet" : "0x12ab702f015D3302f3cc0c4AbA0626A127D06A07 " ,
57- "production-xdc" : "0xe4CFA18A3d0a7d77fAA42961ee943c9221d61937 "
55+ "production-mainnet" : "0x3A2D0a9EF558b42AF5FF8d27FE438b466Fa7692F " ,
56+ "production-xdc" : "0x00F7f61080EF40d3832C8C06e8A2af757839e1F7 "
5857} ;
59- const XDC_INITIAL_USDC = 200000 * 1e6 ;
6058
59+ const circuitBreaker = "" ;
6160export const upgradeCeloStep2 = async ( network , checksOnly ) => {
6261 const ExchangeProviderV2Impl = "0xe930CDE20f60d0A4fc9487874861AE259F5Bed48" ;
6362 const MentoBrokerV2Impl = "0xc69ae3550E25C7AB28301B9Bf75F20f5AF47B7d2" ;
@@ -141,15 +140,17 @@ export const upgradeCeloStep2 = async (network, checksOnly) => {
141140 [ release . MpbBridge , "upgradeTo(address)" , ethers . utils . defaultAbiCoder . encode ( [ "address" ] , [ bridgeImpl ] ) , "0" ] , //upgrade bridge
142141 [
143142 release . MpbBridge ,
144- "setBridgeLimits(uint256,uint256,uint256,uint256,bool)" ,
143+ "setBridgeLimits(( uint256,uint256,uint256,uint256,bool) )" ,
145144 ethers . utils . defaultAbiCoder . encode (
146145 [ "(uint256,uint256,uint256,uint256,bool)" ] ,
147146 [
148- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
149- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
150- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
151- ethers . constants . WeiPerEther . mul ( 10 ) ,
152- false
147+ [
148+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
149+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
150+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
151+ ethers . constants . WeiPerEther . mul ( 10 ) ,
152+ false
153+ ]
153154 ]
154155 ) ,
155156 "0" //set bridge limits
@@ -168,7 +169,7 @@ export const upgradeCeloStep2 = async (network, checksOnly) => {
168169 "registerScheme(address,bytes32,bytes4,address)" ,
169170 ethers . utils . defaultAbiCoder . encode (
170171 [ "address" , "bytes32" , "bytes4" , "address" ] ,
171- [ release . CircuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
172+ [ circuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
172173 ) ,
173174 "0"
174175 ] //give generic call rights to circuit breaker
@@ -274,15 +275,17 @@ export const upgradeFuseStep2 = async (network, checksOnly) => {
274275 [ release . MpbBridge , "upgradeTo(address)" , ethers . utils . defaultAbiCoder . encode ( [ "address" ] , [ bridgeImpl ] ) , "0" ] , //upgrade bridge
275276 [
276277 release . MpbBridge ,
277- "setBridgeLimits(uint256,uint256,uint256,uint256,bool)" ,
278+ "setBridgeLimits(( uint256,uint256,uint256,uint256,bool) )" ,
278279 ethers . utils . defaultAbiCoder . encode (
279280 [ "(uint256,uint256,uint256,uint256,bool)" ] ,
280281 [
281- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
282- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
283- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
284- ethers . constants . WeiPerEther . mul ( 10 ) ,
285- false
282+ [
283+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
284+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
285+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
286+ ethers . constants . WeiPerEther . mul ( 10 ) ,
287+ false
288+ ]
286289 ]
287290 ) ,
288291 "0" //set bridge limits
@@ -292,7 +295,7 @@ export const upgradeFuseStep2 = async (network, checksOnly) => {
292295 "registerScheme(address,bytes32,bytes4,address)" ,
293296 ethers . utils . defaultAbiCoder . encode (
294297 [ "address" , "bytes32" , "bytes4" , "address" ] ,
295- [ release . CircuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
298+ [ circuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
296299 ) ,
297300 "0"
298301 ] , //give generic call rights to circuit breaker
@@ -364,15 +367,17 @@ export const upgradeEthStep2 = async (network, checksOnly) => {
364367 [ release . MpbBridge , "upgradeTo(address)" , ethers . utils . defaultAbiCoder . encode ( [ "address" ] , [ bridgeImpl ] ) , "0" ] , //upgrade bridge
365368 [
366369 release . MpbBridge ,
367- "setBridgeLimits(uint256,uint256,uint256,uint256,bool)" ,
370+ "setBridgeLimits(( uint256,uint256,uint256,uint256,bool) )" ,
368371 ethers . utils . defaultAbiCoder . encode (
369372 [ "(uint256,uint256,uint256,uint256,bool)" ] ,
370373 [
371- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
372- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
373- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
374- ethers . constants . WeiPerEther . mul ( 10 ) ,
375- false
374+ [
375+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
376+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
377+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
378+ ethers . constants . WeiPerEther . mul ( 10 ) ,
379+ false
380+ ]
376381 ]
377382 ) ,
378383 "0" //set bridge limits
@@ -382,7 +387,7 @@ export const upgradeEthStep2 = async (network, checksOnly) => {
382387 "registerScheme(address,bytes32,bytes4,address)" ,
383388 ethers . utils . defaultAbiCoder . encode (
384389 [ "address" , "bytes32" , "bytes4" , "address" ] ,
385- [ release . CircuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
390+ [ circuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
386391 ) ,
387392 "0"
388393 ] //give generic call rights to circuit breaker
@@ -423,6 +428,9 @@ export const upgradeEthStep2 = async (network, checksOnly) => {
423428
424429export const upgradeXdcStep2 = async ( network , checksOnly ) => {
425430 let [ root ] = await ethers . getSigners ( ) ;
431+ const MentoReserveImpl = "0xBdaA65e8175875340365d76A660bB2A7a4EFE909" ;
432+ const ExchangeProviderV2Impl = "0xe930CDE20f60d0A4fc9487874861AE259F5Bed48" ;
433+ const MentoBrokerV2Impl = "0xc69ae3550E25C7AB28301B9Bf75F20f5AF47B7d2" ;
426434
427435 const isProduction = networkName . includes ( "production" ) ;
428436
@@ -507,9 +515,30 @@ export const upgradeXdcStep2 = async (network, checksOnly) => {
507515 } ;
508516 await releaser ( torelease , networkName , "deployment" , false ) ;
509517
510- console . log ( { exchangeId } ) ;
518+ console . log ( { exchangeId, DistHelper : DistHelper . address } ) ;
511519
512520 const proposalActions = [
521+ [
522+ release . MentoProxyAdmin ,
523+ "upgrade(address,address)" ,
524+ ethers . utils . defaultAbiCoder . encode (
525+ [ "address" , "address" ] ,
526+ [ release . MentoExchangeProvider , ExchangeProviderV2Impl ]
527+ ) ,
528+ "0"
529+ ] ,
530+ [
531+ release . MentoProxyAdmin ,
532+ "upgrade(address,address)" ,
533+ ethers . utils . defaultAbiCoder . encode ( [ "address" , "address" ] , [ release . MentoBroker , MentoBrokerV2Impl ] ) ,
534+ "0"
535+ ] ,
536+ [
537+ release . MentoProxyAdmin ,
538+ "upgrade(address,address)" ,
539+ ethers . utils . defaultAbiCoder . encode ( [ "address" , "address" ] , [ release . MentoReserve , MentoReserveImpl ] ) ,
540+ "0"
541+ ] ,
513542 [
514543 release . Controller ,
515544 "registerScheme(address,bytes32,bytes4,address)" ,
@@ -522,15 +551,17 @@ export const upgradeXdcStep2 = async (network, checksOnly) => {
522551 [ release . MpbBridge , "upgradeTo(address)" , ethers . utils . defaultAbiCoder . encode ( [ "address" ] , [ bridgeImpl ] ) , "0" ] , //upgrade bridge
523552 [
524553 release . MpbBridge ,
525- "setBridgeLimits(uint256,uint256,uint256,uint256,bool)" ,
554+ "setBridgeLimits(( uint256,uint256,uint256,uint256,bool) )" ,
526555 ethers . utils . defaultAbiCoder . encode (
527556 [ "(uint256,uint256,uint256,uint256,bool)" ] ,
528557 [
529- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
530- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
531- ethers . constants . WeiPerEther . mul ( 300e6 ) ,
532- ethers . constants . WeiPerEther . mul ( 10 ) ,
533- false
558+ [
559+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
560+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
561+ ethers . constants . WeiPerEther . mul ( 300e6 ) ,
562+ ethers . constants . WeiPerEther . mul ( 10 ) ,
563+ false
564+ ]
534565 ]
535566 ) ,
536567 "0" //set bridge limits
@@ -585,7 +616,7 @@ export const upgradeXdcStep2 = async (network, checksOnly) => {
585616 "registerScheme(address,bytes32,bytes4,address)" ,
586617 ethers . utils . defaultAbiCoder . encode (
587618 [ "address" , "bytes32" , "bytes4" , "address" ] ,
588- [ release . CircuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
619+ [ circuitBreaker , ethers . constants . HashZero , "0x00000010" , release . Avatar ]
589620 ) ,
590621 "0"
591622 ] //give generic call rights to circuit breaker
0 commit comments