diff --git a/bin/app.ts b/bin/app.ts index 4632b78b1f..22e2b12d2e 100644 --- a/bin/app.ts +++ b/bin/app.ts @@ -37,6 +37,7 @@ export class RoutingAPIStage extends Stage { tenderlyAccessKey: string unicornSecret: string alchemyQueryKey?: string + decentralizedNetworkApiKey?: string } ) { super(scope, id, props) @@ -56,6 +57,7 @@ export class RoutingAPIStage extends Stage { tenderlyAccessKey, unicornSecret, alchemyQueryKey, + decentralizedNetworkApiKey, } = props const { url } = new RoutingAPIStack(this, 'RoutingAPI', { @@ -74,6 +76,7 @@ export class RoutingAPIStage extends Stage { tenderlyAccessKey, unicornSecret, alchemyQueryKey, + decentralizedNetworkApiKey, }) this.url = url } @@ -244,6 +247,7 @@ export class RoutingAPIPipeline extends Stack { tenderlyAccessKey: tenderlyCreds.secretValueFromJson('tenderly-access-key').toString(), unicornSecret: unicornSecrets.secretValueFromJson('debug-config-unicorn-key').toString(), alchemyQueryKey: routingApiNewSecrets.secretValueFromJson('alchemy-query-key').toString(), + decentralizedNetworkApiKey: routingApiNewSecrets.secretValueFromJson('decentralized-network-api-key').toString(), }) const betaUsEast2AppStage = pipeline.addStage(betaUsEast2Stage) @@ -268,6 +272,7 @@ export class RoutingAPIPipeline extends Stack { tenderlyAccessKey: tenderlyCreds.secretValueFromJson('tenderly-access-key').toString(), unicornSecret: unicornSecrets.secretValueFromJson('debug-config-unicorn-key').toString(), alchemyQueryKey: routingApiNewSecrets.secretValueFromJson('alchemy-query-key').toString(), + decentralizedNetworkApiKey: routingApiNewSecrets.secretValueFromJson('decentralized-network-api-key').toString(), }) const prodUsEast2AppStage = pipeline.addStage(prodUsEast2Stage) diff --git a/bin/stacks/routing-api-stack.ts b/bin/stacks/routing-api-stack.ts index 879ecd7632..293bb125b4 100644 --- a/bin/stacks/routing-api-stack.ts +++ b/bin/stacks/routing-api-stack.ts @@ -47,6 +47,7 @@ export class RoutingAPIStack extends cdk.Stack { tenderlyAccessKey: string unicornSecret: string alchemyQueryKey?: string + decentralizedNetworkApiKey?: string } ) { super(parent, name, props) @@ -68,6 +69,7 @@ export class RoutingAPIStack extends cdk.Stack { tenderlyAccessKey, unicornSecret, alchemyQueryKey, + decentralizedNetworkApiKey, } = props const { @@ -87,6 +89,7 @@ export class RoutingAPIStack extends cdk.Stack { pinata_secret, hosted_zone, alchemyQueryKey, + decentralizedNetworkApiKey, }) const { diff --git a/bin/stacks/routing-caching-stack.ts b/bin/stacks/routing-caching-stack.ts index 547ab6c322..d20c324fae 100644 --- a/bin/stacks/routing-caching-stack.ts +++ b/bin/stacks/routing-caching-stack.ts @@ -26,6 +26,7 @@ export interface RoutingCachingStackProps extends cdk.NestedStackProps { hosted_zone?: string chatbotSNSArn?: string alchemyQueryKey?: string + decentralizedNetworkApiKey?: string } export class RoutingCachingStack extends cdk.NestedStack { @@ -39,15 +40,17 @@ export class RoutingCachingStack extends cdk.NestedStack { public readonly ipfsCleanPoolCachingLambda: aws_lambda_nodejs.NodejsFunction public readonly poolCacheLambdaNameArray: string[] = [] public readonly alchemyQueryKey: string | undefined = undefined + public readonly decentralizedNetworkApiKey: string | undefined = undefined constructor(scope: Construct, name: string, props: RoutingCachingStackProps) { super(scope, name, props) - const { chatbotSNSArn, alchemyQueryKey } = props + const { chatbotSNSArn, alchemyQueryKey, decentralizedNetworkApiKey } = props const chatBotTopic = chatbotSNSArn ? aws_sns.Topic.fromTopicArn(this, 'ChatbotTopic', chatbotSNSArn) : undefined this.alchemyQueryKey = alchemyQueryKey + this.decentralizedNetworkApiKey = decentralizedNetworkApiKey // TODO: Remove and swap to the new bucket below. Kept around for the rollout, but all requests will go to bucket 2. this.poolCacheBucket = new aws_s3.Bucket(this, 'PoolCacheBucket') @@ -132,6 +135,7 @@ export class RoutingCachingStack extends cdk.NestedStack { POOL_CACHE_KEY: this.poolCacheKey, POOL_CACHE_GZIP_KEY: this.poolCacheGzipKey, ALCHEMY_QUERY_KEY: this.alchemyQueryKey ?? '', + DCN_API_KEY: this.decentralizedNetworkApiKey ?? '', chainId: chainId.toString(), protocol, timeout: timeout.toString(), diff --git a/lib/cron/cache-config.ts b/lib/cron/cache-config.ts index dfcf1cdb0b..1260a54a0e 100644 --- a/lib/cron/cache-config.ts +++ b/lib/cron/cache-config.ts @@ -29,6 +29,8 @@ const v3SubgraphUrlOverride = (chainId: ChainId) => { const v2SubgraphUrlOverride = (chainId: ChainId) => { switch (chainId) { + case ChainId.MAINNET: + return `https://gateway-arbitrum.network.thegraph.com/api/${process.env.DCN_API_KEY}/subgraphs/id/AHjUuKYZTVPNXGKp6c2NcL5hEQWDfvSSrqVDGwzosjVn` case ChainId.ARBITRUM_ONE: return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-arbitrum/api` case ChainId.POLYGON: @@ -196,7 +198,8 @@ export const chainProtocols = [ true, 1000, v2TrackedEthThreshold, - v2UntrackedUsdThreshold + v2UntrackedUsdThreshold, + v2SubgraphUrlOverride(ChainId.MAINNET) ), // 1000 is the largest page size supported by thegraph }, {