Skip to content

Commit

Permalink
Typus/safu (#11643)
Browse files Browse the repository at this point in the history
Co-authored-by: g1ntoki <[email protected]>
  • Loading branch information
WayneAl and g1nt0ki committed Sep 16, 2024
1 parent 0915cf5 commit 6f469e1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 1 addition & 4 deletions projects/typus-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ const V1_SINGLE_DEPOSIT_VAULT_REGISTRY = "0x4ae62c4d67f9f5d7077626fcc6d450535c4d
const V1_SINGLE_BID_VAULT_REGISTRY = "0x2c8cdd00ced47e717420cd2fc54990b3b38e115e34a9209271063a59ddeeb059";

async function tvl(api) {
const depositVaultFields = await sui.getDynamicFieldObjects({
const depositVaults = await sui.getDynamicFieldObjects({
parent: SINGLE_DEPOSIT_VAULT_REGISTRY,
});

const depositVaultIds = depositVaultFields.map((item) => item.fields.id.id);
const depositVaults = await sui.getObjects(depositVaultIds);

depositVaults.forEach(({ fields }) => {
const deposit_token = "0x" + fields.deposit_token.fields.name;
const bid_token = "0x" + fields.bid_token.fields.name;
Expand Down
22 changes: 22 additions & 0 deletions projects/typus-safu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const sui = require("../helper/chain/sui");

const SAFU_REGISTRY = "0xdc970d638d1489385e49ddb76889748011bac4616b95a51aa63633972b841706";

async function tvl(api) {
const fields = await sui.getDynamicFieldObjects({
parent: SAFU_REGISTRY,
});
const safuVaults = fields.filter((item) => item.type.includes("Vault"));

safuVaults.forEach(({ fields }) => {
const deposit_token = "0x" + fields.deposit_token.fields.name;
api.add(deposit_token, fields.share_supply.slice(0, 4));
});
}

module.exports = {
timetravel: false,
sui: {
tvl,
},
};

0 comments on commit 6f469e1

Please sign in to comment.