forked from maticnetwork/pos-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-implementation.js
32 lines (26 loc) · 1.17 KB
/
update-implementation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const contractAddresses = require('../contractAddresses.json')
const RootChainManagerProxy = artifacts.require('RootChainManagerProxy')
async function updateImplementation(address) {
const rootChainManager = await RootChainManagerProxy.at(
contractAddresses.root.RootChainManagerProxy
)
let currentImplementation = await rootChainManager.implementation()
console.log("Current ChildChainManagerProxy implementation address", currentImplementation)
const data = rootChainManager.contract.methods.updateImplementation(address).encodeABI()
console.log("ChildChainManagerProxy updateImplementation ABI encoded data:", data)
}
module.exports = async function(callback) {
// args starts with index 6, example: first arg == process.args[6]
console.log(process.argv)
try {
const accounts = await web3.eth.getAccounts()
console.log('Current configured address to make transactions:', accounts[0])
// set validator share address
// -- --network <network-name> <new-address>
await updateImplementation(process.argv[6])
} catch (e) {
// truffle exec <script> doesn't throw errors, so handling it in a verbose manner here
console.log(e)
}
callback()
}