From 1cebcd75c77ea3249ac5a7aea59720c2f136653b Mon Sep 17 00:00:00 2001 From: eddie <66155195+just-toby@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:17:44 -0700 Subject: [PATCH] chore: update dependencies (#278) --- package-lock.json | 120 +++++++++--------- package.json | 11 +- src/providers/v2/static-subgraph-provider.ts | 12 +- src/providers/v3/static-subgraph-provider.ts | 50 ++++---- .../alpha-router/gas-models/v3/gas-costs.ts | 6 + src/routers/legacy-router/bases.ts | 2 + src/util/addresses.ts | 17 +++ src/util/chains.ts | 14 ++ 8 files changed, 135 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36e9c8e2c..51395b728 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,13 +11,13 @@ "dependencies": { "@uniswap/default-token-list": "^11.2.0", "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.3.0", + "@uniswap/router-sdk": "^1.6.0", "@uniswap/swap-router-contracts": "^1.3.0", "@uniswap/token-lists": "^1.0.0-beta.31", "@uniswap/universal-router": "^1.0.1", - "@uniswap/universal-router-sdk": "^1.3.9", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.7.0", + "@uniswap/universal-router-sdk": "^1.5.4", + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0", "async-retry": "^1.3.1", "await-timeout": "^1.1.1", "axios": "^0.21.1", @@ -3111,15 +3111,15 @@ } }, "node_modules/@uniswap/router-sdk": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.4.0.tgz", - "integrity": "sha512-GyUX8x+hnwnh89DHyA/yKWUwhU3Eukx3B76vfvMMWfr++GA4CW6PzT5j4JgNZDrsBTOSJWxTdU5YbgOuwU2XGg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.6.0.tgz", + "integrity": "sha512-onpAzcvEnrsm8tUtu49IrR9EP3n9j0IDpGc0Ee3FDDkVgXrp9cIrAADC+yb56vgLtJFnshbhyIdjXLMIzWe0Gw==", "dependencies": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "^3.0.1", + "@uniswap/sdk-core": "^4", "@uniswap/swap-router-contracts": "1.1.0", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.8.3" + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0" } }, "node_modules/@uniswap/router-sdk/node_modules/@uniswap/lib": { @@ -3170,9 +3170,9 @@ } }, "node_modules/@uniswap/sdk-core": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-3.2.6.tgz", - "integrity": "sha512-MvH/3G0W0sM2g7XjaUy9qU7IabxL/KQp/ucU0AQGpVxiTaAhmVRtsjkkv9UDyzpIXVrmevl4kRgV7KKE29UuXA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.0.3.tgz", + "integrity": "sha512-OXO1BdwQ29LW1TEJyCw5imqIC8HHSDd8d9kGQd+AXMzKbMYeMzxTRZn2U/LboYHr9XnE2wgFO4LnrXGIUyZ7/g==", "dependencies": { "@ethersproject/address": "^5.0.2", "big.js": "^5.2.2", @@ -3231,9 +3231,9 @@ } }, "node_modules/@uniswap/universal-router": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router/-/universal-router-1.2.1.tgz", - "integrity": "sha512-F3S1wKylncuvIG2qwC1ciXXc1z1QmKsalo4p6H2A90LSRylEEhNp7ITxs7qCcnfRh+ZNkGJ0yQ0zmuVJSBezOQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router/-/universal-router-1.4.3.tgz", + "integrity": "sha512-SZmYfhYZtsuxrTMCitcA39iJuG9sbe2nvm9iQfd70WjMpbB0+GuEs5OqSHc5tB/ujrVKzPJ1LOoNNGOs0xPEeA==", "dependencies": { "@openzeppelin/contracts": "4.7.0", "@uniswap/v2-core": "1.0.1", @@ -3244,16 +3244,16 @@ } }, "node_modules/@uniswap/universal-router-sdk": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.3.9.tgz", - "integrity": "sha512-uXhdK8IDuyZZRMKiua9dJ6jj5MJ5xUrGflczWwhp6i0cb2VvXoLNQqc7aq3130NfIrKEYfkBGMjsqStZmqqKug==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.5.4.tgz", + "integrity": "sha512-9vbB1AFFW3QeZWjtRFE0PVnMa2L+yjJpbU9EqCaEAYdR3+T4zx8fuml+84XUQzjKTp1cnndwusc1Mm+g0/Djpg==", "dependencies": { "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.4.0", - "@uniswap/sdk-core": "^3.1.0", - "@uniswap/universal-router": "1.2.1", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.9.0", + "@uniswap/router-sdk": "^1.6.0", + "@uniswap/sdk-core": "^4.0.0", + "@uniswap/universal-router": "1.4.3", + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0", "bignumber.js": "^9.0.2", "ethers": "^5.3.1" }, @@ -3305,13 +3305,13 @@ } }, "node_modules/@uniswap/v2-sdk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-3.0.1.tgz", - "integrity": "sha512-eSpm2gjo2CZh9FACH5fq42str/oSNyWcDxB27o5k44bEew4sxb+pld4gGIf/byJndLBvArR9PtH8c0n/goNOTw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-3.2.0.tgz", + "integrity": "sha512-kBOJ6Iwtgb/2LckLMIzfbPM37/ll0F+33lzPmZlqoJwsT0F2hZdVfAhclufZcSb0Y9RdLXl6372CZJ+lhx8cUQ==", "dependencies": { "@ethersproject/address": "^5.0.0", "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "^3.0.0-alpha.3", + "@uniswap/sdk-core": "^4.0.2", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" }, @@ -3366,13 +3366,13 @@ } }, "node_modules/@uniswap/v3-sdk": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.9.0.tgz", - "integrity": "sha512-LuoF3UcY1DxSAQKJ3E4/1Eq4HaNp+x+7q9mvbpiu+/PBj+O1DjLforAMrKxu+RsA0aarmZtz7yBnAPy+akgfgQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.10.0.tgz", + "integrity": "sha512-sbmSA1O+Ct960r66Ie/c1rOmVadpwRu8nQ79pGICv0pZJdnFIQ/SReG3F+iC2C2UNNjNP6aC2WDUggXrjyrgnA==", "dependencies": { "@ethersproject/abi": "^5.0.12", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "^3.0.1", + "@uniswap/sdk-core": "^4", "@uniswap/swap-router-contracts": "^1.2.1", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", @@ -14106,15 +14106,15 @@ } }, "@uniswap/router-sdk": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.4.0.tgz", - "integrity": "sha512-GyUX8x+hnwnh89DHyA/yKWUwhU3Eukx3B76vfvMMWfr++GA4CW6PzT5j4JgNZDrsBTOSJWxTdU5YbgOuwU2XGg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.6.0.tgz", + "integrity": "sha512-onpAzcvEnrsm8tUtu49IrR9EP3n9j0IDpGc0Ee3FDDkVgXrp9cIrAADC+yb56vgLtJFnshbhyIdjXLMIzWe0Gw==", "requires": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "3.2.6", + "@uniswap/sdk-core": "^4", "@uniswap/swap-router-contracts": "1.1.0", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.8.3" + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0" }, "dependencies": { "@uniswap/lib": { @@ -14155,9 +14155,9 @@ } }, "@uniswap/sdk-core": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-3.2.6.tgz", - "integrity": "sha512-MvH/3G0W0sM2g7XjaUy9qU7IabxL/KQp/ucU0AQGpVxiTaAhmVRtsjkkv9UDyzpIXVrmevl4kRgV7KKE29UuXA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.0.3.tgz", + "integrity": "sha512-OXO1BdwQ29LW1TEJyCw5imqIC8HHSDd8d9kGQd+AXMzKbMYeMzxTRZn2U/LboYHr9XnE2wgFO4LnrXGIUyZ7/g==", "requires": { "@ethersproject/address": "^5.0.2", "big.js": "^5.2.2", @@ -14203,9 +14203,9 @@ "integrity": "sha512-BQVoelKCRf64IToPEs1wxiXOnhr/ukwPOF78XG11PrTAOL4F8umjYKFb8ZPv1/dIJsPaC7GhLSriEqyp94SasQ==" }, "@uniswap/universal-router": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router/-/universal-router-1.2.1.tgz", - "integrity": "sha512-F3S1wKylncuvIG2qwC1ciXXc1z1QmKsalo4p6H2A90LSRylEEhNp7ITxs7qCcnfRh+ZNkGJ0yQ0zmuVJSBezOQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router/-/universal-router-1.4.3.tgz", + "integrity": "sha512-SZmYfhYZtsuxrTMCitcA39iJuG9sbe2nvm9iQfd70WjMpbB0+GuEs5OqSHc5tB/ujrVKzPJ1LOoNNGOs0xPEeA==", "requires": { "@openzeppelin/contracts": "4.7.0", "@uniswap/v2-core": "1.0.1", @@ -14225,16 +14225,16 @@ } }, "@uniswap/universal-router-sdk": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.3.9.tgz", - "integrity": "sha512-uXhdK8IDuyZZRMKiua9dJ6jj5MJ5xUrGflczWwhp6i0cb2VvXoLNQqc7aq3130NfIrKEYfkBGMjsqStZmqqKug==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.5.4.tgz", + "integrity": "sha512-9vbB1AFFW3QeZWjtRFE0PVnMa2L+yjJpbU9EqCaEAYdR3+T4zx8fuml+84XUQzjKTp1cnndwusc1Mm+g0/Djpg==", "requires": { "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.4.0", - "@uniswap/sdk-core": "3.2.6", - "@uniswap/universal-router": "1.2.1", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.9.0", + "@uniswap/router-sdk": "^1.6.0", + "@uniswap/sdk-core": "^4.0.0", + "@uniswap/universal-router": "1.4.3", + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0", "bignumber.js": "^9.0.2", "ethers": "^5.3.1" } @@ -14263,13 +14263,13 @@ } }, "@uniswap/v2-sdk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-3.0.1.tgz", - "integrity": "sha512-eSpm2gjo2CZh9FACH5fq42str/oSNyWcDxB27o5k44bEew4sxb+pld4gGIf/byJndLBvArR9PtH8c0n/goNOTw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-3.2.0.tgz", + "integrity": "sha512-kBOJ6Iwtgb/2LckLMIzfbPM37/ll0F+33lzPmZlqoJwsT0F2hZdVfAhclufZcSb0Y9RdLXl6372CZJ+lhx8cUQ==", "requires": { "@ethersproject/address": "^5.0.0", "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "3.2.6", + "@uniswap/sdk-core": "^4.0.2", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" } @@ -14311,13 +14311,13 @@ } }, "@uniswap/v3-sdk": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.9.0.tgz", - "integrity": "sha512-LuoF3UcY1DxSAQKJ3E4/1Eq4HaNp+x+7q9mvbpiu+/PBj+O1DjLforAMrKxu+RsA0aarmZtz7yBnAPy+akgfgQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.10.0.tgz", + "integrity": "sha512-sbmSA1O+Ct960r66Ie/c1rOmVadpwRu8nQ79pGICv0pZJdnFIQ/SReG3F+iC2C2UNNjNP6aC2WDUggXrjyrgnA==", "requires": { "@ethersproject/abi": "^5.0.12", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "3.2.6", + "@uniswap/sdk-core": "^4", "@uniswap/swap-router-contracts": "^1.2.1", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", diff --git a/package.json b/package.json index 4b80c12b8..a99da41d1 100644 --- a/package.json +++ b/package.json @@ -33,13 +33,13 @@ "dependencies": { "@uniswap/default-token-list": "^11.2.0", "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.3.0", + "@uniswap/router-sdk": "^1.6.0", "@uniswap/swap-router-contracts": "^1.3.0", "@uniswap/token-lists": "^1.0.0-beta.31", "@uniswap/universal-router": "^1.0.1", - "@uniswap/universal-router-sdk": "^1.3.9", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.7.0", + "@uniswap/universal-router-sdk": "^1.5.4", + "@uniswap/v2-sdk": "^3.2.0", + "@uniswap/v3-sdk": "^3.10.0", "async-retry": "^1.3.1", "await-timeout": "^1.1.1", "axios": "^0.21.1", @@ -101,9 +101,6 @@ "peerDependencies": { "jsbi": "^3.2.0" }, - "overrides": { - "@uniswap/sdk-core": "3.2.6" - }, "files": [ "build/main", "build/module", diff --git a/src/providers/v2/static-subgraph-provider.ts b/src/providers/v2/static-subgraph-provider.ts index fc9adbb43..ff102e2be 100644 --- a/src/providers/v2/static-subgraph-provider.ts +++ b/src/providers/v2/static-subgraph-provider.ts @@ -8,7 +8,7 @@ import { DAI_MAINNET, USDC_MAINNET, USDT_MAINNET, - WBTC_MAINNET, + WBTC_MAINNET } from '../token-provider'; import { IV2SubgraphProvider, V2SubgraphPool } from './subgraph-provider'; @@ -23,7 +23,7 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { DAI_MAINNET, USDC_MAINNET, USDT_MAINNET, - WBTC_MAINNET, + WBTC_MAINNET ], [ChainId.GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.GOERLI]!], [ChainId.SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!], @@ -40,6 +40,8 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { [ChainId.MOONBEAM]: [], [ChainId.BNB]: [], [ChainId.AVALANCHE]: [], + [ChainId.BASE_GOERLI]: [], + [ChainId.BASE]: [] }; /** @@ -106,14 +108,14 @@ export class StaticV2SubgraphProvider implements IV2SubgraphProvider { id: poolAddress, liquidity: '100', token0: { - id: token0.address, + id: token0.address }, token1: { - id: token1.address, + id: token1.address }, supply: 100, reserve: 100, - reserveUSD: 100, + reserveUSD: 100 }; }) .compact() diff --git a/src/providers/v3/static-subgraph-provider.ts b/src/providers/v3/static-subgraph-provider.ts index b84806cab..b085878ab 100644 --- a/src/providers/v3/static-subgraph-provider.ts +++ b/src/providers/v3/static-subgraph-provider.ts @@ -59,13 +59,12 @@ import { WETH_POLYGON, WMATIC_POLYGON, WMATIC_POLYGON_MUMBAI, - WXDAI_GNOSIS, + WXDAI_GNOSIS } from '../token-provider'; import { IV3PoolProvider } from './pool-provider'; import { IV3SubgraphProvider, V3SubgraphPool } from './subgraph-provider'; - type ChainTokenList = { readonly [chainId in ChainId]: Token[]; }; @@ -76,26 +75,23 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { DAI_MAINNET, USDC_MAINNET, USDT_MAINNET, - WBTC_MAINNET, + WBTC_MAINNET ], [ChainId.GOERLI]: [ WRAPPED_NATIVE_CURRENCY[ChainId.GOERLI]!, USDT_GOERLI, USDC_GOERLI, WBTC_GOERLI, - DAI_GOERLI, - ], - [ChainId.SEPOLIA]: [ - WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!, - USDC_SEPOLIA, + DAI_GOERLI ], + [ChainId.SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!, USDC_SEPOLIA], [ChainId.OPTIMISM]: [ WRAPPED_NATIVE_CURRENCY[ChainId.OPTIMISM]!, USDC_OPTIMISM, DAI_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM, - OP_OPTIMISM, + OP_OPTIMISM ], [ChainId.ARBITRUM_ONE]: [ WRAPPED_NATIVE_CURRENCY[ChainId.ARBITRUM_ONE]!, @@ -103,37 +99,37 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { DAI_ARBITRUM, USDC_ARBITRUM, USDT_ARBITRUM, - ARB_ARBITRUM, + ARB_ARBITRUM ], [ChainId.ARBITRUM_GOERLI]: [ WRAPPED_NATIVE_CURRENCY[ChainId.ARBITRUM_GOERLI]!, - USDC_ARBITRUM_GOERLI, + USDC_ARBITRUM_GOERLI ], [ChainId.OPTIMISM_GOERLI]: [ WRAPPED_NATIVE_CURRENCY[ChainId.OPTIMISM_GOERLI]!, USDC_OPTIMISM_GOERLI, DAI_OPTIMISM_GOERLI, USDT_OPTIMISM_GOERLI, - WBTC_OPTIMISM_GOERLI, + WBTC_OPTIMISM_GOERLI ], [ChainId.POLYGON]: [USDC_POLYGON, WETH_POLYGON, WMATIC_POLYGON], [ChainId.POLYGON_MUMBAI]: [ DAI_POLYGON_MUMBAI, WRAPPED_NATIVE_CURRENCY[ChainId.POLYGON_MUMBAI]!, - WMATIC_POLYGON_MUMBAI, + WMATIC_POLYGON_MUMBAI ], [ChainId.CELO]: [CELO, CUSD_CELO, CEUR_CELO, DAI_CELO], [ChainId.CELO_ALFAJORES]: [ CELO_ALFAJORES, CUSD_CELO_ALFAJORES, CEUR_CELO_ALFAJORES, - DAI_CELO_ALFAJORES, + DAI_CELO_ALFAJORES ], [ChainId.GNOSIS]: [ WRAPPED_NATIVE_CURRENCY[ChainId.GNOSIS], WBTC_GNOSIS, WXDAI_GNOSIS, - USDC_ETHEREUM_GNOSIS, + USDC_ETHEREUM_GNOSIS ], [ChainId.BNB]: [ WRAPPED_NATIVE_CURRENCY[ChainId.BNB], @@ -142,19 +138,21 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { USDC_BNB, USDT_BNB, BTC_BNB, - ETH_BNB, + ETH_BNB ], [ChainId.AVALANCHE]: [ WRAPPED_NATIVE_CURRENCY[ChainId.AVALANCHE], USDC_AVAX, - DAI_AVAX, + DAI_AVAX ], [ChainId.MOONBEAM]: [ WRAPPED_NATIVE_CURRENCY[ChainId.MOONBEAM], DAI_MOONBEAM, USDC_MOONBEAM, - WBTC_MOONBEAM, + WBTC_MOONBEAM ], + [ChainId.BASE_GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE_GOERLI]], + [ChainId.BASE]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE]] }; /** @@ -172,8 +170,7 @@ export class StaticV3SubgraphProvider implements IV3SubgraphProvider { constructor( private chainId: ChainId, private poolProvider: IV3PoolProvider - ) { - } + ) {} public async getPools( tokenIn?: Token, @@ -209,7 +206,7 @@ export class StaticV3SubgraphProvider implements IV3SubgraphProvider { [tokenA, tokenB, FeeAmount.LOWEST], [tokenA, tokenB, FeeAmount.LOW], [tokenA, tokenB, FeeAmount.MEDIUM], - [tokenA, tokenB, FeeAmount.HIGH], + [tokenA, tokenB, FeeAmount.HIGH] ]; }) .value(); @@ -217,7 +214,10 @@ export class StaticV3SubgraphProvider implements IV3SubgraphProvider { log.info( `V3 Static subgraph provider about to get ${pairs.length} pools on-chain` ); - const poolAccessor = await this.poolProvider.getPools(pairs, providerConfig); + const poolAccessor = await this.poolProvider.getPools( + pairs, + providerConfig + ); const pools = poolAccessor.getAllPools(); const poolAddressSet = new Set(); @@ -239,14 +239,14 @@ export class StaticV3SubgraphProvider implements IV3SubgraphProvider { feeTier: unparseFeeAmount(fee), liquidity: liquidity.toString(), token0: { - id: token0.address, + id: token0.address }, token1: { - id: token1.address, + id: token1.address }, // As a very rough proxy we just use liquidity for TVL. tvlETH: liquidityNumber, - tvlUSD: liquidityNumber, + tvlUSD: liquidityNumber }; }) .compact() diff --git a/src/routers/alpha-router/gas-models/v3/gas-costs.ts b/src/routers/alpha-router/gas-models/v3/gas-costs.ts index 8b4f8dcb9..22dfb9faa 100644 --- a/src/routers/alpha-router/gas-models/v3/gas-costs.ts +++ b/src/routers/alpha-router/gas-models/v3/gas-costs.ts @@ -14,6 +14,8 @@ export const BASE_SWAP_COST = (id: ChainId): BigNumber => { case ChainId.OPTIMISM_GOERLI: case ChainId.BNB: case ChainId.AVALANCHE: + case ChainId.BASE: + case ChainId.BASE_GOERLI: return BigNumber.from(2000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: @@ -43,6 +45,8 @@ export const COST_PER_INIT_TICK = (id: ChainId): BigNumber => { return BigNumber.from(31000); case ChainId.OPTIMISM: case ChainId.OPTIMISM_GOERLI: + case ChainId.BASE: + case ChainId.BASE_GOERLI: return BigNumber.from(31000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: @@ -69,6 +73,8 @@ export const COST_PER_HOP = (id: ChainId): BigNumber => { case ChainId.OPTIMISM: case ChainId.OPTIMISM_GOERLI: case ChainId.AVALANCHE: + case ChainId.BASE: + case ChainId.BASE_GOERLI: return BigNumber.from(80000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: diff --git a/src/routers/legacy-router/bases.ts b/src/routers/legacy-router/bases.ts index cfd9d3996..dd914e064 100644 --- a/src/routers/legacy-router/bases.ts +++ b/src/routers/legacy-router/bases.ts @@ -60,6 +60,8 @@ export const BASES_TO_CHECK_TRADES_AGAINST = ( BTC_BNB, ], [ChainId.AVALANCHE]: [WRAPPED_NATIVE_CURRENCY[ChainId.AVALANCHE]!, USDC_AVAX, DAI_AVAX], + [ChainId.BASE]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE]!], + [ChainId.BASE_GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE_GOERLI]!], }; }; diff --git a/src/util/addresses.ts b/src/util/addresses.ts index 8f757c1a7..ac1bac8d0 100644 --- a/src/util/addresses.ts +++ b/src/util/addresses.ts @@ -18,6 +18,7 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = { [ChainId.ARBITRUM_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.ARBITRUM_GOERLI].v3CoreFactoryAddress, [ChainId.BNB]: CHAIN_TO_ADDRESSES_MAP[ChainId.BNB].v3CoreFactoryAddress, [ChainId.AVALANCHE]: CHAIN_TO_ADDRESSES_MAP[ChainId.AVALANCHE].v3CoreFactoryAddress, + [ChainId.BASE_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].v3CoreFactoryAddress // TODO: Gnosis + Moonbeam contracts to be deployed }; @@ -30,6 +31,7 @@ export const QUOTER_V2_ADDRESSES: AddressMap = { [ChainId.ARBITRUM_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.ARBITRUM_GOERLI].quoterAddress, [ChainId.BNB]: CHAIN_TO_ADDRESSES_MAP[ChainId.BNB].quoterAddress, [ChainId.AVALANCHE]: CHAIN_TO_ADDRESSES_MAP[ChainId.AVALANCHE].quoterAddress, + [ChainId.BASE_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].quoterAddress // TODO: Gnosis + Moonbeam contracts to be deployed }; @@ -47,6 +49,7 @@ export const UNISWAP_MULTICALL_ADDRESSES: AddressMap = { [ChainId.ARBITRUM_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.ARBITRUM_GOERLI].multicallAddress, [ChainId.BNB]: CHAIN_TO_ADDRESSES_MAP[ChainId.BNB].multicallAddress, [ChainId.AVALANCHE]: CHAIN_TO_ADDRESSES_MAP[ChainId.AVALANCHE].multicallAddress, + [ChainId.BASE_GOERLI]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].multicallAddress, // TODO: Gnosis + Moonbeam contracts to be deployed }; @@ -143,4 +146,18 @@ export const WETH9: { 'WETH', 'Wrapped Ether' ), + [ChainId.BASE_GOERLI]: new Token( + ChainId.BASE_GOERLI, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.BASE]: new Token( + ChainId.BASE, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ) }; diff --git a/src/util/chains.ts b/src/util/chains.ts index 73cfbf039..613623d9d 100644 --- a/src/util/chains.ts +++ b/src/util/chains.ts @@ -365,6 +365,20 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId in ChainId]: Token } = { 'WAVAX', 'Wrapped AVAX' ), + [ChainId.BASE]: new Token( + ChainId.BASE, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.BASE_GOERLI]: new Token( + ChainId.BASE_GOERLI, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ) }; function isMatic(