Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
308 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require('dotenv').config() | ||
const Web3 = require('web3') | ||
const multiSigWalletAbi = require('../../abi/multiSigwallet') | ||
const proxyAbi = require('../../../build/contracts/EternalStorageProxy').abi | ||
const foreignBridgeAbi = require('../../../build/contracts/ForeignBridgeErcToNative').abi | ||
const callMultiSigWallet = require('../utils/callMultiSigWallet') | ||
const validatorState = require('../utils/validatorState') | ||
|
||
const { | ||
FOREIGN_PRIVKEY, | ||
FOREIGN_RPC_URL, | ||
FOREING_BRIDGE_ADDRESS, | ||
ROLE, | ||
FOREIGN_START_BLOCK, | ||
FOREIGN_GAS_PRICE, | ||
CHAI_INTEREST_RECEIVER | ||
} = process.env | ||
|
||
const web3 = new Web3(new Web3.providers.HttpProvider(FOREIGN_RPC_URL)) | ||
const { address } = web3.eth.accounts.wallet.add(FOREIGN_PRIVKEY) | ||
|
||
const initializeChai = async () => { | ||
try { | ||
const proxy = new web3.eth.Contract(proxyAbi, FOREING_BRIDGE_ADDRESS) | ||
const bridge = new web3.eth.Contract(foreignBridgeAbi, FOREING_BRIDGE_ADDRESS) | ||
|
||
const ownerAddress = await proxy.methods.upgradeabilityOwner().call() | ||
const multiSigWallet = new web3.eth.Contract(multiSigWalletAbi, ownerAddress) | ||
|
||
await validatorState(web3, address, multiSigWallet) | ||
|
||
const data = bridge.methods.initializeChaiToken(CHAI_INTEREST_RECEIVER).encodeABI() | ||
|
||
await callMultiSigWallet({ | ||
role: ROLE, | ||
contract: multiSigWallet, | ||
destination: FOREING_BRIDGE_ADDRESS, | ||
fromBlock: FOREIGN_START_BLOCK, | ||
gasPrice: FOREIGN_GAS_PRICE, | ||
address, | ||
data | ||
}) | ||
} catch (e) { | ||
console.log(e.message) | ||
} | ||
} | ||
|
||
initializeChai() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require('dotenv').config() | ||
const Web3 = require('web3') | ||
const multiSigWalletAbi = require('../../abi/multiSigwallet') | ||
const proxyAbi = require('../../../build/contracts/EternalStorageProxy').abi | ||
const callMultiSigWallet = require('../utils/callMultiSigWallet') | ||
const validatorState = require('../utils/validatorState') | ||
|
||
const { | ||
FOREIGN_PRIVKEY, | ||
FOREIGN_RPC_URL, | ||
FOREING_BRIDGE_ADDRESS, | ||
ROLE, | ||
FOREIGN_START_BLOCK, | ||
FOREIGN_GAS_PRICE, | ||
NEW_IMPLEMENTATION_ETH_BRIDGE | ||
} = process.env | ||
|
||
const web3 = new Web3(new Web3.providers.HttpProvider(FOREIGN_RPC_URL)) | ||
const { address } = web3.eth.accounts.wallet.add(FOREIGN_PRIVKEY) | ||
|
||
const upgradeBridgeOnForeign = async () => { | ||
try { | ||
const proxy = new web3.eth.Contract(proxyAbi, FOREING_BRIDGE_ADDRESS) | ||
const ownerAddress = await proxy.methods.upgradeabilityOwner().call() | ||
const multiSigWallet = new web3.eth.Contract(multiSigWalletAbi, ownerAddress) | ||
|
||
await validatorState(web3, address, multiSigWallet) | ||
|
||
const data = proxy.methods.upgradeTo('4', NEW_IMPLEMENTATION_ETH_BRIDGE).encodeABI() | ||
|
||
await callMultiSigWallet({ | ||
role: ROLE, | ||
contract: multiSigWallet, | ||
destination: FOREING_BRIDGE_ADDRESS, | ||
fromBlock: FOREIGN_START_BLOCK, | ||
gasPrice: FOREIGN_GAS_PRICE, | ||
address, | ||
data | ||
}) | ||
} catch (e) { | ||
console.log(e.message) | ||
} | ||
} | ||
|
||
upgradeBridgeOnForeign() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require('dotenv').config() | ||
const Web3 = require('web3') | ||
const multiSigWalletAbi = require('../../abi/multiSigwallet') | ||
const proxyAbi = require('../../../build/contracts/EternalStorageProxy').abi | ||
const foreignBridgeAbi = require('../../../build/contracts/ForeignBridgeErcToNative').abi | ||
const callMultiSigWallet = require('../utils/callMultiSigWallet') | ||
const validatorState = require('../utils/validatorState') | ||
|
||
const { | ||
FOREIGN_PRIVKEY, | ||
FOREIGN_RPC_URL, | ||
FOREING_BRIDGE_ADDRESS, | ||
ROLE, | ||
FOREIGN_START_BLOCK, | ||
FOREIGN_GAS_PRICE | ||
} = process.env | ||
|
||
const web3 = new Web3(new Web3.providers.HttpProvider(FOREIGN_RPC_URL)) | ||
const { address } = web3.eth.accounts.wallet.add(FOREIGN_PRIVKEY) | ||
|
||
const migrateToMCD = async () => { | ||
try { | ||
const proxy = new web3.eth.Contract(proxyAbi, FOREING_BRIDGE_ADDRESS) | ||
const bridge = new web3.eth.Contract(foreignBridgeAbi, FOREING_BRIDGE_ADDRESS) | ||
|
||
const ownerAddress = await proxy.methods.upgradeabilityOwner().call() | ||
const multiSigWallet = new web3.eth.Contract(multiSigWalletAbi, ownerAddress) | ||
|
||
await validatorState(web3, address, multiSigWallet) | ||
|
||
const data = bridge.methods.migrateToMCD().encodeABI() | ||
|
||
await callMultiSigWallet({ | ||
role: ROLE, | ||
contract: multiSigWallet, | ||
destination: FOREING_BRIDGE_ADDRESS, | ||
fromBlock: FOREIGN_START_BLOCK, | ||
gasPrice: FOREIGN_GAS_PRICE, | ||
address, | ||
data | ||
}) | ||
} catch (e) { | ||
console.log(e.message) | ||
} | ||
} | ||
|
||
migrateToMCD() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require('dotenv').config() | ||
const Web3 = require('web3') | ||
const multiSigWalletAbi = require('../../abi/multiSigwallet') | ||
const proxyAbi = require('../../../build/contracts/EternalStorageProxy').abi | ||
const callMultiSigWallet = require('../utils/callMultiSigWallet') | ||
const validatorState = require('../utils/validatorState') | ||
|
||
const { | ||
HOME_PRIVKEY, | ||
HOME_RPC_URL, | ||
HOME_BRIDGE_ADDRESS, | ||
ROLE, | ||
HOME_START_BLOCK, | ||
HOME_GAS_PRICE, | ||
NEW_IMPLEMENTATION_XDAI_BRIDGE | ||
} = process.env | ||
|
||
const web3 = new Web3(new Web3.providers.HttpProvider(HOME_RPC_URL)) | ||
const { address } = web3.eth.accounts.wallet.add(HOME_PRIVKEY) | ||
|
||
const proxy = new web3.eth.Contract(proxyAbi, HOME_BRIDGE_ADDRESS) | ||
|
||
const upgradeBridgeOnHome = async () => { | ||
try { | ||
const ownerAddress = await proxy.methods.upgradeabilityOwner().call() | ||
const multiSigWallet = new web3.eth.Contract(multiSigWalletAbi, ownerAddress) | ||
|
||
await validatorState(web3, address, multiSigWallet) | ||
|
||
const data = proxy.methods.upgradeTo('3', NEW_IMPLEMENTATION_XDAI_BRIDGE).encodeABI() | ||
|
||
await callMultiSigWallet({ | ||
role: ROLE, | ||
contract: multiSigWallet, | ||
destination: HOME_BRIDGE_ADDRESS, | ||
fromBlock: HOME_START_BLOCK, | ||
gasPrice: HOME_GAS_PRICE, | ||
address, | ||
data | ||
}) | ||
} catch (e) { | ||
console.log(e.message) | ||
} | ||
} | ||
|
||
upgradeBridgeOnHome() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.