Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix poolsToIgnore filter by using pool id instead of address #559

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions balancer-js/src/lib/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export const BALANCER_NETWORK_CONFIG: Record<Network, BalancerNetworkConfig> = {
},
},
poolsToIgnore: [
'0xbd482ffb3e6e50dc1c437557c3bea2b68f3683ee', // a pool made by an external dev who was playing with a novel rate provider mechanism in production.
'0x0afbd58beca09545e4fb67772faf3858e610bcd0',
'0xf22ff21e17157340575158ad7394e068048dd98b',
'0xf71d0774b214c4cf51e33eb3d30ef98132e4dbaa',
'0xbd482ffb3e6e50dc1c437557c3bea2b68f3683ee0000000000000000000003c6', // a pool made by an external dev who was playing with a novel rate provider mechanism in production.
'0x0afbd58beca09545e4fb67772faf3858e610bcd00000000000000000000004b9',
'0xf22ff21e17157340575158ad7394e068048dd98b0000000000000000000004b8',
'0xf71d0774b214c4cf51e33eb3d30ef98132e4dbaa00000000000000000000046e',
],
sorConnectingTokens: [
{
Expand Down Expand Up @@ -118,8 +118,8 @@ export const BALANCER_NETWORK_CONFIG: Record<Network, BalancerNetworkConfig> = {
},
pools: {},
poolsToIgnore: [
'0x600bd01b6526611079e12e1ff93aba7a3e34226f', // This pool has rateProviders with incorrect scaling
'0xc31a37105b94ab4efca1954a14f059af11fcd9bb', // Stable pool with Convergence issues
'0x600bd01b6526611079e12e1ff93aba7a3e34226f0000000000000000000009e4', // This pool has rateProviders with incorrect scaling
'0xc31a37105b94ab4efca1954a14f059af11fcd9bb000000000000000000000455', // Stable pool with Convergence issues
],
sorConnectingTokens: [
{
Expand Down
2 changes: 1 addition & 1 deletion balancer-js/src/lib/constants/poolsToIgnore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const poolsToIgnore = [
export const POOLS_TO_IGNORE = [
'0x00c2a4be503869fa751c2dbcb7156cc970b5a8da000000000000000000000477',
'0x02d928e68d8f10c0358566152677db51e1e2dc8c00000000000000000000051e',
'0x04248aabca09e9a1a3d5129a7ba05b7f17de768400000000000000000000050e',
Expand Down
5 changes: 2 additions & 3 deletions balancer-js/src/modules/data/pool/subgraphOnChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { PoolAttribute, PoolsRepositoryFetchOptions } from './types';
import { Pool } from '@/types';
import { getOnChainBalances } from '../../../modules/sor/pool-data/onChainData3';
import { PoolsSubgraphRepository } from './subgraph';
import { isSameAddress } from '@/lib/utils';
import { Logger } from '@/lib/utils/logger';

interface PoolsSubgraphOnChainRepositoryOptions {
Expand Down Expand Up @@ -46,8 +45,8 @@ export class PoolsSubgraphOnChainRepository
const filteredPools = pools.filter((p) => {
if (p.swapEnabled === false) return false;
if (!this.poolsToIgnore) return true;
const index = this.poolsToIgnore.findIndex((addr) =>
isSameAddress(addr, p.address)
const index = this.poolsToIgnore.findIndex(
(id) => id.toLowerCase() === p.id.toLowerCase()
);
return index === -1;
});
Expand Down
4 changes: 2 additions & 2 deletions balancer-js/src/modules/pools/apr/apr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { BALANCER_NETWORK_CONFIG } from '@/lib/constants/config';
import { BigNumber } from '@ethersproject/bignumber';
import { Logger } from '@/lib/utils/logger';
import { GyroConfigRepository } from '@/modules/data/gyro-config/repository';
import { poolsToIgnore } from '@/lib/constants/poolsToIgnore';
import { POOLS_TO_IGNORE } from '@/lib/constants/poolsToIgnore';

export interface AprBreakdown {
swapFees: number;
Expand Down Expand Up @@ -412,7 +412,7 @@ export class PoolApr {
* @returns pool APR split [bsp]
*/
async apr(pool: Pool): Promise<AprBreakdown> {
if (poolsToIgnore.includes(pool.id)) {
if (POOLS_TO_IGNORE.includes(pool.id)) {
return {
swapFees: 0,
tokenAprs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const poolIds = [
'0xa2ccad543fbe9332b87910beabd941b86dd5f762000000000000000000000b5c', // V4
];

describe('ComposableStable - recovery', () => {
describe.skip('ComposableStable - recovery', () => {
before(async () => {
await forkSetup(
signer,
Expand Down
11 changes: 5 additions & 6 deletions balancer-js/src/modules/sor/sor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
} from '@/types';
import { SubgraphTokenPriceService } from './token-price/subgraphTokenPriceService';
import { getNetworkConfig } from '@/modules/sdk.helpers';
import { poolsToIgnore } from '@/lib/constants/poolsToIgnore';
import { getPoolAddress } from '@/pool-utils';
import { POOLS_TO_IGNORE } from '@/lib/constants/poolsToIgnore';

export class Sor extends SOR {
constructor(sdkConfig: BalancerSdkConfig) {
Expand Down Expand Up @@ -72,11 +71,11 @@ export class Sor extends SOR {
provider: Provider,
subgraphClient: SubgraphClient
) {
const poolsToIgnoreAddr = poolsToIgnore.map((id) => getPoolAddress(id));
// For SOR we want to ignore all configured pools (for Vault/Simulation we don't)
const allPoolsToIgnore = network.poolsToIgnore
? [...network.poolsToIgnore, ...poolsToIgnoreAddr]
: poolsToIgnoreAddr;
const allPoolsToIgnore = [
...(network.poolsToIgnore ?? []),
...POOLS_TO_IGNORE,
];
return typeof sorConfig.poolDataService === 'object'
? sorConfig.poolDataService
: new SubgraphPoolDataService(
Expand Down
Loading