From a1a571cd47483e9c5d5d1a391d3e798ad1ccb65a Mon Sep 17 00:00:00 2001 From: leehoemun Date: Wed, 29 Oct 2025 13:15:41 +0800 Subject: [PATCH] feat: add dew --- projects/dew.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/dew.js diff --git a/projects/dew.js b/projects/dew.js new file mode 100644 index 00000000000..6ae56b5dac7 --- /dev/null +++ b/projects/dew.js @@ -0,0 +1,29 @@ +const { sumSingleBalance, call } = require('./helper/chain/near') + +const VAULT_CONTRACT = "dew-rneardefi-vault.near" + +async function tvl() { + const balances = {} + + const totalShares = await call(VAULT_CONTRACT, 'ft_total_supply', {}) + const exchangeRateScale = await call(VAULT_CONTRACT, 'get_exchange_rate_scale', {}) + const rNearExchangeRate = await call(VAULT_CONTRACT, 'get_exchange_rate', { + asset: { + FungibleToken: { + contract_id: "lst.rhealab.near" + } + } + }) + + const rNearSupplied = BigInt(totalShares) * BigInt(rNearExchangeRate) / BigInt(exchangeRateScale) + + sumSingleBalance(balances, "lst.rhealab.near", rNearSupplied) + + return balances +} + +module.exports = { + near: { + tvl: tvl + } +} \ No newline at end of file