Skip to content

Commit

Permalink
Merge pull request #83 from eco-stake/replace-dydx-apr-api
Browse files Browse the repository at this point in the history
Replace dYdX APR API
  • Loading branch information
tombeynon authored May 20, 2024
2 parents ce9bd96 + 635e863 commit 01b259b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions chains/chainMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,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: parseFloat(aprRequest['0']?.average_stakingapr)
}
} else if (path === 'sifchain') {
const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json();
Expand Down

0 comments on commit 01b259b

Please sign in to comment.