Skip to content

Commit

Permalink
return vesting tvl
Browse files Browse the repository at this point in the history
  • Loading branch information
Yolley committed Jul 19, 2024
1 parent 17be21b commit 7de94e1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions projects/streamflow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -30,20 +30,28 @@ 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,
misrepresentedTokens: false,
}
chains.forEach((chain) => {
module.exports[chain] = {
tvl
tvl, vesting
};
});

0 comments on commit 7de94e1

Please sign in to comment.