File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ const sui = require ( "../helper/chain/sui" )
2
+
3
+ const XSUI_INFO_ID =
4
+ "0x0431232199873db77a92aa645cd43521437e9cc5c6fff07fd03edb88afe0b25a"
5
+ const XSUI_COIN_TYPE =
6
+ "0x2b6602099970374cf58a2a1b9d96f005fccceb81e92eb059873baf420eb6c717::x_sui::X_SUI"
7
+ const SUI_COIN_TYPE =
8
+ "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
9
+
10
+ async function loadInfo ( ) {
11
+ const obj = await sui . getObject ( XSUI_INFO_ID )
12
+ const totalSupply = BigInt (
13
+ obj . fields . lst_treasury_cap . fields . total_supply . fields . value ,
14
+ )
15
+ const stakedSui = BigInt (
16
+ obj . fields . storage . fields . total_sui_supply ,
17
+ ) ;
18
+ return { totalSupply, stakedSui }
19
+ }
20
+
21
+ async function tvl ( api ) {
22
+ const { stakedSui } = await loadInfo ( )
23
+
24
+ api . add ( SUI_COIN_TYPE , stakedSui )
25
+ }
26
+
27
+ module . exports = {
28
+ timetravel : false ,
29
+ methodology :
30
+ "Calculates the amount of SUI staked in xSUI liquid staking contracts." ,
31
+ sui : { tvl } ,
32
+ }
You can’t perform that action at this time.
0 commit comments