diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5bdaa91f5..33b2532fc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -452,8 +452,8 @@ jobs: TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }} - integration-tests-quote-for-other-networks-goerli: - name: Integration Tests - Quote For Other Networks Goerli + integration-tests-quote-for-other-networks-sepolia: + name: Integration Tests - Quote For Other Networks Sepolia runs-on: ubuntu-latest steps: @@ -478,9 +478,9 @@ jobs: run: npm run build - name: Run Integration tests - run: npm run integ-test -- -t 'quote for other networks * goerli' + run: npm run integ-test -- -t 'quote for other networks * sepolia' env: - JSON_RPC_PROVIDER_GORLI: ${{ secrets.JSON_RPC_PROVIDER_GORLI }} + JSON_RPC_PROVIDER_SEPOLIA: ${{ secrets.JSON_RPC_PROVIDER_SEPOLIA }} TENDERLY_BASE_URL: ${{ secrets.TENDERLY_BASE_URL }} TENDERLY_USER: ${{ secrets.TENDERLY_USER }} TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} @@ -623,6 +623,40 @@ jobs: TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }} + integration-tests-quote-for-other-networks-blast: + name: Integration Tests - Quote For Other Networks Blast + 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@v2 + 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 * blast' + env: + JSON_RPC_PROVIDER_BLAST: ${{ secrets.JSON_RPC_PROVIDER_BLAST }} + 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 @@ -650,7 +684,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|goerli|celo|bnb|avalanche|base))' + run: npm run integ-test -- -t 'quote for other networks * (?!(mainnet|optimism|arbitrum|polygon|sepolia|celo|bnb|avalanche|base|blast))' 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 diff --git a/package-lock.json b/package-lock.json index 7969b6082..3ade1e5ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,25 +1,26 @@ { "name": "@uniswap/smart-order-router", - "version": "3.24.0", + "version": "3.27.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@uniswap/smart-order-router", - "version": "3.24.0", + "version": "3.27.2", "license": "GPL", "dependencies": { + "@eth-optimism/sdk": "^3.2.2", "@types/brotli": "^1.3.4", - "@uniswap/default-token-list": "^11.2.0", + "@uniswap/default-token-list": "^11.13.0", "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.7.5", - "@uniswap/sdk-core": "^4.1.2", - "@uniswap/swap-router-contracts": "^1.3.0", + "@uniswap/router-sdk": "^1.9.0", + "@uniswap/sdk-core": "^4.2.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": "^1.6.1", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1", + "@uniswap/universal-router-sdk": "^1.8.2", + "@uniswap/v2-sdk": "^4.3.0", + "@uniswap/v3-sdk": "^3.11.0", "async-retry": "^1.3.1", "await-timeout": "^1.1.1", "axios": "^0.21.1", @@ -751,6 +752,158 @@ "node": ">= 4" } }, + "node_modules/@eth-optimism/contracts": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eth-optimism/contracts/-/contracts-0.6.0.tgz", + "integrity": "sha512-vQ04wfG9kMf1Fwy3FEMqH2QZbgS0gldKhcBeBUPfO8zu68L61VI97UDXmsMQXzTsEAxK8HnokW3/gosl4/NW3w==", + "dependencies": { + "@eth-optimism/core-utils": "0.12.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0" + }, + "peerDependencies": { + "ethers": "^5" + } + }, + "node_modules/@eth-optimism/contracts-bedrock": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.17.1.tgz", + "integrity": "sha512-Hc5peN5PM8kzl9dzqSD5jv6ED3QliO1DF0dXLRJxfrXR7/rmEeyuAYESUwUM0gdJZjkwRYiS5m230BI6bQmnlw==", + "hasInstallScript": true + }, + "node_modules/@eth-optimism/contracts/node_modules/@eth-optimism/core-utils": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@eth-optimism/core-utils/-/core-utils-0.12.0.tgz", + "integrity": "sha512-qW+7LZYCz7i8dRa7SRlUKIo1VBU8lvN0HeXCxJR+z+xtMzMQpPds20XJNCMclszxYQHkXY00fOT6GvFw9ZL6nw==", + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/contracts": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/providers": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bufio": "^1.0.7", + "chai": "^4.3.4" + } + }, + "node_modules/@eth-optimism/core-utils": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@eth-optimism/core-utils/-/core-utils-0.13.1.tgz", + "integrity": "sha512-1FvzbUmCEy9zSKPG1QWg2VfA2Cy90xBA9Wkp11lXXrz91zUPCNCNSRTujXWYIC86ketNsZp7p4njSf6lTycHCw==", + "hasInstallScript": true, + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/contracts": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/web": "^5.7.1", + "chai": "^4.3.9", + "ethers": "^5.7.2", + "node-fetch": "^2.6.7" + } + }, + "node_modules/@eth-optimism/sdk": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@eth-optimism/sdk/-/sdk-3.2.2.tgz", + "integrity": "sha512-P8YXAlh2lun0KZlwrw4FqmK4kNIoOOzI816XXhfkW3nMVADGRAru3TKSM74MgmEuyGiHrA9EoPRq1WLqUX4B0w==", + "dependencies": { + "@eth-optimism/contracts": "0.6.0", + "@eth-optimism/contracts-bedrock": "0.17.1", + "@eth-optimism/core-utils": "0.13.1", + "lodash": "^4.17.21", + "merkletreejs": "^0.3.11", + "rlp": "^2.2.7", + "semver": "^7.6.0" + }, + "peerDependencies": { + "ethers": "^5" + } + }, + "node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@ethereumjs/util/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@scure/bip32": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz", + "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==", + "dependencies": { + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@scure/bip39": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz", + "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==", + "dependencies": { + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/ethereum-cryptography": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz", + "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==", + "dependencies": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@scure/bip32": "1.3.3", + "@scure/bip39": "1.2.2" + } + }, "node_modules/@ethersproject/abi": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", @@ -1890,6 +2043,28 @@ "rlp": "^2.2.3" } }, + "node_modules/@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "dependencies": { + "@noble/hashes": "1.3.3" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/hashes": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", @@ -2430,15 +2605,12 @@ "integrity": "sha512-tAG9LWg8+M2CMu7hIsqHPaTyG4uDzjr6mhvH96LvOpLZZj6tgzTluBt+LsCf1/QaYrlis6pITvpIaIhE+iZB+Q==" }, "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@scure/bip32": { "version": "1.1.0", @@ -3100,9 +3272,9 @@ } }, "node_modules/@uniswap/default-token-list": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/@uniswap/default-token-list/-/default-token-list-11.2.0.tgz", - "integrity": "sha512-royMoeeONKRheGEQD7eeLKdwWvdl6l4qzpFr5Jh9Mp09xdQoBaF7zqZuM/5URIXV0cvvWGWnbIqVKbtFikkMRA==" + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@uniswap/default-token-list/-/default-token-list-11.13.0.tgz", + "integrity": "sha512-hbXp0Y1Ic91FlYT2SVHq1HplKSznkvnjJoCMwdfLaMcD810HRNRMSP1icA+oqr3nKSEEeejnkuLfQD6NdB9/+g==" }, "node_modules/@uniswap/lib": { "version": "1.1.1", @@ -3123,21 +3295,21 @@ } }, "node_modules/@uniswap/router-sdk": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.7.5.tgz", - "integrity": "sha512-wfCq45cRmABIGHDNxnUaO+RRJRj5dRv5n+v/yBInt0ABv8BEJm5iX/sKd12CznXNxFD9phtWs7fK1LaLFxtbyA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.0.tgz", + "integrity": "sha512-UeQrrjhOIzPDxHzkF341Sd9PjIzJwiHFQhaEYFIWNE4yC/wzSiISxc5Ebp94p/KVmettoFRa+682yn9IZBhFTA==", "dependencies": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/swap-router-contracts": "^1.1.0", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1" + "@uniswap/v2-sdk": "^4.3.0", + "@uniswap/v3-sdk": "^3.11.0" } }, "node_modules/@uniswap/sdk-core": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.1.2.tgz", - "integrity": "sha512-bk/oHiNCofy48ix84Q8aK/HHDmMVmk+SaoTq6U/93MmJ/nE7hbsckmY1c3MG2Vz1+jnGMCX9AmdBbnSF7VR5Ow==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.2.0.tgz", + "integrity": "sha512-yXAMLHZRYYuh6KpN2nOlLTYBjGiopmI9WUB4Z0tyNkW4ZZub54cUt22eibpGbZAhRAMxclox9IPIs6wwrM3soQ==", "dependencies": { "@ethersproject/address": "^5.0.2", "big.js": "^5.2.2", @@ -3151,14 +3323,14 @@ } }, "node_modules/@uniswap/swap-router-contracts": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.0.tgz", - "integrity": "sha512-iKvCuRkHXEe0EMjOf8HFUISTIhlxI57kKFllf3C3PUIE0HmwxrayyoflwAz5u/TRsFGYqJ9IjX2UgzLCsrNa5A==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.1.tgz", + "integrity": "sha512-mh/YNbwKb7Mut96VuEtL+Z5bRe0xVIbjjiryn+iMMrK2sFKhR4duk/86mEz0UO5gSx4pQIw9G5276P5heY/7Rg==", "dependencies": { "@openzeppelin/contracts": "3.4.2-solc-0.7", - "@uniswap/v2-core": "1.0.1", - "@uniswap/v3-core": "1.0.0", - "@uniswap/v3-periphery": "1.4.1", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "@uniswap/v3-periphery": "^1.4.4", "dotenv": "^14.2.0", "hardhat-watcher": "^2.1.1" }, @@ -3171,14 +3343,6 @@ "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" }, - "node_modules/@uniswap/swap-router-contracts/node_modules/@uniswap/v3-core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", - "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==", - "engines": { - "node": ">=10" - } - }, "node_modules/@uniswap/swap-router-contracts/node_modules/dotenv": { "version": "14.3.2", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-14.3.2.tgz", @@ -3209,16 +3373,16 @@ } }, "node_modules/@uniswap/universal-router-sdk": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.6.1.tgz", - "integrity": "sha512-qmbPp8rs9qvk0KLYmLAhQaXKjO0q0kTreeo4NovFmAnhJFVRPW5KB8V4+YvaRJDtbUk0EPssmVwGEcDj+ZzfRg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.8.2.tgz", + "integrity": "sha512-u7ZnKxf4NH2J3DoTOOueh2rNruQku1JpLTRGl+/Kvol1NKTXdMAkaTTNRcwBzSpolpfbldK4pAIuwDza7gWzDw==", "dependencies": { "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.7.5", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/router-sdk": "^1.9.0", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/universal-router": "1.6.0", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1", + "@uniswap/v2-sdk": "^4.2.0", + "@uniswap/v3-sdk": "^3.11.0", "bignumber.js": "^9.0.2", "ethers": "^5.3.1" }, @@ -3270,13 +3434,13 @@ } }, "node_modules/@uniswap/v2-sdk": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.0.1.tgz", - "integrity": "sha512-3mYejrgPcxzjntqTrd2ZlnCHvbxAkKUUQPQkH1J3bXSxjEjQC93UuMCdD4g9Pfizw0jFku3mN+rz8DiZ+GfSRg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.3.0.tgz", + "integrity": "sha512-FUKkgo/1TQc/HuWWgsoy1FIcsLkKwm3Nnor88yfn2NH8ER5RK/wDF9UzDDilYh3yyf2mAnaY89CKFhcIl+lbBQ==", "dependencies": { "@ethersproject/address": "^5.0.0", "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" }, @@ -3288,22 +3452,20 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==", - "dev": true, "engines": { "node": ">=10" } }, "node_modules/@uniswap/v3-periphery": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.1.tgz", - "integrity": "sha512-Ab0ZCKOQrQMKIcpBTezTsEhWfQjItd0TtkCG8mPhoQu+wC67nPaf4hYUhM6wGHeFUmDiYY5MpEQuokB0ENvoTg==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", "dependencies": { "@openzeppelin/contracts": "3.4.2-solc-0.7", "@uniswap/lib": "^4.0.1-alpha", - "@uniswap/v2-core": "1.0.1", - "@uniswap/v3-core": "1.0.0", - "base64-sol": "1.0.1", - "hardhat-watcher": "^2.1.1" + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" }, "engines": { "node": ">=10" @@ -3322,22 +3484,14 @@ "node": ">=10" } }, - "node_modules/@uniswap/v3-periphery/node_modules/@uniswap/v3-core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", - "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==", - "engines": { - "node": ">=10" - } - }, "node_modules/@uniswap/v3-sdk": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.10.1.tgz", - "integrity": "sha512-Ed3A/O0egU6qEuW5EaF+DiFIVNOHBgOXdCdtUsJ1J2862mEKiDU9zZjDQ03AZjME9BLj/xJiDTWMdQ+Y5D8+7w==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.0.tgz", + "integrity": "sha512-gz6Q6SlN34AXvxhyz181F90D4OuIkxLnzBAucEzB9Fv3Z+3orHZY/SpGaD02nP1VsNQVu/DQvOsdkPUDGn1Y9Q==", "dependencies": { "@ethersproject/abi": "^5.0.12", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/swap-router-contracts": "^1.2.1", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", @@ -3673,6 +3827,14 @@ "node": ">=0.10.0" } }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "engines": { + "node": "*" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -4083,6 +4245,19 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, + "node_modules/buffer-reverse": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-reverse/-/buffer-reverse-1.0.1.tgz", + "integrity": "sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg==" + }, + "node_modules/bufio": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bufio/-/bufio-1.2.1.tgz", + "integrity": "sha512-9oR3zNdupcg/Ge2sSHQF3GX+kmvL/fTPvD0nd5AGLq8SjUYnTz+SlFjK/GXidndbZtIj+pVKXiWeR9w6e9wKCA==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/bunyan": { "version": "1.8.15", "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", @@ -4233,6 +4408,23 @@ "node": ">=6" } }, + "node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -4257,6 +4449,17 @@ "node": ">=10" } }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -4527,6 +4730,11 @@ "node": ">= 8" } }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, "node_modules/cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -4629,6 +4837,17 @@ "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", "dev": true }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -5387,6 +5606,14 @@ "node": ">=0.10.0" } }, + "node_modules/ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "dependencies": { + "js-sha3": "^0.8.0" + } + }, "node_modules/ethereum-cryptography": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", @@ -5492,6 +5719,24 @@ "@ethersproject/wordlists": "5.7.0" } }, + "node_modules/ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "dependencies": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/ethjs-unit/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, "node_modules/ethjs-util": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", @@ -5924,6 +6169,14 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "engines": { + "node": "*" + } + }, "node_modules/get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -8125,6 +8378,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, "node_modules/lru_map": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", @@ -8293,6 +8554,26 @@ "node": ">= 8" } }, + "node_modules/merkletreejs": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.3.11.tgz", + "integrity": "sha512-LJKTl4iVNTndhL+3Uz/tfkjD0klIWsHlUzgtuNnNrsf7bAlXR30m+xYB7lHr5Z/l6e/yAIsr26Dabx6Buo4VGQ==", + "dependencies": { + "bignumber.js": "^9.0.1", + "buffer-reverse": "^1.0.1", + "crypto-js": "^4.2.0", + "treeify": "^1.1.0", + "web3-utils": "^1.3.4" + }, + "engines": { + "node": ">= 7.6.0" + } + }, + "node_modules/micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -8983,6 +9264,24 @@ "node": ">=8" } }, + "node_modules/number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "dependencies": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/number-to-bn/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, "node_modules/nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", @@ -9520,6 +9819,14 @@ "node": ">=8" } }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "engines": { + "node": "*" + } + }, "node_modules/pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -10335,7 +10642,6 @@ "version": "7.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -10350,7 +10656,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -10361,8 +10666,7 @@ "node_modules/semver/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/serialize-javascript": { "version": "6.0.0", @@ -11163,6 +11467,14 @@ "node": ">=8" } }, + "node_modules/treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", @@ -11388,7 +11700,6 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, "engines": { "node": ">=4" } @@ -11518,6 +11829,11 @@ "punycode": "^2.1.0" } }, + "node_modules/utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -11606,6 +11922,71 @@ "makeerror": "1.0.12" } }, + "node_modules/web3-utils": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.4.tgz", + "integrity": "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A==", + "dependencies": { + "@ethereumjs/util": "^8.1.0", + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereum-cryptography": "^2.1.2", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-utils/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@scure/bip32": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz", + "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==", + "dependencies": { + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@scure/bip39": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz", + "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==", + "dependencies": { + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/ethereum-cryptography": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz", + "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==", + "dependencies": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@scure/bip32": "1.3.3", + "@scure/bip39": "1.2.2" + } + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -12394,6 +12775,133 @@ } } }, + "@eth-optimism/contracts": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eth-optimism/contracts/-/contracts-0.6.0.tgz", + "integrity": "sha512-vQ04wfG9kMf1Fwy3FEMqH2QZbgS0gldKhcBeBUPfO8zu68L61VI97UDXmsMQXzTsEAxK8HnokW3/gosl4/NW3w==", + "requires": { + "@eth-optimism/core-utils": "0.12.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0" + }, + "dependencies": { + "@eth-optimism/core-utils": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@eth-optimism/core-utils/-/core-utils-0.12.0.tgz", + "integrity": "sha512-qW+7LZYCz7i8dRa7SRlUKIo1VBU8lvN0HeXCxJR+z+xtMzMQpPds20XJNCMclszxYQHkXY00fOT6GvFw9ZL6nw==", + "requires": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/contracts": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/providers": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bufio": "^1.0.7", + "chai": "^4.3.4" + } + } + } + }, + "@eth-optimism/contracts-bedrock": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.17.1.tgz", + "integrity": "sha512-Hc5peN5PM8kzl9dzqSD5jv6ED3QliO1DF0dXLRJxfrXR7/rmEeyuAYESUwUM0gdJZjkwRYiS5m230BI6bQmnlw==" + }, + "@eth-optimism/core-utils": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@eth-optimism/core-utils/-/core-utils-0.13.1.tgz", + "integrity": "sha512-1FvzbUmCEy9zSKPG1QWg2VfA2Cy90xBA9Wkp11lXXrz91zUPCNCNSRTujXWYIC86ketNsZp7p4njSf6lTycHCw==", + "requires": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/contracts": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/web": "^5.7.1", + "chai": "^4.3.9", + "ethers": "^5.7.2", + "node-fetch": "^2.6.7" + } + }, + "@eth-optimism/sdk": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@eth-optimism/sdk/-/sdk-3.2.2.tgz", + "integrity": "sha512-P8YXAlh2lun0KZlwrw4FqmK4kNIoOOzI816XXhfkW3nMVADGRAru3TKSM74MgmEuyGiHrA9EoPRq1WLqUX4B0w==", + "requires": { + "@eth-optimism/contracts": "0.6.0", + "@eth-optimism/contracts-bedrock": "0.17.1", + "@eth-optimism/core-utils": "0.13.1", + "lodash": "^4.17.21", + "merkletreejs": "^0.3.11", + "rlp": "^2.2.7", + "semver": "^7.6.0" + } + }, + "@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==" + }, + "@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "requires": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + }, + "@scure/bip32": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz", + "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==", + "requires": { + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + } + }, + "@scure/bip39": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz", + "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==", + "requires": { + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + } + }, + "ethereum-cryptography": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz", + "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==", + "requires": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@scure/bip32": "1.3.3", + "@scure/bip39": "1.2.2" + } + } + } + }, "@ethersproject/abi": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", @@ -13137,6 +13645,21 @@ } } }, + "@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "requires": { + "@noble/hashes": "1.3.3" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + } + } + }, "@noble/hashes": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", @@ -13508,9 +14031,9 @@ "integrity": "sha512-tAG9LWg8+M2CMu7hIsqHPaTyG4uDzjr6mhvH96LvOpLZZj6tgzTluBt+LsCf1/QaYrlis6pITvpIaIhE+iZB+Q==" }, "@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" }, "@scure/bip32": { "version": "1.1.0", @@ -14067,9 +14590,9 @@ } }, "@uniswap/default-token-list": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/@uniswap/default-token-list/-/default-token-list-11.2.0.tgz", - "integrity": "sha512-royMoeeONKRheGEQD7eeLKdwWvdl6l4qzpFr5Jh9Mp09xdQoBaF7zqZuM/5URIXV0cvvWGWnbIqVKbtFikkMRA==" + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@uniswap/default-token-list/-/default-token-list-11.13.0.tgz", + "integrity": "sha512-hbXp0Y1Ic91FlYT2SVHq1HplKSznkvnjJoCMwdfLaMcD810HRNRMSP1icA+oqr3nKSEEeejnkuLfQD6NdB9/+g==" }, "@uniswap/lib": { "version": "1.1.1", @@ -14087,21 +14610,21 @@ } }, "@uniswap/router-sdk": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.7.5.tgz", - "integrity": "sha512-wfCq45cRmABIGHDNxnUaO+RRJRj5dRv5n+v/yBInt0ABv8BEJm5iX/sKd12CznXNxFD9phtWs7fK1LaLFxtbyA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.0.tgz", + "integrity": "sha512-UeQrrjhOIzPDxHzkF341Sd9PjIzJwiHFQhaEYFIWNE4yC/wzSiISxc5Ebp94p/KVmettoFRa+682yn9IZBhFTA==", "requires": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/swap-router-contracts": "^1.1.0", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1" + "@uniswap/v2-sdk": "^4.3.0", + "@uniswap/v3-sdk": "^3.11.0" } }, "@uniswap/sdk-core": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.1.2.tgz", - "integrity": "sha512-bk/oHiNCofy48ix84Q8aK/HHDmMVmk+SaoTq6U/93MmJ/nE7hbsckmY1c3MG2Vz1+jnGMCX9AmdBbnSF7VR5Ow==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.2.0.tgz", + "integrity": "sha512-yXAMLHZRYYuh6KpN2nOlLTYBjGiopmI9WUB4Z0tyNkW4ZZub54cUt22eibpGbZAhRAMxclox9IPIs6wwrM3soQ==", "requires": { "@ethersproject/address": "^5.0.2", "big.js": "^5.2.2", @@ -14112,14 +14635,14 @@ } }, "@uniswap/swap-router-contracts": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.0.tgz", - "integrity": "sha512-iKvCuRkHXEe0EMjOf8HFUISTIhlxI57kKFllf3C3PUIE0HmwxrayyoflwAz5u/TRsFGYqJ9IjX2UgzLCsrNa5A==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.1.tgz", + "integrity": "sha512-mh/YNbwKb7Mut96VuEtL+Z5bRe0xVIbjjiryn+iMMrK2sFKhR4duk/86mEz0UO5gSx4pQIw9G5276P5heY/7Rg==", "requires": { "@openzeppelin/contracts": "3.4.2-solc-0.7", - "@uniswap/v2-core": "1.0.1", - "@uniswap/v3-core": "1.0.0", - "@uniswap/v3-periphery": "1.4.1", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "@uniswap/v3-periphery": "^1.4.4", "dotenv": "^14.2.0", "hardhat-watcher": "^2.1.1" }, @@ -14129,11 +14652,6 @@ "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" }, - "@uniswap/v3-core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", - "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==" - }, "dotenv": { "version": "14.3.2", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-14.3.2.tgz", @@ -14169,16 +14687,16 @@ } }, "@uniswap/universal-router-sdk": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.6.1.tgz", - "integrity": "sha512-qmbPp8rs9qvk0KLYmLAhQaXKjO0q0kTreeo4NovFmAnhJFVRPW5KB8V4+YvaRJDtbUk0EPssmVwGEcDj+ZzfRg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-1.8.2.tgz", + "integrity": "sha512-u7ZnKxf4NH2J3DoTOOueh2rNruQku1JpLTRGl+/Kvol1NKTXdMAkaTTNRcwBzSpolpfbldK4pAIuwDza7gWzDw==", "requires": { "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.7.5", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/router-sdk": "^1.9.0", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/universal-router": "1.6.0", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1", + "@uniswap/v2-sdk": "^4.2.0", + "@uniswap/v3-sdk": "^3.11.0", "bignumber.js": "^9.0.2", "ethers": "^5.3.1" } @@ -14207,13 +14725,13 @@ } }, "@uniswap/v2-sdk": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.0.1.tgz", - "integrity": "sha512-3mYejrgPcxzjntqTrd2ZlnCHvbxAkKUUQPQkH1J3bXSxjEjQC93UuMCdD4g9Pfizw0jFku3mN+rz8DiZ+GfSRg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.3.0.tgz", + "integrity": "sha512-FUKkgo/1TQc/HuWWgsoy1FIcsLkKwm3Nnor88yfn2NH8ER5RK/wDF9UzDDilYh3yyf2mAnaY89CKFhcIl+lbBQ==", "requires": { "@ethersproject/address": "^5.0.0", "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" } @@ -14221,20 +14739,18 @@ "@uniswap/v3-core": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", - "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==", - "dev": true + "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==" }, "@uniswap/v3-periphery": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.1.tgz", - "integrity": "sha512-Ab0ZCKOQrQMKIcpBTezTsEhWfQjItd0TtkCG8mPhoQu+wC67nPaf4hYUhM6wGHeFUmDiYY5MpEQuokB0ENvoTg==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", "requires": { "@openzeppelin/contracts": "3.4.2-solc-0.7", "@uniswap/lib": "^4.0.1-alpha", - "@uniswap/v2-core": "1.0.1", - "@uniswap/v3-core": "1.0.0", - "base64-sol": "1.0.1", - "hardhat-watcher": "^2.1.1" + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" }, "dependencies": { "@openzeppelin/contracts": { @@ -14246,22 +14762,17 @@ "version": "4.0.1-alpha", "resolved": "https://registry.npmjs.org/@uniswap/lib/-/lib-4.0.1-alpha.tgz", "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==" - }, - "@uniswap/v3-core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", - "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==" } } }, "@uniswap/v3-sdk": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.10.1.tgz", - "integrity": "sha512-Ed3A/O0egU6qEuW5EaF+DiFIVNOHBgOXdCdtUsJ1J2862mEKiDU9zZjDQ03AZjME9BLj/xJiDTWMdQ+Y5D8+7w==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.0.tgz", + "integrity": "sha512-gz6Q6SlN34AXvxhyz181F90D4OuIkxLnzBAucEzB9Fv3Z+3orHZY/SpGaD02nP1VsNQVu/DQvOsdkPUDGn1Y9Q==", "requires": { "@ethersproject/abi": "^5.0.12", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.0", "@uniswap/swap-router-contracts": "^1.2.1", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", @@ -14509,6 +15020,11 @@ "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", "dev": true }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, "astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -14829,6 +15345,16 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, + "buffer-reverse": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-reverse/-/buffer-reverse-1.0.1.tgz", + "integrity": "sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg==" + }, + "bufio": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bufio/-/bufio-1.2.1.tgz", + "integrity": "sha512-9oR3zNdupcg/Ge2sSHQF3GX+kmvL/fTPvD0nd5AGLq8SjUYnTz+SlFjK/GXidndbZtIj+pVKXiWeR9w6e9wKCA==" + }, "bunyan": { "version": "1.8.15", "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", @@ -14927,6 +15453,20 @@ "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==" }, + "chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + } + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -14942,6 +15482,14 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, + "check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "requires": { + "get-func-name": "^2.0.2" + } + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -15162,6 +15710,11 @@ "which": "^2.0.1" } }, + "crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -15245,6 +15798,14 @@ "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", "dev": true }, + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "requires": { + "type-detect": "^4.0.0" + } + }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -15827,6 +16388,14 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "requires": { + "js-sha3": "^0.8.0" + } + }, "ethereum-cryptography": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", @@ -15924,6 +16493,22 @@ "@ethersproject/wordlists": "5.7.0" } }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, "ethjs-util": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", @@ -16235,6 +16820,11 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, + "get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==" + }, "get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -17874,6 +18464,14 @@ "is-unicode-supported": "^0.1.0" } }, + "loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "requires": { + "get-func-name": "^2.0.1" + } + }, "lru_map": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", @@ -18004,6 +18602,23 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, + "merkletreejs": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.3.11.tgz", + "integrity": "sha512-LJKTl4iVNTndhL+3Uz/tfkjD0klIWsHlUzgtuNnNrsf7bAlXR30m+xYB7lHr5Z/l6e/yAIsr26Dabx6Buo4VGQ==", + "requires": { + "bignumber.js": "^9.0.1", + "buffer-reverse": "^1.0.1", + "crypto-js": "^4.2.0", + "treeify": "^1.1.0", + "web3-utils": "^1.3.4" + } + }, + "micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" + }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -18531,6 +19146,22 @@ "path-key": "^3.0.0" } }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, "nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", @@ -18940,6 +19571,11 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" + }, "pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -19498,7 +20134,6 @@ "version": "7.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, "requires": { "lru-cache": "^6.0.0" }, @@ -19507,7 +20142,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "requires": { "yallist": "^4.0.0" } @@ -19515,8 +20149,7 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } }, @@ -20155,6 +20788,11 @@ "punycode": "^2.1.1" } }, + "treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==" + }, "trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", @@ -20304,8 +20942,7 @@ "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, "type-fest": { "version": "0.20.2", @@ -20403,6 +21040,11 @@ "punycode": "^2.1.0" } }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -20481,6 +21123,58 @@ "makeerror": "1.0.12" } }, + "web3-utils": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.4.tgz", + "integrity": "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A==", + "requires": { + "@ethereumjs/util": "^8.1.0", + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereum-cryptography": "^2.1.2", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + }, + "@scure/bip32": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz", + "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==", + "requires": { + "@noble/curves": "~1.3.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + } + }, + "@scure/bip39": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz", + "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==", + "requires": { + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.4" + } + }, + "ethereum-cryptography": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz", + "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==", + "requires": { + "@noble/curves": "1.3.0", + "@noble/hashes": "1.3.3", + "@scure/bip32": "1.3.3", + "@scure/bip39": "1.2.2" + } + } + } + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/package.json b/package.json index c51f4abb8..4432e3bad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uniswap/smart-order-router", - "version": "3.24.0", + "version": "3.27.2", "description": "Uniswap Smart Order Router", "main": "build/main/index.js", "typings": "build/main/index.d.ts", @@ -31,17 +31,18 @@ "node": ">=10" }, "dependencies": { + "@eth-optimism/sdk": "^3.2.2", "@types/brotli": "^1.3.4", - "@uniswap/default-token-list": "^11.2.0", + "@uniswap/default-token-list": "^11.13.0", "@uniswap/permit2-sdk": "^1.2.0", - "@uniswap/router-sdk": "^1.7.5", - "@uniswap/sdk-core": "^4.1.2", - "@uniswap/swap-router-contracts": "^1.3.0", + "@uniswap/router-sdk": "^1.9.0", + "@uniswap/sdk-core": "^4.2.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": "^1.6.1", - "@uniswap/v2-sdk": "^4.0.1", - "@uniswap/v3-sdk": "^3.10.1", + "@uniswap/universal-router-sdk": "^1.8.2", + "@uniswap/v2-sdk": "^4.3.0", + "@uniswap/v3-sdk": "^3.11.0", "async-retry": "^1.3.1", "await-timeout": "^1.1.1", "axios": "^0.21.1", diff --git a/src/providers/caching-token-provider.ts b/src/providers/caching-token-provider.ts index 2803e03ca..e30483f88 100644 --- a/src/providers/caching-token-provider.ts +++ b/src/providers/caching-token-provider.ts @@ -27,6 +27,7 @@ import { ETH_BNB, ITokenProvider, TokenAccessor, + USDB_BLAST, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, USDC_ARBITRUM_SEPOLIA, @@ -54,7 +55,7 @@ import { WBTC_OPTIMISM_GOERLI, WBTC_OPTIMISM_SEPOLIA, WMATIC_POLYGON, - WMATIC_POLYGON_MUMBAI, + WMATIC_POLYGON_MUMBAI } from './token-provider'; // These tokens will added to the Token cache on initialization. @@ -160,6 +161,10 @@ export const CACHE_SEED_TOKENS: { USDC: USDC_BASE, WETH: WRAPPED_NATIVE_CURRENCY[ChainId.BASE], }, + [ChainId.BLAST]: { + USDB: USDB_BLAST, + WETH: WRAPPED_NATIVE_CURRENCY[ChainId.BLAST], + }, // Currently we do not have providers for Moonbeam mainnet or Gnosis testnet }; diff --git a/src/providers/eth-estimate-gas-provider.ts b/src/providers/eth-estimate-gas-provider.ts index d2a33115f..5820a34c8 100644 --- a/src/providers/eth-estimate-gas-provider.ts +++ b/src/providers/eth-estimate-gas-provider.ts @@ -18,7 +18,6 @@ import { IPortionProvider } from './portion-provider'; import { ProviderConfig } from './provider'; import { SimulationStatus, Simulator } from './simulation-provider'; import { IV2PoolProvider } from './v2/pool-provider'; -import { ArbitrumGasData, OptimismGasData } from './v3/gas-data-provider'; import { IV3PoolProvider } from './v3/pool-provider'; // We multiply eth estimate gas by this to add a buffer for gas limits @@ -47,7 +46,6 @@ export class EthEstimateGasSimulator extends Simulator { fromAddress: string, swapOptions: SwapOptions, route: SwapRoute, - l2GasData?: ArbitrumGasData | OptimismGasData, providerConfig?: ProviderConfig ): Promise { const currencyIn = route.trade.inputAmount.currency; @@ -114,15 +112,7 @@ export class EthEstimateGasSimulator extends Simulator { estimatedGasUsedQuoteToken, estimatedGasUsedGasToken, quoteGasAdjusted, - } = await calculateGasUsed( - route.quote.currency.chainId, - route, - estimatedGasUsed, - this.v2PoolProvider, - this.v3PoolProvider, - l2GasData, - providerConfig - ); + } = await calculateGasUsed(route.quote.currency.chainId, route, estimatedGasUsed, this.v2PoolProvider, this.v3PoolProvider, this.provider, providerConfig); return { ...initSwapRouteFromExisting( route, @@ -156,8 +146,7 @@ export class EthEstimateGasSimulator extends Simulator { fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, - l2GasData?: OptimismGasData | ArbitrumGasData | undefined, - _providerConfig?: GasModelProviderConfig | undefined + _providerConfig?: GasModelProviderConfig ): Promise { const inputAmount = swapRoute.trade.inputAmount; if ( @@ -169,12 +158,7 @@ export class EthEstimateGasSimulator extends Simulator { this.provider )) ) { - return await this.ethEstimateGas( - fromAddress, - swapOptions, - swapRoute, - l2GasData - ); + return await this.ethEstimateGas(fromAddress, swapOptions, swapRoute, _providerConfig); } else { log.info('Token not approved, skipping simulation'); return { diff --git a/src/providers/on-chain-quote-provider.ts b/src/providers/on-chain-quote-provider.ts index ef6fb552e..9b2827830 100644 --- a/src/providers/on-chain-quote-provider.ts +++ b/src/providers/on-chain-quote-provider.ts @@ -21,6 +21,10 @@ import { } from '../util/addresses'; import { CurrencyAmount } from '../util/amounts'; import { log } from '../util/log'; +import { + DEFAULT_BLOCK_NUMBER_CONFIGS, + DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES, +} from '../util/onchainQuoteProviderConfigs'; import { routeToString } from '../util/routes'; import { Result } from './multicall-provider'; @@ -92,6 +96,14 @@ export type RouteWithQuotes = [ AmountQuote[] ]; +/** + * Final consolidated return type of all on-chain quotes. + */ +export type OnChainQuotes = { + routesWithQuotes: RouteWithQuotes[]; + blockNumber: BigNumber; +}; + type QuoteBatchSuccess = { status: 'success'; inputs: [string, string][]; @@ -141,10 +153,7 @@ export interface IOnChainQuoteProvider { amountIns: CurrencyAmount[], routes: TRoute[], providerConfig?: ProviderConfig - ): Promise<{ - routesWithQuotes: RouteWithQuotes[]; - blockNumber: BigNumber; - }>; + ): Promise>; /** * For every route, gets ane exactOut quote for every amount provided. @@ -160,10 +169,7 @@ export interface IOnChainQuoteProvider { amountOuts: CurrencyAmount[], routes: TRoute[], providerConfig?: ProviderConfig - ): Promise<{ - routesWithQuotes: RouteWithQuotes[]; - blockNumber: BigNumber; - }>; + ): Promise>; } /** @@ -264,12 +270,16 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { * @param successRateFailureOverrides The parameters for retries when we fail to get quotes. * @param blockNumberConfig Parameters for adjusting which block we get quotes from, and how to handle block header not found errors. * @param [quoterAddressOverride] Overrides the address of the quoter contract to use. + * @param metricsPrefix metrics prefix to differentiate between different instances of the quote provider. */ constructor( protected chainId: ChainId, protected provider: BaseProvider, // Only supports Uniswap Multicall as it needs the gas limitting functionality. protected multicall2Provider: UniswapMulticallProvider, + // retryOptions, batchParams, and gasErrorFailureOverride are always override in alpha-router + // so below default values are always not going to be picked up in prod. + // So we will not extract out below default values into constants. protected retryOptions: QuoteRetryOptions = { retries: DEFAULT_BATCH_RETRIES, minTimeout: 25, @@ -284,15 +294,13 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { gasLimitOverride: 1_500_000, multicallChunk: 100, }, - protected successRateFailureOverrides: FailureOverrides = { - gasLimitOverride: 1_300_000, - multicallChunk: 110, - }, - protected blockNumberConfig: BlockNumberConfig = { - baseBlockOffset: 0, - rollback: { enabled: false }, - }, - protected quoterAddressOverride?: string + // successRateFailureOverrides and blockNumberConfig are not always override in alpha-router. + // So we will extract out below default values into constants. + // In alpha-router default case, we will also define the constants with same values as below. + protected successRateFailureOverrides: FailureOverrides = DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES, + protected blockNumberConfig: BlockNumberConfig = DEFAULT_BLOCK_NUMBER_CONFIGS, + protected quoterAddressOverride?: string, + protected metricsPrefix: string = '' // default metric prefix to be empty string ) {} private getQuoterAddress(useMixedRouteQuoter: boolean): string { @@ -317,10 +325,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { amountIns: CurrencyAmount[], routes: TRoute[], providerConfig?: ProviderConfig - ): Promise<{ - routesWithQuotes: RouteWithQuotes[]; - blockNumber: BigNumber; - }> { + ): Promise> { return this.getQuotesManyData( amountIns, routes, @@ -333,10 +338,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { amountOuts: CurrencyAmount[], routes: TRoute[], providerConfig?: ProviderConfig - ): Promise<{ - routesWithQuotes: RouteWithQuotes[]; - blockNumber: BigNumber; - }> { + ): Promise> { return this.getQuotesManyData( amountOuts, routes, @@ -352,10 +354,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { routes: TRoute[], functionName: 'quoteExactInput' | 'quoteExactOutput', _providerConfig?: ProviderConfig - ): Promise<{ - routesWithQuotes: RouteWithQuotes[]; - blockNumber: BigNumber; - }> { + ): Promise> { const useMixedRouteQuoter = routes.some((route) => route.protocol === Protocol.V2) || routes.some((route) => route.protocol === Protocol.MIXED); @@ -420,13 +419,19 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } and block number: ${await providerConfig.blockNumber} [Original before offset: ${originalBlockNumber}].` ); - metric.putMetric('QuoteBatchSize', inputs.length, MetricLoggerUnit.Count); metric.putMetric( - `QuoteBatchSize_${ID_TO_NETWORK_NAME(this.chainId)}`, + `${this.metricsPrefix}QuoteBatchSize`, + inputs.length, + MetricLoggerUnit.Count + ); + metric.putMetric( + `${this.metricsPrefix}QuoteBatchSize_${ID_TO_NETWORK_NAME(this.chainId)}`, inputs.length, MetricLoggerUnit.Count ); + const startTime = Date.now(); + let haveRetriedForSuccessRate = false; let haveRetriedForBlockHeader = false; let blockHeaderRetryAttemptNumber = 0; @@ -593,7 +598,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { if (error instanceof BlockConflictError) { if (!haveRetriedForBlockConflictError) { metric.putMetric( - 'QuoteBlockConflictErrorRetry', + `${this.metricsPrefix}QuoteBlockConflictErrorRetry`, 1, MetricLoggerUnit.Count ); @@ -604,7 +609,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } else if (error instanceof ProviderBlockHeaderError) { if (!haveRetriedForBlockHeader) { metric.putMetric( - 'QuoteBlockHeaderNotFoundRetry', + `${this.metricsPrefix}QuoteBlockHeaderNotFoundRetry`, 1, MetricLoggerUnit.Count ); @@ -644,7 +649,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } else if (error instanceof ProviderTimeoutError) { if (!haveRetriedForTimeout) { metric.putMetric( - 'QuoteTimeoutRetry', + `${this.metricsPrefix}QuoteTimeoutRetry`, 1, MetricLoggerUnit.Count ); @@ -653,7 +658,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } else if (error instanceof ProviderGasError) { if (!haveRetriedForOutOfGas) { metric.putMetric( - 'QuoteOutOfGasExceptionRetry', + `${this.metricsPrefix}QuoteOutOfGasExceptionRetry`, 1, MetricLoggerUnit.Count ); @@ -665,7 +670,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } else if (error instanceof SuccessRateError) { if (!haveRetriedForSuccessRate) { metric.putMetric( - 'QuoteSuccessRateRetry', + `${this.metricsPrefix}QuoteSuccessRateRetry`, 1, MetricLoggerUnit.Count ); @@ -681,7 +686,7 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } else { if (!haveRetriedForUnknownReason) { metric.putMetric( - 'QuoteUnknownReasonRetry', + `${this.metricsPrefix}QuoteUnknownReasonRetry`, 1, MetricLoggerUnit.Count ); @@ -769,32 +774,39 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { amounts ); + const endTime = Date.now(); metric.putMetric( - 'QuoteApproxGasUsedPerSuccessfulCall', + `${this.metricsPrefix}QuoteLatency`, + endTime - startTime, + MetricLoggerUnit.Milliseconds + ) + + metric.putMetric( + `${this.metricsPrefix}QuoteApproxGasUsedPerSuccessfulCall`, approxGasUsedPerSuccessCall, MetricLoggerUnit.Count ); metric.putMetric( - 'QuoteNumRetryLoops', + `${this.metricsPrefix}QuoteNumRetryLoops`, finalAttemptNumber - 1, MetricLoggerUnit.Count ); metric.putMetric( - 'QuoteTotalCallsToProvider', + `${this.metricsPrefix}QuoteTotalCallsToProvider`, totalCallsMade, MetricLoggerUnit.Count ); metric.putMetric( - 'QuoteExpectedCallsToProvider', + `${this.metricsPrefix}QuoteExpectedCallsToProvider`, expectedCallsMade, MetricLoggerUnit.Count ); metric.putMetric( - 'QuoteNumRetriedCalls', + `${this.metricsPrefix}QuoteNumRetriedCalls`, totalCallsMade - expectedCallsMade, MetricLoggerUnit.Count ); @@ -812,7 +824,10 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } attempt loops. Total calls made to provider: ${totalCallsMade}. Have retried for timeout: ${haveRetriedForTimeout}` ); - return { routesWithQuotes: routesQuotes, blockNumber }; + return { + routesWithQuotes: routesQuotes, + blockNumber, + } as OnChainQuotes; } private partitionQuotes( diff --git a/src/providers/simulation-provider.ts b/src/providers/simulation-provider.ts index 434889106..d5070209c 100644 --- a/src/providers/simulation-provider.ts +++ b/src/providers/simulation-provider.ts @@ -7,14 +7,13 @@ import { GasModelProviderConfig, SwapOptions, SwapRoute, - SwapType, + SwapType } from '../routers'; import { Erc20__factory } from '../types/other/factories/Erc20__factory'; import { Permit2__factory } from '../types/other/factories/Permit2__factory'; import { CurrencyAmount, log, SWAP_ROUTER_02_ADDRESSES } from '../util'; import { IPortionProvider } from './portion-provider'; -import { ArbitrumGasData, OptimismGasData } from './v3/gas-data-provider'; export type SimulationResult = { transaction: { @@ -63,7 +62,6 @@ export abstract class Simulator { swapRoute: SwapRoute, amount: CurrencyAmount, quote: CurrencyAmount, - l2GasData?: OptimismGasData | ArbitrumGasData, providerConfig?: GasModelProviderConfig ): Promise { const neededBalance = @@ -81,13 +79,7 @@ export abstract class Simulator { 'User has sufficient balance to simulate. Simulating transaction.' ); try { - return this.simulateTransaction( - fromAddress, - swapOptions, - swapRoute, - l2GasData, - providerConfig - ); + return this.simulateTransaction(fromAddress, swapOptions, swapRoute, providerConfig); } catch (e) { log.error({ e }, 'Error simulating transaction'); return { @@ -108,7 +100,6 @@ export abstract class Simulator { fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, - l2GasData?: OptimismGasData | ArbitrumGasData, providerConfig?: GasModelProviderConfig ): Promise; diff --git a/src/providers/tenderly-simulation-provider.ts b/src/providers/tenderly-simulation-provider.ts index 4fa345904..8904d0a85 100644 --- a/src/providers/tenderly-simulation-provider.ts +++ b/src/providers/tenderly-simulation-provider.ts @@ -17,7 +17,7 @@ import { MetricLoggerUnit, SwapOptions, SwapRoute, - SwapType, + SwapType } from '../routers'; import { Erc20__factory } from '../types/other/factories/Erc20__factory'; import { Permit2__factory } from '../types/other/factories/Permit2__factory'; @@ -41,7 +41,6 @@ import { Simulator, } from './simulation-provider'; import { IV2PoolProvider } from './v2/pool-provider'; -import { ArbitrumGasData, OptimismGasData } from './v3/gas-data-provider'; import { IV3PoolProvider } from './v3/pool-provider'; export type TenderlyResponseUniversalRouter = { @@ -114,7 +113,6 @@ export class FallbackTenderlySimulator extends Simulator { fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, - l2GasData?: ArbitrumGasData | OptimismGasData, providerConfig?: GasModelProviderConfig ): Promise { // Make call to eth estimate gas if possible @@ -136,13 +134,7 @@ export class FallbackTenderlySimulator extends Simulator { try { const swapRouteWithGasEstimate = - await this.ethEstimateGasSimulator.ethEstimateGas( - fromAddress, - swapOptions, - swapRoute, - l2GasData, - providerConfig - ); + await this.ethEstimateGasSimulator.ethEstimateGas(fromAddress, swapOptions, swapRoute, providerConfig); return swapRouteWithGasEstimate; } catch (err) { log.info({ err: err }, 'Error simulating using eth_estimateGas'); @@ -151,13 +143,7 @@ export class FallbackTenderlySimulator extends Simulator { } try { - return await this.tenderlySimulator.simulateTransaction( - fromAddress, - swapOptions, - swapRoute, - l2GasData, - providerConfig - ); + return await this.tenderlySimulator.simulateTransaction(fromAddress, swapOptions, swapRoute, providerConfig); } catch (err) { log.error({ err: err }, 'Failed to simulate via Tenderly'); @@ -217,7 +203,6 @@ export class TenderlySimulator extends Simulator { fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, - l2GasData?: ArbitrumGasData | OptimismGasData, providerConfig?: GasModelProviderConfig ): Promise { const currencyIn = swapRoute.trade.inputAmount.currency; @@ -524,15 +509,7 @@ export class TenderlySimulator extends Simulator { estimatedGasUsedQuoteToken, estimatedGasUsedGasToken, quoteGasAdjusted, - } = await calculateGasUsed( - chainId, - swapRoute, - estimatedGasUsed, - this.v2PoolProvider, - this.v3PoolProvider, - l2GasData, - providerConfig - ); + } = await calculateGasUsed(chainId, swapRoute, estimatedGasUsed, this.v2PoolProvider, this.v3PoolProvider, this.provider, providerConfig); return { ...initSwapRouteFromExisting( swapRoute, diff --git a/src/providers/token-fee-fetcher.ts b/src/providers/token-fee-fetcher.ts index 0c9b1eba2..94b03780b 100644 --- a/src/providers/token-fee-fetcher.ts +++ b/src/providers/token-fee-fetcher.ts @@ -34,7 +34,23 @@ export type TokenFeeMap = Record; const FEE_DETECTOR_ADDRESS = (chainId: ChainId) => { switch (chainId) { case ChainId.MAINNET: + return '0x19C97dc2a25845C7f9d1d519c8C2d4809c58b43f'; + case ChainId.OPTIMISM: + return '0xa7c17505B43955A474fb6AFE61E093907a7567c9'; + case ChainId.BNB: + return '0x331f6D0AAB4A1F039f0d75A613a7F1593DbDE1BB'; + case ChainId.POLYGON: + return '0x92bCCCb6c8c199AAcA38408621E38Ab6dBfA00B5'; + case ChainId.BASE: + return '0x331f6D0AAB4A1F039f0d75A613a7F1593DbDE1BB'; + case ChainId.ARBITRUM_ONE: + return '0x64CF365CC5CCf5E64380bc05Acd5df7D0618c118'; + case ChainId.CELO: + return '0x3dfF0145E68a5880EAbE8F56b6Bc30C4AdCF3413'; + case ChainId.AVALANCHE: + return '0xBF2B9F6A6eCc4541b31ab2dCF8156D33644Ca3F3'; default: + // just default to mainnet contract return '0x19C97dc2a25845C7f9d1d519c8C2d4809c58b43f'; } }; diff --git a/src/providers/token-provider.ts b/src/providers/token-provider.ts index 53cf99a30..09e7c9a85 100644 --- a/src/providers/token-provider.ts +++ b/src/providers/token-provider.ts @@ -647,6 +647,15 @@ export const WBTC_MOONBEAM = new Token( 'Wrapped BTC bridged using Multichain' ); +// Blast Tokens +export const USDB_BLAST = new Token( + ChainId.BLAST, + '0x4300000000000000000000000000000000000003', + 18, + 'USDB', + 'USD Blast' +) + export class TokenProvider implements ITokenProvider { constructor( private chainId: ChainId, diff --git a/src/providers/v2/static-subgraph-provider.ts b/src/providers/v2/static-subgraph-provider.ts index 4f41c2ef7..91b89b1ac 100644 --- a/src/providers/v2/static-subgraph-provider.ts +++ b/src/providers/v2/static-subgraph-provider.ts @@ -19,7 +19,7 @@ import { DAI_MOONBEAM, DAI_OPTIMISM, ETH_BNB, - OP_OPTIMISM, + OP_OPTIMISM, USDB_BLAST, USDC_ARBITRUM, USDC_AVAX, USDC_BASE, @@ -38,7 +38,7 @@ import { WBTC_MOONBEAM, WBTC_OPTIMISM, WETH_POLYGON, - WMATIC_POLYGON, + WMATIC_POLYGON } from '../token-provider'; import { IV2SubgraphProvider, V2SubgraphPool } from './subgraph-provider'; @@ -106,6 +106,10 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { ], [ChainId.BASE_GOERLI]: [], [ChainId.BASE]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE], USDC_BASE], + [ChainId.ZORA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA]!], + [ChainId.ZORA_SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA_SEPOLIA]!], + [ChainId.ROOTSTOCK]: [WRAPPED_NATIVE_CURRENCY[ChainId.ROOTSTOCK]!], + [ChainId.BLAST]: [WRAPPED_NATIVE_CURRENCY[ChainId.BLAST]!, USDB_BLAST], }; /** diff --git a/src/providers/v3/gas-data-provider.ts b/src/providers/v3/gas-data-provider.ts index c076ca0b7..dcfa294f7 100644 --- a/src/providers/v3/gas-data-provider.ts +++ b/src/providers/v3/gas-data-provider.ts @@ -3,9 +3,7 @@ import { BaseProvider } from '@ethersproject/providers'; import { ChainId } from '@uniswap/sdk-core'; import { GasDataArbitrum__factory } from '../../types/other/factories/GasDataArbitrum__factory'; -import { GasPriceOracle__factory } from '../../types/other/factories/GasPriceOracle__factory'; -import { ARB_GASINFO_ADDRESS, log, OVM_GASPRICE_ADDRESS } from '../../util'; -import { IMulticallProvider } from '../multicall-provider'; +import { ARB_GASINFO_ADDRESS } from '../../util'; import { ProviderConfig } from '../provider'; /** @@ -22,79 +20,6 @@ export interface IL2GasDataProvider { getGasData(providerConfig?: ProviderConfig): Promise; } -export type OptimismGasData = { - l1BaseFee: BigNumber; - scalar: BigNumber; - decimals: BigNumber; - overhead: BigNumber; -}; - -export class OptimismGasDataProvider - implements IL2GasDataProvider -{ - protected gasOracleAddress: string; - - constructor( - protected chainId: ChainId, - protected multicall2Provider: IMulticallProvider, - gasPriceAddress?: string - ) { - if (chainId !== ChainId.OPTIMISM && chainId !== ChainId.BASE) { - throw new Error('This data provider is used only on optimism networks.'); - } - this.gasOracleAddress = gasPriceAddress ?? OVM_GASPRICE_ADDRESS; - } - - /** - * Gets the data constants needed to calculate the l1 security fee on Optimism. - * @returns An OptimismGasData object that includes the l1BaseFee, - * scalar, decimals, and overhead values. - */ - public async getGasData( - providerConfig?: ProviderConfig - ): Promise { - // TODO: Also get the gasPrice from GasPriceOracle.sol - const funcNames = ['l1BaseFee', 'scalar', 'decimals', 'overhead']; - const tx = - await this.multicall2Provider.callMultipleFunctionsOnSameContract< - undefined, - [BigNumber] - >({ - address: this.gasOracleAddress, - contractInterface: GasPriceOracle__factory.createInterface(), - functionNames: funcNames, - providerConfig: providerConfig, - }); - - if ( - !tx.results[0]?.success || - !tx.results[1]?.success || - !tx.results[2]?.success || - !tx.results[3]?.success - ) { - log.info( - { results: tx.results }, - 'Failed to get gas constants data from the optimism gas oracle' - ); - throw new Error( - 'Failed to get gas constants data from the optimism gas oracle' - ); - } - - const { result: l1BaseFee } = tx.results![0]; - const { result: scalar } = tx.results![1]; - const { result: decimals } = tx.results![2]; - const { result: overhead } = tx.results![3]; - - return { - l1BaseFee: l1BaseFee[0], - scalar: scalar[0], - decimals: decimals[0], - overhead: overhead[0], - }; - } -} - /** * perL2TxFee is the base fee in wei for an l2 transaction. * perL2CalldataFee is the fee in wei per byte of calldata the swap uses. Multiply by the total bytes of the calldata. diff --git a/src/providers/v3/static-subgraph-provider.ts b/src/providers/v3/static-subgraph-provider.ts index f2e735004..41aac87af 100644 --- a/src/providers/v3/static-subgraph-provider.ts +++ b/src/providers/v3/static-subgraph-provider.ts @@ -31,6 +31,7 @@ import { DAI_POLYGON_MUMBAI, ETH_BNB, OP_OPTIMISM, + USDB_BLAST, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, USDC_AVAX, @@ -60,7 +61,7 @@ import { WETH_POLYGON, WMATIC_POLYGON, WMATIC_POLYGON_MUMBAI, - WXDAI_GNOSIS, + WXDAI_GNOSIS } from '../token-provider'; import { IV3PoolProvider } from './pool-provider'; @@ -161,6 +162,10 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { ], [ChainId.BASE_GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE_GOERLI]], [ChainId.BASE]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE], USDC_BASE], + [ChainId.ZORA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA]!], + [ChainId.ZORA_SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA_SEPOLIA]!], + [ChainId.ROOTSTOCK]: [WRAPPED_NATIVE_CURRENCY[ChainId.ROOTSTOCK]!], + [ChainId.BLAST]: [WRAPPED_NATIVE_CURRENCY[ChainId.BLAST]!, USDB_BLAST], }; /** diff --git a/src/providers/v3/subgraph-provider.ts b/src/providers/v3/subgraph-provider.ts index 1eaf9d8d5..e5e08d7bf 100644 --- a/src/providers/v3/subgraph-provider.ts +++ b/src/providers/v3/subgraph-provider.ts @@ -67,6 +67,7 @@ const SUBGRAPH_URL_BY_CHAIN: { [chainId in ChainId]?: string } = { 'https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax', [ChainId.BASE]: 'https://api.studio.thegraph.com/query/48211/uniswap-v3-base/version/latest', + [ChainId.BLAST]: 'https://gateway-arbitrum.network.thegraph.com/api/0ae45f0bf40ae2e73119b44ccd755967/subgraphs/id/2LHovKznvo8YmKC9ZprPjsYAZDCc4K5q4AYz8s3cnQn1', }; const PAGE_SIZE = 1000; // 1k is max possible query size from subgraph. diff --git a/src/routers/alpha-router/alpha-router.ts b/src/routers/alpha-router/alpha-router.ts index 4eecddaa8..f8ea19132 100644 --- a/src/routers/alpha-router/alpha-router.ts +++ b/src/routers/alpha-router/alpha-router.ts @@ -74,8 +74,6 @@ import { ArbitrumGasData, ArbitrumGasDataProvider, IL2GasDataProvider, - OptimismGasData, - OptimismGasDataProvider, } from '../../providers/v3/gas-data-provider'; import { IV3PoolProvider, @@ -100,6 +98,17 @@ import { buildTrade, } from '../../util/methodParameters'; import { metric, MetricLoggerUnit } from '../../util/metric'; +import { + BATCH_PARAMS, + BLOCK_NUMBER_CONFIGS, + DEFAULT_BATCH_PARAMS, DEFAULT_BLOCK_NUMBER_CONFIGS, + DEFAULT_GAS_ERROR_FAILURE_OVERRIDES, + DEFAULT_RETRY_OPTIONS, + DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES, + GAS_ERROR_FAILURE_OVERRIDES, + RETRY_OPTIONS, + SUCCESS_RATE_FAILURE_OVERRIDES +} from '../../util/onchainQuoteProviderConfigs'; import { UNSUPPORTED_TOKENS } from '../../util/unsupported-tokens'; import { IRouter, @@ -227,11 +236,6 @@ export type AlphaRouterParams = { */ swapRouterProvider?: ISwapRouterProvider; - /** - * Calls the optimism gas oracle contract to fetch constants for calculating the l1 security fee. - */ - optimismGasDataProvider?: IL2GasDataProvider; - /** * A token validator for detecting fee-on-transfer tokens or tokens that can't be transferred. */ @@ -456,7 +460,6 @@ export class AlphaRouter protected tokenValidatorProvider?: ITokenValidatorProvider; protected blockedTokenListProvider?: ITokenListProvider; protected l2GasDataProvider?: - | IL2GasDataProvider | IL2GasDataProvider; protected simulator?: Simulator; protected v2Quoter: V2Quoter; @@ -484,7 +487,6 @@ export class AlphaRouter v2GasModelFactory, mixedRouteGasModelFactory, swapRouterProvider, - optimismGasDataProvider, tokenValidatorProvider, arbitrumGasDataProvider, simulator, @@ -548,6 +550,7 @@ export class AlphaRouter ); break; case ChainId.BASE: + case ChainId.BLAST: case ChainId.BASE_GOERLI: this.onChainQuoteProvider = new OnChainQuoteProvider( chainId, @@ -634,25 +637,30 @@ export class AlphaRouter } ); break; + case ChainId.POLYGON_MUMBAI: + case ChainId.SEPOLIA: + case ChainId.MAINNET: + this.onChainQuoteProvider = new OnChainQuoteProvider( + chainId, + provider, + this.multicall2Provider, + RETRY_OPTIONS[chainId], + BATCH_PARAMS[chainId], + GAS_ERROR_FAILURE_OVERRIDES[chainId], + SUCCESS_RATE_FAILURE_OVERRIDES[chainId], + BLOCK_NUMBER_CONFIGS[chainId] + ); + break; default: this.onChainQuoteProvider = new OnChainQuoteProvider( chainId, provider, this.multicall2Provider, - { - retries: 2, - minTimeout: 100, - maxTimeout: 1000, - }, - { - multicallChunk: 210, - gasLimitPerCall: 705_000, - quoteMinSuccessRate: 0.15, - }, - { - gasLimitOverride: 2_000_000, - multicallChunk: 70, - } + DEFAULT_RETRY_OPTIONS, + DEFAULT_BATCH_PARAMS, + DEFAULT_GAS_ERROR_FAILURE_OVERRIDES, + DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES, + DEFAULT_BLOCK_NUMBER_CONFIGS, ); break; } @@ -773,9 +781,9 @@ export class AlphaRouter ) ); this.v3GasModelFactory = - v3GasModelFactory ?? new V3HeuristicGasModelFactory(); + v3GasModelFactory ?? new V3HeuristicGasModelFactory(this.provider); this.v2GasModelFactory = - v2GasModelFactory ?? new V2HeuristicGasModelFactory(); + v2GasModelFactory ?? new V2HeuristicGasModelFactory(this.provider); this.mixedRouteGasModelFactory = mixedRouteGasModelFactory ?? new MixedRouteHeuristicGasModelFactory(); @@ -783,11 +791,6 @@ export class AlphaRouter swapRouterProvider ?? new SwapRouterProvider(this.multicall2Provider, this.chainId); - if (chainId === ChainId.OPTIMISM || chainId === ChainId.BASE) { - this.l2GasDataProvider = - optimismGasDataProvider ?? - new OptimismGasDataProvider(chainId, this.multicall2Provider); - } if ( chainId === ChainId.ARBITRUM_ONE || chainId === ChainId.ARBITRUM_GOERLI @@ -1523,9 +1526,6 @@ export class AlphaRouter // Quote will be in WETH even if quoteCurrency is ETH // So we init a new CurrencyAmount object here CurrencyAmount.fromRawAmount(quoteCurrency, quote.quotient.toString()), - this.l2GasDataProvider - ? await this.l2GasDataProvider!.getGasData(providerConfig) - : undefined, providerConfig ); metric.putMetric( @@ -2081,7 +2081,7 @@ export class AlphaRouter nativeAndSpecifiedGasTokenV3Pool: nativeAndSpecifiedGasTokenV3Pool, }; - const v2GasModelPromise = V2_SUPPORTED.includes(this.chainId) + const v2GasModelPromise = this.v2Supported?.includes(this.chainId) ? this.v2GasModelFactory.buildGasModel({ chainId: this.chainId, gasPriceWei, @@ -2089,7 +2089,7 @@ export class AlphaRouter token: quoteToken, l2GasDataProvider: this.l2GasDataProvider, providerConfig: providerConfig, - }) + }).catch(_ => undefined) // If v2 model throws uncaught exception, we return undefined v2 gas model, so there's a chance v3 route can go through : Promise.resolve(undefined); const v3GasModelPromise = this.v3GasModelFactory.buildGasModel({ diff --git a/src/routers/alpha-router/config.ts b/src/routers/alpha-router/config.ts index b9bdfff40..fff64faa3 100644 --- a/src/routers/alpha-router/config.ts +++ b/src/routers/alpha-router/config.ts @@ -12,6 +12,7 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = ( case ChainId.OPTIMISM_SEPOLIA: case ChainId.BASE: case ChainId.BASE_GOERLI: + case ChainId.BLAST: return { v2PoolSelection: { topN: 3, diff --git a/src/routers/alpha-router/functions/get-candidate-pools.ts b/src/routers/alpha-router/functions/get-candidate-pools.ts index 4572a87eb..41f80c4b6 100644 --- a/src/routers/alpha-router/functions/get-candidate-pools.ts +++ b/src/routers/alpha-router/functions/get-candidate-pools.ts @@ -11,7 +11,7 @@ import { USDC_OPTIMISM_SEPOLIA, USDT_OPTIMISM_SEPOLIA, V2SubgraphPool, - WBTC_OPTIMISM_SEPOLIA, + WBTC_OPTIMISM_SEPOLIA } from '../../../providers'; import { CELO, @@ -31,6 +31,7 @@ import { DAI_SEPOLIA, FEI_MAINNET, ITokenProvider, + USDB_BLAST, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, USDC_AVAX, @@ -185,6 +186,7 @@ const baseTokensByChain: { [chainId in ChainId]?: Token[] } = { [ChainId.BNB]: [DAI_BNB, USDC_BNB, USDT_BNB], [ChainId.AVALANCHE]: [DAI_AVAX, USDC_AVAX], [ChainId.BASE]: [USDC_BASE], + [ChainId.BLAST]: [WRAPPED_NATIVE_CURRENCY[ChainId.BLAST]!, USDB_BLAST], }; class SubcategorySelectionPools { diff --git a/src/routers/alpha-router/gas-models/gas-model.ts b/src/routers/alpha-router/gas-models/gas-model.ts index 0362d36cc..628a8e05e 100644 --- a/src/routers/alpha-router/gas-models/gas-model.ts +++ b/src/routers/alpha-router/gas-models/gas-model.ts @@ -20,7 +20,7 @@ import { DAI_OPTIMISM_GOERLI, DAI_OPTIMISM_SEPOLIA, DAI_POLYGON_MUMBAI, - DAI_SEPOLIA, + DAI_SEPOLIA, USDB_BLAST, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, USDC_ARBITRUM_SEPOLIA, @@ -52,13 +52,12 @@ import { USDT_OPTIMISM, USDT_OPTIMISM_GOERLI, USDT_OPTIMISM_SEPOLIA, - WBTC_GOERLI, + WBTC_GOERLI } from '../../../providers/token-provider'; import { IV2PoolProvider } from '../../../providers/v2/pool-provider'; import { ArbitrumGasData, IL2GasDataProvider, - OptimismGasData, } from '../../../providers/v3/gas-data-provider'; import { WRAPPED_NATIVE_CURRENCY } from '../../../util'; import { CurrencyAmount } from '../../../util/amounts'; @@ -114,6 +113,7 @@ export const usdGasTokensByChain: { [chainId in ChainId]?: Token[] } = { USDC_BRIDGED_AVAX, ], [ChainId.BASE]: [USDC_BASE, USDC_NATIVE_BASE], + [ChainId.BLAST]: [USDB_BLAST], }; export type L1ToL2GasCosts = { @@ -139,9 +139,7 @@ export type BuildOnChainGasModelFactoryType = { amountToken: Token; quoteToken: Token; v2poolProvider: IV2PoolProvider; - l2GasDataProvider?: - | IL2GasDataProvider - | IL2GasDataProvider; + l2GasDataProvider?: IL2GasDataProvider; providerConfig?: GasModelProviderConfig; }; @@ -150,9 +148,7 @@ export type BuildV2GasModelFactoryType = { gasPriceWei: BigNumber; poolProvider: IV2PoolProvider; token: Token; - l2GasDataProvider?: - | IL2GasDataProvider - | IL2GasDataProvider; + l2GasDataProvider?: IL2GasDataProvider; providerConfig?: GasModelProviderConfig; }; diff --git a/src/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.ts b/src/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.ts index 3d11c0edc..975a1b862 100644 --- a/src/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.ts +++ b/src/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.ts @@ -20,6 +20,7 @@ import { IV2GasModelFactory, usdGasTokensByChain, } from '../gas-model'; +import { BaseProvider } from '@ethersproject/providers'; // Constant cost for doing any swap regardless of pools. export const BASE_SWAP_COST = BigNumber.from(135000); // 115000, bumped up by 20_000 @eric 7/8/2022 @@ -45,8 +46,11 @@ export const COST_PER_EXTRA_HOP = BigNumber.from(50000); // 20000, bumped up by * @class V2HeuristicGasModelFactory */ export class V2HeuristicGasModelFactory extends IV2GasModelFactory { - constructor() { + private provider: BaseProvider; + + constructor(provider: BaseProvider) { super(); + this.provider = provider; } public async buildGasModel({ @@ -117,6 +121,7 @@ export class V2HeuristicGasModelFactory extends IV2GasModelFactory { usdPool, token, nativePool, + this.provider, l2GasData ); }; 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 c70aaa1db..3588ae4a3 100644 --- a/src/routers/alpha-router/gas-models/v3/gas-costs.ts +++ b/src/routers/alpha-router/gas-models/v3/gas-costs.ts @@ -20,6 +20,10 @@ export const BASE_SWAP_COST = (id: ChainId): BigNumber => { case ChainId.AVALANCHE: case ChainId.BASE: case ChainId.BASE_GOERLI: + case ChainId.ZORA: + case ChainId.ZORA_SEPOLIA: + case ChainId.ROOTSTOCK: + case ChainId.BLAST: return BigNumber.from(2000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: @@ -53,6 +57,10 @@ export const COST_PER_INIT_TICK = (id: ChainId): BigNumber => { case ChainId.OPTIMISM_SEPOLIA: case ChainId.BASE: case ChainId.BASE_GOERLI: + case ChainId.ZORA: + case ChainId.ZORA_SEPOLIA: + case ChainId.ROOTSTOCK: + case ChainId.BLAST: return BigNumber.from(31000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: @@ -83,6 +91,10 @@ export const COST_PER_HOP = (id: ChainId): BigNumber => { case ChainId.AVALANCHE: case ChainId.BASE: case ChainId.BASE_GOERLI: + case ChainId.ZORA: + case ChainId.ZORA_SEPOLIA: + case ChainId.ROOTSTOCK: + case ChainId.BLAST: return BigNumber.from(80000); case ChainId.ARBITRUM_ONE: case ChainId.ARBITRUM_GOERLI: diff --git a/src/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.ts b/src/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.ts index 539e1f1ac..d091c8697 100644 --- a/src/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.ts +++ b/src/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.ts @@ -24,6 +24,7 @@ import { SINGLE_HOP_OVERHEAD, TOKEN_OVERHEAD, } from './gas-costs'; +import { BaseProvider } from '@ethersproject/providers'; /** * Computes a gas estimate for a V3 swap using heuristics. @@ -44,8 +45,11 @@ import { * @class V3HeuristicGasModelFactory */ export class V3HeuristicGasModelFactory extends IOnChainGasModelFactory { - constructor() { + private provider: BaseProvider; + + constructor(provider: BaseProvider) { super(); + this.provider = provider; } public async buildGasModel({ @@ -79,6 +83,7 @@ export class V3HeuristicGasModelFactory extends IOnChainGasModelFactory { usdPool, quoteToken, pools.nativeAndQuoteTokenV3Pool, + this.provider, l2GasData ); }; diff --git a/src/routers/alpha-router/quoters/v2-quoter.ts b/src/routers/alpha-router/quoters/v2-quoter.ts index 500a7b85b..ba232bcda 100644 --- a/src/routers/alpha-router/quoters/v2-quoter.ts +++ b/src/routers/alpha-router/quoters/v2-quoter.ts @@ -33,7 +33,6 @@ import { NATIVE_OVERHEAD } from '../gas-models/v3/gas-costs'; import { ArbitrumGasData, IL2GasDataProvider, - OptimismGasData, } from '../../../providers/v3/gas-data-provider'; import { BaseQuoter } from './base-quoter'; import { GetQuotesResult } from './model/results/get-quotes-result'; @@ -44,9 +43,7 @@ export class V2Quoter extends BaseQuoter { protected v2PoolProvider: IV2PoolProvider; protected v2QuoteProvider: IV2QuoteProvider; protected v2GasModelFactory: IV2GasModelFactory; - protected l2GasDataProvider?: - | IL2GasDataProvider - | IL2GasDataProvider; + protected l2GasDataProvider?: IL2GasDataProvider; constructor( v2SubgraphProvider: IV2SubgraphProvider, @@ -57,9 +54,7 @@ export class V2Quoter extends BaseQuoter { chainId: ChainId, blockedTokenListProvider?: ITokenListProvider, tokenValidatorProvider?: ITokenValidatorProvider, - l2GasDataProvider?: - | IL2GasDataProvider - | IL2GasDataProvider + l2GasDataProvider?: IL2GasDataProvider ) { super( tokenProvider, diff --git a/src/routers/legacy-router/bases.ts b/src/routers/legacy-router/bases.ts index 636cbcc50..388ed8d74 100644 --- a/src/routers/legacy-router/bases.ts +++ b/src/routers/legacy-router/bases.ts @@ -7,7 +7,7 @@ import { DAI_AVAX, DAI_BNB, DAI_MAINNET, - ITokenProvider, + ITokenProvider, USDB_BLAST, USDC_AVAX, USDC_BASE, USDC_BNB, @@ -16,7 +16,7 @@ import { USDT_MAINNET, WBTC_MAINNET, WMATIC_POLYGON, - WMATIC_POLYGON_MUMBAI, + WMATIC_POLYGON_MUMBAI } from '../../providers/token-provider'; import { WRAPPED_NATIVE_CURRENCY } from '../../util/chains'; @@ -72,6 +72,10 @@ export const BASES_TO_CHECK_TRADES_AGAINST = ( ], [ChainId.BASE]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE]!, USDC_BASE], [ChainId.BASE_GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.BASE_GOERLI]!], + [ChainId.ZORA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA]!], + [ChainId.ZORA_SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.ZORA_SEPOLIA]!], + [ChainId.ROOTSTOCK]: [WRAPPED_NATIVE_CURRENCY[ChainId.ROOTSTOCK]!], + [ChainId.BLAST]: [WRAPPED_NATIVE_CURRENCY[ChainId.BLAST]!, USDB_BLAST], }; }; diff --git a/src/util/addresses.ts b/src/util/addresses.ts index 248d72642..8b46b41bb 100644 --- a/src/util/addresses.ts +++ b/src/util/addresses.ts @@ -1,4 +1,4 @@ -import { ChainId, CHAIN_TO_ADDRESSES_MAP, Token } from '@uniswap/sdk-core'; +import { CHAIN_TO_ADDRESSES_MAP, ChainId, SWAP_ROUTER_02_ADDRESSES as SWAP_ROUTER_02_ADDRESSES_HELPER, Token } from '@uniswap/sdk-core'; import { FACTORY_ADDRESS } from '@uniswap/v3-sdk'; import { NETWORKS_WITH_SAME_UNISWAP_ADDRESSES } from './chains'; @@ -34,6 +34,7 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = { CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].v3CoreFactoryAddress, [ChainId.BASE]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE].v3CoreFactoryAddress, [ChainId.BASE_SEPOLIA]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_SEPOLIA].v3CoreFactoryAddress, + [ChainId.BLAST]: CHAIN_TO_ADDRESSES_MAP[ChainId.BLAST].v3CoreFactoryAddress, // TODO: Gnosis + Moonbeam contracts to be deployed }; @@ -57,9 +58,17 @@ export const QUOTER_V2_ADDRESSES: AddressMap = { CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].quoterAddress, [ChainId.BASE]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE].quoterAddress, [ChainId.BASE_SEPOLIA]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_SEPOLIA].quoterAddress, + [ChainId.BLAST]: CHAIN_TO_ADDRESSES_MAP[ChainId.BLAST].quoterAddress, // TODO: Gnosis + Moonbeam contracts to be deployed }; +export const NEW_QUOTER_V2_ADDRESSES: AddressMap = { + ...constructSameAddressMap('0x61fFE014bA17989E743c5F6cB21bF9697530B21e'), + [ChainId.POLYGON_MUMBAI]: '0x60e06b92bC94a665036C26feC5FF2A92E2d04c5f', + [ChainId.SEPOLIA]: '0x6650ab818c0a7efa72fc1404a878fef1fec8e058', + [ChainId.MAINNET]: '0x5e55C9e631FAE526cd4B0526C4818D6e0a9eF0e3' +}; + export const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap = { [ChainId.MAINNET]: CHAIN_TO_ADDRESSES_MAP[ChainId.MAINNET].v1MixedRouteQuoterAddress, @@ -88,14 +97,12 @@ export const UNISWAP_MULTICALL_ADDRESSES: AddressMap = { CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_GOERLI].multicallAddress, [ChainId.BASE]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE].multicallAddress, [ChainId.BASE_SEPOLIA]: CHAIN_TO_ADDRESSES_MAP[ChainId.BASE_SEPOLIA].multicallAddress, + [ChainId.BLAST]: CHAIN_TO_ADDRESSES_MAP[ChainId.BLAST].multicallAddress, // TODO: Gnosis + Moonbeam contracts to be deployed }; -export const SWAP_ROUTER_02_ADDRESSES = (chainId: number): string => { - if (chainId == ChainId.BNB) { - return BNB_SWAP_ROUTER_02_ADDRESS; - } - return '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45'; +export const SWAP_ROUTER_02_ADDRESSES= (chainId: number): string => { + return SWAP_ROUTER_02_ADDRESSES_HELPER(chainId) ?? '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45'; }; export const OVM_GASPRICE_ADDRESS = @@ -136,6 +143,10 @@ export const WETH9: { | ChainId.MOONBEAM | ChainId.BNB | ChainId.AVALANCHE + // TODO: remove ROOTSTOCK, ZORA and ZORA_SEPOLIA once we support both at the routing level + | ChainId.ROOTSTOCK + | ChainId.ZORA + | ChainId.ZORA_SEPOLIA >]: Token; } = { [ChainId.MAINNET]: new Token( @@ -222,6 +233,13 @@ export const WETH9: { 'WETH', 'Wrapped Ether' ), + [ChainId.BLAST]: new Token( + ChainId.BLAST, + '0x4300000000000000000000000000000000000004', + 18, + 'WETH', + 'Wrapped Ether' + ) }; export const BEACON_CHAIN_DEPOSIT_ADDRESS = diff --git a/src/util/chains.ts b/src/util/chains.ts index cac908199..ef4572df8 100644 --- a/src/util/chains.ts +++ b/src/util/chains.ts @@ -17,19 +17,18 @@ export const SUPPORTED_CHAINS: ChainId[] = [ ChainId.ARBITRUM_SEPOLIA, ChainId.POLYGON, ChainId.POLYGON_MUMBAI, - ChainId.GOERLI, ChainId.SEPOLIA, ChainId.CELO_ALFAJORES, ChainId.CELO, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE, + ChainId.BLAST, // Gnosis and Moonbeam don't yet have contracts deployed yet ]; export const V2_SUPPORTED = [ ChainId.MAINNET, - ChainId.GOERLI, ChainId.SEPOLIA, ChainId.ARBITRUM_ONE, ChainId.OPTIMISM, @@ -48,6 +47,7 @@ export const HAS_L1_FEE = [ ChainId.ARBITRUM_SEPOLIA, ChainId.BASE, ChainId.BASE_GOERLI, + ChainId.BLAST, ]; export const NETWORKS_WITH_SAME_UNISWAP_ADDRESSES = [ @@ -99,6 +99,8 @@ export const ID_TO_CHAIN_ID = (id: number): ChainId => { return ChainId.BASE; case 84531: return ChainId.BASE_GOERLI; + case 81457: + return ChainId.BLAST; default: throw new Error(`Unknown chain id: ${id}`); } @@ -124,6 +126,7 @@ export enum ChainName { AVALANCHE = 'avalanche-mainnet', BASE = 'base-mainnet', BASE_GOERLI = 'base-goerli', + BLAST = 'blast-mainnet', } export enum NativeCurrencyName { @@ -203,6 +206,11 @@ export const NATIVE_NAMES_BY_ID: { [chainId: number]: string[] } = { 'ETHER', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', ], + [ChainId.BLAST]: [ + 'ETH', + 'ETHER', + '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + ], }; export const NATIVE_CURRENCY: { [chainId: number]: NativeCurrencyName } = { @@ -224,6 +232,7 @@ export const NATIVE_CURRENCY: { [chainId: number]: NativeCurrencyName } = { [ChainId.BNB]: NativeCurrencyName.BNB, [ChainId.AVALANCHE]: NativeCurrencyName.AVALANCHE, [ChainId.BASE]: NativeCurrencyName.ETHER, + [ChainId.BLAST]: NativeCurrencyName.ETHER, }; export const ID_TO_NETWORK_NAME = (id: number): ChainName => { @@ -266,6 +275,8 @@ export const ID_TO_NETWORK_NAME = (id: number): ChainName => { return ChainName.BASE; case 84531: return ChainName.BASE_GOERLI; + case 81457: + return ChainName.BLAST; default: throw new Error(`Unknown chain id: ${id}`); } @@ -309,6 +320,8 @@ export const ID_TO_PROVIDER = (id: ChainId): string => { return process.env.JSON_RPC_PROVIDER_AVALANCHE!; case ChainId.BASE: return process.env.JSON_RPC_PROVIDER_BASE!; + case ChainId.BLAST: + return process.env.JSON_RPC_PROVIDER_BLAST!; default: throw new Error(`Chain id: ${id} not supported`); } @@ -450,6 +463,34 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId in ChainId]: Token } = { 'WETH', 'Wrapped Ether' ), + [ChainId.ROOTSTOCK]: new Token( + ChainId.ROOTSTOCK, + '0x542fDA317318eBF1d3DEAf76E0b632741A7e677d', + 18, + 'WRBTC', + 'Wrapped BTC' + ), + [ChainId.ZORA]: new Token( + ChainId.ZORA, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.ZORA_SEPOLIA]: new Token( + ChainId.ZORA_SEPOLIA, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.BLAST]: new Token( + ChainId.BLAST, + '0x4300000000000000000000000000000000000004', + 18, + 'WETH', + 'Wrapped Ether' + ), }; function isMatic( diff --git a/src/util/gas-factory-helpers.ts b/src/util/gas-factory-helpers.ts index d7da98a24..fe3711688 100644 --- a/src/util/gas-factory-helpers.ts +++ b/src/util/gas-factory-helpers.ts @@ -9,8 +9,7 @@ import _ from 'lodash'; import { IV2PoolProvider } from '../providers'; import { IPortionProvider } from '../providers/portion-provider'; import { - ArbitrumGasData, - OptimismGasData, + ArbitrumGasData } from '../providers/v3/gas-data-provider'; import { IV3PoolProvider } from '../providers/v3/pool-provider'; import { @@ -32,6 +31,8 @@ import { CurrencyAmount, log, WRAPPED_NATIVE_CURRENCY } from '../util'; import { Pair } from '@uniswap/v2-sdk'; import { opStackChains } from './l2FeeChains'; import { buildSwapMethodParameters, buildTrade } from './methodParameters'; +import { estimateL1Gas, estimateL1GasCost } from '@eth-optimism/sdk'; +import { BaseProvider, TransactionRequest } from '@ethersproject/providers'; export async function getV2NativePool( token: Token, @@ -214,33 +215,29 @@ export function calculateArbitrumToL1FeeFromCalldata( ): [BigNumber, BigNumber, BigNumber] { const { perL2TxFee, perL1CalldataFee, perArbGasTotal } = gasData; // calculates gas amounts based on bytes of calldata, use 0 as overhead. - const l1GasUsed = getL2ToL1GasUsed(calldata, BigNumber.from(0), chainId); + const l1GasUsed = getL2ToL1GasUsed(calldata, chainId); // multiply by the fee per calldata and add the flat l2 fee const l1Fee = l1GasUsed.mul(perL1CalldataFee).add(perL2TxFee); const gasUsedL1OnL2 = l1Fee.div(perArbGasTotal); return [l1GasUsed, l1Fee, gasUsedL1OnL2]; } -export function calculateOptimismToL1FeeFromCalldata( +export async function calculateOptimismToL1FeeFromCalldata( calldata: string, - gasData: OptimismGasData, - chainId: ChainId -): [BigNumber, BigNumber] { - const { l1BaseFee, scalar, decimals, overhead } = gasData; - - const l1GasUsed = getL2ToL1GasUsed(calldata, overhead, chainId); - // l1BaseFee is L1 Gas Price on etherscan - const l1Fee = l1GasUsed.mul(l1BaseFee); - const unscaled = l1Fee.mul(scalar); - // scaled = unscaled / (10 ** decimals) - const scaledConversion = BigNumber.from(10).pow(decimals); - const scaled = unscaled.div(scaledConversion); - return [l1GasUsed, scaled]; + chainId: ChainId, + provider: BaseProvider +): Promise<[BigNumber, BigNumber]> { + const tx: TransactionRequest = { + data: calldata, + chainId: chainId, + type: 2 // sign the transaction as EIP-1559, otherwise it will fail at maxFeePerGas + } + const [l1GasUsed, l1GasCost] = await Promise.all([estimateL1Gas(provider, tx), estimateL1GasCost(provider, tx)]); + return [l1GasUsed, l1GasCost]; } export function getL2ToL1GasUsed( data: string, - overhead: BigNumber, chainId: ChainId ): BigNumber { switch (chainId) { @@ -250,27 +247,6 @@ export function getL2ToL1GasUsed( const l1ByteUsed = getArbitrumBytes(data); return l1ByteUsed.mul(16); } - case ChainId.OPTIMISM: - case ChainId.OPTIMISM_GOERLI: - case ChainId.BASE: - case ChainId.BASE_GOERLI: { - // based on the code from the optimism OVM_GasPriceOracle contract - // data is hex encoded - const dataArr: string[] = data.slice(2).match(/.{1,2}/g)!; - const numBytes = dataArr.length; - let count = 0; - for (let i = 0; i < numBytes; i += 1) { - const byte = parseInt(dataArr[i]!, 16); - if (byte == 0) { - count += 4; - } else { - count += 16; - } - } - const unsigned = overhead.add(count); - const signedConversion = 68 * 16; - return unsigned.add(signedConversion); - } default: return BigNumber.from(0); } @@ -282,13 +258,13 @@ export async function calculateGasUsed( simulatedGasUsed: BigNumber, v2PoolProvider: IV2PoolProvider, v3PoolProvider: IV3PoolProvider, - l2GasData?: ArbitrumGasData | OptimismGasData, + provider: BaseProvider, providerConfig?: GasModelProviderConfig ): Promise<{ estimatedGasUsedUSD: CurrencyAmount; estimatedGasUsedQuoteToken: CurrencyAmount; estimatedGasUsedGasToken?: CurrencyAmount; - quoteGasAdjusted: CurrencyAmount; + quoteGasAdjusted: CurrencyAmount }> { const quoteToken = route.quote.currency.wrapped; const gasPriceWei = route.gasPriceWei; @@ -296,19 +272,12 @@ export async function calculateGasUsed( let l2toL1FeeInWei = BigNumber.from(0); // Arbitrum charges L2 gas for L1 calldata posting costs. // See https://github.com/Uniswap/smart-order-router/pull/464/files#r1441376802 - if ( - [ - ChainId.OPTIMISM, - ChainId.OPTIMISM_GOERLI, - ChainId.BASE, - ChainId.BASE_GOERLI, - ].includes(chainId) - ) { - l2toL1FeeInWei = calculateOptimismToL1FeeFromCalldata( + if (opStackChains.includes(chainId)) { + l2toL1FeeInWei = (await calculateOptimismToL1FeeFromCalldata( route.methodParameters!.calldata, - l2GasData as OptimismGasData, - chainId - )[1]; + chainId, + provider + ))[1]; } // add l2 to l1 fee and wrap fee to native currency @@ -554,7 +523,8 @@ export const calculateL1GasFeesHelper = async ( usdPool: Pair | Pool, quoteToken: Token, nativePool: Pair | Pool | null, - l2GasData?: ArbitrumGasData | OptimismGasData + provider: BaseProvider, + l2GasData?: ArbitrumGasData ): Promise<{ gasUsedL1: BigNumber; gasUsedL1OnL2: BigNumber; @@ -571,12 +541,7 @@ export const calculateL1GasFeesHelper = async ( let mainnetFeeInWei = BigNumber.from(0); let gasUsedL1OnL2 = BigNumber.from(0); if (opStackChains.includes(chainId)) { - [mainnetGasUsed, mainnetFeeInWei] = calculateOptimismToL1SecurityFee( - route, - swapOptions, - l2GasData as OptimismGasData, - chainId - ); + [mainnetGasUsed, mainnetFeeInWei] = await calculateOptimismToL1SecurityFee(route, swapOptions, chainId, provider); } else if ( chainId == ChainId.ARBITRUM_ONE || chainId == ChainId.ARBITRUM_GOERLI @@ -633,14 +598,12 @@ export const calculateL1GasFeesHelper = async ( * To avoid having a call to optimism's L1 security fee contract for every route and amount combination, * we replicate the gas cost accounting here. */ - function calculateOptimismToL1SecurityFee( + async function calculateOptimismToL1SecurityFee( routes: RouteWithValidQuote[], swapConfig: SwapOptionsUniversalRouter, - gasData: OptimismGasData, - chainId: ChainId - ): [BigNumber, BigNumber] { - const { l1BaseFee, scalar, decimals, overhead } = gasData; - + chainId: ChainId, + provider: BaseProvider + ): Promise<[BigNumber, BigNumber]> { const route: RouteWithValidQuote = routes[0]!; const amountToken = route.tradeType == TradeType.EXACT_INPUT @@ -658,14 +621,9 @@ export const calculateL1GasFeesHelper = async ( swapConfig, ChainId.OPTIMISM ).calldata; - const l1GasUsed = getL2ToL1GasUsed(data, overhead, chainId); - // l1BaseFee is L1 Gas Price on etherscan - const l1Fee = l1GasUsed.mul(l1BaseFee); - const unscaled = l1Fee.mul(scalar); - // scaled = unscaled / (10 ** decimals) - const scaledConversion = BigNumber.from(10).pow(decimals); - const scaled = unscaled.div(scaledConversion); - return [l1GasUsed, scaled]; + + const [l1GasUsed, l1GasCost] = await calculateOptimismToL1FeeFromCalldata(data, chainId, provider); + return [l1GasUsed, l1GasCost]; } function calculateArbitrumToL1SecurityFee( diff --git a/src/util/l2FeeChains.ts b/src/util/l2FeeChains.ts index fba351c3d..87f7f6e43 100644 --- a/src/util/l2FeeChains.ts +++ b/src/util/l2FeeChains.ts @@ -6,4 +6,5 @@ export const opStackChains = [ ChainId.OPTIMISM_SEPOLIA, ChainId.BASE, ChainId.BASE_GOERLI, + ChainId.BLAST, ]; diff --git a/src/util/onchainQuoteProviderConfigs.ts b/src/util/onchainQuoteProviderConfigs.ts new file mode 100644 index 000000000..927712a69 --- /dev/null +++ b/src/util/onchainQuoteProviderConfigs.ts @@ -0,0 +1,144 @@ +import { ChainId } from '@uniswap/sdk-core'; + +import { + BatchParams, + BlockNumberConfig, + FailureOverrides, + QuoteRetryOptions +} from '../providers'; + +export const NETWORKS_WITH_SAME_RETRY_OPTIONS = [ChainId.POLYGON]; + +export function constructSameRetryOptionsMap( + retryOptions: T, + additionalNetworks: ChainId[] = [] +): { [chainId: number]: T } { + return NETWORKS_WITH_SAME_RETRY_OPTIONS.concat(additionalNetworks).reduce<{ + [chainId: number]: T; + }>((memo, chainId) => { + memo[chainId] = retryOptions; + return memo; + }, {}); +} + +export const DEFAULT_RETRY_OPTIONS: QuoteRetryOptions = { + retries: 2, + minTimeout: 100, + maxTimeout: 1000, +}; + +export const RETRY_OPTIONS = { + ...constructSameRetryOptionsMap(DEFAULT_RETRY_OPTIONS), +}; + +export const NETWORKS_WITH_SAME_BATCH_PARAMS = [ChainId.POLYGON]; + +export function constructSameBatchParamsMap( + batchParams: T, + additionalNetworks: ChainId[] = [] +): { [chainId: number]: T } { + return NETWORKS_WITH_SAME_BATCH_PARAMS.concat(additionalNetworks).reduce<{ + [chainId: number]: T; + }>((memo, chainId) => { + memo[chainId] = batchParams; + return memo; + }, {}); +} + +export const DEFAULT_BATCH_PARAMS: BatchParams = { + multicallChunk: 210, + gasLimitPerCall: 705_000, + quoteMinSuccessRate: 0.15, +}; + +export const BATCH_PARAMS = { + ...constructSameBatchParamsMap(DEFAULT_BATCH_PARAMS), +}; + +export const NETWORKS_WITH_SAME_GAS_ERROR_FAILURE_OVERRIDES = [ChainId.POLYGON]; + +export function constructSameGasErrorFailureOverridesMap< + T extends FailureOverrides +>( + gasErrorFailureOverrides: T, + additionalNetworks: ChainId[] = [] +): { [chainId: number]: T } { + return NETWORKS_WITH_SAME_GAS_ERROR_FAILURE_OVERRIDES.concat( + additionalNetworks + ).reduce<{ + [chainId: number]: T; + }>((memo, chainId) => { + memo[chainId] = gasErrorFailureOverrides; + return memo; + }, {}); +} + +export const DEFAULT_GAS_ERROR_FAILURE_OVERRIDES: FailureOverrides = { + gasLimitOverride: 2_000_000, + multicallChunk: 70, +}; + +export const GAS_ERROR_FAILURE_OVERRIDES = { + ...constructSameGasErrorFailureOverridesMap( + DEFAULT_GAS_ERROR_FAILURE_OVERRIDES + ), +}; + +export const NETWORKS_WITH_SAME_SUCCESS_RATE_FAILURE_OVERRIDES = [ + ChainId.POLYGON, +]; + +export function constructSameSuccessRateFailureOverridesMap< + T extends FailureOverrides +>( + successRateFailureOverrides: T, + additionalNetworks: ChainId[] = [] +): { [chainId: number]: T } { + return NETWORKS_WITH_SAME_SUCCESS_RATE_FAILURE_OVERRIDES.concat( + additionalNetworks + ).reduce<{ + [chainId: number]: T; + }>((memo, chainId) => { + memo[chainId] = successRateFailureOverrides; + return memo; + }, {}); +} + +export const DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES: FailureOverrides = +{ + gasLimitOverride: 1_300_000, + multicallChunk: 110, +}; + +export const SUCCESS_RATE_FAILURE_OVERRIDES = { + ...constructSameSuccessRateFailureOverridesMap( + DEFAULT_SUCCESS_RATE_FAILURE_OVERRIDES + ), +}; + +export const NETWORKS_WITH_SAME_BLOCK_NUMBER_CONFIGS = [ChainId.POLYGON]; + +export function constructSameBlockNumberConfigsMap( + blockNumberConfigs: T, + additionalNetworks: ChainId[] = [] +): { [chainId: number]: T } { + return NETWORKS_WITH_SAME_BLOCK_NUMBER_CONFIGS.concat( + additionalNetworks + ).reduce<{ + [chainId: number]: T; + }>((memo, chainId) => { + memo[chainId] = blockNumberConfigs; + return memo; + }, {}); +} + +export const DEFAULT_BLOCK_NUMBER_CONFIGS: BlockNumberConfig = { + baseBlockOffset: 0, + rollback: { enabled: false }, +}; + +export const BLOCK_NUMBER_CONFIGS = { + ...constructSameBlockNumberConfigsMap( + DEFAULT_BLOCK_NUMBER_CONFIGS + ), +}; diff --git a/test/integ/routers/alpha-router/alpha-router.integration.test.ts b/test/integ/routers/alpha-router/alpha-router.integration.test.ts index 4414f348d..857e103d5 100644 --- a/test/integ/routers/alpha-router/alpha-router.integration.test.ts +++ b/test/integ/routers/alpha-router/alpha-router.integration.test.ts @@ -20,7 +20,9 @@ import { PERMIT2_ADDRESS, UNIVERSAL_ROUTER_ADDRESS as UNIVERSAL_ROUTER_ADDRESS_BY_CHAIN } from '@uniswap/universal-router-sdk'; -import { Permit2Permit } from '@uniswap/universal-router-sdk/dist/utils/inputTokens'; +import { + Permit2Permit +} from '@uniswap/universal-router-sdk/dist/utils/inputTokens'; import { Pair } from '@uniswap/v2-sdk'; import { encodeSqrtRatioX96, FeeAmount, Pool } from '@uniswap/v3-sdk'; import bunyan from 'bunyan'; @@ -64,11 +66,15 @@ import { UNI_GOERLI, UNI_MAINNET, UniswapMulticallProvider, + USDB_BLAST, USDC_BNB, USDC_ETHEREUM_GNOSIS, USDC_MAINNET, USDC_NATIVE_ARBITRUM, + USDC_NATIVE_AVAX, + USDC_NATIVE_BASE, USDC_NATIVE_OPTIMISM, + USDC_NATIVE_POLYGON, USDC_ON, USDT_BNB, USDT_MAINNET, @@ -81,10 +87,7 @@ import { WBTC_MOONBEAM, WETH9, WNATIVE_ON, - WRAPPED_NATIVE_CURRENCY, - USDC_NATIVE_POLYGON, - USDC_NATIVE_BASE, - USDC_NATIVE_AVAX + WRAPPED_NATIVE_CURRENCY } from '../../../../src'; import { PortionProvider } from '../../../../src/providers/portion-provider'; import { @@ -106,9 +109,7 @@ import { } from '../../../test-util/mock-data'; import { WHALES } from '../../../test-util/whales'; -// TODO: this should be at a later block that's aware of universal router v1.3 0x3F6328669a86bef431Dc6F9201A5B90F7975a023 deployed at block 18222746. We can use later block, e.g. at block 18318644 -// TODO: permit-related tests will fail during hardfork swap execution when changing to later block. Investigate why. -const FORK_BLOCK = 19022742; +const FORK_BLOCK = 19472074; const UNIVERSAL_ROUTER_ADDRESS = UNIVERSAL_ROUTER_ADDRESS_BY_CHAIN(1); const SLIPPAGE = new Percent(15, 100); // 5% or 10_000? const LARGE_SLIPPAGE = new Percent(45, 100); // 5% or 10_000? @@ -116,7 +117,7 @@ const LARGE_SLIPPAGE = new Percent(45, 100); // 5% or 10_000? // Those are the worst deviation (we intend to keep them low and strict) tested manually with FORK_BLOCK = 18222746 // We may need to tune them if we change the FORK_BLOCK const GAS_ESTIMATE_DEVIATION_PERCENT: { [chainId in ChainId]: number } = { - [ChainId.MAINNET]: 35, + [ChainId.MAINNET]: 40, [ChainId.GOERLI]: 62, [ChainId.SEPOLIA]: 50, [ChainId.OPTIMISM]: 35, @@ -135,6 +136,10 @@ const GAS_ESTIMATE_DEVIATION_PERCENT: { [chainId in ChainId]: number } = { [ChainId.AVALANCHE]: 36, [ChainId.BASE]: 34, [ChainId.BASE_GOERLI]: 30, + [ChainId.ZORA]: 30, + [ChainId.ZORA_SEPOLIA]: 30, + [ChainId.ROOTSTOCK]: 30, + [ChainId.BLAST]: 34, } const V2_SUPPORTED_PAIRS = [ @@ -3320,6 +3325,10 @@ describe('quote for other networks', () => { [ChainId.BASE]: () => USDC_ON(ChainId.BASE), [ChainId.BASE]: () => USDC_NATIVE_BASE, [ChainId.BASE_GOERLI]: () => USDC_ON(ChainId.BASE_GOERLI), + [ChainId.ZORA]: () => USDC_ON(ChainId.ZORA), + [ChainId.ZORA_SEPOLIA]: () => USDC_ON(ChainId.ZORA_SEPOLIA), + [ChainId.ROOTSTOCK]: () => USDC_ON(ChainId.ROOTSTOCK), + [ChainId.BLAST]: () => USDB_BLAST, }; const TEST_ERC20_2: { [chainId in ChainId]: () => Token } = { [ChainId.MAINNET]: () => DAI_ON(1), @@ -3341,6 +3350,10 @@ describe('quote for other networks', () => { [ChainId.AVALANCHE]: () => DAI_ON(ChainId.AVALANCHE), [ChainId.BASE]: () => WNATIVE_ON(ChainId.BASE), [ChainId.BASE_GOERLI]: () => WNATIVE_ON(ChainId.BASE_GOERLI), + [ChainId.ZORA]: () => WNATIVE_ON(ChainId.ZORA), + [ChainId.ZORA_SEPOLIA]: () => WNATIVE_ON(ChainId.ZORA_SEPOLIA), + [ChainId.ROOTSTOCK]: () => WNATIVE_ON(ChainId.ROOTSTOCK), + [ChainId.BLAST]: () => WNATIVE_ON(ChainId.BLAST), }; // TODO: Find valid pools/tokens on optimistic kovan and polygon mumbai. We skip those tests for now. @@ -3354,7 +3367,9 @@ describe('quote for other networks', () => { c != ChainId.ARBITRUM_SEPOLIA && // Tests are failing https://github.com/Uniswap/smart-order-router/issues/104 c != ChainId.CELO_ALFAJORES && - c != ChainId.SEPOLIA + c != ChainId.ZORA && + c != ChainId.ZORA_SEPOLIA && + c != ChainId.ROOTSTOCK )) { for (const tradeType of [TradeType.EXACT_INPUT, TradeType.EXACT_OUTPUT]) { const erc1 = TEST_ERC20_1[chain](); @@ -3485,12 +3500,20 @@ describe('quote for other networks', () => { }); it(`erc20 -> erc20`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + const tokenIn = erc1; const tokenOut = erc2; + + // Current WETH/USDB pool (https://blastscan.io/address/0xf52b4b69123cbcf07798ae8265642793b2e8990c) has low WETH amount + const exactOutAmount = chain === ChainId.BLAST ? '0.002' : '1'; const amount = tradeType == TradeType.EXACT_INPUT ? parseAmount('1', tokenIn) - : parseAmount('1', tokenOut); + : parseAmount(exactOutAmount, tokenOut); const swap = await alphaRouter.route( amount, @@ -3510,6 +3533,16 @@ describe('quote for other networks', () => { const native = NATIVE_CURRENCY[chain]; it(`${native} -> erc20`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + + if (chain == ChainId.BLAST) { + // Blast doesn't have DAI or USDC yet + return; + } + const tokenIn = nativeOnChain(chain); // TODO ROUTE-64: Remove this once smart-order-router supports ETH native currency on BASE // see https://uniswapteam.slack.com/archives/C021SU4PMR7/p1691593679108459?thread_ts=1691532336.742419&cid=C021SU4PMR7 @@ -3543,12 +3576,20 @@ describe('quote for other networks', () => { }); it(`has quoteGasAdjusted values`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + const tokenIn = erc1; const tokenOut = erc2; + + // Current WETH/USDB pool (https://blastscan.io/address/0xf52b4b69123cbcf07798ae8265642793b2e8990c) has low WETH amount + const exactOutAmount = chain === ChainId.BLAST ? '0.002' : '1'; const amount = tradeType == TradeType.EXACT_INPUT ? parseAmount('1', tokenIn) - : parseAmount('1', tokenOut); + : parseAmount(exactOutAmount, tokenOut); const swap = await alphaRouter.route( amount, @@ -3576,12 +3617,20 @@ describe('quote for other networks', () => { }); it(`does not error when protocols array is empty`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + const tokenIn = erc1; const tokenOut = erc2; + + // Current WETH/USDB pool (https://blastscan.io/address/0xf52b4b69123cbcf07798ae8265642793b2e8990c) has low WETH amount + const exactOutAmount = chain === ChainId.BLAST ? '0.002' : '1'; const amount = tradeType == TradeType.EXACT_INPUT ? parseAmount('1', tokenIn) - : parseAmount('1', tokenOut); + : parseAmount(exactOutAmount, tokenOut); const swap = await alphaRouter.route( amount, @@ -3626,7 +3675,7 @@ describe('quote for other networks', () => { if (isTenderlyEnvironmentSet()) { describe(`Simulate + Swap ${tradeType.toString()}`, function() { // Tenderly does not support Celo - if ([ChainId.CELO, ChainId.CELO_ALFAJORES].includes(chain)) { + if ([ChainId.CELO, ChainId.CELO_ALFAJORES, ChainId.SEPOLIA, ChainId.BLAST].includes(chain)) { return; } it(`${wrappedNative.symbol} -> erc20`, async () => { @@ -3828,6 +3877,11 @@ describe('quote for other networks', () => { }); it(`erc20 -> erc20`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + const tokenIn = erc1; const tokenOut = erc2; const amount = @@ -3924,6 +3978,11 @@ describe('quote for other networks', () => { const native = NATIVE_CURRENCY[chain]; it(`${native} -> erc20`, async () => { + if (chain === ChainId.SEPOLIA) { + // Sepolia doesn't have sufficient liquidity on DAI pools yet + return; + } + const tokenIn = nativeOnChain(chain); // TODO ROUTE-64: Remove this once smart-order-router supports ETH native currency on BASE // see https://uniswapteam.slack.com/archives/C021SU4PMR7/p1691593679108459?thread_ts=1691532336.742419&cid=C021SU4PMR7 diff --git a/test/unit/providers/v2/quote-provider.test.ts b/test/unit/providers/v2/quote-provider.test.ts index e0d89067c..ea2cc639d 100644 --- a/test/unit/providers/v2/quote-provider.test.ts +++ b/test/unit/providers/v2/quote-provider.test.ts @@ -5,13 +5,7 @@ import JSBI from 'jsbi'; import { V2QuoteProvider, V2Route, WETH9 } from '../../../../src'; import { ProviderConfig } from '../../../../src/providers/provider'; import { computeAllV2Routes } from '../../../../src/routers/alpha-router/functions/compute-all-routes'; -import { - BLAST, - BLAST_WITHOUT_TAX, - BULLET, - BULLET_WITHOUT_TAX, - STETH, -} from '../../../test-util/mock-data'; +import { BLAST, BLAST_WITHOUT_TAX, BULLET, BULLET_WITHOUT_TAX, STETH, } from '../../../test-util/mock-data'; const tokenIn = BULLET_WITHOUT_TAX; const tokenOut = BLAST_WITHOUT_TAX; @@ -134,7 +128,7 @@ describe('QuoteProvider', () => { expect(pair.reserve1.currency.buyFeeBps).toBeDefined(); } - const [outputAmount] = pair.getOutputAmount(currentInputAmount, enableFeeOnTransferFeeFetching); + const [outputAmount] = pair.getOutputAmount(currentInputAmount, enableFeeOnTransferFeeFetching === true); currentInputAmount = outputAmount; if (enableFeeOnTransferFeeFetching) { diff --git a/test/unit/routers/alpha-router/gas-models/v2-gas-model.test.ts b/test/unit/routers/alpha-router/gas-models/v2-gas-model.test.ts index 870de9514..e9ede6d27 100644 --- a/test/unit/routers/alpha-router/gas-models/v2-gas-model.test.ts +++ b/test/unit/routers/alpha-router/gas-models/v2-gas-model.test.ts @@ -13,11 +13,13 @@ import { import { WETH_DAI } from '../../../../test-util/mock-data'; import { getV2RouteWithValidQuoteStub } from '../../../providers/caching/route/test-util/mocked-dependencies'; import { getMockedV2PoolProvider } from './test-util/mocked-dependencies'; +import sinon from 'sinon'; +import { BaseProvider } from '@ethersproject/providers'; describe('v2 gas model tests', () => { const gasPriceWei = BigNumber.from(1000000000); const chainId = 1; - const v2GasModelFactory = new V2HeuristicGasModelFactory(); + const v2GasModelFactory = new V2HeuristicGasModelFactory(sinon.createStubInstance(BaseProvider)); const mockedV2PoolProvider = getMockedV2PoolProvider(); diff --git a/test/unit/routers/alpha-router/gas-models/v3-gas-model.test.ts b/test/unit/routers/alpha-router/gas-models/v3-gas-model.test.ts index 1b1efce15..8ae31b0f9 100644 --- a/test/unit/routers/alpha-router/gas-models/v3-gas-model.test.ts +++ b/test/unit/routers/alpha-router/gas-models/v3-gas-model.test.ts @@ -31,11 +31,13 @@ import { getMockedV3PoolProvider, } from './test-util/mocked-dependencies'; import { getPools } from './test-util/helpers'; +import sinon from 'sinon'; +import { BaseProvider } from '@ethersproject/providers'; describe('v3 gas model tests', () => { const gasPriceWei = BigNumber.from(1000000000); const chainId = 1; - const v3GasModelFactory = new V3HeuristicGasModelFactory(); + const v3GasModelFactory = new V3HeuristicGasModelFactory(sinon.createStubInstance(BaseProvider)); const mockedV3PoolProvider = getMockedV3PoolProvider(); const mockedV2PoolProvider = getMockedV2PoolProvider(); diff --git a/test/unit/routers/alpha-router/util/gas-factory-helpers.test.ts b/test/unit/routers/alpha-router/util/gas-factory-helpers.test.ts index efc335ebc..92c477e49 100644 --- a/test/unit/routers/alpha-router/util/gas-factory-helpers.test.ts +++ b/test/unit/routers/alpha-router/util/gas-factory-helpers.test.ts @@ -32,7 +32,7 @@ import { ChainId, TradeType } from '@uniswap/sdk-core'; import { Trade } from '@uniswap/router-sdk'; import { Route } from '@uniswap/v3-sdk'; import { getPools } from '../gas-models/test-util/helpers'; -import { ArbitrumGasData } from '../../../../../src/providers/v3/gas-data-provider'; +import { BaseProvider } from '@ethersproject/providers'; const mockUSDCNativePools = [ USDC_WETH_LOW_LIQ_LOW, @@ -125,7 +125,7 @@ describe('gas factory helpers tests', () => { gasToken ); - const v3GasModel = await (new V3HeuristicGasModelFactory()).buildGasModel({ + const v3GasModel = await (new V3HeuristicGasModelFactory(sinon.createStubInstance(BaseProvider))).buildGasModel({ chainId: chainId, gasPriceWei, pools, @@ -184,7 +184,7 @@ describe('gas factory helpers tests', () => { estimatedGasUsedUSD, estimatedGasUsedGasToken, quoteGasAdjusted - } = await calculateGasUsed(chainId, mockSwapRoute, simulatedGasUsed, getMockedV2PoolProvider(), mockPoolProvider, undefined, providerConfig); + } = await calculateGasUsed(chainId, mockSwapRoute, simulatedGasUsed, getMockedV2PoolProvider(), mockPoolProvider, sinon.createStubInstance(BaseProvider), providerConfig); expect(estimatedGasUsedQuoteToken.currency.equals(quoteToken)).toBe(true); expect(estimatedGasUsedQuoteToken.toExact()).not.toEqual('0'); @@ -193,18 +193,12 @@ describe('gas factory helpers tests', () => { expect(estimatedGasUsedGasToken?.toExact()).not.toEqual('0'); expect(quoteGasAdjusted.lessThan(mockSwapRoute.quote)).toBe(true); - const arbGasData: ArbitrumGasData = { - perL2TxFee: BigNumber.from(1_000_000), - perL1CalldataFee: BigNumber.from(1_000), - perArbGasTotal: BigNumber.from(1_000_000_000), - } - const { estimatedGasUsedQuoteToken: estimatedGasUsedQuoteTokenArb, estimatedGasUsedUSD: estimatedGasUsedUSDArb, estimatedGasUsedGasToken: estimatedGasUsedGasTokenArb, quoteGasAdjusted: quoteGasAdjustedArb - } = await calculateGasUsed(chainId, mockSwapRoute, simulatedGasUsed, getMockedV2PoolProvider(), mockPoolProvider, arbGasData, providerConfig); + } = await calculateGasUsed(chainId, mockSwapRoute, simulatedGasUsed, getMockedV2PoolProvider(), mockPoolProvider, sinon.createStubInstance(BaseProvider), providerConfig); // Arbitrum gas data should not affect the quote gas or USD amounts expect(estimatedGasUsedQuoteTokenArb.currency.equals(quoteToken)).toBe(true); @@ -219,7 +213,7 @@ describe('gas factory helpers tests', () => { it('should return the gas costs for the compressed bytes', async () => { const calldata = '0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003fc10e65473c5939c700000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8912ce59144191c1204e64559fe8253a0e49e6548000000000000000000000000000000000000000000'; const compressedBytes = getArbitrumBytes(calldata); - const gasUsed = getL2ToL1GasUsed(calldata, BigNumber.from(0), chainId); + const gasUsed = getL2ToL1GasUsed(calldata, chainId); expect(gasUsed).toEqual(compressedBytes.mul(16)); }); }