Skip to content

Commit

Permalink
chore: bump sor to 4.10.0 - fix: update deploy address for v4 on sepo…
Browse files Browse the repository at this point in the history
…lia and unichain sepolia (#956)
  • Loading branch information
jsy1218 authored Jan 8, 2025
1 parent 8e2b650 commit 0e52d09
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 169 deletions.
6 changes: 3 additions & 3 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class RoutingAPIPipeline extends Stack {
// Load RPC provider URLs from AWS secret
let jsonRpcProviders = {} as { [chainId: string]: string }
SUPPORTED_CHAINS.forEach((chainId: ChainId) => {
if (chainId !== ChainId.WORLDCHAIN && chainId !== ChainId.ASTROCHAIN_SEPOLIA) {
if (chainId !== ChainId.WORLDCHAIN && chainId !== ChainId.UNICHAIN_SEPOLIA) {
const key = `WEB3_RPC_${chainId}`
jsonRpcProviders[key] = jsonRpcProvidersSecret.secretValueFromJson(key).toString()
new CfnOutput(this, key, {
Expand Down Expand Up @@ -234,7 +234,7 @@ export class RoutingAPIPipeline extends Stack {
'ALCHEMY_324',
// WorldChain,
'QUICKNODE_480',
// AstroChain Sepolia,
// Unichain Sepolia,
'QUICKNODE_1301',
// unirpc - serves all chains
'UNIRPC_0',
Expand Down Expand Up @@ -410,7 +410,7 @@ const jsonRpcProviders = {
ALCHEMY_324: process.env.ALCHEMY_324!,
// WorldChain,
QUICKNODE_480: process.env.QUICKNODE_480!,
// AstroChain Sepolia,
// Unichain Sepolia,
QUICKNODE_1301: process.env.QUICKNODE_1301!,
// unirpc - serves all chains
UNIRPC_0: process.env.UNIRPC_0!,
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 @@ -37,7 +37,7 @@ export const v3SubgraphUrlOverride = (chainId: ChainId) => {
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:
case ChainId.UNICHAIN_SEPOLIA:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v3-astrochain-sepolia/api`
default:
return undefined
Expand All @@ -64,7 +64,7 @@ export const v2SubgraphUrlOverride = (chainId: ChainId) => {
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:
case ChainId.UNICHAIN_SEPOLIA:
return `https://subgraph.satsuma-prod.com/${process.env.ALCHEMY_QUERY_KEY}/uniswap/uniswap-v2-astrochain-sepolia/api`
default:
return undefined
Expand Down
2 changes: 1 addition & 1 deletion lib/dashboards/rpc-providers-widgets-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ID_TO_PROVIDER = (id: ChainId): string => {
case ChainId.CELO:
case ChainId.BNB:
case ChainId.BASE:
case ChainId.ASTROCHAIN_SEPOLIA:
case ChainId.UNICHAIN_SEPOLIA:
return ProviderName.QUIKNODE
case ChainId.CELO_ALFAJORES:
return ProviderName.FORNO
Expand Down
4 changes: 2 additions & 2 deletions lib/graphql/graphql-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export class UniGraphQLProvider implements IUniGraphQLProvider {
return 'ZKSYNC'
case ChainId.WORLDCHAIN:
return 'WORLDCHAIN'
case ChainId.ASTROCHAIN_SEPOLIA:
return 'ASTROCHAIN'
case ChainId.UNICHAIN_SEPOLIA:
return 'UNICHAIN_SEPOLIA'
default:
throw new Error(`UniGraphQLProvider._chainIdToGraphQLChainName unsupported ChainId: ${chainId}`)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/handlers/injector-sor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const SUPPORTED_CHAINS: ChainId[] = [
ChainId.ZORA,
ChainId.ZKSYNC,
ChainId.WORLDCHAIN,
ChainId.ASTROCHAIN_SEPOLIA,
ChainId.UNICHAIN_SEPOLIA,
]
const DEFAULT_TOKEN_LIST = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org'

Expand Down Expand Up @@ -366,7 +366,7 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
case ChainId.ZORA:
case ChainId.ZKSYNC:
case ChainId.WORLDCHAIN:
case ChainId.ASTROCHAIN_SEPOLIA:
case ChainId.UNICHAIN_SEPOLIA:
const currentQuoteProvider = new OnChainQuoteProvider(
chainId,
provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ export const QUOTE_PROVIDER_TRAFFIC_SWITCH_CONFIGURATION = (
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
// 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.ASTROCHAIN_SEPOLIA:
case ChainId.UNICHAIN_SEPOLIA:
switch (protocol) {
case Protocol.MIXED:
case Protocol.V4:
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
}
case ChainId.OPTIMISM:
case ChainId.WORLDCHAIN:
case ChainId.ASTROCHAIN_SEPOLIA:
case ChainId.UNICHAIN_SEPOLIA:
return {
v2PoolSelection: {
topN: 3,
Expand Down
4 changes: 2 additions & 2 deletions lib/rpc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function chainIdToNetworkName(networkId: ChainId): string {
return 'base'
case ChainId.WORLDCHAIN:
return 'worldchain'
case ChainId.ASTROCHAIN_SEPOLIA:
return 'astrochain-sepolia'
case ChainId.UNICHAIN_SEPOLIA:
return 'unichain-sepolia'
default:
return 'ethereum'
}
Expand Down
4 changes: 3 additions & 1 deletion lib/util/defaultBlocksToLiveRoutesDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const DEFAULT_BLOCKS_TO_LIVE_ROUTES_DB: { [chain in ChainId]: number } =
// (12 hours) / (2 seconds) = 21600
[ChainId.WORLDCHAIN]: 21600,
// (60 minutes) / (1 seconds) = 3600
[ChainId.ASTROCHAIN_SEPOLIA]: 3600,
[ChainId.UNICHAIN_SEPOLIA]: 3600,
[ChainId.UNICHAIN]: 3600,
[ChainId.MONAD_TESTNET]: 3600,
// (60 minutes) / (250 milliseconds) = 14400
[ChainId.ARBITRUM_ONE]: 14400,
[ChainId.ARBITRUM_GOERLI]: 14400,
Expand Down
4 changes: 3 additions & 1 deletion lib/util/extraV4FeeTiersTickSpacingsHookAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ export const EXTRA_V4_FEE_TICK_SPACINGS_HOOK_ADDRESSES: { [chain in ChainId]: Ar
[ChainId.BLAST]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.ZKSYNC]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.WORLDCHAIN]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.ASTROCHAIN_SEPOLIA]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.UNICHAIN_SEPOLIA]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.UNICHAIN]: emptyV4FeeTickSpacingsHookAddresses,
[ChainId.MONAD_TESTNET]: emptyV4FeeTickSpacingsHookAddresses,
}
4 changes: 2 additions & 2 deletions lib/util/gasLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const CELO_UPPER_SWAP_GAS_LIMIT = BigNumber.from(5000000)
// https://github.com/Uniswap/routing-api/blob/fe410751985995cb2904837e24f22da7dca1f518/lib/util/onChainQuoteProviderConfigs.ts#L340 divivde by 10
export const WORLDCHAIN_UPPER_SWAP_GAS_LIMIT = BigNumber.from(300000)
// https://github.com/Uniswap/routing-api/blob/fe410751985995cb2904837e24f22da7dca1f518/lib/util/onChainQuoteProviderConfigs.ts#L344 divivde by 10
export const ASTROCHAIN_SEPOLIA_UPPER_SWAP_GAS_LIMIT = BigNumber.from(300000)
export const UNICHAIN_SEPOLIA_UPPER_SWAP_GAS_LIMIT = BigNumber.from(300000)
// https://github.com/Uniswap/smart-order-router/blob/c77d04d334cc1c6694bd74d88287cc5b6e3a7425/src/util/onchainQuoteProviderConfigs.ts#L83 divide by 10
export const BNB_UPPER_SWAP_GAS_LIMIT = BigNumber.from(200000)
// https://github.com/Uniswap/smart-order-router/blob/c77d04d334cc1c6694bd74d88287cc5b6e3a7425/src/util/onchainQuoteProviderConfigs.ts#L83 divide by 10
Expand All @@ -17,7 +17,7 @@ export const CHAIN_TO_GAS_LIMIT_MAP: { [chainId: number]: BigNumber } = {
[ChainId.ZKSYNC]: ZKSYNC_UPPER_SWAP_GAS_LIMIT,
[ChainId.CELO]: CELO_UPPER_SWAP_GAS_LIMIT,
[ChainId.CELO_ALFAJORES]: CELO_UPPER_SWAP_GAS_LIMIT,
[ChainId.ASTROCHAIN_SEPOLIA]: ASTROCHAIN_SEPOLIA_UPPER_SWAP_GAS_LIMIT,
[ChainId.UNICHAIN_SEPOLIA]: UNICHAIN_SEPOLIA_UPPER_SWAP_GAS_LIMIT,
[ChainId.BNB]: BNB_UPPER_SWAP_GAS_LIMIT,
[ChainId.ZORA]: ZORA_UPPER_SWAP_GAS_LIMIT,
}
4 changes: 3 additions & 1 deletion lib/util/hooksAddressesAllowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ export const HOOKS_ADDRESSES_ALLOWLIST: { [chain in ChainId]: Array<string> } =
[ChainId.BLAST]: [ADDRESS_ZERO],
[ChainId.ZKSYNC]: [ADDRESS_ZERO],
[ChainId.WORLDCHAIN]: [ADDRESS_ZERO],
[ChainId.ASTROCHAIN_SEPOLIA]: [ADDRESS_ZERO],
[ChainId.UNICHAIN_SEPOLIA]: [ADDRESS_ZERO],
[ChainId.UNICHAIN]: [ADDRESS_ZERO],
[ChainId.MONAD_TESTNET]: [ADDRESS_ZERO],
}
4 changes: 3 additions & 1 deletion lib/util/newCachedRoutesRolloutPercent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ export const NEW_CACHED_ROUTES_ROLLOUT_PERCENT: { [chain in ChainId]: number } =
[ChainId.BLAST]: 100,
[ChainId.ZKSYNC]: 100,
[ChainId.WORLDCHAIN]: 100,
[ChainId.ASTROCHAIN_SEPOLIA]: 100,
[ChainId.UNICHAIN_SEPOLIA]: 100,
[ChainId.UNICHAIN]: 100,
[ChainId.MONAD_TESTNET]: 100,
}
42 changes: 23 additions & 19 deletions lib/util/onChainQuoteProviderConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const RETRY_OPTIONS: { [chainId: number]: AsyncRetry.Options | undefined
minTimeout: 100,
maxTimeout: 1000,
},
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
retries: 2,
minTimeout: 100,
maxTimeout: 1000,
Expand Down Expand Up @@ -116,7 +116,7 @@ export const OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]: {
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -181,7 +181,7 @@ export const OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]: {
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -247,7 +247,7 @@ export const OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]: {
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -306,8 +306,8 @@ export const OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]: {
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
// TODO: once unichain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -377,8 +377,8 @@ export const NON_OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
// TODO: once unichain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -442,8 +442,8 @@ export const NON_OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
// TODO: once unichain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -508,8 +508,8 @@ export const NON_OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
// TODO: once unichain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -568,8 +568,8 @@ export const NON_OPTIMISTIC_CACHED_ROUTES_BATCH_PARAMS: { [protocol in Protocol]
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
},
// TODO: once astrochain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.ASTROCHAIN_SEPOLIA]: {
// TODO: once unichain-sepolia has view-quoter, optimize muilcallChunk and gasLimitPerCall
[ChainId.UNICHAIN_SEPOLIA]: {
multicallChunk: 80,
gasLimitPerCall: 1_200_000,
quoteMinSuccessRate: 0.1,
Expand Down Expand Up @@ -607,7 +607,7 @@ export const GAS_ERROR_FAILURE_OVERRIDES: { [chainId: number]: FailureOverrides
gasLimitOverride: 3_000_000,
multicallChunk: 45,
},
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
gasLimitOverride: 3_000_000,
multicallChunk: 45,
},
Expand Down Expand Up @@ -643,7 +643,7 @@ export const SUCCESS_RATE_FAILURE_OVERRIDES: { [chainId: number]: FailureOverrid
gasLimitOverride: 3_000_000,
multicallChunk: 45,
},
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
gasLimitOverride: 3_000_000,
multicallChunk: 45,
},
Expand Down Expand Up @@ -691,7 +691,7 @@ export const BLOCK_NUMBER_CONFIGS: { [chainId: number]: BlockNumberConfig } = {
rollbackBlockOffset: -20,
},
},
[ChainId.ASTROCHAIN_SEPOLIA]: {
[ChainId.UNICHAIN_SEPOLIA]: {
baseBlockOffset: -25,
rollback: {
enabled: true,
Expand Down Expand Up @@ -729,7 +729,9 @@ export const NEW_QUOTER_DEPLOY_BLOCK: { [chainId in ChainId]: number } = {
[ChainId.BLAST]: 2370179,
[ChainId.ZKSYNC]: 35982078,
[ChainId.WORLDCHAIN]: -1,
[ChainId.ASTROCHAIN_SEPOLIA]: -1,
[ChainId.UNICHAIN_SEPOLIA]: -1,
[ChainId.UNICHAIN]: -1,
[ChainId.MONAD_TESTNET]: -1,
}

// 0 threshold means it's not deployed yet
Expand Down Expand Up @@ -759,7 +761,9 @@ export const LIKELY_OUT_OF_GAS_THRESHOLD: { [chainId in ChainId]: number } = {
[ChainId.BLAST]: 17540 * 2, // 17540 is the single tick.cross cost on blast. We multiply by 2 to be safe,
[ChainId.ZKSYNC]: 17540 * 2, // 17540 is the single tick.cross cost on zkSync. We multiply by 2 to be safe
[ChainId.WORLDCHAIN]: 0,
[ChainId.ASTROCHAIN_SEPOLIA]: 0,
[ChainId.UNICHAIN_SEPOLIA]: 0,
[ChainId.UNICHAIN]: 0,
[ChainId.MONAD_TESTNET]: 0,
}

// TODO: Move this new addresses to SOR
Expand Down
4 changes: 3 additions & 1 deletion lib/util/tenderlyNewEndpointRolloutPercent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ export const TENDERLY_NEW_ENDPOINT_ROLLOUT_PERCENT: { [chain in ChainId]: number
[ChainId.BLAST]: 100,
[ChainId.ZKSYNC]: 0,
[ChainId.WORLDCHAIN]: 100,
[ChainId.ASTROCHAIN_SEPOLIA]: 0,
[ChainId.UNICHAIN_SEPOLIA]: 0,
[ChainId.UNICHAIN]: 0,
[ChainId.MONAD_TESTNET]: 0,
}
3 changes: 2 additions & 1 deletion lib/util/testNets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const TESTNETS = [
ChainId.OPTIMISM_GOERLI,
ChainId.ARBITRUM_SEPOLIA,
ChainId.ARBITRUM_GOERLI,
ChainId.ASTROCHAIN_SEPOLIA,
ChainId.UNICHAIN_SEPOLIA,
ChainId.MONAD_TESTNET,
]
Loading

0 comments on commit 0e52d09

Please sign in to comment.