Skip to content

Commit

Permalink
fix: missing chains for outside of same map config (Uniswap#549)
Browse files Browse the repository at this point in the history
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)
Bug fix

- **What is the current behavior?** (You can also link to an open issue here)
I was reviewing onchain quote provider config, and realized the same config map only contains Polygon. I populated for all networks to be safe for future references. Also I realized the [NETWORKS_WITH_SAME_UNISWAP_ADDRESSES](https://github.com/Uniswap/smart-order-router/blob/f73799d8025bddfea725df93f9dad6ecbe895d62/src/util/chains.ts#L53) doesn't contain all the production networks, so I need to manually populate them to be extra safe.

- **What is the new behavior (if this is a feature change)?**
Add the missing chains for the same config mapping.

- **Other information**:
  • Loading branch information
jsy1218 authored Apr 22, 2024
1 parent 8f6963b commit f29b58c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/util/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ export const QUOTER_V2_ADDRESSES: AddressMap = {

export const NEW_QUOTER_V2_ADDRESSES: AddressMap = {
...constructSameAddressMap('0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3'),
[ChainId.CELO]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3',
[ChainId.CELO_ALFAJORES]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3',
[ChainId.OPTIMISM_SEPOLIA]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3',
[ChainId.SEPOLIA]: '0xf0c802dcb0cf1c4f7b953756b49d940eed190221',
[ChainId.ARBITRUM_SEPOLIA]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3',
[ChainId.BNB]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3',
[ChainId.AVALANCHE]: '0xf0c802dcb0cf1c4f7b953756b49d940eed190221',
[ChainId.POLYGON_MUMBAI]: '0x60e06b92bC94a665036C26feC5FF2A92E2d04c5f',
[ChainId.BASE]: '0x222cA98F00eD15B1faE10B61c277703a194cf5d2',
[ChainId.BLAST]: '0x9D0F15f2cf58655fDDcD1EE6129C547fDaeD01b1',
Expand Down
25 changes: 15 additions & 10 deletions src/util/onchainQuoteProviderConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import {
BatchParams,
BlockNumberConfig,
FailureOverrides,
QuoteRetryOptions
QuoteRetryOptions,
} from '../providers';

export const NETWORKS_WITH_SAME_RETRY_OPTIONS = [ChainId.POLYGON];
export const NETWORKS_WITH_SAME_RETRY_OPTIONS = Object.values(
ChainId
) as ChainId[];

export function constructSameRetryOptionsMap<T extends QuoteRetryOptions>(
retryOptions: T,
Expand All @@ -31,7 +33,9 @@ export const RETRY_OPTIONS = {
...constructSameRetryOptionsMap(DEFAULT_RETRY_OPTIONS),
};

export const NETWORKS_WITH_SAME_BATCH_PARAMS = [ChainId.POLYGON];
export const NETWORKS_WITH_SAME_BATCH_PARAMS = Object.values(
ChainId
) as ChainId[];

export function constructSameBatchParamsMap<T extends BatchParams>(
batchParams: T,
Expand All @@ -55,7 +59,9 @@ export const BATCH_PARAMS = {
...constructSameBatchParamsMap(DEFAULT_BATCH_PARAMS),
};

export const NETWORKS_WITH_SAME_GAS_ERROR_FAILURE_OVERRIDES = [ChainId.POLYGON];
export const NETWORKS_WITH_SAME_GAS_ERROR_FAILURE_OVERRIDES = Object.values(
ChainId
) as ChainId[];

export function constructSameGasErrorFailureOverridesMap<
T extends FailureOverrides
Expand Down Expand Up @@ -104,8 +110,7 @@ export function constructSameSuccessRateFailureOverridesMap<
}, {});
}

export const DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES: FailureOverrides =
{
export const DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES: FailureOverrides = {
gasLimitOverride: 1_300_000,
multicallChunk: 110,
};
Expand All @@ -116,7 +121,9 @@ export const SUCCESS_RATE_FAILURE_OVERRIDES = {
),
};

export const NETWORKS_WITH_SAME_BLOCK_NUMBER_CONFIGS = [ChainId.POLYGON];
export const NETWORKS_WITH_SAME_BLOCK_NUMBER_CONFIGS = Object.values(
ChainId
) as ChainId[];

export function constructSameBlockNumberConfigsMap<T extends BlockNumberConfig>(
blockNumberConfigs: T,
Expand All @@ -138,7 +145,5 @@ export const DEFAULT_BLOCK_NUMBER_CONFIGS: BlockNumberConfig = {
};

export const BLOCK_NUMBER_CONFIGS = {
...constructSameBlockNumberConfigsMap(
DEFAULT_BLOCK_NUMBER_CONFIGS
),
...constructSameBlockNumberConfigsMap(DEFAULT_BLOCK_NUMBER_CONFIGS),
};

0 comments on commit f29b58c

Please sign in to comment.