Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MerkleSnapshot
Compiler Version
v0.5.11+commit.c082d0b4
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2020-10-01
*/
// File: contracts/zeppelin/MerkleProof.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.11;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
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;
}
}
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts/zeppelin/Pausable.sol
pragma solidity ^0.5.11;
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
// File: contracts/IController.sol
pragma solidity ^0.5.11;
contract IController is Pausable {
event SetContractInfo(bytes32 id, address contractAddress, bytes20 gitCommitHash);
function setContractInfo(bytes32 _id, address _contractAddress, bytes20 _gitCommitHash) external;
function updateController(bytes32 _id, address _controller) external;
function getContract(bytes32 _id) public view returns (address);
}
// File: contracts/Manager.sol
pragma solidity ^0.5.11;
contract Manager is IManager {
// Controller that contract is registered with
IController public controller;
// Check if sender is controller
modifier onlyController() {
require(msg.sender == address(controller), "caller must be Controller");
_;
}
// Check if sender is controller owner
modifier onlyControllerOwner() {
require(msg.sender == controller.owner(), "caller must be Controller owner");
_;
}
// Check if controller is not paused
modifier whenSystemNotPaused() {
require(!controller.paused(), "system is paused");
_;
}
// Check if controller is paused
modifier whenSystemPaused() {
require(controller.paused(), "system is not paused");
_;
}
constructor(address _controller) public {
controller = IController(_controller);
}
/**
* @notice Set controller. Only callable by current controller
* @param _controller Controller contract address
*/
function setController(address _controller) external onlyController {
controller = IController(_controller);
emit SetController(_controller);
}
}
// File: contracts/snapshots/MerkleSnapshot.sol
pragma solidity ^0.5.11;
contract MerkleSnapshot is Manager {
mapping (bytes32 => bytes32) public snapshot;
constructor(address _controller) public Manager(_controller) {}
function setSnapshot(bytes32 _id, bytes32 _root) external onlyControllerOwner {
snapshot[_id] = _root;
}
function verify(bytes32 _id, bytes32[] calldata _proof, bytes32 _leaf) external view returns (bool) {
return MerkleProof.verify(_proof, snapshot[_id], _leaf);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"bytes32","name":"_leaf","type":"bytes32"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"snapshot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setSnapshot","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"controller","type":"address"}],"name":"SetController","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"param","type":"string"}],"name":"ParameterUpdate","type":"event"}]Contract Creation Code
608060405234801561001057600080fd5b506040516104d93803806104d98339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610474806100656000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630a02831c1461005c5780631ac79c41146100e75780635824adf41461011657806392eefe9b1461013b578063f77c479114610161575b600080fd5b6100d36004803603606081101561007257600080fd5b8135919081019060408101602082013564010000000081111561009457600080fd5b8201836020820111156100a657600080fd5b803590602001918460208302840111640100000000831117156100c857600080fd5b919350915035610185565b604080519115158252519081900360200190f35b610104600480360360208110156100fd57600080fd5b50356101db565b60408051918252519081900360200190f35b6101396004803603604081101561012c57600080fd5b50803590602001356101ed565b005b6101396004803603602081101561015157600080fd5b50356001600160a01b03166102d4565b610169610387565b604080516001600160a01b039092168252519081900360200190f35b60006101d284848080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508a81526001602052604090205492508691506103969050565b95945050505050565b60016020526000908152604090205481565b6000809054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561023a57600080fd5b505afa15801561024e573d6000803e3d6000fd5b505050506040513d602081101561026457600080fd5b50516001600160a01b031633146102c2576040805162461bcd60e51b815260206004820152601f60248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572206f776e657200604482015290519081900360640190fd5b60009182526001602052604090912055565b6000546001600160a01b03163314610333576040805162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c657200000000000000604482015290519081900360640190fd5b600080546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f709181900360200190a150565b6000546001600160a01b031681565b600081815b85518110156104345760008682815181106103b257fe5b602002602001015190508083116103f9578281604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120925061042b565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b5060010161039b565b50909214939250505056fea265627a7a7231582023645c12fe16cb9cd5b455ff3431beef6d545f99c80527001e532557c7e885a164736f6c634300050b0032000000000000000000000000f96d54e490317c557a967abfa5d6e33006be69b3
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80630a02831c1461005c5780631ac79c41146100e75780635824adf41461011657806392eefe9b1461013b578063f77c479114610161575b600080fd5b6100d36004803603606081101561007257600080fd5b8135919081019060408101602082013564010000000081111561009457600080fd5b8201836020820111156100a657600080fd5b803590602001918460208302840111640100000000831117156100c857600080fd5b919350915035610185565b604080519115158252519081900360200190f35b610104600480360360208110156100fd57600080fd5b50356101db565b60408051918252519081900360200190f35b6101396004803603604081101561012c57600080fd5b50803590602001356101ed565b005b6101396004803603602081101561015157600080fd5b50356001600160a01b03166102d4565b610169610387565b604080516001600160a01b039092168252519081900360200190f35b60006101d284848080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508a81526001602052604090205492508691506103969050565b95945050505050565b60016020526000908152604090205481565b6000809054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561023a57600080fd5b505afa15801561024e573d6000803e3d6000fd5b505050506040513d602081101561026457600080fd5b50516001600160a01b031633146102c2576040805162461bcd60e51b815260206004820152601f60248201527f63616c6c6572206d75737420626520436f6e74726f6c6c6572206f776e657200604482015290519081900360640190fd5b60009182526001602052604090912055565b6000546001600160a01b03163314610333576040805162461bcd60e51b815260206004820152601960248201527f63616c6c6572206d75737420626520436f6e74726f6c6c657200000000000000604482015290519081900360640190fd5b600080546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f709181900360200190a150565b6000546001600160a01b031681565b600081815b85518110156104345760008682815181106103b257fe5b602002602001015190508083116103f9578281604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120925061042b565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b5060010161039b565b50909214939250505056fea265627a7a7231582023645c12fe16cb9cd5b455ff3431beef6d545f99c80527001e532557c7e885a164736f6c634300050b0032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f96d54e490317c557a967abfa5d6e33006be69b3
-----Decoded View---------------
Arg [0] : _controller (address): 0xF96D54E490317c557A967ABfA5d6e33006BE69b3
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000f96d54e490317c557a967abfa5d6e33006be69b3
Deployed Bytecode Sourcemap
5634:469:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5634:469:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5926:174;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5926:174:0;;;;;;;;;;;;;;21:11:-1;5:28;;2:2;;;46:1;43;36:12;2:2;5926:174:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;5926:174:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;5926:174:0;;-1:-1:-1;5926:174:0;-1:-1:-1;5926:174:0;;:::i;:::-;;;;;;;;;;;;;;;;;;5676:44;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5676:44:0;;:::i;:::-;;;;;;;;;;;;;;;;5800:118;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5800:118:0;;;;;;;:::i;:::-;;5374:168;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5374:168:0;-1:-1:-1;;;;;5374:168:0;;:::i;4409:29::-;;;:::i;:::-;;;;-1:-1:-1;;;;;4409:29:0;;;;;;;;;;;;;;5926:174;6020:4;6044:48;6063:6;;6044:48;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;-1:-1;6071:13:0;;;:8;:13;;;;;;;-1:-1:-1;6086:5:0;;-1:-1:-1;6044:18:0;;-1:-1:-1;6044:48:0:i;:::-;6037:55;5926:174;-1:-1:-1;;;;;5926:174:0:o;5676:44::-;;;;;;;;;;;;;:::o;5800:118::-;4729:10;;;;;;;;;-1:-1:-1;;;;;4729:10:0;-1:-1:-1;;;;;4729:16:0;;:18;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4729:18:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4729:18:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4729:18:0;-1:-1:-1;;;;;4715:32:0;:10;:32;4707:76;;;;;-1:-1:-1;;;4707:76:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;5889:13;;;;:8;:13;;;;;;:21;5800:118::o;5374:168::-;4552:10;;-1:-1:-1;;;;;4552:10:0;4530;:33;4522:71;;;;;-1:-1:-1;;;4522:71:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;5453:10;:37;;-1:-1:-1;;;;;5453:37:0;;-1:-1:-1;;;;;;5453:37:0;;;;;;;;5508:26;;;;;;;;;;;;;;;;5374:168;:::o;4409:29::-;;;-1:-1:-1;;;;;4409:29:0;;:::o;559:796::-;650:4;690;650;707:525;731:5;:12;727:1;:16;707:525;;;765:20;788:5;794:1;788:8;;;;;;;;;;;;;;765:31;;833:12;817;:28;813:408;;987:12;1001;970:44;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;970:44:0;;;960:55;;;;;;945:70;;813:408;;;1177:12;1191;1160:44;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;1160:44:0;;;1150:55;;;;;;1135:70;;813:408;-1:-1:-1;745:3:0;;707:525;;;-1:-1:-1;1327:20:0;;;;559:796;-1:-1:-1;;;559:796:0:o
Swarm Source
bzzr://23645c12fe16cb9cd5b455ff3431beef6d545f99c80527001e532557c7e885a1
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.