Contract 0x4200000000000000000000000000000000000007 7

 

Contract Overview

Boba Network: L2 Cross Domain Messenger
Balance:
0 Ether

EtherValue:
$0.00
My Name Tag:
Not Available, login to update

ContractCreator:
GENESIS at txn GENESIS_4200000000000000000000000000000000000007
Txn Hash Method
Block
From
To
Value
0xfe72fda0b6769e57c8b4919ded8714d2e9e2f008ce7462d7272b2a597c79ab1aRelay Message9930122023-03-30 1:16:4213 hrs 4 mins ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x2bc92a8f985f633aa767abb5fd9b188e677f654c8b8882830de10181f8f842b1Relay Message9929522023-03-29 23:53:1814 hrs 28 mins ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xde540f134f0125e5b22ebf740be54b919fdfb8f2e57b5fdcc189e08b626e5768Relay Message9927342023-03-29 16:01:5122 hrs 19 mins ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x3d2e4929e7c260206ba87e58a6687fa399ff83d9e94e9d5e3945ea643986a62fRelay Message9927222023-03-29 15:53:3822 hrs 27 mins ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x4435fcd8a300cb493ffb7df608ad3162d455031ec7c71093d9fe60f40f537cd1Relay Message9925342023-03-29 10:15:511 day 4 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xe28b3add7155220185b8660faf77b39c6b512ac01be8e898c7c31233972c354cRelay Message9922582023-03-29 4:10:141 day 10 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x14caf446e5f4dc6ac1a0ac3056ec43c7f335b045e8cd632ba7a1551f332a32a7Relay Message9919892023-03-28 20:13:531 day 18 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x5c332a1565c1d2fe79da78afcb03153a913cbd964c781acd62c032230af448a3Relay Message9919532023-03-28 19:30:281 day 18 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x9b1dfb8d45f27aba605a4ace3cca368e8c36a5fa5a95e19133555649e1a87a3fRelay Message9916812023-03-28 13:45:502 days 35 mins ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x8b04b289592c4565f3ce59b5177816625b98279cb29a20a11f88e77b9cf03aa7Relay Message9914652023-03-28 9:49:272 days 4 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x926f94cb434fc8bc0c2fac5ccaf0c473ad2eaf4b7d853fc016a9e81874c75216Relay Message9912372023-03-28 5:51:412 days 8 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xa8bbddadbd50912e8a9d8d5fb4ac27356ea309bbc51e7cae4528fba0cd76911aRelay Message9911932023-03-28 5:08:392 days 9 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xb29558102900f05a3cfdd9ae1ccd7ef8d21241b58f52a611db71b681d098bc49Relay Message9911832023-03-28 4:57:392 days 9 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xa39c76fddd80054cc2ccf9233864de32f8d90871ebc39fece9ab8e1f46773595Relay Message9911662023-03-28 4:35:062 days 9 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x2dea65058dd8b5a9e8240826b371f6cda514f0ee03180379e02f1c33d71e6368Relay Message9911382023-03-28 4:13:282 days 10 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xa85a33ce00043b943a2090998beabe05d22101229bcf9ca623ba002fa2ad78f5Relay Message9909012023-03-28 0:53:272 days 13 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x89f443d20df8b706003929f5d872e25a01a63767c841611fb97bf5e47b190408Relay Message9908642023-03-27 23:32:282 days 14 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x3d84f0506706098ec2c38aaeb8cbf248d569862ca268d4b55810735e84e44aa1Relay Message9906662023-03-27 21:30:502 days 16 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x04a7cd8f486b2f6e0606af415315d7b32e63abf32d3a5a4b631ec757b6c04d8dRelay Message9906052023-03-27 21:04:312 days 17 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x3f9a78a037b2d6f2349d57bd273da898f1d77fb880ab9aa094c4a91e9ffaaaf2Relay Message9904192023-03-27 18:56:102 days 19 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x9cd7fa61f4ab2f4d7588af93d08d7f9bfb73ac2532a63ddce55a6a9da8c0adc7Relay Message9903982023-03-27 18:49:172 days 19 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x6c49ed7508c2d098c2a61245993a7947722d5243fc278bce3fa60776bf2e80d3Relay Message9902002023-03-27 16:01:532 days 22 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x168d06082dbb2132a7e3a39429566c22eb3784d89e59546988ed3406672c3577Relay Message9893892023-03-26 20:58:523 days 17 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0xa8088ddfdde4a51ae4a1f8d142171151850d7669b72e2c679ba6700995bc07cdRelay Message9892842023-03-26 18:46:133 days 19 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
0x956c884fccec3ec3e58df54bebb44f18877e7905395b533fd9f71418be3f74f5Relay Message9892602023-03-26 17:59:533 days 20 hrs ago0x0000000000000000000000000000000000000000 IN Boba Network: L2 Cross Domain Messenger0 Ether00
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xf4ae73bb4465c90f8db38e9bcf76a23af642af7dd90502979fbfb7b79c03fe179936082023-03-30 11:57:192 hrs 24 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0xf4ae73bb4465c90f8db38e9bcf76a23af642af7dd90502979fbfb7b79c03fe179936082023-03-30 11:57:192 hrs 24 mins ago Boba Network: Proxy L2 Liquidity PoolBoba Network: L2 Cross Domain Messenger0 Ether
0x2565fb44cde6bb72c594dd1c0f2c4a23f84180818931821bdda26f6c68b5c3cd9935912023-03-30 11:42:022 hrs 39 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0x2565fb44cde6bb72c594dd1c0f2c4a23f84180818931821bdda26f6c68b5c3cd9935912023-03-30 11:42:022 hrs 39 mins ago Boba Network: Proxy L2 Liquidity PoolBoba Network: L2 Cross Domain Messenger0 Ether
0x317468f579dd510a261b41a24f4e89350880edea65abdd24f254fd261397e7209935632023-03-30 10:54:013 hrs 27 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0x317468f579dd510a261b41a24f4e89350880edea65abdd24f254fd261397e7209935632023-03-30 10:54:013 hrs 27 mins ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0xfe72fda0b6769e57c8b4919ded8714d2e9e2f008ce7462d7272b2a597c79ab1a9930122023-03-30 1:16:4213 hrs 4 mins ago Boba Network: Proxy L2 Liquidity PoolBoba Network: L2 Cross Domain Messenger0 Ether
0xfe72fda0b6769e57c8b4919ded8714d2e9e2f008ce7462d7272b2a597c79ab1a9930122023-03-30 1:16:4213 hrs 4 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: Proxy L2 Liquidity Pool0 Ether
0x2bc92a8f985f633aa767abb5fd9b188e677f654c8b8882830de10181f8f842b19929522023-03-29 23:53:1814 hrs 28 mins ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0x2bc92a8f985f633aa767abb5fd9b188e677f654c8b8882830de10181f8f842b19929522023-03-29 23:53:1814 hrs 28 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: L2 Standard Bridge0 Ether
0x1f0d1945e3922ce000b320b4cd4778be7a0996db11b0efa4bed20f80909ada259929382023-03-29 23:08:2415 hrs 12 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0x1f0d1945e3922ce000b320b4cd4778be7a0996db11b0efa4bed20f80909ada259929382023-03-29 23:08:2415 hrs 12 mins ago Boba Network: Proxy L2 Liquidity PoolBoba Network: L2 Cross Domain Messenger0 Ether
0xde540f134f0125e5b22ebf740be54b919fdfb8f2e57b5fdcc189e08b626e57689927342023-03-29 16:01:5122 hrs 19 mins ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0xde540f134f0125e5b22ebf740be54b919fdfb8f2e57b5fdcc189e08b626e57689927342023-03-29 16:01:5122 hrs 19 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: L2 Standard Bridge0 Ether
0x3d2e4929e7c260206ba87e58a6687fa399ff83d9e94e9d5e3945ea643986a62f9927222023-03-29 15:53:3822 hrs 27 mins ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0x3d2e4929e7c260206ba87e58a6687fa399ff83d9e94e9d5e3945ea643986a62f9927222023-03-29 15:53:3822 hrs 27 mins ago Boba Network: L2 Cross Domain MessengerBoba Network: L2 Standard Bridge0 Ether
0x4435fcd8a300cb493ffb7df608ad3162d455031ec7c71093d9fe60f40f537cd19925342023-03-29 10:15:511 day 4 hrs ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0x4435fcd8a300cb493ffb7df608ad3162d455031ec7c71093d9fe60f40f537cd19925342023-03-29 10:15:511 day 4 hrs ago Boba Network: L2 Cross Domain MessengerBoba Network: L2 Standard Bridge0 Ether
0x001850f1c18ce3bdf6b2317b71921b87161ebf701778591e6e9b3dfb0f2275499925162023-03-29 9:22:281 day 4 hrs ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0x001850f1c18ce3bdf6b2317b71921b87161ebf701778591e6e9b3dfb0f2275499925162023-03-29 9:22:281 day 4 hrs ago Boba Network: Proxy L2 Liquidity PoolBoba Network: L2 Cross Domain Messenger0 Ether
0xc2890fbba36f5c3f3c162edd894a9aae5435d0bceb02fc3faaa907ad4246a9929924552023-03-29 7:49:521 day 6 hrs ago Boba Network: L2 Cross Domain MessengerBoba Network: OVM L2 To L1 Message Passer0 Ether
0xc2890fbba36f5c3f3c162edd894a9aae5435d0bceb02fc3faaa907ad4246a9929924552023-03-29 7:49:521 day 6 hrs ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0xe28b3add7155220185b8660faf77b39c6b512ac01be8e898c7c31233972c354c9922582023-03-29 4:10:141 day 10 hrs ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
0xe28b3add7155220185b8660faf77b39c6b512ac01be8e898c7c31233972c354c9922582023-03-29 4:10:141 day 10 hrs ago Boba Network: L2 Cross Domain MessengerBoba Network: L2 Standard Bridge0 Ether
0x14caf446e5f4dc6ac1a0ac3056ec43c7f335b045e8cd632ba7a1551f332a32a79919892023-03-28 20:13:531 day 18 hrs ago Boba Network: L2 Standard BridgeBoba Network: L2 Cross Domain Messenger0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Genesis Bytecode Match Only)

