Skip to content

Commit

Permalink
track metastable meth #13244
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Jan 25, 2025
1 parent b7dab3c commit 1ee767d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] || {}) })
Expand Down
17 changes: 11 additions & 6 deletions projects/metastable-musd/index.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down

0 comments on commit 1ee767d

Please sign in to comment.