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 30fae9e + 3147482 commit e7761e5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions chains/chainMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,14 @@ function ChainMonitor() {
const blockParams = await getBlockParams(restUrl, chain) || {}, { actualBlocksPerYear } = blockParams
const stakingParams = await getStakingParams(restUrl, chain) || {}, { bondedTokens } = stakingParams
const slashingParams = await getSlashingParams(restUrl, chain) || {}
let supplyParams = {}, aprParams = {}
let supplyParams = {}
if (denom) {
supplyParams = await getSupplyParams(restUrl, chain, bondedTokens) || {}
}
const mintParams = await getMintParams(restUrl, chain) || {}, { blocksPerYear } = mintParams
const distributionParams = await getDistributionParams(restUrl, chain) || {}, { communityTax } = distributionParams
const provisionParams = await getProvisionParams(restUrl, chain, supplyParams, blockParams) || {}, { annualProvision } = provisionParams
if(annualProvision && bondedTokens){
aprParams = await calculateApr(chain, annualProvision, bondedTokens, communityTax, blocksPerYear, actualBlocksPerYear) || {}
}
const aprParams = await calculateApr(chain, annualProvision, bondedTokens, communityTax, blocksPerYear, actualBlocksPerYear) || {}
const data = {
...current,
...authzParams,
Expand Down Expand Up @@ -282,7 +280,7 @@ function ChainMonitor() {
return {
calculatedApr: aprRequest.rate
}
} else {
} else if (annualProvision && bondedTokens){
const estimatedApr = (annualProvision / bondedTokens) * (1 - communityTax)
if (blocksPerYear) {
const calculatedApr = estimatedApr * (actualBlocksPerYear / blocksPerYear)
Expand Down

0 comments on commit e7761e5

Please sign in to comment.