ETH Price: $3,356.72 (+0.26%)
Gas: 8 Gwei

Contract

0x611F8A7CCe36D8ba831684AD7f119362d41749d1
 

Overview

ETH Balance

0.017 ETH

Eth Value

$57.06 (@ $3,356.72/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Refund187780862023-12-13 15:17:35229 days ago1702480655IN
0x611F8A7C...2d41749d1
0 ETH0.004346657.73604654
Refund187484752023-12-09 11:49:23234 days ago1702122563IN
0x611F8A7C...2d41749d1
0 ETH0.0021717228.84177689
Refund187351712023-12-07 15:01:11235 days ago1701961271IN
0x611F8A7C...2d41749d1
0 ETH0.0054189471.98095383
Refund187351562023-12-07 14:58:11235 days ago1701961091IN
0x611F8A7C...2d41749d1
0 ETH0.0046446761.01939853
Refund187347832023-12-07 13:41:59235 days ago1701956519IN
0x611F8A7C...2d41749d1
0 ETH0.0030118540.00023545
Refund187321512023-12-07 4:51:35236 days ago1701924695IN
0x611F8A7C...2d41749d1
0 ETH0.0025125333.36926206
Refund187321302023-12-07 4:47:23236 days ago1701924443IN
0x611F8A7C...2d41749d1
0 ETH0.0025325933.27199036
Refund187320982023-12-07 4:40:59236 days ago1701924059IN
0x611F8A7C...2d41749d1
0 ETH0.0027538236.17880606
Refund187320782023-12-07 4:36:59236 days ago1701923819IN
0x611F8A7C...2d41749d1
0 ETH0.0024661532.39958919
Refund187320602023-12-07 4:33:23236 days ago1701923603IN
0x611F8A7C...2d41749d1
0 ETH0.0024744132.50210421
Refund187320402023-12-07 4:29:23236 days ago1701923363IN
0x611F8A7C...2d41749d1
0 ETH0.0023029530.26542979
Refund187320262023-12-07 4:26:35236 days ago1701923195IN
0x611F8A7C...2d41749d1
0 ETH0.0023367230.69465348
Refund187320142023-12-07 4:24:11236 days ago1701923051IN
0x611F8A7C...2d41749d1
0 ETH0.0023585731.32900383
Refund187319992023-12-07 4:21:11236 days ago1701922871IN
0x611F8A7C...2d41749d1
0 ETH0.0025382933.71046944
Refund187319862023-12-07 4:18:35236 days ago1701922715IN
0x611F8A7C...2d41749d1
0 ETH0.002507132.94267245
Refund187319592023-12-07 4:13:11236 days ago1701922391IN
0x611F8A7C...2d41749d1
0 ETH0.0026564635.28129186
Refund187319372023-12-07 4:08:47236 days ago1701922127IN
0x611F8A7C...2d41749d1
0 ETH0.0025581833.60767654
Refund187319112023-12-07 4:03:23236 days ago1701921803IN
0x611F8A7C...2d41749d1
0 ETH0.0025369233.33372745
Refund187318692023-12-07 3:54:59236 days ago1701921299IN
0x611F8A7C...2d41749d1
0 ETH0.0025831333.9350916
Refund187318252023-12-07 3:46:11236 days ago1701920771IN
0x611F8A7C...2d41749d1
0 ETH0.0028139137.37735317
Refund187318042023-12-07 3:41:47236 days ago1701920507IN
0x611F8A7C...2d41749d1
0 ETH0.0026238334.47202343
Refund187317292023-12-07 3:26:47236 days ago1701919607IN
0x611F8A7C...2d41749d1
0 ETH0.0024856233.01660524
Refund187316812023-12-07 3:16:59236 days ago1701919019IN
0x611F8A7C...2d41749d1
0 ETH0.0027947436.71156995
Refund187316582023-12-07 3:12:23236 days ago1701918743IN
0x611F8A7C...2d41749d1
0 ETH0.0025813133.90804253
Refund187316322023-12-07 3:07:11236 days ago1701918431IN
0x611F8A7C...2d41749d1
0 ETH0.0025261733.18413152
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
187780862023-12-13 15:17:35229 days ago1702480655
0x611F8A7C...2d41749d1
0.065 ETH
187484752023-12-09 11:49:23234 days ago1702122563
0x611F8A7C...2d41749d1
0.045 ETH
187351712023-12-07 15:01:11235 days ago1701961271
0x611F8A7C...2d41749d1
0.015 ETH
187351562023-12-07 14:58:11235 days ago1701961091
0x611F8A7C...2d41749d1
0.03 ETH
187347832023-12-07 13:41:59235 days ago1701956519
0x611F8A7C...2d41749d1
0.075 ETH
187321512023-12-07 4:51:35236 days ago1701924695
0x611F8A7C...2d41749d1
0.135 ETH
187321302023-12-07 4:47:23236 days ago1701924443
0x611F8A7C...2d41749d1
0.125 ETH
187320982023-12-07 4:40:59236 days ago1701924059
0x611F8A7C...2d41749d1
0.55 ETH
187320782023-12-07 4:36:59236 days ago1701923819
0x611F8A7C...2d41749d1
0.085 ETH
187320602023-12-07 4:33:23236 days ago1701923603
0x611F8A7C...2d41749d1
0.064 ETH
187320402023-12-07 4:29:23236 days ago1701923363
0x611F8A7C...2d41749d1
0.135 ETH
187320262023-12-07 4:26:35236 days ago1701923195
0x611F8A7C...2d41749d1
0.055 ETH
187320142023-12-07 4:24:11236 days ago1701923051
0x611F8A7C...2d41749d1
0.067 ETH
187319992023-12-07 4:21:11236 days ago1701922871
0x611F8A7C...2d41749d1
0.076 ETH
187319862023-12-07 4:18:35236 days ago1701922715
0x611F8A7C...2d41749d1
0.087 ETH
187319592023-12-07 4:13:11236 days ago1701922391
0x611F8A7C...2d41749d1
0.075 ETH
187319372023-12-07 4:08:47236 days ago1701922127
0x611F8A7C...2d41749d1
0.065 ETH
187319112023-12-07 4:03:23236 days ago1701921803
0x611F8A7C...2d41749d1
0.035 ETH
187318692023-12-07 3:54:59236 days ago1701921299
0x611F8A7C...2d41749d1
0.068 ETH
187318252023-12-07 3:46:11236 days ago1701920771
0x611F8A7C...2d41749d1
0.065 ETH
187318042023-12-07 3:41:47236 days ago1701920507
0x611F8A7C...2d41749d1
0.104 ETH
187317292023-12-07 3:26:47236 days ago1701919607
0x611F8A7C...2d41749d1
0.06 ETH
187316812023-12-07 3:16:59236 days ago1701919019
0x611F8A7C...2d41749d1
0.075 ETH
187316582023-12-07 3:12:23236 days ago1701918743
0x611F8A7C...2d41749d1
0.065 ETH
187316322023-12-07 3:07:11236 days ago1701918431
0x611F8A7C...2d41749d1
0.073 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Auction

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 9 : Auction.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/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title Auction
 * @notice Auction contract, inspired by Heedong, Kubz and Captainz contracts.
 * All credits to them for the ideas and most of the code.
 * See 0x52A494dbf47107Cc0c624EE10703abecAF586776 proxy to 0x5d7b782ec34cae8b38a56c1a3487337583178466
 */
contract Auction is ReentrancyGuard, Ownable {
    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_AMOUNT = 15000000000000000000; // 15 Eth
    uint256 public MIN_BID_AMOUNT;
    uint256 public BID_ITEMS_COUNT;

    uint256 public finalPrice;
    uint256 public totalWonItemsCount;
    uint256 public withdrawn;

    address[] public bidders;

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

    struct BidderRefundStatus {
        address bidder;
        bool isRefunded;
    }

    mapping(address => Bid) private userBid; // 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 UserRefunded(
        address indexed user,
        uint256 bidAmount,
        uint256 indexed wonItemsCount
    );

    //  ============================================================
    //  Init
    //  ============================================================

    constructor(address financeWallet, uint64 minBidAmount, uint256 bidItemsCount) {
        _setFinanceWalletAddress(financeWallet);
        MIN_BID_AMOUNT = minBidAmount;
        BID_ITEMS_COUNT = bidItemsCount;
    }

    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 _address user address
    /// @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 = userBid[msg.sender].amount + msg.value;
        require(newAmount >= MIN_BID_AMOUNT, "Min Bid Required");
        require(newAmount <= MAX_BID_AMOUNT, "Max Bid Exceeded");

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

        if (userBid[msg.sender].exists) {
            userBid[msg.sender].amount = newAmount;
            userBid[msg.sender].updatedAt = uint32(block.timestamp);
        } else {
            userBid[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 bids) {
        Bid[] memory _bids = new Bid[](bidders.length);
        for (uint256 i; i < bidders.length; i++) {
            _bids[i] = userBid[bidders[i]];
        }
        return _bids;
    }

    /// @dev gets user's bid
    function getUserBid(address bidder) external view returns (uint256 bidAmount) {
        return userBid[bidder].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 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 user won items count
    function refund(
        bytes32[] calldata proof,
        uint256 wonItemsCount
    ) external nonReentrant {
        uint256 userBidAmount = userBid[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(totalWonItemsCount > 0, "totalWonItemsCount not set");
        require(finalPrice > 0, "finalPrice not set");
        uint256 sales = totalWonItemsCount * finalPrice;
        uint256 available = sales - withdrawn;
        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");
        withdrawn += _amount;
    }

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

    //  ============================================================
    //  Auction Administration
    //  ============================================================

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

    function setMaxBidAmount(
        uint256 amount
    ) external onlyOwner {
        MAX_BID_AMOUNT = amount;
    }

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

    function setTotalWonItemsCount(uint256 items) external onlyOwner {
        require(items <= BID_ITEMS_COUNT, "Too many won items");
        totalWonItemsCount = 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 (BidderRefundStatus[] memory)
    {
        BidderRefundStatus[] memory _status = new BidderRefundStatus[](bidders.length);
        for (uint256 i; i < bidders.length; i++) {
            _status[i] = BidderRefundStatus(bidders[i], isUserRefunded[bidders[i]]);
        }
        return _status;
    }
}

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

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

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

File 3 of 9 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // 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;

    constructor() {
        _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 Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 4 of 9 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 5 of 9 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @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 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 6 of 9 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (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 rebuilds 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 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 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 from 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) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                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 rebuilds 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 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 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 from 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) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                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 7 of 9 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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 256, 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 << 3) < value ? 1 : 0);
        }
    }
}

