Sepolia Testnet

Contract

0x8f3486292cEce8D15c6f60A11F5646e6f83CC467

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
L1MessageQueueWithGasPriceOracle

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)

File 1 of 12 : L1MessageQueueWithGasPriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.8.24;

import {IWhitelist} from "../../libraries/common/IWhitelist.sol";
import {IL1MessageQueue} from "./IL1MessageQueue.sol";
import {IL1MessageQueueWithGasPriceOracle} from "./IL1MessageQueueWithGasPriceOracle.sol";
import {IL2GasPriceOracle} from "./IL2GasPriceOracle.sol";

import {L1MessageQueue} from "./L1MessageQueue.sol";

contract L1MessageQueueWithGasPriceOracle is L1MessageQueue, IL1MessageQueueWithGasPriceOracle {
    /*************
     * Constants *
     *************/

    /// @notice The intrinsic gas for transaction.
    uint256 private constant INTRINSIC_GAS_TX = 21000;

    /// @notice The appropriate intrinsic gas for each byte.
    uint256 private constant APPROPRIATE_INTRINSIC_GAS_PER_BYTE = 16;

    /*************
     * Variables *
     *************/

    /// @inheritdoc IL1MessageQueueWithGasPriceOracle
    uint256 public override l2BaseFee;

    /// @inheritdoc IL1MessageQueueWithGasPriceOracle
    address public override whitelistChecker;

    /***************
     * Constructor *
     ***************/

    /// @notice Constructor for `L1MessageQueueWithGasPriceOracle` implementation contract.
    ///
    /// @param _messenger The address of `L1ScrollMessenger` contract.
    /// @param _scrollChain The address of `ScrollChain` contract.
    /// @param _enforcedTxGateway The address of `EnforcedTxGateway` contract.
    constructor(
        address _messenger,
        address _scrollChain,
        address _enforcedTxGateway
    ) L1MessageQueue(_messenger, _scrollChain, _enforcedTxGateway) {}

    /// @notice Initialize the storage of L1MessageQueueWithGasPriceOracle.
    function initializeV2() external reinitializer(2) {
        l2BaseFee = IL2GasPriceOracle(gasOracle).l2BaseFee();
        whitelistChecker = IL2GasPriceOracle(gasOracle).whitelist();
    }

    function initializeV3() external reinitializer(3) {
        nextUnfinalizedQueueIndex = pendingQueueIndex;
    }

    /*************************
     * Public View Functions *
     *************************/

    /// @inheritdoc IL1MessageQueue
    function estimateCrossDomainMessageFee(uint256 _gasLimit)
        external
        view
        override(IL1MessageQueue, L1MessageQueue)
        returns (uint256)
    {
        return _gasLimit * l2BaseFee;
    }

    /// @inheritdoc IL1MessageQueue
    function calculateIntrinsicGasFee(bytes calldata _calldata)
        public
        pure
        override(IL1MessageQueue, L1MessageQueue)
        returns (uint256)
    {
        // no way this can overflow `uint256`
        unchecked {
            return INTRINSIC_GAS_TX + _calldata.length * APPROPRIATE_INTRINSIC_GAS_PER_BYTE;
        }
    }

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @notice Allows whitelistCheckered caller to modify the l2 base fee.
    /// @param _newL2BaseFee The new l2 base fee.
    function setL2BaseFee(uint256 _newL2BaseFee) external {
        if (!IWhitelist(whitelistChecker).isSenderAllowed(_msgSender())) {
            revert ErrorNotWhitelistedSender();
        }

        uint256 _oldL2BaseFee = l2BaseFee;
        l2BaseFee = _newL2BaseFee;

        emit UpdateL2BaseFee(_oldL2BaseFee, _newL2BaseFee);
    }

    /************************
     * Restricted Functions *
     ************************/

    /// @notice Update whitelist checker contract.
    /// @dev This function can only called by contract owner.
    /// @param _newWhitelistChecker The address of new whitelist checker contract.
    function updateWhitelistChecker(address _newWhitelistChecker) external onlyOwner {
        address _oldWhitelistChecker = whitelistChecker;
        whitelistChecker = _newWhitelistChecker;
        emit UpdateWhitelistChecker(_oldWhitelistChecker, _newWhitelistChecker);
    }
}

File 2 of 12 : OwnableUpgradeable.sol
// 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;
}

File 3 of 12 : Initializable.sol
// 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;
    }
}

File 4 of 12 : AddressUpgradeable.sol
// 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);
        }
    }
}

File 5 of 12 : ContextUpgradeable.sol
// 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;
}

File 6 of 12 : BitMapsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */
library BitMapsUpgradeable {
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(BitMap storage bitmap, uint256 index, bool value) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }
}

File 7 of 12 : IL1MessageQueue.sol
// 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 dequeued transactions are reset.
    /// @param startIndex The start index of messages.
    event ResetDequeuedTransaction(uint256 startIndex);

    /// @notice Emitted when some L1 => L2 transactions are finalized in L1.
    /// @param finalizedIndex The last index of messages finalized.
    event FinalizedDequeuedTransaction(uint256 finalizedIndex);

    /// @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 The start index of all unfinalized messages.
    /// @dev All messages from `nextUnfinalizedQueueIndex` to `pendingQueueIndex-1` are committed but not finalized.
    function nextUnfinalizedQueueIndex() 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 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 Reset status of popped messages.
    ///
    /// @dev We can only reset unfinalized popped messages.
    ///
    /// @param startIndex The start index to reset.
    function resetPoppedCrossDomainMessage(uint256 startIndex) external;

    /// @notice Finalize status of popped messages.
    /// @param newFinalizedQueueIndexPlusOne The index of message to finalize plus one.
    function finalizePoppedCrossDomainMessage(uint256 newFinalizedQueueIndexPlusOne) external;

    /// @notice Drop a skipped message from the queue.
    function dropCrossDomainMessage(uint256 index) external;
}

File 8 of 12 : IL1MessageQueueWithGasPriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.24;

import {IL1MessageQueue} from "./IL1MessageQueue.sol";

interface IL1MessageQueueWithGasPriceOracle is IL1MessageQueue {
    /**********
     * Events *
     **********/

    /// @notice Emitted when owner updates whitelist checker contract.
    /// @param _oldWhitelistChecker The address of old whitelist checker contract.
    /// @param _newWhitelistChecker The address of new whitelist checker contract.
    event UpdateWhitelistChecker(address indexed _oldWhitelistChecker, address indexed _newWhitelistChecker);

    /// @notice Emitted when current l2 base fee is updated.
    /// @param oldL2BaseFee The original l2 base fee before update.
    /// @param newL2BaseFee The current l2 base fee updated.
    event UpdateL2BaseFee(uint256 oldL2BaseFee, uint256 newL2BaseFee);

    /**********
     * Errors *
     **********/

    /// @dev Thrown when the caller is not whitelisted.
    error ErrorNotWhitelistedSender();

    /*************************
     * Public View Functions *
     *************************/

    /// @notice Return the latest known l2 base fee.
    function l2BaseFee() external view returns (uint256);

    /// @notice Return the address of whitelist checker contract.
    function whitelistChecker() external view returns (address);
}

File 9 of 12 : IL2GasPriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.24;

