Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 69,278 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Multi Generate | 7294768 | 2123 days ago | IN | 0 ETH | 0.00010996 | ||||
Multi Generate | 6441060 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441056 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441054 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441047 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441034 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441025 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441018 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441008 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441003 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6441000 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440992 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440990 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440987 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440985 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440983 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440976 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440961 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440943 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440938 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440925 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440920 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440918 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440911 | 2275 days ago | IN | 0 ETH | 0.0004446 | ||||
Multi Generate | 6440898 | 2275 days ago | IN | 0 ETH | 0.0004446 |
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 0x182EBF4C...0e31e8c7F The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MultiMerkleMine
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-07-26 */ pragma solidity 0.4.24; /** * @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); } } } /** * @title BytesUtil * @dev Utilities for extracting bytes from byte arrays * Functions taken from: * - https://github.com/ethereum/solidity-examples/blob/master/src/unsafe/Memory.sol * - https://github.com/ethereum/solidity-examples/blob/master/src/bytes/Bytes.sol */ library BytesUtil{ uint256 internal constant BYTES_HEADER_SIZE = 32; uint256 internal constant WORD_SIZE = 32; /** * @dev Returns a memory pointer to the data portion of the provided bytes array. * @param bts Memory byte array */ function dataPtr(bytes memory bts) internal pure returns (uint256 addr) { assembly { addr := add(bts, /*BYTES_HEADER_SIZE*/ 32) } } /** * @dev Copy 'len' bytes from memory address 'src', to address 'dest'. * This function does not check the or destination, it only copies * the bytes. * @param src Memory address of source byte array * @param dest Memory address of destination byte array * @param len Number of bytes to copy from `src` to `dest` */ function copy(uint256 src, uint256 dest, uint256 len) internal pure { // Copy word-length chunks while possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } dest += WORD_SIZE; src += WORD_SIZE; } // Copy remaining bytes uint256 mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } /** * @dev Creates a 'bytes memory' variable from the memory address 'addr', with the * length 'len'. The function will allocate new memory for the bytes array, and * the 'len bytes starting at 'addr' will be copied into that new memory. * @param addr Memory address of input byte array * @param len Number of bytes to copy from input byte array */ function toBytes(uint256 addr, uint256 len) internal pure returns (bytes memory bts) { bts = new bytes(len); uint256 btsptr = dataPtr(bts); copy(addr, btsptr, len); } /** * @dev Copies 'len' bytes from 'bts' into a new array, starting at the provided 'startIndex'. * Returns the new copy. * Requires that: * - 'startIndex + len <= self.length' * The length of the substring is: 'len' * @param bts Memory byte array to copy from * @param startIndex Index of `bts` to start copying bytes from * @param len Number of bytes to copy from `bts` */ function substr(bytes memory bts, uint256 startIndex, uint256 len) internal pure returns (bytes memory) { require(startIndex + len <= bts.length); if (len == 0) { return; } uint256 addr = dataPtr(bts); return toBytes(addr + startIndex, len); } /** * @dev Reads a bytes32 value from a byte array by copying 32 bytes from `bts` starting at the provided `startIndex`. * @param bts Memory byte array to copy from * @param startIndex Index of `bts` to start copying bytes from */ function readBytes32(bytes memory bts, uint256 startIndex) internal pure returns (bytes32 result) { require(startIndex + 32 <= bts.length); uint256 addr = dataPtr(bts); assembly { result := mload(add(addr, startIndex)) } return result; } } /** * @title MultiMerkleMine * @dev The MultiMerkleMine contract is purely a convenience wrapper around an existing MerkleMine contract deployed on the blockchain. */ contract MultiMerkleMine { using SafeMath for uint256; /** * @dev Generates token allocations for multiple recipients. Generation period must be started. * @param _merkleMineContract Address of the deployed MerkleMine contract * @param _recipients Array of recipients * @param _merkleProofs Proofs for respective recipients constructed in the format: * [proof_1_size, proof_1, proof_2_size, proof_2, ... , proof_n_size, proof_n] */ function multiGenerate(address _merkleMineContract, address[] _recipients, bytes _merkleProofs) public { MerkleMine mine = MerkleMine(_merkleMineContract); ERC20 token = ERC20(mine.token()); require( block.number >= mine.callerAllocationStartBlock(), "caller allocation period has not started" ); uint256 initialBalance = token.balanceOf(this); bytes[] memory proofs = new bytes[](_recipients.length); // Counter to keep track of position in `_merkleProofs` byte array uint256 i = 0; // Counter to keep track of index of each extracted Merkle proof uint256 j = 0; // Extract proofs while(i < _merkleProofs.length){ uint256 proofSize = uint256(BytesUtil.readBytes32(_merkleProofs, i)); require( proofSize % 32 == 0, "proof size must be a multiple of 32" ); proofs[j] = BytesUtil.substr(_merkleProofs, i + 32, proofSize); i = i + 32 + proofSize; j++; } require( _recipients.length == j, "number of recipients != number of proofs" ); for (uint256 k = 0; k < _recipients.length; k++) { // If recipient's token allocation has not been generated, generate the token allocation // Else, continue to the next recipient if (!mine.generated(_recipients[k])) { mine.generate(_recipients[k], proofs[k]); } } uint256 newBalanceSinceAllocation = token.balanceOf(this); uint256 callerTokensGenerated = newBalanceSinceAllocation.sub(initialBalance); // Transfer caller's portion of tokens generated by this function call if (callerTokensGenerated > 0) { require(token.transfer(msg.sender, callerTokensGenerated)); } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":false,"inputs":[{"name":"_merkleMineContract","type":"address"},{"name":"_recipients","type":"address[]"},{"name":"_merkleProofs","type":"bytes"}],"name":"multiGenerate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f725839f14610046575b600080fd5b34801561005257600080fd5b50610110600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610112565b005b600080600060606000806000806000808c99508973ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561018957600080fd5b505af115801561019d573d6000803e3d6000fd5b505050506040513d60208110156101b357600080fd5b810190808051906020019092919050505098508973ffffffffffffffffffffffffffffffffffffffff1663de0cf58b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d602081101561025457600080fd5b81019080805190602001909291905050504310151515610302576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c657220616c6c6f636174696f6e20706572696f6420686173206e6f7481526020017f207374617274656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8873ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561039d57600080fd5b505af11580156103b1573d6000803e3d6000fd5b505050506040513d60208110156103c757600080fd5b810190808051906020019092919050505097508b5160405190808252806020026020018201604052801561040f57816020015b60608152602001906001900390816103fa5790505b50965060009550600094505b8a5186101561051c5761042e8b87610a06565b600190049350600060208581151561044257fe5b061415156104de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f70726f6f662073697a65206d7573742062652061206d756c7469706c65206f6681526020017f203332000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6104ec8b6020880186610a37565b87868151811015156104fa57fe5b906020019060200201819052508360208701019550848060010195505061041b565b848c511415156105ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f6e756d626572206f6620726563697069656e747320213d206e756d626572206f81526020017f662070726f6f667300000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600092505b8b51831015610817578973ffffffffffffffffffffffffffffffffffffffff166362bea2958d858151811015156105f257fe5b906020019060200201516040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561067a57600080fd5b505af115801561068e573d6000803e3d6000fd5b505050506040513d60208110156106a457600080fd5b8101908080519060200190929190505050151561080a578973ffffffffffffffffffffffffffffffffffffffff16632c84bfa68d858151811015156106e557fe5b9060200190602002015189868151811015156106fd57fe5b906020019060200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156107a4578082015181840152602081019050610789565b50505050905090810190601f1680156107d15780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156107f157600080fd5b505af1158015610805573d6000803e3d6000fd5b505050505b82806001019350506105bf565b8873ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156108b257600080fd5b505af11580156108c6573d6000803e3d6000fd5b505050506040513d60208110156108dc57600080fd5b810190808051906020019092919050505091506109028883610a7d90919063ffffffff16565b905060008111156109f7578873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156109b057600080fd5b505af11580156109c4573d6000803e3d6000fd5b505050506040513d60208110156109da57600080fd5b810190808051906020019092919050505015156109f657600080fd5b5b50505050505050505050505050565b60008083516020840111151515610a1c57600080fd5b610a2584610a96565b90508281015191508191505092915050565b60606000845183850111151515610a4d57600080fd5b6000831415610a5b57610a75565b610a6485610a96565b9050610a7284820184610aa3565b91505b509392505050565b6000828211151515610a8b57fe5b818303905092915050565b6000602082019050919050565b60606000826040519080825280601f01601f191660200182016040528015610ada5781602001602082028038833980820191505090505b509150610ae682610a96565b9050610af3848285610afa565b5092915050565b60005b602082101515610b225783518352602083019250602084019350602082039150610afd565b6001826020036101000a03905080198451168184511681811785525050505050505600a165627a7a723058203d8784cc2ee440d8fd9a5735fce92aa140c837350e6c2b6d292a0bc860aa404a0029
Swarm Source
bzzr://3d8784cc2ee440d8fd9a5735fce92aa140c837350e6c2b6d292a0bc860aa404a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.