File tree Expand file tree Collapse file tree 2 files changed +36
-27
lines changed Expand file tree Collapse file tree 2 files changed +36
-27
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ const host_chains = {
34
34
} ;
35
35
36
36
const endpoint = endPoints [ "pryzm" ]
37
- const amm_vault_address = "pryzm1y7d08j5uy7kgurnv4pwag8h34m2cgptcwe75wn" ;
38
37
39
38
function tvlOnChain ( chain ) {
40
39
return async ( api ) => {
@@ -49,32 +48,6 @@ function tvlOnChain(chain) {
49
48
} ;
50
49
}
51
50
52
- async function tvl ( api ) {
53
- const { balances : data } =
54
- await get ( `${ endpoint } /cosmos/bank/v1beta1/balances/${ amm_vault_address } ?pagination.limit=1000` ) ;
55
-
56
- for ( const { denom, amount } of data ) {
57
- if ( denom . startsWith ( "c:" ) ||
58
- denom . startsWith ( "p:" ) ||
59
- denom . startsWith ( "y:" ) ||
60
- denom . startsWith ( "lp:" )
61
- ) {
62
- continue
63
- }
64
- if ( denom === 'ibc/B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395' )
65
- api . addCGToken ( 'terra-luna-2' , amount / 1e6 )
66
- else
67
- api . add ( denom , amount ) ;
68
- }
69
- }
70
-
71
- module . exports = {
72
- methodology : "Counts the liquidity on liquid staking module and all AMM pools" ,
73
- pryzm : {
74
- tvl
75
- } ,
76
- } ;
77
-
78
51
for ( const chainName of Object . keys ( host_chains ) ) {
79
52
module . exports [ chainName ] = { tvl : tvlOnChain ( host_chains [ chainName ] ) } ;
80
53
}
Original file line number Diff line number Diff line change
1
+ const { get } = require ( '../helper/http' )
2
+ const { endPoints, } = require ( '../helper/chain/cosmos' ) ;
3
+ const { concat } = require ( "ethers" ) ;
4
+
5
+ const endpoint = endPoints [ "pryzm" ]
6
+ const amm_vault_address = "pryzm1y7d08j5uy7kgurnv4pwag8h34m2cgptcwe75wn" ;
7
+ const refractor_vault_address = "pryzm1xtnrr4e6553hap0zuveautjstc3w2sxmf2zph3" ;
8
+
9
+ async function tvl ( api ) {
10
+ const [ { balances : amm_balances } , { balances : refractor_balances } ] =
11
+ await Promise . all ( [
12
+ await get ( `${ endpoint } /cosmos/bank/v1beta1/balances/${ amm_vault_address } ?pagination.limit=1000` ) ,
13
+ await get ( `${ endpoint } /cosmos/bank/v1beta1/balances/${ refractor_vault_address } ?pagination.limit=1000` )
14
+ ] ) ;
15
+
16
+ let all_balances = amm_balances . concat ( refractor_balances ) ;
17
+ for ( const { denom, amount } of all_balances ) {
18
+ if ( denom . startsWith ( "p:" ) ||
19
+ denom . startsWith ( "y:" ) ||
20
+ denom . startsWith ( "lp:" )
21
+ ) {
22
+ continue
23
+ }
24
+ if ( denom === 'ibc/B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395' )
25
+ api . addCGToken ( 'terra-luna-2' , amount / 1e6 )
26
+ else
27
+ api . add ( denom , amount ) ;
28
+ }
29
+ }
30
+
31
+ module . exports = {
32
+ methodology : "Counts the liquidity on the refractor module and all AMM pools" ,
33
+ pryzm : {
34
+ tvl
35
+ } ,
36
+ } ;
You can’t perform that action at this time.
0 commit comments