@@ -8,7 +8,7 @@ async function main() {
8
8
9
9
let newWalletAddress = null ;
10
10
11
- switch ( network ) {
11
+ switch ( network ) {
12
12
case "rsktestnet" :
13
13
newWalletAddress = '0x51591ec8f296ef3e4deebe32c392c706aef42133' ;
14
14
break ;
@@ -20,11 +20,6 @@ async function main() {
20
20
break ;
21
21
}
22
22
23
- if ( newWalletAddress === null ) {
24
- console . log ( 'No new owner founded' ) ;
25
- return ;
26
- }
27
-
28
23
const Bridge = await deployments . get ( 'BridgeV3' ) ;
29
24
const BridgeProxy = await deployments . get ( 'BridgeProxy' ) ;
30
25
@@ -51,72 +46,59 @@ async function main() {
51
46
console . log ( 'Current Bridge Owner: ' , bridgeOwner ) ;
52
47
console . log ( 'List of multisig owners: ' , multiSigOwners ) ;
53
48
54
- if ( ! multiSigOwners . includes ( deployer ) ) {
55
- console . log ( 'You should be a owner in the multisig wallet to perform this transaction' ) ;
49
+ if ( ! multiSigOwners . includes ( deployer ) || newWalletAddress === null ) {
50
+ console . log ( 'You should be a owner in the multisig wallet to perform this transaction and the new ' +
51
+ 'wallet should exists' ) ;
56
52
return ;
57
53
}
58
54
59
- if ( bridgeOwner === MultiSigWallet . address ) {
60
- const changeBridgeOwnerMethod = bridge . methods
61
- . transferOwnership ( newWalletAddress ) ;
62
- await changeBridgeOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
63
- await multiSigContract . methods . submitTransaction (
64
- BridgeProxy . address ,
65
- 0 ,
66
- changeBridgeOwnerMethod . encodeABI ( )
67
- ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
55
+ try {
56
+ if ( bridgeOwner === MultiSigWallet . address ) {
57
+ const changeBridgeOwnerMethod = bridge . methods
58
+ . transferOwnership ( newWalletAddress ) ;
59
+ await changeBridgeOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
60
+ await multiSigContract . methods . submitTransaction (
61
+ BridgeProxy . address ,
62
+ 0 ,
63
+ changeBridgeOwnerMethod . encodeABI ( )
64
+ ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
68
65
69
- const newOwner = await bridge . methods . owner ( ) . call ( ) ;
66
+ const newOwner = await bridge . methods . owner ( ) . call ( ) ;
70
67
71
- if ( newOwner . toLowerCase ( ) === newWalletAddress . toLowerCase ( ) ) {
72
68
console . log ( 'Bridge owner changed successfully, the new owner now is: ' , newOwner ) ;
73
- } else {
74
- console . log ( 'Error changing the bridge owner, owner is: ' , newOwner ) ;
75
69
}
76
- } else {
77
- console . log ( 'Multisig is not the bridge owner' ) ;
78
- }
79
70
80
- if ( federationOwner === MultiSigWallet . address ) {
81
- const changeFederationOwnerMethod = federation . methods
82
- . transferOwnership ( newWalletAddress ) ;
83
- await changeFederationOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
84
- await multiSigContract . methods . submitTransaction (
85
- FederationProxy . address ,
86
- 0 ,
87
- changeFederationOwnerMethod . encodeABI ( )
88
- ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
71
+ if ( federationOwner === MultiSigWallet . address ) {
72
+ const changeFederationOwnerMethod = federation . methods
73
+ . transferOwnership ( newWalletAddress ) ;
74
+ await changeFederationOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
75
+ await multiSigContract . methods . submitTransaction (
76
+ FederationProxy . address ,
77
+ 0 ,
78
+ changeFederationOwnerMethod . encodeABI ( )
79
+ ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
89
80
90
- const newOwner = await federation . methods . owner ( ) . call ( ) ;
81
+ const newOwner = await federation . methods . owner ( ) . call ( ) ;
91
82
92
- if ( newOwner . toLowerCase ( ) === newWalletAddress . toLowerCase ( ) ) {
93
83
console . log ( 'Federation owner changed successfully, the new owner now is: ' , newOwner ) ;
94
- } else {
95
- console . log ( 'Error changing the federation owner, owner is: ' , newOwner ) ;
96
84
}
97
- } else {
98
- console . log ( 'Multisig is not the Federation owner' ) ;
99
- }
100
85
101
- if ( allowTokensOwner === MultiSigWallet . address ) {
102
- const changeAllowTokensOwnerMethod = allowTokens . methods
103
- . transferOwnership ( newWalletAddress ) ;
104
- await changeAllowTokensOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
105
- await multiSigContract . methods . submitTransaction (
106
- AllowTokensProxy . address ,
107
- 0 ,
108
- changeAllowTokensOwnerMethod . encodeABI ( )
109
- ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
86
+ if ( allowTokensOwner === MultiSigWallet . address ) {
87
+ const changeAllowTokensOwnerMethod = allowTokens . methods
88
+ . transferOwnership ( newWalletAddress ) ;
89
+ await changeAllowTokensOwnerMethod . call ( { from : MultiSigWallet . address } ) ;
90
+ await multiSigContract . methods . submitTransaction (
91
+ AllowTokensProxy . address ,
92
+ 0 ,
93
+ changeAllowTokensOwnerMethod . encodeABI ( )
94
+ ) . send ( { from : deployer , gasLimit : 3000000 } ) ;
110
95
111
- const newOwner = await allowTokens . methods . owner ( ) . call ( ) ;
96
+ const newOwner = await allowTokens . methods . owner ( ) . call ( ) ;
112
97
113
- if ( newOwner . toLowerCase ( ) === newWalletAddress . toLowerCase ( ) ) {
114
98
console . log ( 'Allow Tokens owner changed successfully, the new owner now is: ' , newOwner ) ;
115
- } else {
116
- console . log ( 'Error changing the Allow Tokens owner, owner is: ' , newOwner ) ;
117
99
}
118
- } else {
119
- console . log ( 'Multisig is not the Allow tokens owner' ) ;
100
+ } catch ( err ) {
101
+ throw new Error ( err ) ;
120
102
}
121
103
}
122
104
0 commit comments