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

Commit

Permalink
fix(balancer-v2): Filter out faulty reawrd address from Balancer-v2 f…
Browse files Browse the repository at this point in the history
…arm position (#2959)
  • Loading branch information
wpoulin committed Oct 1, 2023
1 parent 018e230 commit 06c9eae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -6,4 +6,6 @@ import { BalancerV2FarmContractPositionFetcher } from '../common/balancer-v2.far
export class BaseBalancerV2FarmContractPositionFetcher extends BalancerV2FarmContractPositionFetcher {
groupLabel = 'Staked';
subgraphUrl = 'https://api.studio.thegraph.com/query/24660/balancer-gauges-base/version/latest';

faultyRewardAddress = ['0x65226673f3d202e0f897c862590d7e1a992b2048'];
}
Expand Up @@ -42,6 +42,7 @@ export abstract class BalancerV2FarmContractPositionFetcher extends SingleStakin
}

abstract subgraphUrl: string;
faultyRewardAddress?: string[] = [];

getContract(address: string): BalancerGauge {
return this.contractFactory.balancerGauge({ address, network: this.network });
Expand All @@ -60,8 +61,11 @@ export abstract class BalancerV2FarmContractPositionFetcher extends SingleStakin
}

async getRewardTokenAddresses({ contract }: GetTokenDefinitionsParams<BalancerGauge>) {
const rewardTokenAddresses = await Promise.all(range(0, 4).map(async i => contract.reward_tokens(i)));
return rewardTokenAddresses.map(v => v.toLowerCase()).filter(v => v !== ZERO_ADDRESS);
const rewardTokenAddressesRaw = await Promise.all(range(0, 4).map(async i => contract.reward_tokens(i)));

const rewardTokenAddresses = rewardTokenAddressesRaw.map(v => v.toLowerCase()).filter(v => v !== ZERO_ADDRESS);

return rewardTokenAddresses.filter(x => !this.faultyRewardAddress?.includes(x));
}

async getRewardRates({ contract, contractPosition }: GetDataPropsParams<BalancerGauge, SingleStakingFarmDataProps>) {
Expand Down

0 comments on commit 06c9eae

Please sign in to comment.