Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ScrollChain
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {IL1MessageQueue} from "./IL1MessageQueue.sol"; import {IScrollChain} from "./IScrollChain.sol"; import {BatchHeaderV0Codec} from "../../libraries/codec/BatchHeaderV0Codec.sol"; import {BatchHeaderV1Codec} from "../../libraries/codec/BatchHeaderV1Codec.sol"; import {ChunkCodecV0} from "../../libraries/codec/ChunkCodecV0.sol"; import {ChunkCodecV1} from "../../libraries/codec/ChunkCodecV1.sol"; import {IRollupVerifier} from "../../libraries/verifier/IRollupVerifier.sol"; // solhint-disable no-inline-assembly // solhint-disable reason-string /// @title ScrollChain /// @notice This contract maintains data for the Scroll rollup. contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain { /********** * Errors * **********/ /// @dev Thrown when the given account is not EOA account. error ErrorAccountIsNotEOA(); /// @dev Thrown when committing a committed batch. error ErrorBatchIsAlreadyCommitted(); /// @dev Thrown when finalizing a verified batch. error ErrorBatchIsAlreadyVerified(); /// @dev Thrown when committing empty batch (batch without chunks) error ErrorBatchIsEmpty(); /// @dev Thrown when call precompile failed. error ErrorCallPointEvaluationPrecompileFailed(); /// @dev Thrown when the caller is not prover. error ErrorCallerIsNotProver(); /// @dev Thrown when the caller is not sequencer. error ErrorCallerIsNotSequencer(); /// @dev Thrown when the transaction has multiple blobs. error ErrorFoundMultipleBlob(); /// @dev Thrown when some fields are not zero in genesis batch. error ErrorGenesisBatchHasNonZeroField(); /// @dev Thrown when importing genesis batch twice. error ErrorGenesisBatchImported(); /// @dev Thrown when data hash in genesis batch is zero. error ErrorGenesisDataHashIsZero(); /// @dev Thrown when the parent batch hash in genesis batch is zero. error ErrorGenesisParentBatchHashIsNonZero(); /// @dev Thrown when the l2 transaction is incomplete. error ErrorIncompleteL2TransactionData(); /// @dev Thrown when the batch hash is incorrect. error ErrorIncorrectBatchHash(); /// @dev Thrown when the batch index is incorrect. error ErrorIncorrectBatchIndex(); /// @dev Thrown when the bitmap length is incorrect. error ErrorIncorrectBitmapLength(); /// @dev Thrown when the previous state root doesn't match stored one. error ErrorIncorrectPreviousStateRoot(); /// @dev Thrown when the batch header version is invalid. error ErrorInvalidBatchHeaderVersion(); /// @dev Thrown when the last message is skipped. error ErrorLastL1MessageSkipped(); /// @dev Thrown when no blob found in the transaction. error ErrorNoBlobFound(); /// @dev Thrown when the number of transactions is less than number of L1 message in one block. error ErrorNumTxsLessThanNumL1Msgs(); /// @dev Thrown when the given previous state is zero. error ErrorPreviousStateRootIsZero(); /// @dev Thrown when the number of batches to revert is zero. error ErrorRevertZeroBatches(); /// @dev Thrown when the reverted batches are not in the ending of commited batch chain. error ErrorRevertNotStartFromEnd(); /// @dev Thrown when reverting a finialized batch. error ErrorRevertFinalizedBatch(); /// @dev Thrown when the given state root is zero. error ErrorStateRootIsZero(); /// @dev Thrown when a chunk contains too many transactions. error ErrorTooManyTxsInOneChunk(); /// @dev Thrown when the precompile output is incorrect. error ErrorUnexpectedPointEvaluationPrecompileOutput(); /// @dev Thrown when the given address is `address(0)`. error ErrorZeroAddress(); /************* * Constants * *************/ /// @dev Address of the point evaluation precompile used for EIP-4844 blob verification. address private constant POINT_EVALUATION_PRECOMPILE_ADDR = address(0x0A); /// @dev BLS Modulus value defined in EIP-4844 and the magic value returned from a successful call to the /// point evaluation precompile uint256 private constant BLS_MODULUS = 52435875175126190479447740508185965837690552500527637822603658699938581184513; /// @notice The chain id of the corresponding layer 2 chain. uint64 public immutable layer2ChainId; /// @notice The address of L1MessageQueue contract. address public immutable messageQueue; /// @notice The address of RollupVerifier. address public immutable verifier; /************* * Variables * *************/ /// @notice The maximum number of transactions allowed in each chunk. uint256 public maxNumTxInChunk; /// @dev The storage slot used as L1MessageQueue contract, which is deprecated now. address private __messageQueue; /// @dev The storage slot used as RollupVerifier contract, which is deprecated now. address private __verifier; /// @notice Whether an account is a sequencer. mapping(address => bool) public isSequencer; /// @notice Whether an account is a prover. mapping(address => bool) public isProver; /// @inheritdoc IScrollChain uint256 public override lastFinalizedBatchIndex; /// @inheritdoc IScrollChain mapping(uint256 => bytes32) public override committedBatches; /// @inheritdoc IScrollChain mapping(uint256 => bytes32) public override finalizedStateRoots; /// @inheritdoc IScrollChain mapping(uint256 => bytes32) public override withdrawRoots; /********************** * Function Modifiers * **********************/ modifier OnlySequencer() { // @note In the decentralized mode, it should be only called by a list of validator. if (!isSequencer[_msgSender()]) revert ErrorCallerIsNotSequencer(); _; } modifier OnlyProver() { if (!isProver[_msgSender()]) revert ErrorCallerIsNotProver(); _; } /*************** * Constructor * ***************/ /// @notice Constructor for `ScrollChain` implementation contract. /// /// @param _chainId The chain id of L2. /// @param _messageQueue The address of `L1MessageQueue` contract. /// @param _verifier The address of zkevm verifier contract. constructor( uint64 _chainId, address _messageQueue, address _verifier ) { if (_messageQueue == address(0) || _verifier == address(0)) { revert ErrorZeroAddress(); } _disableInitializers(); layer2ChainId = _chainId; messageQueue = _messageQueue; verifier = _verifier; } /// @notice Initialize the storage of ScrollChain. /// /// @dev The parameters `_messageQueue` are no longer used. /// /// @param _messageQueue The address of `L1MessageQueue` contract. /// @param _verifier The address of zkevm verifier contract. /// @param _maxNumTxInChunk The maximum number of transactions allowed in each chunk. function initialize( address _messageQueue, address _verifier, uint256 _maxNumTxInChunk ) public initializer { OwnableUpgradeable.__Ownable_init(); maxNumTxInChunk = _maxNumTxInChunk; __verifier = _verifier; __messageQueue = _messageQueue; emit UpdateMaxNumTxInChunk(0, _maxNumTxInChunk); } /************************* * Public View Functions * *************************/ /// @inheritdoc IScrollChain function isBatchFinalized(uint256 _batchIndex) external view override returns (bool) { return _batchIndex <= lastFinalizedBatchIndex; } /***************************** * Public Mutating Functions * *****************************/ /// @notice Import layer 2 genesis block /// @param _batchHeader The header of the genesis batch. /// @param _stateRoot The state root of the genesis block. function importGenesisBatch(bytes calldata _batchHeader, bytes32 _stateRoot) external { // check genesis batch header length if (_stateRoot == bytes32(0)) revert ErrorStateRootIsZero(); // check whether the genesis batch is imported if (finalizedStateRoots[0] != bytes32(0)) revert ErrorGenesisBatchImported(); (uint256 memPtr, bytes32 _batchHash, , ) = _loadBatchHeader(_batchHeader); // check all fields except `dataHash` and `lastBlockHash` are zero unchecked { uint256 sum = BatchHeaderV0Codec.getVersion(memPtr) + BatchHeaderV0Codec.getBatchIndex(memPtr) + BatchHeaderV0Codec.getL1MessagePopped(memPtr) + BatchHeaderV0Codec.getTotalL1MessagePopped(memPtr); if (sum != 0) revert ErrorGenesisBatchHasNonZeroField(); } if (BatchHeaderV0Codec.getDataHash(memPtr) == bytes32(0)) revert ErrorGenesisDataHashIsZero(); if (BatchHeaderV0Codec.getParentBatchHash(memPtr) != bytes32(0)) revert ErrorGenesisParentBatchHashIsNonZero(); committedBatches[0] = _batchHash; finalizedStateRoots[0] = _stateRoot; emit CommitBatch(0, _batchHash); emit FinalizeBatch(0, _batchHash, _stateRoot, bytes32(0)); } /// @inheritdoc IScrollChain function commitBatch( uint8 _version, bytes calldata _parentBatchHeader, bytes[] memory _chunks, bytes calldata _skippedL1MessageBitmap ) external override OnlySequencer whenNotPaused { // check whether the batch is empty if (_chunks.length == 0) revert ErrorBatchIsEmpty(); (, bytes32 _parentBatchHash, uint256 _batchIndex, uint256 _totalL1MessagesPoppedOverall) = _loadBatchHeader( _parentBatchHeader ); unchecked { _batchIndex += 1; } if (committedBatches[_batchIndex] != 0) revert ErrorBatchIsAlreadyCommitted(); bytes32 _batchHash; uint256 batchPtr; bytes32 _dataHash; uint256 _totalL1MessagesPoppedInBatch; if (_version == 0) { (_dataHash, _totalL1MessagesPoppedInBatch) = _commitChunksV0( _totalL1MessagesPoppedOverall, _chunks, _skippedL1MessageBitmap ); assembly { batchPtr := mload(0x40) _totalL1MessagesPoppedOverall := add(_totalL1MessagesPoppedOverall, _totalL1MessagesPoppedInBatch) } // store entries, the order matters BatchHeaderV0Codec.storeVersion(batchPtr, 0); BatchHeaderV0Codec.storeBatchIndex(batchPtr, _batchIndex); BatchHeaderV0Codec.storeL1MessagePopped(batchPtr, _totalL1MessagesPoppedInBatch); BatchHeaderV0Codec.storeTotalL1MessagePopped(batchPtr, _totalL1MessagesPoppedOverall); BatchHeaderV0Codec.storeDataHash(batchPtr, _dataHash); BatchHeaderV0Codec.storeParentBatchHash(batchPtr, _parentBatchHash); BatchHeaderV0Codec.storeSkippedBitmap(batchPtr, _skippedL1MessageBitmap); // compute batch hash _batchHash = BatchHeaderV0Codec.computeBatchHash( batchPtr, BatchHeaderV0Codec.BATCH_HEADER_FIXED_LENGTH + _skippedL1MessageBitmap.length ); } else if (_version == 1) { bytes32 blobVersionedHash; (blobVersionedHash, _dataHash, _totalL1MessagesPoppedInBatch) = _commitChunksV1( _totalL1MessagesPoppedOverall, _chunks, _skippedL1MessageBitmap ); assembly { batchPtr := mload(0x40) _totalL1MessagesPoppedOverall := add(_totalL1MessagesPoppedOverall, _totalL1MessagesPoppedInBatch) } // store entries, the order matters BatchHeaderV1Codec.storeVersion(batchPtr, 1); BatchHeaderV1Codec.storeBatchIndex(batchPtr, _batchIndex); BatchHeaderV1Codec.storeL1MessagePopped(batchPtr, _totalL1MessagesPoppedInBatch); BatchHeaderV1Codec.storeTotalL1MessagePopped(batchPtr, _totalL1MessagesPoppedOverall); BatchHeaderV1Codec.storeDataHash(batchPtr, _dataHash); BatchHeaderV1Codec.storeBlobVersionedHash(batchPtr, blobVersionedHash); BatchHeaderV1Codec.storeParentBatchHash(batchPtr, _parentBatchHash); BatchHeaderV1Codec.storeSkippedBitmap(batchPtr, _skippedL1MessageBitmap); // compute batch hash _batchHash = BatchHeaderV1Codec.computeBatchHash( batchPtr, BatchHeaderV1Codec.BATCH_HEADER_FIXED_LENGTH + _skippedL1MessageBitmap.length ); } else { revert ErrorInvalidBatchHeaderVersion(); } // check the length of bitmap unchecked { if (((_totalL1MessagesPoppedInBatch + 255) / 256) * 32 != _skippedL1MessageBitmap.length) { revert ErrorIncorrectBitmapLength(); } } committedBatches[_batchIndex] = _batchHash; emit CommitBatch(_batchIndex, _batchHash); } /// @inheritdoc IScrollChain /// @dev If the owner want to revert a sequence of batches by sending multiple transactions, /// make sure to revert recent batches first. function revertBatch(bytes calldata _batchHeader, uint256 _count) external onlyOwner { if (_count == 0) revert ErrorRevertZeroBatches(); (, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader); // make sure no gap is left when reverting from the ending to the beginning. if (committedBatches[_batchIndex + _count] != bytes32(0)) revert ErrorRevertNotStartFromEnd(); // check finalization if (_batchIndex <= lastFinalizedBatchIndex) revert ErrorRevertFinalizedBatch(); while (_count > 0) { committedBatches[_batchIndex] = bytes32(0); emit RevertBatch(_batchIndex, _batchHash); unchecked { _batchIndex += 1; _count -= 1; } _batchHash = committedBatches[_batchIndex]; if (_batchHash == bytes32(0)) break; } } /// @inheritdoc IScrollChain /// @dev We keep this function to upgrade to 4844 more smoothly. function finalizeBatchWithProof( bytes calldata _batchHeader, bytes32 _prevStateRoot, bytes32 _postStateRoot, bytes32 _withdrawRoot, bytes calldata _aggrProof ) external override OnlyProver whenNotPaused { if (_prevStateRoot == bytes32(0)) revert ErrorPreviousStateRootIsZero(); if (_postStateRoot == bytes32(0)) revert ErrorStateRootIsZero(); // compute batch hash and verify (uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader); bytes32 _dataHash = BatchHeaderV0Codec.getDataHash(memPtr); // verify previous state root. if (finalizedStateRoots[_batchIndex - 1] != _prevStateRoot) revert ErrorIncorrectPreviousStateRoot(); // avoid duplicated verification if (finalizedStateRoots[_batchIndex] != bytes32(0)) revert ErrorBatchIsAlreadyVerified(); // compute public input hash bytes32 _publicInputHash = keccak256( abi.encodePacked(layer2ChainId, _prevStateRoot, _postStateRoot, _withdrawRoot, _dataHash) ); // verify batch IRollupVerifier(verifier).verifyAggregateProof(0, _batchIndex, _aggrProof, _publicInputHash); // check and update lastFinalizedBatchIndex unchecked { if (lastFinalizedBatchIndex + 1 != _batchIndex) revert ErrorIncorrectBatchIndex(); lastFinalizedBatchIndex = _batchIndex; } // record state root and withdraw root finalizedStateRoots[_batchIndex] = _postStateRoot; withdrawRoots[_batchIndex] = _withdrawRoot; // Pop finalized and non-skipped message from L1MessageQueue. _popL1Messages( BatchHeaderV0Codec.getSkippedBitmapPtr(memPtr), BatchHeaderV0Codec.getTotalL1MessagePopped(memPtr), BatchHeaderV0Codec.getL1MessagePopped(memPtr) ); emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot); } /// @inheritdoc IScrollChain /// @dev Memory layout of `_blobDataProof`: /// ```text /// | z | y | kzg_commitment | kzg_proof | /// |---------|---------|----------------|-----------| /// | bytes32 | bytes32 | bytes48 | bytes48 | /// ``` function finalizeBatchWithProof4844( bytes calldata _batchHeader, bytes32 _prevStateRoot, bytes32 _postStateRoot, bytes32 _withdrawRoot, bytes calldata _blobDataProof, bytes calldata _aggrProof ) external override OnlyProver whenNotPaused { if (_prevStateRoot == bytes32(0)) revert ErrorPreviousStateRootIsZero(); if (_postStateRoot == bytes32(0)) revert ErrorStateRootIsZero(); // compute batch hash and verify (uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader); bytes32 _dataHash = BatchHeaderV1Codec.getDataHash(memPtr); bytes32 _blobVersionedHash = BatchHeaderV1Codec.getBlobVersionedHash(memPtr); // Calls the point evaluation precompile and verifies the output { (bool success, bytes memory data) = POINT_EVALUATION_PRECOMPILE_ADDR.staticcall( abi.encodePacked(_blobVersionedHash, _blobDataProof) ); // We verify that the point evaluation precompile call was successful by testing the latter 32 bytes of the // response is equal to BLS_MODULUS as defined in https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile if (!success) revert ErrorCallPointEvaluationPrecompileFailed(); (, uint256 result) = abi.decode(data, (uint256, uint256)); if (result != BLS_MODULUS) revert ErrorUnexpectedPointEvaluationPrecompileOutput(); } // verify previous state root. if (finalizedStateRoots[_batchIndex - 1] != _prevStateRoot) revert ErrorIncorrectPreviousStateRoot(); // avoid duplicated verification if (finalizedStateRoots[_batchIndex] != bytes32(0)) revert ErrorBatchIsAlreadyVerified(); // compute public input hash bytes32 _publicInputHash = keccak256( abi.encodePacked( layer2ChainId, _prevStateRoot, _postStateRoot, _withdrawRoot, _dataHash, _blobDataProof[0:64], _blobVersionedHash ) ); // load version from batch header, it is always the first byte. uint256 batchVersion; assembly { batchVersion := shr(248, calldataload(_batchHeader.offset)) } // verify batch IRollupVerifier(verifier).verifyAggregateProof(batchVersion, _batchIndex, _aggrProof, _publicInputHash); // check and update lastFinalizedBatchIndex unchecked { if (lastFinalizedBatchIndex + 1 != _batchIndex) revert ErrorIncorrectBatchIndex(); lastFinalizedBatchIndex = _batchIndex; } // record state root and withdraw root finalizedStateRoots[_batchIndex] = _postStateRoot; withdrawRoots[_batchIndex] = _withdrawRoot; // Pop finalized and non-skipped message from L1MessageQueue. _popL1Messages( BatchHeaderV1Codec.getSkippedBitmapPtr(memPtr), BatchHeaderV1Codec.getTotalL1MessagePopped(memPtr), BatchHeaderV1Codec.getL1MessagePopped(memPtr) ); emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot); } /************************ * Restricted Functions * ************************/ /// @notice Add an account to the sequencer list. /// @param _account The address of account to add. function addSequencer(address _account) external onlyOwner { // @note Currently many external services rely on EOA sequencer to decode metadata directly from tx.calldata. // So we explicitly make sure the account is EOA. if (_account.code.length > 0) revert ErrorAccountIsNotEOA(); isSequencer[_account] = true; emit UpdateSequencer(_account, true); } /// @notice Remove an account from the sequencer list. /// @param _account The address of account to remove. function removeSequencer(address _account) external onlyOwner { isSequencer[_account] = false; emit UpdateSequencer(_account, false); } /// @notice Add an account to the prover list. /// @param _account The address of account to add. function addProver(address _account) external onlyOwner { // @note Currently many external services rely on EOA prover to decode metadata directly from tx.calldata. // So we explicitly make sure the account is EOA. if (_account.code.length > 0) revert ErrorAccountIsNotEOA(); isProver[_account] = true; emit UpdateProver(_account, true); } /// @notice Add an account from the prover list. /// @param _account The address of account to remove. function removeProver(address _account) external onlyOwner { isProver[_account] = false; emit UpdateProver(_account, false); } /// @notice Update the value of `maxNumTxInChunk`. /// @param _maxNumTxInChunk The new value of `maxNumTxInChunk`. function updateMaxNumTxInChunk(uint256 _maxNumTxInChunk) external onlyOwner { uint256 _oldMaxNumTxInChunk = maxNumTxInChunk; maxNumTxInChunk = _maxNumTxInChunk; emit UpdateMaxNumTxInChunk(_oldMaxNumTxInChunk, _maxNumTxInChunk); } /// @notice Pause the contract /// @param _status The pause status to update. function setPause(bool _status) external onlyOwner { if (_status) { _pause(); } else { _unpause(); } } /********************** * Internal Functions * **********************/ /// @dev Internal function to commit chunks with version 0 /// @param _totalL1MessagesPoppedOverall The number of L1 messages popped before the list of chunks. /// @param _chunks The list of chunks to commit. /// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. /// @return _batchDataHash The computed data hash for the list of chunks. /// @return _totalL1MessagesPoppedInBatch The total number of L1 messages poped in this batch, including skipped one. function _commitChunksV0( uint256 _totalL1MessagesPoppedOverall, bytes[] memory _chunks, bytes calldata _skippedL1MessageBitmap ) internal view returns (bytes32 _batchDataHash, uint256 _totalL1MessagesPoppedInBatch) { uint256 _chunksLength = _chunks.length; // load `batchDataHashPtr` and reserve the memory region for chunk data hashes uint256 batchDataHashPtr; assembly { batchDataHashPtr := mload(0x40) mstore(0x40, add(batchDataHashPtr, mul(_chunksLength, 32))) } // compute the data hash for each chunk for (uint256 i = 0; i < _chunksLength; i++) { uint256 _totalNumL1MessagesInChunk; bytes32 _chunkDataHash; (_chunkDataHash, _totalNumL1MessagesInChunk) = _commitChunkV0( _chunks[i], _totalL1MessagesPoppedInBatch, _totalL1MessagesPoppedOverall, _skippedL1MessageBitmap ); unchecked { _totalL1MessagesPoppedInBatch += _totalNumL1MessagesInChunk; _totalL1MessagesPoppedOverall += _totalNumL1MessagesInChunk; } assembly { mstore(batchDataHashPtr, _chunkDataHash) batchDataHashPtr := add(batchDataHashPtr, 0x20) } } assembly { let dataLen := mul(_chunksLength, 0x20) _batchDataHash := keccak256(sub(batchDataHashPtr, dataLen), dataLen) } } /// @dev Internal function to commit chunks with version 1 /// @param _totalL1MessagesPoppedOverall The number of L1 messages popped before the list of chunks. /// @param _chunks The list of chunks to commit. /// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. /// @return _blobVersionedHash The blob versioned hash for the blob carried in this transaction. /// @return _batchDataHash The computed data hash for the list of chunks. /// @return _totalL1MessagesPoppedInBatch The total number of L1 messages poped in this batch, including skipped one. function _commitChunksV1( uint256 _totalL1MessagesPoppedOverall, bytes[] memory _chunks, bytes calldata _skippedL1MessageBitmap ) internal view returns ( bytes32 _blobVersionedHash, bytes32 _batchDataHash, uint256 _totalL1MessagesPoppedInBatch ) { { bytes32 _secondBlob; // Get blob's versioned hash assembly { _blobVersionedHash := blobhash(0) _secondBlob := blobhash(1) } if (_blobVersionedHash == bytes32(0)) revert ErrorNoBlobFound(); if (_secondBlob != bytes32(0)) revert ErrorFoundMultipleBlob(); } uint256 _chunksLength = _chunks.length; // load `batchDataHashPtr` and reserve the memory region for chunk data hashes uint256 batchDataHashPtr; assembly { batchDataHashPtr := mload(0x40) mstore(0x40, add(batchDataHashPtr, mul(_chunksLength, 32))) } // compute the data hash for each chunk for (uint256 i = 0; i < _chunksLength; i++) { uint256 _totalNumL1MessagesInChunk; bytes32 _chunkDataHash; (_chunkDataHash, _totalNumL1MessagesInChunk) = _commitChunkV1( _chunks[i], _totalL1MessagesPoppedInBatch, _totalL1MessagesPoppedOverall, _skippedL1MessageBitmap ); unchecked { _totalL1MessagesPoppedInBatch += _totalNumL1MessagesInChunk; _totalL1MessagesPoppedOverall += _totalNumL1MessagesInChunk; } assembly { mstore(batchDataHashPtr, _chunkDataHash) batchDataHashPtr := add(batchDataHashPtr, 0x20) } } // compute the data hash for current batch assembly { let dataLen := mul(_chunksLength, 0x20) _batchDataHash := keccak256(sub(batchDataHashPtr, dataLen), dataLen) } } /// @dev Internal function to load batch header from calldata to memory. /// @param _batchHeader The batch header in calldata. /// @return batchPtr The start memory offset of loaded batch header. /// @return _batchHash The hash of the loaded batch header. /// @return _batchIndex The index of this batch. /// @param _totalL1MessagesPoppedOverall The number of L1 messages popped after this batch. function _loadBatchHeader(bytes calldata _batchHeader) internal view returns ( uint256 batchPtr, bytes32 _batchHash, uint256 _batchIndex, uint256 _totalL1MessagesPoppedOverall ) { // load version from batch header, it is always the first byte. uint256 version; assembly { version := shr(248, calldataload(_batchHeader.offset)) } // version should be always 0 or 1 in current code uint256 _length; if (version == 0) { (batchPtr, _length) = BatchHeaderV0Codec.loadAndValidate(_batchHeader); _batchHash = BatchHeaderV0Codec.computeBatchHash(batchPtr, _length); _batchIndex = BatchHeaderV0Codec.getBatchIndex(batchPtr); } else if (version == 1) { (batchPtr, _length) = BatchHeaderV1Codec.loadAndValidate(_batchHeader); _batchHash = BatchHeaderV1Codec.computeBatchHash(batchPtr, _length); _batchIndex = BatchHeaderV1Codec.getBatchIndex(batchPtr); } else { revert ErrorInvalidBatchHeaderVersion(); } // only check when genesis is imported if (committedBatches[_batchIndex] != _batchHash && finalizedStateRoots[0] != bytes32(0)) { revert ErrorIncorrectBatchHash(); } _totalL1MessagesPoppedOverall = BatchHeaderV0Codec.getTotalL1MessagePopped(batchPtr); } /// @dev Internal function to commit a chunk with version 0. /// @param _chunk The encoded chunk to commit. /// @param _totalL1MessagesPoppedInBatch The total number of L1 messages popped in the current batch before this chunk. /// @param _totalL1MessagesPoppedOverall The total number of L1 messages popped in all batches including the current batch, before this chunk. /// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. /// @return _dataHash The computed data hash for this chunk. /// @return _totalNumL1MessagesInChunk The total number of L1 message popped in current chunk function _commitChunkV0( bytes memory _chunk, uint256 _totalL1MessagesPoppedInBatch, uint256 _totalL1MessagesPoppedOverall, bytes calldata _skippedL1MessageBitmap ) internal view returns (bytes32 _dataHash, uint256 _totalNumL1MessagesInChunk) { uint256 chunkPtr; uint256 startDataPtr; uint256 dataPtr; assembly { dataPtr := mload(0x40) startDataPtr := dataPtr chunkPtr := add(_chunk, 0x20) // skip chunkLength } uint256 _numBlocks = ChunkCodecV0.validateChunkLength(chunkPtr, _chunk.length); // concatenate block contexts, use scope to avoid stack too deep { uint256 _totalTransactionsInChunk; for (uint256 i = 0; i < _numBlocks; i++) { dataPtr = ChunkCodecV0.copyBlockContext(chunkPtr, dataPtr, i); uint256 blockPtr = chunkPtr + 1 + i * ChunkCodecV0.BLOCK_CONTEXT_LENGTH; uint256 _numTransactionsInBlock = ChunkCodecV0.getNumTransactions(blockPtr); unchecked { _totalTransactionsInChunk += _numTransactionsInBlock; } } assembly { mstore(0x40, add(dataPtr, mul(_totalTransactionsInChunk, 0x20))) // reserve memory for tx hashes } } // It is used to compute the actual number of transactions in chunk. uint256 txHashStartDataPtr = dataPtr; // concatenate tx hashes uint256 l2TxPtr = ChunkCodecV0.getL2TxPtr(chunkPtr, _numBlocks); chunkPtr += 1; while (_numBlocks > 0) { // concatenate l1 message hashes uint256 _numL1MessagesInBlock = ChunkCodecV0.getNumL1Messages(chunkPtr); dataPtr = _loadL1MessageHashes( dataPtr, _numL1MessagesInBlock, _totalL1MessagesPoppedInBatch, _totalL1MessagesPoppedOverall, _skippedL1MessageBitmap ); // concatenate l2 transaction hashes uint256 _numTransactionsInBlock = ChunkCodecV0.getNumTransactions(chunkPtr); if (_numTransactionsInBlock < _numL1MessagesInBlock) revert ErrorNumTxsLessThanNumL1Msgs(); for (uint256 j = _numL1MessagesInBlock; j < _numTransactionsInBlock; j++) { bytes32 txHash; (txHash, l2TxPtr) = ChunkCodecV0.loadL2TxHash(l2TxPtr); assembly { mstore(dataPtr, txHash) dataPtr := add(dataPtr, 0x20) } } unchecked { _totalNumL1MessagesInChunk += _numL1MessagesInBlock; _totalL1MessagesPoppedInBatch += _numL1MessagesInBlock; _totalL1MessagesPoppedOverall += _numL1MessagesInBlock; _numBlocks -= 1; chunkPtr += ChunkCodecV0.BLOCK_CONTEXT_LENGTH; } } // check the actual number of transactions in the chunk if ((dataPtr - txHashStartDataPtr) / 32 > maxNumTxInChunk) revert ErrorTooManyTxsInOneChunk(); assembly { chunkPtr := add(_chunk, 0x20) } // check chunk has correct length if (l2TxPtr - chunkPtr != _chunk.length) revert ErrorIncompleteL2TransactionData(); // compute data hash and store to memory assembly { _dataHash := keccak256(startDataPtr, sub(dataPtr, startDataPtr)) } } /// @dev Internal function to commit a chunk with version 1. /// @param _chunk The encoded chunk to commit. /// @param _totalL1MessagesPoppedInBatch The total number of L1 messages popped in current batch. /// @param _totalL1MessagesPoppedOverall The total number of L1 messages popped in all batches including current batch. /// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. /// @return _dataHash The computed data hash for this chunk. /// @return _totalNumL1MessagesInChunk The total number of L1 message popped in current chunk function _commitChunkV1( bytes memory _chunk, uint256 _totalL1MessagesPoppedInBatch, uint256 _totalL1MessagesPoppedOverall, bytes calldata _skippedL1MessageBitmap ) internal view returns (bytes32 _dataHash, uint256 _totalNumL1MessagesInChunk) { uint256 chunkPtr; uint256 startDataPtr; uint256 dataPtr; assembly { dataPtr := mload(0x40) startDataPtr := dataPtr chunkPtr := add(_chunk, 0x20) // skip chunkLength } uint256 _numBlocks = ChunkCodecV1.validateChunkLength(chunkPtr, _chunk.length); // concatenate block contexts, use scope to avoid stack too deep for (uint256 i = 0; i < _numBlocks; i++) { dataPtr = ChunkCodecV1.copyBlockContext(chunkPtr, dataPtr, i); uint256 blockPtr = chunkPtr + 1 + i * ChunkCodecV1.BLOCK_CONTEXT_LENGTH; uint256 _numL1MessagesInBlock = ChunkCodecV1.getNumL1Messages(blockPtr); unchecked { _totalNumL1MessagesInChunk += _numL1MessagesInBlock; } } assembly { mstore(0x40, add(dataPtr, mul(_totalNumL1MessagesInChunk, 0x20))) // reserve memory for l1 message hashes chunkPtr := add(chunkPtr, 1) } // the number of actual transactions in one chunk: non-skipped l1 messages + l2 txs uint256 _totalTransactionsInChunk; // concatenate tx hashes while (_numBlocks > 0) { // concatenate l1 message hashes uint256 _numL1MessagesInBlock = ChunkCodecV1.getNumL1Messages(chunkPtr); uint256 startPtr = dataPtr; dataPtr = _loadL1MessageHashes( dataPtr, _numL1MessagesInBlock, _totalL1MessagesPoppedInBatch, _totalL1MessagesPoppedOverall, _skippedL1MessageBitmap ); uint256 _numTransactionsInBlock = ChunkCodecV1.getNumTransactions(chunkPtr); if (_numTransactionsInBlock < _numL1MessagesInBlock) revert ErrorNumTxsLessThanNumL1Msgs(); unchecked { _totalTransactionsInChunk += (dataPtr - startPtr) / 32; // number of non-skipped l1 messages _totalTransactionsInChunk += _numTransactionsInBlock - _numL1MessagesInBlock; // number of l2 txs _totalL1MessagesPoppedInBatch += _numL1MessagesInBlock; _totalL1MessagesPoppedOverall += _numL1MessagesInBlock; _numBlocks -= 1; chunkPtr += ChunkCodecV1.BLOCK_CONTEXT_LENGTH; } } // check the actual number of transactions in the chunk if (_totalTransactionsInChunk > maxNumTxInChunk) { revert ErrorTooManyTxsInOneChunk(); } // compute data hash and store to memory assembly { _dataHash := keccak256(startDataPtr, sub(dataPtr, startDataPtr)) } } /// @dev Internal function to load L1 message hashes from the message queue. /// @param _ptr The memory offset to store the transaction hash. /// @param _numL1Messages The number of L1 messages to load. /// @param _totalL1MessagesPoppedInBatch The total number of L1 messages popped in current batch. /// @param _totalL1MessagesPoppedOverall The total number of L1 messages popped in all batches including current batch. /// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. /// @return uint256 The new memory offset after loading. function _loadL1MessageHashes( uint256 _ptr, uint256 _numL1Messages, uint256 _totalL1MessagesPoppedInBatch, uint256 _totalL1MessagesPoppedOverall, bytes calldata _skippedL1MessageBitmap ) internal view returns (uint256) { if (_numL1Messages == 0) return _ptr; IL1MessageQueue _messageQueue = IL1MessageQueue(messageQueue); unchecked { uint256 _bitmap; uint256 rem; for (uint256 i = 0; i < _numL1Messages; i++) { uint256 quo = _totalL1MessagesPoppedInBatch >> 8; rem = _totalL1MessagesPoppedInBatch & 0xff; // load bitmap every 256 bits if (i == 0 || rem == 0) { assembly { _bitmap := calldataload(add(_skippedL1MessageBitmap.offset, mul(0x20, quo))) } } if (((_bitmap >> rem) & 1) == 0) { // message not skipped bytes32 _hash = _messageQueue.getCrossDomainMessage(_totalL1MessagesPoppedOverall); assembly { mstore(_ptr, _hash) _ptr := add(_ptr, 0x20) } } _totalL1MessagesPoppedInBatch += 1; _totalL1MessagesPoppedOverall += 1; } // check last L1 message is not skipped, _totalL1MessagesPoppedInBatch must > 0 rem = (_totalL1MessagesPoppedInBatch - 1) & 0xff; if (((_bitmap >> rem) & 1) > 0) revert ErrorLastL1MessageSkipped(); } return _ptr; } /// @dev Internal function to pop finalized l1 messages. /// @param bitmapPtr The memory offset of `skippedL1MessageBitmap`. /// @param totalL1MessagePopped The total number of L1 messages poped in all batches including current batch. /// @param l1MessagePopped The number of L1 messages popped in current batch. function _popL1Messages( uint256 bitmapPtr, uint256 totalL1MessagePopped, uint256 l1MessagePopped ) internal { if (l1MessagePopped == 0) return; unchecked { uint256 startIndex = totalL1MessagePopped - l1MessagePopped; uint256 bitmap; for (uint256 i = 0; i < l1MessagePopped; i += 256) { uint256 _count = 256; if (l1MessagePopped - i < _count) { _count = l1MessagePopped - i; } assembly { bitmap := mload(bitmapPtr) bitmapPtr := add(bitmapPtr, 0x20) } IL1MessageQueue(messageQueue).popCrossDomainMessage(startIndex, _count, bitmap); startIndex += 256; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; interface IL1MessageQueue { /********** * Events * **********/ /// @notice Emitted when a new L1 => L2 transaction is appended to the queue. /// @param sender The address of account who initiates the transaction. /// @param target The address of account who will receive the transaction. /// @param value The value passed with the transaction. /// @param queueIndex The index of this transaction in the queue. /// @param gasLimit Gas limit required to complete the message relay on L2. /// @param data The calldata of the transaction. event QueueTransaction( address indexed sender, address indexed target, uint256 value, uint64 queueIndex, uint256 gasLimit, bytes data ); /// @notice Emitted when some L1 => L2 transactions are included in L1. /// @param startIndex The start index of messages popped. /// @param count The number of messages popped. /// @param skippedBitmap A bitmap indicates whether a message is skipped. event DequeueTransaction(uint256 startIndex, uint256 count, uint256 skippedBitmap); /// @notice Emitted when a message is dropped from L1. /// @param index The index of message dropped. event DropTransaction(uint256 index); /// @notice Emitted when owner updates gas oracle contract. /// @param _oldGasOracle The address of old gas oracle contract. /// @param _newGasOracle The address of new gas oracle contract. event UpdateGasOracle(address indexed _oldGasOracle, address indexed _newGasOracle); /// @notice Emitted when owner updates max gas limit. /// @param _oldMaxGasLimit The old max gas limit. /// @param _newMaxGasLimit The new max gas limit. event UpdateMaxGasLimit(uint256 _oldMaxGasLimit, uint256 _newMaxGasLimit); /********** * Errors * **********/ /// @dev Thrown when the given address is `address(0)`. error ErrorZeroAddress(); /************************* * Public View Functions * *************************/ /// @notice The start index of all pending inclusion messages. function pendingQueueIndex() external view returns (uint256); /// @notice Return the index of next appended message. /// @dev Also the total number of appended messages. function nextCrossDomainMessageIndex() external view returns (uint256); /// @notice Return the message of in `queueIndex`. /// @param queueIndex The index to query. function getCrossDomainMessage(uint256 queueIndex) external view returns (bytes32); /// @notice Return the amount of ETH should pay for cross domain message. /// @param gasLimit Gas limit required to complete the message relay on L2. function estimateCrossDomainMessageFee(uint256 gasLimit) external view returns (uint256); /// @notice Return the amount of intrinsic gas fee should pay for cross domain message. /// @param _calldata The calldata of L1-initiated transaction. function calculateIntrinsicGasFee(bytes calldata _calldata) external view returns (uint256); /// @notice Return the hash of a L1 message. /// @param sender The address of sender. /// @param queueIndex The queue index of this message. /// @param value The amount of Ether transfer to target. /// @param target The address of target. /// @param gasLimit The gas limit provided. /// @param data The calldata passed to target address. function computeTransactionHash( address sender, uint256 queueIndex, uint256 value, address target, uint256 gasLimit, bytes calldata data ) external view returns (bytes32); /// @notice Return whether the message is skipped. /// @param queueIndex The queue index of the message to check. function isMessageSkipped(uint256 queueIndex) external view returns (bool); /// @notice Return whether the message is dropped. /// @param queueIndex The queue index of the message to check. function isMessageDropped(uint256 queueIndex) external view returns (bool); /***************************** * Public Mutating Functions * *****************************/ /// @notice Append a L1 to L2 message into this contract. /// @param target The address of target contract to call in L2. /// @param gasLimit The maximum gas should be used for relay this message in L2. /// @param data The calldata passed to target contract. function appendCrossDomainMessage( address target, uint256 gasLimit, bytes calldata data ) external; /// @notice Append an enforced transaction to this contract. /// @dev The address of sender should be an EOA. /// @param sender The address of sender who will initiate this transaction in L2. /// @param target The address of target contract to call in L2. /// @param value The value passed /// @param gasLimit The maximum gas should be used for this transaction in L2. /// @param data The calldata passed to target contract. function appendEnforcedTransaction( address sender, address target, uint256 value, uint256 gasLimit, bytes calldata data ) external; /// @notice Pop finalized messages from queue. /// /// @dev We can pop at most 256 messages each time. And if the message is not skipped, /// the corresponding entry will be cleared. /// /// @param startIndex The start index to pop. /// @param count The number of messages to pop. /// @param skippedBitmap A bitmap indicates whether a message is skipped. function popCrossDomainMessage( uint256 startIndex, uint256 count, uint256 skippedBitmap ) external; /// @notice Drop a skipped message from the queue. function dropCrossDomainMessage(uint256 index) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @title IScrollChain /// @notice The interface for ScrollChain. interface IScrollChain { /********** * Events * **********/ /// @notice Emitted when a new batch is committed. /// @param batchIndex The index of the batch. /// @param batchHash The hash of the batch. event CommitBatch(uint256 indexed batchIndex, bytes32 indexed batchHash); /// @notice revert a pending batch. /// @param batchIndex The index of the batch. /// @param batchHash The hash of the batch event RevertBatch(uint256 indexed batchIndex, bytes32 indexed batchHash); /// @notice Emitted when a batch is finalized. /// @param batchIndex The index of the batch. /// @param batchHash The hash of the batch /// @param stateRoot The state root on layer 2 after this batch. /// @param withdrawRoot The merkle root on layer2 after this batch. event FinalizeBatch(uint256 indexed batchIndex, bytes32 indexed batchHash, bytes32 stateRoot, bytes32 withdrawRoot); /// @notice Emitted when owner updates the status of sequencer. /// @param account The address of account updated. /// @param status The status of the account updated. event UpdateSequencer(address indexed account, bool status); /// @notice Emitted when owner updates the status of prover. /// @param account The address of account updated. /// @param status The status of the account updated. event UpdateProver(address indexed account, bool status); /// @notice Emitted when the value of `maxNumTxInChunk` is updated. /// @param oldMaxNumTxInChunk The old value of `maxNumTxInChunk`. /// @param newMaxNumTxInChunk The new value of `maxNumTxInChunk`. event UpdateMaxNumTxInChunk(uint256 oldMaxNumTxInChunk, uint256 newMaxNumTxInChunk); /************************* * Public View Functions * *************************/ /// @return The latest finalized batch index. function lastFinalizedBatchIndex() external view returns (uint256); /// @param batchIndex The index of the batch. /// @return The batch hash of a committed batch. function committedBatches(uint256 batchIndex) external view returns (bytes32); /// @param batchIndex The index of the batch. /// @return The state root of a committed batch. function finalizedStateRoots(uint256 batchIndex) external view returns (bytes32); /// @param batchIndex The index of the batch. /// @return The message root of a committed batch. function withdrawRoots(uint256 batchIndex) external view returns (bytes32); /// @param batchIndex The index of the batch. /// @return Whether the batch is finalized by batch index. function isBatchFinalized(uint256 batchIndex) external view returns (bool); /***************************** * Public Mutating Functions * *****************************/ /// @notice Commit a batch of transactions on layer 1. /// /// @param version The version of current batch. /// @param parentBatchHeader The header of parent batch, see the comments of `BatchHeaderV0Codec`. /// @param chunks The list of encoded chunks, see the comments of `ChunkCodec`. /// @param skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not. function commitBatch( uint8 version, bytes calldata parentBatchHeader, bytes[] memory chunks, bytes calldata skippedL1MessageBitmap ) external; /// @notice Revert a pending batch. /// @dev one can only revert unfinalized batches. /// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch`. /// @param count The number of subsequent batches to revert, including current batch. function revertBatch(bytes calldata batchHeader, uint256 count) external; /// @notice Finalize a committed batch on layer 1. /// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch. /// @param prevStateRoot The state root of parent batch. /// @param postStateRoot The state root of current batch. /// @param withdrawRoot The withdraw trie root of current batch. /// @param aggrProof The aggregation proof for current batch. function finalizeBatchWithProof( bytes calldata batchHeader, bytes32 prevStateRoot, bytes32 postStateRoot, bytes32 withdrawRoot, bytes calldata aggrProof ) external; /// @notice Finalize a committed batch (with blob) on layer 1. /// /// @dev Memory layout of `blobDataProof`: /// | z | y | kzg_commitment | kzg_proof | /// |---------|---------|----------------|-----------| /// | bytes32 | bytes32 | bytes48 | bytes48 | /// /// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch. /// @param prevStateRoot The state root of parent batch. /// @param postStateRoot The state root of current batch. /// @param withdrawRoot The withdraw trie root of current batch. /// @param blobDataProof The proof for blob data. /// @param aggrProof The aggregation proof for current batch. function finalizeBatchWithProof4844( bytes calldata batchHeader, bytes32 prevStateRoot, bytes32 postStateRoot, bytes32 withdrawRoot, bytes calldata blobDataProof, bytes calldata aggrProof ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; // solhint-disable no-inline-assembly /// @dev Below is the encoding for `BatchHeader` V0, total 89 + ceil(l1MessagePopped / 256) * 32 bytes. /// ```text /// * Field Bytes Type Index Comments /// * version 1 uint8 0 The batch version /// * batchIndex 8 uint64 1 The index of the batch /// * l1MessagePopped 8 uint64 9 Number of L1 messages popped in the batch /// * totalL1MessagePopped 8 uint64 17 Number of total L1 messages popped after the batch /// * dataHash 32 bytes32 25 The data hash of the batch /// * parentBatchHash 32 bytes32 57 The parent batch hash /// * skippedL1MessageBitmap dynamic uint256[] 89 A bitmap to indicate which L1 messages are skipped in the batch /// ``` library BatchHeaderV0Codec { /// @dev Thrown when the length of batch header is smaller than 89 error ErrorBatchHeaderLengthTooSmall(); /// @dev Thrown when the length of skippedL1MessageBitmap is incorrect. error ErrorIncorrectBitmapLength(); /// @dev The length of fixed parts of the batch header. uint256 internal constant BATCH_HEADER_FIXED_LENGTH = 89; /// @notice Load batch header in calldata to memory. /// @param _batchHeader The encoded batch header bytes in calldata. /// @return batchPtr The start memory offset of the batch header in memory. /// @return length The length in bytes of the batch header. function loadAndValidate(bytes calldata _batchHeader) internal pure returns (uint256 batchPtr, uint256 length) { length = _batchHeader.length; if (length < BATCH_HEADER_FIXED_LENGTH) revert ErrorBatchHeaderLengthTooSmall(); // copy batch header to memory. assembly { batchPtr := mload(0x40) calldatacopy(batchPtr, _batchHeader.offset, length) mstore(0x40, add(batchPtr, length)) } // check batch header length uint256 _l1MessagePopped = getL1MessagePopped(batchPtr); unchecked { if (length != BATCH_HEADER_FIXED_LENGTH + ((_l1MessagePopped + 255) / 256) * 32) { revert ErrorIncorrectBitmapLength(); } } } /// @notice Get the version of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _version The version of the batch header. function getVersion(uint256 batchPtr) internal pure returns (uint256 _version) { assembly { _version := shr(248, mload(batchPtr)) } } /// @notice Get the batch index of the batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _batchIndex The batch index of the batch. function getBatchIndex(uint256 batchPtr) internal pure returns (uint256 _batchIndex) { assembly { _batchIndex := shr(192, mload(add(batchPtr, 1))) } } /// @notice Get the number of L1 messages of the batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _l1MessagePopped The number of L1 messages of the batch. function getL1MessagePopped(uint256 batchPtr) internal pure returns (uint256 _l1MessagePopped) { assembly { _l1MessagePopped := shr(192, mload(add(batchPtr, 9))) } } /// @notice Get the number of L1 messages popped before this batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _totalL1MessagePopped The the number of L1 messages popped before this batch. function getTotalL1MessagePopped(uint256 batchPtr) internal pure returns (uint256 _totalL1MessagePopped) { assembly { _totalL1MessagePopped := shr(192, mload(add(batchPtr, 17))) } } /// @notice Get the data hash of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _dataHash The data hash of the batch header. function getDataHash(uint256 batchPtr) internal pure returns (bytes32 _dataHash) { assembly { _dataHash := mload(add(batchPtr, 25)) } } /// @notice Get the parent batch hash of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _parentBatchHash The parent batch hash of the batch header. function getParentBatchHash(uint256 batchPtr) internal pure returns (bytes32 _parentBatchHash) { assembly { _parentBatchHash := mload(add(batchPtr, 57)) } } /// @notice Get the start memory offset for skipped L1 messages bitmap. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _bitmapPtr the start memory offset for skipped L1 messages bitmap. function getSkippedBitmapPtr(uint256 batchPtr) internal pure returns (uint256 _bitmapPtr) { assembly { _bitmapPtr := add(batchPtr, BATCH_HEADER_FIXED_LENGTH) } } /// @notice Get the skipped L1 messages bitmap. /// @param batchPtr The start memory offset of the batch header in memory. /// @param index The index of bitmap to load. /// @return _bitmap The bitmap from bits `index * 256` to `index * 256 + 255`. function getSkippedBitmap(uint256 batchPtr, uint256 index) internal pure returns (uint256 _bitmap) { assembly { batchPtr := add(batchPtr, BATCH_HEADER_FIXED_LENGTH) _bitmap := mload(add(batchPtr, mul(index, 32))) } } /// @notice Store the version of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _version The version of batch header. function storeVersion(uint256 batchPtr, uint256 _version) internal pure { assembly { mstore8(batchPtr, _version) } } /// @notice Store the batch index of batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeL1MessagePopped`, `storeTotalL1MessagePopped`, and `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _batchIndex The batch index. function storeBatchIndex(uint256 batchPtr, uint256 _batchIndex) internal pure { assembly { mstore(add(batchPtr, 1), shl(192, _batchIndex)) } } /// @notice Store the number of L1 messages popped in current batch to batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeTotalL1MessagePopped` and `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _l1MessagePopped The number of L1 messages popped in current batch. function storeL1MessagePopped(uint256 batchPtr, uint256 _l1MessagePopped) internal pure { assembly { mstore(add(batchPtr, 9), shl(192, _l1MessagePopped)) } } /// @notice Store the total number of L1 messages popped after current batch to batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _totalL1MessagePopped The total number of L1 messages popped after current batch. function storeTotalL1MessagePopped(uint256 batchPtr, uint256 _totalL1MessagePopped) internal pure { assembly { mstore(add(batchPtr, 17), shl(192, _totalL1MessagePopped)) } } /// @notice Store the data hash of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _dataHash The data hash. function storeDataHash(uint256 batchPtr, bytes32 _dataHash) internal pure { assembly { mstore(add(batchPtr, 25), _dataHash) } } /// @notice Store the parent batch hash of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _parentBatchHash The parent batch hash. function storeParentBatchHash(uint256 batchPtr, bytes32 _parentBatchHash) internal pure { assembly { mstore(add(batchPtr, 57), _parentBatchHash) } } /// @notice Store the skipped L1 message bitmap of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _skippedL1MessageBitmap The skipped L1 message bitmap. function storeSkippedBitmap(uint256 batchPtr, bytes calldata _skippedL1MessageBitmap) internal pure { assembly { calldatacopy( add(batchPtr, BATCH_HEADER_FIXED_LENGTH), _skippedL1MessageBitmap.offset, _skippedL1MessageBitmap.length ) } } /// @notice Compute the batch hash. /// @dev Caller should make sure that the encoded batch header is correct. /// /// @param batchPtr The start memory offset of the batch header in memory. /// @param length The length of the batch. /// @return _batchHash The hash of the corresponding batch. function computeBatchHash(uint256 batchPtr, uint256 length) internal pure returns (bytes32 _batchHash) { // in the current version, the hash is: keccak(BatchHeader without timestamp) assembly { _batchHash := keccak256(batchPtr, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; // solhint-disable no-inline-assembly /// @dev Below is the encoding for `BatchHeader` V1, total 121 + ceil(l1MessagePopped / 256) * 32 bytes. /// ```text /// * Field Bytes Type Index Comments /// * version 1 uint8 0 The batch version /// * batchIndex 8 uint64 1 The index of the batch /// * l1MessagePopped 8 uint64 9 Number of L1 messages popped in the batch /// * totalL1MessagePopped 8 uint64 17 Number of total L1 messages popped after the batch /// * dataHash 32 bytes32 25 The data hash of the batch /// * blobVersionedHash 32 bytes32 57 The versioned hash of the blob with this batch’s data /// * parentBatchHash 32 bytes32 89 The parent batch hash /// * skippedL1MessageBitmap dynamic uint256[] 121 A bitmap to indicate which L1 messages are skipped in the batch /// ``` library BatchHeaderV1Codec { /// @dev Thrown when the length of batch header is smaller than 121. error ErrorBatchHeaderLengthTooSmall(); /// @dev Thrown when the length of skippedL1MessageBitmap is incorrect. error ErrorIncorrectBitmapLength(); /// @dev The length of fixed parts of the batch header. uint256 internal constant BATCH_HEADER_FIXED_LENGTH = 121; /// @notice Load batch header in calldata to memory. /// @param _batchHeader The encoded batch header bytes in calldata. /// @return batchPtr The start memory offset of the batch header in memory. /// @return length The length in bytes of the batch header. function loadAndValidate(bytes calldata _batchHeader) internal pure returns (uint256 batchPtr, uint256 length) { length = _batchHeader.length; if (length < BATCH_HEADER_FIXED_LENGTH) revert ErrorBatchHeaderLengthTooSmall(); // copy batch header to memory. assembly { batchPtr := mload(0x40) calldatacopy(batchPtr, _batchHeader.offset, length) mstore(0x40, add(batchPtr, length)) } // check batch header length uint256 _l1MessagePopped = getL1MessagePopped(batchPtr); unchecked { if (length != BATCH_HEADER_FIXED_LENGTH + ((_l1MessagePopped + 255) / 256) * 32) revert ErrorIncorrectBitmapLength(); } } /// @notice Get the version of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _version The version of the batch header. function getVersion(uint256 batchPtr) internal pure returns (uint256 _version) { assembly { _version := shr(248, mload(batchPtr)) } } /// @notice Get the batch index of the batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _batchIndex The batch index of the batch. function getBatchIndex(uint256 batchPtr) internal pure returns (uint256 _batchIndex) { assembly { _batchIndex := shr(192, mload(add(batchPtr, 1))) } } /// @notice Get the number of L1 messages of the batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _l1MessagePopped The number of L1 messages of the batch. function getL1MessagePopped(uint256 batchPtr) internal pure returns (uint256 _l1MessagePopped) { assembly { _l1MessagePopped := shr(192, mload(add(batchPtr, 9))) } } /// @notice Get the number of L1 messages popped before this batch. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _totalL1MessagePopped The the number of L1 messages popped before this batch. function getTotalL1MessagePopped(uint256 batchPtr) internal pure returns (uint256 _totalL1MessagePopped) { assembly { _totalL1MessagePopped := shr(192, mload(add(batchPtr, 17))) } } /// @notice Get the data hash of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _dataHash The data hash of the batch header. function getDataHash(uint256 batchPtr) internal pure returns (bytes32 _dataHash) { assembly { _dataHash := mload(add(batchPtr, 25)) } } /// @notice Get the blob versioned hash of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _blobVersionedHash The blob versioned hash of the batch header. function getBlobVersionedHash(uint256 batchPtr) internal pure returns (bytes32 _blobVersionedHash) { assembly { _blobVersionedHash := mload(add(batchPtr, 57)) } } /// @notice Get the parent batch hash of the batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _parentBatchHash The parent batch hash of the batch header. function getParentBatchHash(uint256 batchPtr) internal pure returns (bytes32 _parentBatchHash) { assembly { _parentBatchHash := mload(add(batchPtr, 89)) } } /// @notice Get the start memory offset for skipped L1 messages bitmap. /// @param batchPtr The start memory offset of the batch header in memory. /// @return _bitmapPtr the start memory offset for skipped L1 messages bitmap. function getSkippedBitmapPtr(uint256 batchPtr) internal pure returns (uint256 _bitmapPtr) { assembly { _bitmapPtr := add(batchPtr, BATCH_HEADER_FIXED_LENGTH) } } /// @notice Get the skipped L1 messages bitmap. /// @param batchPtr The start memory offset of the batch header in memory. /// @param index The index of bitmap to load. /// @return _bitmap The bitmap from bits `index * 256` to `index * 256 + 255`. function getSkippedBitmap(uint256 batchPtr, uint256 index) internal pure returns (uint256 _bitmap) { assembly { batchPtr := add(batchPtr, BATCH_HEADER_FIXED_LENGTH) _bitmap := mload(add(batchPtr, mul(index, 32))) } } /// @notice Store the version of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _version The version of batch header. function storeVersion(uint256 batchPtr, uint256 _version) internal pure { assembly { mstore8(batchPtr, _version) } } /// @notice Store the batch index of batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeL1MessagePopped`, `storeTotalL1MessagePopped`, and `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _batchIndex The batch index. function storeBatchIndex(uint256 batchPtr, uint256 _batchIndex) internal pure { assembly { mstore(add(batchPtr, 1), shl(192, _batchIndex)) } } /// @notice Store the number of L1 messages popped in current batch to batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeTotalL1MessagePopped` and `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _l1MessagePopped The number of L1 messages popped in current batch. function storeL1MessagePopped(uint256 batchPtr, uint256 _l1MessagePopped) internal pure { assembly { mstore(add(batchPtr, 9), shl(192, _l1MessagePopped)) } } /// @notice Store the total number of L1 messages popped after current batch to batch header. /// @dev Because this function can overwrite the subsequent fields, it must be called before /// `storeDataHash`. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _totalL1MessagePopped The total number of L1 messages popped after current batch. function storeTotalL1MessagePopped(uint256 batchPtr, uint256 _totalL1MessagePopped) internal pure { assembly { mstore(add(batchPtr, 17), shl(192, _totalL1MessagePopped)) } } /// @notice Store the data hash of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _dataHash The data hash. function storeDataHash(uint256 batchPtr, bytes32 _dataHash) internal pure { assembly { mstore(add(batchPtr, 25), _dataHash) } } /// @notice Store the parent batch hash of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _blobVersionedHash The versioned hash of the blob with this batch’s data. function storeBlobVersionedHash(uint256 batchPtr, bytes32 _blobVersionedHash) internal pure { assembly { mstore(add(batchPtr, 57), _blobVersionedHash) } } /// @notice Store the parent batch hash of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _parentBatchHash The parent batch hash. function storeParentBatchHash(uint256 batchPtr, bytes32 _parentBatchHash) internal pure { assembly { mstore(add(batchPtr, 89), _parentBatchHash) } } /// @notice Store the skipped L1 message bitmap of batch header. /// @param batchPtr The start memory offset of the batch header in memory. /// @param _skippedL1MessageBitmap The skipped L1 message bitmap. function storeSkippedBitmap(uint256 batchPtr, bytes calldata _skippedL1MessageBitmap) internal pure { assembly { calldatacopy( add(batchPtr, BATCH_HEADER_FIXED_LENGTH), _skippedL1MessageBitmap.offset, _skippedL1MessageBitmap.length ) } } /// @notice Compute the batch hash. /// @dev Caller should make sure that the encoded batch header is correct. /// /// @param batchPtr The start memory offset of the batch header in memory. /// @param length The length of the batch. /// @return _batchHash The hash of the corresponding batch. function computeBatchHash(uint256 batchPtr, uint256 length) internal pure returns (bytes32 _batchHash) { // in the current version, the hash is: keccak(BatchHeader without timestamp) assembly { _batchHash := keccak256(batchPtr, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @dev Below is the encoding for `Chunk`, total 60*n+1+m bytes. /// ```text /// * Field Bytes Type Index Comments /// * numBlocks 1 uint8 0 The number of blocks in this chunk /// * block[0] 60 BlockContext 1 The first block in this chunk /// * ...... /// * block[i] 60 BlockContext 60*i+1 The (i+1)'th block in this chunk /// * ...... /// * block[n-1] 60 BlockContext 60*n-59 The last block in this chunk /// * l2Transactions dynamic bytes 60*n+1 /// ``` /// /// @dev Below is the encoding for `BlockContext`, total 60 bytes. /// ```text /// * Field Bytes Type Index Comments /// * blockNumber 8 uint64 0 The height of this block. /// * timestamp 8 uint64 8 The timestamp of this block. /// * baseFee 32 uint256 16 The base fee of this block. /// * gasLimit 8 uint64 48 The gas limit of this block. /// * numTransactions 2 uint16 56 The number of transactions in this block, both L1 & L2 txs. /// * numL1Messages 2 uint16 58 The number of l1 messages in this block. /// ``` library ChunkCodecV0 { /// @dev Thrown when no blocks in chunk. error ErrorNoBlockInChunk(); /// @dev Thrown when the length of chunk is incorrect. error ErrorIncorrectChunkLength(); /// @dev The length of one block context. uint256 internal constant BLOCK_CONTEXT_LENGTH = 60; /// @notice Validate the length of chunk. /// @param chunkPtr The start memory offset of the chunk in memory. /// @param _length The length of the chunk. /// @return _numBlocks The number of blocks in current chunk. function validateChunkLength(uint256 chunkPtr, uint256 _length) internal pure returns (uint256 _numBlocks) { _numBlocks = getNumBlocks(chunkPtr); // should contain at least one block if (_numBlocks == 0) revert ErrorNoBlockInChunk(); // should contain at least the number of the blocks and block contexts if (_length < 1 + _numBlocks * BLOCK_CONTEXT_LENGTH) revert ErrorIncorrectChunkLength(); } /// @notice Return the start memory offset of `l2Transactions`. /// @dev The caller should make sure `_numBlocks` is correct. /// @param chunkPtr The start memory offset of the chunk in memory. /// @param _numBlocks The number of blocks in current chunk. /// @return _l2TxPtr the start memory offset of `l2Transactions`. function getL2TxPtr(uint256 chunkPtr, uint256 _numBlocks) internal pure returns (uint256 _l2TxPtr) { unchecked { _l2TxPtr = chunkPtr + 1 + _numBlocks * BLOCK_CONTEXT_LENGTH; } } /// @notice Return the number of blocks in current chunk. /// @param chunkPtr The start memory offset of the chunk in memory. /// @return _numBlocks The number of blocks in current chunk. function getNumBlocks(uint256 chunkPtr) internal pure returns (uint256 _numBlocks) { assembly { _numBlocks := shr(248, mload(chunkPtr)) } } /// @notice Copy the block context to another memory. /// @param chunkPtr The start memory offset of the chunk in memory. /// @param dstPtr The destination memory offset to store the block context. /// @param index The index of block context to copy. /// @return uint256 The new destination memory offset after copy. function copyBlockContext( uint256 chunkPtr, uint256 dstPtr, uint256 index ) internal pure returns (uint256) { // only first 58 bytes is needed. assembly { chunkPtr := add(chunkPtr, add(1, mul(BLOCK_CONTEXT_LENGTH, index))) mstore(dstPtr, mload(chunkPtr)) // first 32 bytes mstore( add(dstPtr, 0x20), and(mload(add(chunkPtr, 0x20)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000) ) // next 26 bytes dstPtr := add(dstPtr, 58) } return dstPtr; } /// @notice Return the number of transactions in current block. /// @param blockPtr The start memory offset of the block context in memory. /// @return _numTransactions The number of transactions in current block. function getNumTransactions(uint256 blockPtr) internal pure returns (uint256 _numTransactions) { assembly { _numTransactions := shr(240, mload(add(blockPtr, 56))) } } /// @notice Return the number of L1 messages in current block. /// @param blockPtr The start memory offset of the block context in memory. /// @return _numL1Messages The number of L1 messages in current block. function getNumL1Messages(uint256 blockPtr) internal pure returns (uint256 _numL1Messages) { assembly { _numL1Messages := shr(240, mload(add(blockPtr, 58))) } } /// @notice Compute and load the transaction hash. /// @param _l2TxPtr The start memory offset of the transaction in memory. /// @return bytes32 The transaction hash of the transaction. /// @return uint256 The start memory offset of the next transaction in memory. function loadL2TxHash(uint256 _l2TxPtr) internal pure returns (bytes32, uint256) { bytes32 txHash; assembly { // first 4 bytes indicate the length let txPayloadLength := shr(224, mload(_l2TxPtr)) _l2TxPtr := add(_l2TxPtr, 4) txHash := keccak256(_l2TxPtr, txPayloadLength) _l2TxPtr := add(_l2TxPtr, txPayloadLength) } return (txHash, _l2TxPtr); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {ChunkCodecV0} from "./ChunkCodecV0.sol"; /// @dev Below is the encoding for `Chunk`, total 60*n+1 bytes. /// The only difference between `ChunkCodecV0` is we remove `l2Transactions` from chunk encoding. /// ```text /// * Field Bytes Type Index Comments /// * numBlocks 1 uint8 0 The number of blocks in this chunk /// * block[0] 60 BlockContext 1 The first block in this chunk /// * ...... /// * block[i] 60 BlockContext 60*i+1 The (i+1)'th block in this chunk /// * ...... /// * block[n-1] 60 BlockContext 60*n-59 The last block in this chunk /// ``` /// /// @dev Below is the encoding for `BlockContext`, total 60 bytes. /// ```text /// * Field Bytes Type Index Comments /// * blockNumber 8 uint64 0 The height of this block. /// * timestamp 8 uint64 8 The timestamp of this block. /// * baseFee 32 uint256 16 The base fee of this block. /// * gasLimit 8 uint64 48 The gas limit of this block. /// * numTransactions 2 uint16 56 The number of transactions in this block, both L1 & L2 txs. /// * numL1Messages 2 uint16 58 The number of l1 messages in this block. /// ``` library ChunkCodecV1 { /// @dev Thrown when no blocks in chunk. error ErrorNoBlockInChunk(); /// @dev Thrown when the length of chunk is incorrect. error ErrorIncorrectChunkLength(); /// @dev The length of one block context. uint256 internal constant BLOCK_CONTEXT_LENGTH = 60; /// @notice Validate the length of chunk. /// @param chunkPtr The start memory offset of the chunk in memory. /// @param _length The length of the chunk. /// @return _numBlocks The number of blocks in current chunk. function validateChunkLength(uint256 chunkPtr, uint256 _length) internal pure returns (uint256 _numBlocks) { _numBlocks = getNumBlocks(chunkPtr); // should contain at least one block if (_numBlocks == 0) revert ErrorNoBlockInChunk(); // should contain the number of the blocks and block contexts if (_length != 1 + _numBlocks * BLOCK_CONTEXT_LENGTH) revert ErrorIncorrectChunkLength(); } /// @notice Return the number of blocks in current chunk. /// @param chunkPtr The start memory offset of the chunk in memory. /// @return _numBlocks The number of blocks in current chunk. function getNumBlocks(uint256 chunkPtr) internal pure returns (uint256 _numBlocks) { return ChunkCodecV0.getNumBlocks(chunkPtr); } /// @notice Copy the block context to another memory. /// @param chunkPtr The start memory offset of the chunk in memory. /// @param dstPtr The destination memory offset to store the block context. /// @param index The index of block context to copy. /// @return uint256 The new destination memory offset after copy. function copyBlockContext( uint256 chunkPtr, uint256 dstPtr, uint256 index ) internal pure returns (uint256) { return ChunkCodecV0.copyBlockContext(chunkPtr, dstPtr, index); } /// @notice Return the number of transactions in current block. /// @param blockPtr The start memory offset of the block context in memory. /// @return _numTransactions The number of transactions in current block. function getNumTransactions(uint256 blockPtr) internal pure returns (uint256 _numTransactions) { return ChunkCodecV0.getNumTransactions(blockPtr); } /// @notice Return the number of L1 messages in current block. /// @param blockPtr The start memory offset of the block context in memory. /// @return _numL1Messages The number of L1 messages in current block. function getNumL1Messages(uint256 blockPtr) internal pure returns (uint256 _numL1Messages) { return ChunkCodecV0.getNumL1Messages(blockPtr); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @title IRollupVerifier /// @notice The interface for rollup verifier. interface IRollupVerifier { /// @notice Verify aggregate zk proof. /// @param batchIndex The batch index to verify. /// @param aggrProof The aggregated proof. /// @param publicInputHash The public input hash. function verifyAggregateProof( uint256 batchIndex, bytes calldata aggrProof, bytes32 publicInputHash ) external view; /// @notice Verify aggregate zk proof. /// @param version The version of verifier to use. /// @param batchIndex The batch index to verify. /// @param aggrProof The aggregated proof. /// @param publicInputHash The public input hash. function verifyAggregateProof( uint256 version, uint256 batchIndex, bytes calldata aggrProof, bytes32 publicInputHash ) external view; }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "cancun", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"internalType":"address","name":"_messageQueue","type":"address"},{"internalType":"address","name":"_verifier","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ErrorAccountIsNotEOA","type":"error"},{"inputs":[],"name":"ErrorBatchHeaderLengthTooSmall","type":"error"},{"inputs":[],"name":"ErrorBatchHeaderLengthTooSmall","type":"error"},{"inputs":[],"name":"ErrorBatchIsAlreadyCommitted","type":"error"},{"inputs":[],"name":"ErrorBatchIsAlreadyVerified","type":"error"},{"inputs":[],"name":"ErrorBatchIsEmpty","type":"error"},{"inputs":[],"name":"ErrorCallPointEvaluationPrecompileFailed","type":"error"},{"inputs":[],"name":"ErrorCallerIsNotProver","type":"error"},{"inputs":[],"name":"ErrorCallerIsNotSequencer","type":"error"},{"inputs":[],"name":"ErrorFoundMultipleBlob","type":"error"},{"inputs":[],"name":"ErrorGenesisBatchHasNonZeroField","type":"error"},{"inputs":[],"name":"ErrorGenesisBatchImported","type":"error"},{"inputs":[],"name":"ErrorGenesisDataHashIsZero","type":"error"},{"inputs":[],"name":"ErrorGenesisParentBatchHashIsNonZero","type":"error"},{"inputs":[],"name":"ErrorIncompleteL2TransactionData","type":"error"},{"inputs":[],"name":"ErrorIncorrectBatchHash","type":"error"},{"inputs":[],"name":"ErrorIncorrectBatchIndex","type":"error"},{"inputs":[],"name":"ErrorIncorrectBitmapLength","type":"error"},{"inputs":[],"name":"ErrorIncorrectBitmapLength","type":"error"},{"inputs":[],"name":"ErrorIncorrectBitmapLength","type":"error"},{"inputs":[],"name":"ErrorIncorrectChunkLength","type":"error"},{"inputs":[],"name":"ErrorIncorrectChunkLength","type":"error"},{"inputs":[],"name":"ErrorIncorrectPreviousStateRoot","type":"error"},{"inputs":[],"name":"ErrorInvalidBatchHeaderVersion","type":"error"},{"inputs":[],"name":"ErrorLastL1MessageSkipped","type":"error"},{"inputs":[],"name":"ErrorNoBlobFound","type":"error"},{"inputs":[],"name":"ErrorNoBlockInChunk","type":"error"},{"inputs":[],"name":"ErrorNoBlockInChunk","type":"error"},{"inputs":[],"name":"ErrorNumTxsLessThanNumL1Msgs","type":"error"},{"inputs":[],"name":"ErrorPreviousStateRootIsZero","type":"error"},{"inputs":[],"name":"ErrorRevertFinalizedBatch","type":"error"},{"inputs":[],"name":"ErrorRevertNotStartFromEnd","type":"error"},{"inputs":[],"name":"ErrorRevertZeroBatches","type":"error"},{"inputs":[],"name":"ErrorStateRootIsZero","type":"error"},{"inputs":[],"name":"ErrorTooManyTxsInOneChunk","type":"error"},{"inputs":[],"name":"ErrorUnexpectedPointEvaluationPrecompileOutput","type":"error"},{"inputs":[],"name":"ErrorZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchIndex","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"batchHash","type":"bytes32"}],"name":"CommitBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchIndex","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"batchHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"withdrawRoot","type":"bytes32"}],"name":"FinalizeBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":true,"internalType":"uint256","name":"batchIndex","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"batchHash","type":"bytes32"}],"name":"RevertBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxNumTxInChunk","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxNumTxInChunk","type":"uint256"}],"name":"UpdateMaxNumTxInChunk","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"UpdateProver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"UpdateSequencer","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"addProver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"addSequencer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_version","type":"uint8"},{"internalType":"bytes","name":"_parentBatchHeader","type":"bytes"},{"internalType":"bytes[]","name":"_chunks","type":"bytes[]"},{"internalType":"bytes","name":"_skippedL1MessageBitmap","type":"bytes"}],"name":"commitBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"committedBatches","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_batchHeader","type":"bytes"},{"internalType":"bytes32","name":"_prevStateRoot","type":"bytes32"},{"internalType":"bytes32","name":"_postStateRoot","type":"bytes32"},{"internalType":"bytes32","name":"_withdrawRoot","type":"bytes32"},{"internalType":"bytes","name":"_aggrProof","type":"bytes"}],"name":"finalizeBatchWithProof","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_batchHeader","type":"bytes"},{"internalType":"bytes32","name":"_prevStateRoot","type":"bytes32"},{"internalType":"bytes32","name":"_postStateRoot","type":"bytes32"},{"internalType":"bytes32","name":"_withdrawRoot","type":"bytes32"},{"internalType":"bytes","name":"_blobDataProof","type":"bytes"},{"internalType":"bytes","name":"_aggrProof","type":"bytes"}],"name":"finalizeBatchWithProof4844","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"finalizedStateRoots","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_batchHeader","type":"bytes"},{"internalType":"bytes32","name":"_stateRoot","type":"bytes32"}],"name":"importGenesisBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageQueue","type":"address"},{"internalType":"address","name":"_verifier","type":"address"},{"internalType":"uint256","name":"_maxNumTxInChunk","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchIndex","type":"uint256"}],"name":"isBatchFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isProver","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isSequencer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastFinalizedBatchIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"layer2ChainId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxNumTxInChunk","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageQueue","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"removeProver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"removeSequencer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_batchHeader","type":"bytes"},{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"revertBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxNumTxInChunk","type":"uint256"}],"name":"updateMaxNumTxInChunk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawRoots","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e060405234801562000010575f80fd5b50604051620027d4380380620027d483398101604081905262000033916200017a565b6001600160a01b03821615806200005157506001600160a01b038116155b15620000705760405163a7f9319d60e01b815260040160405180910390fd5b6200007a620000a0565b6001600160401b039092166080526001600160a01b0390811660a0521660c052620001cd565b5f54610100900460ff16156200010c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff908116146200015c575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b038116811462000175575f80fd5b919050565b5f805f606084860312156200018d575f80fd5b83516001600160401b0381168114620001a4575f80fd5b9250620001b4602085016200015e565b9150620001c4604085016200015e565b90509250925092565b60805160a05160c0516125b2620002225f395f81816102ff015281816106dc0152610f1901525f8181610351015281816115420152611d8301525f81816101be015281816106590152610ea101526125b25ff3fe608060405234801561000f575f80fd5b50600436106101a0575f3560e01c806331fa742d116100f35780638a33623111610093578063bedb86fb1161006e578063bedb86fb14610405578063ea5f084f14610418578063ef6602ba14610437578063f2fde38b14610440575f80fd5b80638a336231146103ce5780638da5cb5b146103e1578063b571d3dd146103f2575f80fd5b80635c975abb116100ce5780635c975abb146103865780636989ca7c146103915780636d46e987146103a4578063715018a6146103c6575f80fd5b806331fa742d146103395780633b70c18a1461034c5780633fdeecb214610373575f80fd5b80631325aca01161015e5780631e228302116101395780631e228302146102a95780632362f03e146102bc5780632571098d146102db5780632b7ac3f3146102fa575f80fd5b80631325aca0146102705780631794bb3c146102835780631d49e45714610296575f80fd5b8062b0f4d7146101a457806303c7f4af146101b9578063059def61146101fe5780630a2459241461021557806310d4458314610247578063116a1f421461025a575b5f80fd5b6101b76101b2366004611f71565b610453565b005b6101e07f000000000000000000000000000000000000000000000000000000000000000081565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610207609c5481565b6040519081526020016101f5565b61023761022336600461203c565b609b6020525f908152604090205460ff1681565b60405190151581526020016101f5565b6101b761025536600461205c565b61080e565b6102376102683660046120a4565b609c54101590565b6101b761027e366004612100565b61090c565b6101b761029136600461228a565b610b3b565b6101b76102a436600461203c565b610cbc565b6101b76102b73660046120a4565b610d4a565b6102076102ca3660046120a4565b609d6020525f908152604090205481565b6102076102e93660046120a4565b609e6020525f908152604090205481565b6103217f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101f5565b6101b76103473660046122c3565b610d97565b6103217f000000000000000000000000000000000000000000000000000000000000000081565b6101b761038136600461205c565b611030565b60655460ff16610237565b6101b761039f36600461203c565b611206565b6102376103b236600461203c565b609a6020525f908152604090205460ff1681565b6101b761125c565b6101b76103dc36600461203c565b61126f565b6033546001600160a01b0316610321565b6101b761040036600461203c565b6112f6565b6101b7610413366004612349565b61134c565b6102076104263660046120a4565b609f6020525f908152604090205481565b61020760975481565b6101b761044e36600461203c565b61136d565b335f908152609b602052604090205460ff1661048257604051637b263b1760e01b815260040160405180910390fd5b61048a6113e3565b866104a857604051636af2a73b60e11b815260040160405180910390fd5b856104c65760405163f9a9465f60e01b815260040160405180910390fd5b5f805f6104d38c8c611429565b509250925092505f6104e6846019015190565b90505f6104f4856039015190565b90505f80600a6001600160a01b0316838c8c60405160200161051893929190612368565b60408051601f198184030181529082905261053291612381565b5f60405180830381855afa9150503d805f811461056a576040519150601f19603f3d011682016040523d82523d5f602084013e61056f565b606091505b509150915081610592576040516371ebedf560e01b815260040160405180910390fd5b5f818060200190518101906105a791906123ad565b9150507f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000181146105ea57604051638a89514360e01b815260040160405180910390fd5b5050508b609e5f6001866105fe91906123e3565b81526020019081526020015f20541461062a576040516347c5a1e560e01b815260040160405180910390fd5b5f838152609e6020526040902054156106565760405163092d315560e41b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000008d8d8d868e8e5f9060409261068f939291906123f6565b886040516020016106a798979695949392919061241d565b60408051601f19818403018152908290528051602090910120630581350960e31b825291508f3560f81c906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632c09a8489061071990849089908e908e90899060040161248c565b5f6040518083038186803b15801561072f575f80fd5b505afa158015610741573d5f803e3d5ffd5b5050505084609c546001011461076a57604051631d17cec760e21b815260040160405180910390fd5b84609c819055508c609e5f8781526020019081526020015f20819055508b609f5f8781526020019081526020015f20819055506107bf6107aa8860790190565b601189015160c01c60098a015160c01c6114e7565b604080518e8152602081018e9052879187917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a350505050505050505050505050505050565b6108166115bd565b805f0361083657604051635453822b60e11b815260040160405180910390fd5b5f806108428585611429565b5090935091505f9050609d8161085886856124bd565b81526020019081526020015f20541461088457604051633f707d7d60e21b815260040160405180910390fd5b609c5481116108a657604051632ad7756360e11b815260040160405180910390fd5b5b8215610905575f818152609d602052604080822082905551839183917ecae2739091badfd91c373f0a16cede691e0cd25bb80cff77dd5caeb47101469190a36001015f818152609d60205260409020545f19909301929150816108a7575b5050505050565b335f908152609a602052604090205460ff1661093b57604051631e6edd6f60e11b815260040160405180910390fd5b6109436113e3565b82515f0361096457604051632974c17360e21b815260040160405180910390fd5b5f805f6109718888611429565b60019091015f818152609d6020526040902054929650945092501590506109ab5760405163012137ab60e41b815260040160405180910390fd5b5f805f808c60ff165f03610a2b576109c5858b8b8b611617565b60405196810196945090925090506109dd835f61168f565b60c086811b600185015281811b600985015285901b60118401526019830182905260398301879052610a10838a8a611696565b610a2483610a1f8a60596124bd565b902090565b9350610ac8565b8c60ff16600103610aaf575f610a43868c8c8c6116a2565b60405198810198965090945092509050610a5e84600161168f565b60c087811b600186015282811b600986015286901b6011850152601984018390526039840181905260598401889052610a98848b8b61175e565b610aa784610a1f8b60796124bd565b945050610ac8565b6040516326dcf1f560e21b815260040160405180910390fd5b8761010060ff83010460200214610af257604051630808452960e31b815260040160405180910390fd5b5f868152609d602052604080822086905551859188917f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f9190a350505050505050505050505050565b5f54610100900460ff1615808015610b5957505f54600160ff909116105b80610b725750303b158015610b7257505f5460ff166001145b610bda5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015610bfb575f805461ff0019166101001790555b610c0361176a565b6097829055609980546001600160a01b038581166001600160a01b0319928316179092556098805492871692909116919091179055604080515f8152602081018490527f6d0f49971e462a2f78a25906f145cb29cd5e7bd01ebf681ac8f58cb814e5877a910160405180910390a18015610cb6575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610cc46115bd565b6001600160a01b0381163b15610ced57604051632c0fc2e160e11b815260040160405180910390fd5b6001600160a01b0381165f818152609b6020908152604091829020805460ff1916600190811790915591519182527f967f99d5d403870e4356ff46556df3a6b6ba1f50146639aaedfb9f248eb8661e91015b60405180910390a250565b610d526115bd565b609780549082905560408051828152602081018490527f6d0f49971e462a2f78a25906f145cb29cd5e7bd01ebf681ac8f58cb814e5877a910160405180910390a15050565b335f908152609b602052604090205460ff16610dc657604051637b263b1760e01b815260040160405180910390fd5b610dce6113e3565b84610dec57604051636af2a73b60e11b815260040160405180910390fd5b83610e0a5760405163f9a9465f60e01b815260040160405180910390fd5b5f805f610e178a8a611429565b509250925092505f610e2a846019015190565b905088609e5f610e3b6001866123e3565b81526020019081526020015f205414610e67576040516347c5a1e560e01b815260040160405180910390fd5b5f828152609e602052604090205415610e935760405163092d315560e41b815260040160405180910390fd5b6040516001600160c01b03197f000000000000000000000000000000000000000000000000000000000000000060c01b166020820152602881018a90526048810189905260688101889052608881018290525f9060a80160408051601f19818403018152908290528051602090910120630581350960e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632c09a84890610f56905f9087908c908c90889060040161248c565b5f6040518083038186803b158015610f6c575f80fd5b505afa158015610f7e573d5f803e3d5ffd5b5050505082609c5460010114610fa757604051631d17cec760e21b815260040160405180910390fd5b609c8390555f838152609e602090815260408083208c9055609f9091529020889055610fe560598601601187015160c01c600988015160c01c6114e7565b604080518a8152602081018a9052859185917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a3505050505050505050505050565b8061104e5760405163f9a9465f60e01b815260040160405180910390fd5b5f8052609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a9597854156110965760405163c22a199f60e01b815260040160405180910390fd5b5f806110a28585611429565b5050915091505f6110b7836011015160c01c90565b600984015160c01c600185015160c01c855160f81c010101905080156110f05760405163f4f38de560e01b815260040160405180910390fd5b505f6110fd836019015190565b0361111b576040516303d840a960e41b815260040160405180910390fd5b5f611127836039015190565b1461114557604051632781461960e11b815260040160405180910390fd5b5f8080527fc5dc36ae4e7617e4c4d23ddfcde33c79e9ed64c300aed766a9288a6b9b31f63d829055609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a959788490556040518291907f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f908290a3604080518481525f60208201819052839290917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a35050505050565b61120e6115bd565b6001600160a01b0381165f818152609a60209081526040808320805460ff19169055519182527f631cb110fbe6a87fba5414d6b2cff02264480535cd1f5abdbc4fa638bc0b56929101610d3f565b6112646115bd565b61126d5f611798565b565b6112776115bd565b6001600160a01b0381163b156112a057604051632c0fc2e160e11b815260040160405180910390fd5b6001600160a01b0381165f818152609a6020908152604091829020805460ff1916600190811790915591519182527f631cb110fbe6a87fba5414d6b2cff02264480535cd1f5abdbc4fa638bc0b56929101610d3f565b6112fe6115bd565b6001600160a01b0381165f818152609b60209081526040808320805460ff19169055519182527f967f99d5d403870e4356ff46556df3a6b6ba1f50146639aaedfb9f248eb8661e9101610d3f565b6113546115bd565b8015611365576113626117e9565b50565b611362611843565b6113756115bd565b6001600160a01b0381166113da5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bd1565b61136281611798565b60655460ff161561126d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bd1565b5f808080853560f81c8181810361145d57611444888861187c565b80822060018301519298509650915060c01c935061146f565b81600103610aaf5761144488886118f5565b5f848152609d602052604090205485148015906114b457505f8052609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a959785415155b156114d25760405163150e0a2160e11b815260040160405180910390fd5b601186015160c01c9250505092959194509250565b805f036114f357505050565b8082035f805b838110156115b55761010081850381111561151357508084035b8651604051632afb09e760e11b81526004810186905260248101839052604481018290526020909801979093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906355f613ce906064015f604051808303815f87803b15801561158b575f80fd5b505af115801561159d573d5f803e3d5ffd5b505050506101008401935050610100810190506114f9565b505050505050565b6033546001600160a01b0316331461126d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610bd1565b8251604080516020830281019091525f918291825b82811015611678575f8061165c8a848151811061164b5761164b6124d0565b6020026020010151878d8c8c611966565b9085529a8b019a9590950194505060209091019060010161162c565b506020919091029081900320969095509350505050565b8082535050565b80826059850137505050565b5f80499080600149836116c857604051630168f63160e21b815260040160405180910390fd5b80156116e757604051630148201960e11b815260040160405180910390fd5b508551604080516020830281019091525f5b82811015611745575f806117298b8481518110611718576117186124d0565b6020026020010151878e8d8d611b40565b9085529b8c019b959095019450506020909101906001016116f9565b5060208202808183032094505050509450945094915050565b80826079850137505050565b5f54610100900460ff166117905760405162461bcd60e51b8152600401610bd1906124e4565b61126d611c90565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6117f16113e3565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118263390565b6040516001600160a01b03909116815260200160405180910390a1565b61184b611cbf565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611826565b5f8160598110156118a05760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f6118be836009015160c01c90565b905061010060ff82010460200260590182146118ed57604051630808452960e31b815260040160405180910390fd5b509250929050565b5f8160798110156119195760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f611937836009015160c01c90565b905061010060ff82010460200260790182146118ed57604051630808452960e31b815260040160405180910390fd5b60405185515f91829160208901919081908490611984908590611d08565b90505f805b828110156119f757603c81028601600181015185526021015165ffffffffffff19166020850152603a840193505f6119c2603c8361252f565b6119cd8860016124bd565b6119d791906124bd565b90505f6119e8826038015160f01c90565b93909301925050600101611989565b506020028201604052815f6001603c84028701019050611a186001876124bd565b95505b8215611ac2575f611a3087603a015160f01c90565b9050611a4085828f8f8f8f611d72565b94505f611a51886038015160f01c90565b905081811015611a7457604051638c5a4ea360e01b815260040160405180910390fd5b815b81811015611aa157835160e01c60048086018290208952602090980197940190930192600101611a76565b50509b8c019b9a8b019a9690960195603c95909501945f1990920191611a1b565b6097546020611ad184876123e3565b611adb9190612546565b1115611afa57604051634d56f17560e01b815260040160405180910390fd5b8c5160208e019650611b0c87836123e3565b14611b2a5760405163670241af60e01b815260040160405180910390fd5b5050508190039020989197509095505050505050565b60405185515f91829160208901919081908490611b5e908590611ea1565b90505f5b81811015611bcb57603c81028501600181015184526021015165ffffffffffff19166020840152603a830192505f611b9b603c8361252f565b611ba68760016124bd565b611bb091906124bd565b90505f611bbc82611f02565b97909701965050600101611b62565b506020850282016040526001840193505f5b8115611c58575f611bed86611f02565b905083611bfe81838f8f8f8f611d72565b94505f611c0a88611f11565b905082811015611c2d57604051638c5a4ea360e01b815260040160405180910390fd5b9c82019c9b82019b603c97909701965f19949094019360209186039190910492909201910301611bdd565b609754811115611c7b57604051634d56f17560e01b815260040160405180910390fd5b50508190039020989197509095505050505050565b5f54610100900460ff16611cb65760405162461bcd60e51b8152600401610bd1906124e4565b61126d33611798565b60655460ff1661126d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bd1565b5f611d14835160f81c90565b9050805f03611d3657604051631f18bc2360e21b815260040160405180910390fd5b611d41603c8261252f565b611d4c9060016124bd565b821015611d6c576040516302e3d2ef60e61b815260040160405180910390fd5b92915050565b5f855f03611d81575085611e97565b7f00000000000000000000000000000000000000000000000000000000000000005f80805b89811015611e635760ff89169150600889901c811580611dc4575082155b15611dd3578060200288013593505b600184841c165f03611e525760405163ae453cd560e01b8152600481018a90525f906001600160a01b0387169063ae453cd590602401602060405180830381865afa158015611e24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e489190612565565b8d52506020909b019a5b506001988901989788019701611da6565b505060ff5f1988011681811c60011615611e9057604051632eba9e1160e21b815260040160405180910390fd5b5050879150505b9695505050505050565b5f611eab83611f20565b9050805f03611ecd57604051631f18bc2360e21b815260040160405180910390fd5b611ed8603c8261252f565b611ee39060016124bd565b8214611d6c576040516302e3d2ef60e61b815260040160405180910390fd5b5f611d6c82603a015160f01c90565b5f611d6c826038015160f01c90565b5f611d6c825160f81c90565b5f8083601f840112611f3c575f80fd5b50813567ffffffffffffffff811115611f53575f80fd5b602083019150836020828501011115611f6a575f80fd5b9250929050565b5f805f805f805f805f60c08a8c031215611f89575f80fd5b893567ffffffffffffffff80821115611fa0575f80fd5b611fac8d838e01611f2c565b909b50995060208c0135985060408c0135975060608c0135965060808c0135915080821115611fd9575f80fd5b611fe58d838e01611f2c565b909650945060a08c0135915080821115611ffd575f80fd5b5061200a8c828d01611f2c565b915080935050809150509295985092959850929598565b80356001600160a01b0381168114612037575f80fd5b919050565b5f6020828403121561204c575f80fd5b61205582612021565b9392505050565b5f805f6040848603121561206e575f80fd5b833567ffffffffffffffff811115612084575f80fd5b61209086828701611f2c565b909790965060209590950135949350505050565b5f602082840312156120b4575f80fd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156120f8576120f86120bb565b604052919050565b5f805f805f8060808789031215612115575f80fd5b863560ff811614612124575f80fd5b8635955067ffffffffffffffff8060208901351115612141575f80fd5b6121518960208a01358a01611f2c565b90965094506040880135811015612166575f80fd5b6040880135880189601f82011261217b575f80fd5b818135111561218c5761218c6120bb565b61219c6020823560051b016120cf565b81358082526020808301929160051b8401018c10156121b9575f80fd5b602083015b6020843560051b8501018110156122535784813511156121dc575f80fd5b803584018d603f8201126121ee575f80fd5b602081013586811115612203576122036120bb565b612216601f8201601f19166020016120cf565b8181528f604083850101111561222a575f80fd5b816040840160208301375f602083830101528086525050506020830192506020810190506121be565b50955050506060880135811015612268575f80fd5b506122798860608901358901611f2c565b969995985093965091949293915050565b5f805f6060848603121561229c575f80fd5b6122a584612021565b92506122b360208501612021565b9150604084013590509250925092565b5f805f805f805f60a0888a0312156122d9575f80fd5b873567ffffffffffffffff808211156122f0575f80fd5b6122fc8b838c01611f2c565b909950975060208a0135965060408a0135955060608a0135945060808a0135915080821115612329575f80fd5b506123368a828b01611f2c565b989b979a50959850939692959293505050565b5f60208284031215612359575f80fd5b81358015158114612055575f80fd5b838152818360208301375f910160200190815292915050565b5f82515f5b818110156123a05760208186018101518583015201612386565b505f920191825250919050565b5f80604083850312156123be575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b81810381811115611d6c57611d6c6123cf565b5f8085851115612404575f80fd5b83861115612410575f80fd5b5050820193919092039150565b67ffffffffffffffff60c01b8960c01b16815287600882015286602882015285604882015284606882015282846088830137608892019182015260a8019695505050505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b858152846020820152608060408201525f6124ab608083018587612464565b90508260608301529695505050505050565b80820180821115611d6c57611d6c6123cf565b634e487b7160e01b5f52603260045260245ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8082028115828204841417611d6c57611d6c6123cf565b5f8261256057634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215612575575f80fd5b505191905056fea264697066735822122011d1581609207a020c0be53e793a10cd9b9f7ce8e9468b91484b3818de3fd39a64736f6c6343000818003300000000000000000000000000000000000000000000000000000000000827500000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f6
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106101a0575f3560e01c806331fa742d116100f35780638a33623111610093578063bedb86fb1161006e578063bedb86fb14610405578063ea5f084f14610418578063ef6602ba14610437578063f2fde38b14610440575f80fd5b80638a336231146103ce5780638da5cb5b146103e1578063b571d3dd146103f2575f80fd5b80635c975abb116100ce5780635c975abb146103865780636989ca7c146103915780636d46e987146103a4578063715018a6146103c6575f80fd5b806331fa742d146103395780633b70c18a1461034c5780633fdeecb214610373575f80fd5b80631325aca01161015e5780631e228302116101395780631e228302146102a95780632362f03e146102bc5780632571098d146102db5780632b7ac3f3146102fa575f80fd5b80631325aca0146102705780631794bb3c146102835780631d49e45714610296575f80fd5b8062b0f4d7146101a457806303c7f4af146101b9578063059def61146101fe5780630a2459241461021557806310d4458314610247578063116a1f421461025a575b5f80fd5b6101b76101b2366004611f71565b610453565b005b6101e07f000000000000000000000000000000000000000000000000000000000008275081565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610207609c5481565b6040519081526020016101f5565b61023761022336600461203c565b609b6020525f908152604090205460ff1681565b60405190151581526020016101f5565b6101b761025536600461205c565b61080e565b6102376102683660046120a4565b609c54101590565b6101b761027e366004612100565b61090c565b6101b761029136600461228a565b610b3b565b6101b76102a436600461203c565b610cbc565b6101b76102b73660046120a4565b610d4a565b6102076102ca3660046120a4565b609d6020525f908152604090205481565b6102076102e93660046120a4565b609e6020525f908152604090205481565b6103217f0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f681565b6040516001600160a01b0390911681526020016101f5565b6101b76103473660046122c3565b610d97565b6103217f0000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b81565b6101b761038136600461205c565b611030565b60655460ff16610237565b6101b761039f36600461203c565b611206565b6102376103b236600461203c565b609a6020525f908152604090205460ff1681565b6101b761125c565b6101b76103dc36600461203c565b61126f565b6033546001600160a01b0316610321565b6101b761040036600461203c565b6112f6565b6101b7610413366004612349565b61134c565b6102076104263660046120a4565b609f6020525f908152604090205481565b61020760975481565b6101b761044e36600461203c565b61136d565b335f908152609b602052604090205460ff1661048257604051637b263b1760e01b815260040160405180910390fd5b61048a6113e3565b866104a857604051636af2a73b60e11b815260040160405180910390fd5b856104c65760405163f9a9465f60e01b815260040160405180910390fd5b5f805f6104d38c8c611429565b509250925092505f6104e6846019015190565b90505f6104f4856039015190565b90505f80600a6001600160a01b0316838c8c60405160200161051893929190612368565b60408051601f198184030181529082905261053291612381565b5f60405180830381855afa9150503d805f811461056a576040519150601f19603f3d011682016040523d82523d5f602084013e61056f565b606091505b509150915081610592576040516371ebedf560e01b815260040160405180910390fd5b5f818060200190518101906105a791906123ad565b9150507f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000181146105ea57604051638a89514360e01b815260040160405180910390fd5b5050508b609e5f6001866105fe91906123e3565b81526020019081526020015f20541461062a576040516347c5a1e560e01b815260040160405180910390fd5b5f838152609e6020526040902054156106565760405163092d315560e41b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000827508d8d8d868e8e5f9060409261068f939291906123f6565b886040516020016106a798979695949392919061241d565b60408051601f19818403018152908290528051602090910120630581350960e31b825291508f3560f81c906001600160a01b037f0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f61690632c09a8489061071990849089908e908e90899060040161248c565b5f6040518083038186803b15801561072f575f80fd5b505afa158015610741573d5f803e3d5ffd5b5050505084609c546001011461076a57604051631d17cec760e21b815260040160405180910390fd5b84609c819055508c609e5f8781526020019081526020015f20819055508b609f5f8781526020019081526020015f20819055506107bf6107aa8860790190565b601189015160c01c60098a015160c01c6114e7565b604080518e8152602081018e9052879187917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a350505050505050505050505050505050565b6108166115bd565b805f0361083657604051635453822b60e11b815260040160405180910390fd5b5f806108428585611429565b5090935091505f9050609d8161085886856124bd565b81526020019081526020015f20541461088457604051633f707d7d60e21b815260040160405180910390fd5b609c5481116108a657604051632ad7756360e11b815260040160405180910390fd5b5b8215610905575f818152609d602052604080822082905551839183917ecae2739091badfd91c373f0a16cede691e0cd25bb80cff77dd5caeb47101469190a36001015f818152609d60205260409020545f19909301929150816108a7575b5050505050565b335f908152609a602052604090205460ff1661093b57604051631e6edd6f60e11b815260040160405180910390fd5b6109436113e3565b82515f0361096457604051632974c17360e21b815260040160405180910390fd5b5f805f6109718888611429565b60019091015f818152609d6020526040902054929650945092501590506109ab5760405163012137ab60e41b815260040160405180910390fd5b5f805f808c60ff165f03610a2b576109c5858b8b8b611617565b60405196810196945090925090506109dd835f61168f565b60c086811b600185015281811b600985015285901b60118401526019830182905260398301879052610a10838a8a611696565b610a2483610a1f8a60596124bd565b902090565b9350610ac8565b8c60ff16600103610aaf575f610a43868c8c8c6116a2565b60405198810198965090945092509050610a5e84600161168f565b60c087811b600186015282811b600986015286901b6011850152601984018390526039840181905260598401889052610a98848b8b61175e565b610aa784610a1f8b60796124bd565b945050610ac8565b6040516326dcf1f560e21b815260040160405180910390fd5b8761010060ff83010460200214610af257604051630808452960e31b815260040160405180910390fd5b5f868152609d602052604080822086905551859188917f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f9190a350505050505050505050505050565b5f54610100900460ff1615808015610b5957505f54600160ff909116105b80610b725750303b158015610b7257505f5460ff166001145b610bda5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015610bfb575f805461ff0019166101001790555b610c0361176a565b6097829055609980546001600160a01b038581166001600160a01b0319928316179092556098805492871692909116919091179055604080515f8152602081018490527f6d0f49971e462a2f78a25906f145cb29cd5e7bd01ebf681ac8f58cb814e5877a910160405180910390a18015610cb6575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610cc46115bd565b6001600160a01b0381163b15610ced57604051632c0fc2e160e11b815260040160405180910390fd5b6001600160a01b0381165f818152609b6020908152604091829020805460ff1916600190811790915591519182527f967f99d5d403870e4356ff46556df3a6b6ba1f50146639aaedfb9f248eb8661e91015b60405180910390a250565b610d526115bd565b609780549082905560408051828152602081018490527f6d0f49971e462a2f78a25906f145cb29cd5e7bd01ebf681ac8f58cb814e5877a910160405180910390a15050565b335f908152609b602052604090205460ff16610dc657604051637b263b1760e01b815260040160405180910390fd5b610dce6113e3565b84610dec57604051636af2a73b60e11b815260040160405180910390fd5b83610e0a5760405163f9a9465f60e01b815260040160405180910390fd5b5f805f610e178a8a611429565b509250925092505f610e2a846019015190565b905088609e5f610e3b6001866123e3565b81526020019081526020015f205414610e67576040516347c5a1e560e01b815260040160405180910390fd5b5f828152609e602052604090205415610e935760405163092d315560e41b815260040160405180910390fd5b6040516001600160c01b03197f000000000000000000000000000000000000000000000000000000000008275060c01b166020820152602881018a90526048810189905260688101889052608881018290525f9060a80160408051601f19818403018152908290528051602090910120630581350960e31b825291506001600160a01b037f0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f61690632c09a84890610f56905f9087908c908c90889060040161248c565b5f6040518083038186803b158015610f6c575f80fd5b505afa158015610f7e573d5f803e3d5ffd5b5050505082609c5460010114610fa757604051631d17cec760e21b815260040160405180910390fd5b609c8390555f838152609e602090815260408083208c9055609f9091529020889055610fe560598601601187015160c01c600988015160c01c6114e7565b604080518a8152602081018a9052859185917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a3505050505050505050505050565b8061104e5760405163f9a9465f60e01b815260040160405180910390fd5b5f8052609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a9597854156110965760405163c22a199f60e01b815260040160405180910390fd5b5f806110a28585611429565b5050915091505f6110b7836011015160c01c90565b600984015160c01c600185015160c01c855160f81c010101905080156110f05760405163f4f38de560e01b815260040160405180910390fd5b505f6110fd836019015190565b0361111b576040516303d840a960e41b815260040160405180910390fd5b5f611127836039015190565b1461114557604051632781461960e11b815260040160405180910390fd5b5f8080527fc5dc36ae4e7617e4c4d23ddfcde33c79e9ed64c300aed766a9288a6b9b31f63d829055609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a959788490556040518291907f2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f908290a3604080518481525f60208201819052839290917f26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d910160405180910390a35050505050565b61120e6115bd565b6001600160a01b0381165f818152609a60209081526040808320805460ff19169055519182527f631cb110fbe6a87fba5414d6b2cff02264480535cd1f5abdbc4fa638bc0b56929101610d3f565b6112646115bd565b61126d5f611798565b565b6112776115bd565b6001600160a01b0381163b156112a057604051632c0fc2e160e11b815260040160405180910390fd5b6001600160a01b0381165f818152609a6020908152604091829020805460ff1916600190811790915591519182527f631cb110fbe6a87fba5414d6b2cff02264480535cd1f5abdbc4fa638bc0b56929101610d3f565b6112fe6115bd565b6001600160a01b0381165f818152609b60209081526040808320805460ff19169055519182527f967f99d5d403870e4356ff46556df3a6b6ba1f50146639aaedfb9f248eb8661e9101610d3f565b6113546115bd565b8015611365576113626117e9565b50565b611362611843565b6113756115bd565b6001600160a01b0381166113da5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bd1565b61136281611798565b60655460ff161561126d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bd1565b5f808080853560f81c8181810361145d57611444888861187c565b80822060018301519298509650915060c01c935061146f565b81600103610aaf5761144488886118f5565b5f848152609d602052604090205485148015906114b457505f8052609e6020527fedae58bba15aea52a58242ef195db2cc4de2b75de265dbb0d58482df22a959785415155b156114d25760405163150e0a2160e11b815260040160405180910390fd5b601186015160c01c9250505092959194509250565b805f036114f357505050565b8082035f805b838110156115b55761010081850381111561151357508084035b8651604051632afb09e760e11b81526004810186905260248101839052604481018290526020909801979093507f0000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b6001600160a01b0316906355f613ce906064015f604051808303815f87803b15801561158b575f80fd5b505af115801561159d573d5f803e3d5ffd5b505050506101008401935050610100810190506114f9565b505050505050565b6033546001600160a01b0316331461126d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610bd1565b8251604080516020830281019091525f918291825b82811015611678575f8061165c8a848151811061164b5761164b6124d0565b6020026020010151878d8c8c611966565b9085529a8b019a9590950194505060209091019060010161162c565b506020919091029081900320969095509350505050565b8082535050565b80826059850137505050565b5f80499080600149836116c857604051630168f63160e21b815260040160405180910390fd5b80156116e757604051630148201960e11b815260040160405180910390fd5b508551604080516020830281019091525f5b82811015611745575f806117298b8481518110611718576117186124d0565b6020026020010151878e8d8d611b40565b9085529b8c019b959095019450506020909101906001016116f9565b5060208202808183032094505050509450945094915050565b80826079850137505050565b5f54610100900460ff166117905760405162461bcd60e51b8152600401610bd1906124e4565b61126d611c90565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6117f16113e3565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118263390565b6040516001600160a01b03909116815260200160405180910390a1565b61184b611cbf565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611826565b5f8160598110156118a05760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f6118be836009015160c01c90565b905061010060ff82010460200260590182146118ed57604051630808452960e31b815260040160405180910390fd5b509250929050565b5f8160798110156119195760405163e4d8ae0760e01b815260040160405180910390fd5b6040519150808483378082016040525f611937836009015160c01c90565b905061010060ff82010460200260790182146118ed57604051630808452960e31b815260040160405180910390fd5b60405185515f91829160208901919081908490611984908590611d08565b90505f805b828110156119f757603c81028601600181015185526021015165ffffffffffff19166020850152603a840193505f6119c2603c8361252f565b6119cd8860016124bd565b6119d791906124bd565b90505f6119e8826038015160f01c90565b93909301925050600101611989565b506020028201604052815f6001603c84028701019050611a186001876124bd565b95505b8215611ac2575f611a3087603a015160f01c90565b9050611a4085828f8f8f8f611d72565b94505f611a51886038015160f01c90565b905081811015611a7457604051638c5a4ea360e01b815260040160405180910390fd5b815b81811015611aa157835160e01c60048086018290208952602090980197940190930192600101611a76565b50509b8c019b9a8b019a9690960195603c95909501945f1990920191611a1b565b6097546020611ad184876123e3565b611adb9190612546565b1115611afa57604051634d56f17560e01b815260040160405180910390fd5b8c5160208e019650611b0c87836123e3565b14611b2a5760405163670241af60e01b815260040160405180910390fd5b5050508190039020989197509095505050505050565b60405185515f91829160208901919081908490611b5e908590611ea1565b90505f5b81811015611bcb57603c81028501600181015184526021015165ffffffffffff19166020840152603a830192505f611b9b603c8361252f565b611ba68760016124bd565b611bb091906124bd565b90505f611bbc82611f02565b97909701965050600101611b62565b506020850282016040526001840193505f5b8115611c58575f611bed86611f02565b905083611bfe81838f8f8f8f611d72565b94505f611c0a88611f11565b905082811015611c2d57604051638c5a4ea360e01b815260040160405180910390fd5b9c82019c9b82019b603c97909701965f19949094019360209186039190910492909201910301611bdd565b609754811115611c7b57604051634d56f17560e01b815260040160405180910390fd5b50508190039020989197509095505050505050565b5f54610100900460ff16611cb65760405162461bcd60e51b8152600401610bd1906124e4565b61126d33611798565b60655460ff1661126d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bd1565b5f611d14835160f81c90565b9050805f03611d3657604051631f18bc2360e21b815260040160405180910390fd5b611d41603c8261252f565b611d4c9060016124bd565b821015611d6c576040516302e3d2ef60e61b815260040160405180910390fd5b92915050565b5f855f03611d81575085611e97565b7f0000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b5f80805b89811015611e635760ff89169150600889901c811580611dc4575082155b15611dd3578060200288013593505b600184841c165f03611e525760405163ae453cd560e01b8152600481018a90525f906001600160a01b0387169063ae453cd590602401602060405180830381865afa158015611e24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e489190612565565b8d52506020909b019a5b506001988901989788019701611da6565b505060ff5f1988011681811c60011615611e9057604051632eba9e1160e21b815260040160405180910390fd5b5050879150505b9695505050505050565b5f611eab83611f20565b9050805f03611ecd57604051631f18bc2360e21b815260040160405180910390fd5b611ed8603c8261252f565b611ee39060016124bd565b8214611d6c576040516302e3d2ef60e61b815260040160405180910390fd5b5f611d6c82603a015160f01c90565b5f611d6c826038015160f01c90565b5f611d6c825160f81c90565b5f8083601f840112611f3c575f80fd5b50813567ffffffffffffffff811115611f53575f80fd5b602083019150836020828501011115611f6a575f80fd5b9250929050565b5f805f805f805f805f60c08a8c031215611f89575f80fd5b893567ffffffffffffffff80821115611fa0575f80fd5b611fac8d838e01611f2c565b909b50995060208c0135985060408c0135975060608c0135965060808c0135915080821115611fd9575f80fd5b611fe58d838e01611f2c565b909650945060a08c0135915080821115611ffd575f80fd5b5061200a8c828d01611f2c565b915080935050809150509295985092959850929598565b80356001600160a01b0381168114612037575f80fd5b919050565b5f6020828403121561204c575f80fd5b61205582612021565b9392505050565b5f805f6040848603121561206e575f80fd5b833567ffffffffffffffff811115612084575f80fd5b61209086828701611f2c565b909790965060209590950135949350505050565b5f602082840312156120b4575f80fd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156120f8576120f86120bb565b604052919050565b5f805f805f8060808789031215612115575f80fd5b863560ff811614612124575f80fd5b8635955067ffffffffffffffff8060208901351115612141575f80fd5b6121518960208a01358a01611f2c565b90965094506040880135811015612166575f80fd5b6040880135880189601f82011261217b575f80fd5b818135111561218c5761218c6120bb565b61219c6020823560051b016120cf565b81358082526020808301929160051b8401018c10156121b9575f80fd5b602083015b6020843560051b8501018110156122535784813511156121dc575f80fd5b803584018d603f8201126121ee575f80fd5b602081013586811115612203576122036120bb565b612216601f8201601f19166020016120cf565b8181528f604083850101111561222a575f80fd5b816040840160208301375f602083830101528086525050506020830192506020810190506121be565b50955050506060880135811015612268575f80fd5b506122798860608901358901611f2c565b969995985093965091949293915050565b5f805f6060848603121561229c575f80fd5b6122a584612021565b92506122b360208501612021565b9150604084013590509250925092565b5f805f805f805f60a0888a0312156122d9575f80fd5b873567ffffffffffffffff808211156122f0575f80fd5b6122fc8b838c01611f2c565b909950975060208a0135965060408a0135955060608a0135945060808a0135915080821115612329575f80fd5b506123368a828b01611f2c565b989b979a50959850939692959293505050565b5f60208284031215612359575f80fd5b81358015158114612055575f80fd5b838152818360208301375f910160200190815292915050565b5f82515f5b818110156123a05760208186018101518583015201612386565b505f920191825250919050565b5f80604083850312156123be575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b81810381811115611d6c57611d6c6123cf565b5f8085851115612404575f80fd5b83861115612410575f80fd5b5050820193919092039150565b67ffffffffffffffff60c01b8960c01b16815287600882015286602882015285604882015284606882015282846088830137608892019182015260a8019695505050505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b858152846020820152608060408201525f6124ab608083018587612464565b90508260608301529695505050505050565b80820180821115611d6c57611d6c6123cf565b634e487b7160e01b5f52603260045260245ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8082028115828204841417611d6c57611d6c6123cf565b5f8261256057634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215612575575f80fd5b505191905056fea264697066735822122011d1581609207a020c0be53e793a10cd9b9f7ce8e9468b91484b3818de3fd39a64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000827500000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f6
-----Decoded View---------------
Arg [0] : _chainId (uint64): 534352
Arg [1] : _messageQueue (address): 0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B
Arg [2] : _verifier (address): 0x1Ea29d57dAC237152d878758bAe4BeB2668998f6
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000082750
Arg [1] : 0000000000000000000000000d7e906bd9cafa154b048cfa766cc1e54e39af9b
Arg [2] : 0000000000000000000000001ea29d57dac237152d878758bae4beb2668998f6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.