Contract Name:
L2CrossDomainMessenger

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at bobascan.com on 2022-12-08
*/

// File: packages/contracts/contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol


pragma solidity ^0.8.9;

/**
 * @title iOVM_L2ToL1MessagePasser
 */
interface iOVM_L2ToL1MessagePasser {
    /**********
     * Events *
     **********/

    event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);

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

    function passMessageToL1(bytes calldata _message) external;
}

// File: packages/contracts/contracts/libraries/bridge/ICrossDomainMessenger.sol


pragma solidity >0.5.0 <0.9.0;

/**
 * @title ICrossDomainMessenger
 */
interface ICrossDomainMessenger {
    /**********
     * Events *
     **********/

    event SentMessage(
        address indexed target,
        address sender,
        bytes message,
        uint256 messageNonce,
        uint256 gasLimit
    );
    event RelayedMessage(bytes32 indexed msgHash);
    event FailedRelayedMessage(bytes32 indexed msgHash);

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

    function xDomainMessageSender() external view returns (address);

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

    /**
     * Sends a cross domain message to the target messenger.
     * @param _target Target contract address.
     * @param _message Message to send to the target.
     * @param _gasLimit Gas limit for the provided message.
     */
    function sendMessage(
        address _target,
        bytes calldata _message,
        uint32 _gasLimit
    ) external;
}

