diff --git a/src/adapters/__tests__/decode-helpers.ts b/src/adapters/__tests__/decode-helpers.ts index 9f9244bf..20a5a97e 100644 --- a/src/adapters/__tests__/decode-helpers.ts +++ b/src/adapters/__tests__/decode-helpers.ts @@ -5,14 +5,14 @@ import { IL2AssetRouterABI, IBaseTokenABI, IERC20ABI, - InteropCenterABI, + IInteropCenterABI, } from '../../core/abi.ts'; const Bridgehub = new Interface(IBridgehubABI as any); const L2AssetRouter = new Interface(IL2AssetRouterABI as any); const BaseToken = new Interface(IBaseTokenABI as any); const IERC20 = new Interface(IERC20ABI as any); -const InteropCenter = new Interface(InteropCenterABI as any); +const InteropCenter = new Interface(IInteropCenterABI as any); const coder = new AbiCoder(); export function decodeTwoBridgeOuter(data: string) { diff --git a/src/adapters/__tests__/interop/direct.test.ts b/src/adapters/__tests__/interop/direct.test.ts index 09df91b6..610dff95 100644 --- a/src/adapters/__tests__/interop/direct.test.ts +++ b/src/adapters/__tests__/interop/direct.test.ts @@ -6,7 +6,7 @@ import { createEthersHarness, makeInteropContext } from '../adapter-harness.ts'; import { parseSendBundleTx } from '../decode-helpers.ts'; import { createEthersAttributesResource } from '../../ethers/resources/interop/attributes/resource.ts'; import { interopCodec } from '../../ethers/resources/interop/address.ts'; -import { InteropCenterABI, IInteropHandlerABI } from '../../../core/abi.ts'; +import { IInteropCenterABI, IInteropHandlerABI } from '../../../core/abi.ts'; import type { BuildCtx } from '../../ethers/resources/interop/context.ts'; import type { Hex, Address } from '../../../core/types/primitives.ts'; @@ -19,7 +19,7 @@ function makeTestBuildCtx( const ctx = makeInteropContext(harness); const attributes = createEthersAttributesResource(); - const interopCenterIface = new Interface(InteropCenterABI); + const interopCenterIface = new Interface(IInteropCenterABI); const interopHandlerIface = new Interface(IInteropHandlerABI); return { diff --git a/src/adapters/__tests__/interop/indirect.test.ts b/src/adapters/__tests__/interop/indirect.test.ts index b93c3754..e801a68a 100644 --- a/src/adapters/__tests__/interop/indirect.test.ts +++ b/src/adapters/__tests__/interop/indirect.test.ts @@ -12,7 +12,7 @@ import { parseSendBundleTx } from '../decode-helpers.ts'; import { createEthersAttributesResource } from '../../ethers/resources/interop/attributes/resource.ts'; import { interopCodec } from '../../ethers/resources/interop/address.ts'; import { - InteropCenterABI, + IInteropCenterABI, IInteropHandlerABI, IERC20ABI, L2NativeTokenVaultABI, @@ -33,7 +33,7 @@ function makeTestBuildCtx( const attributes = createEthersAttributesResource(); const tokens = createTokensResource(harness.client); - const interopCenterIface = new Interface(InteropCenterABI); + const interopCenterIface = new Interface(IInteropCenterABI); const interopHandlerIface = new Interface(IInteropHandlerABI); return { diff --git a/src/adapters/ethers/client.ts b/src/adapters/ethers/client.ts index 10dbb2b7..8773e71a 100644 --- a/src/adapters/ethers/client.ts +++ b/src/adapters/ethers/client.ts @@ -21,7 +21,7 @@ import { L2NativeTokenVaultABI, L1NativeTokenVaultABI, IBaseTokenABI, - InteropCenterABI, + IInteropCenterABI, IInteropHandlerABI, L2MessageVerificationABI, } from '../../core/abi'; @@ -262,7 +262,7 @@ export function createEthersClient(args: InitArgs): EthersClient { l2AssetRouter: new Contract(a.l2AssetRouter, IL2AssetRouterABI, l2), l2NativeTokenVault: new Contract(a.l2NativeTokenVault, L2NativeTokenVaultABI, l2), l2BaseTokenSystem: new Contract(a.l2BaseTokenSystem, IBaseTokenABI, l2), - interopCenter: new Contract(a.interopCenter, InteropCenterABI, l2), + interopCenter: new Contract(a.interopCenter, IInteropCenterABI, l2), interopHandler: new Contract(a.interopHandler, IInteropHandlerABI, l2), l2MessageVerification: new Contract(a.l2MessageVerification, L2MessageVerificationABI, l2), }; diff --git a/src/adapters/ethers/resources/interop/context.ts b/src/adapters/ethers/resources/interop/context.ts index 890327b5..b4e1e19c 100644 --- a/src/adapters/ethers/resources/interop/context.ts +++ b/src/adapters/ethers/resources/interop/context.ts @@ -9,7 +9,7 @@ import { type TxGasOverrides, toGasOverrides } from '../../../../core/types/fees import type { TokensResource } from '../../../../core/types/flows/token'; import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource'; import type { ContractsResource } from '../contracts'; -import { IInteropHandlerABI, InteropCenterABI } from '../../../../core/abi'; +import { IInteropHandlerABI, IInteropCenterABI } from '../../../../core/abi'; import { createError } from '../../../../core/errors/factory'; import { OP_INTEROP } from '../../../../core/types/errors'; @@ -94,7 +94,7 @@ export async function commonCtx( client.baseToken(dstChainId), ]); - const interopCenterIface = new Interface(InteropCenterABI); + const interopCenterIface = new Interface(IInteropCenterABI); const interopHandlerIface = new Interface(IInteropHandlerABI); const baseMatches = srcBaseToken.toLowerCase() === dstBaseToken.toLowerCase(); diff --git a/src/adapters/ethers/resources/interop/services/finalization/data-fetchers.ts b/src/adapters/ethers/resources/interop/services/finalization/data-fetchers.ts index 659686b0..6ededd71 100644 --- a/src/adapters/ethers/resources/interop/services/finalization/data-fetchers.ts +++ b/src/adapters/ethers/resources/interop/services/finalization/data-fetchers.ts @@ -3,7 +3,7 @@ import type { Address, Hex } from '../../../../../../core/types/primitives'; import type { Log } from '../../../../../../core/types/transactions'; import { createErrorHandlers } from '../../../../errors/error-ops'; import { OP_INTEROP } from '../../../../../../core/types'; -import { InteropRootStorageABI } from '../../../../../../core/abi'; +import { IInteropRootStorageABI } from '../../../../../../core/abi'; import { L2_INTEROP_ROOT_STORAGE_ADDRESS } from '../../../../../../core/constants'; const { wrap } = createErrorHandlers('interop'); @@ -125,7 +125,7 @@ export async function getInteropRoot( async () => { const rootStorage = new Contract( L2_INTEROP_ROOT_STORAGE_ADDRESS, - InteropRootStorageABI, + IInteropRootStorageABI, provider, ); diff --git a/src/adapters/ethers/resources/interop/services/finalization/topics.ts b/src/adapters/ethers/resources/interop/services/finalization/topics.ts index 525c27ae..3d68b0b0 100644 --- a/src/adapters/ethers/resources/interop/services/finalization/topics.ts +++ b/src/adapters/ethers/resources/interop/services/finalization/topics.ts @@ -1,6 +1,6 @@ import { Interface } from 'ethers'; import type { InteropTopics } from '../../../../../../core/resources/interop/events'; -import InteropCenterAbi from '../../../../../../core/internal/abis/InteropCenter'; +import InteropCenterAbi from '../../../../../../core/internal/abis/IInteropCenter'; import IInteropHandlerAbi from '../../../../../../core/internal/abis/IInteropHandler'; import type { Hex } from '../../../../../../core'; diff --git a/src/core/abi.ts b/src/core/abi.ts index 8dea45d6..85619228 100644 --- a/src/core/abi.ts +++ b/src/core/abi.ts @@ -10,7 +10,7 @@ export { default as IBaseTokenABI } from './internal/abis/IBaseToken'; export { default as IERC20ABI } from './internal/abis/IERC20'; export { default as IERC7786AttributesABI } from './internal/abis/IERC7786Attributes'; export { default as MailboxABI } from './internal/abis/Mailbox'; -export { default as InteropCenterABI } from './internal/abis/InteropCenter'; +export { default as IInteropCenterABI } from './internal/abis/IInteropCenter'; export { default as IInteropHandlerABI } from './internal/abis/IInteropHandler'; -export { default as InteropRootStorageABI } from './internal/abis/InteropRootStorage'; +export { default as IInteropRootStorageABI } from './internal/abis/IInteropRootStorage'; export { default as L2MessageVerificationABI } from './internal/abis/L2MessageVerification'; diff --git a/src/core/internal/abis/IInteropCenter.ts b/src/core/internal/abis/IInteropCenter.ts index 9302714f..787b84ed 100644 --- a/src/core/internal/abis/IInteropCenter.ts +++ b/src/core/internal/abis/IInteropCenter.ts @@ -1,271 +1,663 @@ const IInteropCenterABI = [ { - anonymous: false, + type: 'function', + name: 'L1_CHAIN_ID', + inputs: [], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'ZK_INTEROP_FEE', + inputs: [], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'ZK_TOKEN_ASSET_ID', + inputs: [], + outputs: [ + { + name: '', + type: 'bytes32', + internalType: 'bytes32', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'accumulatedProtocolFees', + inputs: [ + { + name: 'coinbase', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'accumulatedZKFees', + inputs: [ + { + name: 'coinbase', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'claimProtocolFees', + inputs: [ + { + name: '_receiver', + type: 'address', + internalType: 'address', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'claimZKFees', + inputs: [ + { + name: '_receiver', + type: 'address', + internalType: 'address', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'forwardTransactionOnGatewayWithBalanceChange', + inputs: [ + { + name: '_chainId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: '_canonicalTxHash', + type: 'bytes32', + internalType: 'bytes32', + }, + { + name: '_expirationTimestamp', + type: 'uint64', + internalType: 'uint64', + }, + { + name: '_balanceChange', + type: 'tuple', + internalType: 'struct BalanceChange', + components: [ + { + name: 'version', + type: 'bytes1', + internalType: 'bytes1', + }, + { + name: 'originToken', + type: 'address', + internalType: 'address', + }, + { + name: 'baseTokenAssetId', + type: 'bytes32', + internalType: 'bytes32', + }, + { + name: 'baseTokenAmount', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'assetId', + type: 'bytes32', + internalType: 'bytes32', + }, + { + name: 'amount', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'tokenOriginChainId', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'getZKTokenAddress', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'initL2', + inputs: [ + { + name: '_l1ChainId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: '_owner', + type: 'address', + internalType: 'address', + }, + { + name: '_zkTokenAssetId', + type: 'bytes32', + internalType: 'bytes32', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'interopBundleNonce', + inputs: [ + { + name: 'sender', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'interopProtocolFee', + inputs: [], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'parseAttributes', + inputs: [ + { + name: '_attributes', + type: 'bytes[]', + internalType: 'bytes[]', + }, + { + name: '_restriction', + type: 'uint8', + internalType: 'enum IInteropCenter.AttributeParsingRestrictions', + }, + ], + outputs: [ + { + name: 'callAttributes', + type: 'tuple', + internalType: 'struct CallAttributes', + components: [ + { + name: 'interopCallValue', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'indirectCall', + type: 'bool', + internalType: 'bool', + }, + { + name: 'indirectCallMessageValue', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, + { + name: 'bundleAttributes', + type: 'tuple', + internalType: 'struct BundleAttributes', + components: [ + { + name: 'executionAddress', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'unbundlerAddress', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'useFixedFee', + type: 'bool', + internalType: 'bool', + }, + ], + }, + ], + stateMutability: 'pure', + }, + { + type: 'function', + name: 'pause', + inputs: [], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'sendBundle', + inputs: [ + { + name: '_destinationChainId', + type: 'bytes', + internalType: 'bytes', + }, + { + name: '_callStarters', + type: 'tuple[]', + internalType: 'struct InteropCallStarter[]', + components: [ + { + name: 'to', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'data', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'callAttributes', + type: 'bytes[]', + internalType: 'bytes[]', + }, + ], + }, + { + name: '_bundleAttributes', + type: 'bytes[]', + internalType: 'bytes[]', + }, + ], + outputs: [ + { + name: 'bundleHash', + type: 'bytes32', + internalType: 'bytes32', + }, + ], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'setInteropFee', + inputs: [ + { + name: '_fee', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'unpause', + inputs: [], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'updateL2', + inputs: [ + { + name: '_l1ChainId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: '_owner', + type: 'address', + internalType: 'address', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'zkToken', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'contract IERC20', + }, + ], + stateMutability: 'view', + }, + { + type: 'event', + name: 'FixedZKFeesAccumulated', inputs: [ { + name: 'payer', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'coinbase', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', indexed: false, - internalType: 'bytes32', - name: 'l2l1MsgHash', - type: 'bytes32', + internalType: 'uint256', }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'InteropBundleSent', + inputs: [ { + name: 'l2l1MsgHash', + type: 'bytes32', indexed: false, internalType: 'bytes32', + }, + { name: 'interopBundleHash', type: 'bytes32', + indexed: false, + internalType: 'bytes32', }, { + name: 'interopBundle', + type: 'tuple', + indexed: false, + internalType: 'struct InteropBundle', components: [ { - internalType: 'bytes1', name: 'version', type: 'bytes1', + internalType: 'bytes1', }, { - internalType: 'uint256', name: 'sourceChainId', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'uint256', name: 'destinationChainId', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'bytes32', name: 'interopBundleSalt', type: 'bytes32', + internalType: 'bytes32', }, { + name: 'calls', + type: 'tuple[]', + internalType: 'struct InteropCall[]', components: [ { - internalType: 'bytes1', name: 'version', type: 'bytes1', + internalType: 'bytes1', }, { - internalType: 'bool', name: 'shadowAccount', type: 'bool', + internalType: 'bool', }, { - internalType: 'address', name: 'to', type: 'address', + internalType: 'address', }, { - internalType: 'address', name: 'from', type: 'address', + internalType: 'address', }, { - internalType: 'uint256', name: 'value', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'bytes', name: 'data', type: 'bytes', + internalType: 'bytes', }, ], - internalType: 'struct InteropCall[]', - name: 'calls', - type: 'tuple[]', }, { + name: 'bundleAttributes', + type: 'tuple', + internalType: 'struct BundleAttributes', components: [ { - internalType: 'bytes', name: 'executionAddress', type: 'bytes', + internalType: 'bytes', }, { - internalType: 'bytes', name: 'unbundlerAddress', type: 'bytes', + internalType: 'bytes', + }, + { + name: 'useFixedFee', + type: 'bool', + internalType: 'bool', }, ], - internalType: 'struct BundleAttributes', - name: 'bundleAttributes', - type: 'tuple', }, ], - indexed: false, - internalType: 'struct InteropBundle', - name: 'interopBundle', - type: 'tuple', }, ], - name: 'InteropBundleSent', - type: 'event', + anonymous: false, }, { - anonymous: false, + type: 'event', + name: 'InteropFeeUpdated', inputs: [ { + name: 'oldFee', + type: 'uint256', indexed: true, - internalType: 'address', - name: 'oldAssetRouter', - type: 'address', + internalType: 'uint256', }, { + name: 'newFee', + type: 'uint256', indexed: true, - internalType: 'address', - name: 'newAssetRouter', - type: 'address', + internalType: 'uint256', }, ], - name: 'NewAssetRouter', - type: 'event', + anonymous: false, }, { - anonymous: false, + type: 'event', + name: 'NewAssetRouter', inputs: [ { + name: 'oldAssetRouter', + type: 'address', indexed: true, internalType: 'address', - name: 'oldAssetTracker', - type: 'address', }, { + name: 'newAssetRouter', + type: 'address', indexed: true, internalType: 'address', - name: 'newAssetTracker', - type: 'address', }, ], - name: 'NewAssetTracker', - type: 'event', + anonymous: false, }, { + type: 'event', + name: 'NewAssetTracker', inputs: [ { - internalType: 'uint256', - name: '_chainId', - type: 'uint256', + name: 'oldAssetTracker', + type: 'address', + indexed: true, + internalType: 'address', }, { - internalType: 'bytes32', - name: '_canonicalTxHash', - type: 'bytes32', + name: 'newAssetTracker', + type: 'address', + indexed: true, + internalType: 'address', }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'ProtocolFeesAccumulated', + inputs: [ { - internalType: 'uint64', - name: '_expirationTimestamp', - type: 'uint64', + name: 'coinbase', + type: 'address', + indexed: true, + internalType: 'address', }, { - components: [ - { - internalType: 'bytes1', - name: 'version', - type: 'bytes1', - }, - { - internalType: 'address', - name: 'originToken', - type: 'address', - }, - { - internalType: 'bytes32', - name: 'baseTokenAssetId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: 'baseTokenAmount', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: 'assetId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenOriginChainId', - type: 'uint256', - }, - ], - internalType: 'struct BalanceChange', - name: '_balanceChange', - type: 'tuple', + name: 'amount', + type: 'uint256', + indexed: false, + internalType: 'uint256', }, ], - name: 'forwardTransactionOnGatewayWithBalanceChange', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', + anonymous: false, }, { + type: 'event', + name: 'ProtocolFeesClaimed', inputs: [ { - internalType: 'uint256', - name: '_l1ChainId', - type: 'uint256', + name: 'coinbase', + type: 'address', + indexed: true, + internalType: 'address', }, { - internalType: 'address', - name: '_owner', + name: 'receiver', type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + internalType: 'uint256', }, ], - name: 'initL2', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', + anonymous: false, }, { + type: 'event', + name: 'ZKFeesClaimed', inputs: [ { - internalType: 'bytes', - name: '_destinationChainId', - type: 'bytes', - }, - { - components: [ - { - internalType: 'bytes', - name: 'to', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - { - internalType: 'bytes[]', - name: 'callAttributes', - type: 'bytes[]', - }, - ], - internalType: 'struct InteropCallStarter[]', - name: '_callStarters', - type: 'tuple[]', + name: 'coinbase', + type: 'address', + indexed: true, + internalType: 'address', }, { - internalType: 'bytes[]', - name: '_bundleAttributes', - type: 'bytes[]', + name: 'receiver', + type: 'address', + indexed: true, + internalType: 'address', }, - ], - name: 'sendBundle', - outputs: [ { - internalType: 'bytes32', - name: '', - type: 'bytes32', + name: 'amount', + type: 'uint256', + indexed: false, + internalType: 'uint256', }, ], - stateMutability: 'payable', - type: 'function', + anonymous: false, }, ] as const; diff --git a/src/core/internal/abis/IInteropHandler.ts b/src/core/internal/abis/IInteropHandler.ts index 661e8bbb..3f8f7d93 100644 --- a/src/core/internal/abis/IInteropHandler.ts +++ b/src/core/internal/abis/IInteropHandler.ts @@ -1,214 +1,283 @@ const IInteropHandlerABI = [ { - anonymous: false, - inputs: [ + type: 'function', + name: 'L1_CHAIN_ID', + inputs: [], + outputs: [ { - indexed: true, - internalType: 'bytes32', - name: 'bundleHash', - type: 'bytes32', + name: '', + type: 'uint256', + internalType: 'uint256', }, ], - name: 'BundleExecuted', - type: 'event', + stateMutability: 'view', }, { - anonymous: false, + type: 'function', + name: 'bundleStatus', inputs: [ { - indexed: true, - internalType: 'bytes32', name: 'bundleHash', type: 'bytes32', + internalType: 'bytes32', }, ], - name: 'BundleUnbundled', - type: 'event', - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: true, - internalType: 'bytes32', - name: 'bundleHash', - type: 'bytes32', + name: '', + type: 'uint8', + internalType: 'enum BundleStatus', }, ], - name: 'BundleVerified', - type: 'event', + stateMutability: 'view', }, { - anonymous: false, + type: 'function', + name: 'callStatus', inputs: [ { - indexed: true, - internalType: 'bytes32', name: 'bundleHash', type: 'bytes32', + internalType: 'bytes32', }, { - indexed: true, - internalType: 'uint256', name: 'callIndex', type: 'uint256', + internalType: 'uint256', }, + ], + outputs: [ { - indexed: false, - internalType: 'enum CallStatus', - name: 'status', + name: '', type: 'uint8', + internalType: 'enum CallStatus', }, ], - name: 'CallProcessed', - type: 'event', + stateMutability: 'view', }, { + type: 'function', + name: 'executeBundle', inputs: [ { - internalType: 'bytes', name: '_bundle', type: 'bytes', + internalType: 'bytes', }, { + name: '_proof', + type: 'tuple', + internalType: 'struct MessageInclusionProof', components: [ { - internalType: 'uint256', name: 'chainId', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'uint256', name: 'l1BatchNumber', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'uint256', name: 'l2MessageIndex', type: 'uint256', + internalType: 'uint256', }, { + name: 'message', + type: 'tuple', + internalType: 'struct L2Message', components: [ { - internalType: 'uint16', name: 'txNumberInBatch', type: 'uint16', + internalType: 'uint16', }, { - internalType: 'address', name: 'sender', type: 'address', + internalType: 'address', }, { - internalType: 'bytes', name: 'data', type: 'bytes', + internalType: 'bytes', }, ], - internalType: 'struct L2Message', - name: 'message', - type: 'tuple', }, { - internalType: 'bytes32[]', name: 'proof', type: 'bytes32[]', + internalType: 'bytes32[]', }, ], - internalType: 'struct MessageInclusionProof', - name: '_proof', - type: 'tuple', }, ], - name: 'executeBundle', outputs: [], stateMutability: 'nonpayable', - type: 'function', }, { + type: 'function', + name: 'initL2', inputs: [ { + name: '_l1ChainId', + type: 'uint256', internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'unbundleBundle', + inputs: [ + { name: '_sourceChainId', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'bytes', name: '_bundle', type: 'bytes', + internalType: 'bytes', }, { - internalType: 'enum CallStatus[]', name: '_callStatus', type: 'uint8[]', + internalType: 'enum CallStatus[]', }, ], - name: 'unbundleBundle', outputs: [], stateMutability: 'nonpayable', - type: 'function', }, { + type: 'function', + name: 'verifyBundle', inputs: [ { - internalType: 'bytes', name: '_bundle', type: 'bytes', + internalType: 'bytes', }, { + name: '_proof', + type: 'tuple', + internalType: 'struct MessageInclusionProof', components: [ { - internalType: 'uint256', name: 'chainId', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'uint256', name: 'l1BatchNumber', type: 'uint256', + internalType: 'uint256', }, { - internalType: 'uint256', name: 'l2MessageIndex', type: 'uint256', + internalType: 'uint256', }, { + name: 'message', + type: 'tuple', + internalType: 'struct L2Message', components: [ { - internalType: 'uint16', name: 'txNumberInBatch', type: 'uint16', + internalType: 'uint16', }, { - internalType: 'address', name: 'sender', type: 'address', + internalType: 'address', }, { - internalType: 'bytes', name: 'data', type: 'bytes', + internalType: 'bytes', }, ], - internalType: 'struct L2Message', - name: 'message', - type: 'tuple', }, { - internalType: 'bytes32[]', name: 'proof', type: 'bytes32[]', + internalType: 'bytes32[]', }, ], - internalType: 'struct MessageInclusionProof', - name: '_proof', - type: 'tuple', }, ], - name: 'verifyBundle', outputs: [], stateMutability: 'nonpayable', - type: 'function', + }, + { + type: 'event', + name: 'BundleExecuted', + inputs: [ + { + name: 'bundleHash', + type: 'bytes32', + indexed: true, + internalType: 'bytes32', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'BundleUnbundled', + inputs: [ + { + name: 'bundleHash', + type: 'bytes32', + indexed: true, + internalType: 'bytes32', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'BundleVerified', + inputs: [ + { + name: 'bundleHash', + type: 'bytes32', + indexed: true, + internalType: 'bytes32', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'CallProcessed', + inputs: [ + { + name: 'bundleHash', + type: 'bytes32', + indexed: true, + internalType: 'bytes32', + }, + { + name: 'callIndex', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + { + name: 'status', + type: 'uint8', + indexed: false, + internalType: 'enum CallStatus', + }, + ], + anonymous: false, }, ] as const; diff --git a/src/core/internal/abis/IInteropRootStorage.ts b/src/core/internal/abis/IInteropRootStorage.ts new file mode 100644 index 00000000..c47218c9 --- /dev/null +++ b/src/core/internal/abis/IInteropRootStorage.ts @@ -0,0 +1,53 @@ +const InteropRootStorageABI = [ + { + type: 'function', + name: 'interopRoots', + inputs: [ + { + name: 'chainId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'blockOrBatchNumber', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: '', + type: 'bytes32', + internalType: 'bytes32', + }, + ], + stateMutability: 'view', + }, + { + type: 'event', + name: 'InteropRootAdded', + inputs: [ + { + name: 'chainId', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + { + name: 'blockNumber', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + { + name: 'sides', + type: 'bytes32[]', + indexed: false, + internalType: 'bytes32[]', + }, + ], + anonymous: false, + }, +] as const; + +export default InteropRootStorageABI; diff --git a/src/core/internal/abis/InteropCenter.ts b/src/core/internal/abis/InteropCenter.ts deleted file mode 100644 index 66fb5472..00000000 --- a/src/core/internal/abis/InteropCenter.ts +++ /dev/null @@ -1,750 +0,0 @@ -const InteropCenterABI = [ - { - inputs: [ - { - internalType: 'bytes4', - name: 'selector', - type: 'bytes4', - }, - ], - name: 'AttributeAlreadySet', - type: 'error', - }, - { - inputs: [ - { - internalType: 'bytes4', - name: 'selector', - type: 'bytes4', - }, - { - internalType: 'uint256', - name: 'restriction', - type: 'uint256', - }, - ], - name: 'AttributeViolatesRestriction', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'expected', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'actual', - type: 'uint256', - }, - ], - name: 'IndirectCallValueMismatch', - type: 'error', - }, - { - inputs: [ - { - internalType: 'bytes', - name: 'interoperableAddress', - type: 'bytes', - }, - ], - name: 'InteroperableAddressChainReferenceNotEmpty', - type: 'error', - }, - { - inputs: [ - { - internalType: 'bytes', - name: 'interoperableAddress', - type: 'bytes', - }, - ], - name: 'InteroperableAddressNotEmpty', - type: 'error', - }, - { - inputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - name: 'InteroperableAddressParsingError', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'expectedMsgValue', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'providedMsgValue', - type: 'uint256', - }, - ], - name: 'MsgValueMismatch', - type: 'error', - }, - { - inputs: [], - name: 'NotInGatewayMode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'sourceChainId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'destinationChainId', - type: 'uint256', - }, - ], - name: 'NotL2ToL2', - type: 'error', - }, - { - inputs: [], - name: 'SlotOccupied', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'caller', - type: 'address', - }, - ], - name: 'Unauthorized', - type: 'error', - }, - { - inputs: [ - { - internalType: 'bytes4', - name: 'selector', - type: 'bytes4', - }, - ], - name: 'UnsupportedAttribute', - type: 'error', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint8', - name: 'version', - type: 'uint8', - }, - ], - name: 'Initialized', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'bytes32', - name: 'l2l1MsgHash', - type: 'bytes32', - }, - { - indexed: false, - internalType: 'bytes32', - name: 'interopBundleHash', - type: 'bytes32', - }, - { - components: [ - { - internalType: 'bytes1', - name: 'version', - type: 'bytes1', - }, - { - internalType: 'uint256', - name: 'sourceChainId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'destinationChainId', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: 'interopBundleSalt', - type: 'bytes32', - }, - { - components: [ - { - internalType: 'bytes1', - name: 'version', - type: 'bytes1', - }, - { - internalType: 'bool', - name: 'shadowAccount', - type: 'bool', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - internalType: 'struct InteropCall[]', - name: 'calls', - type: 'tuple[]', - }, - { - components: [ - { - internalType: 'bytes', - name: 'executionAddress', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'unbundlerAddress', - type: 'bytes', - }, - ], - internalType: 'struct BundleAttributes', - name: 'bundleAttributes', - type: 'tuple', - }, - ], - indexed: false, - internalType: 'struct InteropBundle', - name: 'interopBundle', - type: 'tuple', - }, - ], - name: 'InteropBundleSent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'sendId', - type: 'bytes32', - }, - { - indexed: false, - internalType: 'bytes', - name: 'sender', - type: 'bytes', - }, - { - indexed: false, - internalType: 'bytes', - name: 'recipient', - type: 'bytes', - }, - { - indexed: false, - internalType: 'bytes', - name: 'payload', - type: 'bytes', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes[]', - name: 'attributes', - type: 'bytes[]', - }, - ], - name: 'MessageSent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldAssetRouter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newAssetRouter', - type: 'address', - }, - ], - name: 'NewAssetRouter', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldAssetTracker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newAssetTracker', - type: 'address', - }, - ], - name: 'NewAssetTracker', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferStarted', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'Paused', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'Unpaused', - type: 'event', - }, - { - inputs: [], - name: 'L1_CHAIN_ID', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_chainId', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: '_canonicalTxHash', - type: 'bytes32', - }, - { - internalType: 'uint64', - name: '_expirationTimestamp', - type: 'uint64', - }, - { - components: [ - { - internalType: 'bytes1', - name: 'version', - type: 'bytes1', - }, - { - internalType: 'address', - name: 'originToken', - type: 'address', - }, - { - internalType: 'bytes32', - name: 'baseTokenAssetId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: 'baseTokenAmount', - type: 'uint256', - }, - { - internalType: 'bytes32', - name: 'assetId', - type: 'bytes32', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenOriginChainId', - type: 'uint256', - }, - ], - internalType: 'struct BalanceChange', - name: '_balanceChange', - type: 'tuple', - }, - ], - name: 'forwardTransactionOnGatewayWithBalanceChange', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_l1ChainId', - type: 'uint256', - }, - { - internalType: 'address', - name: '_owner', - type: 'address', - }, - ], - name: 'initL2', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'interopBundleNonce', - outputs: [ - { - internalType: 'uint256', - name: 'numberOfBundlesSent', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes[]', - name: '_attributes', - type: 'bytes[]', - }, - { - internalType: 'enum IInteropCenter.AttributeParsingRestrictions', - name: '_restriction', - type: 'uint8', - }, - ], - name: 'parseAttributes', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'interopCallValue', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'indirectCall', - type: 'bool', - }, - { - internalType: 'uint256', - name: 'indirectCallMessageValue', - type: 'uint256', - }, - ], - internalType: 'struct CallAttributes', - name: 'callAttributes', - type: 'tuple', - }, - { - components: [ - { - internalType: 'bytes', - name: 'executionAddress', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'unbundlerAddress', - type: 'bytes', - }, - ], - internalType: 'struct BundleAttributes', - name: 'bundleAttributes', - type: 'tuple', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - { - inputs: [], - name: 'pause', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'paused', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'pendingOwner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'renounceOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes', - name: '_destinationChainId', - type: 'bytes', - }, - { - components: [ - { - internalType: 'bytes', - name: 'to', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - { - internalType: 'bytes[]', - name: 'callAttributes', - type: 'bytes[]', - }, - ], - internalType: 'struct InteropCallStarter[]', - name: '_callStarters', - type: 'tuple[]', - }, - { - internalType: 'bytes[]', - name: '_bundleAttributes', - type: 'bytes[]', - }, - ], - name: 'sendBundle', - outputs: [ - { - internalType: 'bytes32', - name: 'bundleHash', - type: 'bytes32', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes', - name: 'recipient', - type: 'bytes', - }, - { - internalType: 'bytes', - name: 'payload', - type: 'bytes', - }, - { - internalType: 'bytes[]', - name: 'attributes', - type: 'bytes[]', - }, - ], - name: 'sendMessage', - outputs: [ - { - internalType: 'bytes32', - name: 'sendId', - type: 'bytes32', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes4', - name: '_attributeSelector', - type: 'bytes4', - }, - ], - name: 'supportsAttribute', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'unpause', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -] as const; - -export default InteropCenterABI; diff --git a/src/core/internal/abis/InteropRootStorage.ts b/src/core/internal/abis/InteropRootStorage.ts deleted file mode 100644 index a1b714f1..00000000 --- a/src/core/internal/abis/InteropRootStorage.ts +++ /dev/null @@ -1,28 +0,0 @@ -const InteropRootStorageABI = [ - { - inputs: [ - { - internalType: 'uint256', - name: 'chainId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'batchNumber', - type: 'uint256', - }, - ], - name: 'interopRoots', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -] as const; - -export default InteropRootStorageABI;