File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -118,3 +118,9 @@ npm run truffle -- migrate --network mainnetChild --f 5 --to 5
118118- Register RootChainManager and ChildChainManager on StateSender
119119- Set stateSenderAddress on RootChainManager
120120- Grant STATE_SYNCER_ROLE on ChildChainManager
121+
122+ ### Command scripts (Management scripts)
123+
124+ ``` bash
125+ npm run truffle exec scripts/update-implementation.js -- --network < network-name> < new-address>
126+ ```
Original file line number Diff line number Diff line change 1+ const contractAddresses = require ( '../contractAddresses.json' )
2+
3+ const RootChainManagerProxy = artifacts . require ( 'RootChainManagerProxy' )
4+
5+ async function updateImplementation ( address ) {
6+ const rootChainManager = await RootChainManagerProxy . at (
7+ contractAddresses . root . RootChainManagerProxy
8+ )
9+
10+ let currentImplementation = await rootChainManager . implementation ( )
11+ console . log ( "Current ChildChainManagerProxy implementation address" , currentImplementation )
12+
13+ const data = rootChainManager . contract . methods . updateImplementation ( address ) . encodeABI ( )
14+ console . log ( "ChildChainManagerProxy updateImplementation ABI encoded data:" , data )
15+ }
16+
17+ module . exports = async function ( callback ) {
18+ // args starts with index 6, example: first arg == process.args[6]
19+ console . log ( process . argv )
20+ try {
21+ const accounts = await web3 . eth . getAccounts ( )
22+ console . log ( 'Current configured address to make transactions:' , accounts [ 0 ] )
23+
24+ // set validator share address
25+ // -- --network <network-name> <new-address>
26+ await updateImplementation ( process . argv [ 6 ] )
27+ } catch ( e ) {
28+ // truffle exec <script> doesn't throw errors, so handling it in a verbose manner here
29+ console . log ( e )
30+ }
31+ callback ( )
32+ }
You can’t perform that action at this time.
0 commit comments