// File: packages/contracts/contracts/L2/messaging/IL2CrossDomainMessenger.sol


pragma solidity ^0.8.9;

/* Interface Imports */


/**
 * @title IL2CrossDomainMessenger
 */
interface IL2CrossDomainMessenger is ICrossDomainMessenger {
    /********************
     * Public Functions *
     ********************/

    /**
     * Relays a cross domain message to a contract.
     * @param _target Target contract address.
     * @param _sender Message sender address.
     * @param _message Message to send to the target.
     * @param _messageNonce Nonce for the provided message.
     */
    function relayMessage(
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    ) external;
}

// File: packages/contracts/contracts/libraries/constants/Lib_PredeployAddresses.sol


pragma solidity ^0.8.9;

/**
 * @title Lib_PredeployAddresses
 */
library Lib_PredeployAddresses {
    // solhint-disable max-line-length
    address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;
    address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;
    address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;
    address payable internal constant OVM_ETH = payable(0x4200000000000000000000000000000000000006);
    // solhint-disable-next-line max-line-length
    address internal constant L2_CROSS_DOMAIN_MESSENGER =
        0x4200000000000000000000000000000000000007;
    address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;
    address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;
    address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
    address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;
    address internal constant L2_STANDARD_TOKEN_FACTORY =
        0x4200000000000000000000000000000000000012;
    address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;
    address internal constant OVM_GAS_PRICE_ORACLE = 0x420000000000000000000000000000000000000F;
    address internal constant PROXY__BOBA_TURING_PREPAY =
        0x4200000000000000000000000000000000000020;
    address internal constant BOBA_TURING_PREPAY = 0x4200000000000000000000000000000000000021;
    address internal constant BOBA_TURING_HELPER = 0x4200000000000000000000000000000000000022;
}

