Contract 0x4200000000000000000000000000000000000007 5

 

Contract Overview

Balance:
0 Ether

EtherValue:
$0.00
Txn Hash Method
Index
From
To
Value
0x7f6e6dc62522e52c80fd509ecd56b80e818a887b9b8dfcecd6cb59038c43db7cRelay Message138514882022-07-04 23:24:2635 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0002389415010
0x103f2dbf659edbfe9a1d287cdc39752a519f61a87dd223accb2833c784c81b86Relay Message138501702022-07-04 22:59:071 hr agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000898956930
0x548e3e9c93b5913ebb87fe567af4422f8b91653533a106baa1313383cc83689eRelay Message138501412022-07-04 22:58:211 hr 1 min agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001299340140
0x9bdb0df98ba44a833c69bedb5311419307b60d16cebcbf3280312964b7453826Relay Message138500442022-07-04 22:56:241 hr 3 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001361442090
0x2d36596f1913370b2da75446b12baf5edaaeaf05b9677c1703d661fd286cf60dRelay Message138500192022-07-04 22:55:341 hr 4 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001339632150
0x978099953dbe0b135398126794bdcc0f22a7588b81bf36dc7d9b1db663dcd5d0Relay Message138499262022-07-04 22:54:211 hr 5 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001187221750
0x7df21914ea971942ecb9d4dbd34be00b81c4db7b592509da9de60b98df3c3b71Relay Message138493852022-07-04 22:44:071 hr 15 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001081350390
0xc69074c9c716c9ee26baccd6354162c592706d76b64ed02206bbe0f68586d041Relay Message138489582022-07-04 22:37:581 hr 21 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000765183830
0x96fa89dec77b4c978b0c34c15efa12733da717f31aec04d16888c290a069705dRelay Message138481272022-07-04 22:26:011 hr 33 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001182120870
0xd2676e2ca53d0a791bf625923a6aa7c2a585c89ff59621155272bcde69a260edRelay Message138477192022-07-04 22:15:481 hr 44 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001059844430
0x36d93e3e0a5c7406507894e7a4e1420c737d863cd4deeac7594a6f086f099dcaRelay Message138476422022-07-04 22:12:111 hr 47 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001104456520
0x5eb415896c3dde93a5e92ddc9aaadb19a7916efd756cb894dbda94e4e9592207Relay Message138476402022-07-04 22:11:461 hr 48 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001280758460
0x98bb03a92d922178cd8b1d373a2b50012a82825e331612ffe4beb359a040566eRelay Message138463812022-07-04 21:47:142 hrs 12 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000788371940
0xb0fe9a52397348aafbd24ddb7ecae949cf459e69df74587cdc9e146e0b1c72c0Relay Message138451822022-07-04 21:20:572 hrs 38 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001278282010
0x69076978beb0a0f36a3c1a1a9c9ce812eb1b69d359d996a7c3061e80e2a7a190Relay Message138451462022-07-04 21:19:302 hrs 40 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000953805250
0x7f67596c39d7655f7259c1c0a38febb03679572f8479799bc263cef47e5591fcRelay Message138447722022-07-04 21:07:512 hrs 52 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001292132980
0xc4a8cf4f946ded9f900ead220f686b37277ab47d9e2527d041e385ae46d8285cRelay Message138441282022-07-04 20:44:233 hrs 15 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001736879620
0x8b23fe761d9188847e4c304d67f888555639c53152c1734b7b0c5697d6a81853Relay Message138439212022-07-04 20:35:473 hrs 24 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.000087763620
0x1b05dedc54d24389727356b9258e92343d40a427ee90d22d12be7260a0a62dbcRelay Message138437672022-07-04 20:30:473 hrs 29 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000845985140
0xb97e89431046e07d089883596ac7424afa80336f245badf4da8320867617aa76Relay Message138429522022-07-04 20:07:513 hrs 52 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001236469020
0xe6964d73698979a67d9e4379d5815f7fb2c8bf84be6a8169e8141434b10eab19Relay Message138424042022-07-04 19:52:304 hrs 7 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether00
0x3d34a07ec3910fc8e54328e484d52ce351ead221dde8f0c95ef649025080a0fdRelay Message138422772022-07-04 19:47:444 hrs 12 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000907566860
0x02d17c1b39b6bb1df18e3eaf4b0ef08fdb17dd88cf99427ae347c389384eab88Relay Message138419302022-07-04 19:36:194 hrs 23 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0000862684840
0xf55327f097e59414a4492bbfc8a4b5a991e81a132d6558b892a2e21ef6f67c78Relay Message138418282022-07-04 19:31:534 hrs 28 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.0001465171320
0xc27f24dde86e430ac4207666e832e605898860a662a7284d2acbbe8897bec232Relay Message138418172022-07-04 19:31:194 hrs 28 mins agoNull Address: 0x000…000 IN 0x42000000000000000000000000000000000000070 Ether0.000141519240
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x76dffe8a6df73b31d16fb15aadcfc62d6cd0420b37e5d859bd4f963362215e50138530532022-07-04 23:53:406 mins ago 0x42000000000000000000000000000000000000070x42000000000000000000000000000000000000000 Ether
0x76dffe8a6df73b31d16fb15aadcfc62d6cd0420b37e5d859bd4f963362215e50138530532022-07-04 23:53:406 mins ago Optimism Bridge0x42000000000000000000000000000000000000070 Ether
0x7f6e6dc62522e52c80fd509ecd56b80e818a887b9b8dfcecd6cb59038c43db7c138514882022-07-04 23:24:2635 mins ago 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0x42000000000000000000000000000000000000070 Ether
0x7f6e6dc62522e52c80fd509ecd56b80e818a887b9b8dfcecd6cb59038c43db7c138514882022-07-04 23:24:2635 mins ago 0x4200000000000000000000000000000000000007 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0 Ether
0xcafe82ca8128f71a0f76e443ea7fa54cd6ce0b4171ed21f306acafb6c20b2c66138510272022-07-04 23:17:5142 mins ago 0x42000000000000000000000000000000000000070x42000000000000000000000000000000000000000 Ether
0xcafe82ca8128f71a0f76e443ea7fa54cd6ce0b4171ed21f306acafb6c20b2c66138510272022-07-04 23:17:5142 mins ago Optimism Bridge0x42000000000000000000000000000000000000070 Ether
0x103f2dbf659edbfe9a1d287cdc39752a519f61a87dd223accb2833c784c81b86138501702022-07-04 22:59:071 hr ago 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0x42000000000000000000000000000000000000070 Ether
0x103f2dbf659edbfe9a1d287cdc39752a519f61a87dd223accb2833c784c81b86138501702022-07-04 22:59:071 hr ago 0x4200000000000000000000000000000000000007 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0 Ether
0x548e3e9c93b5913ebb87fe567af4422f8b91653533a106baa1313383cc83689e138501412022-07-04 22:58:211 hr 1 min ago 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0x42000000000000000000000000000000000000070 Ether
0x548e3e9c93b5913ebb87fe567af4422f8b91653533a106baa1313383cc83689e138501412022-07-04 22:58:211 hr 1 min ago 0x4200000000000000000000000000000000000007 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0 Ether
0x9bdb0df98ba44a833c69bedb5311419307b60d16cebcbf3280312964b7453826138500442022-07-04 22:56:241 hr 3 mins ago 0x136b1ec699c62b0606854056f02dc7bb80482d630x42000000000000000000000000000000000000070 Ether
0x9bdb0df98ba44a833c69bedb5311419307b60d16cebcbf3280312964b7453826138500442022-07-04 22:56:241 hr 3 mins ago 0x4200000000000000000000000000000000000007 0x136b1ec699c62b0606854056f02dc7bb80482d630 Ether
0x2d36596f1913370b2da75446b12baf5edaaeaf05b9677c1703d661fd286cf60d138500192022-07-04 22:55:341 hr 4 mins ago 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0x42000000000000000000000000000000000000070 Ether
0x2d36596f1913370b2da75446b12baf5edaaeaf05b9677c1703d661fd286cf60d138500192022-07-04 22:55:341 hr 4 mins ago 0x4200000000000000000000000000000000000007 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0 Ether
0x978099953dbe0b135398126794bdcc0f22a7588b81bf36dc7d9b1db663dcd5d0138499262022-07-04 22:54:211 hr 5 mins ago 0x136b1ec699c62b0606854056f02dc7bb80482d630x42000000000000000000000000000000000000070 Ether
0x978099953dbe0b135398126794bdcc0f22a7588b81bf36dc7d9b1db663dcd5d0138499262022-07-04 22:54:211 hr 5 mins ago 0x4200000000000000000000000000000000000007 0x136b1ec699c62b0606854056f02dc7bb80482d630 Ether
0x7df21914ea971942ecb9d4dbd34be00b81c4db7b592509da9de60b98df3c3b71138493852022-07-04 22:44:071 hr 15 mins ago Optimism Bridge0x42000000000000000000000000000000000000070 Ether
0x7df21914ea971942ecb9d4dbd34be00b81c4db7b592509da9de60b98df3c3b71138493852022-07-04 22:44:071 hr 15 mins ago 0x4200000000000000000000000000000000000007Optimism Bridge0 Ether
0xc69074c9c716c9ee26baccd6354162c592706d76b64ed02206bbe0f68586d041138489582022-07-04 22:37:581 hr 21 mins ago Optimism Bridge0x42000000000000000000000000000000000000070 Ether
0xc69074c9c716c9ee26baccd6354162c592706d76b64ed02206bbe0f68586d041138489582022-07-04 22:37:581 hr 21 mins ago 0x4200000000000000000000000000000000000007Optimism Bridge0 Ether
0x96fa89dec77b4c978b0c34c15efa12733da717f31aec04d16888c290a069705d138481272022-07-04 22:26:011 hr 33 mins ago Optimism Bridge0x42000000000000000000000000000000000000070 Ether
0x96fa89dec77b4c978b0c34c15efa12733da717f31aec04d16888c290a069705d138481272022-07-04 22:26:011 hr 33 mins ago 0x4200000000000000000000000000000000000007Optimism Bridge0 Ether
0xd2676e2ca53d0a791bf625923a6aa7c2a585c89ff59621155272bcde69a260ed138477192022-07-04 22:15:481 hr 44 mins ago 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0x42000000000000000000000000000000000000070 Ether
0xd2676e2ca53d0a791bf625923a6aa7c2a585c89ff59621155272bcde69a260ed138477192022-07-04 22:15:481 hr 44 mins ago 0x4200000000000000000000000000000000000007 0x83f6244bd87662118d96d9a6d44f09dfff14b30e0 Ether
0x36d93e3e0a5c7406507894e7a4e1420c737d863cd4deeac7594a6f086f099dca138476422022-07-04 22:12:111 hr 47 mins ago 0x136b1ec699c62b0606854056f02dc7bb80482d630x42000000000000000000000000000000000000070 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
File 1 of 9 : L2CrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import { AddressAliasHelper } from "../../standards/AddressAliasHelper.sol";
import { Lib_CrossDomainUtils } from "../../libraries/bridge/Lib_CrossDomainUtils.sol";
import { Lib_DefaultValues } from "../../libraries/constants/Lib_DefaultValues.sol";
import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol";

