Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/revert-83-replace-dydx-apr-api' …
Browse files Browse the repository at this point in the history
…into release-v0.5.18
  • Loading branch information
tombeynon committed Jul 16, 2024
2 parents 1d04531 + 8672e61 commit 85be37d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions chains/chainMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 85be37d

Please sign in to comment.