From ccc94fdfc2c9062ffd79f52631b6b8d32b9037f4 Mon Sep 17 00:00:00 2001 From: Charles Bachmeier Date: Mon, 24 Jul 2023 18:00:29 -0700 Subject: [PATCH] feat: update infura fork block height for cypress tests to be dynamic (#6998) * import creation block from ur sdk * update ur sdk --- hardhat.config.js | 11 +++-------- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/hardhat.config.js b/hardhat.config.js index cc64ef83be..ce70899f22 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,14 +1,9 @@ import { ChainId } from '@uniswap/sdk-core' +import { UNIVERSAL_ROUTER_CREATION_BLOCK } from '@uniswap/universal-router-sdk' /* eslint-env node */ require('dotenv').config() -// Block selection is arbitrary, as e2e tests will build up their own state. -// The only requirement is that all infrastructure under test (eg Permit2 contracts) are already deployed. -// TODO(WEB-2187): Make more dynamic to avoid manually updating -const BLOCK_NUMBER = 17693163 -const POLYGON_BLOCK_NUMBER = 43600000 - const forkingConfig = { httpHeaders: { Origin: 'localhost:3000', // infura allowlists requests by origin @@ -18,12 +13,12 @@ const forkingConfig = { const forks = { [ChainId.MAINNET]: { url: `https://mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`, - blockNumber: BLOCK_NUMBER, + blockNumber: UNIVERSAL_ROUTER_CREATION_BLOCK(ChainId.MAINNET), ...forkingConfig, }, [ChainId.POLYGON]: { url: `https://polygon-mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`, - blockNumber: POLYGON_BLOCK_NUMBER, + blockNumber: UNIVERSAL_ROUTER_CREATION_BLOCK(ChainId.POLYGON), ...forkingConfig, }, } diff --git a/package.json b/package.json index feffb1bce9..8c9be4f083 100644 --- a/package.json +++ b/package.json @@ -180,7 +180,7 @@ "@uniswap/smart-order-router": "^3.13.7", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/uniswapx-sdk": "^1.0.1", - "@uniswap/universal-router-sdk": "^1.5.4", + "@uniswap/universal-router-sdk": "^1.5.6", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", "@uniswap/v2-sdk": "^3.2.0", diff --git a/yarn.lock b/yarn.lock index bed82b9217..08ef81b8a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6385,10 +6385,10 @@ "@uniswap/sdk-core" "^4.0.3" ethers "^5.7.0" -"@uniswap/universal-router-sdk@^1.5.4": - version "1.5.4" - resolved "https://registry.yarnpkg.com/@uniswap/universal-router-sdk/-/universal-router-sdk-1.5.4.tgz#9eb2a578b12fdc38ca18300ff708b3d4a86297c8" - integrity sha512-9vbB1AFFW3QeZWjtRFE0PVnMa2L+yjJpbU9EqCaEAYdR3+T4zx8fuml+84XUQzjKTp1cnndwusc1Mm+g0/Djpg== +"@uniswap/universal-router-sdk@^1.5.4", "@uniswap/universal-router-sdk@^1.5.6": + version "1.5.6" + resolved "https://registry.yarnpkg.com/@uniswap/universal-router-sdk/-/universal-router-sdk-1.5.6.tgz#274a6ac5df032c34544005fe329aa9e2aac9ade6" + integrity sha512-ZD27U+kugMRJRVEX0oWZsRCw1n5vBN3I17Q22IWE+w/WhOJSppUr6PLo9u4HRdqXTZET7gubnlRc0LOAEkkSkQ== dependencies: "@uniswap/permit2-sdk" "^1.2.0" "@uniswap/router-sdk" "^1.6.0"