Contract 0xc2f48bC4D8A42B82F801315696a92141f6F3413f 11

 
Txn Hash Method
Block
From
To
Value
0xf6cb7de61e674f0e3afaf4726630348fed21740c6505dc355e38c5fadc0518f7Add Caller26189322023-08-14 15:33:31107 days 12 hrs ago0x068053f77e321c8828f5fea91b6917011b1a77fe IN  0xc2f48bc4d8a42b82f801315696a92141f6f3413f0 ETH0.0001449867541.65000029
0x6dbc9466f046450739f83af7fbdf948846b88edcc22c6fe73671d7c096341a2e0x6080604026189262023-08-14 15:33:19107 days 12 hrs ago0x068053f77e321c8828f5fea91b6917011b1a77fe IN  Contract Creation0 ETH0.0010074982690.100000281
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Similar Match Source Code
This contract matches the deployed ByteCode of the Source Code for Contract 0xF9e693fC08C3Cb2db5b1EeB987612460B40e3e2b
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
OptimismL2Messenger

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 7 : OptimismMessengers.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../../../interfaces/IMessenger.sol";

import "../../RestrictedCalls.sol";
import "OpenZeppelin/[email protected]/contracts/vendor/optimism/ICrossDomainMessenger.sol";
import "optimism/Lib_PredeployAddresses.sol";

abstract contract OptimismMessengerBase is IMessenger, RestrictedCalls {
    uint32 private constant MESSAGE_GAS_LIMIT = 1_000_000;

    ICrossDomainMessenger public nativeMessenger;

    function callAllowed(
        address caller,
        address courier
    ) external view returns (bool) {
        return
            courier == address(nativeMessenger) &&
            caller == nativeMessenger.xDomainMessageSender();
    }

    function sendMessage(
        address target,
        bytes calldata message
    ) external restricted(block.chainid) {
        nativeMessenger.sendMessage(target, message, MESSAGE_GAS_LIMIT);
    }
}

contract OptimismL1Messenger is OptimismMessengerBase {
    constructor(address messenger_) {
        nativeMessenger = ICrossDomainMessenger(messenger_);
    }
}

contract OptimismL2Messenger is OptimismMessengerBase {
    constructor() {
        nativeMessenger = ICrossDomainMessenger(
            Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER
        );
    }
}

File 2 of 7 : ICrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (vendor/optimism/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 3 of 7 : 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 4 of 7 : IMessenger.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

/// The messenger interface.
///
/// Implementations of this interface are expected to transport
/// messages across the L1 <-> L2 boundary. For instance,
/// if an implementation is deployed on L1, the :sol:func:`sendMessage`
/// would send a message to a L2 chain, as determined by the implementation.
/// In order to do this, a messenger implementation may use a native
/// messenger contract. In such cases, :sol:func:`nativeMessenger` must
/// return the address of the native messenger contract.
interface IMessenger {
    /// Send a message across the L1 <-> L2 boundary.
    ///
    /// @param target The message recipient.
    /// @param message The message.
    function sendMessage(address target, bytes calldata message) external;

    /// Return whether the call is allowed or not.
    ///
    /// @param caller The caller.
    /// @param courier The contract that is trying to deliver the message.
    function callAllowed(address caller, address courier)
        external
        view
        returns (bool);
}

File 5 of 7 : RestrictedCalls.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "OpenZeppelin/[email protected]/contracts/access/Ownable.sol";
import "../interfaces/IMessenger.sol";

/// A helper contract that provides a way to restrict callers of restricted functions
/// to a single address. This allows for a trusted call chain,
/// as described in :ref:`contracts' architecture <contracts-architecture>`.
contract RestrictedCalls is Ownable {
    /// Maps caller chain IDs to tuples [caller, messenger].
    ///
    /// For same-chain calls, the messenger address is 0x0.
    mapping(uint256 callerChainId => address[2]) public callers;

    function _addCaller(
        uint256 callerChainId,
        address caller,
        address messenger
    ) internal {
        require(caller != address(0), "RestrictedCalls: caller cannot be 0");
        require(
            callers[callerChainId][0] == address(0),
            "RestrictedCalls: caller already exists"
        );
        callers[callerChainId] = [caller, messenger];
    }

    /// Allow calls from an address on the same chain.
    ///
    /// @param caller The caller.
    function addCaller(address caller) external onlyOwner {
        _addCaller(block.chainid, caller, address(0));
    }

    /// Allow calls from an address on another chain.
    ///
    /// @param callerChainId The caller's chain ID.
    /// @param caller The caller.
    /// @param messenger The messenger.
    function addCaller(
        uint256 callerChainId,
        address caller,
        address messenger
    ) external onlyOwner {
        _addCaller(callerChainId, caller, messenger);
    }

    /// Mark the function as restricted.
    ///
    /// Calls to the restricted function can only come from an address that
    /// was previously added by a call to :sol:func:`addCaller`.
    ///
    /// Example usage::
    ///
    ///     restricted(block.chainid)   // expecting calls from the same chain
    ///     restricted(otherChainId)    // expecting calls from another chain
    ///
    modifier restricted(uint256 callerChainId) {
        address caller = callers[callerChainId][0];

        if (callerChainId == block.chainid) {
            require(msg.sender == caller, "RestrictedCalls: call disallowed");
        } else {
            address messenger = callers[callerChainId][1];
            require(
                messenger != address(0),
                "RestrictedCalls: messenger not set"
            );
            require(
                IMessenger(messenger).callAllowed(caller, msg.sender),
                "RestrictedCalls: call disallowed"
            );
        }
        _;
    }
}

File 6 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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);
    }
}

