From 57f0ae77016678f9778c65bc7618c71bc72b07c5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:40:34 +0200 Subject: [PATCH] alex: turn on chain (#11265) --- projects/alexlab/api.js | 1 - projects/alexlab/index.js | 35 +++++------------------------------ 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/projects/alexlab/api.js b/projects/alexlab/api.js index 208b740e4081..539871663ad8 100644 --- a/projects/alexlab/api.js +++ b/projects/alexlab/api.js @@ -1,6 +1,5 @@ const { call } = require('../helper/chain/stacks-api') const { getCache, setCache } = require('../helper/cache') -const { transformDexBalances } = require('../helper/portedTokens') const { sleep } = require('../helper/utils') const sdk = require('@defillama/sdk') diff --git a/projects/alexlab/index.js b/projects/alexlab/index.js index 523b6f815f2e..a723011104df 100644 --- a/projects/alexlab/index.js +++ b/projects/alexlab/index.js @@ -4,41 +4,16 @@ const { get } = require('../helper/http') // https://stacks-node-api.blockstack.org/extended/v1/address/SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault/balances const ALEX_API = "https://api.alexlab.co/v1"; -async function fetch() { - const url = `${ALEX_API}/pool_token_stats`; - const alexStatsResponse = await get(url) - - const valueLockedMap = {}; - let totalValueLocked = 0; - for (const pool of alexStatsResponse) { - let poolValue = 0; - const poolToken = pool.pool_token; - - if (poolToken == "age000-governance-token") { - poolValue = pool.price * pool.reserved_balance; - } else { - poolValue = pool.price * pool.total_supply; - } - totalValueLocked += poolValue; - valueLockedMap[poolToken] = poolValue; - } - - return { tether: totalValueLocked }; -} - async function staking() { const url = `${ALEX_API}/stats/tvl`; const alexResponse = await get(url) return { tether: alexResponse.reserve_pool_value }; } +const { getExports } = require('../helper/heroku-api') -// node test.js projects/alexlab/index.js module.exports = { - misrepresentedTokens: true, timetravel: false, - stacks: { - tvl: fetch, - staking, - }, - methodology: "Alex Lab TVL is sum of tokens locked in ALEX platform.", -}; + ...getExports("alexlab", ['stacks']), +} + +module.exports.stacks.staking = staking