ETH Price: $2,732.04 (+0.91%)

Contract

0xf99D5033835B82A318A06A7a33218324b7FeD2Af
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

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 0x6f7cBC40...1Fc0C4A2B
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Claiming

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-09-07
*/

/**
 *Submitted for verification at BscScan.com on 2022-07-26
*/

// File: @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol


// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

// File: @openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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-upgradeable/utils/StringsUpgradeable.sol


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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

// File: @openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol


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

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.
 *
 * 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.
 */
library MerkleProofUpgradeable {
    /**
     * @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 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++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol


// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol


// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;


/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

// File: @openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;



/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// File: @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// File: @openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol


// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;






/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// File: @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol


// OpenZeppelin Contracts v4.4.1 (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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// File: @openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol


// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;



/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// File: @openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol


// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;


/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// File: contracts/Claiming.sol


pragma solidity 0.8.9;










contract Claiming is Initializable, ContextUpgradeable, OwnableUpgradeable, AccessControlUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
    using StringsUpgradeable for uint16;
    using StringsUpgradeable for uint256;

    bytes32 public constant LOCKER_ROLE = keccak256("LOCKER_ROLE");
    uint256 public constant denominator = 100000000;
    bool public isAllowedWithdraw;

    struct DistributorSettings {
        bytes32 claimingWalletsMerkleRoot; // Root Merkle Tree: WalletAddress|Balance
        uint256 unlocksNumber; // UnlocksNumber = 2
        uint256 lastRootUpdate;
        bool paused;
    }

    struct UnlockPeriod {
        uint256 startDate;
        uint256 totalPercentage;
        uint256 endDate;
        uint256 periodUnit;
        bool isUnlockedBeforeStart;
    }

    struct Claim {
        uint256 totalClaimed;
    }

    struct Wallet {
        bool isGraylisted;
        uint256 lastWalletUpdate;
    }

    address distributorAddress;
    DistributorSettings distributorSetting;
    mapping(uint256 => UnlockPeriod) unlocks;
    mapping(address => Claim) claims; // claims[wallet]
    mapping(address => Wallet) wallets; // wallets[wallet];
    mapping(address => address) walletInfo; // walletInfo[currentWallet]

    event UnlockPeriodChanged(uint256 indexed _periodIndex, uint256 _vestingStartDate, uint256 _totalPercentage, uint256 _cliffEndDate, uint256 _periodUnit, bool _isUnlocked);
    event Claimed(address indexed sender, uint256 _amount);
    event TokensWithdrawn(uint256 _amount);
    event MerkleRootUpdated(bytes32 _merkleRoot);
    event DistributionPaused(bool _paused);
    event WalletUpdated(address indexed _existingWallet, address indexed _newWallet);

    function initialize() public initializer {
        __Ownable_init();
        __Pausable_init();
        __ReentrancyGuard_init();
        __AccessControl_init();
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(LOCKER_ROLE, _msgSender());
        isAllowedWithdraw = true;
    }

    function setRoot(address _distributorAddress, bytes32 _merkleRoot) public onlyRole(LOCKER_ROLE) {
        _setRoot(_distributorAddress, _merkleRoot);
    }

    function setPause(bool _paused) public onlyRole(LOCKER_ROLE) {
        distributorSetting.paused = _paused;
        emit DistributionPaused(_paused);
    }

    function withdrawEmergency(address _to, uint256 _amount) public onlyRole(LOCKER_ROLE) {
        require(isAllowedWithdraw, "emgergeny withdraw stopped");
        IERC20Upgradeable _token = IERC20Upgradeable(distributorAddress);
        require(_token.balanceOf(address(this)) >= _amount, "insufficient balance");
        _token.transfer(_to, _amount);
        emit TokensWithdrawn(_amount);
    }

    function lock(
        address _distributorAddress,
        bytes32 _merkleRoot,
        UnlockPeriod[] calldata _periods
    ) public onlyRole(LOCKER_ROLE) {

        _setRoot(_distributorAddress, _merkleRoot);
        setUnlockPeriods(_periods);
    }

    function stopEmergencyWithdraw() public onlyRole(LOCKER_ROLE) {
        isAllowedWithdraw = false;
    }

    function updateWallet(
        uint256 _totalAllocation,
        address _newWallet,
        bytes32[] calldata _merkleProof
    ) public nonReentrant {
        require(!distributorSetting.paused, "distribution paused");

        _validateProof(_totalAllocation, _msgSender(), distributorSetting.claimingWalletsMerkleRoot, _merkleProof);

        wallets[_msgSender()].isGraylisted = true;
        wallets[_msgSender()].lastWalletUpdate = block.timestamp;
        wallets[_newWallet].isGraylisted = false;
        wallets[_newWallet].lastWalletUpdate = block.timestamp;
        if (walletInfo[_msgSender()] == address(0))
            walletInfo[_newWallet] = _msgSender();
        else
            walletInfo[_newWallet] = walletInfo[_msgSender()];
        walletInfo[_msgSender()] = address(0);

        claims[_newWallet].totalClaimed = claims[_msgSender()].totalClaimed;

        emit WalletUpdated(_msgSender(), _newWallet);
    }

    function claim(
        uint256 _totalAllocation,
        bytes32[] calldata _merkleProof
    ) public nonReentrant {

        require(!distributorSetting.paused, "distribution paused");

        require(!wallets[_msgSender()].isGraylisted, "wallet greylisted");

        _validateProof(_totalAllocation, _msgSender(), distributorSetting.claimingWalletsMerkleRoot, _merkleProof);

        uint256 totalToClaim = getAvailableTokens(_totalAllocation, _msgSender(), _merkleProof);

        require(totalToClaim > 0, "nothing to claim");

        _transfer(totalToClaim);

        claims[_msgSender()].totalClaimed += totalToClaim;

        emit Claimed(_msgSender(), totalToClaim);
    }

    function getAvailableTokens(uint256 _totalAllocation, address _wallet, bytes32[] calldata _merkleProof) public view returns (uint256) {
        require(!wallets[_wallet].isGraylisted, "wallet greylisted");

        _validateProof(_totalAllocation, _wallet, distributorSetting.claimingWalletsMerkleRoot, _merkleProof);

        uint256 availableAmount = 0;
        uint256 unlocksNumber = distributorSetting.unlocksNumber;
        uint256 totalClaimed = claims[_wallet].totalClaimed;
        uint256 unlockedBefore = 0;

        for (uint256 _periodIndex = 0; _periodIndex < unlocksNumber; _periodIndex++) {
            UnlockPeriod memory _unlockPeriod = unlocks[_periodIndex];
            if (block.timestamp >= _unlockPeriod.startDate) {
                if (_unlockPeriod.totalPercentage == 0) {
                    continue;
                }
                if (_unlockPeriod.isUnlockedBeforeStart) {

                    unlockedBefore += _unlockPeriod.totalPercentage;
                    continue;
                }
                if (_unlockPeriod.periodUnit == 0) {
                    availableAmount += _unlockPeriod.totalPercentage;
                } else {
                    if (block.timestamp >= _unlockPeriod.endDate) {
                        availableAmount += _unlockPeriod.totalPercentage;
                    } else {
                        availableAmount += (_unlockPeriod.totalPercentage / ((_unlockPeriod.endDate - _unlockPeriod.startDate) / _unlockPeriod.periodUnit + 1)) * ((block.timestamp - _unlockPeriod.startDate) / _unlockPeriod.periodUnit + 1);
                    }
                }
            } else {
                break;
            }
        }
        if ((availableAmount + unlockedBefore) > (100 * denominator)) availableAmount = 100 * denominator - unlockedBefore;
        return _calculatePercentage(_totalAllocation, availableAmount) - totalClaimed;
    }

    function verifyTotalPercentageUnlockPeriod(UnlockPeriod[] calldata _periods) public pure returns (bool) {
        uint256 _totalAmount = 0;
        for(uint256 _periodIndex = 0; _periodIndex < _periods.length; _periodIndex++) {
            _totalAmount += _periods[_periodIndex].totalPercentage;
        }
        return ((_totalAmount <= 100 * denominator) && (_totalAmount >= 99 * denominator));
    }

    function setUnlockPeriods(UnlockPeriod[] calldata _periods) public onlyRole(LOCKER_ROLE) {
        require(verifyTotalPercentageUnlockPeriod(_periods), "invalid unlock percentage");
        distributorSetting.unlocksNumber = _periods.length;

        for(uint256 _periodIndex = 0; _periodIndex < _periods.length; _periodIndex++) {

            unlocks[_periodIndex].startDate = _periods[_periodIndex].startDate;
            unlocks[_periodIndex].totalPercentage = _periods[_periodIndex].totalPercentage;
            unlocks[_periodIndex].endDate = _periods[_periodIndex].endDate;
            unlocks[_periodIndex].periodUnit = _periods[_periodIndex].periodUnit;
            unlocks[_periodIndex].isUnlockedBeforeStart = _periods[_periodIndex].isUnlockedBeforeStart;


            emit UnlockPeriodChanged(
                _periodIndex,
                _periods[_periodIndex].startDate,
                _periods[_periodIndex].totalPercentage,
                _periods[_periodIndex].endDate,
                _periods[_periodIndex].periodUnit,
                _periods[_periodIndex].isUnlockedBeforeStart);
        }
    }

    function getTotalClaimedPerWallet(address _wallet, uint256 _totalAllocation, bytes32[] calldata _merkleProof) public view returns (uint256) {
        require(!wallets[_wallet].isGraylisted, "wallet greylisted");

        _validateProof(_totalAllocation, _wallet, distributorSetting.claimingWalletsMerkleRoot, _merkleProof);

        uint256 unlockedBefore = 0;
        uint256 unlocksNumber = distributorSetting.unlocksNumber;
        for (uint256 _periodIndex = 0; _periodIndex < unlocksNumber; _periodIndex++) {
            UnlockPeriod memory _unlockPeriod = unlocks[_periodIndex];
            if (_unlockPeriod.isUnlockedBeforeStart) {
                unlockedBefore += _unlockPeriod.totalPercentage;
                continue;
            } else {
                break;
            }
        }
        return claims[_wallet].totalClaimed + _calculatePercentage(_totalAllocation, unlockedBefore);
    }

    // --------------------------------------------------------------------------------
    // Internal functions
    // --------------------------------------------------------------------------------

    function _setRoot(address _distributorAddress, bytes32 _merkleRoot) internal {
        distributorAddress = _distributorAddress;
        distributorSetting.claimingWalletsMerkleRoot = _merkleRoot;
        distributorSetting.lastRootUpdate = block.timestamp;
        emit MerkleRootUpdated(_merkleRoot);
    }

    function _calculatePercentage(
        uint256 _amount,
        uint256 _percentage
    ) internal pure returns (uint256) {
        return (_amount * _percentage / (100 * denominator));
    }

    function _validateProof(
        uint256 _totalAllocation,
        address _wallet,
        bytes32 _merkleRoot,
        bytes32[] calldata _merkleProof
    ) internal view {
        address _origin = walletInfo[_wallet];
        if (_origin == address(0)) _origin = _wallet;
        bytes32 leaf = keccak256(abi.encode(_origin, _totalAllocation));
        require(MerkleProofUpgradeable.verify(_merkleProof, _merkleRoot, leaf), "invalid proof");
    }

    function _transfer(uint256 _amount) internal {
        IERC20Upgradeable _token = IERC20Upgradeable(distributorAddress);
        require(_token.balanceOf(address(this)) >= _amount, "insufficient balance");
        _token.transfer(_msgSender(), _amount);
    }

}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_paused","type":"bool"}],"name":"DistributionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"MerkleRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_vestingStartDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_totalPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_cliffEndDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_periodUnit","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_isUnlocked","type":"bool"}],"name":"UnlockPeriodChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_existingWallet","type":"address"},{"indexed":true,"internalType":"address","name":"_newWallet","type":"address"}],"name":"WalletUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalAllocation","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"denominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalAllocation","type":"uint256"},{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"getAvailableTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_totalAllocation","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"getTotalClaimedPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isAllowedWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_distributorAddress","type":"address"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"},{"components":[{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"totalPercentage","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"periodUnit","type":"uint256"},{"internalType":"bool","name":"isUnlockedBeforeStart","type":"bool"}],"internalType":"struct Claiming.UnlockPeriod[]","name":"_periods","type":"tuple[]"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_distributorAddress","type":"address"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"totalPercentage","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"periodUnit","type":"uint256"},{"internalType":"bool","name":"isUnlockedBeforeStart","type":"bool"}],"internalType":"struct Claiming.UnlockPeriod[]","name":"_periods","type":"tuple[]"}],"name":"setUnlockPeriods","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalAllocation","type":"uint256"},{"internalType":"address","name":"_newWallet","type":"address"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"updateWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"totalPercentage","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"periodUnit","type":"uint256"},{"internalType":"bool","name":"isUnlockedBeforeStart","type":"bool"}],"internalType":"struct Claiming.UnlockPeriod[]","name":"_periods","type":"tuple[]"}],"name":"verifyTotalPercentageUnlockPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638129fc1c116100de578063bedb86fb11610097578063f2fde38b11610071578063f2fde38b1461033c578063f36213671461034f578063f7487c9814610364578063fb1057cd1461037757600080fd5b8063bedb86fb14610303578063c328474e14610316578063d547741f1461032957600080fd5b80638129fc1c146102a7578063867a0984146102af5780638da5cb5b146102c257806391d14854146102dd57806396ce0795146102f0578063a217fddf146102fb57600080fd5b806347ee951c1161014b5780635c975abb116101255780635c975abb1461026e5780636c3d7e1d14610279578063715018a61461028c5780637f94f65d1461029457600080fd5b806347ee951c1461023a578063553bccf11461024d57806357971e781461025b57600080fd5b806301ffc9a7146101935780630e42ff13146101bb578063248a9ca3146101d05780632f2ff15d146102015780632f52ebb71461021457806336568abe14610227575b600080fd5b6101a66101a1366004611bb8565b61037f565b60405190151581526020015b60405180910390f35b6101ce6101c9366004611c2e565b6103b6565b005b6101f36101de366004611c70565b60009081526097602052604090206001015490565b6040519081526020016101b2565b6101ce61020f366004611ca0565b61065a565b6101ce610222366004611d11565b610684565b6101ce610235366004611ca0565b610829565b6101f3610248366004611d5d565b6108a7565b61012d546101a69060ff1681565b6101f3610269366004611db7565b610acc565b60c95460ff166101a6565b6101ce610287366004611df9565b610be9565b6101ce610dd9565b6101ce6102a2366004611df9565b610e3f565b6101ce610e61565b6101ce6102bd366004611e23565b610f1f565b6033546040516001600160a01b0390911681526020016101b2565b6101a66102eb366004611ca0565b610f52565b6101f36305f5e10081565b6101f3600081565b6101ce610311366004611e7f565b610f7d565b6101a6610324366004611c2e565b610fdf565b6101ce610337366004611ca0565b61105c565b6101ce61034a366004611e9c565b611081565b6101f360008051602061216a83398151915281565b6101ce610372366004611d5d565b611149565b6101ce611322565b60006001600160e01b03198216637965db0b60e01b14806103b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008051602061216a8339815191526103ce81611348565b6103d88383610fdf565b6104295760405162461bcd60e51b815260206004820152601960248201527f696e76616c696420756e6c6f636b2070657263656e746167650000000000000060448201526064015b60405180910390fd5b61012f82905560005b828110156106545783838281811061044c5761044c611eb7565b60008481526101326020526040902060a090910292909201359091555083838281811061047b5761047b611eb7565b905060a00201602001356101326000838152602001908152602001600020600101819055508383828181106104b2576104b2611eb7565b905060a00201604001356101326000838152602001908152602001600020600201819055508383828181106104e9576104e9611eb7565b905060a002016060013561013260008381526020019081526020016000206003018190555083838281811061052057610520611eb7565b905060a0020160800160208101906105389190611e7f565b600082815261013260205260409020600401805460ff1916911515919091179055807f92c9de83f112173ee7e61902732a99242d514635be0257ace0761072c730633485858381811061058d5761058d611eb7565b905060a00201600001358686858181106105a9576105a9611eb7565b905060a00201602001358787868181106105c5576105c5611eb7565b905060a00201604001358888878181106105e1576105e1611eb7565b905060a00201606001358989888181106105fd576105fd611eb7565b905060a0020160800160208101906106159190611e7f565b6040805195865260208601949094529284019190915260608301521515608082015260a00160405180910390a28061064c81611ee3565b915050610432565b50505050565b60008281526097602052604090206001015461067581611348565b61067f8383611352565b505050565b600260fb5414156106d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610420565b600260fb556101315460ff16156107265760405162461bcd60e51b8152602060048201526013602482015272191a5cdd1c9a589d5d1a5bdb881c185d5cd959606a1b6044820152606401610420565b336000908152610134602052604090205460ff16156107575760405162461bcd60e51b815260040161042090611efe565b61076883335b61012e5485856113d8565b6000610776843385856108a7565b9050600081116107bb5760405162461bcd60e51b815260206004820152601060248201526f6e6f7468696e6720746f20636c61696d60801b6044820152606401610420565b6107c4816114b8565b3360009081526101336020526040812080548392906107e4908490611f29565b909155505060405181815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9060200160405180910390a25050600160fb555050565b6001600160a01b03811633146108995760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610420565b6108a38282611611565b5050565b6001600160a01b0383166000908152610134602052604081205460ff16156108e15760405162461bcd60e51b815260040161042090611efe565b6108f4858561012e6000015486866113d8565b61012f546001600160a01b0385166000908152610133602052604081205490919082805b83811015610a6d5760008181526101326020908152604091829020825160a0810184528154808252600183015493820193909352600282015493810193909352600381015460608401526004015460ff16151560808301524210610a535760208101516109855750610a5b565b8060800151156109a657602081015161099e9084611f29565b925050610a5b565b60608101516109c55760208101516109be9087611f29565b9550610a59565b806040015142106109df5760208101516109be9087611f29565b606081015181516109f09042611f41565b6109fa9190611f58565b610a05906001611f29565b606082015182516040840151610a1b9190611f41565b610a259190611f58565b610a30906001611f29565b8260200151610a3f9190611f58565b610a499190611f7a565b6109be9087611f29565b50610a6d565b505b80610a6581611ee3565b915050610918565b50610a7d6305f5e1006064611f7a565b610a878286611f29565b1115610aaa5780610a9d6305f5e1006064611f7a565b610aa79190611f41565b93505b81610ab58a86611678565b610abf9190611f41565b9998505050505050505050565b6001600160a01b0384166000908152610134602052604081205460ff1615610b065760405162461bcd60e51b815260040161042090611efe565b610b19848661012e6000015486866113d8565b61012f54600090815b81811015610baf5760008181526101326020908152604091829020825160a081018452815481526001820154928101929092526002810154928201929092526003820154606082015260049091015460ff161580156080830152610b97576020810151610b8f9085611f29565b935050610b9d565b50610baf565b80610ba781611ee3565b915050610b22565b50610bba8683611678565b6001600160a01b03881660009081526101336020526040902054610bde9190611f29565b979650505050505050565b60008051602061216a833981519152610c0181611348565b61012d5460ff16610c545760405162461bcd60e51b815260206004820152601a60248201527f656d67657267656e792077697468647261772073746f707065640000000000006044820152606401610420565b61012d546040516370a0823160e01b81523060048201526101009091046001600160a01b031690839082906370a082319060240160206040518083038186803b158015610ca057600080fd5b505afa158015610cb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd89190611f99565b1015610d1d5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610420565b60405163a9059cbb60e01b81526001600160a01b0385811660048301526024820185905282169063a9059cbb90604401602060405180830381600087803b158015610d6757600080fd5b505af1158015610d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9f9190611fb2565b506040518381527f9c6393f251205f9e03559951cab4c9ae71767b6174f77944a5b0c2fa51fbda9f9060200160405180910390a150505050565b6033546001600160a01b03163314610e335760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610420565b610e3d60006116a4565b565b60008051602061216a833981519152610e5781611348565b61067f83836116f6565b6000610e6d6001611752565b90508015610e85576000805461ff0019166101001790555b610e8d6117df565b610e9561180e565b610e9d61183d565b610ea561186c565b610eb0600033611893565b610ec860008051602061216a83398151915233611893565b61012d805460ff191660011790558015610f1c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b60008051602061216a833981519152610f3781611348565b610f4185856116f6565b610f4b83836103b6565b5050505050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061216a833981519152610f9581611348565b610131805460ff19168315159081179091556040519081527f41cbf6951a9357698e34cd1b958ca104f937fcd0e1bee7b3c98552ad3b67394e906020015b60405180910390a15050565b600080805b8381101561102757848482818110610ffe57610ffe611eb7565b905060a0020160200135826110139190611f29565b91508061101f81611ee3565b915050610fe4565b506110376305f5e1006064611f7a565b811115801561105457506110506305f5e1006063611f7a565b8110155b949350505050565b60008281526097602052604090206001015461107781611348565b61067f8383611611565b6033546001600160a01b031633146110db5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610420565b6001600160a01b0381166111405760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610420565b610f1c816116a4565b600260fb54141561119c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610420565b600260fb556101315460ff16156111eb5760405162461bcd60e51b8152602060048201526013602482015272191a5cdd1c9a589d5d1a5bdb881c185d5cd959606a1b6044820152606401610420565b6111f5843361075d565b336000818152610134602090815260408083208054600160ff1991821681178355429281018390556001600160a01b038a811687528487208054909316835591019190915593835261013590915290205416611279576001600160a01b03831660009081526101356020526040902080546001600160a01b031916331790556112b0565b3360009081526101356020526040808220546001600160a01b0386811684529190922080546001600160a01b031916919092161790555b3360008181526101356020908152604080832080546001600160a01b0319169055610133909152808220546001600160a01b0387168084528284209190915590519092917f0f37c6733428a3a65d46b7f1853a5ce4bfa3cf92d25322507a50bf23a0b5a0a891a35050600160fb555050565b60008051602061216a83398151915261133a81611348565b5061012d805460ff19169055565b610f1c813361189d565b61135c8282610f52565b6108a35760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556113943390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b038085166000908152610135602052604090205416806113fc5750835b604080516001600160a01b03831660208201529081018790526000906060016040516020818303038152906040528051906020012090506114738484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992508591506119019050565b6114af5760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b6044820152606401610420565b50505050505050565b61012d546040516370a0823160e01b81523060048201526101009091046001600160a01b031690829082906370a082319060240160206040518083038186803b15801561150457600080fd5b505afa158015611518573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153c9190611f99565b10156115815760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610420565b6001600160a01b03811663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b1580156115d957600080fd5b505af11580156115ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067f9190611fb2565b61161b8282610f52565b156108a35760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006116896305f5e1006064611f7a565b6116938385611f7a565b61169d9190611f58565b9392505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61012d8054610100600160a81b0319166101006001600160a01b0385160217905561012e81905542610130556040518181527f90004c04698bc3322499a575ed3752dd4abf33e0a7294c06a787a0fe01bea94190602001610fd3565b60008054610100900460ff1615611799578160ff1660011480156117755750303b155b6117915760405162461bcd60e51b815260040161042090611fcf565b506000919050565b60005460ff8084169116106117c05760405162461bcd60e51b815260040161042090611fcf565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166118065760405162461bcd60e51b81526004016104209061201d565b610e3d611917565b600054610100900460ff166118355760405162461bcd60e51b81526004016104209061201d565b610e3d611947565b600054610100900460ff166118645760405162461bcd60e51b81526004016104209061201d565b610e3d61197a565b600054610100900460ff16610e3d5760405162461bcd60e51b81526004016104209061201d565b6108a38282611352565b6118a78282610f52565b6108a3576118bf816001600160a01b031660146119a8565b6118ca8360206119a8565b6040516020016118db929190612094565b60408051601f198184030181529082905262461bcd60e51b825261042091600401612109565b60008261190e8584611b44565b14949350505050565b600054610100900460ff1661193e5760405162461bcd60e51b81526004016104209061201d565b610e3d336116a4565b600054610100900460ff1661196e5760405162461bcd60e51b81526004016104209061201d565b60c9805460ff19169055565b600054610100900460ff166119a15760405162461bcd60e51b81526004016104209061201d565b600160fb55565b606060006119b7836002611f7a565b6119c2906002611f29565b67ffffffffffffffff8111156119da576119da61213c565b6040519080825280601f01601f191660200182016040528015611a04576020820181803683370190505b509050600360fc1b81600081518110611a1f57611a1f611eb7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611a4e57611a4e611eb7565b60200101906001600160f81b031916908160001a9053506000611a72846002611f7a565b611a7d906001611f29565b90505b6001811115611af5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611ab157611ab1611eb7565b1a60f81b828281518110611ac757611ac7611eb7565b60200101906001600160f81b031916908160001a90535060049490941c93611aee81612152565b9050611a80565b50831561169d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610420565b600081815b8451811015611bb0576000858281518110611b6657611b66611eb7565b60200260200101519050808311611b8c5760008381526020829052604090209250611b9d565b600081815260208490526040902092505b5080611ba881611ee3565b915050611b49565b509392505050565b600060208284031215611bca57600080fd5b81356001600160e01b03198116811461169d57600080fd5b60008083601f840112611bf457600080fd5b50813567ffffffffffffffff811115611c0c57600080fd5b60208301915083602060a083028501011115611c2757600080fd5b9250929050565b60008060208385031215611c4157600080fd5b823567ffffffffffffffff811115611c5857600080fd5b611c6485828601611be2565b90969095509350505050565b600060208284031215611c8257600080fd5b5035919050565b80356001600160a01b03811681146117da57600080fd5b60008060408385031215611cb357600080fd5b82359150611cc360208401611c89565b90509250929050565b60008083601f840112611cde57600080fd5b50813567ffffffffffffffff811115611cf657600080fd5b6020830191508360208260051b8501011115611c2757600080fd5b600080600060408486031215611d2657600080fd5b83359250602084013567ffffffffffffffff811115611d4457600080fd5b611d5086828701611ccc565b9497909650939450505050565b60008060008060608587031215611d7357600080fd5b84359350611d8360208601611c89565b9250604085013567ffffffffffffffff811115611d9f57600080fd5b611dab87828801611ccc565b95989497509550505050565b60008060008060608587031215611dcd57600080fd5b611dd685611c89565b935060208501359250604085013567ffffffffffffffff811115611d9f57600080fd5b60008060408385031215611e0c57600080fd5b611e1583611c89565b946020939093013593505050565b60008060008060608587031215611e3957600080fd5b611e4285611c89565b935060208501359250604085013567ffffffffffffffff811115611e6557600080fd5b611dab87828801611be2565b8015158114610f1c57600080fd5b600060208284031215611e9157600080fd5b813561169d81611e71565b600060208284031215611eae57600080fd5b61169d82611c89565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ef757611ef7611ecd565b5060010190565b6020808252601190820152701dd85b1b195d0819dc995e5b1a5cdd1959607a1b604082015260600190565b60008219821115611f3c57611f3c611ecd565b500190565b600082821015611f5357611f53611ecd565b500390565b600082611f7557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f9457611f94611ecd565b500290565b600060208284031215611fab57600080fd5b5051919050565b600060208284031215611fc457600080fd5b815161169d81611e71565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b8381101561208357818101518382015260200161206b565b838111156106545750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516120cc816017850160208801612068565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516120fd816028840160208801612068565b01602801949350505050565b6020815260008251806020840152612128816040850160208701612068565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b60008161216157612161611ecd565b50600019019056feaf9a8bb3cbd6b84fbccefa71ff73e26e798553c6914585a84886212a46a90279a26469706673582212206a547c1094217ffc4c06b773292eb6c4b66519fde949944bc2ced54bb55a34c364736f6c63430008090033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.