From 1ee767d58ee65556bb9eb554afd98de83df83145 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 25 Jan 2025 12:17:01 +0100 Subject: [PATCH] track metastable meth #13244 --- projects/helper/tokenMapping.js | 5 ++++- projects/metastable-musd/index.js | 17 +++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 9d12f1b101..fecd12976b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -86,7 +86,10 @@ const fixBalancesTokens = { swan: { [ADDRESSES.null]: { coingeckoId: 'swan-chain', decimals: 18 }, '0xBb4eC1b56cB624863298740Fd264ef2f910d5564': { coingeckoId: 'swan-chain', decimals: 18 }, - } + }, + sui: { + '0xf4530aa5ef8af33c497ec38f54ff9dd45fad9157264efae9693eb62faf8667b5::coin::COIN': { coingeckoId: 'dinero-staked-eth', decimals: 8 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/metastable-musd/index.js b/projects/metastable-musd/index.js index 24a3527e2d..9ce5ea9278 100644 --- a/projects/metastable-musd/index.js +++ b/projects/metastable-musd/index.js @@ -1,31 +1,36 @@ const sui = require("../helper/chain/sui"); const http = require('../helper/http'); -const { getEnv } = require('../helper/env') +const { getEnv } = require('../helper/env'); +const { sumTokens2 } = require("../helper/unwrapLPs"); const endpoint = () => getEnv('SUI_RPC') async function tvl(api) { - const vaultData = await sui.getObjects(["0xb950819c5eba1bb5980f714f2a3b1d8738e3da58a4d9daf5fa21b6c2a7dd1e12"]) + const vaultData = await sui.getObjects([ + "0xb950819c5eba1bb5980f714f2a3b1d8738e3da58a4d9daf5fa21b6c2a7dd1e12", + "0x2d6e81126336685a28ea0637109b570510f988bba2b589877c9b579d3cb8cad8", + ]) for (const { fields: { metadata, } } of vaultData) { const { result: { data: fields } - } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method: 'suix_getDynamicFields', params: [metadata.fields.id.id , null, 48], }) + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method: 'suix_getDynamicFields', params: [metadata.fields.id.id, null, 48], }) const fieldObjects = await sui.getDynamicFieldObjects({ - parent: metadata.fields.id.id + parent: metadata.fields.id.id }) let i = 0 for (const field of fields) { - + const coin = field.name.value.name const amount = fieldObjects[i].fields.balance - + api.add("0x" + coin, amount) i++ } } + return sumTokens2({ api }) } module.exports = {