More Info
Private Name Tags
ContractCreator
Sponsored
Latest 25 from a total of 55 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Claim | 13130161 | 755 days 20 hrs ago | IN | 0 ETH | 0.00463346 | ||||
Claim | 13012726 | 774 days 1 min ago | IN | 0 ETH | 0.00331015 | ||||
Claim | 13012715 | 774 days 3 mins ago | IN | 0 ETH | 0.0033097 | ||||
Claim | 12993543 | 776 days 23 hrs ago | IN | 0 ETH | 0.0037933 | ||||
Claim | 12868262 | 796 days 14 hrs ago | IN | 0 ETH | 0.00087201 | ||||
Claim | 12868156 | 796 days 14 hrs ago | IN | 0 ETH | 0.00093895 | ||||
Claim | 12830022 | 802 days 14 hrs ago | IN | 0 ETH | 0.00139041 | ||||
Claim | 12830022 | 802 days 14 hrs ago | IN | 0 ETH | 0.00139022 | ||||
Claim | 12829677 | 802 days 15 hrs ago | IN | 0 ETH | 0.00169213 | ||||
Claim | 12764137 | 812 days 21 hrs ago | IN | 0 ETH | 0.00060785 | ||||
Claim | 12762237 | 813 days 4 hrs ago | IN | 0 ETH | 0.00129169 | ||||
Claim | 12761714 | 813 days 6 hrs ago | IN | 0 ETH | 0.00121644 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00051547 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00051553 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00051545 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00053453 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00053442 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00053449 | ||||
Claim | 12700985 | 822 days 17 hrs ago | IN | 0 ETH | 0.00053468 | ||||
Claim | 12700958 | 822 days 17 hrs ago | IN | 0 ETH | 0.0007549 | ||||
Claim | 12698246 | 823 days 3 hrs ago | IN | 0 ETH | 0.0009167 | ||||
Claim | 12678382 | 826 days 5 hrs ago | IN | 0 ETH | 0.00293733 | ||||
Claim | 12673054 | 827 days 1 hr ago | IN | 0 ETH | 0.00244358 | ||||
Claim | 12672904 | 827 days 2 hrs ago | IN | 0 ETH | 0.00053477 | ||||
Claim | 12672792 | 827 days 2 hrs ago | IN | 0 ETH | 0.00045826 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
MerkleDistributor
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract MerkleDistributor { event Claimed(uint256 index, address account, uint256 amount); address public immutable token; bytes32 public immutable merkleRoot; // This is a packed array of booleans. mapping(uint256 => uint256) private claimedBitMap; constructor(address token_, bytes32 merkleRoot_) { token = token_; merkleRoot = merkleRoot_; } // Returns true if the index has been marked claimed. function isClaimed(uint256 index) public view returns (bool) { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; uint256 claimedWord = claimedBitMap[claimedWordIndex]; uint256 mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint256 index) private { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex); } // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external { require(!isClaimed(index), "MerkleDistributor: Drop already claimed."); // Verify the merkle proof. bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), "MerkleDistributor: Invalid proof."); // Mark it claimed and send the token. _setClaimed(index); require(IERC20(token).transfer(account, amount), "MerkleDistributor: Transfer failed."); emit Claimed(index, account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ 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; } }
{ "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b5060405161071a38038061071a83398101604081905261002f9161004a565b60609190911b6001600160601b03191660805260a052610082565b6000806040838503121561005c578182fd5b82516001600160a01b0381168114610072578283fd5b6020939093015192949293505050565b60805160601c60a0516106646100b660003960008181606b015261020301526000818160c801526102b301526106646000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80632e7ba6ef146100515780632eb4a7ab146100665780639e34070f146100a0578063fc0c546a146100c3575b600080fd5b61006461005f366004610553565b610102565b005b61008d7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100b36100ae36600461053b565b6103d8565b6040519015158152602001610097565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610097565b61010b856103d8565b156101835760405162461bcd60e51b815260206004820152602860248201527f4d65726b6c654469737472696275746f723a2044726f7020616c72656164792060448201527f636c61696d65642e00000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60408051602081018790526bffffffffffffffffffffffff19606087901b16918101919091526054810184905260009060740160405160208183030381529060405280519060200120905061022e8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f000000000000000000000000000000000000000000000000000000000000000092508591506104199050565b6102845760405162461bcd60e51b815260206004820152602160248201527f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f666044820152601760f91b606482015260840161017a565b61028d866104d6565b60405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401602060405180830381600087803b1580156102f757600080fd5b505af115801561030b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032f9190610514565b6103875760405162461bcd60e51b815260206004820152602360248201527f4d65726b6c654469737472696275746f723a205472616e73666572206661696c60448201526232b21760e91b606482015260840161017a565b604080518781526001600160a01b03871660208201529081018590527f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269060600160405180910390a1505050505050565b6000806103e7610100846105f2565b905060006103f76101008561062d565b60009283526020839052604090922054600190921b9182169091149392505050565b600081815b85518110156104cb57600086828151811061044957634e487b7160e01b600052603260045260246000fd5b6020026020010151905080831161048b5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506104b8565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806104c381610606565b91505061041e565b509092149392505050565b60006104e4610100836105f2565b905060006104f46101008461062d565b6000928352602083905260409092208054600190931b9092179091555050565b600060208284031215610525578081fd5b81518015158114610534578182fd5b9392505050565b60006020828403121561054c578081fd5b5035919050565b60008060008060006080868803121561056a578081fd5b8535945060208601356001600160a01b0381168114610587578182fd5b935060408601359250606086013567ffffffffffffffff808211156105aa578283fd5b818801915088601f8301126105bd578283fd5b8135818111156105cb578384fd5b8960208260051b85010111156105df578384fd5b9699959850939650602001949392505050565b60008261060157610601610641565b500490565b600060001982141561062657634e487b7160e01b81526011600452602481fd5b5060010190565b60008261063c5761063c610641565b500690565b634e487b7160e01b600052601260045260246000fdfea164736f6c6343000804000a000000000000000000000000a10ee8a7bfa188e762a7bc7169512222a621fab4d63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80632e7ba6ef146100515780632eb4a7ab146100665780639e34070f146100a0578063fc0c546a146100c3575b600080fd5b61006461005f366004610553565b610102565b005b61008d7fd63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b81565b6040519081526020015b60405180910390f35b6100b36100ae36600461053b565b6103d8565b6040519015158152602001610097565b6100ea7f000000000000000000000000a10ee8a7bfa188e762a7bc7169512222a621fab481565b6040516001600160a01b039091168152602001610097565b61010b856103d8565b156101835760405162461bcd60e51b815260206004820152602860248201527f4d65726b6c654469737472696275746f723a2044726f7020616c72656164792060448201527f636c61696d65642e00000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60408051602081018790526bffffffffffffffffffffffff19606087901b16918101919091526054810184905260009060740160405160208183030381529060405280519060200120905061022e8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507fd63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b92508591506104199050565b6102845760405162461bcd60e51b815260206004820152602160248201527f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f666044820152601760f91b606482015260840161017a565b61028d866104d6565b60405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f000000000000000000000000a10ee8a7bfa188e762a7bc7169512222a621fab4169063a9059cbb90604401602060405180830381600087803b1580156102f757600080fd5b505af115801561030b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032f9190610514565b6103875760405162461bcd60e51b815260206004820152602360248201527f4d65726b6c654469737472696275746f723a205472616e73666572206661696c60448201526232b21760e91b606482015260840161017a565b604080518781526001600160a01b03871660208201529081018590527f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269060600160405180910390a1505050505050565b6000806103e7610100846105f2565b905060006103f76101008561062d565b60009283526020839052604090922054600190921b9182169091149392505050565b600081815b85518110156104cb57600086828151811061044957634e487b7160e01b600052603260045260246000fd5b6020026020010151905080831161048b5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506104b8565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806104c381610606565b91505061041e565b509092149392505050565b60006104e4610100836105f2565b905060006104f46101008461062d565b6000928352602083905260409092208054600190931b9092179091555050565b600060208284031215610525578081fd5b81518015158114610534578182fd5b9392505050565b60006020828403121561054c578081fd5b5035919050565b60008060008060006080868803121561056a578081fd5b8535945060208601356001600160a01b0381168114610587578182fd5b935060408601359250606086013567ffffffffffffffff808211156105aa578283fd5b818801915088601f8301126105bd578283fd5b8135818111156105cb578384fd5b8960208260051b85010111156105df578384fd5b9699959850939650602001949392505050565b60008261060157610601610641565b500490565b600060001982141561062657634e487b7160e01b81526011600452602481fd5b5060010190565b60008261063c5761063c610641565b500690565b634e487b7160e01b600052601260045260246000fdfea164736f6c6343000804000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a10ee8a7bfa188e762a7bc7169512222a621fab4d63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b
-----Decoded View---------------
Arg [0] : token_ (address): 0xa10Ee8A7bFA188E762a7bc7169512222a621Fab4
Arg [1] : merkleRoot_ (bytes32): 0xd63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a10ee8a7bfa188e762a7bc7169512222a621fab4
Arg [1] : d63388cb1525fedac38743e5ff456904a94a1f43e28da6c9cfdb364e786b934b
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ 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.