Skip to content

Commit

Permalink
Merge branch 'dydx-apr' into release-v0.5.15
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Feb 12, 2024
2 parents a13a699 + 0d7a831 commit 30fae9e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion chains/chainMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,18 @@ function ChainMonitor() {
async function calculateApr(chain, annualProvision, bondedTokens, communityTax, blocksPerYear, actualBlocksPerYear) {
const path = chain.path
try {
if (path === 'sifchain') {
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: aprRequest[0]?.rewardRate
}
} else if (path === 'sifchain') {
const aprRequest = await got.get("https://data.sifchain.finance/beta/validator/stakingRewards", gotOpts).json();
return {
calculatedApr: aprRequest.rate
Expand Down

0 comments on commit 30fae9e

Please sign in to comment.