From e3d034f23cacac1e0e9bd0fc9834e81d1ae0cacc Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Fri, 17 May 2024 11:11:13 +0100 Subject: [PATCH 1/3] Replace dYdX APR API --- chains/chainMonitor.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/chains/chainMonitor.js b/chains/chainMonitor.js index ce9d384..6f74678 100644 --- a/chains/chainMonitor.js +++ b/chains/chainMonitor.js @@ -264,16 +264,10 @@ function ChainMonitor() { async function calculateApr(chain, annualProvision, bondedTokens, communityTax, blocksPerYear, actualBlocksPerYear) { const path = chain.path try { - 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(); + if (path === 'dydx') { + const aprRequest = await got.get("https://api.lacertalabs.xyz/data/stakingapr", gotOpts).json(); return { - calculatedApr: aprRequest[0]?.rewardRate + calculatedApr: aprRequest['0']?.average_stakingapr } } else if (path === 'sifchain') { const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json(); From ede30b8691e7276cf746944d852c8bf27f987cf7 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Fri, 17 May 2024 11:27:58 +0100 Subject: [PATCH 2/3] Convert dydx APR to bignumber --- chains/chainMonitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/chainMonitor.js b/chains/chainMonitor.js index 6f74678..ac6de5a 100644 --- a/chains/chainMonitor.js +++ b/chains/chainMonitor.js @@ -267,7 +267,7 @@ function ChainMonitor() { if (path === 'dydx') { const aprRequest = await got.get("https://api.lacertalabs.xyz/data/stakingapr", gotOpts).json(); return { - calculatedApr: aprRequest['0']?.average_stakingapr + calculatedApr: bignumber(aprRequest['0']?.average_stakingapr) } } else if (path === 'sifchain') { const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json(); From 635e8634ebc3f35c362da99cf50835342f5c4b4c Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Fri, 17 May 2024 11:36:03 +0100 Subject: [PATCH 3/3] Convert dydx APR to float --- chains/chainMonitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/chainMonitor.js b/chains/chainMonitor.js index ac6de5a..7c24bb5 100644 --- a/chains/chainMonitor.js +++ b/chains/chainMonitor.js @@ -267,7 +267,7 @@ function ChainMonitor() { if (path === 'dydx') { const aprRequest = await got.get("https://api.lacertalabs.xyz/data/stakingapr", gotOpts).json(); return { - calculatedApr: bignumber(aprRequest['0']?.average_stakingapr) + calculatedApr: parseFloat(aprRequest['0']?.average_stakingapr) } } else if (path === 'sifchain') { const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json();