ETH Price: $1,993.70 (-2.65%)

Contract

0x2A398bBa1236890fb6e9698A698A393Bb8ee8674
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Age:90D
Reset Filter

Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Age:90D
Reset Filter

Advanced mode:
Parent Transaction Hash Method Block
From
To

There are no matching entries

Update your filters to view other transactions

View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MerkleDistributor

Compiler Version
v0.7.4+commit.3f05b770

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
/**
 *Submitted for verification at Etherscan.io on 2020-12-07
*/

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


pragma solidity ^0.7.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);
}

// File: @openzeppelin/contracts/cryptography/MerkleProof.sol


pragma solidity ^0.7.0;

/**
 * @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/interfaces/IMerkleDistributor.sol

pragma solidity ^0.7.4;

// Allows anyone to claim a token if they exist in a merkle root.
interface IMerkleDistributor {
    // Returns the address of the token distributed by this contract.
    function token() external view returns (address);

    // Returns the merkle root of the merkle tree containing account balances available to claim.
    function merkleRoot() external view returns (bytes32);

    // Returns the start time of distribution
    function startTime() external view returns (uint256);

    // Returns true if the index has been marked claimed.
    function isClaimed(uint256 index) external view returns (bool);

    // 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;

    // This event is triggered whenever a call to #claim succeeds.
    event Claimed(uint256 index, address account, uint256 amount);
}

// File: contracts/distributor/MerkleDistributor.sol

pragma solidity ^0.7.4;




contract MerkleDistributor is IMerkleDistributor {
    address public immutable override token;
    bytes32 public immutable override merkleRoot;
    uint256 public immutable override startTime;

    // This is a packed array of booleans.
    mapping(uint256 => uint256) private claimedBitMap;

    constructor(address token_, bytes32 merkleRoot_, uint256 startTime_) {
        token = token_;
        merkleRoot = merkleRoot_;
        startTime = startTime_;
    }

    function isClaimed(uint256 index) public override 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);
    }

    function claim(
        uint256 index,
        address account,
        uint256 amount,
        bytes32[] calldata merkleProof
    ) external override {
        require(block.timestamp >= startTime, "MerkleDistributor: Distribution not started yet");
        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);
    }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"},{"internalType":"uint256","name":"startTime_","type":"uint256"}],"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":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e060405234801561001057600080fd5b506040516106ed3803806106ed8339818101604052606081101561003357600080fd5b5080516020820151604090920151606082901b6001600160601b03191660805260a083905260c08190526001600160a01b03909116919061065161009c60003980610163528061044452508061028152806104205250806102f2528061048e52506106516000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e7ba6ef1461005c5780632eb4a7ab146100ea57806378e97925146101045780639e34070f1461010c578063fc0c546a1461013d575b600080fd5b6100e86004803603608081101561007257600080fd5b8135916001600160a01b0360208201351691604082013591908101906080810160608201356401000000008111156100a957600080fd5b8201836020820111156100bb57600080fd5b803590602001918460208302840111640100000000831117156100dd57600080fd5b509092509050610161565b005b6100f261041e565b60408051918252519081900360200190f35b6100f2610442565b6101296004803603602081101561012257600080fd5b5035610466565b604080519115158252519081900360200190f35b61014561048c565b604080516001600160a01b039092168252519081900360200190f35b7f00000000000000000000000000000000000000000000000000000000000000004210156101c05760405162461bcd60e51b815260040180806020018281038252602f8152602001806105ed602f913960400191505060405180910390fd5b6101c985610466565b156102055760405162461bcd60e51b81526004018080602001828103825260288152602001806105816028913960400191505060405180910390fd5b600085858560405160200180848152602001836001600160a01b031660601b815260140182815260200193505050506040516020818303038152906040528051906020012090506102ac8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f000000000000000000000000000000000000000000000000000000000000000092508591506104b09050565b6102e75760405162461bcd60e51b81526004018080602001828103825260218152602001806105a96021913960400191505060405180910390fd5b6102f086610559565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561036757600080fd5b505af115801561037b573d6000803e3d6000fd5b505050506040513d602081101561039157600080fd5b50516103ce5760405162461bcd60e51b81526004018080602001828103825260238152602001806105ca6023913960400191505060405180910390fd5b604080518781526001600160a01b038716602082015280820186905290517f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269181900360600190a1505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6101008104600090815260208190526040902054600160ff9092169190911b9081161490565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081815b855181101561054e5760008682815181106104cc57fe5b602002602001015190508083116105135782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610545565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b506001016104b5565b509092149392505050565b610100810460009081526020819052604090208054600160ff9093169290921b909117905556fe4d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e4d65726b6c654469737472696275746f723a205472616e73666572206661696c65642e4d65726b6c654469737472696275746f723a20446973747269627574696f6e206e6f74207374617274656420796574a2646970667358221220269e02b8d1b0fb78971999ccb974e9eff95b000ba800e2b7795edf29b4bd6fbf64736f6c6343000704003300000000000000000000000009a3ecafa817268f77be1283176b946c4ff2e60849a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee5000000000000000000000000000000000000000000000000000000005fc935b0

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80632e7ba6ef1461005c5780632eb4a7ab146100ea57806378e97925146101045780639e34070f1461010c578063fc0c546a1461013d575b600080fd5b6100e86004803603608081101561007257600080fd5b8135916001600160a01b0360208201351691604082013591908101906080810160608201356401000000008111156100a957600080fd5b8201836020820111156100bb57600080fd5b803590602001918460208302840111640100000000831117156100dd57600080fd5b509092509050610161565b005b6100f261041e565b60408051918252519081900360200190f35b6100f2610442565b6101296004803603602081101561012257600080fd5b5035610466565b604080519115158252519081900360200190f35b61014561048c565b604080516001600160a01b039092168252519081900360200190f35b7f000000000000000000000000000000000000000000000000000000005fc935b04210156101c05760405162461bcd60e51b815260040180806020018281038252602f8152602001806105ed602f913960400191505060405180910390fd5b6101c985610466565b156102055760405162461bcd60e51b81526004018080602001828103825260288152602001806105816028913960400191505060405180910390fd5b600085858560405160200180848152602001836001600160a01b031660601b815260140182815260200193505050506040516020818303038152906040528051906020012090506102ac8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f49a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee592508591506104b09050565b6102e75760405162461bcd60e51b81526004018080602001828103825260218152602001806105a96021913960400191505060405180910390fd5b6102f086610559565b7f00000000000000000000000009a3ecafa817268f77be1283176b946c4ff2e6086001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561036757600080fd5b505af115801561037b573d6000803e3d6000fd5b505050506040513d602081101561039157600080fd5b50516103ce5760405162461bcd60e51b81526004018080602001828103825260238152602001806105ca6023913960400191505060405180910390fd5b604080518781526001600160a01b038716602082015280820186905290517f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269181900360600190a1505050505050565b7f49a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee581565b7f000000000000000000000000000000000000000000000000000000005fc935b081565b6101008104600090815260208190526040902054600160ff9092169190911b9081161490565b7f00000000000000000000000009a3ecafa817268f77be1283176b946c4ff2e60881565b600081815b855181101561054e5760008682815181106104cc57fe5b602002602001015190508083116105135782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610545565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b506001016104b5565b509092149392505050565b610100810460009081526020819052604090208054600160ff9093169290921b909117905556fe4d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e4d65726b6c654469737472696275746f723a205472616e73666572206661696c65642e4d65726b6c654469737472696275746f723a20446973747269627574696f6e206e6f74207374617274656420796574a2646970667358221220269e02b8d1b0fb78971999ccb974e9eff95b000ba800e2b7795edf29b4bd6fbf64736f6c63430007040033

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

00000000000000000000000009a3ecafa817268f77be1283176b946c4ff2e60849a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee5000000000000000000000000000000000000000000000000000000005fc935b0

-----Decoded View---------------
Arg [0] : token_ (address): 0x09a3EcAFa817268f77BE1283176B946C4ff2E608
Arg [1] : merkleRoot_ (bytes32): 0x49a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee5
Arg [2] : startTime_ (uint256): 1607022000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000009a3ecafa817268f77be1283176b946c4ff2e608
Arg [1] : 49a1e0e885953b96669a39bf383afabf9b604df593c34285c6f1664fbb400ee5
Arg [2] : 000000000000000000000000000000000000000000000000000000005fc935b0


Deployed Bytecode Sourcemap

5342:1977:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6450:866;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;6450:866:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6450:866:0;;-1:-1:-1;6450:866:0;-1:-1:-1;6450:866:0;:::i;:::-;;5444:44;;;:::i;:::-;;;;;;;;;;;;;;;;5495:43;;;:::i;5827:331::-;;;;;;;;;;;;;;;;-1:-1:-1;5827:331:0;;:::i;:::-;;;;;;;;;;;;;;;;;;5398:39;;;:::i;:::-;;;;-1:-1:-1;;;;;5398:39:0;;;;;;;;;;;;;;6450:866;6644:9;6625:15;:28;;6617:88;;;;-1:-1:-1;;;6617:88:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6725:16;6735:5;6725:9;:16::i;:::-;6724:17;6716:70;;;;-1:-1:-1;;;6716:70:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6836:12;6878:5;6885:7;6894:6;6861:40;;;;;;;;;;;-1:-1:-1;;;;;6861:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6851:51;;;;;;6836:66;;6935:49;6954:11;;6935:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6967:10:0;;-1:-1:-1;6979:4:0;;-1:-1:-1;6935:18:0;;-1:-1:-1;6935:49:0:i;:::-;6913:132;;;;-1:-1:-1;;;6913:132:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7106:18;7118:5;7106:11;:18::i;:::-;7164:5;-1:-1:-1;;;;;7157:22:0;;7180:7;7189:6;7157:39;;;;;;;;;;;;;-1:-1:-1;;;;;7157:39:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7157:39:0;7135:124;;;;-1:-1:-1;;;7135:124:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7277:31;;;;;;-1:-1:-1;;;;;7277:31:0;;;;;;;;;;;;;;;;;;;;;;;6450:866;;;;;;:::o;5444:44::-;;;:::o;5495:43::-;;;:::o;5827:331::-;5943:3;5935:11;;5891:4;6027:31;;;;;;;;;;;6085:1;5983:11;;;;6085:20;;;;6124:18;;;:26;;5827:331::o;5398:39::-;;;:::o;3344:796::-;3435:4;3475;3435;3492:525;3516:5;:12;3512:1;:16;3492:525;;;3550:20;3573:5;3579:1;3573:8;;;;;;;;;;;;;;3550:31;;3618:12;3602;:28;3598:408;;3772:12;3786;3755:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3745:55;;;;;;3730:70;;3598:408;;;3962:12;3976;3945:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3935:55;;;;;;3920:70;;3598:408;-1:-1:-1;3530:3:0;;3492:525;;;-1:-1:-1;4112:20:0;;;;3344:796;-1:-1:-1;;;3344:796:0:o;6166:276::-;6256:3;6248:11;;6221:24;6365:31;;;;;;;;;;;;6413:1;6296:11;;;;6413:20;;;;6365:69;;;6318:116;;6166:276::o

Swarm Source

ipfs://269e02b8d1b0fb78971999ccb974e9eff95b000ba800e2b7795edf29b4bd6fbf

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.