Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(aura): Add reward multiplier to the equation computing claimable…
Browse files Browse the repository at this point in the history
… aura on farms
  • Loading branch information
wpoulin committed Sep 27, 2023
1 parent a5ee5b4 commit e031844
Show file tree
Hide file tree
Showing 9 changed files with 3,921 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/apps/aura/common/aura.farm.contract-position-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export const claimedBalToMintedAura = (claimedBalAmount: string, currentAuraSupp
};

export abstract class AuraFarmContractPositionFetcher extends SingleStakingFarmDynamicTemplateContractPositionFetcher<AuraBaseRewardPool> {
abstract boosterMultiplierAddress: string;

constructor(
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit,
@Inject(AuraContractFactory)
Expand Down Expand Up @@ -168,7 +170,18 @@ export abstract class AuraFarmContractPositionFetcher extends SingleStakingFarmD

const balBalanceBN = await contract.earned(address);
const balBalanceRaw = balBalanceBN.toString();
let auraBalanceRaw = claimedBalToMintedAura(balBalanceRaw, currentAuraSupply.toString());
const auraBalanceMintedRaw = claimedBalToMintedAura(balBalanceRaw, currentAuraSupply.toString());
const boosterMultiplierContract = this.contractFactory.auraBoosterV2({
address: this.boosterMultiplierAddress,
network: this.network,
});

const [rewardMultiplierDenominator, rewardMultipleRaw] = await Promise.all([
multicall.wrap(boosterMultiplierContract).REWARD_MULTIPLIER_DENOMINATOR(),
multicall.wrap(boosterMultiplierContract).getRewardMultipliers(contractPosition.address),
]);

let auraBalanceRaw = auraBalanceMintedRaw.mul(rewardMultipleRaw).div(rewardMultiplierDenominator);

const numExtraRewards = await multicall.wrap(contract).extraRewardsLength();
const extraRewardBalances = await Promise.all(
Expand Down
Loading

0 comments on commit e031844

Please sign in to comment.