diff --git a/src/apps/vector-finance/avalanche/vector-finance.farm.contract-position-fetcher.ts b/src/apps/vector-finance/avalanche/vector-finance.farm.contract-position-fetcher.ts index 5c53aa847..e09b08a51 100644 --- a/src/apps/vector-finance/avalanche/vector-finance.farm.contract-position-fetcher.ts +++ b/src/apps/vector-finance/avalanche/vector-finance.farm.contract-position-fetcher.ts @@ -27,7 +27,7 @@ import { VectorFinanceMasterChefContract } from '../contracts/viem/VectorFinance import { VectorFinanceMasterChefRewarderContract } from '../contracts/viem/VectorFinanceMasterChefRewarder'; @PositionTemplate() -export class VectorFinanceFarmContractPositionFetcher extends MasterChefV2TemplateContractPositionFetcher< +export class AvalancheVectorFinanceFarmContractPositionFetcher extends MasterChefV2TemplateContractPositionFetcher< VectorFinanceMasterChef, VectorFinanceMasterChefRewarder > { @@ -62,13 +62,12 @@ export class VectorFinanceFarmContractPositionFetcher extends MasterChefV2Templa const registeredToken = await contract.read.registeredToken([BigInt(poolIndex)]); const poolInfo = await contract.read.addressToPoolInfo([registeredToken]); - const _helper = this.contractFactory.vectorFinanceMasterChefPoolHelper({ + const helper = this.contractFactory.vectorFinanceMasterChefPoolHelper({ address: poolInfo[5], network: this.network, }); - const helper = multicall.wrap(_helper); - return helper.read.depositToken(); + return multicall.wrap(helper).read.depositToken(); } getRewardTokenAddress(contract: VectorFinanceMasterChefContract): Promise { diff --git a/src/apps/vector-finance/vector-finance.module.ts b/src/apps/vector-finance/vector-finance.module.ts index dd4fa4d7e..1a9fc4860 100644 --- a/src/apps/vector-finance/vector-finance.module.ts +++ b/src/apps/vector-finance/vector-finance.module.ts @@ -2,10 +2,10 @@ import { Module } from '@nestjs/common'; import { AbstractApp } from '~app/app.dynamic-module'; -import { VectorFinanceFarmContractPositionFetcher } from './avalanche/vector-finance.farm.contract-position-fetcher'; +import { AvalancheVectorFinanceFarmContractPositionFetcher } from './avalanche/vector-finance.farm.contract-position-fetcher'; import { VectorFinanceViemContractFactory } from './contracts'; @Module({ - providers: [VectorFinanceViemContractFactory, VectorFinanceFarmContractPositionFetcher], + providers: [VectorFinanceViemContractFactory, AvalancheVectorFinanceFarmContractPositionFetcher], }) export class VectorFinanceAppModule extends AbstractApp() {} diff --git a/src/position/template/master-chef-v2.template.contract-position-fetcher.ts b/src/position/template/master-chef-v2.template.contract-position-fetcher.ts index 94c4d6ce2..068715479 100644 --- a/src/position/template/master-chef-v2.template.contract-position-fetcher.ts +++ b/src/position/template/master-chef-v2.template.contract-position-fetcher.ts @@ -1,5 +1,6 @@ import { Inject } from '@nestjs/common'; -import { BigNumberish, Contract } from 'ethers'; +import { BigNumberish } from 'ethers'; +import { Abi, GetContractReturnType, PublicClient } from 'viem'; import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { ZERO_ADDRESS } from '~app-toolkit/constants/address'; @@ -17,7 +18,6 @@ import { MasterChefContractPositionDefinition, MasterChefTemplateContractPositionFetcher, } from './master-chef.template.contract-position-fetcher'; -import { Abi, GetContractReturnType, PublicClient } from 'viem'; export type MasterChefV2ContractPositionDataProps = MasterChefContractPositionDataProps & { extraRewarderAddress: string; diff --git a/src/position/template/master-chef.template.contract-position-fetcher.ts b/src/position/template/master-chef.template.contract-position-fetcher.ts index 0f0082f70..de507180f 100644 --- a/src/position/template/master-chef.template.contract-position-fetcher.ts +++ b/src/position/template/master-chef.template.contract-position-fetcher.ts @@ -1,5 +1,5 @@ import { Inject } from '@nestjs/common'; -import { BigNumber, BigNumberish, Contract } from 'ethers'; +import { BigNumber, BigNumberish } from 'ethers'; import { isArray, range, sum } from 'lodash'; import { Abi, GetContractReturnType, PublicClient } from 'viem'; @@ -7,7 +7,8 @@ import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { ZERO_ADDRESS } from '~app-toolkit/constants/address'; import { BLOCKS_PER_DAY } from '~app-toolkit/constants/blocks'; import { getImagesFromToken, getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present'; -import { IMulticallWrapper, ViemMulticallDataLoader } from '~multicall'; +import { ViemMulticallDataLoader } from '~multicall'; +import { isViemMulticallUnderlyingError } from '~multicall/errors'; import { isMulticallUnderlyingError } from '~multicall/impl/multicall.ethers'; import { MetaType } from '~position/position.interface'; import { isClaimable, isSupplied } from '~position/position.utils'; @@ -98,7 +99,7 @@ export abstract class MasterChefTemplateContractPositionFetcher< const stakedTokenAddress = await this.getStakedTokenAddress(contract, definition.poolIndex, multicall).catch( err => { - if (isMulticallUnderlyingError(err)) return null; + if (isViemMulticallUnderlyingError(err)) return null; throw err; }, );