@@ -10,12 +10,25 @@ const Addresses = {
10
10
ayin : 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy'
11
11
}
12
12
13
+ const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3'
14
+
13
15
const TokenIds = {
14
16
usdt : alephium . contractIdFromAddress ( Addresses . usdt ) ,
15
17
weth : alephium . contractIdFromAddress ( Addresses . weth ) ,
16
18
ayin : alephium . contractIdFromAddress ( Addresses . ayin )
17
19
}
18
20
21
+ async function ayinTvlForXAyin ( ) {
22
+ const results = await alephium . contractMultiCall ( [
23
+ { group : 0 , address : XAyinAddress , methodIndex : 3 } ,
24
+ { group : 0 , address : XAyinAddress , methodIndex : 11 }
25
+ ] )
26
+
27
+ const totalSupply = results [ 0 ] . returns [ 0 ] . value
28
+ const currentPrice = results [ 1 ] . returns [ 0 ] . value
29
+ return ( Number ( totalSupply ) / 1e18 ) * ( Number ( currentPrice ) / 1e18 )
30
+ }
31
+
19
32
async function tvl ( ) {
20
33
const alphTvls = await Promise . all ( [
21
34
Addresses . alphAyinPool , Addresses . alphUsdtPool , Addresses . alphWethPool
@@ -32,9 +45,10 @@ async function tvl() {
32
45
} ) ;
33
46
return res
34
47
} , { [ TokenIds . ayin ] : 0 , [ TokenIds . usdt ] : 0 , [ TokenIds . weth ] : 0 } )
48
+ const xAyinTvl = await ayinTvlForXAyin ( )
35
49
return {
36
50
alephium : alphTvl / 1e18 ,
37
- ayin : tokensTvl [ TokenIds . ayin ] / 1e18 ,
51
+ ayin : tokensTvl [ TokenIds . ayin ] / 1e18 + xAyinTvl ,
38
52
weth : tokensTvl [ TokenIds . weth ] / 1e18 ,
39
53
tether : tokensTvl [ TokenIds . usdt ] / 1e6
40
54
}
0 commit comments