More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 43,191 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Start | 17752887 | 572 days ago | IN | 0 ETH | 0.0003084 | ||||
Transfer | 12497812 | 1362 days ago | IN | 0.10376993 ETH | 0.001197 | ||||
Transfer | 9402208 | 1839 days ago | IN | 0.17738838 ETH | 0.00001052 | ||||
Generate | 9321965 | 1851 days ago | IN | 0 ETH | 0.00046 | ||||
Generate | 9321942 | 1851 days ago | IN | 0 ETH | 0.0005048 | ||||
Generate | 9321924 | 1851 days ago | IN | 0 ETH | 0.00046 | ||||
Generate | 7939887 | 2074 days ago | IN | 0 ETH | 0.00046 | ||||
Generate | 7866843 | 2086 days ago | IN | 0 ETH | 0.00143514 | ||||
Generate | 7866819 | 2086 days ago | IN | 0 ETH | 0.00143514 | ||||
Transfer | 7424739 | 2155 days ago | IN | 0 ETH | 0.00010733 | ||||
Generate | 7316964 | 2171 days ago | IN | 0 ETH | 0.00014325 | ||||
Generate | 7316952 | 2171 days ago | IN | 0 ETH | 0.00021488 | ||||
Generate | 7316940 | 2171 days ago | IN | 0 ETH | 0.00021488 | ||||
Generate | 7305948 | 2173 days ago | IN | 0 ETH | 0.00021527 | ||||
Generate | 7305937 | 2173 days ago | IN | 0 ETH | 0.00021527 | ||||
Generate | 7247045 | 2185 days ago | IN | 0 ETH | 0.0003591 | ||||
Generate | 7246969 | 2185 days ago | IN | 0 ETH | 0.00007182 | ||||
Transfer | 7089372 | 2218 days ago | IN | 0.00014664 ETH | 0.000042 | ||||
Generate | 6985904 | 2237 days ago | IN | 0 ETH | 0.00021488 | ||||
Generate | 6850936 | 2259 days ago | IN | 0 ETH | 0.00028702 | ||||
Generate | 6850916 | 2259 days ago | IN | 0 ETH | 0.00028702 | ||||
Generate | 6787154 | 2270 days ago | IN | 0 ETH | 0.0003575 | ||||
Generate | 6766482 | 2273 days ago | IN | 0 ETH | 0.00132912 | ||||
Generate | 6766472 | 2273 days ago | IN | 0 ETH | 0.00132912 | ||||
Generate | 6740968 | 2277 days ago | IN | 0 ETH | 0.00024245 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xE999ac1e...0F1cb42F1 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MerkleMine
Compiler Version
v0.4.18+commit.9cf6e910
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-04-30 */ pragma solidity 0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /* * @title MerkleProof * @dev Merkle proof verification * @note Based on https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol */ library MerkleProof { /* * @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves * and each pair of pre-images is sorted. * @param _proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree * @param _root Merkle root * @param _leaf Leaf of Merkle tree */ function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) { // Check if proof length is a multiple of 32 if (_proof.length % 32 != 0) return false; bytes32 proofElement; bytes32 computedHash = _leaf; for (uint256 i = 32; i <= _proof.length; i += 32) { assembly { // Load the current element of the proof proofElement := mload(add(_proof, i)) } if (computedHash < proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(proofElement, computedHash); } } // Check if the computed hash (root) is equal to the provided root return computedHash == _root; } } /** * @title MerkleMine * @dev Token distribution based on providing Merkle proofs of inclusion in genesis state to generate allocation */ contract MerkleMine { using SafeMath for uint256; // ERC20 token being distributed ERC20 public token; // Merkle root representing genesis state which encodes token recipients bytes32 public genesisRoot; // Total amount of tokens that can be generated uint256 public totalGenesisTokens; // Total number of recipients included in genesis state uint256 public totalGenesisRecipients; // Amount of tokens per recipient allocation. Equal to `totalGenesisTokens` / `totalGenesisRecipients` uint256 public tokensPerAllocation; // Minimum ETH balance threshold for recipients included in genesis state uint256 public balanceThreshold; // Block number of genesis - used to determine which ETH accounts are included in the genesis state uint256 public genesisBlock; // Start block where a third party caller (not the recipient) can generate and split the allocation with the recipient // As the current block gets closer to `callerAllocationEndBlock`, the caller receives a larger precentage of the allocation uint256 public callerAllocationStartBlock; // From this block onwards, a third party caller (not the recipient) can generate and claim the recipient's full allocation uint256 public callerAllocationEndBlock; // Number of blocks in the caller allocation period as defined by `callerAllocationEndBlock` - `callerAllocationStartBlock` uint256 public callerAllocationPeriod; // Track if the generation process is started bool public started; // Track the already generated allocations for recipients mapping (address => bool) public generated; // Check that a recipient's allocation has not been generated modifier notGenerated(address _recipient) { require(!generated[_recipient]); _; } // Check that the generation period is started modifier isStarted() { require(started); _; } // Check that the generation period is not started modifier isNotStarted() { require(!started); _; } event Generate(address indexed _recipient, address indexed _caller, uint256 _recipientTokenAmount, uint256 _callerTokenAmount, uint256 _block); /** * @dev MerkleMine constructor * @param _token ERC20 token being distributed * @param _genesisRoot Merkle root representing genesis state which encodes token recipients * @param _totalGenesisTokens Total amount of tokens that can be generated * @param _totalGenesisRecipients Total number of recipients included in genesis state * @param _balanceThreshold Minimum ETH balance threshold for recipients included in genesis state * @param _genesisBlock Block number of genesis - used to determine which ETH accounts are included in the genesis state * @param _callerAllocationStartBlock Start block where a third party caller (not the recipient) can generate and split the allocation with the recipient * @param _callerAllocationEndBlock From this block onwards, a third party caller (not the recipient) can generate and claim the recipient's full allocation */ function MerkleMine( address _token, bytes32 _genesisRoot, uint256 _totalGenesisTokens, uint256 _totalGenesisRecipients, uint256 _balanceThreshold, uint256 _genesisBlock, uint256 _callerAllocationStartBlock, uint256 _callerAllocationEndBlock ) public { // Address of token contract must not be null require(_token != address(0)); // Number of recipients must be non-zero require(_totalGenesisRecipients > 0); // Genesis block must be at or before the current block require(_genesisBlock <= block.number); // Start block for caller allocation must be after current block require(_callerAllocationStartBlock > block.number); // End block for caller allocation must be after caller allocation start block require(_callerAllocationEndBlock > _callerAllocationStartBlock); token = ERC20(_token); genesisRoot = _genesisRoot; totalGenesisTokens = _totalGenesisTokens; totalGenesisRecipients = _totalGenesisRecipients; tokensPerAllocation = _totalGenesisTokens.div(_totalGenesisRecipients); balanceThreshold = _balanceThreshold; genesisBlock = _genesisBlock; callerAllocationStartBlock = _callerAllocationStartBlock; callerAllocationEndBlock = _callerAllocationEndBlock; callerAllocationPeriod = _callerAllocationEndBlock.sub(_callerAllocationStartBlock); } /** * @dev Start the generation period - first checks that this contract's balance is equal to `totalGenesisTokens` * The generation period must not already be started */ function start() external isNotStarted { // Check that this contract has a sufficient balance for the generation period require(token.balanceOf(this) >= totalGenesisTokens); started = true; } /** * @dev Generate a recipient's token allocation. Generation period must be started. Starting from `callerAllocationStartBlock` * a third party caller (not the recipient) can invoke this function to generate the recipient's token * allocation and claim a percentage of it. The percentage of the allocation claimed by the * third party caller is determined by how many blocks have elapsed since `callerAllocationStartBlock`. * After `callerAllocationEndBlock`, a third party caller can claim the full allocation * @param _recipient Recipient of token allocation * @param _merkleProof Proof of recipient's inclusion in genesis state Merkle root */ function generate(address _recipient, bytes _merkleProof) external isStarted notGenerated(_recipient) { // Check the Merkle proof bytes32 leaf = keccak256(_recipient); // _merkleProof must prove inclusion of _recipient in the genesis state root require(MerkleProof.verifyProof(_merkleProof, genesisRoot, leaf)); generated[_recipient] = true; address caller = msg.sender; if (caller == _recipient) { // If the caller is the recipient, transfer the full allocation to the caller/recipient require(token.transfer(_recipient, tokensPerAllocation)); Generate(_recipient, _recipient, tokensPerAllocation, 0, block.number); } else { // If the caller is not the recipient, the token allocation generation // can only take place if we are in the caller allocation period require(block.number >= callerAllocationStartBlock); uint256 callerTokenAmount = callerTokenAmountAtBlock(block.number); uint256 recipientTokenAmount = tokensPerAllocation.sub(callerTokenAmount); if (callerTokenAmount > 0) { require(token.transfer(caller, callerTokenAmount)); } if (recipientTokenAmount > 0) { require(token.transfer(_recipient, recipientTokenAmount)); } Generate(_recipient, caller, recipientTokenAmount, callerTokenAmount, block.number); } } /** * @dev Return the amount of tokens claimable by a third party caller when generating a recipient's token allocation at a given block * @param _blockNumber Block at which to compute the amount of tokens claimable by a third party caller */ function callerTokenAmountAtBlock(uint256 _blockNumber) public view returns (uint256) { if (_blockNumber < callerAllocationStartBlock) { // If the block is before the start of the caller allocation period, the third party caller can claim nothing return 0; } else if (_blockNumber >= callerAllocationEndBlock) { // If the block is at or after the end block of the caller allocation period, the third party caller can claim everything return tokensPerAllocation; } else { // During the caller allocation period, the third party caller can claim an increasing percentage // of the recipient's allocation based on a linear curve - as more blocks pass in the caller allocation // period, the amount claimable by the third party caller increases linearly uint256 blocksSinceCallerAllocationStartBlock = _blockNumber.sub(callerAllocationStartBlock); return tokensPerAllocation.mul(blocksSinceCallerAllocationStartBlock).div(callerAllocationPeriod); } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"started","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_recipient","type":"address"},{"name":"_merkleProof","type":"bytes"}],"name":"generate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"genesisBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"generated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalGenesisTokens","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokensPerAllocation","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"start","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"balanceThreshold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"genesisRoot","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"callerAllocationStartBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"callerAllocationEndBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"callerAllocationPeriod","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_blockNumber","type":"uint256"}],"name":"callerTokenAmountAtBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalGenesisRecipients","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_genesisRoot","type":"bytes32"},{"name":"_totalGenesisTokens","type":"uint256"},{"name":"_totalGenesisRecipients","type":"uint256"},{"name":"_balanceThreshold","type":"uint256"},{"name":"_genesisBlock","type":"uint256"},{"name":"_callerAllocationStartBlock","type":"uint256"},{"name":"_callerAllocationEndBlock","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_recipient","type":"address"},{"indexed":true,"name":"_caller","type":"address"},{"indexed":false,"name":"_recipientTokenAmount","type":"uint256"},{"indexed":false,"name":"_callerTokenAmount","type":"uint256"},{"indexed":false,"name":"_block","type":"uint256"}],"name":"Generate","type":"event"}]
Deployed Bytecode
0x6060604052600436106100c15763ffffffff60e060020a6000350416631f2698ab81146100c65780632c84bfa6146100ed5780634cdc9c631461011a57806362bea2951461013f57806378d8e17b1461015e578063ba88544614610171578063be9a655514610184578063c317377414610197578063c7033721146101aa578063de0cf58b146101bd578063dfc10ea8146101d0578063e4cfe9eb146101e3578063f61cd7de146101f6578063fc0c546a1461020c578063fda962d31461023b575b600080fd5b34156100d157600080fd5b6100d961024e565b604051901515815260200160405180910390f35b34156100f857600080fd5b61011860048035600160a060020a03169060248035908101910135610257565b005b341561012557600080fd5b61012d61064b565b60405190815260200160405180910390f35b341561014a57600080fd5b6100d9600160a060020a0360043516610651565b341561016957600080fd5b61012d610666565b341561017c57600080fd5b61012d61066c565b341561018f57600080fd5b610118610672565b34156101a257600080fd5b61012d610717565b34156101b557600080fd5b61012d61071d565b34156101c857600080fd5b61012d610723565b34156101db57600080fd5b61012d610729565b34156101ee57600080fd5b61012d61072f565b341561020157600080fd5b61012d600435610735565b341561021757600080fd5b61021f6107a4565b604051600160a060020a03909116815260200160405180910390f35b341561024657600080fd5b61012d6107b3565b600a5460ff1681565b600a5460009081908190819060ff16151561027157600080fd5b600160a060020a0387166000908152600b6020526040902054879060ff161561029957600080fd5b87604051600160a060020a03919091166c010000000000000000000000000281526014016040518091039020945073289ba1701c2f088cf0faf8b3705246331cb8a83963101f13e288886001548960006040516020015260405160e060020a63ffffffff871602815260248101839052604481018290526060600482019081526064820185905290819060840186868082843782019150509550505050505060206040518083038186803b151561034f57600080fd5b6102c65a03f4151561036057600080fd5b50505060405180519050151561037557600080fd5b600160a060020a038089166000818152600b60205260409020805460ff1916600117905533955090851614156104935760008054600454600160a060020a039091169163a9059cbb918b916040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561040a57600080fd5b6102c65a03f1151561041b57600080fd5b50505060405180519050151561043057600080fd5b87600160a060020a031688600160a060020a03167f5a85ed1ee645c51ffdeeb66ec8978efd1c03d5069a212315c8b430756d848d6960045460004360405180848152602001838152602001828152602001935050505060405180910390a3610641565b6007544310156104a257600080fd5b6104ab43610735565b6004549093506104c1908463ffffffff6107b916565b915060008311156105545760008054600160a060020a03169063a9059cbb90869086906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561052e57600080fd5b6102c65a03f1151561053f57600080fd5b50505060405180519050151561055457600080fd5b60008211156105e55760008054600160a060020a03169063a9059cbb908a9085906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156105bf57600080fd5b6102c65a03f115156105d057600080fd5b5050506040518051905015156105e557600080fd5b83600160a060020a031688600160a060020a03167f5a85ed1ee645c51ffdeeb66ec8978efd1c03d5069a212315c8b430756d848d6984864360405180848152602001838152602001828152602001935050505060405180910390a35b5050505050505050565b60065481565b600b6020526000908152604090205460ff1681565b60025481565b60045481565b600a5460ff161561068257600080fd5b60025460008054600160a060020a0316906370a082319030906040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156106e057600080fd5b6102c65a03f115156106f157600080fd5b505050604051805190501015151561070857600080fd5b600a805460ff19166001179055565b60055481565b60015481565b60075481565b60085481565b60095481565b60008060075483101561074b576000915061079e565b600854831061075e57600454915061079e565b60075461077290849063ffffffff6107b916565b905061079b60095461078f836004546107cb90919063ffffffff16565b9063ffffffff61080116565b91505b50919050565b600054600160a060020a031681565b60035481565b6000828211156107c557fe5b50900390565b6000808315156107de57600091506107fa565b508282028284828115156107ee57fe5b04146107f657fe5b8091505b5092915050565b600080828481151561080f57fe5b049493505050505600a165627a7a723058205d35076b8b058765077c4b44ba0e998f34f5dd270b87b2ee61142443fb50b8620029
Swarm Source
bzzr://5d35076b8b058765077c4b44ba0e998f34f5dd270b87b2ee61142443fb50b862
Loading...
Loading
Loading...
Loading
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.