Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate blast v3/v4 subgraphs to new account #1031

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The best way to develop and test the API is to deploy your own instance to AWS.
TENDERLY_ACCESS_KEY = '' # For enabling Tenderly simulations
TENDERLY_NODE_API_KEY = '' # For enabling Tenderly node-level RPC access
ALCHEMY_QUERY_KEY = '' # For Alchemy subgraph query access
ALCHEMY_QUERY_KEY_2 = '' # For Alchemy subgraph query access
GQL_URL = '' # The GraphQL endpoint url, for Uniswap graphql query access
GQL_H_ORGN = '' # The GraphQL header origin, for Uniswap graphql query access
```
Expand Down
21 changes: 14 additions & 7 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class RoutingAPIStage extends Stage {
tenderlyNodeApiKey: string
unicornSecret: string
alchemyQueryKey?: string
decentralizedNetworkApiKey?: string
alchemyQueryKey2?: string
uniGraphQLEndpoint: string
uniGraphQLHeaderOrigin: string
}
Expand All @@ -61,7 +61,7 @@ export class RoutingAPIStage extends Stage {
tenderlyNodeApiKey,
unicornSecret,
alchemyQueryKey,
decentralizedNetworkApiKey,
alchemyQueryKey2,
uniGraphQLEndpoint,
uniGraphQLHeaderOrigin,
} = props
Expand All @@ -83,7 +83,7 @@ export class RoutingAPIStage extends Stage {
tenderlyNodeApiKey,
unicornSecret,
alchemyQueryKey,
decentralizedNetworkApiKey,
alchemyQueryKey2,
uniGraphQLEndpoint,
uniGraphQLHeaderOrigin,
})
Expand Down Expand Up @@ -178,6 +178,11 @@ export class RoutingAPIPipeline extends Stack {
secretCompleteArn: 'arn:aws:secretsmanager:us-east-2:644039819003:secret:RoutingApiNewSecrets-7EijpM',
})

// ALchemy subgraphs are split between two accounts, hence the two keys alchemy-query-key and alchemy-query-key-2
const alchemySubgraphSecret = sm.Secret.fromSecretAttributes(this, 'RoutingAlchemySubgraphSecret', {
secretCompleteArn: 'arn:aws:secretsmanager:us-east-2:644039819003:secret:RoutingAlchemySubgraphSecret-QKtgMX',
})

// Load RPC provider URLs from AWS secret
let jsonRpcProviders = {} as { [chainId: string]: string }
SUPPORTED_CHAINS.forEach((chainId: ChainId) => {
Expand Down Expand Up @@ -271,8 +276,8 @@ export class RoutingAPIPipeline extends Stack {
tenderlyAccessKey: tenderlyCreds.secretValueFromJson('tenderly-access-key').toString(),
tenderlyNodeApiKey: tenderlyCreds.secretValueFromJson('tenderly-node-api-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(),
alchemyQueryKey: alchemySubgraphSecret.secretValueFromJson('alchemy-query-key').toString(),
alchemyQueryKey2: alchemySubgraphSecret.secretValueFromJson('alchemy-query-key-2').toString(),
uniGraphQLEndpoint: routingApiNewSecrets.secretValueFromJson('uni-graphql-endpoint').toString(),
uniGraphQLHeaderOrigin: routingApiNewSecrets.secretValueFromJson('uni-graphql-header-origin').toString(),
})
Expand Down Expand Up @@ -300,8 +305,8 @@ export class RoutingAPIPipeline extends Stack {
tenderlyAccessKey: tenderlyCreds.secretValueFromJson('tenderly-access-key').toString(),
tenderlyNodeApiKey: tenderlyCreds.secretValueFromJson('tenderly-node-api-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(),
alchemyQueryKey: alchemySubgraphSecret.secretValueFromJson('alchemy-query-key').toString(),
alchemyQueryKey2: alchemySubgraphSecret.secretValueFromJson('alchemy-query-key-2').toString(),
uniGraphQLEndpoint: routingApiNewSecrets.secretValueFromJson('uni-graphql-endpoint').toString(),
uniGraphQLHeaderOrigin: routingApiNewSecrets.secretValueFromJson('uni-graphql-header-origin').toString(),
})
Expand Down Expand Up @@ -448,6 +453,8 @@ new RoutingAPIStack(app, 'RoutingAPIStack', {
unicornSecret: process.env.UNICORN_SECRET!,
uniGraphQLEndpoint: process.env.GQL_URL!,
uniGraphQLHeaderOrigin: process.env.GQL_H_ORGN!,
alchemyQueryKey: process.env.ALCHEMY_QUERY_KEY!,
alchemyQueryKey2: process.env.ALCHEMY_QUERY_KEY_2!,
})

new RoutingAPIPipeline(app, 'RoutingAPIPipelineStack', {
Expand Down
6 changes: 3 additions & 3 deletions bin/stacks/routing-api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class RoutingAPIStack extends cdk.Stack {
tenderlyNodeApiKey: string
unicornSecret: string
alchemyQueryKey?: string
decentralizedNetworkApiKey?: string
alchemyQueryKey2?: string
uniGraphQLEndpoint: string
uniGraphQLHeaderOrigin: string
}
Expand All @@ -73,7 +73,7 @@ export class RoutingAPIStack extends cdk.Stack {
tenderlyNodeApiKey,
unicornSecret,
alchemyQueryKey,
decentralizedNetworkApiKey,
alchemyQueryKey2,
uniGraphQLEndpoint,
uniGraphQLHeaderOrigin,
} = props
Expand All @@ -95,7 +95,7 @@ export class RoutingAPIStack extends cdk.Stack {
pinata_secret,
hosted_zone,
alchemyQueryKey,
decentralizedNetworkApiKey,
alchemyQueryKey2,
})

const {
Expand Down
11 changes: 5 additions & 6 deletions bin/stacks/routing-caching-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface RoutingCachingStackProps extends cdk.NestedStackProps {
hosted_zone?: string
chatbotSNSArn?: string
alchemyQueryKey?: string
decentralizedNetworkApiKey?: string
alchemyQueryKey2?: string
}

export class RoutingCachingStack extends cdk.NestedStack {
Expand All @@ -40,18 +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
public readonly alchemyQueryKey2: string | undefined = undefined

constructor(scope: Construct, name: string, props: RoutingCachingStackProps) {
super(scope, name, props)

const { chatbotSNSArn, alchemyQueryKey, decentralizedNetworkApiKey } = props
const { chatbotSNSArn, alchemyQueryKey, alchemyQueryKey2 } = props

const chatBotTopic = chatbotSNSArn ? aws_sns.Topic.fromTopicArn(this, 'ChatbotTopic', chatbotSNSArn) : undefined

this.alchemyQueryKey = alchemyQueryKey
this.decentralizedNetworkApiKey = decentralizedNetworkApiKey

this.alchemyQueryKey2 = alchemyQueryKey2
// 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')
this.poolCacheBucket2 = new aws_s3.Bucket(this, 'PoolCacheBucket2')
Expand Down Expand Up @@ -133,7 +132,7 @@ export class RoutingCachingStack extends cdk.NestedStack {
POOL_CACHE_BUCKET_3: this.poolCacheBucket3.bucketName,
POOL_CACHE_GZIP_KEY: this.poolCacheGzipKey,
ALCHEMY_QUERY_KEY: this.alchemyQueryKey ?? '',
DCN_API_KEY: this.decentralizedNetworkApiKey ?? '',
ALCHEMY_QUERY_KEY_2: this.alchemyQueryKey2 ?? '',
chainId: chainId.toString(),
protocol,
timeout: timeout.toString(),
Expand Down
4 changes: 2 additions & 2 deletions lib/cron/cache-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const v4SubgraphUrlOverride = (chainId: ChainId) => {
case ChainId.UNICHAIN:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v4-unichain-mainnet/api`
case ChainId.BLAST:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v4-blast/api`
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY_2}/uniswap-2/uniswap-v4-blast/api`
case ChainId.MAINNET:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v4-mainnet/api`
default:
Expand All @@ -46,7 +46,7 @@ export const v3SubgraphUrlOverride = (chainId: ChainId) => {
case ChainId.BNB:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-bsc-ii/api`
case ChainId.BLAST:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-blast/api`
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY_2}/uniswap-2/uniswap-v3-blast/api`
case ChainId.BASE:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-base/api`
case ChainId.CELO:
Expand Down
Loading