From c7bc038da25ed728d6fed55ed60f690f7179428a Mon Sep 17 00:00:00 2001 From: Austin Adams Date: Sat, 17 Feb 2024 12:44:48 -0500 Subject: [PATCH 1/5] fix: add correct addresses for sepolia --- src/addresses.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/addresses.ts b/src/addresses.ts index 960264e5..ab1e127a 100644 --- a/src/addresses.ts +++ b/src/addresses.ts @@ -127,7 +127,8 @@ const OPTIMISM_SEPOLIA_ADDRESSES: ChainAddresses = { quoterAddress: '0x0FBEa6cf957d95ee9313490050F6A0DA68039404', v3MigratorAddress: '0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07', nonfungiblePositionManagerAddress: '0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d', - tickLensAddress: '0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5' + tickLensAddress: '0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5', + swapRouter02Address: '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4' } // arbitrum goerli v3 addresses @@ -147,7 +148,8 @@ const ARBITRUM_SEPOLIA_ADDRESSES: ChainAddresses = { quoterAddress: '0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B', v3MigratorAddress: '0x398f43ef2c67B941147157DA1c5a868E906E043D', nonfungiblePositionManagerAddress: '0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65', - tickLensAddress: '0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9' + tickLensAddress: '0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9', + swapRouter02Address: '0x101F443B4d1b059569D643917553c771E1b9663E' } // sepolia v3 addresses @@ -157,7 +159,8 @@ const SEPOLIA_ADDRESSES: ChainAddresses = { quoterAddress: '0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3', v3MigratorAddress: '0x729004182cF005CEC8Bd85df140094b6aCbe8b15', nonfungiblePositionManagerAddress: '0x1238536071E1c677A632429e3655c799b22cDA52', - tickLensAddress: '0xd7f33bcdb21b359c8ee6f0251d30e94832baad07' + tickLensAddress: '0xd7f33bcdb21b359c8ee6f0251d30e94832baad07', + swapRouter02Address: '0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E' } // Avalanche v3 addresses From 375a43c62e2508059580196776898500e890bb2c Mon Sep 17 00:00:00 2001 From: dallinlarsen <56076097+dallinlarsen@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:15:08 -0700 Subject: [PATCH 2/5] Fixed bug that returned an empty swap router 02 address for base chain (#120) * Updated code to correctly access addresses * add test to ensure no regression --------- Co-authored-by: jsy1218 <91580504+jsy1218@users.noreply.github.com> --- src/addresses.test.ts | 26 ++++++++++++++++++++++++++ src/addresses.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/addresses.test.ts diff --git a/src/addresses.test.ts b/src/addresses.test.ts new file mode 100644 index 00000000..c316833b --- /dev/null +++ b/src/addresses.test.ts @@ -0,0 +1,26 @@ +import {SWAP_ROUTER_02_ADDRESSES} from "./addresses"; +import {ChainId} from "./chains"; + +describe('addresses', () => { + describe('swap router 02 addresses', () => { + it('should return the correct address for base', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE) + expect(address).toEqual('0x2626664c2603336E57B271c5C0b26F421741e481') + }); + + it('should return the correct address for base goerli', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE_GOERLI) + expect(address).toEqual('0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d') + }); + + it('should return the correct address for avalanche', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.AVALANCHE) + expect(address).toEqual('0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE') + }); + + it('should return the correct address for BNB', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BNB) + expect(address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') + }); + }); +}); \ No newline at end of file diff --git a/src/addresses.ts b/src/addresses.ts index ab1e127a..7c57b798 100644 --- a/src/addresses.ts +++ b/src/addresses.ts @@ -313,7 +313,7 @@ export const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap = SUPPORTED_CHAINS.redu }, {}) export const SWAP_ROUTER_02_ADDRESSES = (chainId: number) => { - if (chainId in SUPPORTED_CHAINS) { + if (SUPPORTED_CHAINS.includes(chainId)) { const id = chainId as SupportedChainsType return CHAIN_TO_ADDRESSES_MAP[id].swapRouter02Address ?? '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45' } From 2d3043dd230ce62bc842b3c3acb6d74ca83d97c4 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 23 Feb 2024 01:15:39 +0000 Subject: [PATCH 3/5] Fix code style issues with Prettier --- src/addresses.test.ts | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/addresses.test.ts b/src/addresses.test.ts index c316833b..7f387b63 100644 --- a/src/addresses.test.ts +++ b/src/addresses.test.ts @@ -1,26 +1,26 @@ -import {SWAP_ROUTER_02_ADDRESSES} from "./addresses"; -import {ChainId} from "./chains"; +import { SWAP_ROUTER_02_ADDRESSES } from './addresses' +import { ChainId } from './chains' describe('addresses', () => { - describe('swap router 02 addresses', () => { - it('should return the correct address for base', () => { - const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE) - expect(address).toEqual('0x2626664c2603336E57B271c5C0b26F421741e481') - }); + describe('swap router 02 addresses', () => { + it('should return the correct address for base', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE) + expect(address).toEqual('0x2626664c2603336E57B271c5C0b26F421741e481') + }) - it('should return the correct address for base goerli', () => { - const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE_GOERLI) - expect(address).toEqual('0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d') - }); + it('should return the correct address for base goerli', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BASE_GOERLI) + expect(address).toEqual('0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d') + }) - it('should return the correct address for avalanche', () => { - const address = SWAP_ROUTER_02_ADDRESSES(ChainId.AVALANCHE) - expect(address).toEqual('0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE') - }); + it('should return the correct address for avalanche', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.AVALANCHE) + expect(address).toEqual('0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE') + }) - it('should return the correct address for BNB', () => { - const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BNB) - expect(address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') - }); - }); -}); \ No newline at end of file + it('should return the correct address for BNB', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BNB) + expect(address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') + }) + }) +}) From 00ea0eb04600c787fde2be519614f113cb5f8dfb Mon Sep 17 00:00:00 2001 From: jsy1218 <91580504+jsy1218@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:20:06 -0800 Subject: [PATCH 4/5] enhance testing coverage --- src/addresses.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/addresses.test.ts b/src/addresses.test.ts index 7f387b63..4345f3db 100644 --- a/src/addresses.test.ts +++ b/src/addresses.test.ts @@ -22,5 +22,20 @@ describe('addresses', () => { const address = SWAP_ROUTER_02_ADDRESSES(ChainId.BNB) expect(address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') }) + + it('should return the correct address for arbitrum goerli', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.ARBITRUM_GOERLI) + expect(address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') + }) + + it('should return the correct address for optimism sepolia', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.OPTIMISM_SEPOLIA) + expect(address).toEqual('0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4') + }) + + it('should return the correct address for sepolia', () => { + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.SEPOLIA) + expect(address).toEqual('0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E') + }) }) }) From 6bcd5773606bf908c51fe152cbf0a8ccfd7a29b9 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 23 Feb 2024 01:21:17 +0000 Subject: [PATCH 5/5] Fix code style issues with Prettier --- src/addresses.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addresses.test.ts b/src/addresses.test.ts index 4345f3db..d0fc0199 100644 --- a/src/addresses.test.ts +++ b/src/addresses.test.ts @@ -34,8 +34,8 @@ describe('addresses', () => { }) it('should return the correct address for sepolia', () => { - const address = SWAP_ROUTER_02_ADDRESSES(ChainId.SEPOLIA) - expect(address).toEqual('0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E') + const address = SWAP_ROUTER_02_ADDRESSES(ChainId.SEPOLIA) + expect(address).toEqual('0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E') }) }) })