Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

feat: support blast #374

Merged
merged 6 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions lib/config/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const SUPPORTED_CHAINS = {
ChainId.AVALANCHE,
ChainId.BASE_GOERLI,
ChainId.BASE,
ChainId.BLAST,
],
[RoutingType.DUTCH_LIMIT]: [ChainId.MAINNET, ChainId.POLYGON, ChainId.GOERLI],
[RoutingType.DUTCH_V2]: [ChainId.MAINNET],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"@uniswap/default-token-list": "^11.7.0",
"@uniswap/permit2-sdk": "^1.2.0",
"@uniswap/router-sdk": "^1.4.0",
"@uniswap/sdk-core": "^4.0.7",
"@uniswap/smart-order-router": "3.17.1",
"@uniswap/sdk-core": "^4.2.0",
"@uniswap/smart-order-router": "3.25.0",
"@uniswap/uniswapx-sdk": "1.5.0-alpha.7",
"@uniswap/universal-router-sdk": "1.7.1",
"aws-cdk-lib": "2.85.0",
Expand Down
2 changes: 1 addition & 1 deletion test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export function getTestAmount(currency: Currency): string {
case XSGD_MAINNET:
return '1000';
case DAI_ON(ChainId.MAINNET):
return '1000';
return '5000';
case WBTC_MAINNET:
return '1';
default:
Expand Down
29 changes: 26 additions & 3 deletions test/integ/quote-classic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,11 @@ describe('quote', function () {
CurrencyAmount.fromRawAmount(UNI_MAINNET, quoteJSON.quote)
);
} else {
expect(tokenOutAfter.subtract(tokenOutBefore).toExact()).to.equal('10000');
const tokensDiff = tokenOutBefore.subtract(tokenOutAfter);
const percentDiff = tokensDiff.asFraction.divide(quoteReq.amount);
// After Dencun, start seeing exact out amount has slight rounding error
// We will tolerate by 0.0001% for now
expect(percentDiff.lessThan(new Fraction(1, 1000000))).to.be.true;
// Can't easily check slippage for ETH due to gas costs effecting ETH balance.
}
});
Expand Down Expand Up @@ -2469,6 +2473,7 @@ describe('quote', function () {
[ChainId.MAINNET]: USDC_ON(1),
[ChainId.OPTIMISM]: USDC_ON(ChainId.OPTIMISM),
[ChainId.OPTIMISM_GOERLI]: USDC_ON(ChainId.OPTIMISM_GOERLI),
[ChainId.OPTIMISM_SEPOLIA]: null,
[ChainId.ARBITRUM_ONE]: USDC_ON(ChainId.ARBITRUM_ONE),
[ChainId.POLYGON]: USDC_ON(ChainId.POLYGON),
[ChainId.POLYGON_MUMBAI]: USDC_ON(ChainId.POLYGON_MUMBAI),
Expand All @@ -2481,14 +2486,20 @@ describe('quote', function () {
[ChainId.MOONBEAM]: null,
[ChainId.GNOSIS]: null,
[ChainId.ARBITRUM_GOERLI]: null,
[ChainId.ARBITRUM_SEPOLIA]: null,
[ChainId.BASE_GOERLI]: USDC_ON(ChainId.BASE_GOERLI),
[ChainId.BASE]: USDC_ON(ChainId.BASE),
[ChainId.ZORA]: null,
[ChainId.ZORA_SEPOLIA]: null,
[ChainId.ROOTSTOCK]: null,
[ChainId.BLAST]: null,
};

const TEST_ERC20_2: { [chainId in ChainId]: Token | null } = {
[ChainId.MAINNET]: DAI_ON(1),
[ChainId.OPTIMISM]: DAI_ON(ChainId.OPTIMISM),
[ChainId.OPTIMISM_GOERLI]: DAI_ON(ChainId.OPTIMISM_GOERLI),
[ChainId.OPTIMISM_SEPOLIA]: null,
[ChainId.ARBITRUM_ONE]: DAI_ON(ChainId.ARBITRUM_ONE),
[ChainId.POLYGON]: DAI_ON(ChainId.POLYGON),
[ChainId.POLYGON_MUMBAI]: DAI_ON(ChainId.POLYGON_MUMBAI),
Expand All @@ -2501,8 +2512,13 @@ describe('quote', function () {
[ChainId.MOONBEAM]: null,
[ChainId.GNOSIS]: null,
[ChainId.ARBITRUM_GOERLI]: null,
[ChainId.ARBITRUM_SEPOLIA]: null,
[ChainId.BASE_GOERLI]: WNATIVE_ON(ChainId.BASE_GOERLI),
[ChainId.BASE]: WNATIVE_ON(ChainId.BASE),
[ChainId.ZORA]: null,
[ChainId.ZORA_SEPOLIA]: null,
[ChainId.ROOTSTOCK]: null,
[ChainId.BLAST]: null,
};

// TODO: Find valid pools/tokens on optimistic kovan and polygon mumbai. We skip those tests for now.
Expand All @@ -2511,12 +2527,19 @@ describe('quote', function () {
(c) =>
c !== ChainId.POLYGON_MUMBAI &&
c !== ChainId.ARBITRUM_GOERLI &&
c !== ChainId.ARBITRUM_SEPOLIA &&
c !== ChainId.CELO_ALFAJORES &&
c !== ChainId.GOERLI &&
c !== ChainId.SEPOLIA &&
c !== ChainId.OPTIMISM_GOERLI &&
c != ChainId.BASE &&
c != ChainId.BASE_GOERLI
c != ChainId.OPTIMISM_SEPOLIA &&
c !== ChainId.BASE &&
c !== ChainId.BASE_GOERLI &&
// We will follow up supporting ZORA and ROOTSTOCK
c !== ChainId.ZORA &&
c !== ChainId.ZORA_SEPOLIA &&
c !== ChainId.ROOTSTOCK &&
c !== ChainId.BLAST
)) {
for (const type of ['EXACT_INPUT', 'EXACT_OUTPUT']) {
const erc1 = TEST_ERC20_1[chain];
Expand Down
2 changes: 1 addition & 1 deletion test/integ/quote-gouda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('quoteUniswapX', function () {
parseAmount('5000', UNI_MAINNET),
parseAmount('4000', WETH9[1]),
parseAmount('5000000', DAI_MAINNET),
parseAmount('50000', agEUR_MAINNET),
parseAmount('5000', agEUR_MAINNET),
parseAmount('475000', XSGD_MAINNET),
]);
});
Expand Down
2 changes: 1 addition & 1 deletion test/integ/quote-xv2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('quoteUniswapX-v2', function () {
parseAmount('5000', UNI_MAINNET),
parseAmount('4000', WETH9[1]),
parseAmount('5000000', DAI_MAINNET),
parseAmount('50000', agEUR_MAINNET),
parseAmount('5000', agEUR_MAINNET),
parseAmount('475000', XSGD_MAINNET),
]);
});
Expand Down
2 changes: 1 addition & 1 deletion test/utils/forkAndFund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const WHALES = [
'0xd0C6f16CC58f1b23c51d1529B95fec2740218F0a',
'0x171d311eAcd2206d21Cb462d661C33F0eddadC03',
'0xD91cd0Bcc450409a542A4daeFbFc4118a9F9f5f3',
'0xa173524e030a2d2398036fb33ea3ed6d784c5904',
'0xa116f421ff82A9704428259fd8CC63347127B777',
];

const { ethers } = hre;
Expand Down
Loading
Loading