From c05d2b8c8525ab7e0862ff8b178eb32d0daf4b14 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Fri, 15 Mar 2024 06:59:53 +0800 Subject: [PATCH] feature: add StaPearl as collateral to tvl (#9363) --- projects/bucket-protocol/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index ad8ccc657d84..41a692608f81 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -3,8 +3,7 @@ const sui = require("../helper/chain/sui"); const MAINNET_PROTOCOL_ID = "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; -const BUCK = - ADDRESSES.sui.BUCK; +const BUCK = ADDRESSES.sui.BUCK; const USDC = ADDRESSES.sui.USDC; const USDT = ADDRESSES.sui.USDT; @@ -48,6 +47,9 @@ const BUCKETUS_PSM = const CETABLE_PSM = "0x6e94fe6910747a30e52addf446f2d7e844f69bf39eced6bed03441e01fa66acd"; +const STAPEARL_PSM = + "0x368b7301b499eded2949f9d0806254144ac368eb7173ec42c36b7db87e9af9a8"; + async function tvl(_, _1, _2, { api }) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, @@ -84,6 +86,9 @@ async function tvl(_, _1, _2, { api }) { const cetablePSMObj = await sui.getObject(CETABLE_PSM); const cetablePSMAmount = cetablePSMObj.fields.pool; + const stapearlPSMObj = await sui.getObject(STAPEARL_PSM); + const stapearlPSMAmount = stapearlPSMObj.fields.pool; + const bucketList = protocolFields.filter((item) => item.type.includes("Bucket") ); @@ -154,6 +159,11 @@ async function tvl(_, _1, _2, { api }) { api.add(USDC, Math.floor(halfCetableAmount)); api.add(USDT, Math.floor(halfCetableAmount)); + // 1 STAPEARL = 0.5 USDC + 0.5 USDT + const halfStapearlAmount = Math.floor(stapearlPSMAmount / 2); + api.add(USDC, Math.floor(halfStapearlAmount)); + api.add(USDT, Math.floor(halfStapearlAmount)); + const halfBucketusAmount = Math.floor(bucketusPSMAmount / 2); api.add(USDC, Math.floor(halfBucketusAmount / 1000));