Skip to content

Commit

Permalink
subtract xalgo staking apr if borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
gidonkatten committed Jan 2, 2025
1 parent ff7901c commit 1d0a06b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lend/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ONE_12_DP,
ONE_16_DP,
ONE_4_DP,
SECONDS_IN_YEAR
SECONDS_IN_YEAR,
} from "../math-lib";
import { enc, fromIntToByteHex, getParsedValueFromState, parseUint64s, unixTime } from "../utils";

Expand Down Expand Up @@ -482,6 +482,13 @@ export function userLoanInfo(
netRate -= borrowBalanceValue * interestRate;
netYield -= borrowBalanceValue * interestYield;

// subtract xALGO staking apr if requested (must be mainnet)
if (assetId === MainnetPools.xALGO.assetId && xAlgoStakingRateBps) {
// multiply by 1e12 to standardise at 16 d.p.
netRate -= borrowBalanceValue * xAlgoStakingRateBps * ONE_12_DP;
netYield -= borrowBalanceValue * xAlgoStakingRateBps * ONE_12_DP;
}

borrows.push({
poolAppId,
assetId,
Expand Down

0 comments on commit 1d0a06b

Please sign in to comment.