From 8672e61749006ba3de0ea1ccdb30fb9aced90413 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 16 Jul 2024 09:57:01 +0100 Subject: [PATCH] Revert "Replace dYdX APR API" --- chains/chainMonitor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chains/chainMonitor.js b/chains/chainMonitor.js index 74c860f..8bc6b3b 100644 --- a/chains/chainMonitor.js +++ b/chains/chainMonitor.js @@ -265,10 +265,16 @@ function ChainMonitor() { async function calculateApr(chain, annualProvision, bondedTokens, communityTax, blocksPerYear, actualBlocksPerYear) { const path = chain.path try { - if (path === 'dydx') { - const aprRequest = await got.get("https://api.lacertalabs.xyz/data/stakingapr", gotOpts).json(); + if (path === 'dydx' && process.env.APYBARA_API_KEY) { + const opts = { + headers: { + 'X-ACCESS-KEY': `${process.env.APYBARA_API_KEY}` + }, + ...gotOpts + } + const aprRequest = await got.get("https://api.protocolstaking.info/v0/protocols/dydx", opts).json(); return { - calculatedApr: parseFloat(aprRequest['0']?.average_stakingapr) + calculatedApr: aprRequest[0]?.rewardRate } } else if (path === 'sifchain') { const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json();