// File: packages/contracts/contracts/libraries/constants/Lib_DefaultValues.sol


pragma solidity ^0.8.9;

/**
 * @title Lib_DefaultValues
 */
library Lib_DefaultValues {
    // The default x-domain message sender being set to a non-zero value makes
    // deployment a bit more expensive, but in exchange the refund on every call to
    // `relayMessage` by the L1 and L2 messengers will be higher.
    address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;
}

// File: packages/contracts/contracts/libraries/rlp/Lib_RLPReader.sol


pragma solidity ^0.8.9;

/**
 * @title Lib_RLPReader
 * @dev Adapted from "RLPReader" by Hamdi Allam ([email protected]).
 */
library Lib_RLPReader {
    /*************
     * Constants *
     *************/

    uint256 internal constant MAX_LIST_LENGTH = 32;

    /*********
     * Enums *
     *********/

    enum RLPItemType {
        DATA_ITEM,
        LIST_ITEM
    }

    /***********
     * Structs *
     ***********/

    struct RLPItem {
        uint256 length;
        uint256 ptr;
    }

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

    /**
     * Converts bytes to a reference to memory position and length.
     * @param _in Input bytes to convert.
     * @return Output memory reference.
     */
    function toRLPItem(bytes memory _in) internal pure returns (RLPItem memory) {
        uint256 ptr;
        assembly {
            ptr := add(_in, 32)
        }

        return RLPItem({ length: _in.length, ptr: ptr });
    }

    /**
     * Reads an RLP list value into a list of RLP items.
     * @param _in RLP list value.
     * @return Decoded RLP list items.
     */
    function readList(RLPItem memory _in) internal pure returns (RLPItem[] memory) {
        (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.LIST_ITEM, "Invalid RLP list value.");

        // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by
        // writing to the length. Since we can't know the number of RLP items without looping over
        // the entire input, we'd have to loop twice to accurately size this array. It's easier to
        // simply set a reasonable maximum list length and decrease the size before we finish.
        RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);

        uint256 itemCount = 0;
        uint256 offset = listOffset;
        while (offset < _in.length) {
            require(itemCount < MAX_LIST_LENGTH, "Provided RLP list exceeds max list length.");

            (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(
                RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })
            );

            out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });

            itemCount += 1;
            offset += itemOffset + itemLength;
        }

        // Decrease the array size to match the actual item count.
        assembly {
            mstore(out, itemCount)
        }

        return out;
    }

    /**
     * Reads an RLP list value into a list of RLP items.
     * @param _in RLP list value.
     * @return Decoded RLP list items.
     */
    function readList(bytes memory _in) internal pure returns (RLPItem[] memory) {
        return readList(toRLPItem(_in));
    }

    /**
     * Reads an RLP bytes value into bytes.
     * @param _in RLP bytes value.
     * @return Decoded bytes.
     */
    function readBytes(RLPItem memory _in) internal pure returns (bytes memory) {
        (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes value.");

        return _copy(_in.ptr, itemOffset, itemLength);
    }

    /**
     * Reads an RLP bytes value into bytes.
     * @param _in RLP bytes value.
     * @return Decoded bytes.
     */
    function readBytes(bytes memory _in) internal pure returns (bytes memory) {
        return readBytes(toRLPItem(_in));
    }

    /**
     * Reads an RLP string value into a string.
     * @param _in RLP string value.
     * @return Decoded string.
     */
    function readString(RLPItem memory _in) internal pure returns (string memory) {
        return string(readBytes(_in));
    }

    /**
     * Reads an RLP string value into a string.
     * @param _in RLP string value.
     * @return Decoded string.
     */
    function readString(bytes memory _in) internal pure returns (string memory) {
        return readString(toRLPItem(_in));
    }

    /**
     * Reads an RLP bytes32 value into a bytes32.
     * @param _in RLP bytes32 value.
     * @return Decoded bytes32.
     */
    function readBytes32(RLPItem memory _in) internal pure returns (bytes32) {
        require(_in.length <= 33, "Invalid RLP bytes32 value.");

        (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes32 value.");

        uint256 ptr = _in.ptr + itemOffset;
        bytes32 out;
        assembly {
            out := mload(ptr)

            // Shift the bytes over to match the item size.
            if lt(itemLength, 32) {
                out := div(out, exp(256, sub(32, itemLength)))
            }
        }

        return out;
    }

    /**
     * Reads an RLP bytes32 value into a bytes32.
     * @param _in RLP bytes32 value.
     * @return Decoded bytes32.
     */
    function readBytes32(bytes memory _in) internal pure returns (bytes32) {
        return readBytes32(toRLPItem(_in));
    }

    /**
     * Reads an RLP uint256 value into a uint256.
     * @param _in RLP uint256 value.
     * @return Decoded uint256.
     */
    function readUint256(RLPItem memory _in) internal pure returns (uint256) {
        return uint256(readBytes32(_in));
    }

    /**
     * Reads an RLP uint256 value into a uint256.
     * @param _in RLP uint256 value.
     * @return Decoded uint256.
     */
    function readUint256(bytes memory _in) internal pure returns (uint256) {
        return readUint256(toRLPItem(_in));
    }

    /**
     * Reads an RLP bool value into a bool.
     * @param _in RLP bool value.
     * @return Decoded bool.
     */
    function readBool(RLPItem memory _in) internal pure returns (bool) {
        require(_in.length == 1, "Invalid RLP boolean value.");

        uint256 ptr = _in.ptr;
        uint256 out;
        assembly {
            out := byte(0, mload(ptr))
        }

        require(out == 0 || out == 1, "Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1");

        return out != 0;
    }

    /**
     * Reads an RLP bool value into a bool.
     * @param _in RLP bool value.
     * @return Decoded bool.
     */
    function readBool(bytes memory _in) internal pure returns (bool) {
        return readBool(toRLPItem(_in));
    }

    /**
     * Reads an RLP address value into a address.
     * @param _in RLP address value.
     * @return Decoded address.
     */
    function readAddress(RLPItem memory _in) internal pure returns (address) {
        if (_in.length == 1) {
            return address(0);
        }

        require(_in.length == 21, "Invalid RLP address value.");

        return address(uint160(readUint256(_in)));
    }

    /**
     * Reads an RLP address value into a address.
     * @param _in RLP address value.
     * @return Decoded address.
     */
    function readAddress(bytes memory _in) internal pure returns (address) {
        return readAddress(toRLPItem(_in));
    }

    /**
     * Reads the raw bytes of an RLP item.
     * @param _in RLP item to read.
     * @return Raw RLP bytes.
     */
    function readRawBytes(RLPItem memory _in) internal pure returns (bytes memory) {
        return _copy(_in);
    }

    /*********************
     * Private Functions *
     *********************/

    /**
     * Decodes the length of an RLP item.
     * @param _in RLP item to decode.
     * @return Offset of the encoded data.
     * @return Length of the encoded data.
     * @return RLP item type (LIST_ITEM or DATA_ITEM).
     */
    function _decodeLength(RLPItem memory _in)
        private
        pure
        returns (
            uint256,
            uint256,
            RLPItemType
        )
    {
        require(_in.length > 0, "RLP item cannot be null.");

        uint256 ptr = _in.ptr;
        uint256 prefix;
        assembly {
            prefix := byte(0, mload(ptr))
        }

        if (prefix <= 0x7f) {
            // Single byte.

            return (0, 1, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xb7) {
            // Short string.

            uint256 strLen = prefix - 0x80;

            require(_in.length > strLen, "Invalid RLP short string.");

            return (1, strLen, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xbf) {
            // Long string.
            uint256 lenOfStrLen = prefix - 0xb7;

            require(_in.length > lenOfStrLen, "Invalid RLP long string length.");

            uint256 strLen;
            assembly {
                // Pick out the string length.
                strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))
            }

            require(_in.length > lenOfStrLen + strLen, "Invalid RLP long string.");

            return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xf7) {
            // Short list.
            uint256 listLen = prefix - 0xc0;

            require(_in.length > listLen, "Invalid RLP short list.");

            return (1, listLen, RLPItemType.LIST_ITEM);
        } else {
            // Long list.
            uint256 lenOfListLen = prefix - 0xf7;

            require(_in.length > lenOfListLen, "Invalid RLP long list length.");

            uint256 listLen;
            assembly {
                // Pick out the list length.
                listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))
            }

            require(_in.length > lenOfListLen + listLen, "Invalid RLP long list.");

            return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);
        }
    }

    /**
     * Copies the bytes from a memory location.
     * @param _src Pointer to the location to read from.
     * @param _offset Offset to start reading from.
     * @param _length Number of bytes to read.
     * @return Copied bytes.
     */
    function _copy(
        uint256 _src,
        uint256 _offset,
        uint256 _length
    ) private pure returns (bytes memory) {
        bytes memory out = new bytes(_length);
        if (out.length == 0) {
            return out;
        }

        uint256 src = _src + _offset;
        uint256 dest;
        assembly {
            dest := add(out, 32)
        }

        // Copy over as many complete words as we can.
        for (uint256 i = 0; i < _length / 32; i++) {
            assembly {
                mstore(dest, mload(src))
            }

            src += 32;
            dest += 32;
        }

        // Pick out the remaining bytes.
        uint256 mask;
        unchecked {
            mask = 256**(32 - (_length % 32)) - 1;
        }

        assembly {
            mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))
        }
        return out;
    }

    /**
     * Copies an RLP item into bytes.
     * @param _in RLP item to copy.
     * @return Copied bytes.
     */
    function _copy(RLPItem memory _in) private pure returns (bytes memory) {
        return _copy(_in.ptr, 0, _in.length);
    }
}

