From cd42b3fae5d929222a627271b911013bbe3e6116 Mon Sep 17 00:00:00 2001 From: franz Date: Thu, 21 Dec 2023 20:56:00 +0100 Subject: [PATCH 1/5] exclude from coingecko --- modules/network/arbitrum.ts | 2 +- modules/network/mainnet.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/network/arbitrum.ts b/modules/network/arbitrum.ts index 3a34524b7..5430e02b0 100644 --- a/modules/network/arbitrum.ts +++ b/modules/network/arbitrum.ts @@ -50,7 +50,7 @@ const arbitrumNetworkData: NetworkData = { coingecko: { nativeAssetId: 'ethereum', platformId: 'arbitrum-one', - excludedTokenAddresses: [], + excludedTokenAddresses: ['0x6dbf2155b0636cb3fd5359fccefb8a2c02b6cb51'], // plsRDNT, has coingecko entry but no price }, tokenPrices: { maxHourlyPriceHistoryNumDays: 100, diff --git a/modules/network/mainnet.ts b/modules/network/mainnet.ts index fe2fd1676..4f3404c57 100644 --- a/modules/network/mainnet.ts +++ b/modules/network/mainnet.ts @@ -57,7 +57,10 @@ const data: NetworkData = { coingecko: { nativeAssetId: 'ethereum', platformId: 'ethereum', - excludedTokenAddresses: ['0xa43a7c62d56df036c187e1966c03e2799d8987ed'], // truMatic, has coingecko entry but no price + excludedTokenAddresses: [ + '0xa43a7c62d56df036c187e1966c03e2799d8987ed', // truMatic, has coingecko entry but no price + '0x93ef1ea305d11a9b2a3ebb9bb4fcc34695292e7d', // qETH, has coingecko entry but no price + ], }, tokenPrices: { maxHourlyPriceHistoryNumDays: 100, From a877fb17b88cfa43dc48d5ba06683424b3574ccb Mon Sep 17 00:00:00 2001 From: franz Date: Thu, 21 Dec 2023 21:14:04 +0100 Subject: [PATCH 2/5] exclude weeth from coingecko --- modules/network/mainnet.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/network/mainnet.ts b/modules/network/mainnet.ts index 5744db4a1..b2bfab90f 100644 --- a/modules/network/mainnet.ts +++ b/modules/network/mainnet.ts @@ -60,6 +60,7 @@ const data: NetworkData = { excludedTokenAddresses: [ '0xa43a7c62d56df036c187e1966c03e2799d8987ed', // truMatic, has coingecko entry but no price '0x93ef1ea305d11a9b2a3ebb9bb4fcc34695292e7d', // qETH, has coingecko entry but no price + '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee', // weEth, has coingekco entry but no price ], }, tokenPrices: { From fcff209a061f5798b5d15419f299ca2230154a0b Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:44:18 +0100 Subject: [PATCH 3/5] Update pool-onchain-gyro-fee.ts --- modules/pool/lib/pool-onchain-gyro-fee.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pool/lib/pool-onchain-gyro-fee.ts b/modules/pool/lib/pool-onchain-gyro-fee.ts index aef4b3c3d..55f5f0511 100644 --- a/modules/pool/lib/pool-onchain-gyro-fee.ts +++ b/modules/pool/lib/pool-onchain-gyro-fee.ts @@ -70,9 +70,9 @@ export const fetchOnChainGyroFees = async (pools: PoolInput[], gyroConfigAddress const results = (await multicaller.execute()) as OnchainGyroFees; const defaultFee = results.defaultFee ?? '0'; - const eclpFee = results.eclpFee ?? '0'; - const twoClpFee = results.twoClpFee ?? '0'; - const threeClpFee = results.threeClpFee ?? '0'; + const eclpFee = results.eclpFee ?? defaultFee; + const twoClpFee = results.twoClpFee ?? defaultFee; + const threeClpFee = results.threeClpFee ?? defaultFee; let parsed: { [address: string]: string } = {}; if (results.pools) { From 1f0ae929d7d10c9bbe1d5058934854aac0e02c29 Mon Sep 17 00:00:00 2001 From: franzns <93920061+franzns@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:15:30 +0100 Subject: [PATCH 4/5] removing sentry integrations (#35) --- app.ts | 6 +++--- worker/worker.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app.ts b/app.ts index 6151bbaff..2a4071599 100644 --- a/app.ts +++ b/app.ts @@ -31,9 +31,9 @@ async function startServer() { enabled: env.NODE_ENV === 'production', ignoreErrors: [/.*error: Provide.*chain.*param/], integrations: [ - new Sentry.Integrations.Apollo(), - new Sentry.Integrations.GraphQL(), - new Sentry.Integrations.Prisma({ client: prisma }), + // new Sentry.Integrations.Apollo(), + // new Sentry.Integrations.GraphQL(), + // new Sentry.Integrations.Prisma({ client: prisma }), new Sentry.Integrations.Express({ app }), new Sentry.Integrations.Http({ tracing: true }), new ProfilingIntegration(), diff --git a/worker/worker.ts b/worker/worker.ts index 375a8095a..9ef3cf5bb 100644 --- a/worker/worker.ts +++ b/worker/worker.ts @@ -13,10 +13,10 @@ export async function startWorker() { environment: `multichain-worker-${env.DEPLOYMENT_ENV}`, enabled: env.NODE_ENV === 'production', integrations: [ - new Sentry.Integrations.Apollo(), - new Sentry.Integrations.GraphQL(), - new Sentry.Integrations.Prisma({ client: prisma }), - new Sentry.Integrations.Express({ app }), + // new Sentry.Integrations.Apollo(), + // new Sentry.Integrations.GraphQL(), + // new Sentry.Integrations.Prisma({ client: prisma }), + // new Sentry.Integrations.Express({ app }), new Sentry.Integrations.Http({ tracing: true }), new ProfilingIntegration(), ], From 9d8e6c5d373f0b84e583ede19753ef894b71891c Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Fri, 12 Jan 2024 21:39:54 +0100 Subject: [PATCH 5/5] use raw query to delete old token prices --- modules/token/lib/token-price.service.ts | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/modules/token/lib/token-price.service.ts b/modules/token/lib/token-price.service.ts index 9b51277fb..72c662013 100644 --- a/modules/token/lib/token-price.service.ts +++ b/modules/token/lib/token-price.service.ts @@ -256,28 +256,10 @@ export class TokenPriceService { } public async purgeOldTokenPricesForAllChains(): Promise { - const purgeBeforeTimestamp = moment().startOf('day').subtract(100, 'days').utc().unix(); - const oldPrices = await prisma.prismaTokenPrice.findMany({ - where: { - timestamp: { lt: purgeBeforeTimestamp }, - }, - }); - - // returns all non midnight prices - const tobeDeleted = _.uniq(oldPrices.filter((tokenPrice) => tokenPrice.timestamp % secondsPerDay !== 0)); - - //apparently prisma has a limitation on delete - const chunks = _.chunk(tobeDeleted, 1000); - - for (const chunk of chunks) { - await prisma.prismaTokenPrice.deleteMany({ - where: { - timestamp: { in: chunk.map((tokenPrice) => tokenPrice.timestamp) }, - }, - }); - } + const deleted = + await prisma.$executeRaw`DELETE FROM "PrismaTokenPrice" WHERE DATE(to_timestamp(timestamp)) != to_timestamp(timestamp) AND to_timestamp(timestamp) < CURRENT_DATE - INTERVAL '100 days'`; - return tobeDeleted.length; + return deleted; } private async updateCandleStickData() {