Skip to content

Commit

Permalink
feat: support monad testnet + base sepolia (#961)
Browse files Browse the repository at this point in the history
* feat: support monad testnet + base sepolia

* qn sepolia url

* base sepolia use unirpc

* sor 4.14.0

* prepare monad subgraph entry

* enable subgraph with fallback
  • Loading branch information
xrsv authored Jan 14, 2025
1 parent 44850c5 commit 6d42def
Show file tree
Hide file tree
Showing 19 changed files with 317 additions and 124 deletions.
4 changes: 2 additions & 2 deletions bin/stacks/routing-lambda-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class RoutingLambdaStack extends cdk.NestedStack {

description: 'Caching Routing Lambda',
environment: {
VERSION: '1',
VERSION: '2',
NODE_OPTIONS: '--enable-source-maps',
POOL_CACHE_BUCKET: poolCacheBucket.bucketName,
POOL_CACHE_BUCKET_3: poolCacheBucket3.bucketName,
Expand Down Expand Up @@ -186,7 +186,7 @@ export class RoutingLambdaStack extends cdk.NestedStack {

description: 'Routing Lambda',
environment: {
VERSION: '28',
VERSION: '29',
NODE_OPTIONS: '--enable-source-maps',
POOL_CACHE_BUCKET: poolCacheBucket.bucketName,
POOL_CACHE_BUCKET_3: poolCacheBucket3.bucketName,
Expand Down
18 changes: 18 additions & 0 deletions lib/config/rpcProviderProdConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,23 @@
"providerInitialWeights": [1],
"providerUrls": ["QUICKNODE_1301"],
"providerNames": ["QUICKNODE"]
},
{
"chainId": 10143,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0,
"healthCheckSampleProb": 0,
"providerInitialWeights": [1],
"providerUrls": ["UNIRPC_0"],
"providerNames": ["UNIRPC"]
},
{
"chainId": 84532,
"useMultiProviderProb": 1,
"latencyEvaluationSampleProb": 0,
"healthCheckSampleProb": 0,
"providerInitialWeights": [1],
"providerUrls": ["UNIRPC_0"],
"providerNames": ["UNIRPC"]
}
]
17 changes: 17 additions & 0 deletions lib/cron/cache-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export const v2SubgraphUrlOverride = (chainId: ChainId) => {
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-worldchain/api`
case ChainId.UNICHAIN_SEPOLIA:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-astrochain-sepolia/api`
case ChainId.MONAD_TESTNET:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-monad-testnet/api`
default:
return undefined
}
Expand Down Expand Up @@ -331,6 +333,21 @@ export const chainProtocols = [
v2SubgraphUrlOverride(ChainId.BLAST)
),
},
{
protocol: Protocol.V2,
chainId: ChainId.MONAD_TESTNET,
timeout: 90000,
provider: new V2SubgraphProvider(
ChainId.MONAD_TESTNET,
3,
90000,
true,
1000,
v2TrackedEthThreshold,
v2UntrackedUsdThreshold,
v2SubgraphUrlOverride(ChainId.MONAD_TESTNET)
),
},
{
protocol: Protocol.V4,
chainId: ChainId.SEPOLIA,
Expand Down
2 changes: 2 additions & 0 deletions lib/dashboards/rpc-providers-widgets-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const ID_TO_PROVIDER = (id: ChainId): string => {
case ChainId.CELO:
case ChainId.BNB:
case ChainId.BASE:
case ChainId.BASE_SEPOLIA:
case ChainId.UNICHAIN_SEPOLIA:
case ChainId.MONAD_TESTNET:
return ProviderName.QUIKNODE
case ChainId.CELO_ALFAJORES:
return ProviderName.FORNO
Expand Down
4 changes: 4 additions & 0 deletions lib/graphql/graphql-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class UniGraphQLProvider implements IUniGraphQLProvider {
return 'BNB'
case ChainId.BASE:
return 'BASE'
case ChainId.BASE_SEPOLIA:
return 'BASE_SEPOLIA'
case ChainId.BLAST:
return 'BLAST'
case ChainId.ZORA:
Expand All @@ -61,6 +63,8 @@ export class UniGraphQLProvider implements IUniGraphQLProvider {
return 'WORLDCHAIN'
case ChainId.UNICHAIN_SEPOLIA:
return 'UNICHAIN_SEPOLIA'
case ChainId.MONAD_TESTNET:
return 'MONAD_TESTNET'
default:
throw new Error(`UniGraphQLProvider._chainIdToGraphQLChainName unsupported ChainId: ${chainId}`)
}
Expand Down
5 changes: 5 additions & 0 deletions lib/handlers/injector-sor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ export const SUPPORTED_CHAINS: ChainId[] = [
ChainId.ZKSYNC,
ChainId.WORLDCHAIN,
ChainId.UNICHAIN_SEPOLIA,
ChainId.MONAD_TESTNET,
ChainId.BASE_SEPOLIA,
]
const DEFAULT_TOKEN_LIST = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org'

Expand Down Expand Up @@ -367,6 +369,8 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
case ChainId.ZKSYNC:
case ChainId.WORLDCHAIN:
case ChainId.UNICHAIN_SEPOLIA:
case ChainId.MONAD_TESTNET:
case ChainId.BASE_SEPOLIA:
const currentQuoteProvider = new OnChainQuoteProvider(
chainId,
provider,
Expand Down Expand Up @@ -507,6 +511,7 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
ChainId.AVALANCHE,
ChainId.BLAST,
ChainId.WORLDCHAIN,
ChainId.MONAD_TESTNET,
]

const v4Supported = [ChainId.SEPOLIA]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ export const QUOTE_PROVIDER_TRAFFIC_SWITCH_CONFIGURATION = (
// worldchain and unichain sepolia don't have the view-only quoter yet, so we can shadow sample 0.1% of traffic
case ChainId.WORLDCHAIN:
case ChainId.UNICHAIN_SEPOLIA:
case ChainId.BASE_SEPOLIA:
case ChainId.MONAD_TESTNET:
switch (protocol) {
case Protocol.MIXED:
case Protocol.V4:
Expand Down
2 changes: 2 additions & 0 deletions lib/handlers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
case ChainId.OPTIMISM:
case ChainId.WORLDCHAIN:
case ChainId.UNICHAIN_SEPOLIA:
case ChainId.MONAD_TESTNET:
case ChainId.BASE_SEPOLIA:
return {
v2PoolSelection: {
topN: 3,
Expand Down
7 changes: 7 additions & 0 deletions lib/rpc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export function chainIdToNetworkName(networkId: ChainId): string {
return 'worldchain'
case ChainId.UNICHAIN_SEPOLIA:
return 'unichain-sepolia'
case ChainId.MONAD_TESTNET:
return 'monad-testnet'
case ChainId.BASE_SEPOLIA:
return 'base-sepolia'
default:
return 'ethereum'
}
Expand Down Expand Up @@ -83,6 +87,9 @@ export function generateProviderUrl(key: string, value: string, chainId: number)
case 'QUICKNODE_8453': {
return `https://${tokens[0]}.base-mainnet.quiknode.pro/${tokens[1]}`
}
case 'QUICKNODE_84532': {
return `https://${tokens[0]}.base-sepolia.quiknode.pro/${tokens[1]}`
}
case 'QUICKNODE_42161': {
return `https://${tokens[0]}.arbitrum-mainnet.quiknode.pro/${tokens[1]}`
}
Expand Down
2 changes: 2 additions & 0 deletions lib/util/defaultBlocksToLiveRoutesDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const DEFAULT_BLOCKS_TO_LIVE_ROUTES_DB: { [chain in ChainId]: number } =
[ChainId.BASE]: 1800,
[ChainId.ZORA]: 1800,
[ChainId.BASE_GOERLI]: 1800,
[ChainId.BASE_SEPOLIA]: 1800,
[ChainId.ZORA_SEPOLIA]: 1800,
[ChainId.BLAST]: 1800,
// Note: Experiment with longer TTL
Expand Down Expand Up @@ -49,4 +50,5 @@ export const DEFAULT_BLOCKS_TO_LIVE_ROUTES_DB: { [chain in ChainId]: number } =
[ChainId.ROOTSTOCK]: 148,
// (60 minutes) / (1 seconds) = 3600
[ChainId.ZKSYNC]: 3600,
[ChainId.MONAD_TESTNET]: 3600,
}
1 change: 1 addition & 0 deletions lib/util/extraV4FeeTiersTickSpacingsHookAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const EXTRA_V4_FEE_TICK_SPACINGS_HOOK_ADDRESSES: { [chain in ChainId]: Ar
[ChainId.BNB]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.AVALANCHE]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.BASE_GOERLI]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.BASE_SEPOLIA]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.BASE]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.ZORA]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.ZORA_SEPOLIA]: emptyV4FeeTickSpacingsHookAddresses,
Expand Down
1 change: 1 addition & 0 deletions lib/util/hooksAddressesAllowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const HOOKS_ADDRESSES_ALLOWLIST: { [chain in ChainId]: Array<string> } =
[ChainId.BNB]: [ADDRESS_ZERO],
[ChainId.AVALANCHE]: [ADDRESS_ZERO],
[ChainId.BASE_GOERLI]: [ADDRESS_ZERO],
[ChainId.BASE_SEPOLIA]: [ADDRESS_ZERO],
[ChainId.BASE]: [ADDRESS_ZERO],
[ChainId.ZORA]: [ADDRESS_ZERO],
[ChainId.ZORA_SEPOLIA]: [ADDRESS_ZERO],
Expand Down
1 change: 1 addition & 0 deletions lib/util/newCachedRoutesRolloutPercent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ export const NEW_CACHED_ROUTES_ROLLOUT_PERCENT: { [chain in ChainId]: number } =
[ChainId.UNICHAIN_SEPOLIA]: 100,
[ChainId.UNICHAIN]: 100,
[ChainId.MONAD_TESTNET]: 100,
[ChainId.BASE_SEPOLIA]: 100,
}
Loading

0 comments on commit 6d42def

Please sign in to comment.