Skip to content

Commit

Permalink
coingecko id override
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Feb 29, 2024
1 parent f60477f commit 0155a39
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 58 deletions.
4 changes: 0 additions & 4 deletions modules/network/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,6 @@ export const arbitrumNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ export const avalancheNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ export const baseNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/fantom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@ export const fantomNetworkConfig: NetworkConfig = {
name: 'sync-latest-reliquary-snapshots',
interval: every(1, 'hours'),
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,6 @@ export const gnosisNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,6 @@ export const mainnetNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,6 @@ export const optimismNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 0 additions & 4 deletions modules/network/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ export const polygonNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
4 changes: 4 additions & 0 deletions modules/network/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,9 @@ export const sepoliaNetworkConfig: NetworkConfig = {
name: 'supdate-swaps-volume-and-fees-v3',
interval: every(20, 'minutes'),
},
{
name: 'sync-global-coingecko-prices',
interval: every(12, 'hours'),
},
],
};
11 changes: 3 additions & 8 deletions modules/network/zkevm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ const zkevmNetworkData: NetworkData = {
platformId: 'polygon-zkevm',
excludedTokenAddresses: [],
},
rpcUrl:
env.GROVE_CITY
rpcUrl: env.GROVE_CITY
? `https://polygon-zkevm-mainnet.rpc.grove.city/v1/${env.GROVE_CITY}`
: env.ALCHEMY_API_KEY && (env.DEPLOYMENT_ENV as DeploymentEnv) === 'main'
? `https://polygonzkevm-mainnet.g.alchemy.com/v2/${env.ALCHEMY_API_KEY}`
: 'https://zkevm-rpc.com',
? `https://polygonzkevm-mainnet.g.alchemy.com/v2/${env.ALCHEMY_API_KEY}`
: 'https://zkevm-rpc.com',
rpcMaxBlockRange: 2000,
protocolToken: 'bal',
bal: {
Expand Down Expand Up @@ -275,10 +274,6 @@ export const zkevmNetworkConfig: NetworkConfig = {
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1,
},
{
name: 'sync-coingecko-coinids',
interval: every(2, 'hours'),
},
{
name: 'update-fee-volume-yield-all-pools',
interval: every(1, 'hours'),
Expand Down
20 changes: 9 additions & 11 deletions modules/token/lib/coingecko-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,15 @@ export class CoingeckoDataService {
}
});

if (coinId && token.coingeckoTokenId !== coinId.id) {
await prisma.prismaToken.update({
where: {
address_chain: { address: token.address, chain: networkContext.chain },
},
data: {
coingeckoTokenId: coinId.id,
coingeckoPlatformId: networkContext.data.coingecko.platformId,
},
});
}
await prisma.prismaToken.update({
where: {
address_chain: { address: token.address, chain: networkContext.chain },
},
data: {
coingeckoTokenId: coinId ? coinId.id : null,
coingeckoPlatformId: networkContext.data.coingecko.platformId,
},
});
}
}

Expand Down
6 changes: 2 additions & 4 deletions modules/token/token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export class TokenService {
}

public async syncTokenContentData() {
//sync coingecko Ids first, then override Ids from the content service
await this.coingeckoDataService.syncCoingeckoIds();
await networkContext.config.contentService.syncTokenContentData();
}

Expand Down Expand Up @@ -137,10 +139,6 @@ export class TokenService {
await this.coingeckoDataService.syncCoingeckoPricesForAllChains();
}

public async syncCoingeckoIds(): Promise<void> {
await this.coingeckoDataService.syncCoingeckoIds();
}

public async getTokenDynamicData(tokenAddress: string, chain: Chain): Promise<PrismaTokenDynamicData | null> {
const token = await prisma.prismaToken.findUnique({
where: {
Expand Down
3 changes: 0 additions & 3 deletions worker/job-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,6 @@ export function configureWorkerRoutes(app: Express) {
next,
);
break;
case 'sync-coingecko-coinids':
await runIfNotAlreadyRunning(job.name, chainId, () => tokenService.syncCoingeckoIds(), res, next);
break;
case 'update-fee-volume-yield-all-pools':
await runIfNotAlreadyRunning(
job.name,
Expand Down

0 comments on commit 0155a39

Please sign in to comment.