@@ -15,44 +15,46 @@ const xrpTBILLAddr = {
15
15
subscriptionOperatorAddress : 'rB56JZWRKvpWNeyqM3QYfZwW4fS9YEyPWM' ,
16
16
}
17
17
18
- async function evmTVL ( api ) {
19
- if ( evmTBILLAddr [ api . chain ] ) {
20
- const tbillTVL = await api . call ( {
21
- abi : 'uint256:totalAssets' ,
22
- target : evmTBILLAddr [ api . chain ] ,
23
- } )
24
- api . add ( evmTBILLAddr [ api . chain ] , tbillTVL )
25
- }
26
-
27
- if ( evmUSDOAddr [ api . chain ] ) {
28
- const usdoTVL = await api . call ( {
29
- abi : 'uint256:totalSupply' ,
30
- target : evmUSDOAddr [ api . chain ] ,
31
- } )
32
- api . add ( evmUSDOAddr [ api . chain ] , usdoTVL )
33
- }
18
+ async function evmTVL ( api , token ) {
19
+ const tvl = await api . call ( {
20
+ abi : 'erc20:totalSupply' ,
21
+ target : token ,
22
+ } )
23
+ api . add ( token , tvl , { skipChain : true } )
24
+ }
25
+
26
+ async function ethTVL ( api ) {
27
+ evmTVL ( api , evmTBILLAddr [ 'ethereum' ] )
28
+ evmTVL ( api , evmUSDOAddr [ 'ethereum' ] )
29
+ }
30
+
31
+ async function arbTVL ( api ) {
32
+ evmTVL ( api , evmTBILLAddr [ 'arbitrum' ] )
33
+ }
34
+
35
+ async function baseTVL ( api ) {
36
+ evmTVL ( api , evmUSDOAddr [ 'base' ] )
34
37
}
35
38
36
39
async function solTVL ( api ) {
37
40
const data = await getTokenSupplies ( [ solTBILLAddr ] )
38
41
Object . entries ( data ) . forEach ( ( [ token , balance ] ) => {
39
- api . add ( token , balance )
42
+ api . add ( token , balance , { skipChain : true } )
40
43
} )
41
44
}
42
45
43
46
async function xrpTVL ( api ) {
44
-
45
47
const data = await ripple . gatewayBalances ( {
46
- account : xrpTBILLAddr . issuerAddress ,
47
- hotwallet : xrpTBILLAddr . subscriptionOperatorAddress ,
48
+ account : xrpTBILLAddr . issuerAddress ,
49
+ hotwallet : xrpTBILLAddr . subscriptionOperatorAddress ,
48
50
} )
49
51
api . add ( evmTBILLAddr [ 'ethereum' ] , Number ( data . obligations ?. TBL ) * 1e6 , { skipChain : true } )
50
52
}
51
53
52
54
module . exports = {
53
- ethereum : { tvl : evmTVL } ,
54
- arbitrum : { tvl : evmTVL } ,
55
- base : { tvl : evmTVL } ,
55
+ ethereum : { tvl : ethTVL } ,
56
+ arbitrum : { tvl : arbTVL } ,
57
+ base : { tvl : baseTVL } ,
56
58
ripple : { tvl : xrpTVL } ,
57
59
solana : { tvl : solTVL } ,
58
60
}
0 commit comments