File 7 of 7 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "remappings": [
    "OpenZeppelin/[email protected]/contracts=.cache/OpenZeppelin/v4.8.0",
    "interfaces=.cache/Interfaces/local",
    "optimism=.cache/Optimism/local"
  ],
  "evmVersion": "london"
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"callerChainId","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"address","name":"messenger","type":"address"}],"name":"addCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"addCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"address","name":"courier","type":"address"}],"name":"callAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"callerChainId","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"callers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeMessenger","outputs":[{"internalType":"contract ICrossDomainMessenger","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"sendMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a33610045565b600280546001600160a01b031916734200000000000000000000000000000000000007179055610095565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6107fd806100a46000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063778972381161006657806377897238146100f8578063845c54431461010b5780638da5cb5b1461012e578063bb5ddb0f1461013f578063f2fde38b1461015257600080fd5b80630e19a1c614610098578063715018a6146100c85780637203ae3b146100d2578063747293fb146100e5575b600080fd5b6100ab6100a6366004610606565b610165565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d0610193565b005b6100d06100e036600461063d565b6101a7565b6100d06100f336600461067f565b6101bf565b6002546100ab906001600160a01b031681565b61011e61011936600461069c565b6101d6565b60405190151581526020016100bf565b6000546001600160a01b03166100ab565b6100d061014d3660046106d5565b610284565b6100d061016036600461067f565b610363565b6001602052816000526040600020816002811061018157600080fd5b01546001600160a01b03169150829050565b61019b6103d9565b6101a56000610433565b565b6101af6103d9565b6101ba838383610483565b505050565b6101c76103d9565b6101d346826000610483565b50565b6002546000906001600160a01b03838116911614801561027d5750600260009054906101000a90046001600160a01b03166001600160a01b0316636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610268919061075a565b6001600160a01b0316836001600160a01b0316145b9392505050565b466000818152600160205260409020546001600160a01b03163381146102f15760405162461bcd60e51b815260206004820181905260248201527f5265737472696374656443616c6c733a2063616c6c20646973616c6c6f77656460448201526064015b60405180910390fd5b600254604051633dbb202b60e01b81526001600160a01b0390911690633dbb202b9061032a90889088908890620f424090600401610777565b600060405180830381600087803b15801561034457600080fd5b505af1158015610358573d6000803e3d6000fd5b505050505050505050565b61036b6103d9565b6001600160a01b0381166103d05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e8565b6101d381610433565b6000546001600160a01b031633146101a55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102e8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166104e55760405162461bcd60e51b815260206004820152602360248201527f5265737472696374656443616c6c733a2063616c6c65722063616e6e6f74206260448201526206520360ec1b60648201526084016102e8565b6000838152600160205260409020546001600160a01b0316156105595760405162461bcd60e51b815260206004820152602660248201527f5265737472696374656443616c6c733a2063616c6c657220616c72656164792060448201526565786973747360d01b60648201526084016102e8565b6040805180820182526001600160a01b03808516825283166020808301919091526000868152600190915291909120610593916002610599565b50505050565b82600281019282156105e1579160200282015b828111156105e157825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906105ac565b506105ed9291506105f1565b5090565b5b808211156105ed57600081556001016105f2565b6000806040838503121561061957600080fd5b50508035926020909101359150565b6001600160a01b03811681146101d357600080fd5b60008060006060848603121561065257600080fd5b83359250602084013561066481610628565b9150604084013561067481610628565b809150509250925092565b60006020828403121561069157600080fd5b813561027d81610628565b600080604083850312156106af57600080fd5b82356106ba81610628565b915060208301356106ca81610628565b809150509250929050565b6000806000604084860312156106ea57600080fd5b83356106f581610628565b9250602084013567ffffffffffffffff8082111561071257600080fd5b818601915086601f83011261072657600080fd5b81358181111561073557600080fd5b87602082850101111561074757600080fd5b6020830194508093505050509250925092565b60006020828403121561076c57600080fd5b815161027d81610628565b6001600160a01b038516815260606020820181905281018390528284608083013760006080848301015260006080601f19601f860116830101905063ffffffff831660408301529594505050505056fea26469706673582212208f821149a764222e7e2318c05dfdeb00f984253d9bc9ea67b2fed9acbf48dc2964736f6c63430008130033

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.