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

Commit

Permalink
fix(dopex): Catch error for calling optionValue (#3065)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Nov 17, 2023
1 parent 499a86b commit 590183c
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -4,6 +4,7 @@ import { compact } from 'lodash';
import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator';
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { isViemMulticallUnderlyingError } from '~multicall/errors';
import { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher';
import {
DefaultAppTokenDataProps,
Expand Down Expand Up @@ -98,7 +99,11 @@ export class ArbitrumDopexSsovV3OptionTokenFetcher extends AppTokenTemplatePosit
}

async getPrice({ appToken, contract }: GetPriceParams<DopexOptionToken>): Promise<number> {
const optionValueRaw = await contract.read.optionValue();
const optionValueRaw = await contract.read.optionValue().catch(err => {
if (isViemMulticallUnderlyingError(err)) return BigInt(0);
throw err;
});

const optionValue = Number(optionValueRaw);

return optionValue !== 0 ? optionValue / 10 ** appToken.decimals : 0;
Expand Down

0 comments on commit 590183c

Please sign in to comment.