Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typus/safu #11643

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
},
};
Loading