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 routing on worldchain and astrochain #853

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 8 additions & 8 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,26 +204,22 @@ export class RoutingAPIPipeline extends Stack {
// Avalanche
// 'INFURA_43114',
'QUICKNODE_43114',
'NIRVANA_43114',
// BNB
'QUICKNODE_56',
// Base
'QUICKNODE_8453',
// 'INFURA_8453',
'ALCHEMY_8453',
'NIRVANA_8453',
// Sepolia
// 'INFURA_11155111',
'ALCHEMY_11155111',
// Arbitrum
// 'INFURA_42161',
'QUICKNODE_42161',
'NIRVANA_42161',
'ALCHEMY_42161',
// Ethereum
// 'INFURA_1',
'QUICKNODE_1',
'NIRVANA_1',
'ALCHEMY_1',
'QUICKNODERETH_1',
// Blast
Expand All @@ -234,6 +230,10 @@ export class RoutingAPIPipeline extends Stack {
// ZkSync
'QUICKNODE_324',
'ALCHEMY_324',
// WorldChain,
'ALCHEMY_480',
jsy1218 marked this conversation as resolved.
Show resolved Hide resolved
// AstroChain Sepolia,
'QUICKNODE_1301',
// unirpc - serves all chains
'UNIRPC_0',
]
Expand Down Expand Up @@ -380,27 +380,23 @@ const jsonRpcProviders = {
// Avalanche
// 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!,
ALCHEMY_8453: process.env.ALCHEMY_8453!,
NIRVANA_8453: process.env.NIRVANA_8453!,
// Sepolia
// INFURA_11155111: process.env.INFURA_11155111!,
ALCHEMY_11155111: process.env.ALCHEMY_11155111!,
// Arbitrum
// 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!,
QUICKNODE_1: process.env.QUICKNODE_1!,
QUICKNODERETH_1: process.env.QUICKNODERETH_1!,
NIRVANA_1: process.env.NIRVANA_1!,
ALCHEMY_1: process.env.ALCHEMY_1!,
// Blast
QUICKNODE_81457: process.env.QUICKNODE_81457!,
Expand All @@ -410,6 +406,10 @@ const jsonRpcProviders = {
// ZkSync
QUICKNODE_324: process.env.QUICKNODE_324!,
ALCHEMY_324: process.env.ALCHEMY_324!,
// WorldChain,
ALCHEMY_480: process.env.ALCHEMY_480!,
// AstroChain Sepolia,
QUICKNODE_1301: process.env.QUICKNODE_1301!,
// unirpc - serves all chains
UNIRPC_0: process.env.UNIRPC_0!,
}
Expand Down
18 changes: 18 additions & 0 deletions lib/config/rpcProviderProdConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,23 @@
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_324"],
"providerNames": ["QUICKNODE"]
},
{
"chainId": 480,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.01,
"healthCheckSampleProb": 0.01,
"providerInitialWeights": [1],
"providerUrls": ["ALCHEMY_480"],
"providerNames": ["ALCHEMY"]
},
{
"chainId": 1301,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0.01,
"healthCheckSampleProb": 0.01,
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_1301"],
"providerNames": ["QUICKNODE"]
}
]
8 changes: 8 additions & 0 deletions lib/cron/cache-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export const v3SubgraphUrlOverride = (chainId: ChainId) => {
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-base/api`
case ChainId.CELO:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-celo/api`
case ChainId.WORLDCHAIN:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-worldchain/api`
case ChainId.ASTROCHAIN_SEPOLIA:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-astrochain-sepolia/api`
default:
return undefined
}
Expand All @@ -58,6 +62,10 @@ export const v2SubgraphUrlOverride = (chainId: ChainId) => {
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-blast/api`
case ChainId.BASE:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-base/api`
case ChainId.WORLDCHAIN:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-worldchain/api`
case ChainId.ASTROCHAIN_SEPOLIA:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-astrochain-sepolia/api`
default:
return undefined
}
Expand Down
3 changes: 3 additions & 0 deletions lib/dashboards/rpc-providers-widgets-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ const ID_TO_PROVIDER = (id: ChainId): string => {
case ChainId.CELO:
case ChainId.BNB:
case ChainId.BASE:
case ChainId.ASTROCHAIN_SEPOLIA:
return ProviderName.QUIKNODE
case ChainId.CELO_ALFAJORES:
return ProviderName.FORNO
case ChainId.WORLDCHAIN:
return ProviderName.ALCHEMY
default:
return ProviderName.UNKNOWN
}
Expand Down
6 changes: 6 additions & 0 deletions lib/graphql/graphql-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export class UniGraphQLProvider implements IUniGraphQLProvider {
return 'BLAST'
case ChainId.ZORA:
return 'ZORA'
case ChainId.ZKSYNC:
return 'ZKSYNC'
case ChainId.WORLDCHAIN:
return 'WORLDCHAIN'
case ChainId.ASTROCHAIN_SEPOLIA:
return 'ASTROCHAIN'
default:
throw new Error(`UniGraphQLProvider._chainIdToGraphQLChainName unsupported ChainId: ${chainId}`)
}
Expand Down
4 changes: 4 additions & 0 deletions lib/handlers/injector-sor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const SUPPORTED_CHAINS: ChainId[] = [
ChainId.BLAST,
ChainId.ZORA,
ChainId.ZKSYNC,
ChainId.WORLDCHAIN,
ChainId.ASTROCHAIN_SEPOLIA,
]
const DEFAULT_TOKEN_LIST = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org'

