@@ -7,13 +7,27 @@ const accounts = Object.values({
7
7
account3 : 'cro1pduq0ga2ans0sspph6r5hcf77cqypz6de7n64y' ,
8
8
account4 : 'cro1fncg0fsr8vt30qaqmzqxunnrkxr6a7xxkfpr7y' ,
9
9
account5 : 'cro1hhfh6xaflg8zwhwvrs7sgur2pyfunjqeu8wsd6' ,
10
+ account6 : 'cro1a2vawclcntewtjd5jfjf44dr6mdfdyg8xzfe5t' ,
11
+ account7 : 'cro1wc43z84u8keas3ffw4ynapwe0hzfen3xx03dpd' ,
12
+ account8 : 'cro1ujkwlnfnl3mmka4twqx07azxk6djlplddcn48h' ,
13
+ account9 : 'cro16wzuj3a9tdqk9z3edx587athz2kk75gj2l6etk' ,
14
+ account10 : 'cro1hfx8t4nldtfk5w6h6eherfts4gtelvcn0dypc3' ,
10
15
} )
11
16
12
17
async function tvl ( api ) {
13
18
const data = await Promise . all ( accounts . map ( account => queryV1Beta1 ( { chain : 'cronos' , url : `/staking/v1beta1/delegations/${ account } ` , } ) ) ) ;
14
- const factroy_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0' ;
19
+ const data2 = await Promise . all ( accounts . map ( account => queryV1Beta1 ( { chain : 'cronos' , url : `/staking/v1beta1/delegators/${ account } /unbonding_delegations` , } ) ) ) ;
20
+ const factory_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0' ;
21
+ const factoryV2_contract_address = '0xfd3300b2441072b35554f1043c3d3a413fd5c219' ;
15
22
data . map ( i => i . delegation_responses ) . flat ( ) . forEach ( i => api . add ( ADDRESSES . cronos . WCRO , i . balance . amount * 1e10 ) )
16
- return api . sumTokens ( { owner : factroy_contract_address , tokens : [ ADDRESSES . cronos . WCRO_1 ] } )
23
+
24
+ for ( let j = 0 ; j < accounts . length ; j ++ ) {
25
+ if ( Number ( data2 [ j ] . pagination . total ) > 0 ) {
26
+ data2 [ j ] . unbonding_responses [ 0 ] . entries . flat ( ) . forEach ( i => api . add ( ADDRESSES . cronos . WCRO , i . balance * 1e10 ) )
27
+ }
28
+ }
29
+
30
+ return api . sumTokens ( { owners : [ factory_contract_address , factoryV2_contract_address ] , tokens : [ ADDRESSES . cronos . WCRO_1 ] } )
17
31
}
18
32
19
33
module . exports = {
0 commit comments