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

Commit

Permalink
feat(stargate): Fix failing balances
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Aug 18, 2022
1 parent 0a1ed26 commit 5a388de
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -3,6 +3,7 @@ import { BigNumberish } from 'ethers';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
import { isMulticallUnderlyingError } from '~multicall/multicall.ethers';
import { MasterChefTemplateContractPositionFetcher } from '~position/template/master-chef.template.contract-position-fetcher';
import { Network } from '~types/network.interface';

Expand Down Expand Up @@ -60,6 +61,10 @@ export class OptimismStargateFarmContractPositionFetcher extends MasterChefTempl
}

async getRewardTokenBalance(address: string, contract: StargateChef, poolIndex: number): Promise<BigNumberish> {
return contract.pendingStargate(poolIndex, address);
// Optimism Stargate Farm in Emergency Withdraw Mode
return contract.pendingStargate(poolIndex, address).catch(err => {
if (isMulticallUnderlyingError(err)) return '0';
throw err;
});
}
}

0 comments on commit 5a388de

Please sign in to comment.