ETH Price: $2,465.85 (+4.26%)
Gas: 13.4 Gwei

Contract

0x5d7b782eC34CAE8b38a56c1a3487337583178466
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040169810952023-04-05 7:26:11555 days ago1680679571IN
 Create: BlindAuction
0 ETH0.0471937327.23008344

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BlindAuction

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : BlindAuction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

//  ===========================================================================================
//  #     #               ######
//  #     # ###### ###### #     #  ####  #    #  ####
//  #     # #      #      #     # #    # ##   # #    #
//  ####### #####  #####  #     # #    # # #  # #
//  #     # #      #      #     # #    # #  # # #  ###
//  #     # #      #      #     # #    # #   ## #    #
//  #     # ###### ###### ######   ####  #    #  ####
//
//  Welcome to the geeky side of HeeDong. There may or may not be an easter egg in this code.
//  If you find one, please let me know. I would love to hear from you.
//  ===========================================================================================

/**
 * @title BlindAuction
 * @author @0xBuooy (buooy.eth)
 * @author @loocurse
 * @notice This contract is heavily inspired by Kubz and Captainz contracts. All credits to them for the ideas and the code.
 */
contract BlindAuction is
    Initializable,
    ReentrancyGuardUpgradeable,
    OwnableUpgradeable
{
    using EnumerableMap for EnumerableMap.AddressToUintMap;

    enum AuctionState {
        NOT_STARTED,
        BIDDING_STARTED,
        BIDDING_ENDED,
        REFUND_STARTED,
        REFUND_ENDED
    }
    AuctionState public auctionState;
    address public financeWalletAddress;
    bytes32 private merkleRootForWonItemsCount;

    uint256 public MAX_BID_QUANTITY;

    uint256 public MIN_BID_AMOUNT;
    uint256 public BID_ITEMS_COUNT;

    uint256 public finalPrice;
    uint256 public wonBiddedItems;
    uint256 public withdrawed;

    address[] public bidders;

    struct Bid {
        bool exists;
        address bidder;
        uint256 amount;
        uint32 createdAt;
        uint32 updatedAt;
    }

    mapping(address => Bid) private userBids; // address => bid
    mapping(address => bool) public isUserRefunded; // address => user has refunded, whether as winner or loser

    //  ============================================================
    //  Modifiers
    //  ============================================================
    modifier auctionMustNotHaveStarted() {
        require(
            auctionState == AuctionState.NOT_STARTED,
            "Auction already started"
        );
        _;
    }

    //  ============================================================
    //  Events
    //  ============================================================
    event UserEnteredBid(
        address indexed user,
        uint256 bidAmount,
        bool indexed newUser
    );

    event UserEnteredWLAirdrop(address indexed user);

    event UserRefunded(
        address indexed user,
        uint256 bidAmount,
        uint256 indexed wonItemsCount
    );

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    /// @dev initializes the contract
    function initialize(address financeWallet) public initializer {
        ReentrancyGuardUpgradeable.__ReentrancyGuard_init();
        OwnableUpgradeable.__Ownable_init();
        setFinanceWalletAddress(financeWallet);
        MAX_BID_QUANTITY = 2000;
        MIN_BID_AMOUNT = 0.05 ether;
        BID_ITEMS_COUNT = 2000;
    }

    receive() external payable {}

    fallback() external payable {}

    //  ============================================================
    //  Won Items Count Verification
    //  ============================================================
    /// @dev returns the merkle root for the won items count
    /// @return merkle root for the won items count
    function getMerkleRootForWonItemsCount()
        external
        view
        onlyOwner
        returns (bytes32)
    {
        return merkleRootForWonItemsCount;
    }

    /// @dev sets the merkle root for the won items count
    /// @param _merkleRoot merkle root for the won items count
    function setMerkleRootForWonItemsCount(
        bytes32 _merkleRoot
    ) external onlyOwner {
        merkleRootForWonItemsCount = _merkleRoot;
    }

    /// @dev verifies the won items count
    /// @param proof merkle proof
    /// @param wonItemsCount won items count
    function verifyWonItemsCount(
        address _address,
        bytes32[] calldata proof,
        uint256 wonItemsCount
    ) public view returns (bool) {
        bytes32 leaf = keccak256(
            bytes.concat(keccak256(abi.encode(_address, wonItemsCount)))
        );
        return MerkleProof.verify(proof, merkleRootForWonItemsCount, leaf);
    }

    //  ============================================================
    //  Bid Management
    //  ============================================================
    /// @dev commits or increases the bid
    function commitBid() external payable {
        require(
            auctionState == AuctionState.BIDDING_STARTED,
            "Bidding is not open"
        );
        require(msg.value != 0, "Bid must be > 0");
        uint256 newAmount = userBids[msg.sender].amount + msg.value;
        require(newAmount >= MIN_BID_AMOUNT, "Min Bid Required");

        emit UserEnteredBid(
            msg.sender,
            newAmount,
            !userBids[msg.sender].exists
        );

        if (userBids[msg.sender].exists) {
            userBids[msg.sender].amount = newAmount;
            userBids[msg.sender].updatedAt = uint32(block.timestamp);
        } else {
            userBids[msg.sender] = Bid({
                exists: true,
                bidder: msg.sender,
                amount: newAmount,
                createdAt: uint32(block.timestamp),
                updatedAt: uint32(block.timestamp)
            });
            bidders.push(msg.sender);
        }
    }

    /// @dev returns a list of bidders and their bid amounts
    /// @return bids list of bids
    function getBids() external view returns (Bid[] memory) {
        Bid[] memory _bids = new Bid[](bidders.length);
        for (uint256 i; i < bidders.length; i++) {
            _bids[i] = userBids[bidders[i]];
        }
        return _bids;
    }

    /// @dev gets the user's bid
    /// @return bidAmount the user's bid amount
    function getUserBid() external view returns (uint256 bidAmount) {
        return userBids[msg.sender].amount;
    }

    /// @dev gets the number of biders
    function getBiddersLength() external view returns (uint256) {
        return bidders.length;
    }

    /// @dev gets a part of the bidders list
    /// @param fromIdx start index
    /// @param toIdx end index
    /// @return part part of the bidders list
    function getBidders(
        uint256 fromIdx,
        uint256 toIdx
    ) external view returns (address[] memory) {
        toIdx = Math.min(toIdx, bidders.length);
        address[] memory part = new address[](toIdx - fromIdx);
        for (uint256 i; i < toIdx - fromIdx; i++) {
            part[i] = bidders[i + fromIdx];
        }
        return part;
    }

    /// @dev gets all the bidders
    /// @return bidders list of bidders
    function getBiddersAll() external view returns (address[] memory) {
        return bidders;
    }

    //  ============================================================
    //  Financial Management
    //  ============================================================
    /// @dev allows user to refund to their wallet
    /// @param proof merkle proof
    /// @param wonItemsCount won items count
    function refund(
        bytes32[] calldata proof,
        uint256 wonItemsCount
    ) external nonReentrant {
        uint256 userBidAmount = userBids[msg.sender].amount;
        require(
            auctionState == AuctionState.REFUND_STARTED,
            "Refund not started yet"
        );
        require(finalPrice > 0, "Final price not set");
        require(verifyWonItemsCount(msg.sender, proof, wonItemsCount), "Invalid proof");
        require(userBidAmount > 0, "No bid record");
        require(!isUserRefunded[msg.sender], "Already refunded");

        uint256 refundAmount = userBidAmount - (finalPrice * wonItemsCount);
        require(refundAmount <= userBidAmount, "underflow");
        require(refundAmount > 0, "No refund needed");

        isUserRefunded[msg.sender] = true;
        emit UserRefunded(msg.sender, refundAmount, wonItemsCount);
        _withdraw(msg.sender, refundAmount);
    }

    /// @dev withdraws the sales to the finance wallet
    function withdrawSales() external onlyOwner {
        require(
            auctionState >= AuctionState.BIDDING_ENDED,
            "Auction not concluding"
        );
        require(wonBiddedItems > 0, "wonBiddedItems not set");
        require(finalPrice > 0, "finalPrice not set");
        uint256 sales = wonBiddedItems * finalPrice;
        uint256 available = sales - withdrawed;
        withdrawed = available;

        require(available > 0, "No balance to withdraw");
        _withdraw(financeWalletAddress, available);
    }

    /// @dev withdraw all proceeds to the finance wallet
    function withdrawAll() external onlyOwner {
        require(
            auctionState >= AuctionState.REFUND_ENDED,
            "Auction refund not ended"
        );
        _withdraw(financeWalletAddress, address(this).balance);
    }

    /// @dev withdraws a fixed amount to the given address
    /// @param _address address to withdraw to
    /// @param _amount amount to withdraw
    function _withdraw(address _address, uint256 _amount) private {
        (bool success, ) = _address.call{value: _amount}("");
        require(success, "cant withdraw");
    }

    /// @dev sets the finance wallet address
    /// @param _financeWalletAddress finance wallet address
    function setFinanceWalletAddress(
        address _financeWalletAddress
    ) public onlyOwner {
        require(_financeWalletAddress != address(0), "Invalid address");
        financeWalletAddress = _financeWalletAddress;
    }

    //  ============================================================
    //  Auction Administration
    //  ============================================================
    function setMaxBidQuantity(uint8 quantity) external onlyOwner {
        MAX_BID_QUANTITY = quantity;
    }

    function changeMinBidAmount(
        uint256 amount
    ) external auctionMustNotHaveStarted onlyOwner {
        MIN_BID_AMOUNT = amount;
    }

    function changeBidItemsCount(
        uint256 count
    ) external auctionMustNotHaveStarted onlyOwner {
        BID_ITEMS_COUNT = count;
    }

    function setWonBiddedItems(uint256 items) external onlyOwner {
        require(items <= BID_ITEMS_COUNT, "Too many won items");
        wonBiddedItems = items;
    }

    function setFinalPrice(uint256 price) external onlyOwner {
        require(price >= MIN_BID_AMOUNT, "Price too low");
        finalPrice = price;
    }

    function getFinalPrice() external view returns (uint256) {
        return finalPrice;
    }

    function setAuctionState(uint8 state) external onlyOwner {
        auctionState = AuctionState(state);
    }

    function getAuctionState() external view returns (uint8) {
        return uint8(auctionState);
    }

    function getIsUserRefunded(address user) external view returns (bool) {
        return isUserRefunded[user];
    }

    function getRefundStatus()
        external
        view
        returns (address[] memory, bool[] memory)
    {
        bool[] memory _isUserRefunded = new bool[](bidders.length);
        for (uint256 i; i < bidders.length; i++) {
            _isUserRefunded[i] = isUserRefunded[bidders[i]];
        }

        return (bidders, _isUserRefunded);
    }
}

