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

Commit

Permalink
fix(vector-finance): Fix failing deposit token call (#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich authored Nov 15, 2023
1 parent 510da9c commit 1d58ec9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
> {
Expand Down Expand Up @@ -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<string> {
Expand Down
4 changes: 2 additions & 2 deletions src/apps/vector-finance/vector-finance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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';

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';
Expand Down Expand Up @@ -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;
},
);
Expand Down

0 comments on commit 1d58ec9

Please sign in to comment.