From 114a7f08c31f13a5bb9ccdcc0ffeb969c08c6b09 Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Tue, 21 May 2024 17:23:58 -0700 Subject: [PATCH 1/4] feat: support zora --- README.md | 1 + bin/app.ts | 4 + lib/handlers/injector-sor.ts | 2 + package-lock.json | 271 +++++++++++++++++++++++++++-------- package.json | 2 +- 5 files changed, 222 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 81be51e2e9..a7d608426f 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ The best way to develop and test the API is to deploy your own instance to AWS. # BNB = 56 # BASE = 8453 # BLAST = 81457 + # ZORA = 7777777 TENDERLY_USER = '' # For enabling Tenderly simulations TENDERLY_PROJECT = '' # For enabling Tenderly simulations TENDERLY_ACCESS_KEY = '' # For enabling Tenderly simulations diff --git a/bin/app.ts b/bin/app.ts index 900f6a98c8..8444bdace2 100644 --- a/bin/app.ts +++ b/bin/app.ts @@ -217,6 +217,8 @@ export class RoutingAPIPipeline extends Stack { // Blast 'QUICKNODE_81457', 'INFURA_81457', + // ZORA + 'QUICKNODE_7777777', ] for (const provider of RPC_GATEWAY_PROVIDERS) { jsonRpcProviders[provider] = jsonRpcProvidersSecret.secretValueFromJson(provider).toString() @@ -376,6 +378,8 @@ const jsonRpcProviders = { // Blast QUICKNODE_81457: process.env.QUICKNODE_81457!, INFURA_81457: process.env.INFURA_81457!, + // Zora + QUICKNODE_7777777: process.env.QUICKNODE_7777777!, } // Local dev stack diff --git a/lib/handlers/injector-sor.ts b/lib/handlers/injector-sor.ts index 66dda62e3c..8ab085bf4c 100644 --- a/lib/handlers/injector-sor.ts +++ b/lib/handlers/injector-sor.ts @@ -84,6 +84,7 @@ export const SUPPORTED_CHAINS: ChainId[] = [ ChainId.AVALANCHE, ChainId.BASE, ChainId.BLAST, + ChainId.ZORA, ] const DEFAULT_TOKEN_LIST = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org' @@ -332,6 +333,7 @@ export abstract class InjectorSOR extends Injector< case ChainId.CELO: case ChainId.AVALANCHE: case ChainId.BLAST: + case ChainId.ZORA: const currentQuoteProvider = new OnChainQuoteProvider( chainId, provider, diff --git a/package-lock.json b/package-lock.json index 66242df4de..262109d227 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "@uniswap/permit2-sdk": "^1.2.0", "@uniswap/router-sdk": "^1.9.0", "@uniswap/sdk-core": "^4.2.0", - "@uniswap/smart-order-router": "3.31.0", + "@uniswap/smart-order-router": "3.32.0", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/universal-router-sdk": "^1.8.1", "@uniswap/v2-sdk": "^4.3.0", @@ -4708,24 +4708,40 @@ } }, "node_modules/@uniswap/permit2-sdk": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@uniswap/permit2-sdk/-/permit2-sdk-1.2.0.tgz", - "integrity": "sha512-Ietv3FxN7+RCXcPSED/i/8b0a2GUZrMdyX05k3FsSztvYKyPFAMS/hBXojF0NZqYB1bHecqYc7Ej+7tV/rdYXg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@uniswap/permit2-sdk/-/permit2-sdk-1.2.1.tgz", + "integrity": "sha512-3eEVW6d1tepF9L4XLGhrGoVPKFBe/kQYRCvkzMmYu32amEeV2L8sg5TBJhrVZu+cu0srX7rh3nhOucNdMVOGzg==", "dependencies": { - "ethers": "^5.3.1", - "tiny-invariant": "^1.3.1" + "ethers": "^5.7.0", + "tiny-invariant": "^1.1.0" } }, "node_modules/@uniswap/router-sdk": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.0.tgz", - "integrity": "sha512-UeQrrjhOIzPDxHzkF341Sd9PjIzJwiHFQhaEYFIWNE4yC/wzSiISxc5Ebp94p/KVmettoFRa+682yn9IZBhFTA==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.2.tgz", + "integrity": "sha512-J63Of3HRpV0s3ZtEnhGlyvbBuZFfjK7NtnMwflzFMKzfdm+75APHYqnvHAnVARKuL/hMYHF4hni0o84bHem2Ng==", "dependencies": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "^4.2.0", - "@uniswap/swap-router-contracts": "^1.1.0", - "@uniswap/v2-sdk": "^4.3.0", - "@uniswap/v3-sdk": "^3.11.0" + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/swap-router-contracts": "^1.3.0", + "@uniswap/v2-sdk": "^4.3.2", + "@uniswap/v3-sdk": "^3.11.2" + } + }, + "node_modules/@uniswap/router-sdk/node_modules/@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "dependencies": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + }, + "engines": { + "node": ">=10" } }, "node_modules/@uniswap/sdk-core": { @@ -4745,9 +4761,9 @@ } }, "node_modules/@uniswap/smart-order-router": { - "version": "3.31.0", - "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-3.31.0.tgz", - "integrity": "sha512-BZKsbkXU4JUyZ5pC4a4/p3eq9PGWO8rmIKBKkThIspIbbWZsO+SOIrfRSYdpJ5Ok1fdZV3MwT/Gn2y92SNV5pw==", + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-3.32.0.tgz", + "integrity": "sha512-M6JK/D5zj67LwPHXoREDirL0wcIIvAB6tVa/UvNbKBqyO+Mc/0wFo1APzSE3Z+WYvA0TMZypGFhV9KGYN/ukVg==", "dependencies": { "@eth-optimism/sdk": "^3.2.2", "@types/brotli": "^1.3.4", @@ -4758,7 +4774,7 @@ "@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.8.2", + "@uniswap/universal-router-sdk": "^2.1.0", "@uniswap/v2-sdk": "^4.3.0", "@uniswap/v3-sdk": "^3.11.0", "async-retry": "^1.3.1", @@ -4782,6 +4798,40 @@ "jsbi": "^3.2.0" } }, + "node_modules/@uniswap/smart-order-router/node_modules/@uniswap/universal-router-sdk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-2.1.0.tgz", + "integrity": "sha512-nLIIr0bZ6AfvwuYC97rM10tyEfqDIdujtG+Ahwqhv1EMWayh6abbqPUwvUQvk6Px4LOyuKtlciryW/MJMusn4w==", + "dependencies": { + "@uniswap/permit2-sdk": "^1.2.1", + "@uniswap/router-sdk": "^1.9.2", + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/universal-router": "1.6.0", + "@uniswap/v2-sdk": "^4.3.2", + "@uniswap/v3-sdk": "^3.11.2", + "bignumber.js": "^9.0.2", + "ethers": "^5.7.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@uniswap/smart-order-router/node_modules/@uniswap/universal-router-sdk/node_modules/@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "dependencies": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@uniswap/smart-order-router/node_modules/graphql": { "version": "15.8.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", @@ -4872,13 +4922,13 @@ } }, "node_modules/@uniswap/v2-sdk": { - "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==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.3.2.tgz", + "integrity": "sha512-yNxfQZuzmQ2xqiKutzyzzoXuiuwFrHWba6GG9gT8JeJ4NT5sTJOeLY1FEdEMVsJQwXfMc+goG/srNBRZXVRtSA==", "dependencies": { - "@ethersproject/address": "^5.0.0", - "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "^4.2.0", + "@ethersproject/address": "^5.0.2", + "@ethersproject/solidity": "^5.0.9", + "@uniswap/sdk-core": "^5.0.0", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" }, @@ -4886,6 +4936,22 @@ "node": ">=10" } }, + "node_modules/@uniswap/v2-sdk/node_modules/@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "dependencies": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@uniswap/v3-core": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", @@ -4915,14 +4981,14 @@ "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" }, "node_modules/@uniswap/v3-sdk": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.0.tgz", - "integrity": "sha512-gz6Q6SlN34AXvxhyz181F90D4OuIkxLnzBAucEzB9Fv3Z+3orHZY/SpGaD02nP1VsNQVu/DQvOsdkPUDGn1Y9Q==", + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.2.tgz", + "integrity": "sha512-TktyuMHVqlhtUxXK3cUaijlvlqiyWfpEYgzd2JD1EcvsVB55zLmtRKb/1fbtLbjRqOapcFsVihD5pVW9nyFlTg==", "dependencies": { - "@ethersproject/abi": "^5.0.12", + "@ethersproject/abi": "^5.5.0", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "^4.2.0", - "@uniswap/swap-router-contracts": "^1.2.1", + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/swap-router-contracts": "^1.3.0", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", "tiny-invariant": "^1.1.0", @@ -4932,6 +4998,22 @@ "node": ">=10" } }, + "node_modules/@uniswap/v3-sdk/node_modules/@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "dependencies": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@uniswap/v3-staker": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@uniswap/v3-staker/-/v3-staker-1.0.0.tgz", @@ -28345,24 +28427,39 @@ "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==" }, "@uniswap/permit2-sdk": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@uniswap/permit2-sdk/-/permit2-sdk-1.2.0.tgz", - "integrity": "sha512-Ietv3FxN7+RCXcPSED/i/8b0a2GUZrMdyX05k3FsSztvYKyPFAMS/hBXojF0NZqYB1bHecqYc7Ej+7tV/rdYXg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@uniswap/permit2-sdk/-/permit2-sdk-1.2.1.tgz", + "integrity": "sha512-3eEVW6d1tepF9L4XLGhrGoVPKFBe/kQYRCvkzMmYu32amEeV2L8sg5TBJhrVZu+cu0srX7rh3nhOucNdMVOGzg==", "requires": { - "ethers": "^5.3.1", - "tiny-invariant": "^1.3.1" + "ethers": "^5.7.0", + "tiny-invariant": "^1.1.0" } }, "@uniswap/router-sdk": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.0.tgz", - "integrity": "sha512-UeQrrjhOIzPDxHzkF341Sd9PjIzJwiHFQhaEYFIWNE4yC/wzSiISxc5Ebp94p/KVmettoFRa+682yn9IZBhFTA==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.9.2.tgz", + "integrity": "sha512-J63Of3HRpV0s3ZtEnhGlyvbBuZFfjK7NtnMwflzFMKzfdm+75APHYqnvHAnVARKuL/hMYHF4hni0o84bHem2Ng==", "requires": { "@ethersproject/abi": "^5.5.0", - "@uniswap/sdk-core": "^4.2.0", - "@uniswap/swap-router-contracts": "^1.1.0", - "@uniswap/v2-sdk": "^4.3.0", - "@uniswap/v3-sdk": "^3.11.0" + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/swap-router-contracts": "^1.3.0", + "@uniswap/v2-sdk": "^4.3.2", + "@uniswap/v3-sdk": "^3.11.2" + }, + "dependencies": { + "@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "requires": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + } + } } }, "@uniswap/sdk-core": { @@ -28379,9 +28476,9 @@ } }, "@uniswap/smart-order-router": { - "version": "3.31.0", - "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-3.31.0.tgz", - "integrity": "sha512-BZKsbkXU4JUyZ5pC4a4/p3eq9PGWO8rmIKBKkThIspIbbWZsO+SOIrfRSYdpJ5Ok1fdZV3MwT/Gn2y92SNV5pw==", + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-3.32.0.tgz", + "integrity": "sha512-M6JK/D5zj67LwPHXoREDirL0wcIIvAB6tVa/UvNbKBqyO+Mc/0wFo1APzSE3Z+WYvA0TMZypGFhV9KGYN/ukVg==", "requires": { "@eth-optimism/sdk": "^3.2.2", "@types/brotli": "^1.3.4", @@ -28392,7 +28489,7 @@ "@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.8.2", + "@uniswap/universal-router-sdk": "^2.1.0", "@uniswap/v2-sdk": "^4.3.0", "@uniswap/v3-sdk": "^3.11.0", "async-retry": "^1.3.1", @@ -28410,6 +28507,36 @@ "stats-lite": "^2.2.0" }, "dependencies": { + "@uniswap/universal-router-sdk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@uniswap/universal-router-sdk/-/universal-router-sdk-2.1.0.tgz", + "integrity": "sha512-nLIIr0bZ6AfvwuYC97rM10tyEfqDIdujtG+Ahwqhv1EMWayh6abbqPUwvUQvk6Px4LOyuKtlciryW/MJMusn4w==", + "requires": { + "@uniswap/permit2-sdk": "^1.2.1", + "@uniswap/router-sdk": "^1.9.2", + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/universal-router": "1.6.0", + "@uniswap/v2-sdk": "^4.3.2", + "@uniswap/v3-sdk": "^3.11.2", + "bignumber.js": "^9.0.2", + "ethers": "^5.7.0" + }, + "dependencies": { + "@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "requires": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + } + } + } + }, "graphql": { "version": "15.8.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", @@ -28485,15 +28612,30 @@ "integrity": "sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q==" }, "@uniswap/v2-sdk": { - "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==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@uniswap/v2-sdk/-/v2-sdk-4.3.2.tgz", + "integrity": "sha512-yNxfQZuzmQ2xqiKutzyzzoXuiuwFrHWba6GG9gT8JeJ4NT5sTJOeLY1FEdEMVsJQwXfMc+goG/srNBRZXVRtSA==", "requires": { - "@ethersproject/address": "^5.0.0", - "@ethersproject/solidity": "^5.0.0", - "@uniswap/sdk-core": "^4.2.0", + "@ethersproject/address": "^5.0.2", + "@ethersproject/solidity": "^5.0.9", + "@uniswap/sdk-core": "^5.0.0", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" + }, + "dependencies": { + "@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "requires": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + } + } } }, "@uniswap/v3-core": { @@ -28521,18 +28663,33 @@ } }, "@uniswap/v3-sdk": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.0.tgz", - "integrity": "sha512-gz6Q6SlN34AXvxhyz181F90D4OuIkxLnzBAucEzB9Fv3Z+3orHZY/SpGaD02nP1VsNQVu/DQvOsdkPUDGn1Y9Q==", + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.2.tgz", + "integrity": "sha512-TktyuMHVqlhtUxXK3cUaijlvlqiyWfpEYgzd2JD1EcvsVB55zLmtRKb/1fbtLbjRqOapcFsVihD5pVW9nyFlTg==", "requires": { - "@ethersproject/abi": "^5.0.12", + "@ethersproject/abi": "^5.5.0", "@ethersproject/solidity": "^5.0.9", - "@uniswap/sdk-core": "^4.2.0", - "@uniswap/swap-router-contracts": "^1.2.1", + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/swap-router-contracts": "^1.3.0", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" + }, + "dependencies": { + "@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "requires": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + } + } } }, "@uniswap/v3-staker": { diff --git a/package.json b/package.json index ccf173ad3c..e31f643f4d 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "@uniswap/router-sdk": "^1.9.0", "@uniswap/sdk-core": "^4.2.0", "@types/semver": "^7.5.8", - "@uniswap/smart-order-router": "3.31.0", + "@uniswap/smart-order-router": "3.32.0", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/universal-router-sdk": "^1.8.1", "@uniswap/v2-sdk": "^4.3.0", From 5fa66d62a1437321492c34cbc1d9196e0dc10859 Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Tue, 21 May 2024 17:26:43 -0700 Subject: [PATCH 2/4] add whale address on Zora --- test/mocha/e2e/quote.test.ts | 1 - test/utils/tokens.ts | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/mocha/e2e/quote.test.ts b/test/mocha/e2e/quote.test.ts index 46a6fd9f01..a078656dda 100644 --- a/test/mocha/e2e/quote.test.ts +++ b/test/mocha/e2e/quote.test.ts @@ -2509,7 +2509,6 @@ describe('quote', function () { c != ChainId.ARBITRUM_GOERLI && c != ChainId.CELO_ALFAJORES && // We will follow up supporting ZORA and ROOTSTOCK - c != ChainId.ZORA && c != ChainId.ZORA_SEPOLIA && c != ChainId.ROOTSTOCK && c != ChainId.GOERLI diff --git a/test/utils/tokens.ts b/test/utils/tokens.ts index 56c8389a55..01a702b41d 100644 --- a/test/utils/tokens.ts +++ b/test/utils/tokens.ts @@ -31,7 +31,7 @@ import { USDT_OPTIMISM, WRAPPED_NATIVE_CURRENCY, USDC_BASE, - USDC_BASE_GOERLI, + USDC_BASE_GOERLI, USDC_ZORA } from '@uniswap/smart-order-router' import { ethers } from 'ethers' import NodeCache from 'node-cache' @@ -132,6 +132,8 @@ export const USDC_ON = (chainId: ChainId): Token => { return USDC_BASE case ChainId.BASE_GOERLI: return USDC_BASE_GOERLI + case ChainId.ZORA: + return USDC_ZORA default: throw new Error(`Chain id: ${chainId} not supported`) } From a085e29759fdbec606b4770ce1cc30a9a7ac0e0f Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Tue, 21 May 2024 21:36:27 -0700 Subject: [PATCH 3/4] remove infura from env var --- bin/app.ts | 36 +++++++++++++-------------- bin/stacks/routing-lambda-stack.ts | 2 +- lib/config/rpcProviderProdConfig.json | 8 ++++++ lib/rpc/utils.ts | 3 +++ test/utils/tokens.ts | 3 ++- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/bin/app.ts b/bin/app.ts index 8444bdace2..4632b78b1f 100644 --- a/bin/app.ts +++ b/bin/app.ts @@ -179,44 +179,44 @@ export class RoutingAPIPipeline extends Stack { // Load RPC provider URLs from AWS secret (for RPC Gateway) const RPC_GATEWAY_PROVIDERS = [ // Optimism - 'INFURA_10', + // 'INFURA_10', 'QUICKNODE_10', 'ALCHEMY_10', // Polygon 'QUICKNODE_137', - 'INFURA_137', + // 'INFURA_137', 'ALCHEMY_137', // Celo 'QUICKNODE_42220', - 'INFURA_42220', + // 'INFURA_42220', // Avalanche - 'INFURA_43114', + // 'INFURA_43114', 'QUICKNODE_43114', 'NIRVANA_43114', // BNB 'QUICKNODE_56', // Base 'QUICKNODE_8453', - 'INFURA_8453', + // 'INFURA_8453', 'ALCHEMY_8453', 'NIRVANA_8453', // Sepolia - 'INFURA_11155111', + // 'INFURA_11155111', 'ALCHEMY_11155111', // Arbitrum - 'INFURA_42161', + // 'INFURA_42161', 'QUICKNODE_42161', 'NIRVANA_42161', 'ALCHEMY_42161', // Ethereum - 'INFURA_1', + // 'INFURA_1', 'QUICKNODE_1', 'NIRVANA_1', 'ALCHEMY_1', 'QUICKNODERETH_1', // Blast 'QUICKNODE_81457', - 'INFURA_81457', + // 'INFURA_81457', // ZORA 'QUICKNODE_7777777', ] @@ -341,43 +341,43 @@ const jsonRpcProviders = { WEB3_RPC_8453: process.env.WEB3_RPC_8453!, // The followings are for RPC Gateway // Optimism - INFURA_10: process.env.INFURA_10!, + // INFURA_10: process.env.INFURA_10!, QUICKNODE_10: process.env.QUICKNODE_10!, ALCHEMY_10: process.env.ALCHEMY_10!, // Polygon QUICKNODE_137: process.env.QUICKNODE_137!, - INFURA_137: process.env.INFURA_137!, + // INFURA_137: process.env.INFURA_137!, ALCHEMY_137: process.env.ALCHEMY_137!, // Celo QUICKNODE_42220: process.env.QUICKNODE_42220!, - INFURA_42220: process.env.INFURA_42220!, + // INFURA_42220: process.env.INFURA_42220!, // Avalanche - INFURA_43114: process.env.INFURA_43114!, + // INFURA_43114: process.env.INFURA_43114!, QUICKNODE_43114: process.env.QUICKNODE_43114!, NIRVANA_43114: process.env.NIRVANA_43114!, // BNB QUICKNODE_56: process.env.QUICKNODE_56!, // Base QUICKNODE_8453: process.env.QUICKNODE_8453!, - INFURA_8453: process.env.INFURA_8453!, + // INFURA_8453: process.env.INFURA_8453!, ALCHEMY_8453: process.env.ALCHEMY_8453!, NIRVANA_8453: process.env.NIRVANA_8453!, // Sepolia - INFURA_11155111: process.env.INFURA_11155111!, + // INFURA_11155111: process.env.INFURA_11155111!, ALCHEMY_11155111: process.env.ALCHEMY_11155111!, // Arbitrum - INFURA_42161: process.env.INFURA_42161!, + // INFURA_42161: process.env.INFURA_42161!, QUICKNODE_42161: process.env.QUICKNODE_42161!, NIRVANA_42161: process.env.NIRVANA_42161!, ALCHEMY_42161: process.env.ALCHEMY_42161!, // Ethereum - INFURA_1: process.env.INFURA_1!, + // INFURA_1: process.env.INFURA_1!, QUICKNODE_1: process.env.QUICKNODE_1!, NIRVANA_1: process.env.NIRVANA_1!, ALCHEMY_1: process.env.ALCHEMY_1!, // Blast QUICKNODE_81457: process.env.QUICKNODE_81457!, - INFURA_81457: process.env.INFURA_81457!, + // INFURA_81457: process.env.INFURA_81457!, // Zora QUICKNODE_7777777: process.env.QUICKNODE_7777777!, } diff --git a/bin/stacks/routing-lambda-stack.ts b/bin/stacks/routing-lambda-stack.ts index 5985a71e5f..1bc53f720b 100644 --- a/bin/stacks/routing-lambda-stack.ts +++ b/bin/stacks/routing-lambda-stack.ts @@ -117,7 +117,7 @@ export class RoutingLambdaStack extends cdk.NestedStack { description: 'Routing Lambda', environment: { - VERSION: '20', + VERSION: '21', NODE_OPTIONS: '--enable-source-maps', POOL_CACHE_BUCKET: poolCacheBucket.bucketName, POOL_CACHE_BUCKET_2: poolCacheBucket2.bucketName, diff --git a/lib/config/rpcProviderProdConfig.json b/lib/config/rpcProviderProdConfig.json index 1dc2eb5cc3..99428923db 100644 --- a/lib/config/rpcProviderProdConfig.json +++ b/lib/config/rpcProviderProdConfig.json @@ -79,5 +79,13 @@ "healthCheckSampleProb": 0.001, "providerInitialWeights": [1, 0], "providerUrls": ["QUICKNODE_81457", "INFURA_81457"] + }, + { + "chainId": 7777777, + "useMultiProviderProb": 1, + "latencyEvaluationSampleProb": 0.001, + "healthCheckSampleProb": 0.001, + "providerInitialWeights": [1, 0], + "providerUrls": ["QUICKNODE_7777777"] } ] diff --git a/lib/rpc/utils.ts b/lib/rpc/utils.ts index 906845e4aa..5ddffae49b 100644 --- a/lib/rpc/utils.ts +++ b/lib/rpc/utils.ts @@ -98,6 +98,9 @@ export function generateProviderUrl(key: string, value: string): string { case 'QUICKNODE_81457': { return `https://${tokens[0]}.blast-mainnet.quiknode.pro/${tokens[1]}` } + case 'QUICKNODE_7777777': { + return `https://${tokens[0]}.zora-mainnet.quiknode.pro/${tokens[1]}` + } // QuickNode RETH case 'QUICKNODERETH_1': { return `https://${tokens[0]}.quiknode.pro/${tokens[1]}` diff --git a/test/utils/tokens.ts b/test/utils/tokens.ts index 01a702b41d..4e592fd504 100644 --- a/test/utils/tokens.ts +++ b/test/utils/tokens.ts @@ -31,7 +31,8 @@ import { USDT_OPTIMISM, WRAPPED_NATIVE_CURRENCY, USDC_BASE, - USDC_BASE_GOERLI, USDC_ZORA + USDC_BASE_GOERLI, + USDC_ZORA, } from '@uniswap/smart-order-router' import { ethers } from 'ethers' import NodeCache from 'node-cache' From ffef2e044652be2f3b41a18e3c331c5552cd42ee Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Tue, 21 May 2024 22:07:59 -0700 Subject: [PATCH 4/4] remove infura from configs --- lib/config/rpcProviderProdConfig.json | 34 +++++++++++++-------------- test/mocha/e2e/quote.test.ts | 3 ++- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/config/rpcProviderProdConfig.json b/lib/config/rpcProviderProdConfig.json index 99428923db..51118088e9 100644 --- a/lib/config/rpcProviderProdConfig.json +++ b/lib/config/rpcProviderProdConfig.json @@ -4,16 +4,16 @@ "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.1, "healthCheckSampleProb": 0.1, - "providerInitialWeights": [1, 0], - "providerUrls": ["QUICKNODE_42220", "INFURA_42220"] + "providerInitialWeights": [1], + "providerUrls": ["QUICKNODE_42220"] }, { "chainId": 43114, "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.1, "healthCheckSampleProb": 0.1, - "providerInitialWeights": [0, 1, 0], - "providerUrls": ["INFURA_43114", "QUICKNODE_43114", "NIRVANA_43114"] + "providerInitialWeights": [1, 0], + "providerUrls": ["QUICKNODE_43114", "NIRVANA_43114"] }, { "chainId": 56, @@ -28,16 +28,16 @@ "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.01, "healthCheckSampleProb": 0.01, - "providerInitialWeights": [0, 1, 0], - "providerUrls": ["INFURA_10", "QUICKNODE_10", "ALCHEMY_10"] + "providerInitialWeights": [1, 0], + "providerUrls": ["QUICKNODE_10", "ALCHEMY_10"] }, { "chainId": 11155111, "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.01, "healthCheckSampleProb": 0.01, - "providerInitialWeights": [1, -1], - "providerUrls": ["ALCHEMY_11155111", "INFURA_11155111"], + "providerInitialWeights": [1], + "providerUrls": ["ALCHEMY_11155111"], "enableDbSync": true }, { @@ -45,16 +45,16 @@ "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.005, "healthCheckSampleProb": 0.005, - "providerInitialWeights": [1, 0, 0], - "providerUrls": ["QUICKNODE_137", "INFURA_137", "ALCHEMY_137"] + "providerInitialWeights": [1, 0], + "providerUrls": ["QUICKNODE_137", "ALCHEMY_137"] }, { "chainId": 42161, "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.002, "healthCheckSampleProb": 0.002, - "providerInitialWeights": [0, 1, 0, 0], - "providerUrls": ["INFURA_42161", "QUICKNODE_42161", "NIRVANA_42161", "ALCHEMY_42161"] + "providerInitialWeights": [1, 0, 0], + "providerUrls": ["QUICKNODE_42161", "NIRVANA_42161", "ALCHEMY_42161"] }, { "chainId": 8453, @@ -69,23 +69,23 @@ "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.001, "healthCheckSampleProb": 0.001, - "providerInitialWeights": [0, 0, 0, 1], - "providerUrls": ["INFURA_1", "ALCHEMY_1", "NIRVANA_1", "QUICKNODE_1"] + "providerInitialWeights": [0, 0, 1], + "providerUrls": ["ALCHEMY_1", "NIRVANA_1", "QUICKNODE_1"] }, { "chainId": 81457, "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.001, "healthCheckSampleProb": 0.001, - "providerInitialWeights": [1, 0], - "providerUrls": ["QUICKNODE_81457", "INFURA_81457"] + "providerInitialWeights": [1], + "providerUrls": ["QUICKNODE_81457"] }, { "chainId": 7777777, "useMultiProviderProb": 1, "latencyEvaluationSampleProb": 0.001, "healthCheckSampleProb": 0.001, - "providerInitialWeights": [1, 0], + "providerInitialWeights": [1], "providerUrls": ["QUICKNODE_7777777"] } ] diff --git a/test/mocha/e2e/quote.test.ts b/test/mocha/e2e/quote.test.ts index a078656dda..0ddfebc9ad 100644 --- a/test/mocha/e2e/quote.test.ts +++ b/test/mocha/e2e/quote.test.ts @@ -2620,8 +2620,9 @@ describe('quote', function () { return } - if (chain === ChainId.BLAST) { + if (chain === ChainId.BLAST || chain === ChainId.ZORA) { // Blast doesn't have DAI or USDC yet + // Zora doesn't have DAI return }