Skip to content

Commit

Permalink
obsolete poolReloadPoolNestedTokens
Browse files Browse the repository at this point in the history
covered by syncAllPoolsFromSubgraph
  • Loading branch information
gmbronco committed Jan 9, 2024
1 parent 9420112 commit 944f07e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 48 deletions.
38 changes: 2 additions & 36 deletions modules/pool/lib/pool-creator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,42 +81,6 @@ export class PoolCreatorService {
return Array.from(poolIds);
}

public async reloadPoolNestedTokens(poolId: string): Promise<void> {
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<void> {
let operations: any[] = [];
const pools = await prisma.prismaPool.findMany({
Expand Down Expand Up @@ -233,6 +197,8 @@ export class PoolCreatorService {
},
},
});

await this.createAllTokensRelationshipForPool(pool.id);
}

public async createAllTokensRelationshipForPool(poolId: string): Promise<void> {
Expand Down
1 change: 0 additions & 1 deletion modules/pool/pool.gql
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
7 changes: 0 additions & 7 deletions modules/pool/pool.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 0 additions & 4 deletions modules/pool/pool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 944f07e

Please sign in to comment.