Skip to content

Commit

Permalink
obsolete poolSync mutations
Browse files Browse the repository at this point in the history
covered by syncAllPools
  • Loading branch information
gmbronco committed Jan 9, 2024
1 parent 944f07e commit 14dcc83
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 68 deletions.
2 changes: 0 additions & 2 deletions modules/pool/pool.gql
Original file line number Diff line number Diff line change
Expand Up @@ -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!
}

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

0 comments on commit 14dcc83

Please sign in to comment.