File 8 of 9 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"financeWallet","type":"address"},{"internalType":"uint64","name":"minBidAmount","type":"uint64"},{"internalType":"uint256","name":"bidItemsCount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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"},{"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_AMOUNT","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 Auction.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":[],"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 Auction.Bid[]","name":"bids","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":[{"components":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"bool","name":"isRefunded","type":"bool"}],"internalType":"struct Auction.BidderRefundStatus[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bidder","type":"address"}],"name":"getUserBid","outputs":[{"internalType":"uint256","name":"bidAmount","type":"uint256"}],"stateMutability":"view","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":"count","type":"uint256"}],"name":"setBidItemsCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setFinalPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxBidAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setMerkleRootForWonItemsCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMinBidAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"items","type":"uint256"}],"name":"setTotalWonItemsCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWonItemsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"withdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405267d02ab486cedc00006004553480156200001c575f80fd5b5060405162001c1538038062001c158339810160408190526200003f9162000131565b60015f556200004e3362000071565b6200005983620000c2565b6001600160401b03909116600555600655506200018a565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0381166200010f5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f805f6060848603121562000144575f80fd5b83516001600160a01b03811681146200015b575f80fd5b60208501519093506001600160401b038116811462000178575f80fd5b80925050604084015190509250925092565b611a7d80620001985f395ff3fe6080604052600436106101ef575f3560e01c80638da5cb5b1161010b578063c80ec52211610099578063e6ba4a181161006b578063e6ba4a1814610586578063e961928e146105a5578063ed0f8888146105dc578063f16f6674146105f1578063f2fde38b1461061057005b8063c80ec52214610529578063ce22bc671461053e578063cff29dfd14610552578063dd1007921461057157005b8063a6b513ee116100dd578063a6b513ee146104a1578063b66b2073146104b6578063b81c78ec146104ca578063b9ea2fc4146104eb578063bb55f25c1461050a57005b80638da5cb5b1461043c578063900c1220146104595780639688a21d146104785780639ce05df71461048d57005b806337369b2211610188578063525614c31161015a578063525614c31461039c578063715018a6146103bb5780637fb45099146103cf578063853828b6146103fc5780638a828b081461041057005b806337369b221461031d57806339c8ac8914610331578063417fd6b61461036857806345f4d7351461038757005b806318133d15116101c157806318133d15146102695780631bb89762146102a75780631e28ecad146102c5578063343039d5146102e657005b806308bfc300146101f85780630ce28dc41461022357806311cfcadb1461022b57806312cc4ce61461024a57005b366101f657005b005b348015610203575f80fd5b5061020c61062f565b60405160ff90911681526020015b60405180910390f35b6101f6610654565b348015610236575f80fd5b506101f66102453660046116ef565b610933565b348015610255575f80fd5b506101f66102643660046116ef565b610940565b348015610274575f80fd5b50610297610283366004611721565b600c6020525f908152604090205460ff1681565b604051901515815260200161021a565b3480156102b2575f80fd5b50600a545b60405190815260200161021a565b3480156102d0575f80fd5b506102d96109b9565b60405161021a919061173a565b3480156102f1575f80fd5b50600254610305906001600160a01b031681565b6040516001600160a01b03909116815260200161021a565b348015610328575f80fd5b506101f6610aec565b34801561033c575f80fd5b506102b761034b366004611721565b6001600160a01b03165f908152600b602052604090206001015490565b348015610373575f80fd5b506101f66103823660046116ef565b610c78565b348015610392575f80fd5b506102b760055481565b3480156103a7575f80fd5b506101f66103b63660046116ef565b610c85565b3480156103c6575f80fd5b506101f6610c92565b3480156103da575f80fd5b506001546103ef90600160a01b900460ff1681565b60405161021a91906117a7565b348015610407575f80fd5b506101f6610ca5565b34801561041b575f80fd5b5061042f61042a3660046117cd565b610d31565b60405161021a91906117ed565b348015610447575f80fd5b506001546001600160a01b0316610305565b348015610464575f80fd5b506101f6610473366004611839565b610e23565b348015610483575f80fd5b506102b760065481565b348015610498575f80fd5b506007546102b7565b3480156104ac575f80fd5b506102b760075481565b3480156104c1575f80fd5b5061042f610e6a565b3480156104d5575f80fd5b506104de610eca565b60405161021a9190611859565b3480156104f6575f80fd5b506101f6610505366004611918565b61100e565b348015610515575f80fd5b506101f66105243660046116ef565b6112b7565b348015610534575f80fd5b506102b760095481565b348015610549575f80fd5b506102b7611306565b34801561055d575f80fd5b5061030561056c3660046116ef565b611316565b34801561057c575f80fd5b506102b760085481565b348015610591575f80fd5b506102976105a0366004611960565b61133e565b3480156105b0575f80fd5b506102976105bf366004611721565b6001600160a01b03165f908152600c602052604090205460ff1690565b3480156105e7575f80fd5b506102b760045481565b3480156105fc575f80fd5b506101f661060b3660046116ef565b6113dd565b34801561061b575f80fd5b506101f661062a366004611721565b611431565b6001545f90600160a01b900460ff16600481111561064f5761064f611793565b905090565b60018054600160a01b900460ff16600481111561067357610673611793565b146106bb5760405162461bcd60e51b81526020600482015260136024820152722134b23234b7339034b9903737ba1037b832b760691b60448201526064015b60405180910390fd5b345f036106fc5760405162461bcd60e51b815260206004820152600f60248201526e0426964206d757374206265203e203608c1b60448201526064016106b2565b335f908152600b60205260408120600101546107199034906119ca565b90506005548110156107605760405162461bcd60e51b815260206004820152601060248201526f135a5b88109a590814995c5d5a5c995960821b60448201526064016106b2565b6004548111156107a55760405162461bcd60e51b815260206004820152601060248201526f13585e08109a5908115e18d95959195960821b60448201526064016106b2565b335f818152600b602090815260409182902054915184815260ff9092161592917fa16480eaadf1bcfc74d6fe79423817d891a510e620d366c02a7d0b866dbf594f910160405180910390a3335f908152600b602052604090205460ff161561084057335f908152600b602052604090206001810191909155600201805467ffffffff0000000019166401000000004263ffffffff1602179055565b6040805160a081018252600180825233602080840182815284860187815263ffffffff42811660608801818152608089019182525f878152600b9096529885209751885494516001600160a01b031661010002610100600160a81b0319911515919091166001600160a81b031990951694909417939093178755905186860155955160029095018054915187166401000000000267ffffffffffffffff19909216959096169490941793909317909355600a805491820181559091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b03191690911790555b50565b61093b6114a7565b600355565b5f600154600160a01b900460ff16600481111561095f5761095f611793565b146109ac5760405162461bcd60e51b815260206004820152601760248201527f41756374696f6e20616c7265616479207374617274656400000000000000000060448201526064016106b2565b6109b46114a7565b600655565b600a546060905f9067ffffffffffffffff8111156109d9576109d96119dd565b604051908082528060200260200182016040528015610a1d57816020015b604080518082019091525f80825260208201528152602001906001900390816109f75790505b5090505f5b600a54811015610ae6576040518060400160405280600a8381548110610a4a57610a4a6119f1565b905f5260205f20015f9054906101000a90046001600160a01b03166001600160a01b03168152602001600c5f600a8581548110610a8957610a896119f1565b5f9182526020808320909101546001600160a01b0316835282019290925260400190205460ff16151590528251839083908110610ac857610ac86119f1565b60200260200101819052508080610ade90611a05565b915050610a22565b50919050565b610af46114a7565b6002600154600160a01b900460ff166004811115610b1457610b14611793565b1015610b5b5760405162461bcd60e51b815260206004820152601660248201527541756374696f6e206e6f7420636f6e636c7564696e6760501b60448201526064016106b2565b5f60085411610bac5760405162461bcd60e51b815260206004820152601a60248201527f746f74616c576f6e4974656d73436f756e74206e6f742073657400000000000060448201526064016106b2565b5f60075411610bf25760405162461bcd60e51b8152602060048201526012602482015271199a5b985b141c9a58d9481b9bdd081cd95d60721b60448201526064016106b2565b5f600754600854610c039190611a1d565b90505f60095482610c149190611a34565b90505f8111610c5e5760405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b60448201526064016106b2565b600254610c74906001600160a01b031682611501565b5050565b610c806114a7565b600555565b610c8d6114a7565b600455565b610c9a6114a7565b610ca35f6115ab565b565b610cad6114a7565b6004600154600160a01b900460ff166004811115610ccd57610ccd611793565b1015610d1b5760405162461bcd60e51b815260206004820152601860248201527f41756374696f6e20726566756e64206e6f7420656e646564000000000000000060448201526064016106b2565b600254610ca3906001600160a01b031647611501565b6060610d4282600a805490506115fc565b91505f610d4f8484611a34565b67ffffffffffffffff811115610d6757610d676119dd565b604051908082528060200260200182016040528015610d90578160200160208202803683370190505b5090505f5b610d9f8585611a34565b811015610e1957600a610db286836119ca565b81548110610dc257610dc26119f1565b905f5260205f20015f9054906101000a90046001600160a01b0316828281518110610def57610def6119f1565b6001600160a01b039092166020928302919091019091015280610e1181611a05565b915050610d95565b5090505b92915050565b610e2b6114a7565b8060ff166004811115610e4057610e40611793565b6001805460ff60a01b1916600160a01b836004811115610e6257610e62611793565b021790555050565b6060600a805480602002602001604051908101604052809291908181526020018280548015610ec057602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610ea2575b5050505050905090565b600a546060905f9067ffffffffffffffff811115610eea57610eea6119dd565b604051908082528060200260200182016040528015610f4157816020015b6040805160a0810182525f808252602080830182905292820181905260608201819052608082015282525f19909201910181610f085790505b5090505f5b600a54811015610ae657600b5f600a8381548110610f6657610f666119f1565b5f9182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160a081018452815460ff8116151582526101009004909416918401919091526001810154918301919091526002015463ffffffff80821660608401526401000000009091041660808201528251839083908110610ff057610ff06119f1565b6020026020010181905250808061100690611a05565b915050610f46565b611016611613565b335f908152600b60205260409020600101546003600154600160a01b900460ff16600481111561104857611048611793565b1461108e5760405162461bcd60e51b81526020600482015260166024820152751499599d5b99081b9bdd081cdd185c9d1959081e595d60521b60448201526064016106b2565b5f600754116110d55760405162461bcd60e51b8152602060048201526013602482015272119a5b985b081c1c9a58d9481b9bdd081cd95d606a1b60448201526064016106b2565b6110e13385858561133e565b61111d5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b60448201526064016106b2565b5f811161115c5760405162461bcd60e51b815260206004820152600d60248201526c139bc8189a59081c9958dbdc99609a1b60448201526064016106b2565b335f908152600c602052604090205460ff16156111ae5760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c99599d5b99195960821b60448201526064016106b2565b5f826007546111bd9190611a1d565b6111c79083611a34565b9050818111156112055760405162461bcd60e51b8152602060048201526009602482015268756e646572666c6f7760b81b60448201526064016106b2565b5f81116112475760405162461bcd60e51b815260206004820152601060248201526f139bc81c99599d5b99081b995959195960821b60448201526064016106b2565b335f818152600c602052604090819020805460ff19166001179055518491907f662bc2a64340bca927d72cb5c5ec2285714bb7a1b8927bb9c601287f4a479362906112959085815260200190565b60405180910390a36112a73382611501565b50506112b260015f55565b505050565b6112bf6114a7565b6005548110156113015760405162461bcd60e51b815260206004820152600d60248201526c507269636520746f6f206c6f7760981b60448201526064016106b2565b600755565b5f61130f6114a7565b5060035490565b600a8181548110611325575f80fd5b5f918252602090912001546001600160a01b0316905081565b604080516001600160a01b03861660208201529081018290525f90819060600160408051601f19818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506113d38585808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600354915084905061166a565b9695505050505050565b6113e56114a7565b60065481111561142c5760405162461bcd60e51b8152602060048201526012602482015271546f6f206d616e7920776f6e206974656d7360701b60448201526064016106b2565b600855565b6114396114a7565b6001600160a01b03811661149e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106b2565b610930816115ab565b6001546001600160a01b03163314610ca35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b2565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f811461154a576040519150601f19603f3d011682016040523d82523d5f602084013e61154f565b606091505b50509050806115905760405162461bcd60e51b815260206004820152600d60248201526c63616e7420776974686472617760981b60448201526064016106b2565b8160095f8282546115a191906119ca565b9091555050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f81831061160a578161160c565b825b9392505050565b60025f54036116645760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b2565b60025f55565b5f82611676858461167f565b14949350505050565b5f81815b8451811015610e19576116af828683815181106116a2576116a26119f1565b60200260200101516116c3565b9150806116bb81611a05565b915050611683565b5f8183106116dd575f82815260208490526040902061160c565b5f83815260208390526040902061160c565b5f602082840312156116ff575f80fd5b5035919050565b80356001600160a01b038116811461171c575f80fd5b919050565b5f60208284031215611731575f80fd5b61160c82611706565b602080825282518282018190525f919060409081850190868401855b8281101561178657815180516001600160a01b031685528601511515868501529284019290850190600101611756565b5091979650505050505050565b634e487b7160e01b5f52602160045260245ffd5b60208101600583106117c757634e487b7160e01b5f52602160045260245ffd5b91905290565b5f80604083850312156117de575f80fd5b50508035926020909101359150565b602080825282518282018190525f9190848201906040850190845b8181101561182d5783516001600160a01b031683529284019291840191600101611808565b50909695505050505050565b5f60208284031215611849575f80fd5b813560ff8116811461160c575f80fd5b602080825282518282018190525f919060409081850190868401855b82811015611786578151805115158552868101516001600160a01b031687860152858101518686015260608082015163ffffffff90811691870191909152608091820151169085015260a09093019290850190600101611875565b5f8083601f8401126118e0575f80fd5b50813567ffffffffffffffff8111156118f7575f80fd5b6020830191508360208260051b8501011115611911575f80fd5b9250929050565b5f805f6040848603121561192a575f80fd5b833567ffffffffffffffff811115611940575f80fd5b61194c868287016118d0565b909790965060209590950135949350505050565b5f805f8060608587031215611973575f80fd5b61197c85611706565b9350602085013567ffffffffffffffff811115611997575f80fd5b6119a3878288016118d0565b9598909750949560400135949350505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610e1d57610e1d6119b6565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60018201611a1657611a166119b6565b5060010190565b8082028115828204841417610e1d57610e1d6119b6565b81810381811115610e1d57610e1d6119b656fea2646970667358221220ae56950a40df3d1aeec3e9b8e849c145c2d1038e305ec43bbfda690fba741bae64736f6c634300081500330000000000000000000000002d797f422dfe8e2f5fe3be607e17a7a460553ddb00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000007d

