Skip to content

Commit

Permalink
fix: add sbrates for rewardingsAssetsAmount (#1687)
Browse files Browse the repository at this point in the history
  • Loading branch information
murka authored Jan 13, 2025
1 parent dba6645 commit 85fd906
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/adaptors/evaa-protocol/rewardApy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function getDistributions(endpoint = 'evaa.space') {
}
const isLeap = isLeapYear(new Date().getFullYear());
const totalSecsInYear = (isLeap ? 366 : 365) * 24 * 60 * 60;
const SCALE_FACTOR = BigInt(1e12);

function calcApy(
rewardAmount,
Expand Down Expand Up @@ -91,11 +92,11 @@ function calculateRewardApy(distributionsResp, pool, data, prices) {
}

const totalAmountSupply =
rewardingAssetData.totalSupply?.original ??
rewardingAssetData.totalSupply;
(rewardingAssetData.totalSupply * rewardingAssetData.sRate) /
SCALE_FACTOR;
const totalAmountBorrow =
rewardingAssetData.totalBorrow?.original ??
rewardingAssetData.totalBorrow;
(rewardingAssetData.totalBorrow * rewardingAssetData.bRate) /
SCALE_FACTOR;

const totalAmount =
rewardType === 'borrow' ? totalAmountBorrow : totalAmountSupply;
Expand Down

0 comments on commit 85fd906

Please sign in to comment.