Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x37242928893d9e8e3Fc918a1EC535dE203fCf2ea
Balance 0 ETH
Nonce 1
Code Size 5288 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

5288 bytes
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063c147e5321161008c578063e94cdc7f11610066578063e94cdc7f146101da578063ebf0c717146101f6578063f2fde38b14610214578063fc0c546a14610230576100cf565b8063c147e53214610182578063d2855c15146101a0578063dab5f340146101be576100cf565b806304e86903146100d4578063144fa6d7146101045780633b43935114610120578063715018a61461013c5780638da5cb5b146101465780639d3d53a514610164575b600080fd5b6100ee60048036038101906100e99190610be0565b61024e565b6040516100fb9190610c26565b60405180910390f35b61011e60048036038101906101199190610be0565b610266565b005b61013a60048036038101906101359190610cd2565b6102b2565b005b6101446105b9565b005b61014e6105cd565b60405161015b9190610d41565b60405180910390f35b61016c6105f6565b6040516101799190610c26565b60405180910390f35b61018a6105fc565b6040516101979190610c26565b60405180910390f35b6101a8610602565b6040516101b59190610c26565b60405180910390f35b6101d860048036038101906101d39190610d92565b610608565b005b6101f460048036038101906101ef9190610dbf565b61061a565b005b6101fe61062c565b60405161020b9190610dfb565b60405180910390f35b61022e60048036038101906102299190610be0565b610632565b005b6102386106b5565b6040516102459190610d41565b60405180910390f35b60036020528060005260406000206000915090505481565b61026e6106db565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033826040516020016102c7929190610e7f565b60405160208183030381529060405280519060200120905061032d848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505060015483610759565b61036c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036390610f08565b60405180910390fd5b610398600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630610770565b6006546103a59190610f57565b60055410156103ee576103da600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630610770565b6006546103e79190610f57565b6005819055505b6000600454600554846104019190610f8b565b61040b9190610ffc565b905080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561057757600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548161049f919061102d565b600660008282546104b09190610f57565b9250508190555061052e600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484610529919061102d565b6108bf565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105b2565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a9906110ad565b60405180910390fd5b5050505050565b6105c16106db565b6105cb6000610a14565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60045481565b60055481565b60065481565b6106106106db565b8060018190555050565b6106226106db565b8060048190555050565b60015481565b61063a6106db565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036106a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106a09061113f565b60405180910390fd5b6106b281610a14565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6106e3610ad8565b73ffffffffffffffffffffffffffffffffffffffff166107016105cd565b73ffffffffffffffffffffffffffffffffffffffff1614610757576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074e906111ab565b60405180910390fd5b565b6000826107668584610ae0565b1490509392505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff166370a0823160e01b856040516024016107a59190610d41565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161080f919061123c565b600060405180830381855afa9150503d806000811461084a576040519150601f19603f3d011682016040523d82523d6000602084013e61084f565b606091505b5091509150818015610862575060008151115b6108a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108989061129f565b60405180910390fd5b808060200190518101906108b591906112d4565b9250505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b85856040516024016108f4929190611301565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161095e919061123c565b6000604051808303816000865af19150503d806000811461099b576040519150601f19603f3d011682016040523d82523d6000602084013e6109a0565b606091505b50915091508180156109ce57506000815114806109cd5750808060200190518101906109cc9190611362565b5b5b610a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a04906113db565b60405180910390fd5b5050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008082905060005b8451811015610b2b57610b1682868381518110610b0957610b086113fb565b5b6020026020010151610b36565b91508080610b239061142a565b915050610ae9565b508091505092915050565b6000818310610b4e57610b498284610b61565b610b59565b610b588383610b61565b5b905092915050565b600082600052816020526040600020905092915050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610bad82610b82565b9050919050565b610bbd81610ba2565b8114610bc857600080fd5b50565b600081359050610bda81610bb4565b92915050565b600060208284031215610bf657610bf5610b78565b5b6000610c0484828501610bcb565b91505092915050565b6000819050919050565b610c2081610c0d565b82525050565b6000602082019050610c3b6000830184610c17565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610c6657610c65610c41565b5b8235905067ffffffffffffffff811115610c8357610c82610c46565b5b602083019150836020820283011115610c9f57610c9e610c4b565b5b9250929050565b610caf81610c0d565b8114610cba57600080fd5b50565b600081359050610ccc81610ca6565b92915050565b600080600060408486031215610ceb57610cea610b78565b5b600084013567ffffffffffffffff811115610d0957610d08610b7d565b5b610d1586828701610c50565b93509350506020610d2886828701610cbd565b9150509250925092565b610d3b81610ba2565b82525050565b6000602082019050610d566000830184610d32565b92915050565b6000819050919050565b610d6f81610d5c565b8114610d7a57600080fd5b50565b600081359050610d8c81610d66565b92915050565b600060208284031215610da857610da7610b78565b5b6000610db684828501610d7d565b91505092915050565b600060208284031215610dd557610dd4610b78565b5b6000610de384828501610cbd565b91505092915050565b610df581610d5c565b82525050565b6000602082019050610e106000830184610dec565b92915050565b60008160601b9050919050565b6000610e2e82610e16565b9050919050565b6000610e4082610e23565b9050919050565b610e58610e5382610ba2565b610e35565b82525050565b6000819050919050565b610e79610e7482610c0d565b610e5e565b82525050565b6000610e8b8285610e47565b601482019150610e9b8284610e68565b6020820191508190509392505050565b600082825260208201905092915050565b7f496e76616c69642070726f6f6600000000000000000000000000000000000000600082015250565b6000610ef2600d83610eab565b9150610efd82610ebc565b602082019050919050565b60006020820190508181036000830152610f2181610ee5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f6282610c0d565b9150610f6d83610c0d565b9250828201905080821115610f8557610f84610f28565b5b92915050565b6000610f9682610c0d565b9150610fa183610c0d565b9250828202610faf81610c0d565b91508282048414831517610fc657610fc5610f28565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061100782610c0d565b915061101283610c0d565b92508261102257611021610fcd565b5b828204905092915050565b600061103882610c0d565b915061104383610c0d565b925082820390508181111561105b5761105a610f28565b5b92915050565b7f416c726561647920636c61696d65640000000000000000000000000000000000600082015250565b6000611097600f83610eab565b91506110a282611061565b602082019050919050565b600060208201905081810360008301526110c68161108a565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611129602683610eab565b9150611134826110cd565b604082019050919050565b600060208201905081810360008301526111588161111c565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611195602083610eab565b91506111a08261115f565b602082019050919050565b600060208201905081810360008301526111c481611188565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156111ff5780820151818401526020810190506111e4565b60008484015250505050565b6000611216826111cb565b61122081856111d6565b93506112308185602086016111e1565b80840191505092915050565b6000611248828461120b565b915081905092915050565b7f5347420000000000000000000000000000000000000000000000000000000000600082015250565b6000611289600383610eab565b915061129482611253565b602082019050919050565b600060208201905081810360008301526112b88161127c565b9050919050565b6000815190506112ce81610ca6565b92915050565b6000602082840312156112ea576112e9610b78565b5b60006112f8848285016112bf565b91505092915050565b60006040820190506113166000830185610d32565b6113236020830184610c17565b9392505050565b60008115159050919050565b61133f8161132a565b811461134a57600080fd5b50565b60008151905061135c81611336565b92915050565b60006020828403121561137857611377610b78565b5b60006113868482850161134d565b91505092915050565b7f5446000000000000000000000000000000000000000000000000000000000000600082015250565b60006113c5600283610eab565b91506113d08261138f565b602082019050919050565b600060208201905081810360008301526113f4816113b8565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061143582610c0d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361146757611466610f28565b5b60018201905091905056fea2646970667358221220929b1ce82fe6726ba0c940e1c1f9181492069db22885faf093a9a29448dea20664736f6c63430008110033

