Skip to content

Commit 907b2df

Browse files
0xjoiHedy-chu
andauthored
feat(adapter): add xSUI liquid-staking TVL & staking adapter on Sui (DefiLlama#15360)
Co-authored-by: Hedy-chu <[email protected]>
1 parent ed79b40 commit 907b2df

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

projects/xsui/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

0 commit comments

Comments
 (0)