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

bump sor to 4.17.14 - fix: mixed route support ETH <-> WETH #827

Merged
merged 11 commits into from
Feb 12, 2025
68 changes: 2 additions & 66 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ jobs:
run: npm run integ-test -- -t 'quote for other networks * base'
env:
JSON_RPC_PROVIDER_BASE: ${{ secrets.JSON_RPC_PROVIDER_BASE }}
JSON_RPC_PROVIDER_BASE_SEPOLIA: ${{ secrets.JSON_RPC_PROVIDER_BASE_SEPOLIA }}
TENDERLY_BASE_URL: ${{ secrets.TENDERLY_BASE_URL }}
TENDERLY_USER: ${{ secrets.TENDERLY_USER }}
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
Expand Down Expand Up @@ -809,38 +810,6 @@ jobs:
env:
# TODO: add secret in github secrets
JSON_RPC_PROVIDER_UNICHAIN: ${{ secrets.JSON_RPC_PROVIDER_UNICHAIN }}
TENDERLY_BASE_URL: ${{ secrets.TENDERLY_BASE_URL }}
TENDERLY_USER: ${{ secrets.TENDERLY_USER }}
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }}

integration-tests-quote-for-other-networks-unichain-sepolia:
name: Integration Tests - Quote For Other Networks Unichain Sepolia
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 18.x
registry-url: https://registry.npmjs.org

- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install

# This is required separately from yarn test because it generates the typechain definitions
- name: Compile
run: npm run build

- name: Run Integration tests
run: npm run integ-test -- -t 'quote for other networks * unichain sepolia'
env:
JSON_RPC_PROVIDER_UNICHAIN_SEPOLIA: ${{ secrets.JSON_RPC_PROVIDER_UNICHAIN_SEPOLIA }}
TENDERLY_BASE_URL: ${{ secrets.TENDERLY_BASE_URL }}
TENDERLY_USER: ${{ secrets.TENDERLY_USER }}
Expand Down Expand Up @@ -880,39 +849,6 @@ jobs:
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }}

integration-tests-quote-for-other-networks-base-sepolia:
name: Integration Tests - Quote For Other Networks Base Sepolia
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 18.x
registry-url: https://registry.npmjs.org

- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install

# This is required separately from yarn test because it generates the typechain definitions
- name: Compile
run: npm run build

- name: Run Integration tests
run: npm run integ-test -- -t 'quote for other networks * base sepolia'
env:
JSON_RPC_PROVIDER_MONAD_TESTNET: ${{ secrets.JSON_RPC_PROVIDER_BASE_SEPOLIA }}
TENDERLY_BASE_URL: ${{ secrets.TENDERLY_BASE_URL }}
TENDERLY_USER: ${{ secrets.TENDERLY_USER }}
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }}

integration-tests-quote-for-other-networks-remaining-networks:
name: Integration Tests - Quote For Other Networks Remaining Networks
runs-on: ubuntu-latest
Expand Down Expand Up @@ -940,7 +876,7 @@ jobs:

# This is to capture any new networks added into the integ-test suite
- name: Run Integration tests
run: npm run integ-test -- -t 'quote for other networks * (?!(mainnet|optimism|arbitrum|polygon|sepolia|celo|bnb|avalanche|base|blast|zora|zksync|worldchain|UNICHAIN-sepolia|monad-testnet|base-sepolia))'
run: npm run integ-test -- -t 'quote for other networks * (?!(mainnet|optimism|arbitrum|polygon|sepolia|celo|bnb|avalanche|base|blast|zora|zksync|worldchain|unichain|monad-testnet))'
env:
# We don't know which new networks will be added, so we have no way to provider RPC URL ahead of time
# This will make remaining networks integ-test suite to fail, and dev is expected to manually add RPC URL for the new network
Expand Down
58 changes: 29 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uniswap/smart-order-router",
"version": "4.17.13",
"version": "4.17.14",
"description": "Uniswap Smart Order Router",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
Expand Down Expand Up @@ -37,15 +37,15 @@
"@types/brotli": "^1.3.4",
"@uniswap/default-token-list": "^11.13.0",
"@uniswap/permit2-sdk": "^1.3.0",
"@uniswap/router-sdk": "^1.21.0",
"@uniswap/router-sdk": "^1.22.1",
"@uniswap/sdk-core": "^7.5.0",
"@uniswap/swap-router-contracts": "^1.3.1",
"@uniswap/token-lists": "^1.0.0-beta.31",
"@uniswap/universal-router": "^1.6.0",
"@uniswap/universal-router-sdk": "^4.14.0",
"@uniswap/universal-router-sdk": "^4.17.0",
"@uniswap/v2-sdk": "^4.13.0",
"@uniswap/v3-sdk": "^3.24.0",
"@uniswap/v4-sdk": "^1.18.0",
"@uniswap/v4-sdk": "^1.18.1",
"async-retry": "^1.3.1",
"await-timeout": "^1.1.1",
"axios": "^0.21.1",
Expand Down
3 changes: 2 additions & 1 deletion src/providers/on-chain-quote-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,10 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider {
// Hence in case of V2 or mixed, we explicitly encode into mixed routes.
case Protocol.V2:
case Protocol.MIXED:
// we need to retain the fake pool data for the mixed route
return encodeMixedRouteToPath(
route instanceof V2Route
? new MixedRouteSDK(route.pairs, route.input, route.output)
? new MixedRouteSDK(route.pairs, route.input, route.output, true)
: route
) as TPath;
default:
Expand Down
10 changes: 10 additions & 0 deletions src/providers/token-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ export const DAI_POLYGON = new Token(
'Dai Stablecoin'
);

export const DAI_BASE_SEPOLIA = new Token(
ChainId.SEPOLIA,
'0xE6F6e27c0BF1a4841E3F09d03D7D31Da8eAd0a27',
18,
'DAI',
'Dai Stablecoin'
);

//polygon mumbai tokens
export const WMATIC_POLYGON_MUMBAI = new Token(
ChainId.POLYGON_MUMBAI,
Expand Down Expand Up @@ -1013,6 +1021,8 @@ export const DAI_ON = (chainId: ChainId): Token => {
return DAI_ZKSYNC;
case ChainId.UNICHAIN:
return DAI_UNICHAIN;
case ChainId.BASE_SEPOLIA:
return DAI_BASE_SEPOLIA;
default:
throw new Error(`Chain id: ${chainId} not supported`);
}
Expand Down
5 changes: 5 additions & 0 deletions src/routers/alpha-router/alpha-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ export type AlphaRouterConfig = {
* pass in routing-api intent to align the intent between routing-api and SOR
*/
intent?: INTENT;
/**
* boolean flag to control whether we should enable mixed route that connects ETH <-> WETH
*/
shouldEnableMixedRouteEthWeth?: boolean;
};

export class AlphaRouter
Expand Down Expand Up @@ -559,6 +563,7 @@ export class AlphaRouter
protected mixedSupported?: ChainId[];
protected v4PoolParams?: Array<[number, number, string]>;
protected cachedRoutesCacheInvalidationFixRolloutPercentage?: number;
protected shouldEnableMixedRouteEthWeth?: boolean;

constructor({
chainId,
Expand Down
Loading
Loading