// File: packages/contracts/contracts/libraries/bridge/Lib_CrossDomainUtils.sol


pragma solidity ^0.8.9;

/* Library Imports */


/**
 * @title Lib_CrossDomainUtils
 */
library Lib_CrossDomainUtils {
    /**
     * Generates the correct cross domain calldata for a message.
     * @param _target Target contract address.
     * @param _sender Message sender address.
     * @param _message Message to send to the target.
     * @param _messageNonce Nonce for the provided message.
     * @return ABI encoded cross domain calldata.
     */
    function encodeXDomainCalldata(
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    ) internal pure returns (bytes memory) {
        return
            abi.encodeWithSignature(
                "relayMessage(address,address,bytes,uint256)",
                _target,
                _sender,
                _message,
                _messageNonce
            );
    }
}

// File: packages/contracts/contracts/standards/AddressAliasHelper.sol



/*
 * Copyright 2019-2021, Offchain Labs, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

pragma solidity ^0.8.7;

library AddressAliasHelper {
    uint160 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: packages/contracts/contracts/L2/messaging/L2CrossDomainMessenger.sol


pragma solidity ^0.8.9;

/* Library Imports */





/* Interface Imports */



/**
 * @title L2CrossDomainMessenger
 * @dev The L2 Cross Domain Messenger contract sends messages from L2 to L1, and is the entry point
 * for L2 messages sent via the L1 Cross Domain Messenger.
 *
 */
