@@ -41,10 +41,8 @@ task('info:ampl', 'Prints AMPL token data from given networks')
41
41
`${ args . bridge } /tokenVault` ,
42
42
provider ,
43
43
) ;
44
- const [
45
- globalAmpleforthEpoch ,
46
- globalAMPLSupply ,
47
- ] = await policy . globalAmpleforthEpochAndAMPLSupply ( ) ;
44
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
45
+ await policy . globalAmpleforthEpochAndAMPLSupply ( ) ;
48
46
const circulatingSupply = await ampl . totalSupply ( ) ;
49
47
const totalLocked = await tokenVault . totalLocked ( ampl . address ) ;
50
48
console . log ( 'Global epoch:' , globalAmpleforthEpoch . toString ( ) ) ;
@@ -65,10 +63,8 @@ task('info:ampl', 'Prints AMPL token data from given networks')
65
63
'xcAmpleController' ,
66
64
provider ,
67
65
) ;
68
- const [
69
- globalAmpleforthEpoch ,
70
- globalAMPLSupply ,
71
- ] = await xcAmpleController . globalAmpleforthEpochAndAMPLSupply ( ) ;
66
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
67
+ await xcAmpleController . globalAmpleforthEpochAndAMPLSupply ( ) ;
72
68
const circulatingSupply = await xcAmple . totalSupply ( ) ;
73
69
console . log ( 'Global epoch:' , globalAmpleforthEpoch . toString ( ) ) ;
74
70
console . log ( 'Global supply:' , toAmplFloatingPt ( globalAMPLSupply ) ) ;
@@ -107,10 +103,8 @@ task('info:ampl:balance', 'Prints AMPL token balance from given networks')
107
103
'policy' ,
108
104
provider ,
109
105
) ;
110
- const [
111
- globalAmpleforthEpoch ,
112
- globalAMPLSupply ,
113
- ] = await policy . globalAmpleforthEpochAndAMPLSupply ( ) ;
106
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
107
+ await policy . globalAmpleforthEpochAndAMPLSupply ( ) ;
114
108
const balance = await ampl . balanceOf ( args . wallet ) ;
115
109
console . log ( 'Global supply:' , toAmplFloatingPt ( globalAMPLSupply ) ) ;
116
110
console . log ( `Balance(${ args . wallet } ):` , toAmplFloatingPt ( balance ) ) ;
@@ -125,14 +119,142 @@ task('info:ampl:balance', 'Prints AMPL token balance from given networks')
125
119
'xcAmpleController' ,
126
120
provider ,
127
121
) ;
128
- const [
129
- globalAmpleforthEpoch ,
130
- globalAMPLSupply ,
131
- ] = await xcAmpleController . globalAmpleforthEpochAndAMPLSupply ( ) ;
122
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
123
+ await xcAmpleController . globalAmpleforthEpochAndAMPLSupply ( ) ;
132
124
const balance = await xcAmple . balanceOf ( args . wallet ) ;
133
125
console . log ( 'Global supply:' , toAmplFloatingPt ( globalAMPLSupply ) ) ;
134
126
console . log ( `Balance(${ args . wallet } ):` , toAmplFloatingPt ( balance ) ) ;
135
127
}
136
128
console . log ( '---------------------------------------------------------' ) ;
137
129
}
138
130
} ) ;
131
+
132
+ task (
133
+ 'info:ampl:setup' ,
134
+ 'Prints AMPL configuration paramters from given networks' ,
135
+ )
136
+ . addParam ( 'networks' , 'List of hardhat networks' , [ ] , types . json )
137
+ . setAction ( async ( args , hre ) => {
138
+ for ( let n in args . networks ) {
139
+ const network = args . networks [ n ] ;
140
+ const chainAddresses = await readDeploymentData ( network ) ;
141
+ const provider = getEthersProvider ( network ) ;
142
+
143
+ console . log ( '---------------------------------------------------------' ) ;
144
+ console . log (
145
+ chainAddresses . isBaseChain ? 'BaseChain' : 'SatelliteChain' ,
146
+ network ,
147
+ ) ;
148
+
149
+ if ( chainAddresses . isBaseChain ) {
150
+ const ampl = await getDeployedContractInstance (
151
+ network ,
152
+ 'ampl' ,
153
+ provider ,
154
+ ) ;
155
+ const policy = await getDeployedContractInstance (
156
+ network ,
157
+ 'policy' ,
158
+ provider ,
159
+ ) ;
160
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
161
+ await policy . globalAmpleforthEpochAndAMPLSupply ( ) ;
162
+ console . log ( 'AMPL:' , ampl . address ) ;
163
+ console . log ( 'AMPL:policy:' , await ampl . monetaryPolicy ( ) ) ;
164
+ console . log (
165
+ 'AMPL:totalSupply:' ,
166
+ toAmplFloatingPt ( await ampl . totalSupply ( ) ) ,
167
+ ) ;
168
+ console . log ( 'Policy:' , policy . address ) ;
169
+ console . log ( 'Policy:epoch:' , globalAmpleforthEpoch . toString ( ) ) ;
170
+ console . log ( 'Policy:globalSupply:' , toAmplFloatingPt ( globalAMPLSupply ) ) ;
171
+ } else {
172
+ const proxyAdmin = await getDeployedContractInstance (
173
+ network ,
174
+ 'proxyAdmin' ,
175
+ provider ,
176
+ ) ;
177
+ const xcAmple = await getDeployedContractInstance (
178
+ network ,
179
+ 'xcAmple' ,
180
+ provider ,
181
+ ) ;
182
+ const xcAmpleController = await getDeployedContractInstance (
183
+ network ,
184
+ 'xcAmpleController' ,
185
+ provider ,
186
+ ) ;
187
+ const rebaseRelayer = await getDeployedContractInstance (
188
+ network ,
189
+ 'rebaseRelayer' ,
190
+ provider ,
191
+ ) ;
192
+ const [ globalAmpleforthEpoch , globalAMPLSupply ] =
193
+ await xcAmpleController . globalAmpleforthEpochAndAMPLSupply ( ) ;
194
+
195
+ let gatewayWhitelist = { } ;
196
+ try {
197
+ // This fails for BSC
198
+ const whitelistEvents = await xcAmpleController . queryFilter (
199
+ await xcAmpleController . filters . GatewayWhitelistUpdated ( ) ,
200
+ chainAddresses [ 'xcAmple' ] . blockNumber ,
201
+ ) ;
202
+ gatewayWhitelist = whitelistEvents . reduce ( ( m , e ) => {
203
+ m [ e . args . bridgeGateway ] = e . args . active ;
204
+ return m ;
205
+ } , { } ) ;
206
+ } catch ( e ) {
207
+ console . error ( 'Failed to fetch whitelist, verify manually!' ) ;
208
+ }
209
+
210
+ console . log ( 'ProxyAdmin:' , proxyAdmin . address ) ;
211
+ console . log ( 'XCAmple:' , xcAmple . address ) ;
212
+ console . log (
213
+ 'XCAmple:implementation' ,
214
+ await proxyAdmin . getProxyImplementation ( xcAmple . address ) ,
215
+ ) ;
216
+ console . log ( 'XCAmple:controller:' , await xcAmple . controller ( ) ) ;
217
+ console . log (
218
+ 'XCAmple:totalSupply:' ,
219
+ toAmplFloatingPt ( await xcAmple . totalSupply ( ) ) ,
220
+ ) ;
221
+
222
+ console . log ( 'XCAmpleController:' , xcAmple . address ) ;
223
+ console . log (
224
+ 'XCAmpleController:implementation' ,
225
+ await proxyAdmin . getProxyImplementation ( xcAmple . address ) ,
226
+ ) ;
227
+ console . log (
228
+ 'XCAmpleController:xcAmple' ,
229
+ await xcAmpleController . xcAmple ( ) ,
230
+ ) ;
231
+ console . log (
232
+ 'XCAmpleController:epoch' ,
233
+ globalAmpleforthEpoch . toString ( ) ,
234
+ ) ;
235
+ console . log (
236
+ 'XCAmpleController:totalSupply' ,
237
+ toAmplFloatingPt ( globalAMPLSupply ) ,
238
+ ) ;
239
+ console . log ( 'XCAmpleController:gatewayWhitelist' , gatewayWhitelist ) ;
240
+ console . log (
241
+ 'XCAmpleController:rebaseRelayer' ,
242
+ await xcAmpleController . rebaseRelayer ( ) ,
243
+ ) ;
244
+
245
+ console . log ( 'RebaseRelayer:' , rebaseRelayer . address ) ;
246
+ const transactionsSize = (
247
+ await rebaseRelayer . transactionsSize ( )
248
+ ) . toNumber ( ) ;
249
+ console . log ( 'RebaseRelayer:transactionsSize' , transactionsSize ) ;
250
+ for ( let i = 0 ; i < transactionsSize ; i ++ ) {
251
+ const tx = await rebaseRelayer . transactions ( i ) ;
252
+ console . log ( `RebaseRelayer:transaction(${ i } ):` ) ;
253
+ console . log ( '\tdestination:' , tx . destination ) ;
254
+ console . log ( '\tdata:' , tx . data ) ;
255
+ console . log ( '\tenabled:' , tx . enabled ) ;
256
+ }
257
+ }
258
+ console . log ( '---------------------------------------------------------' ) ;
259
+ }
260
+ } ) ;
0 commit comments