Skip to content

Commit 6a4e128

Browse files
authored
Add SpringSui (Ecosystem) (DefiLlama#12261)
1 parent f588262 commit 6a4e128

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

projects/springsui-ecosystem/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const sui = require('../helper/chain/sui')
2+
3+
const CREATE_EVENT_TYPE = '0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::events::Event<0xb0575765166030556a6eafd3b1b970eba8183ff748860680245b9edd41c716e7::liquid_staking::CreateEvent>';
4+
const EXCLUDE_POOL_IDS = [
5+
'0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b',
6+
]
7+
8+
async function tvl() {
9+
const poolIds = (await sui.queryEvents({
10+
eventType: CREATE_EVENT_TYPE,
11+
transform: (i) => i.event.liquid_staking_info_id,
12+
})).filter((id) => !EXCLUDE_POOL_IDS.includes(id));
13+
14+
let suiAmount = 0;
15+
for (const poolId of poolIds) {
16+
const pool = await sui.getObject(poolId);
17+
suiAmount += pool.fields.storage.fields.total_sui_supply / 10 ** 9
18+
}
19+
return {
20+
sui: suiAmount,
21+
}
22+
}
23+
24+
25+
module.exports = {
26+
methodology: "Calculates the amount of SUI staked in ecosystem SpringSui LSTs.",
27+
sui: {
28+
tvl,
29+
}
30+
}

0 commit comments

Comments
 (0)