contract L2CrossDomainMessenger is IL2CrossDomainMessenger {
    /*************
     * Variables *
     *************/

    mapping(bytes32 => bool) public relayedMessages;
    mapping(bytes32 => bool) public successfulMessages;
    mapping(bytes32 => bool) public sentMessages;
    uint256 public messageNonce;
    address internal xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;
    address public l1CrossDomainMessenger;

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

    constructor(address _l1CrossDomainMessenger) {
        l1CrossDomainMessenger = _l1CrossDomainMessenger;
    }

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

    function xDomainMessageSender() public view returns (address) {
        require(
            xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,
            "xDomainMessageSender is not set"
        );
        return xDomainMsgSender;
    }

    /**
     * Sends a cross domain message to the target messenger.
     * @param _target Target contract address.
     * @param _message Message to send to the target.
     * @param _gasLimit Gas limit for the provided message.
     */
    function sendMessage(
        address _target,
        bytes memory _message,
        uint32 _gasLimit
    ) public {
        bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(
            _target,
            msg.sender,
            _message,
            messageNonce
        );

        sentMessages[keccak256(xDomainCalldata)] = true;

        // Actually send the message.
        iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(
            xDomainCalldata
        );

        // Emit an event before we bump the nonce or the nonce will be off by one.
        emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);
        messageNonce += 1;
    }

    /**
     * Relays a cross domain message to a contract.
     * @inheritdoc IL2CrossDomainMessenger
     */
    function relayMessage(
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    ) public {
        require(
            AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,
            "Provided message could not be verified."
        );

        bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(
            _target,
            _sender,
            _message,
            _messageNonce
        );

        bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);

        require(
            successfulMessages[xDomainCalldataHash] == false,
            "Provided message has already been received."
        );

        // Prevent calls to OVM_L2ToL1MessagePasser, which would enable
        // an attacker to maliciously craft the _message to spoof
        // a call from any L2 account.
        if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {
            // Write to the successfulMessages mapping and return immediately.
            successfulMessages[xDomainCalldataHash] = true;
            return;
        }

        xDomainMsgSender = _sender;
        (bool success, ) = _target.call(_message);
        xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;

        // Mark the message as received if the call was successful. Ensures that a message can be
        // relayed multiple times in the case that the call reverted.
        if (success == true) {
            successfulMessages[xDomainCalldataHash] = true;
            emit RelayedMessage(xDomainCalldataHash);
        } else {
            emit FailedRelayedMessage(xDomainCalldataHash);
        }

        // Store an identifier that can be used to prove that the given message was relayed by some
        // user. Gives us an easy way to pay relayers for their work.
        bytes32 relayId = keccak256(abi.encodePacked(xDomainCalldata, msg.sender, block.number));

        relayedMessages[relayId] = true;
    }
}

