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

feat: support zora #706

Merged
merged 4 commits into from
May 22, 2024
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 @@ -32,6 +32,7 @@ The best way to develop and test the API is to deploy your own instance to AWS.
# BNB = 56
# BASE = 8453
# BLAST = 81457
# ZORA = 7777777
TENDERLY_USER = '' # For enabling Tenderly simulations
TENDERLY_PROJECT = '' # For enabling Tenderly simulations
TENDERLY_ACCESS_KEY = '' # For enabling Tenderly simulations
Expand Down
40 changes: 22 additions & 18 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,44 +179,46 @@ export class RoutingAPIPipeline extends Stack {
// Load RPC provider URLs from AWS secret (for RPC Gateway)
const RPC_GATEWAY_PROVIDERS = [
// Optimism
'INFURA_10',
// 'INFURA_10',
'QUICKNODE_10',
'ALCHEMY_10',
// Polygon
'QUICKNODE_137',
'INFURA_137',
// 'INFURA_137',
'ALCHEMY_137',
// Celo
'QUICKNODE_42220',
'INFURA_42220',
// 'INFURA_42220',
// Avalanche
'INFURA_43114',
// 'INFURA_43114',
'QUICKNODE_43114',
'NIRVANA_43114',
// BNB
'QUICKNODE_56',
// Base
'QUICKNODE_8453',
'INFURA_8453',
// 'INFURA_8453',
'ALCHEMY_8453',
'NIRVANA_8453',
// Sepolia
'INFURA_11155111',
// 'INFURA_11155111',
'ALCHEMY_11155111',
// Arbitrum
'INFURA_42161',
// 'INFURA_42161',
'QUICKNODE_42161',
'NIRVANA_42161',
'ALCHEMY_42161',
// Ethereum
'INFURA_1',
// 'INFURA_1',
'QUICKNODE_1',
'NIRVANA_1',
'ALCHEMY_1',
'QUICKNODERETH_1',
// Blast
'QUICKNODE_81457',
'INFURA_81457',
// 'INFURA_81457',
// ZORA
'QUICKNODE_7777777',
]
for (const provider of RPC_GATEWAY_PROVIDERS) {
jsonRpcProviders[provider] = jsonRpcProvidersSecret.secretValueFromJson(provider).toString()
Expand Down Expand Up @@ -339,43 +341,45 @@ const jsonRpcProviders = {
WEB3_RPC_8453: process.env.WEB3_RPC_8453!,
// The followings are for RPC Gateway
// Optimism
INFURA_10: process.env.INFURA_10!,
// INFURA_10: process.env.INFURA_10!,
QUICKNODE_10: process.env.QUICKNODE_10!,
ALCHEMY_10: process.env.ALCHEMY_10!,
// Polygon
QUICKNODE_137: process.env.QUICKNODE_137!,
INFURA_137: process.env.INFURA_137!,
// INFURA_137: process.env.INFURA_137!,
ALCHEMY_137: process.env.ALCHEMY_137!,
// Celo
QUICKNODE_42220: process.env.QUICKNODE_42220!,
INFURA_42220: process.env.INFURA_42220!,
// INFURA_42220: process.env.INFURA_42220!,
// Avalanche
INFURA_43114: process.env.INFURA_43114!,
// INFURA_43114: process.env.INFURA_43114!,
QUICKNODE_43114: process.env.QUICKNODE_43114!,
NIRVANA_43114: process.env.NIRVANA_43114!,
// BNB
QUICKNODE_56: process.env.QUICKNODE_56!,
// Base
QUICKNODE_8453: process.env.QUICKNODE_8453!,
INFURA_8453: process.env.INFURA_8453!,
// INFURA_8453: process.env.INFURA_8453!,
ALCHEMY_8453: process.env.ALCHEMY_8453!,
NIRVANA_8453: process.env.NIRVANA_8453!,
// Sepolia
INFURA_11155111: process.env.INFURA_11155111!,
// INFURA_11155111: process.env.INFURA_11155111!,
ALCHEMY_11155111: process.env.ALCHEMY_11155111!,
// Arbitrum
INFURA_42161: process.env.INFURA_42161!,
// INFURA_42161: process.env.INFURA_42161!,
QUICKNODE_42161: process.env.QUICKNODE_42161!,
NIRVANA_42161: process.env.NIRVANA_42161!,
ALCHEMY_42161: process.env.ALCHEMY_42161!,
// Ethereum
INFURA_1: process.env.INFURA_1!,
// INFURA_1: process.env.INFURA_1!,
QUICKNODE_1: process.env.QUICKNODE_1!,
NIRVANA_1: process.env.NIRVANA_1!,
ALCHEMY_1: process.env.ALCHEMY_1!,
// Blast
QUICKNODE_81457: process.env.QUICKNODE_81457!,
INFURA_81457: process.env.INFURA_81457!,
// INFURA_81457: process.env.INFURA_81457!,
// Zora
QUICKNODE_7777777: process.env.QUICKNODE_7777777!,
}

// Local dev stack
Expand Down
2 changes: 1 addition & 1 deletion bin/stacks/routing-lambda-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class RoutingLambdaStack extends cdk.NestedStack {

description: 'Routing Lambda',
environment: {
VERSION: '20',
VERSION: '21',
NODE_OPTIONS: '--enable-source-maps',
POOL_CACHE_BUCKET: poolCacheBucket.bucketName,
POOL_CACHE_BUCKET_2: poolCacheBucket2.bucketName,
Expand Down
40 changes: 24 additions & 16 deletions lib/config/rpcProviderProdConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.1,
"healthCheckSampleProb": 0.1,
"providerInitialWeights": [1, 0],
"providerUrls": ["QUICKNODE_42220", "INFURA_42220"]
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_42220"]
},
{
"chainId": 43114,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.1,
"healthCheckSampleProb": 0.1,
"providerInitialWeights": [0, 1, 0],
"providerUrls": ["INFURA_43114", "QUICKNODE_43114", "NIRVANA_43114"]
"providerInitialWeights": [1, 0],
"providerUrls": ["QUICKNODE_43114", "NIRVANA_43114"]
},
{
"chainId": 56,
Expand All @@ -28,33 +28,33 @@
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.01,
"healthCheckSampleProb": 0.01,
"providerInitialWeights": [0, 1, 0],
"providerUrls": ["INFURA_10", "QUICKNODE_10", "ALCHEMY_10"]
"providerInitialWeights": [1, 0],
"providerUrls": ["QUICKNODE_10", "ALCHEMY_10"]
},
{
"chainId": 11155111,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.01,
"healthCheckSampleProb": 0.01,
"providerInitialWeights": [1, -1],
"providerUrls": ["ALCHEMY_11155111", "INFURA_11155111"],
"providerInitialWeights": [1],
"providerUrls": ["ALCHEMY_11155111"],
"enableDbSync": true
},
{
"chainId": 137,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.005,
"healthCheckSampleProb": 0.005,
"providerInitialWeights": [1, 0, 0],
"providerUrls": ["QUICKNODE_137", "INFURA_137", "ALCHEMY_137"]
"providerInitialWeights": [1, 0],
"providerUrls": ["QUICKNODE_137", "ALCHEMY_137"]
},
{
"chainId": 42161,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.002,
"healthCheckSampleProb": 0.002,
"providerInitialWeights": [0, 1, 0, 0],
"providerUrls": ["INFURA_42161", "QUICKNODE_42161", "NIRVANA_42161", "ALCHEMY_42161"]
"providerInitialWeights": [1, 0, 0],
"providerUrls": ["QUICKNODE_42161", "NIRVANA_42161", "ALCHEMY_42161"]
},
{
"chainId": 8453,
Expand All @@ -69,15 +69,23 @@
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.001,
"healthCheckSampleProb": 0.001,
"providerInitialWeights": [0, 0, 0, 1],
"providerUrls": ["INFURA_1", "ALCHEMY_1", "NIRVANA_1", "QUICKNODE_1"]
"providerInitialWeights": [0, 0, 1],
"providerUrls": ["ALCHEMY_1", "NIRVANA_1", "QUICKNODE_1"]
},
{
"chainId": 81457,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.001,
"healthCheckSampleProb": 0.001,
"providerInitialWeights": [1, 0],
"providerUrls": ["QUICKNODE_81457", "INFURA_81457"]
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_81457"]
},
{
"chainId": 7777777,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.001,
"healthCheckSampleProb": 0.001,
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_7777777"]
}
]
2 changes: 2 additions & 0 deletions lib/handlers/injector-sor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const SUPPORTED_CHAINS: ChainId[] = [
ChainId.AVALANCHE,
ChainId.BASE,
ChainId.BLAST,
ChainId.ZORA,
]
const DEFAULT_TOKEN_LIST = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org'

Expand Down Expand Up @@ -332,6 +333,7 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
case ChainId.CELO:
case ChainId.AVALANCHE:
case ChainId.BLAST:
case ChainId.ZORA:
const currentQuoteProvider = new OnChainQuoteProvider(
chainId,
provider,
Expand Down
3 changes: 3 additions & 0 deletions lib/rpc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ export function generateProviderUrl(key: string, value: string): string {
case 'QUICKNODE_81457': {
return `https://${tokens[0]}.blast-mainnet.quiknode.pro/${tokens[1]}`
}
case 'QUICKNODE_7777777': {
return `https://${tokens[0]}.zora-mainnet.quiknode.pro/${tokens[1]}`
}
// QuickNode RETH
case 'QUICKNODERETH_1': {
return `https://${tokens[0]}.quiknode.pro/${tokens[1]}`
Expand Down
Loading
Loading