From 23359106f74d895fd2082210550542295c2cee1c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Mar 2024 01:39:15 +0100 Subject: [PATCH] updates neutrino adapter --- projects/helper/chain/waves.js | 4 +++- projects/neutrino/index.js | 12 +++++++++--- projects/vires/index.js | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/helper/chain/waves.js b/projects/helper/chain/waves.js index 7671b2a03b2..6ba52b31a49 100644 --- a/projects/helper/chain/waves.js +++ b/projects/helper/chain/waves.js @@ -73,11 +73,13 @@ const tokenMapping = { 'HGgabTqUS8WtVFUJzfmrTDMgEccJuZLBPhFgQFxvnsoW': { cgId: 'usd-coin', decimals: 6 }, } -async function sumTokens({ owners, api, includeWaves = true, }) { +async function sumTokens({ owners, api, includeWaves = true, blacklistedTokens = [] }) { + blacklistedTokens = new Set(blacklistedTokens) await Promise.all( owners.map(async (owner) => { const { balances } = await get(API_HOST + `assets/balance/${owner}`); balances.forEach(({ assetId, balance }) => { + if (blacklistedTokens.has(assetId)) return; if (tokenMapping[assetId]) { const { cgId, decimals } = tokenMapping[assetId] api.addCGToken(cgId, balance / (10 ** decimals)) diff --git a/projects/neutrino/index.js b/projects/neutrino/index.js index 2efa357ff40..e9d538021fe 100644 --- a/projects/neutrino/index.js +++ b/projects/neutrino/index.js @@ -1,5 +1,11 @@ -const { wavesExport } = require('../helper/chain/wavesAdapter') +const { sumTokens } = require('../helper/chain/waves') -const endpoint = "/neutrino" -module.exports = wavesExport(endpoint, item => item.usdnLocked + item.defoLocked) \ No newline at end of file +module.exports = { + waves: { tvl } +} + +async function tvl(_, _b, _cb, { api, }) { + return sumTokens({ owners: ['3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo',], includeWaves: true, api, blacklistedTokens: ['DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p', '6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g'] }) + +} \ No newline at end of file diff --git a/projects/vires/index.js b/projects/vires/index.js index 61afd1f2f73..53df644167b 100644 --- a/projects/vires/index.js +++ b/projects/vires/index.js @@ -1,7 +1,5 @@ const { sumTokens, call } = require('../helper/chain/waves') -const endpoint = "/vires" - module.exports = { timetravel: false, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`,