ETH Price: $2,878.97 (-5.65%)
Gas: 1 Gwei

Contract

0x6a6893cB59A559458D61618300598394743F0747
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040131478702021-09-02 18:22:501039 days ago1630606970IN
 Create: MirrorWriteRaceOracle
0 ETH0.08432705157.37004643

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MirrorWriteRaceOracle

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion
File 1 of 3 : MirrorWriteRaceOracle.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

import {IMirrorWriteRaceOracle} from "./interface/IMirrorWriteRaceOracle.sol";
import {Ownable} from "../lib/Ownable.sol";

/**
 * @title MirrorWriteRaceOracle
 * @author MirrorXYZ
 */
contract MirrorWriteRaceOracle is IMirrorWriteRaceOracle, Ownable {
    /// @notice Merkle root
    bytes32 public root;

    constructor(address owner_, bytes32 root_) Ownable(owner_) {
        root = root_;
    }

    function updateRoot(bytes32 newRoot) public override onlyOwner {
        root = newRoot;
    }

    /**
     * @notice verifies that an account has participated in the Write Race.
     * see: https://github.com/protofire/zeppelin-solidity/blob/master/contracts/MerkleProof.sol
     */
    function verify(
        address account,
        uint256 index,
        bytes32[] memory proof
    ) public view override returns (bool) {
        bytes32 computedHash = getNode(account, index);

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(
                    abi.encodePacked(computedHash, proofElement)
                );
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(
                    abi.encodePacked(proofElement, computedHash)
                );
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }

    function getNode(address account, uint256 index)
        private
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(account, index));
    }
}

File 2 of 3 : IMirrorWriteRaceOracle.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

/**
 * @title IMirrorWriteRaceOracle
 * @author MirrorXYZ
 */
interface IMirrorWriteRaceOracle {
    event UpdatedRoot(bytes32 oldRoot, bytes32 newRoot);

    function updateRoot(bytes32 newRoot) external;

    function verify(
        address account,
        uint256 index,
        bytes32[] memory proof
    ) external view returns (bool);
}

File 3 of 3 : Ownable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;

