feat: add dew (#16874)

This commit is contained in:
Lee Hoe Mun
2025-11-11 21:57:35 +08:00
committed by GitHub
parent 14fbb0dd55
commit 71e45b26d6

29
projects/dew.js Normal file
View File

@@ -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
}
}