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

Commit

Permalink
fix(trader-joe): Fix reward balances (#3022)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoulin authored Nov 7, 2023
1 parent 7e768ac commit 531d503
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,26 @@ export class AvalancheTraderJoeChefV2FarmContractPositionFetcher extends MasterC
contract,
contractPosition,
}: GetMasterChefTokenBalancesParams<TraderJoeChefV2>) {
return contract.pendingTokens(contractPosition.dataProps.poolIndex, address).then(v => v.pendingJoe);
return contract
.pendingTokens(contractPosition.dataProps.poolIndex, address)
.then(v => v.pendingJoe)
.catch(e => {
if (isMulticallUnderlyingError(e)) return 0;
throw e;
});
}

async getExtraRewardTokenBalances({
address,
contract,
contractPosition,
}: GetMasterChefV2ExtraRewardTokenBalancesParams<TraderJoeChefV2, TraderJoeChefV2Rewarder>) {
return contract.pendingTokens(contractPosition.dataProps.poolIndex, address).then(v => v.pendingBonusToken);
return contract
.pendingTokens(contractPosition.dataProps.poolIndex, address)
.then(v => v.pendingBonusToken)
.catch(e => {
if (isMulticallUnderlyingError(e)) return 0;
throw e;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,26 @@ export class AvalancheTraderJoeChefV3FarmContractPositionFetcher extends MasterC
contract,
contractPosition,
}: GetMasterChefTokenBalancesParams<TraderJoeChefV3>) {
return contract.pendingTokens(contractPosition.dataProps.poolIndex, address).then(v => v.pendingJoe);
return contract
.pendingTokens(contractPosition.dataProps.poolIndex, address)
.then(v => v.pendingJoe)
.catch(e => {
if (isMulticallUnderlyingError(e)) return 0;
throw e;
});
}

async getExtraRewardTokenBalances({
address,
contract,
contractPosition,
}: GetMasterChefV2ExtraRewardTokenBalancesParams<TraderJoeChefV3, TraderJoeChefV2Rewarder>) {
return contract.pendingTokens(contractPosition.dataProps.poolIndex, address).then(v => v.pendingBonusToken);
return contract
.pendingTokens(contractPosition.dataProps.poolIndex, address)
.then(v => v.pendingBonusToken)
.catch(e => {
if (isMulticallUnderlyingError(e)) return 0;
throw e;
});
}
}

0 comments on commit 531d503

Please sign in to comment.