-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from maticnetwork/command-scripts
new: add new script for update-implementation data
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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() | ||
} |