@ensdomains/unruggable-gateways
Version:
Trustless Ethereum Multichain CCIP-Read Gateway
45 lines (44 loc) • 1.73 kB
JavaScript
import { Interface } from 'ethers/abi';
import { ABI_CODER } from '../utils.mjs';
// https://github.com/matter-labs/era-contracts/blob/main/l1-contracts/contracts/state-transition/chain-interfaces/IGetters.sol
// https://github.com/matter-labs/era-contracts/blob/main/l1-contracts/contracts/state-transition/chain-interfaces/IExecutor.sol
export const DIAMOND_ABI = new Interface([
`function storedBatchHash(uint256 batchNumber) view returns (bytes32)`,
`function l2LogsRootHash(uint256 batchNumber) external view returns (bytes32)`,
//`function getTotalBatchesCommitted() view returns (uint256)`,
//`function getTotalBatchesVerified() view returns (uint256)`,
`function getTotalBatchesExecuted() view returns (uint256)`,
`function commitBatchesSharedBridge(
uint256 chainId,
(
uint64 batchNumber,
bytes32 batchHash,
uint64 indexRepeatedStorageChanges,
uint256 numberOfLayer1Txs,
bytes32 priorityOperationsHash,
bytes32 l2LogsTreeRoot,
uint256 timestamp,
bytes32 commitment,
) lastCommittedBatchData,
(
uint64 batchNumber,
uint64 timestamp,
uint64 indexRepeatedStorageChanges,
bytes32 newStateRoot,
uint256 numberOfLayer1Txs,
bytes32 priorityOperationsHash,
bytes32 bootloaderHeapInitialContentsHash,
bytes32 eventsQueueStateHash,
bytes systemLogs,
bytes pubdataCommitments
)[] newBatchesData
)`,
`event BlockCommit(
uint256 indexed batchNumber,
bytes32 indexed batchHash,
bytes32 indexed commitment
)`,
]);
export function encodeProof(proof) {
return ABI_CODER.encode(['bytes32', 'uint64', 'bytes32[]'], [proof.value, proof.index, proof.proof]);
}