ETH Price: $3,224.54 (-1.63%)

Contract

0x2eca3BA9A1B580DEC1e6c5C6003eA87FBA1E7170
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...157222292022-10-11 3:37:59825 days ago1665459479IN
0x2eca3BA9...FBA1E7170
0 ETH0.0008331929.04855204
Set Default L2Ga...156194012022-09-26 18:42:59839 days ago1664217779IN
0x2eca3BA9...FBA1E7170
0 ETH0.000693824.17285188
Transfer Ownersh...155932332022-09-23 3:03:11843 days ago1663902191IN
0x2eca3BA9...FBA1E7170
0 ETH0.000174876.09668745
Set L2Gas Limit ...155932292022-09-23 3:02:23843 days ago1663902143IN
0x2eca3BA9...FBA1E7170
0 ETH0.000301376.52973064

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2Bc96b16...89E4a3Bd2
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
OptimismMessengerWrapper

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 50000 runs

Other Settings:
default evmVersion
File 1 of 7 : OptimismMessengerWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/optimism/messengers/iOVM_L1CrossDomainMessenger.sol";
import "./MessengerWrapper.sol";

/**
 * @dev A MessengerWrapper for Optimism - https://community.optimism.io/docs/
 * @notice Deployed on layer-1
 */

contract OptimismMessengerWrapper is MessengerWrapper, Ownable {

    iOVM_L1CrossDomainMessenger public immutable l1MessengerAddress;
    address public immutable l2BridgeAddress;
    uint256 public defaultL2GasLimit;
    mapping (bytes4 => uint256) public l2GasLimitForSignature;

    constructor(
        address _l1BridgeAddress,
        address _l2BridgeAddress,
        iOVM_L1CrossDomainMessenger _l1MessengerAddress,
        uint256 _defaultL2GasLimit
    )
        public
        MessengerWrapper(_l1BridgeAddress)
    {
        l2BridgeAddress = _l2BridgeAddress;
        l1MessengerAddress = _l1MessengerAddress;
        defaultL2GasLimit = _defaultL2GasLimit;
    }

    /** 
     * @dev Sends a message to the l2BridgeAddress from layer-1
     * @param _calldata The data that l2BridgeAddress will be called with
     */
    function sendCrossDomainMessage(bytes memory _calldata) public override onlyL1Bridge {
        uint256 l2GasLimit = l2GasLimitForCalldata(_calldata);

        l1MessengerAddress.sendMessage(
            l2BridgeAddress,
            _calldata,
            uint32(l2GasLimit)
        );
    }

    function verifySender(address l1BridgeCaller, bytes memory /*_data*/) public override {
        require(l1BridgeCaller == address(l1MessengerAddress), "OVM_MSG_WPR: Caller is not l1MessengerAddress");
        // Verify that cross-domain sender is l2BridgeAddress
        require(l1MessengerAddress.xDomainMessageSender() == l2BridgeAddress, "OVM_MSG_WPR: Invalid cross-domain sender");
    }

    function setDefaultL2GasLimit(uint256 _l2GasLimit) external onlyOwner {
        defaultL2GasLimit = _l2GasLimit;
    }

    function setL2GasLimitForSignature(uint256 _l2GasLimit, bytes4 signature) external onlyOwner {
        l2GasLimitForSignature[signature] = _l2GasLimit;
    }

    // Private functions

    function l2GasLimitForCalldata(bytes memory _calldata) private view returns (uint256) {
        uint256 l2GasLimit;

        if (_calldata.length >= 4) {
            bytes4 functionSignature = bytes4(toUint32(_calldata, 0));
            l2GasLimit = l2GasLimitForSignature[functionSignature];
        }

        if (l2GasLimit == 0) {
            l2GasLimit = defaultL2GasLimit;
        }

        return l2GasLimit;
    }

    // source: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol
    function toUint32(bytes memory _bytes, uint256 _start) private pure returns (uint32) {
        require(_bytes.length >= _start + 4, "OVM_MSG_WPR: out of bounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }
}

File 2 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 7 : iOVM_L1CrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;

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

/**
 * @title iOVM_L1CrossDomainMessenger
 */
interface iOVM_L1CrossDomainMessenger is iOVM_BaseCrossDomainMessenger {}

File 4 of 7 : MessengerWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.12 <=0.8.9;
pragma experimental ABIEncoderV2;

import "../interfaces/IMessengerWrapper.sol";

abstract contract MessengerWrapper is IMessengerWrapper {
    address public immutable l1BridgeAddress;

    constructor(address _l1BridgeAddress) internal {
        l1BridgeAddress = _l1BridgeAddress;
    }

    modifier onlyL1Bridge {
        require(msg.sender == l1BridgeAddress, "MW: Sender must be the L1 Bridge");
        _;
    }
}

File 5 of 7 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 6 of 7 : iOVM_BaseCrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
// +build ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;

/**
 * @title iOVM_BaseCrossDomainMessenger
 */
interface iOVM_BaseCrossDomainMessenger {

    /**********
     * Events *
     **********/
    event SentMessage(bytes message);
    event RelayedMessage(bytes32 msgHash);

    /**********************
     * Contract 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;

    function deposit(
        address _depositor,
        uint256 _amount,
        bool _send
    ) external;
}

File 7 of 7 : IMessengerWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.12 <=0.8.9;
pragma experimental ABIEncoderV2;

interface IMessengerWrapper {
    function sendCrossDomainMessage(bytes memory _calldata) external;
    function verifySender(address l1BridgeCaller, bytes memory _data) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_l1BridgeAddress","type":"address"},{"internalType":"address","name":"_l2BridgeAddress","type":"address"},{"internalType":"contract iOVM_L1CrossDomainMessenger","name":"_l1MessengerAddress","type":"address"},{"internalType":"uint256","name":"_defaultL2GasLimit","type":"uint256"}],"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":[],"name":"defaultL2GasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1BridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1MessengerAddress","outputs":[{"internalType":"contract iOVM_L1CrossDomainMessenger","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2BridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"l2GasLimitForSignature","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"sendCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_l2GasLimit","type":"uint256"}],"name":"setDefaultL2GasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_l2GasLimit","type":"uint256"},{"internalType":"bytes4","name":"signature","type":"bytes4"}],"name":"setL2GasLimitForSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"l1BridgeCaller","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"verifySender","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063934746a711610081578063b67efb701161005b578063b67efb7014610172578063c5deebb314610185578063f2fde38b1461018d576100d4565b8063934746a71461014457806399178dd81461014c578063b08324f51461015f576100d4565b80635ab2a558116100b25780635ab2a5581461011f578063715018a6146101345780638da5cb5b1461013c576100d4565b8063419cb550146100d957806356f3f181146100ee5780635a4846b21461010c575b600080fd5b6100ec6100e7366004610a7d565b6101a0565b005b6100f66102f2565b6040516101039190610d75565b60405180910390f35b6100ec61011a366004610ab8565b6102f8565b610127610370565b6040516101039190610aff565b6100ec610394565b610127610476565b610127610492565b6100ec61015a366004610a13565b6104b6565b6100ec61016d366004610ad0565b610661565b6100f6610180366004610a61565b610707565b610127610719565b6100ec61019b3660046109d4565b61073d565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000914f986a44acb623a277d6bd17368171fcbe42731614610218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610d40565b60405180910390fd5b60006102238261088a565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa11690633dbb202b906102bc907f00000000000000000000000003d7f750777ec48d39d080b020d83eb2cb4e35479086908690600401610b20565b600060405180830381600087803b1580156102d657600080fd5b505af11580156102ea573d6000803e3d6000fd5b505050505050565b60015481565b6103006108eb565b73ffffffffffffffffffffffffffffffffffffffff1661031e610476565b73ffffffffffffffffffffffffffffffffffffffff161461036b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610d0b565b600155565b7f000000000000000000000000914f986a44acb623a277d6bd17368171fcbe427381565b61039c6108eb565b73ffffffffffffffffffffffffffffffffffffffff166103ba610476565b73ffffffffffffffffffffffffffffffffffffffff1614610407576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610d0b565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b7f00000000000000000000000003d7f750777ec48d39d080b020d83eb2cb4e354781565b7f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461053b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610bf4565b7f00000000000000000000000003d7f750777ec48d39d080b020d83eb2cb4e354773ffffffffffffffffffffffffffffffffffffffff167f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa173ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d857600080fd5b505afa1580156105ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061091906109f7565b73ffffffffffffffffffffffffffffffffffffffff161461065d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610cae565b5050565b6106696108eb565b73ffffffffffffffffffffffffffffffffffffffff16610687610476565b73ffffffffffffffffffffffffffffffffffffffff16146106d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610d0b565b7fffffffff0000000000000000000000000000000000000000000000000000000016600090815260026020526040902055565b60026020526000908152604090205481565b7f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa181565b6107456108eb565b73ffffffffffffffffffffffffffffffffffffffff16610763610476565b73ffffffffffffffffffffffffffffffffffffffff16146107b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610d0b565b73ffffffffffffffffffffffffffffffffffffffff81166107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610c51565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60008060048351106108db5760006108a38460006108ef565b60e01b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152600260205260409020549150505b806108e557506001545b92915050565b3390565b6000816004018351101561092f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f90610bbd565b50016004015190565b600082601f830112610948578081fd5b813567ffffffffffffffff8082111561095f578283fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f850116820101818110838211171561099d578485fd5b6040528281529250828483016020018610156109b857600080fd5b8260208601602083013760006020848301015250505092915050565b6000602082840312156109e5578081fd5b81356109f081610d7e565b9392505050565b600060208284031215610a08578081fd5b81516109f081610d7e565b60008060408385031215610a25578081fd5b8235610a3081610d7e565b9150602083013567ffffffffffffffff811115610a4b578182fd5b610a5785828601610938565b9150509250929050565b600060208284031215610a72578081fd5b81356109f081610da3565b600060208284031215610a8e578081fd5b813567ffffffffffffffff811115610aa4578182fd5b610ab084828501610938565b949350505050565b600060208284031215610ac9578081fd5b5035919050565b60008060408385031215610ae2578182fd5b823591506020830135610af481610da3565b809150509250929050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8516825260206060818401528451806060850152825b81811015610b6957868101830151858201608001528201610b4d565b81811115610b7a5783608083870101525b5063ffffffff9490941660408401525050601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160160800192915050565b6020808252601a908201527f4f564d5f4d53475f5750523a206f7574206f6620626f756e6473000000000000604082015260600190565b6020808252602d908201527f4f564d5f4d53475f5750523a2043616c6c6572206973206e6f74206c314d657360408201527f73656e6765724164647265737300000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4f564d5f4d53475f5750523a20496e76616c69642063726f73732d646f6d616960408201527f6e2073656e646572000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f4d573a2053656e646572206d75737420626520746865204c3120427269646765604082015260600190565b90815260200190565b73ffffffffffffffffffffffffffffffffffffffff81168114610da057600080fd5b50565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610da057600080fdfea26469706673582212209f247bd2ae0f991fb6c131d7f9b808923aed1d9f4856b67c340b03fecc481b5664736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.