From 944f07e947c6c697babf13af43ffbdc2f3f732f7 Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Tue, 9 Jan 2024 19:44:04 +0100 Subject: [PATCH] obsolete poolReloadPoolNestedTokens covered by syncAllPoolsFromSubgraph --- modules/pool/lib/pool-creator.service.ts | 38 ++---------------------- modules/pool/pool.gql | 1 - modules/pool/pool.resolvers.ts | 7 ----- modules/pool/pool.service.ts | 4 --- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/modules/pool/lib/pool-creator.service.ts b/modules/pool/lib/pool-creator.service.ts index 435e905d..a8bc5ca2 100644 --- a/modules/pool/lib/pool-creator.service.ts +++ b/modules/pool/lib/pool-creator.service.ts @@ -81,42 +81,6 @@ export class PoolCreatorService { return Array.from(poolIds); } - public async reloadPoolNestedTokens(poolId: string): Promise { - const subgraphPools = await this.balancerSubgraphService.getAllPools({}, false); - const poolToLoad = subgraphPools.find((pool) => pool.id === poolId); - - if (!poolToLoad) { - throw new Error('Pool with id does not exist'); - } - - const poolTokens = poolToLoad.tokens || []; - - for (let i = 0; i < poolTokens.length; i++) { - const token = poolTokens[i]; - - if (token.address === poolToLoad.address) { - continue; - } - - const nestedPool = subgraphPools.find((nestedPool) => { - const poolType = this.mapSubgraphPoolTypeToPoolType(nestedPool.poolType || ''); - - return ( - nestedPool.address === token.address && (poolType === 'LINEAR' || poolType === 'COMPOSABLE_STABLE') - ); - }); - - if (nestedPool) { - await prisma.prismaPoolToken.update({ - where: { id_chain: { id: token.id, chain: this.chain } }, - data: { nestedPoolId: nestedPool.id }, - }); - } - } - - await this.createAllTokensRelationshipForPool(poolId); - } - public async reloadAllTokenNestedPoolIds(): Promise { let operations: any[] = []; const pools = await prisma.prismaPool.findMany({ @@ -233,6 +197,8 @@ export class PoolCreatorService { }, }, }); + + await this.createAllTokensRelationshipForPool(pool.id); } public async createAllTokensRelationshipForPool(poolId: string): Promise { diff --git a/modules/pool/pool.gql b/modules/pool/pool.gql index dbb232c4..cc4cdf6c 100644 --- a/modules/pool/pool.gql +++ b/modules/pool/pool.gql @@ -48,7 +48,6 @@ extend type Mutation { poolUpdateLifetimeValuesForAllPools: String! poolInitializeSnapshotsForPool(poolId: String!): String! poolSyncPool(poolId: String!): String! - poolReloadPoolNestedTokens(poolId: String!): String! poolReloadAllTokenNestedPoolIds: String! poolSetPoolsWithPreferredGaugesAsIncentivized: String! poolBlackListAddPool(poolId: String!): String! diff --git a/modules/pool/pool.resolvers.ts b/modules/pool/pool.resolvers.ts index 7e3a452a..a85d8160 100644 --- a/modules/pool/pool.resolvers.ts +++ b/modules/pool/pool.resolvers.ts @@ -262,13 +262,6 @@ const balancerResolvers: Resolvers = { return 'success'; }, - poolReloadPoolNestedTokens: async (parent, { poolId }, context) => { - isAdminRoute(context); - - await poolService.reloadPoolNestedTokens(poolId); - - return 'success'; - }, poolReloadAllTokenNestedPoolIds: async (parent, {}, context) => { isAdminRoute(context); diff --git a/modules/pool/pool.service.ts b/modules/pool/pool.service.ts index ef90bb67..5f08a323 100644 --- a/modules/pool/pool.service.ts +++ b/modules/pool/pool.service.ts @@ -328,10 +328,6 @@ export class PoolService { await this.poolSnapshotService.createPoolSnapshotsForPoolsMissingSubgraphData(poolId); } - public async reloadPoolNestedTokens(poolId: string) { - await this.poolCreatorService.reloadPoolNestedTokens(poolId); - } - public async reloadAllTokenNestedPoolIds() { await this.poolCreatorService.reloadAllTokenNestedPoolIds(); }