Contract Security Audit

Contract ABI

[{"inputs": [{"internalType": "address","name": "_l1CrossDomainMessenger","type": "address"}],"stateMutability": "nonpayable","type": "constructor"},{"anonymous": false,"inputs": [{"indexed": true,"internalType": "bytes32","name": "msgHash","type": "bytes32"}],"name": "FailedRelayedMessage","type": "event"},{"anonymous": false,"inputs": [{"indexed": true,"internalType": "bytes32","name": "msgHash","type": "bytes32"}],"name": "RelayedMessage","type": "event"},{"anonymous": false,"inputs": [{"indexed": true,"internalType": "address","name": "target","type": "address"},{"indexed": false,"internalType": "address","name": "sender","type": "address"},{"indexed": false,"internalType": "bytes","name": "message","type": "bytes"},{"indexed": false,"internalType": "uint256","name": "messageNonce","type": "uint256"},{"indexed": false,"internalType": "uint256","name": "gasLimit","type": "uint256"}],"name": "SentMessage","type": "event"},{"inputs": [],"name": "l1CrossDomainMessenger","outputs": [{"internalType": "address","name": "","type": "address"}],"stateMutability": "view","type": "function"},{"inputs": [],"name": "messageNonce","outputs": [{"internalType": "uint256","name": "","type": "uint256"}],"stateMutability": "view","type": "function"},{"inputs": [{"internalType": "address","name": "_target","type": "address"},{"internalType": "address","name": "_sender","type": "address"},{"internalType": "bytes","name": "_message","type": "bytes"},{"internalType": "uint256","name": "_messageNonce","type": "uint256"}],"name": "relayMessage","outputs": [],"stateMutability": "nonpayable","type": "function"},{"inputs": [{"internalType": "bytes32","name": "","type": "bytes32"}],"name": "relayedMessages","outputs": [{"internalType": "bool","name": "","type": "bool"}],"stateMutability": "view","type": "function"},{"inputs": [{"internalType": "address","name": "_target","type": "address"},{"internalType": "bytes","name": "_message","type": "bytes"},{"internalType": "uint32","name": "_gasLimit","type": "uint32"}],"name": "sendMessage","outputs": [],"stateMutability": "nonpayable","type": "function"},{"inputs": [{"internalType": "bytes32","name": "","type": "bytes32"}],"name": "sentMessages","outputs": [{"internalType": "bool","name": "","type": "bool"}],"stateMutability": "view","type": "function"},{"inputs": [{"internalType": "bytes32","name": "","type": "bytes32"}],"name": "successfulMessages","outputs": [{"internalType": "bool","name": "","type": "bool"}],"stateMutability": "view","type": "function"},{"inputs": [],"name": "xDomainMessageSender","outputs": [{"internalType": "address","name": "","type": "address"}],"stateMutability": "view","type": "function"}]

