Skip to content

Commit

Permalink
fix: feesTier + campaign 0 APR format conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
asyx21 committed Dec 11, 2023
1 parent c61cd46 commit 964c6c1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/adaptors/smardex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const campaignRewardAPY = (
pair,
currentBlockNumber,
sdexPrice,
BLOCKS_PER_YEAR
BLOCKS_PER_YEAR,
STAKING_ADDRESS,
) => {
let apr = 0;
if (
Expand All @@ -227,7 +228,7 @@ const campaignRewardAPY = (

if (currentBlockNumber < reward.endBlock) {
const aprBN = reward.rewardPerBlock
.mul(parseInt(campaign.id, 10) === 0 ? 1 : WeiPerEther)
.mul(parseInt(campaign.id, 10) === 0 && STAKING_ADDRESS ? 1 : WeiPerEther)
.mul(BLOCKS_PER_YEAR)
.mul(100)
.div(campaign.totalStaked);
Expand Down Expand Up @@ -294,7 +295,7 @@ const topLvl = async (
dataNow = await utils.tvl(dataNow, chainString);
// calculate apy
dataNow = dataNow.map((el) =>
utils.apy({ ...el, feeTier: 500 }, dataPrior, dataPrior7d, version)
utils.apy({ ...el, feeTier: 9000 }, dataPrior, dataPrior7d, version)
);

const prices = (
Expand Down Expand Up @@ -325,7 +326,8 @@ const topLvl = async (
p,
block,
sdexPrice,
BLOCKS_PER_YEAR
BLOCKS_PER_YEAR,
STAKING_ADDRESS,
);

return {
Expand Down

0 comments on commit 964c6c1

Please sign in to comment.