Skip to content

Commit

Permalink
feature: add StaPearl as collateral to tvl (DefiLlama#9363)
Browse files Browse the repository at this point in the history
  • Loading branch information
crispyfisherman authored Mar 14, 2024
1 parent 8a64ae2 commit c05d2b8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions projects/bucket-protocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")
);
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit c05d2b8

Please sign in to comment.