Contract 0x8a1b966ac46f42275860f905dbc75efbfdc12374 1

Contract Overview

Balance:
0 MATIC
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x4e45db802f763b3fbf93336591fb978fa33c61af8233c9544d39f56e11f99fa80x60c06040229088832021-12-20 17:10:38286 days 20 hrs ago0x289ed7b614aa9cb2feeace6ce2b4244ba4bd58a2 IN  Create: EthereumProxy0 MATIC0.001394845003 2.500000007
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EthereumProxy

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : EthereumProxy.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import {IFxMessageProcessor} from '@maticnetwork/fx-portal/contracts/tunnel/FxBaseChildTunnel.sol';

/// @title Ethereum proxy contract
/// @dev This contract represents another contract on L1
contract EthereumProxy is IFxMessageProcessor {
    /// @notice The tunnel contract on the child network, i.e. Polygon
    address public immutable fxChild;

    /// @notice The address of the L1 owner contract, i.e. Ethereum L1 owner address
    address public immutable l1Owner;

    constructor(address _fxChild, address _l1Owner) {
        fxChild = _fxChild;
        l1Owner = _l1Owner;
    }

    /// @dev Emitted when this contract simply receives some currency
    event Received(uint256 value);

    /// @dev If necessary, this contract can accept funds so that it may send funds
    receive() external payable {
        emit Received(msg.value);
    }

    /// @dev This function is how messages are delivered from the polygon message passing contract to polygon contracts.
    function processMessageFromRoot(
        uint256, /*stateId*/
        address sender,
        bytes memory message
    ) external override {
        require(msg.sender == fxChild, 'Can only be called by the state sync child contract');
        require(sender == l1Owner, 'L1 sender must be the owner');

        (address[] memory targets, bytes[] memory datas, uint256[] memory values) = abi.decode(
            message,
            (address[], bytes[], uint256[])
        );

        require(targets.length == datas.length && targets.length == values.length, 'Inconsistent argument lengths');
        for (uint256 i = 0; i < targets.length; i++) {
            (bool success, ) = targets[i].call{value: values[i]}(datas[i]);
            require(success, 'Sub-call failed');
        }
    }
}

File 2 of 2 : FxBaseChildTunnel.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// IFxMessageProcessor represents interface to process message
interface IFxMessageProcessor {
    function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external;
}

