From 14dcc83560c4dea6bc7046f205838d6b152ba890 Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Tue, 9 Jan 2024 20:12:12 +0100 Subject: [PATCH] obsolete poolSync mutations covered by syncAllPools --- modules/pool/pool.gql | 2 -- modules/pool/pool.resolvers.ts | 14 --------- modules/pool/pool.service.ts | 52 ---------------------------------- 3 files changed, 68 deletions(-) diff --git a/modules/pool/pool.gql b/modules/pool/pool.gql index cc4cdf6c..23e2d6fc 100644 --- a/modules/pool/pool.gql +++ b/modules/pool/pool.gql @@ -53,8 +53,6 @@ extend type Mutation { poolBlackListAddPool(poolId: String!): String! poolBlackListRemovePool(poolId: String!): String! poolDeletePool(poolId: String!): String! - poolSyncPriceRateProviders: String! - poolSyncProtocolYieldFeeExemptions: String! poolInitOnChainDataForAllPools: String! } diff --git a/modules/pool/pool.resolvers.ts b/modules/pool/pool.resolvers.ts index a85d8160..337a13e0 100644 --- a/modules/pool/pool.resolvers.ts +++ b/modules/pool/pool.resolvers.ts @@ -295,20 +295,6 @@ const balancerResolvers: Resolvers = { await poolService.deletePool(poolId); - return 'success'; - }, - poolSyncPriceRateProviders: async (parent, {}, context) => { - isAdminRoute(context); - - await poolService.syncPriceRateProvidersForAllPools(); - - return 'success'; - }, - poolSyncProtocolYieldFeeExemptions: async (parent, {}, context) => { - isAdminRoute(context); - - await poolService.syncProtocolYieldFeeExemptionsForAllPools(); - return 'success'; }, }, diff --git a/modules/pool/pool.service.ts b/modules/pool/pool.service.ts index 5f08a323..69ecdba5 100644 --- a/modules/pool/pool.service.ts +++ b/modules/pool/pool.service.ts @@ -336,58 +336,6 @@ export class PoolService { await this.poolSyncService.setPoolsWithPreferredGaugesAsIncentivized(); } - public async syncProtocolYieldFeeExemptionsForAllPools() { - const subgraphPools = await this.balancerSubgraphService.getAllPools({}, false); - for (const subgraphPool of subgraphPools) { - const poolTokens = subgraphPool.tokens || []; - for (let i = 0; i < poolTokens.length; i++) { - const token = poolTokens[i]; - try { - await prisma.prismaPoolToken.update({ - where: { id_chain: { id: token.id, chain: networkContext.chain } }, - data: { - exemptFromProtocolYieldFee: token.isExemptFromYieldProtocolFee - ? token.isExemptFromYieldProtocolFee - : false, - }, - }); - } catch (e) { - console.error('Failed to update token ', token.id, ' error is: ', e); - } - } - } - } - - public async syncPriceRateProvidersForAllPools() { - const subgraphPools = await this.balancerSubgraphService.getAllPools({}, false); - for (const subgraphPool of subgraphPools) { - if (!subgraphPool.priceRateProviders || !subgraphPool.priceRateProviders.length) continue; - - const poolTokens = subgraphPool.tokens || []; - for (let i = 0; i < poolTokens.length; i++) { - const token = poolTokens[i]; - - let priceRateProvider; - const data = subgraphPool.priceRateProviders.find( - (provider) => provider.token.address === token.address, - ); - priceRateProvider = data?.address; - if (!priceRateProvider) continue; - - try { - await prisma.prismaPoolToken.update({ - where: { id_chain: { id: token.id, chain: networkContext.chain } }, - data: { - priceRateProvider, - }, - }); - } catch (e) { - console.error('Failed to update token ', token.id, ' error is: ', e); - } - } - } - } - public async addToBlackList(poolId: string) { const category = await prisma.prismaPoolCategory.findFirst({ where: { poolId, chain: this.chain, category: 'BLACK_LISTED' },