From 7f66ce39eab846252033df6166f8a916cd6f6b4f Mon Sep 17 00:00:00 2001 From: ZD Hu Date: Mon, 20 Nov 2023 11:31:04 +0800 Subject: [PATCH] feat: update router addresses for production use --- .changeset/weak-cups-sing.md | 5 + packages/core/src/configs.ts | 14 +-- packages/core/src/router-kit.test.ts | 156 ++++++++++++++++++++++----- 3 files changed, 142 insertions(+), 33 deletions(-) create mode 100644 .changeset/weak-cups-sing.md diff --git a/.changeset/weak-cups-sing.md b/.changeset/weak-cups-sing.md new file mode 100644 index 00000000..d5b5ca42 --- /dev/null +++ b/.changeset/weak-cups-sing.md @@ -0,0 +1,5 @@ +--- +'@protocolink/core': patch +--- + +feat: update router addresses for production use diff --git a/packages/core/src/configs.ts b/packages/core/src/configs.ts index badc6038..76a92315 100644 --- a/packages/core/src/configs.ts +++ b/packages/core/src/configs.ts @@ -4,28 +4,28 @@ type ContractNames = 'Router'; export const contractAddressMap: Record> = { [common.ChainId.mainnet]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.optimism]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.polygon]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.zksync]: { Router: '0xa8350893B36e0425B50917125d9603F81F2D3C87', }, [common.ChainId.metis]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.base]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.arbitrum]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, [common.ChainId.avalanche]: { - Router: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + Router: '0xDec80E988F4baF43be69c13711453013c212feA8', }, }; diff --git a/packages/core/src/router-kit.test.ts b/packages/core/src/router-kit.test.ts index 2ce5a375..9a929879 100644 --- a/packages/core/src/router-kit.test.ts +++ b/packages/core/src/router-kit.test.ts @@ -9,20 +9,36 @@ describe('RouterKit', function () { const testCases = [ { chainId: common.ChainId.mainnet, - expected: '0x903847853d5fE12BaC24dD85903190528CF6070b', + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', }, { - chainId: common.ChainId.polygon, - expected: '0x903847853d5fE12BaC24dD85903190528CF6070b', + chainId: common.ChainId.optimism, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', }, { - chainId: common.ChainId.arbitrum, - expected: '0x903847853d5fE12BaC24dD85903190528CF6070b', + chainId: common.ChainId.polygon, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', }, { chainId: common.ChainId.zksync, expected: '0x1f4f87CDf642bAfD106fa42Ae327f5bAE7ab8F02', }, + { + chainId: common.ChainId.metis, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', + }, + { + chainId: common.ChainId.base, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', + }, + { + chainId: common.ChainId.arbitrum, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', + }, + { + chainId: common.ChainId.avalanche, + expected: '0x4D4c961De7140E642b7217f221b73e859E3A6482', + }, ]; testCases.forEach(({ chainId, expected }, i) => { @@ -38,19 +54,35 @@ describe('RouterKit', function () { const testCases = [ { chainId: common.ChainId.mainnet, - expected: '0xDdbe07CB6D77e81802C55bB381546c0DA51163dd', + expected: '0x6304EB1B1eC2135a64a90bA901B12Cf769657579', + }, + { + chainId: common.ChainId.optimism, + expected: '0x168608B226ef4E59Db5E61359509656a51BAe090', }, { chainId: common.ChainId.polygon, + expected: '0x3EBe4dfaF95cd320BF34633B3BDf773FbE732E63', + }, + { + chainId: common.ChainId.zksync, expected: '0xDdbe07CB6D77e81802C55bB381546c0DA51163dd', }, + { + chainId: common.ChainId.metis, + expected: '0x75Ce960F2FD5f06C83EE034992362e593dcf7722', + }, + { + chainId: common.ChainId.base, + expected: '0x50Df7c73bA1B4bb74934E50298de73F265260Ea4', + }, { chainId: common.ChainId.arbitrum, - expected: '0xDdbe07CB6D77e81802C55bB381546c0DA51163dd', + expected: '0x3EBe4dfaF95cd320BF34633B3BDf773FbE732E63', }, { - chainId: common.ChainId.zksync, - expected: '0xDdbe07CB6D77e81802C55bB381546c0DA51163dd', + chainId: common.ChainId.avalanche, + expected: '0x168608B226ef4E59Db5E61359509656a51BAe090', }, ]; @@ -67,19 +99,35 @@ describe('RouterKit', function () { const testCases = [ { chainId: common.ChainId.mainnet, - expected: '0xddbe07cb6d77e81802c55bb381546c0da51163dd000000000000000000002710', + expected: '0x6304eb1b1ec2135a64a90ba901b12cf769657579000000000000000000002710', + }, + { + chainId: common.ChainId.optimism, + expected: '0x168608b226ef4e59db5e61359509656a51bae090000000000000000000002710', }, { chainId: common.ChainId.polygon, + expected: '0x3ebe4dfaf95cd320bf34633b3bdf773fbe732e63000000000000000000002710', + }, + { + chainId: common.ChainId.zksync, expected: '0xddbe07cb6d77e81802c55bb381546c0da51163dd000000000000000000002710', }, + { + chainId: common.ChainId.metis, + expected: '0x75ce960f2fd5f06c83ee034992362e593dcf7722000000000000000000002710', + }, + { + chainId: common.ChainId.base, + expected: '0x50df7c73ba1b4bb74934e50298de73f265260ea4000000000000000000002710', + }, { chainId: common.ChainId.arbitrum, - expected: '0xddbe07cb6d77e81802c55bb381546c0da51163dd000000000000000000002710', + expected: '0x3ebe4dfaf95cd320bf34633b3bdf773fbe732e63000000000000000000002710', }, { - chainId: common.ChainId.zksync, - expected: '0xddbe07cb6d77e81802c55bb381546c0da51163dd000000000000000000002710', + chainId: common.ChainId.avalanche, + expected: '0x168608b226ef4e59db5e61359509656a51bae090000000000000000000002710', }, ]; @@ -99,17 +147,33 @@ describe('RouterKit', function () { expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', }, { - chainId: common.ChainId.polygon, + chainId: common.ChainId.optimism, expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', }, { - chainId: common.ChainId.arbitrum, + chainId: common.ChainId.polygon, expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', }, { chainId: common.ChainId.zksync, expected: '0x87C0878B54c174199f438470FD74B3F7e1Def295', }, + { + chainId: common.ChainId.metis, + expected: '0x2EE5407017B878774b58c34A8c09CAcC94aDd69B', + }, + { + chainId: common.ChainId.base, + expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', + }, + { + chainId: common.ChainId.arbitrum, + expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', + }, + { + chainId: common.ChainId.avalanche, + expected: '0x000000000022D473030F116dDEE9F6B43aC78BA3', + }, ]; testCases.forEach(({ chainId, expected }, i) => { @@ -126,32 +190,32 @@ describe('RouterKit', function () { { chainId: common.ChainId.mainnet, account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', - expected: '0xefc25B94FFeB90d5045cDAA936a52489bfBeA9D8', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', }, { chainId: common.ChainId.mainnet, account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', - expected: '0x236E002fb1ba4043463aa89E1ccF845d2e3661a6', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', }, { - chainId: common.ChainId.polygon, + chainId: common.ChainId.optimism, account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', - expected: '0xefc25B94FFeB90d5045cDAA936a52489bfBeA9D8', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', }, { - chainId: common.ChainId.polygon, + chainId: common.ChainId.optimism, account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', - expected: '0x236E002fb1ba4043463aa89E1ccF845d2e3661a6', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', }, { - chainId: common.ChainId.arbitrum, + chainId: common.ChainId.polygon, account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', - expected: '0xefc25B94FFeB90d5045cDAA936a52489bfBeA9D8', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', }, { - chainId: common.ChainId.arbitrum, + chainId: common.ChainId.polygon, account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', - expected: '0x236E002fb1ba4043463aa89E1ccF845d2e3661a6', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', }, { chainId: common.ChainId.zksync, @@ -163,6 +227,46 @@ describe('RouterKit', function () { account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', expected: '0x7A4908e637ae38D565Ea88010F75EB5dBdf39fFc', }, + { + chainId: common.ChainId.metis, + account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', + }, + { + chainId: common.ChainId.metis, + account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', + }, + { + chainId: common.ChainId.base, + account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', + }, + { + chainId: common.ChainId.base, + account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', + }, + { + chainId: common.ChainId.arbitrum, + account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', + }, + { + chainId: common.ChainId.arbitrum, + account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', + }, + { + chainId: common.ChainId.avalanche, + account: '0x5cb738DAe833Ec21fe65ae1719fAd8ab8cE7f23D', + expected: '0x8f6325f5E452B8Aa8137722A9f584C41c32d53A1', + }, + { + chainId: common.ChainId.avalanche, + account: '0xa3C1C91403F0026b9dd086882aDbC8Cdbc3b3cfB', + expected: '0x22CF139619f4B8Afc863beCa670615C6310aC7c6', + }, ]; testCases.forEach(({ chainId, account, expected }, i) => { @@ -198,7 +302,7 @@ describe('RouterKit', function () { name: 'Protocolink', version: '1', chainId: 1, - verifyingContract: '0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21', + verifyingContract: '0xDec80E988F4baF43be69c13711453013c212feA8', }, types: { LogicBatch: [