Skip to content

Commit

Permalink
condense op standard bridge abi
Browse files Browse the repository at this point in the history
Signed-off-by: Bennett <[email protected]>
  • Loading branch information
bmzig committed May 16, 2024
1 parent 8844680 commit 53b26ec
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/clients/TokenClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
66 changes: 20 additions & 46 deletions src/common/ContractAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -1238,29 +1226,15 @@ 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",
abi: OP_WETH_ABI,
},
eth: {
address: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
},
},
},
42161: {
erc20Gateway: {
Expand Down
39 changes: 27 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@uma/common" "^2.17.0"
hardhat "^2.9.3"

"@across-protocol/[email protected]":
"@across-protocol/[email protected]", "@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==
Expand All @@ -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/[email protected]":
version "2.5.6"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.5.6.tgz#3734e03ca42b81e8a878e6d88a5c5ddcb5a8e9ca"
Expand All @@ -46,6 +41,26 @@
axios "^1.6.2"
zksync-web3 "^0.14.3"

"@across-protocol/[email protected]":
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"
Expand All @@ -55,14 +70,14 @@
"@openzeppelin/contracts" "4.1.0"
"@uma/core" "^2.18.0"

"@across-protocol/[email protected].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/[email protected].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"
Expand Down

0 comments on commit 53b26ec

Please sign in to comment.