From 7de94e16459991d3d881f333c2b0d3fabbade937 Mon Sep 17 00:00:00 2001 From: Yolley Date: Fri, 19 Jul 2024 17:21:17 +0300 Subject: [PATCH] return vesting tvl --- projects/streamflow/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js index 1c2ffeca4252..afa733b09467 100644 --- a/projects/streamflow/index.js +++ b/projects/streamflow/index.js @@ -20,7 +20,7 @@ async function getCachedApiRespnse() { return apiResponse; } -async function tvl(api) { +async function fetchData(api, key) { const tokenHoldings = await getCachedApiRespnse(); const chain = (chainMapping[api.chain] || api.chain).toUpperCase(); @@ -30,13 +30,21 @@ async function tvl(api) { for (const tokenHolding of tokenHoldings) { if (tokenHolding.chain === chain) { mints.push(tokenHolding.mint); - balances.push(tokenHolding.amount_locked); + balances.push(tokenHolding[key]); } } api.addTokens(mints, balances); } +async function tvl(api) { + await fetchData(api, "amount_locked_core"); +} + +async function vesting(api) { + await fetchData(api, "amount_locked_vested"); +} + module.exports = { methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d', timetravel: false, @@ -44,6 +52,6 @@ module.exports = { } chains.forEach((chain) => { module.exports[chain] = { - tvl + tvl, vesting }; });