/* Interface Imports */
import { IL2CrossDomainMessenger } from "./IL2CrossDomainMessenger.sol";
import { iOVM_L2ToL1MessagePasser } from "../predeploys/iOVM_L2ToL1MessagePasser.sol";

/**
 * @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;
    }
}

File 2 of 9 : AddressAliasHelper.sol
// SPDX-License-Identifier: Apache-2.0

/*
 * 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 3 of 9 : Lib_CrossDomainUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import { Lib_RLPReader } from "../rlp/Lib_RLPReader.sol";

/**
 * @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 4 of 9 : Lib_DefaultValues.sol
// SPDX-License-Identifier: MIT
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 5 of 9 : Lib_PredeployAddresses.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/**
 * @title Lib_PredeployAddresses
 */
library Lib_PredeployAddresses {
    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(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);
    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;
}

File 6 of 9 : IL2CrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Interface Imports */
import { ICrossDomainMessenger } from "../../libraries/bridge/ICrossDomainMessenger.sol";

/**
 * @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 7 of 9 : iOVM_L2ToL1MessagePasser.sol
// SPDX-License-Identifier: MIT
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 8 of 9 : Lib_RLPReader.sol
// SPDX-License-Identifier: MIT
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 9 of 9 : ICrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
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;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

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"}]

608060405234801561001057600080fd5b50600436106100885760003560e01c8063a71198691161005b578063a71198691461012a578063b1b1b2091461014a578063cbd4ece91461016d578063ecc704281461018057600080fd5b806321d800ec1461008d5780633dbb202b146100c55780636e296e45146100da57806382e3702d14610107575b600080fd5b6100b061009b366004610826565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100d86100d3366004610942565b610197565b005b6100e26102e2565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bc565b6100b0610115366004610826565b60026020526000908152604090205460ff1681565b6005546100e29073ffffffffffffffffffffffffffffffffffffffff1681565b6100b0610158366004610826565b60016020526000908152604090205460ff1681565b6100d861017b3660046109ad565b61038b565b61018960035481565b6040519081526020016100bc565b60006101a784338560035461078d565b80516020808301919091206000908152600290915260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fcafa81dc0000000000000000000000000000000000000000000000000000000081529091507342000000000000000000000000000000000000009063cafa81dc9061023c908490600401610a89565b600060405180830381600087803b15801561025657600080fd5b505af115801561026a573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a3385600354866040516102bc9493929190610aa3565b60405180910390a26001600360008282546102d79190610aef565b909155505050505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff1661dead141561036e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f74207365740060448201526064015b60405180910390fd5b5060045473ffffffffffffffffffffffffffffffffffffffff1690565b60055473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff161461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610365565b60006104788585858561078d565b8051602080830191909120600081815260019092526040909120549192509060ff1615610527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610365565b73ffffffffffffffffffffffffffffffffffffffff8616734200000000000000000000000000000000000000141561059957600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909117905550610787565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff878116919091179091556040516000918816906105f2908790610b2e565b6000604051808303816000865af19150503d806000811461062f576040519150601f19603f3d011682016040523d82523d6000602084013e610634565b606091505b5050600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead1790559050801515600114156106d557600082815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2610701565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161071893929190610b4a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120600090815291829052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050505b50505050565b6060848484846040516024016107a69493929190610b9c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b60006020828403121561083857600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086357600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126108a857600080fd5b813567ffffffffffffffff808211156108c3576108c3610868565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561090957610909610868565b8160405283815286602085880101111561092257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561095757600080fd5b6109608461083f565b9250602084013567ffffffffffffffff81111561097c57600080fd5b61098886828701610897565b925050604084013563ffffffff811681146109a257600080fd5b809150509250925092565b600080600080608085870312156109c357600080fd5b6109cc8561083f565b93506109da6020860161083f565b9250604085013567ffffffffffffffff8111156109f657600080fd5b610a0287828801610897565b949793965093946060013593505050565b60005b83811015610a2e578181015183820152602001610a16565b838111156107875750506000910152565b60008151808452610a57816020860160208601610a13565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610a9c6020830184610a3f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610ad26080830186610a3f565b905083604083015263ffffffff8316606083015295945050505050565b60008219821115610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b60008251610b40818460208701610a13565b9190910192915050565b60008451610b5c818460208901610a13565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610bd56080830185610a3f565b90508260608301529594505050505056fea26469706673582212202e10f5e906e4d6b76a9239c97481d533896c41191186b3ec3ca5feab5203fde664736f6c63430008090033

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