608060405234801561001057600080fd5b50600436106100885760003560e01c8063a71198691161005b578063a71198691461012a578063b1b1b2091461014a578063cbd4ece91461016d578063ecc704281461018057600080fd5b806321d800ec1461008d5780633dbb202b146100c55780636e296e45146100da57806382e3702d14610107575b600080fd5b6100b061009b366004610826565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100d86100d3366004610942565b610197565b005b6100e26102e2565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bc565b6100b0610115366004610826565b60026020526000908152604090205460ff1681565b6005546100e29073ffffffffffffffffffffffffffffffffffffffff1681565b6100b0610158366004610826565b60016020526000908152604090205460ff1681565b6100d861017b3660046109ad565b61038b565b61018960035481565b6040519081526020016100bc565b60006101a784338560035461078d565b80516020808301919091206000908152600290915260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fcafa81dc0000000000000000000000000000000000000000000000000000000081529091507342000000000000000000000000000000000000009063cafa81dc9061023c908490600401610a89565b600060405180830381600087803b15801561025657600080fd5b505af115801561026a573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a3385600354866040516102bc9493929190610aa3565b60405180910390a26001600360008282546102d79190610aef565b909155505050505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff1661dead141561036e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f74207365740060448201526064015b60405180910390fd5b5060045473ffffffffffffffffffffffffffffffffffffffff1690565b60055473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff161461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610365565b60006104788585858561078d565b8051602080830191909120600081815260019092526040909120549192509060ff1615610527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610365565b73ffffffffffffffffffffffffffffffffffffffff8616734200000000000000000000000000000000000000141561059957600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909117905550610787565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff878116919091179091556040516000918816906105f2908790610b2e565b6000604051808303816000865af19150503d806000811461062f576040519150601f19603f3d011682016040523d82523d6000602084013e610634565b606091505b5050600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead1790559050801515600114156106d557600082815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2610701565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161071893929190610b4a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120600090815291829052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050505b50505050565b6060848484846040516024016107a69493929190610b9c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b60006020828403121561083857600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086357600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126108a857600080fd5b813567ffffffffffffffff808211156108c3576108c3610868565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561090957610909610868565b8160405283815286602085880101111561092257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561095757600080fd5b6109608461083f565b9250602084013567ffffffffffffffff81111561097c57600080fd5b61098886828701610897565b925050604084013563ffffffff811681146109a257600080fd5b809150509250925092565b600080600080608085870312156109c357600080fd5b6109cc8561083f565b93506109da6020860161083f565b9250604085013567ffffffffffffffff8111156109f657600080fd5b610a0287828801610897565b949793965093946060013593505050565b60005b83811015610a2e578181015183820152602001610a16565b838111156107875750506000910152565b60008151808452610a57816020860160208601610a13565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610a9c6020830184610a3f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610ad26080830186610a3f565b905083604083015263ffffffff8316606083015295945050505050565b60008219821115610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b60008251610b40818460208701610a13565b9190910192915050565b60008451610b5c818460208901610a13565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610bd56080830185610a3f565b90508260608301529594505050505056fea164736f6c6343000809000a

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.