contract Ownable {
    address public owner;
    address private nextOwner;

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

    // modifiers

    modifier onlyOwner() {
        require(isOwner(), "caller is not the owner.");
        _;
    }

    modifier onlyNextOwner() {
        require(isNextOwner(), "current owner must set caller as next owner.");
        _;
    }

    /**
     * @dev Initialize contract by setting transaction submitter as initial owner.
     */
    constructor(address owner_) {
        owner = owner_;
        emit OwnershipTransferred(address(0), owner);
    }

    /**
     * @dev Initiate ownership transfer by setting nextOwner.
     */
    function transferOwnership(address nextOwner_) external onlyOwner {
        require(nextOwner_ != address(0), "Next owner is the zero address.");

        nextOwner = nextOwner_;
    }

    /**
     * @dev Cancel ownership transfer by deleting nextOwner.
     */
    function cancelOwnershipTransfer() external onlyOwner {
        delete nextOwner;
    }

    /**
     * @dev Accepts ownership transfer by setting owner.
     */
    function acceptOwnership() external onlyNextOwner {
        delete nextOwner;

        owner = msg.sender;

        emit OwnershipTransferred(owner, msg.sender);
    }

    /**
     * @dev Renounce ownership by setting owner to zero address.
     */
    function renounceOwnership() external onlyOwner {
        owner = address(0);

        emit OwnershipTransferred(owner, address(0));
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == owner;
    }

    /**
     * @dev Returns true if the caller is the next owner.
     */
    function isNextOwner() public view returns (bool) {
        return msg.sender == nextOwner;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"bytes32","name":"root_","type":"bytes32"}],"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"oldRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"UpdatedRoot","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isNextOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nextOwner_","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"updateRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516108a33803806108a383398101604081905261002f91610081565b600080546001600160a01b0319166001600160a01b03841690811782556040518492907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600255506100bb565b6000806040838503121561009457600080fd5b82516001600160a01b03811681146100ab57600080fd5b6020939093015192949293505050565b6107d9806100ca6000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063ebf0c7171161005b578063ebf0c71714610156578063ed459df21461016d578063f2fde38b1461018057600080fd5b80638da5cb5b146101185780638f32d59b1461014357600080fd5b8063715018a6116100a7578063715018a6146100e057806379ba5097146100e85780638be0861e146100f057600080fd5b806321ff9970146100c357806323452b9c146100d8575b600080fd5b6100d66100d1366004610717565b610193565b005b6100d66101f7565b6100d6610270565b6100d6610313565b6101036100fe366004610618565b6103e8565b60405190151581526020015b60405180910390f35b60005461012b906001600160a01b031681565b6040516001600160a01b03909116815260200161010f565b6000546001600160a01b03163314610103565b61015f60025481565b60405190815260200161010f565b6001546001600160a01b03163314610103565b6100d661018e3660046105f6565b6104fb565b6000546001600160a01b031633146101f25760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064015b60405180910390fd5b600255565b6000546001600160a01b031633146102515760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146102ca5760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6000805473ffffffffffffffffffffffffffffffffffffffff1916815560405181907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3565b6001546001600160a01b031633146103935760405162461bcd60e51b815260206004820152602c60248201527f63757272656e74206f776e6572206d757374207365742063616c6c657220617360448201527f206e657874206f776e65722e000000000000000000000000000000000000000060648201526084016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19908116909155600080543392168217815560405182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3565b60008061044a85856040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b905060005b83518110156104ee57600084828151811061046c5761046c610777565b602002602001015190508083116104ae5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506104db565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806104e681610730565b91505061044f565b5060025414949350505050565b6000546001600160a01b031633146105555760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6001600160a01b0381166105ab5760405162461bcd60e51b815260206004820152601f60248201527f4e657874206f776e657220697320746865207a65726f20616464726573732e0060448201526064016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b80356001600160a01b03811681146105f157600080fd5b919050565b60006020828403121561060857600080fd5b610611826105da565b9392505050565b60008060006060848603121561062d57600080fd5b610636846105da565b92506020808501359250604085013567ffffffffffffffff8082111561065b57600080fd5b818701915087601f83011261066f57600080fd5b8135818111156106815761068161078d565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156106c4576106c461078d565b604052828152858101935084860182860187018c10156106e357600080fd5b600095505b838610156107065780358552600195909501949386019386016106e8565b508096505050505050509250925092565b60006020828403121561072957600080fd5b5035919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561077057634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220279325bc75dc82ebbc24feb055b2b0cbc4df77d1cfd8feff9a4c920aec365f3264736f6c634300080600330000000000000000000000002330ee705ffd040bb0cba8cb7734dfe00e7c4b57f760f48a911881d432e210cdd6b2d0e92fff6c6a829d403da60052e5e718f048

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063ebf0c7171161005b578063ebf0c71714610156578063ed459df21461016d578063f2fde38b1461018057600080fd5b80638da5cb5b146101185780638f32d59b1461014357600080fd5b8063715018a6116100a7578063715018a6146100e057806379ba5097146100e85780638be0861e146100f057600080fd5b806321ff9970146100c357806323452b9c146100d8575b600080fd5b6100d66100d1366004610717565b610193565b005b6100d66101f7565b6100d6610270565b6100d6610313565b6101036100fe366004610618565b6103e8565b60405190151581526020015b60405180910390f35b60005461012b906001600160a01b031681565b6040516001600160a01b03909116815260200161010f565b6000546001600160a01b03163314610103565b61015f60025481565b60405190815260200161010f565b6001546001600160a01b03163314610103565b6100d661018e3660046105f6565b6104fb565b6000546001600160a01b031633146101f25760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064015b60405180910390fd5b600255565b6000546001600160a01b031633146102515760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146102ca5760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6000805473ffffffffffffffffffffffffffffffffffffffff1916815560405181907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3565b6001546001600160a01b031633146103935760405162461bcd60e51b815260206004820152602c60248201527f63757272656e74206f776e6572206d757374207365742063616c6c657220617360448201527f206e657874206f776e65722e000000000000000000000000000000000000000060648201526084016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19908116909155600080543392168217815560405182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3565b60008061044a85856040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b905060005b83518110156104ee57600084828151811061046c5761046c610777565b602002602001015190508083116104ae5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506104db565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806104e681610730565b91505061044f565b5060025414949350505050565b6000546001600160a01b031633146105555760405162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206f776e65722e000000000000000060448201526064016101e9565b6001600160a01b0381166105ab5760405162461bcd60e51b815260206004820152601f60248201527f4e657874206f776e657220697320746865207a65726f20616464726573732e0060448201526064016101e9565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b80356001600160a01b03811681146105f157600080fd5b919050565b60006020828403121561060857600080fd5b610611826105da565b9392505050565b60008060006060848603121561062d57600080fd5b610636846105da565b92506020808501359250604085013567ffffffffffffffff8082111561065b57600080fd5b818701915087601f83011261066f57600080fd5b8135818111156106815761068161078d565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156106c4576106c461078d565b604052828152858101935084860182860187018c10156106e357600080fd5b600095505b838610156107065780358552600195909501949386019386016106e8565b508096505050505050509250925092565b60006020828403121561072957600080fd5b5035919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561077057634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220279325bc75dc82ebbc24feb055b2b0cbc4df77d1cfd8feff9a4c920aec365f3264736f6c63430008060033

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

0000000000000000000000002330ee705ffd040bb0cba8cb7734dfe00e7c4b57f760f48a911881d432e210cdd6b2d0e92fff6c6a829d403da60052e5e718f048

-----Decoded View---------------
Arg [0] : owner_ (address): 0x2330ee705fFD040bB0cbA8CB7734Dfe00E7C4b57
Arg [1] : root_ (bytes32): 0xf760f48a911881d432e210cdd6b2d0e92fff6c6a829d403da60052e5e718f048

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002330ee705ffd040bb0cba8cb7734dfe00e7c4b57
Arg [1] : f760f48a911881d432e210cdd6b2d0e92fff6c6a829d403da60052e5e718f048


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.