interface IL2GasPriceOracle {
    /// @notice Return the latest known l2 base fee.
    function l2BaseFee() external view returns (uint256);

    /// @notice Return the address of whitelist contract.
    function whitelist() external view returns (address);

    /// @notice Estimate fee for cross chain message call.
    /// @param _gasLimit Gas limit required to complete the message relay on L2.
    function estimateCrossDomainMessageFee(uint256 _gasLimit) external view returns (uint256);

    /// @notice Estimate intrinsic gas fee for cross chain message call.
    /// @param _message The message to be relayed on L2.
    function calculateIntrinsicGasFee(bytes memory _message) external view returns (uint256);
}

File 10 of 12 : L1MessageQueue.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.8.24;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {BitMapsUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol";

import {IL2GasPriceOracle} from "./IL2GasPriceOracle.sol";
import {IL1MessageQueue} from "./IL1MessageQueue.sol";

import {AddressAliasHelper} from "../../libraries/common/AddressAliasHelper.sol";

// solhint-disable no-empty-blocks
// solhint-disable no-inline-assembly
// solhint-disable reason-string

/// @title L1MessageQueue
/// @notice This contract will hold all L1 to L2 messages.
/// Each appended message is assigned with a unique and increasing `uint256` index.
contract L1MessageQueue is OwnableUpgradeable, IL1MessageQueue {
    using BitMapsUpgradeable for BitMapsUpgradeable.BitMap;

    /*************
     * Constants *
     *************/

    /// @notice The address of L1ScrollMessenger contract.
    address public immutable messenger;

    /// @notice The address of ScrollChain contract.
    address public immutable scrollChain;

    /// @notice The address EnforcedTxGateway contract.
    address public immutable enforcedTxGateway;

    /*************
     * Variables *
     *************/

    /// @dev The storage slot used as L1ScrollMessenger contract, which is deprecated now.
    address private __messenger;

    /// @dev The storage slot used as ScrollChain contract, which is deprecated now.
    address private __scrollChain;

    /// @dev The storage slot used as EnforcedTxGateway contract, which is deprecated now.
    address private __enforcedTxGateway;

    /// @notice The address of GasOracle contract.
    address public gasOracle;

    /// @notice The list of queued cross domain messages.
    bytes32[] public messageQueue;

    /// @inheritdoc IL1MessageQueue
    uint256 public pendingQueueIndex;

    /// @notice The max gas limit of L1 transactions.
    uint256 public maxGasLimit;

    /// @dev The bitmap for dropped messages, where `droppedMessageBitmap[i]` keeps the bits from `[i*256, (i+1)*256)`.
    BitMapsUpgradeable.BitMap private droppedMessageBitmap;

    /// @dev The bitmap for skipped messages, where `skippedMessageBitmap[i]` keeps the bits from `[i*256, (i+1)*256)`.
    mapping(uint256 => uint256) private skippedMessageBitmap;

    /// @inheritdoc IL1MessageQueue
    uint256 public nextUnfinalizedQueueIndex;

    /// @dev The storage slots for future usage.
    uint256[40] private __gap;

    /**********************
     * Function Modifiers *
     **********************/

    modifier onlyMessenger() {
        require(_msgSender() == messenger, "Only callable by the L1ScrollMessenger");
        _;
    }

    modifier onlyScrollChain() {
        require(_msgSender() == scrollChain, "Only callable by the ScrollChain");
        _;
    }

    /***************
     * Constructor *
     ***************/

    /// @notice Constructor for `L1MessageQueue` implementation contract.
    ///
    /// @param _messenger The address of `L1ScrollMessenger` contract.
    /// @param _scrollChain The address of `ScrollChain` contract.
    /// @param _enforcedTxGateway The address of `EnforcedTxGateway` contract.
    constructor(
        address _messenger,
        address _scrollChain,
        address _enforcedTxGateway
    ) {
        if (_messenger == address(0) || _scrollChain == address(0) || _enforcedTxGateway == address(0)) {
            revert ErrorZeroAddress();
        }

        _disableInitializers();

        messenger = _messenger;
        scrollChain = _scrollChain;
        enforcedTxGateway = _enforcedTxGateway;
    }

    /// @notice Initialize the storage of L1MessageQueue.
    ///
    /// @dev The parameters `_messenger`, `_scrollChain` and `_enforcedTxGateway` are no longer used.
    ///
    /// @param _messenger The address of `L1ScrollMessenger` contract.
    /// @param _scrollChain The address of `ScrollChain` contract.
    /// @param _enforcedTxGateway The address of `EnforcedTxGateway` contract.
    /// @param _gasOracle The address of `GasOracle` contract.
    /// @param _maxGasLimit The maximum gas limit allowed in single transaction.
    function initialize(
        address _messenger,
        address _scrollChain,
        address _enforcedTxGateway,
        address _gasOracle,
        uint256 _maxGasLimit
    ) external initializer {
        OwnableUpgradeable.__Ownable_init();
        gasOracle = _gasOracle;
        maxGasLimit = _maxGasLimit;

        __messenger = _messenger;
        __scrollChain = _scrollChain;
        __enforcedTxGateway = _enforcedTxGateway;
    }

    /*************************
     * Public View Functions *
     *************************/

    /// @inheritdoc IL1MessageQueue
    function nextCrossDomainMessageIndex() external view returns (uint256) {
        return messageQueue.length;
    }

    /// @inheritdoc IL1MessageQueue
    function getCrossDomainMessage(uint256 _queueIndex) external view returns (bytes32) {
        return messageQueue[_queueIndex];
    }

    /// @inheritdoc IL1MessageQueue
    function estimateCrossDomainMessageFee(uint256 _gasLimit) external view virtual override returns (uint256) {
        address _oracle = gasOracle;
        if (_oracle == address(0)) return 0;
        return IL2GasPriceOracle(_oracle).estimateCrossDomainMessageFee(_gasLimit);
    }

    /// @inheritdoc IL1MessageQueue
    function calculateIntrinsicGasFee(bytes calldata _calldata) public view virtual override returns (uint256) {
        address _oracle = gasOracle;
        if (_oracle == address(0)) return 0;
        return IL2GasPriceOracle(_oracle).calculateIntrinsicGasFee(_calldata);
    }

    /// @inheritdoc IL1MessageQueue
    function computeTransactionHash(
        address _sender,
        uint256 _queueIndex,
        uint256 _value,
        address _target,
        uint256 _gasLimit,
        bytes calldata _data
    ) public pure override returns (bytes32) {
        // We use EIP-2718 to encode the L1 message, and the encoding of the message is
        //      `TransactionType || TransactionPayload`
        // where
        //  1. `TransactionType` is 0x7E
        //  2. `TransactionPayload` is `rlp([queueIndex, gasLimit, to, value, data, sender])`
        //
        // The spec of rlp: https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
        uint256 transactionType = 0x7E;
        bytes32 hash;
        assembly {
            function get_uint_bytes(v) -> len {
                if eq(v, 0) {
                    len := 1
                    leave
                }
                for {

                } gt(v, 0) {

                } {
                    len := add(len, 1)
                    v := shr(8, v)
                }
            }

            // This is used for both store uint and single byte.
            // Integer zero is special handled by geth to encode as `0x80`
            function store_uint_or_byte(_ptr, v, is_uint) -> ptr {
                ptr := _ptr
                switch lt(v, 128)
                case 1 {
                    switch and(iszero(v), is_uint)
                    case 1 {
                        // integer 0
                        mstore8(ptr, 0x80)
                    }
                    default {
                        // single byte in the [0x00, 0x7f]
                        mstore8(ptr, v)
                    }
                    ptr := add(ptr, 1)
                }
                default {
                    // 1-32 bytes long
                    let len := get_uint_bytes(v)
                    mstore8(ptr, add(len, 0x80))
                    ptr := add(ptr, 1)
                    mstore(ptr, shl(mul(8, sub(32, len)), v))
                    ptr := add(ptr, len)
                }
            }

            function store_address(_ptr, v) -> ptr {
                ptr := _ptr
                // 20 bytes long
                mstore8(ptr, 0x94) // 0x80 + 0x14
                ptr := add(ptr, 1)
                mstore(ptr, shl(96, v))
                ptr := add(ptr, 0x14)
            }

            // 1 byte for TransactionType
            // 4 byte for list payload length
            let start_ptr := add(mload(0x40), 5)
            let ptr := start_ptr
            ptr := store_uint_or_byte(ptr, _queueIndex, 1)
            ptr := store_uint_or_byte(ptr, _gasLimit, 1)
            ptr := store_address(ptr, _target)
            ptr := store_uint_or_byte(ptr, _value, 1)

            switch eq(_data.length, 1)
            case 1 {
                // single byte
                ptr := store_uint_or_byte(ptr, byte(0, calldataload(_data.offset)), 0)
            }
            default {
                switch lt(_data.length, 56)
                case 1 {
                    // a string is 0-55 bytes long
                    mstore8(ptr, add(0x80, _data.length))
                    ptr := add(ptr, 1)
                    calldatacopy(ptr, _data.offset, _data.length)
                    ptr := add(ptr, _data.length)
                }
                default {
                    // a string is more than 55 bytes long
                    let len_bytes := get_uint_bytes(_data.length)
                    mstore8(ptr, add(0xb7, len_bytes))
                    ptr := add(ptr, 1)
                    mstore(ptr, shl(mul(8, sub(32, len_bytes)), _data.length))
                    ptr := add(ptr, len_bytes)
                    calldatacopy(ptr, _data.offset, _data.length)
                    ptr := add(ptr, _data.length)
                }
            }
            ptr := store_address(ptr, _sender)

            let payload_len := sub(ptr, start_ptr)
            let value
            let value_bytes
            switch lt(payload_len, 56)
            case 1 {
                // the total payload of a list is 0-55 bytes long
                value := add(0xc0, payload_len)
                value_bytes := 1
            }
            default {
                // If the total payload of a list is more than 55 bytes long
                let len_bytes := get_uint_bytes(payload_len)
                value_bytes := add(len_bytes, 1)
                value := add(0xf7, len_bytes)
                value := shl(mul(len_bytes, 8), value)
                value := or(value, payload_len)
            }
            value := or(value, shl(mul(8, value_bytes), transactionType))
            value_bytes := add(value_bytes, 1)
            let value_bits := mul(8, value_bytes)
            value := or(shl(sub(256, value_bits), value), shr(value_bits, mload(start_ptr)))
            start_ptr := sub(start_ptr, value_bytes)
            mstore(start_ptr, value)
            hash := keccak256(start_ptr, sub(ptr, start_ptr))
        }
        return hash;
    }

    /// @inheritdoc IL1MessageQueue
    function isMessageSkipped(uint256 _queueIndex) external view returns (bool) {
        if (_queueIndex >= pendingQueueIndex) return false;

        return _isMessageSkipped(_queueIndex);
    }

    /// @inheritdoc IL1MessageQueue
    function isMessageDropped(uint256 _queueIndex) external view returns (bool) {
        // it should be a skipped message first.
        return _isMessageSkipped(_queueIndex) && droppedMessageBitmap.get(_queueIndex);
    }

    /*****************************
     * Public Mutating Functions *
     *****************************/

    /// @inheritdoc IL1MessageQueue
    function appendCrossDomainMessage(
        address _target,
        uint256 _gasLimit,
        bytes calldata _data
    ) external override onlyMessenger {
        // validate gas limit
        _validateGasLimit(_gasLimit, _data);

        // do address alias to avoid replay attack in L2.
        address _sender = AddressAliasHelper.applyL1ToL2Alias(_msgSender());

        _queueTransaction(_sender, _target, 0, _gasLimit, _data);
    }

    /// @inheritdoc IL1MessageQueue
    function appendEnforcedTransaction(
        address _sender,
        address _target,
        uint256 _value,
        uint256 _gasLimit,
        bytes calldata _data
    ) external override {
        require(_msgSender() == enforcedTxGateway, "Only callable by the EnforcedTxGateway");
        // We will check it in EnforcedTxGateway, just in case.
        require(_sender.code.length == 0, "only EOA");

        // validate gas limit
        _validateGasLimit(_gasLimit, _data);

        _queueTransaction(_sender, _target, _value, _gasLimit, _data);
    }

    /// @inheritdoc IL1MessageQueue
    function popCrossDomainMessage(
        uint256 _startIndex,
        uint256 _count,
        uint256 _skippedBitmap
    ) external override onlyScrollChain {
        require(_count <= 256, "pop too many messages");
        require(pendingQueueIndex == _startIndex, "start index mismatch");

        unchecked {
            // clear extra bits in `_skippedBitmap`, and if _count = 256, it's designed to overflow.
            uint256 mask = (1 << _count) - 1;
            _skippedBitmap &= mask;

            uint256 bucket = _startIndex >> 8;
            uint256 offset = _startIndex & 0xff;
            skippedMessageBitmap[bucket] |= _skippedBitmap << offset;
            if (offset + _count > 256) {
                skippedMessageBitmap[bucket + 1] = _skippedBitmap >> (256 - offset);
            }

            pendingQueueIndex = _startIndex + _count;
        }

        emit DequeueTransaction(_startIndex, _count, _skippedBitmap);
    }

    /// @inheritdoc IL1MessageQueue
    /// @dev Caller should make sure `_startIndex < pendingQueueIndex` to reduce unnecessary contract call.
    function resetPoppedCrossDomainMessage(uint256 _startIndex) external override onlyScrollChain {
        uint256 cachedPendingQueueIndex = pendingQueueIndex;
        if (_startIndex == cachedPendingQueueIndex) return;

        require(_startIndex >= nextUnfinalizedQueueIndex, "reset finalized messages");
        require(_startIndex < cachedPendingQueueIndex, "reset pending messages");

        unchecked {
            uint256 count = cachedPendingQueueIndex - _startIndex;
            uint256 bucket = _startIndex >> 8;
            uint256 offset = _startIndex & 0xff;
            skippedMessageBitmap[bucket] &= (1 << offset) - 1;
            uint256 numResetMessages = 256 - offset;
            while (numResetMessages < count) {
                bucket += 1;
                uint256 bitmap = skippedMessageBitmap[bucket];
                if (bitmap > 0) skippedMessageBitmap[bucket] = 0;
                numResetMessages += 256;
            }
        }

        pendingQueueIndex = _startIndex;
        emit ResetDequeuedTransaction(_startIndex);
    }

    /// @inheritdoc IL1MessageQueue
    function finalizePoppedCrossDomainMessage(uint256 _newFinalizedQueueIndexPlusOne)
        external
        override
        onlyScrollChain
    {
        uint256 cachedFinalizedQueueIndexPlusOne = nextUnfinalizedQueueIndex;
        if (_newFinalizedQueueIndexPlusOne == cachedFinalizedQueueIndexPlusOne) return;
        require(_newFinalizedQueueIndexPlusOne > cachedFinalizedQueueIndexPlusOne, "finalized index too small");
        require(_newFinalizedQueueIndexPlusOne <= pendingQueueIndex, "finalized index too large");

        nextUnfinalizedQueueIndex = _newFinalizedQueueIndexPlusOne;
        unchecked {
            emit FinalizedDequeuedTransaction(_newFinalizedQueueIndexPlusOne - 1);
        }
    }

    /// @inheritdoc IL1MessageQueue
    function dropCrossDomainMessage(uint256 _index) external onlyMessenger {
        require(_index < nextUnfinalizedQueueIndex, "cannot drop pending message");

        require(_isMessageSkipped(_index), "drop non-skipped message");
        require(!droppedMessageBitmap.get(_index), "message already dropped");
        droppedMessageBitmap.set(_index);

        emit DropTransaction(_index);
    }

    /************************
     * Restricted Functions *
     ************************/

    /// @notice Update the address of gas oracle.
    /// @dev This function can only called by contract owner.
    /// @param _newGasOracle The address to update.
    function updateGasOracle(address _newGasOracle) external onlyOwner {
        address _oldGasOracle = gasOracle;
        gasOracle = _newGasOracle;

        emit UpdateGasOracle(_oldGasOracle, _newGasOracle);
    }

    /// @notice Update the max gas limit.
    /// @dev This function can only called by contract owner.
    /// @param _newMaxGasLimit The new max gas limit.
    function updateMaxGasLimit(uint256 _newMaxGasLimit) external onlyOwner {
        uint256 _oldMaxGasLimit = maxGasLimit;
        maxGasLimit = _newMaxGasLimit;

        emit UpdateMaxGasLimit(_oldMaxGasLimit, _newMaxGasLimit);
    }

    /**********************
     * Internal Functions *
     **********************/

    /// @dev Internal function to queue a L1 transaction.
    /// @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 _queueTransaction(
        address _sender,
        address _target,
        uint256 _value,
        uint256 _gasLimit,
        bytes calldata _data
    ) internal {
        // compute transaction hash
        uint256 _queueIndex = messageQueue.length;
        bytes32 _hash = computeTransactionHash(_sender, _queueIndex, _value, _target, _gasLimit, _data);
        messageQueue.push(_hash);

        // emit event
        emit QueueTransaction(_sender, _target, _value, uint64(_queueIndex), _gasLimit, _data);
    }

    function _validateGasLimit(uint256 _gasLimit, bytes calldata _calldata) internal view {
        require(_gasLimit <= maxGasLimit, "Gas limit must not exceed maxGasLimit");
        // check if the gas limit is above intrinsic gas
        uint256 intrinsicGas = calculateIntrinsicGasFee(_calldata);
        require(_gasLimit >= intrinsicGas, "Insufficient gas limit, must be above intrinsic gas");
    }

    /// @dev Returns whether the bit at `index` is set.
    function _isMessageSkipped(uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return skippedMessageBitmap[bucket] & mask != 0;
    }
}

File 11 of 12 : AddressAliasHelper.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.24;

library AddressAliasHelper {
    /// @dev The offset added to the address in L1.
    uint160 internal constant OFFSET = uint160(0x1111000000000000000000000000000000001111);

    /// @notice Utility function that converts the address in the L1 that submitted a tx to
    /// the inbox to the msg.sender viewed in the L2
    /// @param l1Address the address in the L1 that triggered the tx to L2
    /// @return l2Address L2 address as viewed in msg.sender
    function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
        unchecked {
            l2Address = address(uint160(l1Address) + OFFSET);
        }
    }

    /// @notice Utility function that converts the msg.sender viewed in the L2 to the
    /// address in the L1 that submitted a tx to the inbox
    /// @param l2Address L2 address as viewed in msg.sender
    /// @return l1Address the address in the L1 that triggered the tx to L2
    function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {
        unchecked {
            l1Address = address(uint160(l2Address) - OFFSET);
        }
    }
}

File 12 of 12 : IWhitelist.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.24;

interface IWhitelist {
    /// @notice Check whether the sender is allowed to do something.
    /// @param _sender The address of sender.
    function isSenderAllowed(address _sender) external view returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "cancun",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_messenger","type":"address"},{"internalType":"address","name":"_scrollChain","type":"address"},{"internalType":"address","name":"_enforcedTxGateway","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ErrorNotWhitelistedSender","type":"error"},{"inputs":[],"name":"ErrorZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"skippedBitmap","type":"uint256"}],"name":"DequeueTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"DropTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"finalizedIndex","type":"uint256"}],"name":"FinalizedDequeuedTransaction","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":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"queueIndex","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"QueueTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"ResetDequeuedTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_oldGasOracle","type":"address"},{"indexed":true,"internalType":"address","name":"_newGasOracle","type":"address"}],"name":"UpdateGasOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldL2BaseFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newL2BaseFee","type":"uint256"}],"name":"UpdateL2BaseFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_oldMaxGasLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newMaxGasLimit","type":"uint256"}],"name":"UpdateMaxGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_oldWhitelistChecker","type":"address"},{"indexed":true,"internalType":"address","name":"_newWhitelistChecker","type":"address"}],"name":"UpdateWhitelistChecker","type":"event"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"appendCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"appendEnforcedTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"calculateIntrinsicGasFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_queueIndex","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"computeTransactionHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"dropCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enforcedTxGateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"estimateCrossDomainMessageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFinalizedQueueIndexPlusOne","type":"uint256"}],"name":"finalizePoppedCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gasOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queueIndex","type":"uint256"}],"name":"getCrossDomainMessage","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_messenger","type":"address"},{"internalType":"address","name":"_scrollChain","type":"address"},{"internalType":"address","name":"_enforcedTxGateway","type":"address"},{"internalType":"address","name":"_gasOracle","type":"address"},{"internalType":"uint256","name":"_maxGasLimit","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeV3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queueIndex","type":"uint256"}],"name":"isMessageDropped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queueIndex","type":"uint256"}],"name":"isMessageSkipped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2BaseFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxGasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"messageQueue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messenger","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextCrossDomainMessageIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextUnfinalizedQueueIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingQueueIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startIndex","type":"uint256"},{"internalType":"uint256","name":"_count","type":"uint256"},{"internalType":"uint256","name":"_skippedBitmap","type":"uint256"}],"name":"popCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startIndex","type":"uint256"}],"name":"resetPoppedCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"scrollChain","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newL2BaseFee","type":"uint256"}],"name":"setL2BaseFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newGasOracle","type":"address"}],"name":"updateGasOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMaxGasLimit","type":"uint256"}],"name":"updateMaxGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newWhitelistChecker","type":"address"}],"name":"updateWhitelistChecker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e060405234801562000010575f80fd5b5060405162001dc238038062001dc283398101604081905262000033916200018c565b8282826001600160a01b03831615806200005457506001600160a01b038216155b806200006757506001600160a01b038116155b15620000865760405163a7f9319d60e01b815260040160405180910390fd5b62000090620000b2565b6001600160a01b0392831660805290821660a0521660c05250620001d3915050565b5f54610100900460ff16156200011e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff908116146200016e575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b038116811462000187575f80fd5b919050565b5f805f606084860312156200019f575f80fd5b620001aa8462000170565b9250620001ba6020850162000170565b9150620001ca6040850162000170565b90509250925092565b60805160a05160c051611b9a620002285f395f81816102a001526110b401525f818161036e015281816104b5015281816106d20152610c8f01525f818161023e01528181610e5b01526110110152611b9a5ff3fe608060405234801561000f575f80fd5b50600436106101f2575f3560e01c80637d82191a11610114578063bdc6f0a0116100a9578063e172d3a111610079578063e172d3a114610442578063e3176bd51461045c578063f2fde38b14610465578063f7013ef614610478578063fd0ad31e1461048b575f80fd5b8063bdc6f0a0146103f6578063d5ad4a9714610409578063d7704bae1461041c578063d99bc80e1461042f575f80fd5b80639b159782116100e45780639b159782146103b4578063a85006ca146103c7578063ae453cd5146103d0578063bb7862ca146103e3575f80fd5b80637d82191a14610356578063897630dd146103695780638da5cb5b1461039057806391652461146103a1575f80fd5b80635ad9945a1161018a5780635f9cd92e1161015a5780635f9cd92e1461031557806370cee67f14610328578063715018a61461033b5780637a6e933314610343575f80fd5b80635ad9945a146102de5780635cd8a76b146102f15780635d62a8dd146102f95780635e45da231461030c575f80fd5b80633e6dada1116101c55780633e6dada1146102785780633e83496c1461029b578063416bdfa1146102c257806355f613ce146102cb575f80fd5b806329aa604b146101f657806338050fd41461021c57806338e454b1146102315780633cb747bf14610239575b5f80fd5b6102096102043660046116d2565b610493565b6040519081526020015b60405180910390f35b61022f61022a3660046116d2565b6104b2565b005b61022f6105f3565b6102607f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610213565b61028b6102863660046116d2565b610687565b6040519015158152602001610213565b6102607f000000000000000000000000000000000000000000000000000000000000000081565b610209606e5481565b61022f6102d93660046116e9565b6106cf565b6102096102ec36600461176b565b610850565b61022f610a40565b606854610260906001600160a01b031681565b610209606b5481565b61022f6103233660046117eb565b610bc7565b61022f6103363660046117eb565b610c20565b61022f610c79565b61022f6103513660046116d2565b610c8c565b61028b6103643660046116d2565b610e25565b6102607f000000000000000000000000000000000000000000000000000000000000000081565b6033546001600160a01b0316610260565b61022f6103af3660046116d2565b610e58565b61022f6103c236600461180d565b61100e565b610209606a5481565b6102096103de3660046116d2565b61108d565b609854610260906001600160a01b031681565b61022f610404366004611865565b6110b1565b61022f6104173660046116d2565b61119c565b61020961042a3660046116d2565b6111e2565b61022f61043d3660046116d2565b6111f1565b6102096104503660046118dc565b60100261520801919050565b61020960975481565b61022f6104733660046117eb565b6112c4565b61022f61048636600461191b565b61133a565b606954610209565b606981815481106104a2575f80fd5b5f91825260209091200154905081565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146105035760405162461bcd60e51b81526004016104fa9061197b565b60405180910390fd5b606e54808203610511575050565b8082116105605760405162461bcd60e51b815260206004820152601960248201527f66696e616c697a656420696e64657820746f6f20736d616c6c0000000000000060448201526064016104fa565b606a548211156105b25760405162461bcd60e51b815260206004820152601960248201527f66696e616c697a656420696e64657820746f6f206c617267650000000000000060448201526064016104fa565b606e8290556040515f19830181527fbbbf2de085aff601d965315326f9908eb5ebbb3d1b307e7e5ec42384e3320a10906020015b60405180910390a1505b50565b5f54600390610100900460ff1615801561061357505f5460ff8083169116105b61062f5760405162461bcd60e51b81526004016104fa906119b0565b5f8054606a54606e5561ffff191660ff83169081176101001761ff0019169091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b600881901c5f908152606d6020526040812054600160ff84161b16151580156106c95750600882901c5f908152606c6020526040902054600160ff84161b1615155b92915050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146107175760405162461bcd60e51b81526004016104fa9061197b565b6101008211156107615760405162461bcd60e51b8152602060048201526015602482015274706f7020746f6f206d616e79206d6573736167657360581b60448201526064016104fa565b82606a54146107a95760405162461bcd60e51b81526020600482015260146024820152730e6e8c2e4e840d2dcc8caf040dad2e6dac2e8c6d60631b60448201526064016104fa565b600883901c5f818152606d6020526040902080546001851b5f190193841660ff871681811b90921790925590929190610100818601111561080157600182015f908152606d6020526040902061010082900385901c90555b505050818301606a5560408051848152602081018490529081018290527fc77f792f838ae38399ac31acc3348389aeb110ce7bedf3cfdbdd5e66792679709060600160405180910390a1505050565b5f607e816108fa565b5f8161086757506001919050565b5b811561087d5760089190911c90600101610868565b919050565b8060808310600181146108ba5761089884610859565b60808101835360018301925084816020036008021b83528083019250506108db565b84841516600181146108ce578483536108d3565b608083535b506001820191505b509392505050565b806094815360609290921b60018301525060150190565b6005604051018061090d60018c83610882565b905061091b60018983610882565b905061092789826108e3565b905061093560018b83610882565b9050600186146001811461099d5760388710600181146109825761095888610859565b8060b701845360018401935088816020036008021b84528084019350508789843791870191610997565b87608001835360018301925087898437918701915b506109ae565b6109ab5f89355f1a84610882565b91505b506109b98c826108e3565b90508181035f8060388310600181146109ec576109d584610859565b60f78101600882021b8517935060010191506109f7565b8360c0019250600191505b5086816008021b821791506001810190508060080292508451831c8284610100031b17915080850394505080845250508181038220925050508092505050979650505050505050565b5f54600290610100900460ff16158015610a6057505f5460ff8083169116105b610a7c5760405162461bcd60e51b81526004016104fa906119b0565b5f805461ffff191660ff8316176101001790556068546040805163e3176bd560e01b815290516001600160a01b039092169163e3176bd5916004808201926020929091908290030181865afa158015610ad7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610afb91906119fe565b609755606854604080516393e59dc160e01b815290516001600160a01b03909216916393e59dc1916004808201926020929091908290030181865afa158015610b46573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6a9190611a15565b609880546001600160a01b0319166001600160a01b03929092169190911790555f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161067c565b610bcf611451565b609880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff91b2a410a89d46f14ee984a57e6d7892c217f116905371180998e20cef237e5905f90a35050565b610c28611451565b606880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f9ed5ec28f252b3e7f62f1ace8e54c5ebabf4c61cc2a7c33a806365b2ff7ecc5e905f90a35050565b610c81611451565b610c8a5f6114ab565b565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610cd45760405162461bcd60e51b81526004016104fa9061197b565b606a54808203610ce2575050565b606e54821015610d345760405162461bcd60e51b815260206004820152601860248201527f72657365742066696e616c697a6564206d65737361676573000000000000000060448201526064016104fa565b808210610d7c5760405162461bcd60e51b815260206004820152601660248201527572657365742070656e64696e67206d6573736167657360501b60448201526064016104fa565b600882901c5f818152606d602052604090208054600160ff861690811b5f190190911690915583830391906101008190035b83811015610dec576001929092015f818152606d60205260409020549092908015610de2575f848152606d60205260408120555b5061010001610dae565b505050606a839055506040518281527fc079f1a662217305bfe03e0a85f03944a2ac422f5ee5431c98b9ef7d3c6226c9906020016105e6565b5f606a548210610e3657505f919050565b600882901c5f908152606d6020526040902054600160ff84161b1615156106c9565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610ea05760405162461bcd60e51b81526004016104fa90611a30565b606e548110610ef15760405162461bcd60e51b815260206004820152601b60248201527f63616e6e6f742064726f702070656e64696e67206d657373616765000000000060448201526064016104fa565b600881901c5f908152606d6020526040902054600160ff83161b16610f585760405162461bcd60e51b815260206004820152601860248201527f64726f70206e6f6e2d736b6970706564206d657373616765000000000000000060448201526064016104fa565b600881901c5f908152606c6020526040902054600160ff83161b1615610fc05760405162461bcd60e51b815260206004820152601760248201527f6d65737361676520616c72656164792064726f7070656400000000000000000060448201526064016104fa565b600881901c5f908152606c602052604090208054600160ff84161b1790556040518181527f43a375005206d20a83abc71722cba68c24434a8dc1f583775be7c3fde0396cbf9060200161067c565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146110565760405162461bcd60e51b81526004016104fa90611a30565b6110618383836114fc565b337311110000000000000000000000000000000011110161108681865f8787876115d6565b5050505050565b5f606982815481106110a1576110a1611a76565b905f5260205f2001549050919050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146111385760405162461bcd60e51b815260206004820152602660248201527f4f6e6c792063616c6c61626c652062792074686520456e666f7263656454784760448201526561746577617960d01b60648201526084016104fa565b6001600160a01b0386163b1561117b5760405162461bcd60e51b81526020600482015260086024820152676f6e6c7920454f4160c01b60448201526064016104fa565b6111868383836114fc565b6111948686868686866115d6565b505050505050565b6111a4611451565b606b80549082905560408051828152602081018490527fa030881e03ff723954dd0d35500564afab9603555d09d4456a32436f2b2373c591016105e6565b5f609754826106c99190611a8a565b6098546001600160a01b031663efc78401336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611245573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112699190611aad565b6112865760405163181f985f60e21b815260040160405180910390fd5b609780549082905560408051828152602081018490527fc5271ba80b67178cc31f04a3755325121400925878dc608432b6fcaead36632991016105e6565b6112cc611451565b6001600160a01b0381166113315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fa565b6105f0816114ab565b5f54610100900460ff161580801561135857505f54600160ff909116105b806113715750303b15801561137157505f5460ff166001145b61138d5760405162461bcd60e51b81526004016104fa906119b0565b5f805460ff1916600117905580156113ae575f805461ff0019166101001790555b6113b661167a565b606880546001600160a01b038086166001600160a01b031992831617909255606b849055606580548984169083161790556066805488841690831617905560678054928716929091169190911790558015611194575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6033546001600160a01b03163314610c8a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fa565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606b5483111561155c5760405162461bcd60e51b815260206004820152602560248201527f476173206c696d6974206d757374206e6f7420657863656564206d6178476173604482015264131a5b5a5d60da1b60648201526084016104fa565b6010810261520801808410156115d05760405162461bcd60e51b815260206004820152603360248201527f496e73756666696369656e7420676173206c696d69742c206d7573742062652060448201527261626f766520696e7472696e7369632067617360681b60648201526084016104fa565b50505050565b6069545f6115e98883888a898989610850565b606980546001810182555f919091527f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe399914308018190556040519091506001600160a01b0380891691908a16907f69cfcb8e6d4192b8aba9902243912587f37e550d75c1fa801491fce26717f37e90611668908a9087908b908b908b90611acc565b60405180910390a35050505050505050565b5f54610100900460ff166116a05760405162461bcd60e51b81526004016104fa90611b19565b610c8a5f54610100900460ff166116c95760405162461bcd60e51b81526004016104fa90611b19565b610c8a336114ab565b5f602082840312156116e2575f80fd5b5035919050565b5f805f606084860312156116fb575f80fd5b505081359360208301359350604090920135919050565b6001600160a01b03811681146105f0575f80fd5b5f8083601f840112611736575f80fd5b50813567ffffffffffffffff81111561174d575f80fd5b602083019150836020828501011115611764575f80fd5b9250929050565b5f805f805f805f60c0888a031215611781575f80fd5b873561178c81611712565b9650602088013595506040880135945060608801356117aa81611712565b93506080880135925060a088013567ffffffffffffffff8111156117cc575f80fd5b6117d88a828b01611726565b989b979a50959850939692959293505050565b5f602082840312156117fb575f80fd5b813561180681611712565b9392505050565b5f805f8060608587031215611820575f80fd5b843561182b81611712565b935060208501359250604085013567ffffffffffffffff81111561184d575f80fd5b61185987828801611726565b95989497509550505050565b5f805f805f8060a0878903121561187a575f80fd5b863561188581611712565b9550602087013561189581611712565b94506040870135935060608701359250608087013567ffffffffffffffff8111156118be575f80fd5b6118ca89828a01611726565b979a9699509497509295939492505050565b5f80602083850312156118ed575f80fd5b823567ffffffffffffffff811115611903575f80fd5b61190f85828601611726565b90969095509350505050565b5f805f805f60a0868803121561192f575f80fd5b853561193a81611712565b9450602086013561194a81611712565b9350604086013561195a81611712565b9250606086013561196a81611712565b949793965091946080013592915050565b6020808252818101527f4f6e6c792063616c6c61626c6520627920746865205363726f6c6c436861696e604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b5f60208284031215611a0e575f80fd5b5051919050565b5f60208284031215611a25575f80fd5b815161180681611712565b60208082526026908201527f4f6e6c792063616c6c61626c6520627920746865204c315363726f6c6c4d657360408201526539b2b733b2b960d11b606082015260800190565b634e487b7160e01b5f52603260045260245ffd5b80820281158282048414176106c957634e487b7160e01b5f52601160045260245ffd5b5f60208284031215611abd575f80fd5b81518015158114611806575f80fd5b85815267ffffffffffffffff8516602082015283604082015260806060820152816080820152818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122037cb6329ab84ac8b6d7a00e48617741e1ad6720a954123719736b1794839d27464736f6c6343000818003300000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a000000000000000000000000097f421ca37889269a11ae0fef558114b984c7487

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106101f2575f3560e01c80637d82191a11610114578063bdc6f0a0116100a9578063e172d3a111610079578063e172d3a114610442578063e3176bd51461045c578063f2fde38b14610465578063f7013ef614610478578063fd0ad31e1461048b575f80fd5b8063bdc6f0a0146103f6578063d5ad4a9714610409578063d7704bae1461041c578063d99bc80e1461042f575f80fd5b80639b159782116100e45780639b159782146103b4578063a85006ca146103c7578063ae453cd5146103d0578063bb7862ca146103e3575f80fd5b80637d82191a14610356578063897630dd146103695780638da5cb5b1461039057806391652461146103a1575f80fd5b80635ad9945a1161018a5780635f9cd92e1161015a5780635f9cd92e1461031557806370cee67f14610328578063715018a61461033b5780637a6e933314610343575f80fd5b80635ad9945a146102de5780635cd8a76b146102f15780635d62a8dd146102f95780635e45da231461030c575f80fd5b80633e6dada1116101c55780633e6dada1146102785780633e83496c1461029b578063416bdfa1146102c257806355f613ce146102cb575f80fd5b806329aa604b146101f657806338050fd41461021c57806338e454b1146102315780633cb747bf14610239575b5f80fd5b6102096102043660046116d2565b610493565b6040519081526020015b60405180910390f35b61022f61022a3660046116d2565b6104b2565b005b61022f6105f3565b6102607f00000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a81565b6040516001600160a01b039091168152602001610213565b61028b6102863660046116d2565b610687565b6040519015158152602001610213565b6102607f00000000000000000000000097f421ca37889269a11ae0fef558114b984c748781565b610209606e5481565b61022f6102d93660046116e9565b6106cf565b6102096102ec36600461176b565b610850565b61022f610a40565b606854610260906001600160a01b031681565b610209606b5481565b61022f6103233660046117eb565b610bc7565b61022f6103363660046117eb565b610c20565b61022f610c79565b61022f6103513660046116d2565b610c8c565b61028b6103643660046116d2565b610e25565b6102607f0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a081565b6033546001600160a01b0316610260565b61022f6103af3660046116d2565b610e58565b61022f6103c236600461180d565b61100e565b610209606a5481565b6102096103de3660046116d2565b61108d565b609854610260906001600160a01b031681565b61022f610404366004611865565b6110b1565b61022f6104173660046116d2565b61119c565b61020961042a3660046116d2565b6111e2565b61022f61043d3660046116d2565b6111f1565b6102096104503660046118dc565b60100261520801919050565b61020960975481565b61022f6104733660046117eb565b6112c4565b61022f61048636600461191b565b61133a565b606954610209565b606981815481106104a2575f80fd5b5f91825260209091200154905081565b337f0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a06001600160a01b0316146105035760405162461bcd60e51b81526004016104fa9061197b565b60405180910390fd5b606e54808203610511575050565b8082116105605760405162461bcd60e51b815260206004820152601960248201527f66696e616c697a656420696e64657820746f6f20736d616c6c0000000000000060448201526064016104fa565b606a548211156105b25760405162461bcd60e51b815260206004820152601960248201527f66696e616c697a656420696e64657820746f6f206c617267650000000000000060448201526064016104fa565b606e8290556040515f19830181527fbbbf2de085aff601d965315326f9908eb5ebbb3d1b307e7e5ec42384e3320a10906020015b60405180910390a1505b50565b5f54600390610100900460ff1615801561061357505f5460ff8083169116105b61062f5760405162461bcd60e51b81526004016104fa906119b0565b5f8054606a54606e5561ffff191660ff83169081176101001761ff0019169091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b600881901c5f908152606d6020526040812054600160ff84161b16151580156106c95750600882901c5f908152606c6020526040902054600160ff84161b1615155b92915050565b337f0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a06001600160a01b0316146107175760405162461bcd60e51b81526004016104fa9061197b565b6101008211156107615760405162461bcd60e51b8152602060048201526015602482015274706f7020746f6f206d616e79206d6573736167657360581b60448201526064016104fa565b82606a54146107a95760405162461bcd60e51b81526020600482015260146024820152730e6e8c2e4e840d2dcc8caf040dad2e6dac2e8c6d60631b60448201526064016104fa565b600883901c5f818152606d6020526040902080546001851b5f190193841660ff871681811b90921790925590929190610100818601111561080157600182015f908152606d6020526040902061010082900385901c90555b505050818301606a5560408051848152602081018490529081018290527fc77f792f838ae38399ac31acc3348389aeb110ce7bedf3cfdbdd5e66792679709060600160405180910390a1505050565b5f607e816108fa565b5f8161086757506001919050565b5b811561087d5760089190911c90600101610868565b919050565b8060808310600181146108ba5761089884610859565b60808101835360018301925084816020036008021b83528083019250506108db565b84841516600181146108ce578483536108d3565b608083535b506001820191505b509392505050565b806094815360609290921b60018301525060150190565b6005604051018061090d60018c83610882565b905061091b60018983610882565b905061092789826108e3565b905061093560018b83610882565b9050600186146001811461099d5760388710600181146109825761095888610859565b8060b701845360018401935088816020036008021b84528084019350508789843791870191610997565b87608001835360018301925087898437918701915b506109ae565b6109ab5f89355f1a84610882565b91505b506109b98c826108e3565b90508181035f8060388310600181146109ec576109d584610859565b60f78101600882021b8517935060010191506109f7565b8360c0019250600191505b5086816008021b821791506001810190508060080292508451831c8284610100031b17915080850394505080845250508181038220925050508092505050979650505050505050565b5f54600290610100900460ff16158015610a6057505f5460ff8083169116105b610a7c5760405162461bcd60e51b81526004016104fa906119b0565b5f805461ffff191660ff8316176101001790556068546040805163e3176bd560e01b815290516001600160a01b039092169163e3176bd5916004808201926020929091908290030181865afa158015610ad7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610afb91906119fe565b609755606854604080516393e59dc160e01b815290516001600160a01b03909216916393e59dc1916004808201926020929091908290030181865afa158015610b46573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6a9190611a15565b609880546001600160a01b0319166001600160a01b03929092169190911790555f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161067c565b610bcf611451565b609880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff91b2a410a89d46f14ee984a57e6d7892c217f116905371180998e20cef237e5905f90a35050565b610c28611451565b606880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f9ed5ec28f252b3e7f62f1ace8e54c5ebabf4c61cc2a7c33a806365b2ff7ecc5e905f90a35050565b610c81611451565b610c8a5f6114ab565b565b337f0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a06001600160a01b031614610cd45760405162461bcd60e51b81526004016104fa9061197b565b606a54808203610ce2575050565b606e54821015610d345760405162461bcd60e51b815260206004820152601860248201527f72657365742066696e616c697a6564206d65737361676573000000000000000060448201526064016104fa565b808210610d7c5760405162461bcd60e51b815260206004820152601660248201527572657365742070656e64696e67206d6573736167657360501b60448201526064016104fa565b600882901c5f818152606d602052604090208054600160ff861690811b5f190190911690915583830391906101008190035b83811015610dec576001929092015f818152606d60205260409020549092908015610de2575f848152606d60205260408120555b5061010001610dae565b505050606a839055506040518281527fc079f1a662217305bfe03e0a85f03944a2ac422f5ee5431c98b9ef7d3c6226c9906020016105e6565b5f606a548210610e3657505f919050565b600882901c5f908152606d6020526040902054600160ff84161b1615156106c9565b337f00000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a6001600160a01b031614610ea05760405162461bcd60e51b81526004016104fa90611a30565b606e548110610ef15760405162461bcd60e51b815260206004820152601b60248201527f63616e6e6f742064726f702070656e64696e67206d657373616765000000000060448201526064016104fa565b600881901c5f908152606d6020526040902054600160ff83161b16610f585760405162461bcd60e51b815260206004820152601860248201527f64726f70206e6f6e2d736b6970706564206d657373616765000000000000000060448201526064016104fa565b600881901c5f908152606c6020526040902054600160ff83161b1615610fc05760405162461bcd60e51b815260206004820152601760248201527f6d65737361676520616c72656164792064726f7070656400000000000000000060448201526064016104fa565b600881901c5f908152606c602052604090208054600160ff84161b1790556040518181527f43a375005206d20a83abc71722cba68c24434a8dc1f583775be7c3fde0396cbf9060200161067c565b337f00000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a6001600160a01b0316146110565760405162461bcd60e51b81526004016104fa90611a30565b6110618383836114fc565b337311110000000000000000000000000000000011110161108681865f8787876115d6565b5050505050565b5f606982815481106110a1576110a1611a76565b905f5260205f2001549050919050565b337f00000000000000000000000097f421ca37889269a11ae0fef558114b984c74876001600160a01b0316146111385760405162461bcd60e51b815260206004820152602660248201527f4f6e6c792063616c6c61626c652062792074686520456e666f7263656454784760448201526561746577617960d01b60648201526084016104fa565b6001600160a01b0386163b1561117b5760405162461bcd60e51b81526020600482015260086024820152676f6e6c7920454f4160c01b60448201526064016104fa565b6111868383836114fc565b6111948686868686866115d6565b505050505050565b6111a4611451565b606b80549082905560408051828152602081018490527fa030881e03ff723954dd0d35500564afab9603555d09d4456a32436f2b2373c591016105e6565b5f609754826106c99190611a8a565b6098546001600160a01b031663efc78401336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611245573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112699190611aad565b6112865760405163181f985f60e21b815260040160405180910390fd5b609780549082905560408051828152602081018490527fc5271ba80b67178cc31f04a3755325121400925878dc608432b6fcaead36632991016105e6565b6112cc611451565b6001600160a01b0381166113315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fa565b6105f0816114ab565b5f54610100900460ff161580801561135857505f54600160ff909116105b806113715750303b15801561137157505f5460ff166001145b61138d5760405162461bcd60e51b81526004016104fa906119b0565b5f805460ff1916600117905580156113ae575f805461ff0019166101001790555b6113b661167a565b606880546001600160a01b038086166001600160a01b031992831617909255606b849055606580548984169083161790556066805488841690831617905560678054928716929091169190911790558015611194575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6033546001600160a01b03163314610c8a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fa565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606b5483111561155c5760405162461bcd60e51b815260206004820152602560248201527f476173206c696d6974206d757374206e6f7420657863656564206d6178476173604482015264131a5b5a5d60da1b60648201526084016104fa565b6010810261520801808410156115d05760405162461bcd60e51b815260206004820152603360248201527f496e73756666696369656e7420676173206c696d69742c206d7573742062652060448201527261626f766520696e7472696e7369632067617360681b60648201526084016104fa565b50505050565b6069545f6115e98883888a898989610850565b606980546001810182555f919091527f7fb4302e8e91f9110a6554c2c0a24601252c2a42c2220ca988efcfe399914308018190556040519091506001600160a01b0380891691908a16907f69cfcb8e6d4192b8aba9902243912587f37e550d75c1fa801491fce26717f37e90611668908a9087908b908b908b90611acc565b60405180910390a35050505050505050565b5f54610100900460ff166116a05760405162461bcd60e51b81526004016104fa90611b19565b610c8a5f54610100900460ff166116c95760405162461bcd60e51b81526004016104fa90611b19565b610c8a336114ab565b5f602082840312156116e2575f80fd5b5035919050565b5f805f606084860312156116fb575f80fd5b505081359360208301359350604090920135919050565b6001600160a01b03811681146105f0575f80fd5b5f8083601f840112611736575f80fd5b50813567ffffffffffffffff81111561174d575f80fd5b602083019150836020828501011115611764575f80fd5b9250929050565b5f805f805f805f60c0888a031215611781575f80fd5b873561178c81611712565b9650602088013595506040880135945060608801356117aa81611712565b93506080880135925060a088013567ffffffffffffffff8111156117cc575f80fd5b6117d88a828b01611726565b989b979a50959850939692959293505050565b5f602082840312156117fb575f80fd5b813561180681611712565b9392505050565b5f805f8060608587031215611820575f80fd5b843561182b81611712565b935060208501359250604085013567ffffffffffffffff81111561184d575f80fd5b61185987828801611726565b95989497509550505050565b5f805f805f8060a0878903121561187a575f80fd5b863561188581611712565b9550602087013561189581611712565b94506040870135935060608701359250608087013567ffffffffffffffff8111156118be575f80fd5b6118ca89828a01611726565b979a9699509497509295939492505050565b5f80602083850312156118ed575f80fd5b823567ffffffffffffffff811115611903575f80fd5b61190f85828601611726565b90969095509350505050565b5f805f805f60a0868803121561192f575f80fd5b853561193a81611712565b9450602086013561194a81611712565b9350604086013561195a81611712565b9250606086013561196a81611712565b949793965091946080013592915050565b6020808252818101527f4f6e6c792063616c6c61626c6520627920746865205363726f6c6c436861696e604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b5f60208284031215611a0e575f80fd5b5051919050565b5f60208284031215611a25575f80fd5b815161180681611712565b60208082526026908201527f4f6e6c792063616c6c61626c6520627920746865204c315363726f6c6c4d657360408201526539b2b733b2b960d11b606082015260800190565b634e487b7160e01b5f52603260045260245ffd5b80820281158282048414176106c957634e487b7160e01b5f52601160045260245ffd5b5f60208284031215611abd575f80fd5b81518015158114611806575f80fd5b85815267ffffffffffffffff8516602082015283604082015260806060820152816080820152818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122037cb6329ab84ac8b6d7a00e48617741e1ad6720a954123719736b1794839d27464736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a000000000000000000000000097f421ca37889269a11ae0fef558114b984c7487

-----Decoded View---------------
Arg [0] : _messenger (address): 0x50c7d3e7f7c656493D1D76aaa1a836CedfCBB16A
Arg [1] : _scrollChain (address): 0x2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0
Arg [2] : _enforcedTxGateway (address): 0x97f421CA37889269a11ae0fef558114b984C7487

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000050c7d3e7f7c656493d1d76aaa1a836cedfcbb16a
Arg [1] : 0000000000000000000000002d567ece699eabe5afcd141edb7a4f2d0d6ce8a0
Arg [2] : 00000000000000000000000097f421ca37889269a11ae0fef558114b984c7487


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.