File 2 of 12 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @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 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);
    }

    /**
     * @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 3 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @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.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 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.
     *
     * 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.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * 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.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _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.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 12 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

    function _nonReentrantAfter() private {
        // 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 5 of 12 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 12 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 7 of 12 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 8 of 12 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// 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 9 of 12 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 10 of 12 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 11 of 12 : EnumerableMap.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.

pragma solidity ^0.8.0;

import "./EnumerableSet.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableMap.
 * ====
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        bytes32 value
    ) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.length();
    }

    /**
     * @dev Returns the key-value pair stored at position `index` in the map. O(1).
     *
     * Note that there are no guarantees on the ordering of entries inside the
     * array, and it may change when more entries are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
        bytes32 key = map._keys.at(index);
        return (key, map._values[key]);
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToUintMap storage map,
        uint256 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
        return remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
        return contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the set. O(1).
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (uint256(key), uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key)));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToUintMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key), errorMessage));
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToAddressMap storage map,
        uint256 key,
        address value
    ) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the set. O(1).
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
    }

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        AddressToUintMap storage map,
        address key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(AddressToUintMap storage map, address key) internal returns (bool) {
        return remove(map._inner, bytes32(uint256(uint160(key))));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
        return contains(map._inner, bytes32(uint256(uint160(key))));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(AddressToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the set. O(1).
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (address(uint160(uint256(key))), uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        AddressToUintMap storage map,
        address key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        Bytes32ToUintMap storage map,
        bytes32 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, key, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
        return remove(map._inner, key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {
        return contains(map._inner, key);
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the set. O(1).
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (key, uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, key);
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
        return uint256(get(map._inner, key));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToUintMap storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, key, errorMessage));
    }
}

File 12 of 12 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidAmount","type":"uint256"},{"indexed":true,"internalType":"bool","name":"newUser","type":"bool"}],"name":"UserEnteredBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"UserEnteredWLAirdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"wonItemsCount","type":"uint256"}],"name":"UserRefunded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"BID_ITEMS_COUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BID_QUANTITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BID_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionState","outputs":[{"internalType":"enum BlindAuction.AuctionState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bidders","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"name":"changeBidItemsCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"changeMinBidAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commitBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"finalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"financeWalletAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuctionState","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromIdx","type":"uint256"},{"internalType":"uint256","name":"toIdx","type":"uint256"}],"name":"getBidders","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBiddersAll","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBiddersLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBids","outputs":[{"components":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"createdAt","type":"uint32"},{"internalType":"uint32","name":"updatedAt","type":"uint32"}],"internalType":"struct BlindAuction.Bid[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFinalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getIsUserRefunded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMerkleRootForWonItemsCount","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRefundStatus","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUserBid","outputs":[{"internalType":"uint256","name":"bidAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"financeWallet","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isUserRefunded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"wonItemsCount","type":"uint256"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"state","type":"uint8"}],"name":"setAuctionState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setFinalPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_financeWalletAddress","type":"address"}],"name":"setFinanceWalletAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"quantity","type":"uint8"}],"name":"setMaxBidQuantity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRootForWonItemsCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"items","type":"uint256"}],"name":"setWonBiddedItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"wonItemsCount","type":"uint256"}],"name":"verifyWonItemsCount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawSales","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wonBiddedItems","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611de9806100ed6000396000f3fe6080604052600436106102065760003560e01c8063900c122011610117578063b81c78ec116100a5578063cff29dfd1161006c578063cff29dfd146105dd578063d4b156e9146105fd578063e6ba4a181461061d578063e961928e1461063d578063f2fde38b1461067657005b8063b81c78ec14610546578063b9ea2fc414610568578063bb55f25c14610588578063c4d66de8146105a8578063ce22bc67146105c857005b8063a363a725116100e9578063a363a725146104c5578063a6b513ee146104e5578063ae247275146104fb578063b0eac1d814610511578063b66b20731461053157005b8063900c1220146104645780639688a21d146104845780639a7971281461049a5780639ce05df7146104b057005b80633cf247b111610194578063715018a611610166578063715018a6146103c85780637fb45099146103dd578063853828b6146104045780638a828b08146104195780638da5cb5b1461044657005b80633cf247b11461035c57806345f4d7351461037257806350d2e677146103885780635c6c09e9146103a857005b806318133d15116101d857806318133d15146102925780631bb89762146102d25780631e28ecad146102e7578063343039d51461030a57806337369b221461034757005b806308bfc3001461020f5780630ce28dc41461023b578063118630091461024357806311cfcadb1461027257005b3661020d57005b005b34801561021b57600080fd5b50610224610696565b60405160ff90911681526020015b60405180910390f35b61020d6106b5565b34801561024f57600080fd5b5033600090815260a060205260409020600101545b604051908152602001610232565b34801561027e57600080fd5b5061020d61028d3660046119d6565b61094d565b34801561029e57600080fd5b506102c26102ad366004611a0b565b60a16020526000908152604090205460ff1681565b6040519015158152602001610232565b3480156102de57600080fd5b50609f54610264565b3480156102f357600080fd5b506102fc61095a565b604051610232929190611a6a565b34801561031657600080fd5b5060975461032f9061010090046001600160a01b031681565b6040516001600160a01b039091168152602001610232565b34801561035357600080fd5b5061020d610a97565b34801561036857600080fd5b5061026460995481565b34801561037e57600080fd5b50610264609a5481565b34801561039457600080fd5b5061020d6103a33660046119d6565b610c21565b3480156103b457600080fd5b5061020d6103c3366004611a0b565b610c8e565b3480156103d457600080fd5b5061020d610d06565b3480156103e957600080fd5b506097546103f79060ff1681565b6040516102329190611ad9565b34801561041057600080fd5b5061020d610d1a565b34801561042557600080fd5b50610439610434366004611b01565b610da4565b6040516102329190611b23565b34801561045257600080fd5b506065546001600160a01b031661032f565b34801561047057600080fd5b5061020d61047f366004611b36565b610e9b565b34801561049057600080fd5b50610264609b5481565b3480156104a657600080fd5b50610264609e5481565b3480156104bc57600080fd5b50609c54610264565b3480156104d157600080fd5b5061020d6104e03660046119d6565b610edc565b3480156104f157600080fd5b50610264609c5481565b34801561050757600080fd5b50610264609d5481565b34801561051d57600080fd5b5061020d61052c366004611b36565b610f49565b34801561053d57600080fd5b50610439610f59565b34801561055257600080fd5b5061055b610fbb565b6040516102329190611b59565b34801561057457600080fd5b5061020d610583366004611c2a565b61110b565b34801561059457600080fd5b5061020d6105a33660046119d6565b6113b4565b3480156105b457600080fd5b5061020d6105c3366004611a0b565b611403565b3480156105d457600080fd5b5061026461153b565b3480156105e957600080fd5b5061032f6105f83660046119d6565b61154c565b34801561060957600080fd5b5061020d6106183660046119d6565b611576565b34801561062957600080fd5b506102c2610638366004611c76565b6115ca565b34801561064957600080fd5b506102c2610658366004611a0b565b6001600160a01b0316600090815260a1602052604090205460ff1690565b34801561068257600080fd5b5061020d610691366004611a0b565b61166b565b60975460009060ff1660048111156106b0576106b0611ac3565b905090565b600160975460ff1660048111156106ce576106ce611ac3565b146107165760405162461bcd60e51b81526020600482015260136024820152722134b23234b7339034b9903737ba1037b832b760691b60448201526064015b60405180910390fd5b346000036107585760405162461bcd60e51b815260206004820152600f60248201526e0426964206d757374206265203e203608c1b604482015260640161070d565b33600090815260a06020526040812060010154610776903490611ce6565b9050609a548110156107bd5760405162461bcd60e51b815260206004820152601060248201526f135a5b88109a590814995c5d5a5c995960821b604482015260640161070d565b33600081815260a0602090815260409182902054915184815260ff9092161592917fa16480eaadf1bcfc74d6fe79423817d891a510e620d366c02a7d0b866dbf594f910160405180910390a333600090815260a0602052604090205460ff161561085b5733600090815260a0602052604090206001810191909155600201805467ffffffff0000000019166401000000004263ffffffff1602179055565b6040805160a08082018352600180835233602080850182815285870188815263ffffffff4281166060890181815260808a019182526000878152989095529887209751885493516001600160a01b031661010002610100600160a81b0319911515919091166001600160a81b0319909416939093179290921787555186850155905160029095018054965182166401000000000267ffffffffffffffff19909716959091169490941794909417909255609f8054928301815590527f0bc14066c33013fe88f66e314e4cf150b0b2d4d6451a1a51dbbd1c27cd11de280180546001600160a01b03191690911790555b50565b6109556116e1565b609855565b6060806000609f8054905067ffffffffffffffff81111561097d5761097d611cf9565b6040519080825280602002602001820160405280156109a6578160200160208202803683370190505b50905060005b609f54811015610a2e5760a16000609f83815481106109cd576109cd611d0f565b60009182526020808320909101546001600160a01b03168352820192909252604001902054825160ff90911690839083908110610a0c57610a0c611d0f565b9115156020928302919091019091015280610a2681611d25565b9150506109ac565b50609f8181805480602002602001604051908101604052809291908181526020018280548015610a8757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a69575b5050505050915092509250509091565b610a9f6116e1565b600260975460ff166004811115610ab857610ab8611ac3565b1015610aff5760405162461bcd60e51b815260206004820152601660248201527541756374696f6e206e6f7420636f6e636c7564696e6760501b604482015260640161070d565b6000609d5411610b4a5760405162461bcd60e51b81526020600482015260166024820152751ddbdb909a59191959125d195b5cc81b9bdd081cd95d60521b604482015260640161070d565b6000609c5411610b915760405162461bcd60e51b8152602060048201526012602482015271199a5b985b141c9a58d9481b9bdd081cd95d60721b604482015260640161070d565b6000609c54609d54610ba39190611d3e565b90506000609e5482610bb59190611d55565b609e819055905080610c025760405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b604482015260640161070d565b609754610c1d9061010090046001600160a01b03168261173b565b5050565b600060975460ff166004811115610c3a57610c3a611ac3565b14610c815760405162461bcd60e51b8152602060048201526017602482015276105d58dd1a5bdb88185b1c9958591e481cdd185c9d1959604a1b604482015260640161070d565b610c896116e1565b609a55565b610c966116e1565b6001600160a01b038116610cde5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161070d565b609780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b610d0e6116e1565b610d1860006117ce565b565b610d226116e1565b600460975460ff166004811115610d3b57610d3b611ac3565b1015610d895760405162461bcd60e51b815260206004820152601860248201527f41756374696f6e20726566756e64206e6f7420656e6465640000000000000000604482015260640161070d565b609754610d189061010090046001600160a01b03164761173b565b6060610db582609f80549050611820565b91506000610dc38484611d55565b67ffffffffffffffff811115610ddb57610ddb611cf9565b604051908082528060200260200182016040528015610e04578160200160208202803683370190505b50905060005b610e148585611d55565b811015610e9157609f610e278683611ce6565b81548110610e3757610e37611d0f565b9060005260206000200160009054906101000a90046001600160a01b0316828281518110610e6757610e67611d0f565b6001600160a01b039092166020928302919091019091015280610e8981611d25565b915050610e0a565b5090505b92915050565b610ea36116e1565b8060ff166004811115610eb857610eb8611ac3565b6097805460ff19166001836004811115610ed457610ed4611ac3565b021790555050565b600060975460ff166004811115610ef557610ef5611ac3565b14610f3c5760405162461bcd60e51b8152602060048201526017602482015276105d58dd1a5bdb88185b1c9958591e481cdd185c9d1959604a1b604482015260640161070d565b610f446116e1565b609b55565b610f516116e1565b60ff16609955565b6060609f805480602002602001604051908101604052809291908181526020018280548015610fb157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f93575b5050505050905090565b609f5460609060009067ffffffffffffffff811115610fdc57610fdc611cf9565b60405190808252806020026020018201604052801561103557816020015b6040805160a081018252600080825260208083018290529282018190526060820181905260808201528252600019909201910181610ffa5790505b50905060005b609f548110156111055760a06000609f838154811061105c5761105c611d0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160a081018452815460ff8116151582526101009004909416918401919091526001810154918301919091526002015463ffffffff808216606084015264010000000090910416608082015282518390839081106110e7576110e7611d0f565b602002602001018190525080806110fd90611d25565b91505061103b565b50919050565b611113611838565b33600090815260a06020526040902060010154600360975460ff16600481111561113f5761113f611ac3565b146111855760405162461bcd60e51b81526020600482015260166024820152751499599d5b99081b9bdd081cdd185c9d1959081e595d60521b604482015260640161070d565b6000609c54116111cd5760405162461bcd60e51b8152602060048201526013602482015272119a5b985b081c1c9a58d9481b9bdd081cd95d606a1b604482015260640161070d565b6111d9338585856115ca565b6112155760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b604482015260640161070d565b600081116112555760405162461bcd60e51b815260206004820152600d60248201526c139bc8189a59081c9958dbdc99609a1b604482015260640161070d565b33600090815260a1602052604090205460ff16156112a85760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c99599d5b99195960821b604482015260640161070d565b600082609c546112b89190611d3e565b6112c29083611d55565b9050818111156113005760405162461bcd60e51b8152602060048201526009602482015268756e646572666c6f7760b81b604482015260640161070d565b600081116113435760405162461bcd60e51b815260206004820152601060248201526f139bc81c99599d5b99081b995959195960821b604482015260640161070d565b33600081815260a1602052604090819020805460ff19166001179055518491907f662bc2a64340bca927d72cb5c5ec2285714bb7a1b8927bb9c601287f4a479362906113929085815260200190565b60405180910390a36113a4338261173b565b50506113af60018055565b505050565b6113bc6116e1565b609a548110156113fe5760405162461bcd60e51b815260206004820152600d60248201526c507269636520746f6f206c6f7760981b604482015260640161070d565b609c55565b600054610100900460ff16158080156114235750600054600160ff909116105b8061143d5750303b15801561143d575060005460ff166001145b6114a05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161070d565b6000805460ff1916600117905580156114c3576000805461ff0019166101001790555b6114cb611897565b6114d36118c6565b6114dc82610c8e565b6107d0609981905566b1a2bc2ec50000609a55609b558015610c1d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006115456116e1565b5060985490565b609f818154811061155c57600080fd5b6000918252602090912001546001600160a01b0316905081565b61157e6116e1565b609b548111156115c55760405162461bcd60e51b8152602060048201526012602482015271546f6f206d616e7920776f6e206974656d7360701b604482015260640161070d565b609d55565b604080516001600160a01b0386166020820152908101829052600090819060600160408051601f19818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506116618585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060985491508490506118f5565b9695505050505050565b6116736116e1565b6001600160a01b0381166116d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161070d565b61094a816117ce565b6065546001600160a01b03163314610d185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161070d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b50509050806113af5760405162461bcd60e51b815260206004820152600d60248201526c63616e7420776974686472617760981b604482015260640161070d565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081831061182f5781611831565b825b9392505050565b60026001540361188a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070d565b6002600155565b60018055565b600054610100900460ff166118be5760405162461bcd60e51b815260040161070d90611d68565b610d1861190b565b600054610100900460ff166118ed5760405162461bcd60e51b815260040161070d90611d68565b610d18611932565b6000826119028584611962565b14949350505050565b600054610100900460ff166118915760405162461bcd60e51b815260040161070d90611d68565b600054610100900460ff166119595760405162461bcd60e51b815260040161070d90611d68565b610d18336117ce565b600081815b8451811015610e91576119938286838151811061198657611986611d0f565b60200260200101516119a7565b91508061199f81611d25565b915050611967565b60008183106119c3576000828152602084905260409020611831565b6000838152602083905260409020611831565b6000602082840312156119e857600080fd5b5035919050565b80356001600160a01b0381168114611a0657600080fd5b919050565b600060208284031215611a1d57600080fd5b611831826119ef565b600081518084526020808501945080840160005b83811015611a5f5781516001600160a01b031687529582019590820190600101611a3a565b509495945050505050565b604081526000611a7d6040830185611a26565b82810360208481019190915284518083528582019282019060005b81811015611ab6578451151583529383019391830191600101611a98565b5090979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6020810160058310611afb57634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215611b1457600080fd5b50508035926020909101359150565b6020815260006118316020830184611a26565b600060208284031215611b4857600080fd5b813560ff8116811461183157600080fd5b602080825282518282018190526000919060409081850190868401855b82811015611bd1578151805115158552868101516001600160a01b031687860152858101518686015260608082015163ffffffff90811691870191909152608091820151169085015260a09093019290850190600101611b76565b5091979650505050505050565b60008083601f840112611bf057600080fd5b50813567ffffffffffffffff811115611c0857600080fd5b6020830191508360208260051b8501011115611c2357600080fd5b9250929050565b600080600060408486031215611c3f57600080fd5b833567ffffffffffffffff811115611c5657600080fd5b611c6286828701611bde565b909790965060209590950135949350505050565b60008060008060608587031215611c8c57600080fd5b611c95856119ef565b9350602085013567ffffffffffffffff811115611cb157600080fd5b611cbd87828801611bde565b9598909750949560400135949350505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e9557610e95611cd0565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201611d3757611d37611cd0565b5060010190565b8082028115828204841417610e9557610e95611cd0565b81810381811115610e9557610e95611cd0565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122025ad54daaf89dfac20132617002621c302652c398c7c8c44bf1f3645624155f564736f6c63430008130033

Deployed Bytecode

0x6080604052600436106102065760003560e01c8063900c122011610117578063b81c78ec116100a5578063cff29dfd1161006c578063cff29dfd146105dd578063d4b156e9146105fd578063e6ba4a181461061d578063e961928e1461063d578063f2fde38b1461067657005b8063b81c78ec14610546578063b9ea2fc414610568578063bb55f25c14610588578063c4d66de8146105a8578063ce22bc67146105c857005b8063a363a725116100e9578063a363a725146104c5578063a6b513ee146104e5578063ae247275146104fb578063b0eac1d814610511578063b66b20731461053157005b8063900c1220146104645780639688a21d146104845780639a7971281461049a5780639ce05df7146104b057005b80633cf247b111610194578063715018a611610166578063715018a6146103c85780637fb45099146103dd578063853828b6146104045780638a828b08146104195780638da5cb5b1461044657005b80633cf247b11461035c57806345f4d7351461037257806350d2e677146103885780635c6c09e9146103a857005b806318133d15116101d857806318133d15146102925780631bb89762146102d25780631e28ecad146102e7578063343039d51461030a57806337369b221461034757005b806308bfc3001461020f5780630ce28dc41461023b578063118630091461024357806311cfcadb1461027257005b3661020d57005b005b34801561021b57600080fd5b50610224610696565b60405160ff90911681526020015b60405180910390f35b61020d6106b5565b34801561024f57600080fd5b5033600090815260a060205260409020600101545b604051908152602001610232565b34801561027e57600080fd5b5061020d61028d3660046119d6565b61094d565b34801561029e57600080fd5b506102c26102ad366004611a0b565b60a16020526000908152604090205460ff1681565b6040519015158152602001610232565b3480156102de57600080fd5b50609f54610264565b3480156102f357600080fd5b506102fc61095a565b604051610232929190611a6a565b34801561031657600080fd5b5060975461032f9061010090046001600160a01b031681565b6040516001600160a01b039091168152602001610232565b34801561035357600080fd5b5061020d610a97565b34801561036857600080fd5b5061026460995481565b34801561037e57600080fd5b50610264609a5481565b34801561039457600080fd5b5061020d6103a33660046119d6565b610c21565b3480156103b457600080fd5b5061020d6103c3366004611a0b565b610c8e565b3480156103d457600080fd5b5061020d610d06565b3480156103e957600080fd5b506097546103f79060ff1681565b6040516102329190611ad9565b34801561041057600080fd5b5061020d610d1a565b34801561042557600080fd5b50610439610434366004611b01565b610da4565b6040516102329190611b23565b34801561045257600080fd5b506065546001600160a01b031661032f565b34801561047057600080fd5b5061020d61047f366004611b36565b610e9b565b34801561049057600080fd5b50610264609b5481565b3480156104a657600080fd5b50610264609e5481565b3480156104bc57600080fd5b50609c54610264565b3480156104d157600080fd5b5061020d6104e03660046119d6565b610edc565b3480156104f157600080fd5b50610264609c5481565b34801561050757600080fd5b50610264609d5481565b34801561051d57600080fd5b5061020d61052c366004611b36565b610f49565b34801561053d57600080fd5b50610439610f59565b34801561055257600080fd5b5061055b610fbb565b6040516102329190611b59565b34801561057457600080fd5b5061020d610583366004611c2a565b61110b565b34801561059457600080fd5b5061020d6105a33660046119d6565b6113b4565b3480156105b457600080fd5b5061020d6105c3366004611a0b565b611403565b3480156105d457600080fd5b5061026461153b565b3480156105e957600080fd5b5061032f6105f83660046119d6565b61154c565b34801561060957600080fd5b5061020d6106183660046119d6565b611576565b34801561062957600080fd5b506102c2610638366004611c76565b6115ca565b34801561064957600080fd5b506102c2610658366004611a0b565b6001600160a01b0316600090815260a1602052604090205460ff1690565b34801561068257600080fd5b5061020d610691366004611a0b565b61166b565b60975460009060ff1660048111156106b0576106b0611ac3565b905090565b600160975460ff1660048111156106ce576106ce611ac3565b146107165760405162461bcd60e51b81526020600482015260136024820152722134b23234b7339034b9903737ba1037b832b760691b60448201526064015b60405180910390fd5b346000036107585760405162461bcd60e51b815260206004820152600f60248201526e0426964206d757374206265203e203608c1b604482015260640161070d565b33600090815260a06020526040812060010154610776903490611ce6565b9050609a548110156107bd5760405162461bcd60e51b815260206004820152601060248201526f135a5b88109a590814995c5d5a5c995960821b604482015260640161070d565b33600081815260a0602090815260409182902054915184815260ff9092161592917fa16480eaadf1bcfc74d6fe79423817d891a510e620d366c02a7d0b866dbf594f910160405180910390a333600090815260a0602052604090205460ff161561085b5733600090815260a0602052604090206001810191909155600201805467ffffffff0000000019166401000000004263ffffffff1602179055565b6040805160a08082018352600180835233602080850182815285870188815263ffffffff4281166060890181815260808a019182526000878152989095529887209751885493516001600160a01b031661010002610100600160a81b0319911515919091166001600160a81b0319909416939093179290921787555186850155905160029095018054965182166401000000000267ffffffffffffffff19909716959091169490941794909417909255609f8054928301815590527f0bc14066c33013fe88f66e314e4cf150b0b2d4d6451a1a51dbbd1c27cd11de280180546001600160a01b03191690911790555b50565b6109556116e1565b609855565b6060806000609f8054905067ffffffffffffffff81111561097d5761097d611cf9565b6040519080825280602002602001820160405280156109a6578160200160208202803683370190505b50905060005b609f54811015610a2e5760a16000609f83815481106109cd576109cd611d0f565b60009182526020808320909101546001600160a01b03168352820192909252604001902054825160ff90911690839083908110610a0c57610a0c611d0f565b9115156020928302919091019091015280610a2681611d25565b9150506109ac565b50609f8181805480602002602001604051908101604052809291908181526020018280548015610a8757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a69575b5050505050915092509250509091565b610a9f6116e1565b600260975460ff166004811115610ab857610ab8611ac3565b1015610aff5760405162461bcd60e51b815260206004820152601660248201527541756374696f6e206e6f7420636f6e636c7564696e6760501b604482015260640161070d565b6000609d5411610b4a5760405162461bcd60e51b81526020600482015260166024820152751ddbdb909a59191959125d195b5cc81b9bdd081cd95d60521b604482015260640161070d565b6000609c5411610b915760405162461bcd60e51b8152602060048201526012602482015271199a5b985b141c9a58d9481b9bdd081cd95d60721b604482015260640161070d565b6000609c54609d54610ba39190611d3e565b90506000609e5482610bb59190611d55565b609e819055905080610c025760405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b604482015260640161070d565b609754610c1d9061010090046001600160a01b03168261173b565b5050565b600060975460ff166004811115610c3a57610c3a611ac3565b14610c815760405162461bcd60e51b8152602060048201526017602482015276105d58dd1a5bdb88185b1c9958591e481cdd185c9d1959604a1b604482015260640161070d565b610c896116e1565b609a55565b610c966116e1565b6001600160a01b038116610cde5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161070d565b609780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b610d0e6116e1565b610d1860006117ce565b565b610d226116e1565b600460975460ff166004811115610d3b57610d3b611ac3565b1015610d895760405162461bcd60e51b815260206004820152601860248201527f41756374696f6e20726566756e64206e6f7420656e6465640000000000000000604482015260640161070d565b609754610d189061010090046001600160a01b03164761173b565b6060610db582609f80549050611820565b91506000610dc38484611d55565b67ffffffffffffffff811115610ddb57610ddb611cf9565b604051908082528060200260200182016040528015610e04578160200160208202803683370190505b50905060005b610e148585611d55565b811015610e9157609f610e278683611ce6565b81548110610e3757610e37611d0f565b9060005260206000200160009054906101000a90046001600160a01b0316828281518110610e6757610e67611d0f565b6001600160a01b039092166020928302919091019091015280610e8981611d25565b915050610e0a565b5090505b92915050565b610ea36116e1565b8060ff166004811115610eb857610eb8611ac3565b6097805460ff19166001836004811115610ed457610ed4611ac3565b021790555050565b600060975460ff166004811115610ef557610ef5611ac3565b14610f3c5760405162461bcd60e51b8152602060048201526017602482015276105d58dd1a5bdb88185b1c9958591e481cdd185c9d1959604a1b604482015260640161070d565b610f446116e1565b609b55565b610f516116e1565b60ff16609955565b6060609f805480602002602001604051908101604052809291908181526020018280548015610fb157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f93575b5050505050905090565b609f5460609060009067ffffffffffffffff811115610fdc57610fdc611cf9565b60405190808252806020026020018201604052801561103557816020015b6040805160a081018252600080825260208083018290529282018190526060820181905260808201528252600019909201910181610ffa5790505b50905060005b609f548110156111055760a06000609f838154811061105c5761105c611d0f565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160a081018452815460ff8116151582526101009004909416918401919091526001810154918301919091526002015463ffffffff808216606084015264010000000090910416608082015282518390839081106110e7576110e7611d0f565b602002602001018190525080806110fd90611d25565b91505061103b565b50919050565b611113611838565b33600090815260a06020526040902060010154600360975460ff16600481111561113f5761113f611ac3565b146111855760405162461bcd60e51b81526020600482015260166024820152751499599d5b99081b9bdd081cdd185c9d1959081e595d60521b604482015260640161070d565b6000609c54116111cd5760405162461bcd60e51b8152602060048201526013602482015272119a5b985b081c1c9a58d9481b9bdd081cd95d606a1b604482015260640161070d565b6111d9338585856115ca565b6112155760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b604482015260640161070d565b600081116112555760405162461bcd60e51b815260206004820152600d60248201526c139bc8189a59081c9958dbdc99609a1b604482015260640161070d565b33600090815260a1602052604090205460ff16156112a85760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c99599d5b99195960821b604482015260640161070d565b600082609c546112b89190611d3e565b6112c29083611d55565b9050818111156113005760405162461bcd60e51b8152602060048201526009602482015268756e646572666c6f7760b81b604482015260640161070d565b600081116113435760405162461bcd60e51b815260206004820152601060248201526f139bc81c99599d5b99081b995959195960821b604482015260640161070d565b33600081815260a1602052604090819020805460ff19166001179055518491907f662bc2a64340bca927d72cb5c5ec2285714bb7a1b8927bb9c601287f4a479362906113929085815260200190565b60405180910390a36113a4338261173b565b50506113af60018055565b505050565b6113bc6116e1565b609a548110156113fe5760405162461bcd60e51b815260206004820152600d60248201526c507269636520746f6f206c6f7760981b604482015260640161070d565b609c55565b600054610100900460ff16158080156114235750600054600160ff909116105b8061143d5750303b15801561143d575060005460ff166001145b6114a05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161070d565b6000805460ff1916600117905580156114c3576000805461ff0019166101001790555b6114cb611897565b6114d36118c6565b6114dc82610c8e565b6107d0609981905566b1a2bc2ec50000609a55609b558015610c1d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006115456116e1565b5060985490565b609f818154811061155c57600080fd5b6000918252602090912001546001600160a01b0316905081565b61157e6116e1565b609b548111156115c55760405162461bcd60e51b8152602060048201526012602482015271546f6f206d616e7920776f6e206974656d7360701b604482015260640161070d565b609d55565b604080516001600160a01b0386166020820152908101829052600090819060600160408051601f19818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506116618585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060985491508490506118f5565b9695505050505050565b6116736116e1565b6001600160a01b0381166116d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161070d565b61094a816117ce565b6065546001600160a01b03163314610d185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161070d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b50509050806113af5760405162461bcd60e51b815260206004820152600d60248201526c63616e7420776974686472617760981b604482015260640161070d565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081831061182f5781611831565b825b9392505050565b60026001540361188a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070d565b6002600155565b60018055565b600054610100900460ff166118be5760405162461bcd60e51b815260040161070d90611d68565b610d1861190b565b600054610100900460ff166118ed5760405162461bcd60e51b815260040161070d90611d68565b610d18611932565b6000826119028584611962565b14949350505050565b600054610100900460ff166118915760405162461bcd60e51b815260040161070d90611d68565b600054610100900460ff166119595760405162461bcd60e51b815260040161070d90611d68565b610d18336117ce565b600081815b8451811015610e91576119938286838151811061198657611986611d0f565b60200260200101516119a7565b91508061199f81611d25565b915050611967565b60008183106119c3576000828152602084905260409020611831565b6000838152602083905260409020611831565b6000602082840312156119e857600080fd5b5035919050565b80356001600160a01b0381168114611a0657600080fd5b919050565b600060208284031215611a1d57600080fd5b611831826119ef565b600081518084526020808501945080840160005b83811015611a5f5781516001600160a01b031687529582019590820190600101611a3a565b509495945050505050565b604081526000611a7d6040830185611a26565b82810360208481019190915284518083528582019282019060005b81811015611ab6578451151583529383019391830191600101611a98565b5090979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6020810160058310611afb57634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215611b1457600080fd5b50508035926020909101359150565b6020815260006118316020830184611a26565b600060208284031215611b4857600080fd5b813560ff8116811461183157600080fd5b602080825282518282018190526000919060409081850190868401855b82811015611bd1578151805115158552868101516001600160a01b031687860152858101518686015260608082015163ffffffff90811691870191909152608091820151169085015260a09093019290850190600101611b76565b5091979650505050505050565b60008083601f840112611bf057600080fd5b50813567ffffffffffffffff811115611c0857600080fd5b6020830191508360208260051b8501011115611c2357600080fd5b9250929050565b600080600060408486031215611c3f57600080fd5b833567ffffffffffffffff811115611c5657600080fd5b611c6286828701611bde565b909790965060209590950135949350505050565b60008060008060608587031215611c8c57600080fd5b611c95856119ef565b9350602085013567ffffffffffffffff811115611cb157600080fd5b611cbd87828801611bde565b9598909750949560400135949350505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e9557610e95611cd0565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201611d3757611d37611cd0565b5060010190565b8082028115828204841417610e9557610e95611cd0565b81810381811115610e9557610e95611cd0565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122025ad54daaf89dfac20132617002621c302652c398c7c8c44bf1f3645624155f564736f6c63430008130033

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
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.