From 9d6a1d6321fe33712f3c81b6b095d9939bd64f28 Mon Sep 17 00:00:00 2001 From: Andrey Minin Date: Thu, 4 Dec 2025 16:26:57 +0100 Subject: [PATCH 1/2] add placeholder for the AFLP vault tvl calculation --- projects/aftermath-fi-aflp/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/aftermath-fi-aflp/index.js diff --git a/projects/aftermath-fi-aflp/index.js b/projects/aftermath-fi-aflp/index.js new file mode 100644 index 00000000000..8277289f647 --- /dev/null +++ b/projects/aftermath-fi-aflp/index.js @@ -0,0 +1,22 @@ +const utils = require("../helper/utils"); + +const AFLP_VAULT_ID = + "0xb950819c5eba1bb5980f714f2a3b1d8738e3da58a4d9daf5fa21b6c2a7dd1e12"; + +async function tvl() { + const usdc = await utils.fetchURL( + `https://aftermath.finance/api/perpetuals/vaults/${AFLP_VAULT_ID}/tvl` + ); + + return { + usdc, + } +} + +module.exports = { + timetravel: false, + methodology: "Returns the TVL of the AFLP vault", + sui: { + tvl, + } +} From 7948ad71cce8e72d6550e6e4ce9c405adb10b461 Mon Sep 17 00:00:00 2001 From: Andrey Minin Date: Thu, 11 Dec 2025 14:03:08 +0100 Subject: [PATCH 2/2] afLP vault TVL fetch change to get on-chain value --- projects/aftermath-fi-aflp/index.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/projects/aftermath-fi-aflp/index.js b/projects/aftermath-fi-aflp/index.js index 8277289f647..d3f58374636 100644 --- a/projects/aftermath-fi-aflp/index.js +++ b/projects/aftermath-fi-aflp/index.js @@ -1,21 +1,22 @@ -const utils = require("../helper/utils"); +const sui = require("../helper/chain/sui"); +// Example type: 0x1331a181525bf7852423ca2022a7cfc524370244b7f7ba04ebeee387d315545e::vault::Vault< +// 0x365c418bca2846daf281b6d9a42182e1b4e266c6348166f5e935cfa97722918a::template::TEMPLATE, +// 0xcdd397f2cffb7f5d439f56fc01afe5585c5f06e3bcd2ee3a21753c566de313d9::usdc::USDC +// > const AFLP_VAULT_ID = "0xb950819c5eba1bb5980f714f2a3b1d8738e3da58a4d9daf5fa21b6c2a7dd1e12"; -async function tvl() { - const usdc = await utils.fetchURL( - `https://aftermath.finance/api/perpetuals/vaults/${AFLP_VAULT_ID}/tvl` - ); - - return { - usdc, - } +async function tvl(api) { + const vault = await sui.getObject(AFLP_VAULT_ID); + const types = vault.type.replace(">", "").split("<")[1]; + const collateralCoinType = types.split(", ")[1]; + const balance = vault.fields.total_deposited_collateral; + api.add(collateralCoinType, balance); } module.exports = { - timetravel: false, - methodology: "Returns the TVL of the AFLP vault", + methodology: "Returns the TVL of the afLP vault", sui: { tvl, }