From 53b26ec00e8d72acb4ca00bad43b8acc8cf9195e Mon Sep 17 00:00:00 2001 From: Bennett Date: Thu, 16 May 2024 15:04:44 -0500 Subject: [PATCH] condense op standard bridge abi Signed-off-by: Bennett --- package.json | 2 +- src/clients/TokenClient.ts | 6 ++- src/common/ContractAddresses.ts | 66 ++++++++++----------------------- yarn.lock | 39 +++++++++++++------ 4 files changed, 53 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index 5463ff043..a569fd87b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "@across-protocol/constants-v2": "1.0.26", "@across-protocol/contracts-v2": "2.5.6", - "@across-protocol/sdk-v2": "0.23.11", + "@across-protocol/sdk-v2": "0.23.13", "@arbitrum/sdk": "^3.1.3", "@consensys/linea-sdk": "^0.2.1", "@defi-wonderland/smock": "^2.3.5", diff --git a/src/clients/TokenClient.ts b/src/clients/TokenClient.ts index 9d919855d..c43daf806 100644 --- a/src/clients/TokenClient.ts +++ b/src/clients/TokenClient.ts @@ -172,7 +172,11 @@ export class TokenClient { } resolveRemoteTokens(chainId: number, hubPoolTokens: L1Token[]): Contract[] { - const { signer } = this.hubPoolClient.hubPool; + const { signer } = this.spokePoolClients[chainId].spokePool; + + if (chainId === this.hubPoolClient.chainId) { + return hubPoolTokens.map(({ address }) => new Contract(address, ERC20.abi, signer)); + } const tokens = hubPoolTokens .map(({ symbol, address }) => { diff --git a/src/common/ContractAddresses.ts b/src/common/ContractAddresses.ts index b5ce018d1..dd47d2d50 100644 --- a/src/common/ContractAddresses.ts +++ b/src/common/ContractAddresses.ts @@ -463,6 +463,22 @@ const OP_WETH_ABI = [ }, ]; +const OP_STANDARD_BRIDGE_ABI = [ + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "_l1Token", type: "address" }, + { indexed: true, internalType: "address", name: "_l2Token", type: "address" }, + { indexed: true, internalType: "address", name: "_from", type: "address" }, + { indexed: false, internalType: "address", name: "_to", type: "address" }, + { indexed: false, internalType: "uint256", name: "_amount", type: "uint256" }, + { indexed: false, internalType: "bytes", name: "_data", type: "bytes" }, + ], + name: "DepositFinalized", + type: "event", + }, +]; + // Constants file exporting hardcoded contract addresses per chain. export const CONTRACT_ADDRESSES: { [chainId: number]: { @@ -1084,21 +1100,7 @@ export const CONTRACT_ADDRESSES: { }, ovmStandardBridge: { address: "0x4200000000000000000000000000000000000010", - abi: [ - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "_l1Token", type: "address" }, - { indexed: true, internalType: "address", name: "_l2Token", type: "address" }, - { indexed: true, internalType: "address", name: "_from", type: "address" }, - { indexed: false, internalType: "address", name: "_to", type: "address" }, - { indexed: false, internalType: "uint256", name: "_amount", type: "uint256" }, - { indexed: false, internalType: "bytes", name: "_data", type: "bytes" }, - ], - name: "DepositFinalized", - type: "event", - }, - ], + abi: OP_STANDARD_BRIDGE_ABI, }, weth: { address: "0x4200000000000000000000000000000000000006", @@ -1203,21 +1205,7 @@ export const CONTRACT_ADDRESSES: { 8453: { ovmStandardBridge: { address: "0x4200000000000000000000000000000000000010", - abi: [ - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "_l1Token", type: "address" }, - { indexed: true, internalType: "address", name: "_l2Token", type: "address" }, - { indexed: true, internalType: "address", name: "_from", type: "address" }, - { indexed: false, internalType: "address", name: "_to", type: "address" }, - { indexed: false, internalType: "uint256", name: "_amount", type: "uint256" }, - { indexed: false, internalType: "bytes", name: "_data", type: "bytes" }, - ], - name: "DepositFinalized", - type: "event", - }, - ], + abi: OP_STANDARD_BRIDGE_ABI, }, weth: { address: "0x4200000000000000000000000000000000000006", @@ -1238,21 +1226,7 @@ export const CONTRACT_ADDRESSES: { 34443: { ovmStandardBridge: { address: "0x4200000000000000000000000000000000000010", - abi: [ - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "_l1Token", type: "address" }, - { indexed: true, internalType: "address", name: "_l2Token", type: "address" }, - { indexed: true, internalType: "address", name: "_from", type: "address" }, - { indexed: false, internalType: "address", name: "_to", type: "address" }, - { indexed: false, internalType: "uint256", name: "_amount", type: "uint256" }, - { indexed: false, internalType: "bytes", name: "_data", type: "bytes" }, - ], - name: "DepositFinalized", - type: "event", - }, - ], + abi: OP_STANDARD_BRIDGE_ABI, }, weth: { address: "0x4200000000000000000000000000000000000006", @@ -1260,7 +1234,7 @@ export const CONTRACT_ADDRESSES: { }, eth: { address: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", - }, + }, }, 42161: { erc20Gateway: { diff --git a/yarn.lock b/yarn.lock index f5033a0e3..2e6237494 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,7 +11,7 @@ "@uma/common" "^2.17.0" hardhat "^2.9.3" -"@across-protocol/constants-v2@1.0.26": +"@across-protocol/constants-v2@1.0.26", "@across-protocol/constants-v2@^1.0.26": version "1.0.26" resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.26.tgz#04fff84574af9fe4128318a19d7b7990ee10f32e" integrity sha512-XuxBGNvhevdTT+GQGreg1YP+RsRWzuqOEHNA9m/p7l3qjFkXuWUM9nj77ttccbIi0tCZQDiMR8VxwHBCAXB4LQ== @@ -21,11 +21,6 @@ resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.20.tgz#d28fb3d3be8514db51c214d92bee954d15e5f06a" integrity sha512-DYb48kaAzv7t4/FVi4a5KYGNxJSG2rOY2mSznuWDI4n4mezM1wTTtQzK3un15tcwkTlIeO13CaDeABgR6jIVvg== -"@across-protocol/constants-v2@^1.0.20": - version "1.0.23" - resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.23.tgz#271fca7e93104c4a7591615da08d920ccab43df1" - integrity sha512-46G5pftiGqdl6W2YFQDaRxv7hYx/GMW0EvMOgbVwyjUUEJbf4s5+NbUUl0QBdlIfR5gvrsS2Vbts94UkSwrmAA== - "@across-protocol/contracts-v2@2.5.6": version "2.5.6" resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.5.6.tgz#3734e03ca42b81e8a878e6d88a5c5ddcb5a8e9ca" @@ -46,6 +41,26 @@ axios "^1.6.2" zksync-web3 "^0.14.3" +"@across-protocol/contracts-v2@2.5.7": + version "2.5.7" + resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.5.7.tgz#5bafbda17a4196593130c175fa6dc5d3b9d9f88d" + integrity sha512-MsvwUfjLiNmGHdVvTQxPHaOIt5U3bWRC99aM2cTzTw629ktH13G5PsCUgAPmPyXqm3WtyQqIOOcEuw5Sz0BAtA== + dependencies: + "@across-protocol/constants-v2" "^1.0.26" + "@defi-wonderland/smock" "^2.3.4" + "@eth-optimism/contracts" "^0.5.40" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@openzeppelin/contracts" "4.9.6" + "@openzeppelin/contracts-upgradeable" "4.9.6" + "@scroll-tech/contracts" "^0.1.0" + "@uma/common" "^2.34.0" + "@uma/contracts-node" "^0.4.17" + "@uma/core" "^2.56.0" + axios "^1.6.2" + zksync-web3 "^0.14.3" + "@across-protocol/contracts@^0.1.4": version "0.1.4" resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-0.1.4.tgz#64b3d91e639d2bb120ea94ddef3d160967047fa5" @@ -55,14 +70,14 @@ "@openzeppelin/contracts" "4.1.0" "@uma/core" "^2.18.0" -"@across-protocol/sdk-v2@0.23.11": - version "0.23.11" - resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.23.11.tgz#1deee92af37ae7fa7849b0dafadebd6f10260a8c" - integrity sha512-P1WQGJJ7+sI+l7wRGQx8Uxwn9Qmu0U8FsWmPSzGn9zbM1Jc7tUnKWJo2waPGCF3Og062oRDExD/QUwCqZxI5kw== +"@across-protocol/sdk-v2@0.23.13": + version "0.23.13" + resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.23.13.tgz#c177afd68ebd8b68ad4817e30ec544d6baa80118" + integrity sha512-X/pdm/lyy/RsYFbxq6N5c2fDKBMJhqF3L0YN0nD7gz2XobM9mO0nqCTxIKuz/r2ZCSk1QcXX9u9YLZVfLJ8zGg== dependencies: "@across-protocol/across-token" "^1.0.0" - "@across-protocol/constants-v2" "^1.0.20" - "@across-protocol/contracts-v2" "2.5.6" + "@across-protocol/constants-v2" "^1.0.26" + "@across-protocol/contracts-v2" "2.5.7" "@eth-optimism/sdk" "^3.2.2" "@pinata/sdk" "^2.1.0" "@types/mocha" "^10.0.1"