Expand Down Expand Up @@ -347,6 +349,8 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
case ChainId.BLAST:
case ChainId.ZORA:
case ChainId.ZKSYNC:
case ChainId.WORLDCHAIN:
case ChainId.ASTROCHAIN_SEPOLIA:
const currentQuoteProvider = new OnChainQuoteProvider(
chainId,
provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ export const QUOTE_PROVIDER_TRAFFIC_SWITCH_CONFIGURATION = (
switchExactOutPercentage: 100,
samplingExactOutPercentage: 0,
} as QuoteProviderTrafficSwitchConfiguration
// worldchain and astrochain sepolia don't have the view-only quoter yet, so we can shadow sample 0.1% of traffic
case ChainId.WORLDCHAIN:
case ChainId.ASTROCHAIN_SEPOLIA:
return {
switchExactInPercentage: 0.0,
samplingExactInPercentage: 0.1,
switchExactOutPercentage: 0.0,
samplingExactOutPercentage: 0.1,
} as QuoteProviderTrafficSwitchConfiguration
// If we accidentally switch a traffic, we have the protection to shadow sample only 0.1% of traffic
default:
return {
Expand Down
2 changes: 2 additions & 0 deletions lib/handlers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
}
case ChainId.BASE:
case ChainId.OPTIMISM:
case ChainId.WORLDCHAIN:
case ChainId.ASTROCHAIN_SEPOLIA:
return {
v2PoolSelection: {
topN: 3,
Expand Down
26 changes: 10 additions & 16 deletions lib/rpc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export function chainIdToNetworkName(networkId: ChainId): string {
return 'avalanchec'
case ChainId.BASE:
return 'base'
case ChainId.WORLDCHAIN:
return 'worldchain'
case ChainId.ASTROCHAIN_SEPOLIA:
return 'astrochain-sepolia'
default:
return 'ethereum'
}
Expand Down Expand Up @@ -60,22 +64,6 @@ export function generateProviderUrl(key: string, value: string, chainId: number)
case 'INFURA_81457': {
return `https://blast-mainnet.infura.io/v3/${tokens[0]}`
}
// Nirvana
case 'NIRVANA_43114': {
return `https://avax.nirvanalabs.xyz/${tokens[0]}/ext/bc/C/rpc?apikey=${tokens[1]}`
}
case 'NIRVANA_10': {
return `https://optimism.nirvanalabs.xyz/${tokens[0]}?apikey=${tokens[1]}`
}
case 'NIRVANA_8453': {
return `https://base.nirvanalabs.xyz/${tokens[0]}?apikey=${tokens[1]}`
}
case 'NIRVANA_42161': {
return `https://arb.nirvanalabs.xyz/${tokens[0]}?apikey=${tokens[1]}`
}
case 'NIRVANA_1': {
return `https://ethereum.nirvanalabs.xyz/${tokens[0]}?apikey=${tokens[1]}`
}
// Quicknode
case 'QUICKNODE_43114': {
return `https://${tokens[0]}.avalanche-mainnet.quiknode.pro/${tokens[1]}/ext/bc/C/rpc/`
Expand Down Expand Up @@ -110,6 +98,9 @@ export function generateProviderUrl(key: string, value: string, chainId: number)
case 'QUICKNODE_324': {
return `https://${tokens[0]}.zksync-mainnet.quiknode.pro/${tokens[1]}`
}
case 'QUICKNODE_1301': {
return `${tokens[0]}`
}
// QuickNode RETH
case 'QUICKNODERETH_1': {
return `https://${tokens[0]}.quiknode.pro/${tokens[1]}`
Expand All @@ -136,6 +127,9 @@ export function generateProviderUrl(key: string, value: string, chainId: number)
case 'ALCHEMY_324': {
return `https://zksync-mainnet.g.alchemy.com/v2/${tokens[0]}`
}
case 'ALCHEMY_480': {
return `https://worldchain-mainnet.g.alchemy.com/v2/${tokens[0]}`
}
}
throw new Error(`Unknown provider-chainId pair: ${key}`)
}
Expand Down
Loading
Loading