Verified Source Code Partial Match

Compiler: v0.8.17+commit.8df45f5f EVM: london Optimization: No
Airdrop.sol 506 lines
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;


/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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


// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
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) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// File: contracts/airdrop.sol


pragma solidity ^0.8.0;





contract Airdrop is Ownable {

    bytes32 public root;

    address public token;
    mapping(address => uint256) public claimedAmount;

    uint256 public totalTokensToBeDistributed;

    uint256 public tokensAlreadyReceived;
    uint256 public tokensAlreadyClaimed;

    constructor(bytes32 _root, address _token, uint256 _totalTokensToBeDistributed) {
        root = _root;
        token = _token;
        totalTokensToBeDistributed = _totalTokensToBeDistributed;
    }

    function claim(bytes32[] calldata proof, uint256 amount) public {
        bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
        require(MerkleProof.verify(proof, root, leaf), "Invalid proof");

        if (tokensAlreadyReceived < tokensAlreadyClaimed + safeGetBalance(token, address(this))) {
            tokensAlreadyReceived = tokensAlreadyClaimed + safeGetBalance(token, address(this));
        }

        uint256 amountToClaim = amount * tokensAlreadyReceived  / totalTokensToBeDistributed;

        if (claimedAmount[msg.sender] < amountToClaim) {
            tokensAlreadyClaimed += amountToClaim - claimedAmount[msg.sender];
            safeTransfer(token, msg.sender, amountToClaim - claimedAmount[msg.sender]);
            claimedAmount[msg.sender] = amountToClaim;
        } else {
            revert("Already claimed");
        }
    }

    function setRoot(bytes32 _root) public onlyOwner {
        root = _root;
    }

    function setToken(address _token) public onlyOwner {
        token = _token;
    }

    function setTotalTokensToBeDistributed(uint256 _totalTokensToBeDistributed) public onlyOwner {
        totalTokensToBeDistributed = _totalTokensToBeDistributed;
    }

    //support

    function safeTransfer(
        address _token,
        address _to,
        uint256 _value
    ) internal {
        (bool success, bytes memory data) = _token.call(
            abi.encodeWithSelector(IERC20.transfer.selector, _to, _value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TF');
    }

    function safeGetBalance(
        address _token,
        address _account
    ) internal view returns (uint256) {
        (bool success, bytes memory data) = _token.staticcall(
            abi.encodeWithSelector(IERC20.balanceOf.selector, _account)
        );
        require(success && (data.length > 0), 'SGB');
        return abi.decode(data, (uint256));
    }

}

Read Contract

claimedAmount 0x04e86903 → uint256
owner 0x8da5cb5b → address
root 0xebf0c717 → bytes32
token 0xfc0c546a → address
tokensAlreadyClaimed 0xd2855c15 → uint256
tokensAlreadyReceived 0xc147e532 → uint256
totalTokensToBeDistributed 0x9d3d53a5 → uint256

Write Contract 6 functions

These functions modify contract state and require a wallet transaction to execute.

claim 0x3b439351
bytes32[] proof
uint256 amount
renounceOwnership 0x715018a6
No parameters
setRoot 0xdab5f340
bytes32 _root
setToken 0x144fa6d7
address _token
setTotalTokensToBeDistributed 0xe94cdc7f
uint256 _totalTokensToBeDistributed
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address