Deployed Bytecode

0x6080604052600436106101ef575f3560e01c80638da5cb5b1161010b578063c80ec52211610099578063e6ba4a181161006b578063e6ba4a1814610586578063e961928e146105a5578063ed0f8888146105dc578063f16f6674146105f1578063f2fde38b1461061057005b8063c80ec52214610529578063ce22bc671461053e578063cff29dfd14610552578063dd1007921461057157005b8063a6b513ee116100dd578063a6b513ee146104a1578063b66b2073146104b6578063b81c78ec146104ca578063b9ea2fc4146104eb578063bb55f25c1461050a57005b80638da5cb5b1461043c578063900c1220146104595780639688a21d146104785780639ce05df71461048d57005b806337369b2211610188578063525614c31161015a578063525614c31461039c578063715018a6146103bb5780637fb45099146103cf578063853828b6146103fc5780638a828b081461041057005b806337369b221461031d57806339c8ac8914610331578063417fd6b61461036857806345f4d7351461038757005b806318133d15116101c157806318133d15146102695780631bb89762146102a75780631e28ecad146102c5578063343039d5146102e657005b806308bfc300146101f85780630ce28dc41461022357806311cfcadb1461022b57806312cc4ce61461024a57005b366101f657005b005b348015610203575f80fd5b5061020c61062f565b60405160ff90911681526020015b60405180910390f35b6101f6610654565b348015610236575f80fd5b506101f66102453660046116ef565b610933565b348015610255575f80fd5b506101f66102643660046116ef565b610940565b348015610274575f80fd5b50610297610283366004611721565b600c6020525f908152604090205460ff1681565b604051901515815260200161021a565b3480156102b2575f80fd5b50600a545b60405190815260200161021a565b3480156102d0575f80fd5b506102d96109b9565b60405161021a919061173a565b3480156102f1575f80fd5b50600254610305906001600160a01b031681565b6040516001600160a01b03909116815260200161021a565b348015610328575f80fd5b506101f6610aec565b34801561033c575f80fd5b506102b761034b366004611721565b6001600160a01b03165f908152600b602052604090206001015490565b348015610373575f80fd5b506101f66103823660046116ef565b610c78565b348015610392575f80fd5b506102b760055481565b3480156103a7575f80fd5b506101f66103b63660046116ef565b610c85565b3480156103c6575f80fd5b506101f6610c92565b3480156103da575f80fd5b506001546103ef90600160a01b900460ff1681565b60405161021a91906117a7565b348015610407575f80fd5b506101f6610ca5565b34801561041b575f80fd5b5061042f61042a3660046117cd565b610d31565b60405161021a91906117ed565b348015610447575f80fd5b506001546001600160a01b0316610305565b348015610464575f80fd5b506101f6610473366004611839565b610e23565b348015610483575f80fd5b506102b760065481565b348015610498575f80fd5b506007546102b7565b3480156104ac575f80fd5b506102b760075481565b3480156104c1575f80fd5b5061042f610e6a565b3480156104d5575f80fd5b506104de610eca565b60405161021a9190611859565b3480156104f6575f80fd5b506101f6610505366004611918565b61100e565b348015610515575f80fd5b506101f66105243660046116ef565b6112b7565b348015610534575f80fd5b506102b760095481565b348015610549575f80fd5b506102b7611306565b34801561055d575f80fd5b5061030561056c3660046116ef565b611316565b34801561057c575f80fd5b506102b760085481565b348015610591575f80fd5b506102976105a0366004611960565b61133e565b3480156105b0575f80fd5b506102976105bf366004611721565b6001600160a01b03165f908152600c602052604090205460ff1690565b3480156105e7575f80fd5b506102b760045481565b3480156105fc575f80fd5b506101f661060b3660046116ef565b6113dd565b34801561061b575f80fd5b506101f661062a366004611721565b611431565b6001545f90600160a01b900460ff16600481111561064f5761064f611793565b905090565b60018054600160a01b900460ff16600481111561067357610673611793565b146106bb5760405162461bcd60e51b81526020600482015260136024820152722134b23234b7339034b9903737ba1037b832b760691b60448201526064015b60405180910390fd5b345f036106fc5760405162461bcd60e51b815260206004820152600f60248201526e0426964206d757374206265203e203608c1b60448201526064016106b2565b335f908152600b60205260408120600101546107199034906119ca565b90506005548110156107605760405162461bcd60e51b815260206004820152601060248201526f135a5b88109a590814995c5d5a5c995960821b60448201526064016106b2565b6004548111156107a55760405162461bcd60e51b815260206004820152601060248201526f13585e08109a5908115e18d95959195960821b60448201526064016106b2565b335f818152600b602090815260409182902054915184815260ff9092161592917fa16480eaadf1bcfc74d6fe79423817d891a510e620d366c02a7d0b866dbf594f910160405180910390a3335f908152600b602052604090205460ff161561084057335f908152600b602052604090206001810191909155600201805467ffffffff0000000019166401000000004263ffffffff1602179055565b6040805160a081018252600180825233602080840182815284860187815263ffffffff42811660608801818152608089019182525f878152600b9096529885209751885494516001600160a01b031661010002610100600160a81b0319911515919091166001600160a81b031990951694909417939093178755905186860155955160029095018054915187166401000000000267ffffffffffffffff19909216959096169490941793909317909355600a805491820181559091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b03191690911790555b50565b61093b6114a7565b600355565b5f600154600160a01b900460ff16600481111561095f5761095f611793565b146109ac5760405162461bcd60e51b815260206004820152601760248201527f41756374696f6e20616c7265616479207374617274656400000000000000000060448201526064016106b2565b6109b46114a7565b600655565b600a546060905f9067ffffffffffffffff8111156109d9576109d96119dd565b604051908082528060200260200182016040528015610a1d57816020015b604080518082019091525f80825260208201528152602001906001900390816109f75790505b5090505f5b600a54811015610ae6576040518060400160405280600a8381548110610a4a57610a4a6119f1565b905f5260205f20015f9054906101000a90046001600160a01b03166001600160a01b03168152602001600c5f600a8581548110610a8957610a896119f1565b5f9182526020808320909101546001600160a01b0316835282019290925260400190205460ff16151590528251839083908110610ac857610ac86119f1565b60200260200101819052508080610ade90611a05565b915050610a22565b50919050565b610af46114a7565b6002600154600160a01b900460ff166004811115610b1457610b14611793565b1015610b5b5760405162461bcd60e51b815260206004820152601660248201527541756374696f6e206e6f7420636f6e636c7564696e6760501b60448201526064016106b2565b5f60085411610bac5760405162461bcd60e51b815260206004820152601a60248201527f746f74616c576f6e4974656d73436f756e74206e6f742073657400000000000060448201526064016106b2565b5f60075411610bf25760405162461bcd60e51b8152602060048201526012602482015271199a5b985b141c9a58d9481b9bdd081cd95d60721b60448201526064016106b2565b5f600754600854610c039190611a1d565b90505f60095482610c149190611a34565b90505f8111610c5e5760405162461bcd60e51b81526020600482015260166024820152754e6f2062616c616e636520746f20776974686472617760501b60448201526064016106b2565b600254610c74906001600160a01b031682611501565b5050565b610c806114a7565b600555565b610c8d6114a7565b600455565b610c9a6114a7565b610ca35f6115ab565b565b610cad6114a7565b6004600154600160a01b900460ff166004811115610ccd57610ccd611793565b1015610d1b5760405162461bcd60e51b815260206004820152601860248201527f41756374696f6e20726566756e64206e6f7420656e646564000000000000000060448201526064016106b2565b600254610ca3906001600160a01b031647611501565b6060610d4282600a805490506115fc565b91505f610d4f8484611a34565b67ffffffffffffffff811115610d6757610d676119dd565b604051908082528060200260200182016040528015610d90578160200160208202803683370190505b5090505f5b610d9f8585611a34565b811015610e1957600a610db286836119ca565b81548110610dc257610dc26119f1565b905f5260205f20015f9054906101000a90046001600160a01b0316828281518110610def57610def6119f1565b6001600160a01b039092166020928302919091019091015280610e1181611a05565b915050610d95565b5090505b92915050565b610e2b6114a7565b8060ff166004811115610e4057610e40611793565b6001805460ff60a01b1916600160a01b836004811115610e6257610e62611793565b021790555050565b6060600a805480602002602001604051908101604052809291908181526020018280548015610ec057602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610ea2575b5050505050905090565b600a546060905f9067ffffffffffffffff811115610eea57610eea6119dd565b604051908082528060200260200182016040528015610f4157816020015b6040805160a0810182525f808252602080830182905292820181905260608201819052608082015282525f19909201910181610f085790505b5090505f5b600a54811015610ae657600b5f600a8381548110610f6657610f666119f1565b5f9182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160a081018452815460ff8116151582526101009004909416918401919091526001810154918301919091526002015463ffffffff80821660608401526401000000009091041660808201528251839083908110610ff057610ff06119f1565b6020026020010181905250808061100690611a05565b915050610f46565b611016611613565b335f908152600b60205260409020600101546003600154600160a01b900460ff16600481111561104857611048611793565b1461108e5760405162461bcd60e51b81526020600482015260166024820152751499599d5b99081b9bdd081cdd185c9d1959081e595d60521b60448201526064016106b2565b5f600754116110d55760405162461bcd60e51b8152602060048201526013602482015272119a5b985b081c1c9a58d9481b9bdd081cd95d606a1b60448201526064016106b2565b6110e13385858561133e565b61111d5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b60448201526064016106b2565b5f811161115c5760405162461bcd60e51b815260206004820152600d60248201526c139bc8189a59081c9958dbdc99609a1b60448201526064016106b2565b335f908152600c602052604090205460ff16156111ae5760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c99599d5b99195960821b60448201526064016106b2565b5f826007546111bd9190611a1d565b6111c79083611a34565b9050818111156112055760405162461bcd60e51b8152602060048201526009602482015268756e646572666c6f7760b81b60448201526064016106b2565b5f81116112475760405162461bcd60e51b815260206004820152601060248201526f139bc81c99599d5b99081b995959195960821b60448201526064016106b2565b335f818152600c602052604090819020805460ff19166001179055518491907f662bc2a64340bca927d72cb5c5ec2285714bb7a1b8927bb9c601287f4a479362906112959085815260200190565b60405180910390a36112a73382611501565b50506112b260015f55565b505050565b6112bf6114a7565b6005548110156113015760405162461bcd60e51b815260206004820152600d60248201526c507269636520746f6f206c6f7760981b60448201526064016106b2565b600755565b5f61130f6114a7565b5060035490565b600a8181548110611325575f80fd5b5f918252602090912001546001600160a01b0316905081565b604080516001600160a01b03861660208201529081018290525f90819060600160408051601f19818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506113d38585808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600354915084905061166a565b9695505050505050565b6113e56114a7565b60065481111561142c5760405162461bcd60e51b8152602060048201526012602482015271546f6f206d616e7920776f6e206974656d7360701b60448201526064016106b2565b600855565b6114396114a7565b6001600160a01b03811661149e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106b2565b610930816115ab565b6001546001600160a01b03163314610ca35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b2565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f811461154a576040519150601f19603f3d011682016040523d82523d5f602084013e61154f565b606091505b50509050806115905760405162461bcd60e51b815260206004820152600d60248201526c63616e7420776974686472617760981b60448201526064016106b2565b8160095f8282546115a191906119ca565b9091555050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f81831061160a578161160c565b825b9392505050565b60025f54036116645760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b2565b60025f55565b5f82611676858461167f565b14949350505050565b5f81815b8451811015610e19576116af828683815181106116a2576116a26119f1565b60200260200101516116c3565b9150806116bb81611a05565b915050611683565b5f8183106116dd575f82815260208490526040902061160c565b5f83815260208390526040902061160c565b5f602082840312156116ff575f80fd5b5035919050565b80356001600160a01b038116811461171c575f80fd5b919050565b5f60208284031215611731575f80fd5b61160c82611706565b602080825282518282018190525f919060409081850190868401855b8281101561178657815180516001600160a01b031685528601511515868501529284019290850190600101611756565b5091979650505050505050565b634e487b7160e01b5f52602160045260245ffd5b60208101600583106117c757634e487b7160e01b5f52602160045260245ffd5b91905290565b5f80604083850312156117de575f80fd5b50508035926020909101359150565b602080825282518282018190525f9190848201906040850190845b8181101561182d5783516001600160a01b031683529284019291840191600101611808565b50909695505050505050565b5f60208284031215611849575f80fd5b813560ff8116811461160c575f80fd5b602080825282518282018190525f919060409081850190868401855b82811015611786578151805115158552868101516001600160a01b031687860152858101518686015260608082015163ffffffff90811691870191909152608091820151169085015260a09093019290850190600101611875565b5f8083601f8401126118e0575f80fd5b50813567ffffffffffffffff8111156118f7575f80fd5b6020830191508360208260051b8501011115611911575f80fd5b9250929050565b5f805f6040848603121561192a575f80fd5b833567ffffffffffffffff811115611940575f80fd5b61194c868287016118d0565b909790965060209590950135949350505050565b5f805f8060608587031215611973575f80fd5b61197c85611706565b9350602085013567ffffffffffffffff811115611997575f80fd5b6119a3878288016118d0565b9598909750949560400135949350505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610e1d57610e1d6119b6565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60018201611a1657611a166119b6565b5060010190565b8082028115828204841417610e1d57610e1d6119b6565b81810381811115610e1d57610e1d6119b656fea2646970667358221220ae56950a40df3d1aeec3e9b8e849c145c2d1038e305ec43bbfda690fba741bae64736f6c63430008150033

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

0000000000000000000000002d797f422dfe8e2f5fe3be607e17a7a460553ddb00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000007d

-----Decoded View---------------
Arg [0] : financeWallet (address): 0x2D797f422dfe8e2f5FE3be607E17A7a460553dDB
Arg [1] : minBidAmount (uint64): 1000000000000000
Arg [2] : bidItemsCount (uint256): 125

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000002d797f422dfe8e2f5fe3be607e17a7a460553ddb
Arg [1] : 00000000000000000000000000000000000000000000000000038d7ea4c68000
Arg [2] : 000000000000000000000000000000000000000000000000000000000000007d


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  ]
[ 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.