/**
* @notice Mock child tunnel contract to receive and send message from L2
*/
abstract contract FxBaseChildTunnel is IFxMessageProcessor{
    // MessageTunnel on L1 will get data from this event
    event MessageSent(bytes message);

    // fx child
    address public fxChild;

    // fx root tunnel
    address public fxRootTunnel;

    constructor(address _fxChild) {
        fxChild = _fxChild;
    }

    // Sender must be fxRootTunnel in case of ERC20 tunnel
    modifier validateSender(address sender) {
        require(sender == fxRootTunnel, "FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT");
        _;
    }

    // set fxRootTunnel if not set already
    function setFxRootTunnel(address _fxRootTunnel) external {
        require(fxRootTunnel == address(0x0), "FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET");
        fxRootTunnel = _fxRootTunnel;
    }

    function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external override {
        require(msg.sender == fxChild, "FxBaseChildTunnel: INVALID_SENDER");
        _processMessageFromRoot(stateId, rootMessageSender, data);
    }

    /**
     * @notice Emit message that can be received on Root Tunnel
     * @dev Call the internal function when need to emit message
     * @param message bytes message that will be sent to Root Tunnel
     * some message examples -
     *   abi.encode(tokenId);
     *   abi.encode(tokenId, tokenMetadata);
     *   abi.encode(messageType, messageData);
     */
    function _sendMessageToRoot(bytes memory message) internal {
        emit MessageSent(message);
    }

    /**
     * @notice Process message received from Root Tunnel
     * @dev function needs to be implemented to handle message as per requirement
     * This is called by onStateReceive function.
     * Since it is called via a system call, any event will not be emitted during its execution.
     * @param stateId unique state id
     * @param sender root message sender
     * @param message bytes message that was sent from Root Tunnel
     */
    function _processMessageFromRoot(uint256 stateId, address sender, bytes memory message) virtual internal;
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_fxChild","type":"address"},{"internalType":"address","name":"_l1Owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Received","type":"event"},{"inputs":[],"name":"fxChild","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1Owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"processMessageFromRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c060405234801561001057600080fd5b506040516109eb3803806109eb83398101604081905261002f91610062565b6001600160a01b039182166080521660a052610095565b80516001600160a01b038116811461005d57600080fd5b919050565b6000806040838503121561007557600080fd5b61007e83610046565b915061008c60208401610046565b90509250929050565b60805160a0516109246100c76000396000818161010801526101f60152600081816089015261014201526109246000f3fe6080604052600436106100385760003560e01c8063450d11f0146100775780639a7c4b71146100d4578063d2db6372146100f657600080fd5b36610072576040513481527fa8142743f8f70a4c26f3691cf4ed59718381fb2f18070ec52be1f1022d8555579060200160405180910390a1005b600080fd5b34801561008357600080fd5b506100ab7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100e057600080fd5b506100f46100ef366004610571565b61012a565b005b34801561010257600080fd5b506100ab7f000000000000000000000000000000000000000000000000000000000000000081565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f43616e206f6e6c792062652063616c6c6564206279207468652073746174652060448201527f73796e63206368696c6420636f6e74726163740000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146102a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c312073656e646572206d75737420626520746865206f776e6572000000000060448201526064016101eb565b6000806000838060200190518101906102c29190610783565b925092509250815183511480156102da575080518351145b610340576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f496e636f6e73697374656e7420617267756d656e74206c656e6774687300000060448201526064016101eb565b60005b835181101561047f5760008482815181106103605761036061086c565b602002602001015173ffffffffffffffffffffffffffffffffffffffff168383815181106103905761039061086c565b60200260200101518584815181106103aa576103aa61086c565b60200260200101516040516103bf919061089b565b60006040518083038185875af1925050503d80600081146103fc576040519150601f19603f3d011682016040523d82523d6000602084013e610401565b606091505b505090508061046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5375622d63616c6c206661696c6564000000000000000000000000000000000060448201526064016101eb565b5080610477816108b7565b915050610343565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff811681146104aa57600080fd5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610523576105236104ad565b604052919050565b600067ffffffffffffffff821115610545576105456104ad565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008060006060848603121561058657600080fd5b83359250602084013561059881610488565b9150604084013567ffffffffffffffff8111156105b457600080fd5b8401601f810186136105c557600080fd5b80356105d86105d38261052b565b6104dc565b8181528760208385010111156105ed57600080fd5b816020840160208301376000602083830101528093505050509250925092565b600067ffffffffffffffff821115610627576106276104ad565b5060051b60200190565b60005b8381101561064c578181015183820152602001610634565b8381111561065b576000848401525b50505050565b600082601f83011261067257600080fd5b815160206106826105d38361060d565b82815260059290921b840181019181810190868411156106a157600080fd5b8286015b8481101561071d57805167ffffffffffffffff8111156106c55760008081fd5b8701603f810189136106d75760008081fd5b8481015160406106e96105d38361052b565b8281528b828486010111156106fe5760008081fd5b61070d83898301848701610631565b86525050509183019183016106a5565b509695505050505050565b600082601f83011261073957600080fd5b815160206107496105d38361060d565b82815260059290921b8401810191818101908684111561076857600080fd5b8286015b8481101561071d578051835291830191830161076c565b60008060006060848603121561079857600080fd5b835167ffffffffffffffff808211156107b057600080fd5b818601915086601f8301126107c457600080fd5b815160206107d46105d38361060d565b82815260059290921b8401810191818101908a8411156107f357600080fd5b948201945b8386101561081a57855161080b81610488565b825294820194908201906107f8565b9189015191975090935050508082111561083357600080fd5b61083f87838801610661565b9350604086015191508082111561085557600080fd5b5061086286828701610728565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082516108ad818460208701610631565b9190910192915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610910577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea164736f6c6343000809000a000000000000000000000000cf73231f28b7331bbe3124b907840a94851f9f110000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc

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

000000000000000000000000cf73231f28b7331bbe3124b907840a94851f9f110000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc

-----Decoded View---------------
Arg [0] : _fxChild (address): 0xcf73231f28b7331bbe3124b907840a94851f9f11
Arg [1] : _l1Owner (address): 0x1a9c8182c09f50c8318d769245bea52c32be35bc

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000cf73231f28b7331bbe3124b907840a94851f9f11
Arg [1] : 0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading