Skip to content

Commit

Permalink
Merge pull request #1950 from galacticcouncil/adjust-apr
Browse files Browse the repository at this point in the history
Adjust APR
  • Loading branch information
vkulinich-cl authored Dec 11, 2024
2 parents d9b3226 + 273fc34 commit 261a0a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/farms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const getFarmsData =
yieldFarm,
},
price.oraclePrice ?? globalFarm.priceAdjustment.toBigNumber(),
isXyk,
balance.freeBalance,
)

Expand Down Expand Up @@ -416,6 +417,7 @@ function getFarmApr(
yieldFarm: PalletLiquidityMiningYieldFarmData
},
priceAdjustment: BigNumber,
isXyk: boolean,
potBalance?: string,
) {
const { globalFarm, yieldFarm } = farm
Expand Down Expand Up @@ -498,7 +500,7 @@ function getFarmApr(
const isDistributed = distributedRewards.div(potMaxRewards).gte(0.999)

// multiply by 100 since APR should be a percentage
apr = isDistributed ? BN_0 : apr.times(100)
apr = isDistributed ? BN_0 : apr.div(isXyk ? 2 : 1).times(100)

const minApr = loyaltyFactor ? apr.times(loyaltyFactor) : null

Expand Down

0 comments on commit 261a0a0

Please sign in to comment.