Skip to content

Commit

Permalink
Add dYdX APR from Apybara
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Feb 12, 2024
1 parent 91cc2b8 commit 0d7a831
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 0d7a831

Please sign in to comment.