ETH Price: $3,398.12 (+1.50%)

Contract

0xdDd9abEc523A05aDC1E1B7a97f5015Ece0FB492a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Bid181923362023-09-22 15:41:23463 days ago1695397283IN
0xdDd9abEc...ce0FB492a
0.22 ETH0.002051839.28667779
Create Bid181923332023-09-22 15:40:47463 days ago1695397247IN
0xdDd9abEc...ce0FB492a
0.22 ETH0.002121249.60081118
Create Bid181873862023-09-21 23:00:47464 days ago1695337247IN
0xdDd9abEc...ce0FB492a
0.24 ETH0.0028722713
Create Bid181873842023-09-21 23:00:23464 days ago1695337223IN
0xdDd9abEc...ce0FB492a
0.24 ETH0.0026513212
Create Bid181213142023-09-12 16:03:11473 days ago1694534591IN
0xdDd9abEc...ce0FB492a
0.24 ETH0.0095377640.06923597
Set Auction Appr...181212412023-09-12 15:48:23473 days ago1694533703IN
0xdDd9abEc...ce0FB492a
0 ETH0.0022673324.59063896
Set Auction Appr...181212402023-09-12 15:48:11473 days ago1694533691IN
0xdDd9abEc...ce0FB492a
0 ETH0.0022490624.39250765
Set Auction Appr...181212392023-09-12 15:47:59473 days ago1694533679IN
0xdDd9abEc...ce0FB492a
0 ETH0.0023166825.12592362
Set Auction Appr...181212382023-09-12 15:47:47473 days ago1694533667IN
0xdDd9abEc...ce0FB492a
0 ETH0.002391825.94061223
Set Auction Appr...181212372023-09-12 15:47:35473 days ago1694533655IN
0xdDd9abEc...ce0FB492a
0 ETH0.0025773924.20291817
Create Auction181206272023-09-12 13:44:23473 days ago1694526263IN
0xdDd9abEc...ce0FB492a
0 ETH0.0049946521.26126119
Create Auction181206262023-09-12 13:44:11473 days ago1694526251IN
0xdDd9abEc...ce0FB492a
0 ETH0.0054378321.32540933
Create Auction181206232023-09-12 13:43:35473 days ago1694526215IN
0xdDd9abEc...ce0FB492a
0 ETH0.0059308923.25904025
Create Auction181206212023-09-12 13:43:11473 days ago1694526191IN
0xdDd9abEc...ce0FB492a
0 ETH0.0057023122.36263115
Create Auction181206182023-09-12 13:42:35473 days ago1694526155IN
0xdDd9abEc...ce0FB492a
0 ETH0.0055382622.20806107

Latest 15 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
181923842023-09-22 15:50:59463 days ago1695397859
0xdDd9abEc...ce0FB492a
0.24 ETH
181923842023-09-22 15:50:59463 days ago1695397859
0xdDd9abEc...ce0FB492a
0.24 ETH
181923772023-09-22 15:49:35463 days ago1695397775
0xdDd9abEc...ce0FB492a
0.24 ETH
181923772023-09-22 15:49:35463 days ago1695397775
0xdDd9abEc...ce0FB492a
0.24 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.22 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.22 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.22 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.22 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.24 ETH
181923692023-09-22 15:47:59463 days ago1695397679
0xdDd9abEc...ce0FB492a
0.24 ETH
181923362023-09-22 15:41:23463 days ago1695397283
0xdDd9abEc...ce0FB492a
0.22 ETH
181923332023-09-22 15:40:47463 days ago1695397247
0xdDd9abEc...ce0FB492a
0.22 ETH
181873862023-09-21 23:00:47464 days ago1695337247
0xdDd9abEc...ce0FB492a
0.24 ETH
181873842023-09-21 23:00:23464 days ago1695337223
0xdDd9abEc...ce0FB492a
0.24 ETH
181213142023-09-12 16:03:11473 days ago1694534591
0xdDd9abEc...ce0FB492a
0.24 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
YecheAuctionHouseV2

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 13 : YecheAuction.sol
// SPDX-License-Identifier: GPL-3.0
// Forked from Zora Auction House: https://github.com/ourzora/auction-house

pragma solidity ^0.8.11;  
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import { IERC721, IERC165 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
import { IYecheAuctionHouseV2 } from "./IYecheAuction.sol";

interface IWETH {
    function deposit() external payable;
    function withdraw(uint wad) external;

    function transfer(address to, uint256 value) external returns (bool);
}

/**
 * @title Yeche Lange auction contract
 */
contract YecheAuctionHouseV2 is IYecheAuctionHouseV2, Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using Counters for Counters.Counter;

    //Bid history
    mapping (uint256 => mapping (uint256 => IYecheAuctionHouseV2.Bid)) public bidHistory;

    //Did this user place a bid on this auction? 
    mapping (uint256 => mapping (address => bool)) public userBid;

    mapping (uint256 => uint256) public numBids;

    // The minimum amount of time left in an auction after a new bid is created
    uint256 public timeBuffer;

    // The minimum percentage difference between the last bid amount and the current bid.
    uint8 public minBidIncrementPercentage;

    // / The address of the WETH contract, so that any ETH transferred can be handled as an ERC-20
    address public wethAddress;

    // A mapping of all of the auctions currently running.
    mapping(uint256 => IYecheAuctionHouseV2.Auction) public auctions;

    // Get auction ID for a given contract address and token ID
    mapping(address => mapping(uint256 => uint256)) public tokenToAuction;

    bytes4 constant interfaceId = 0x80ac58cd; // 721 interface id

    uint256[] public activeAuctionIds;
    uint256 public activeAuctionCount = 0;

    Counters.Counter public _auctionIdTracker;

    /**
     * @notice Require that the specified auction exists
     */
    modifier auctionExists(uint256 auctionId) {
        require(_exists(auctionId), "Auction doesn't exist");
        _;
    }

    /*
     * Constructor
     */
    constructor(address _weth) {
        wethAddress = _weth;
        timeBuffer = 5 * 60; // extend 5 minutes after every bid made in last 5 minutes
        minBidIncrementPercentage = 5; // 5%
    }

    /**
     * @notice Create an auction.
     * @dev Store the auction details in the auctions mapping and emit an AuctionCreated event.
     */
    function createAuction(
        uint256 tokenId,
        address tokenContract,
        uint256 duration,
        uint256 reservePrice,
        address payable splitAddress,
        address auctionCurrency
    ) public override nonReentrant onlyOwner returns (uint256) {

        require(
            IERC165(tokenContract).supportsInterface(interfaceId),
            "tokenContract does not support ERC721 interface"
        );

        address tokenOwner = IERC721(tokenContract).ownerOf(tokenId);

        require(msg.sender == IERC721(tokenContract).getApproved(tokenId) || msg.sender == tokenOwner, "Caller must be approved or owner for token id");
        
        uint256 auctionId = _auctionIdTracker.current();

        tokenToAuction[tokenContract][tokenId] = auctionId;

        auctions[auctionId] = Auction({
            tokenId: tokenId,
            tokenContract: tokenContract,
            approved: false,
            amount: 0,
            duration: duration,
            startTime: 0,
            reservePrice: reservePrice,
            tokenOwner: tokenOwner,
            bidder: payable(address(0)),
            splitAddress: splitAddress,
            auctionCurrency: auctionCurrency
        });

        IERC721(tokenContract).transferFrom(tokenOwner, address(this), tokenId);

        _auctionIdTracker.increment();

        emit AuctionCreated(auctionId, tokenId, tokenContract, duration, reservePrice, tokenOwner, splitAddress, auctionCurrency);

        return auctionId;
    }

    function getCurAuctionId() external view returns (uint256) {
        return _auctionIdTracker.current();
    }

    function getAuctionId(address tokenContract, uint256 tokenId) external view returns (uint256) {
        uint256 auctionId = tokenToAuction[tokenContract][tokenId];
        if (_exists(auctionId)) { 
            return auctionId;
        } else {
            return 0; 
        }
    }

    function getTimeRemaining(uint256 auctionId) external view returns (uint256) {
        if (auctions[auctionId].startTime == 0) {
            return 0;
        }
        uint256 timeRemaining = auctions[auctionId].startTime.add(auctions[auctionId].duration).sub(block.timestamp);
        if (timeRemaining > 0) {
            return timeRemaining;
        } else {
            return 0;
        }
    }        

    function getBidHistory(uint256 auctionId) external view returns (Bid[] memory) {
        IYecheAuctionHouseV2.Bid[] memory bids = new IYecheAuctionHouseV2.Bid[](numBids[auctionId]);

        for (uint i = 0; i < numBids[auctionId]; i++) {
            bids[i] = bidHistory[auctionId][i];
        }
        return bids;
    }

    function getUserBid(address user, uint256 minAuctionId, uint256 maxAuctionId) external view returns (bool) {
        for (uint i = minAuctionId; i <= maxAuctionId; i++) {
            if (userBid[i][user]) {
                return true;
            }
        }
        return false;
    }

    /**
     * @notice Approve an auction, opening up the auction for bids.
     * @dev Only callable by the owner. Cannot be called if the auction has already started.
     */
    function setAuctionApproval(uint256 auctionId, bool approved) external override onlyOwner auctionExists(auctionId) {
        // require(auctions[auctionId].firstBidTime == 0, "Auction has already started");
        require(numBids[auctionId] == 0, "Auction has already started");

        //set start time to now
        auctions[auctionId].startTime = block.timestamp;

        activeAuctionIds.push(auctionId);
        activeAuctionCount++;

        _approveAuction(auctionId, approved);
    }

    function setAuctionReservePrice(uint256 auctionId, uint256 reservePrice) external override onlyOwner auctionExists(auctionId) {
        // require(auctions[auctionId].firstBidTime == 0, "Auction has already started");
        require(numBids[auctionId] == 0, "Auction has already started");
        auctions[auctionId].reservePrice = reservePrice;

        emit AuctionReservePriceUpdated(auctionId, auctions[auctionId].tokenId, auctions[auctionId].tokenContract, reservePrice);
    }

    /**
     * @notice Create a bid on a token, with a given amount.
     * @dev If provided a valid bid, transfers the provided amount to this contract.
     * If the auction is run in native ETH, the ETH is wrapped so it can be identically to other
     * auction currencies in this contract.
     */
    function createBid(uint256 auctionId, uint256 amount)
    external
    override
    payable
    auctionExists(auctionId)
    nonReentrant
    {
        address payable lastBidder = auctions[auctionId].bidder;
        require(auctions[auctionId].approved, "Auction must be approved by contract owner");
        require(
            auctions[auctionId].startTime == 0 ||
            block.timestamp <
            auctions[auctionId].startTime.add(auctions[auctionId].duration),
            "Auction expired"
        );
        require(
            amount >= auctions[auctionId].reservePrice,
                "Must send at least reservePrice"
        );
        require(
            amount >= auctions[auctionId].amount.add(
                auctions[auctionId].amount.mul(minBidIncrementPercentage).div(100)
            ),
            "Must send more than last bid by minBidIncrementPercentage amount"
        );

        //Refund last bidder if there has already been a bid
        if(numBids[auctionId] > 0 && lastBidder != address(0)) {
            _handleOutgoingBid(lastBidder, auctions[auctionId].amount, auctions[auctionId].auctionCurrency);
        }

        _handleIncomingBid(amount, auctions[auctionId].auctionCurrency);

        auctions[auctionId].amount = amount;
        auctions[auctionId].bidder = payable(msg.sender);

        //update userBid 
        userBid[auctionId][msg.sender] = true;

        //add bid to bid history
        bidHistory[auctionId][numBids[auctionId]] = Bid({
            bidder: payable(msg.sender),
            amount: amount,
            timestamp: block.timestamp
        });
        numBids[auctionId]++;

        bool extended = false;
        // at this point we know that the timestamp is less than start + duration (since the auction would be over, otherwise)
        // we want to know by how much the timestamp is less than start + duration
        // if the difference is less than the timeBuffer, increase the duration by the timeBuffer
        if (
            auctions[auctionId].startTime.add(auctions[auctionId].duration).sub(
                block.timestamp
            ) < timeBuffer
        ) {
            uint256 oldDuration = auctions[auctionId].duration;
            auctions[auctionId].duration =
                oldDuration.add(timeBuffer.sub(auctions[auctionId].startTime.add(oldDuration).sub(block.timestamp)));
            extended = true;
        }

        emit AuctionBid(
            auctionId,
            auctions[auctionId].tokenId,
            auctions[auctionId].tokenContract,
            msg.sender,
            amount,
            lastBidder == address(0), // firstBid boolean
            extended
        );

        if (extended) {
            emit AuctionDurationExtended(
                auctionId,
                auctions[auctionId].tokenId,
                auctions[auctionId].tokenContract,
                auctions[auctionId].duration
            );
        }
    }

    /**
     * @notice Get array of active auction IDs.
     */
    function getActiveAuctionIds() external view returns (uint256[] memory) {
        return activeAuctionIds;
    }

    /**
     * @notice Check if there are any expired auctions that need to be ended.
     */
    function areThereExpiredAuctions() external view returns (bool) {
        for (uint256 i = 0; i < activeAuctionCount; i++) {
            uint256 auctionId = activeAuctionIds[i];
            Auction storage auction = auctions[auctionId];
            if (block.timestamp >= auction.startTime.add(auction.duration)) {
                return true;
            }
        }
        return false;
    }

    /**
     * @notice End all auctions that are expired
     */
    function endExpiredAuctions() external nonReentrant {
        for (uint256 i = 0; i < activeAuctionCount; i++) {
            uint256 auctionId = activeAuctionIds[i];
            if (block.timestamp >= auctions[auctionId].startTime.add(auctions[auctionId].duration)) {
                _endAuctionInternal(auctionId);
            }
        }
    }

    /**
     * @notice End an auction, finalizing the bid on Zora if applicable and paying out the respective parties.
     * @dev If for some reason the auction cannot be finalized (invalid token recipient, for example),
     * The auction is reset and the NFT is transferred back to the auction creator.
     * 
     * Allow anyone to end an auction after it's expired. 
     */
    function endAuction(uint256 auctionId) external override auctionExists(auctionId) nonReentrant {
        _endAuctionInternal(auctionId);
    }

    function _endAuctionInternal(uint256 auctionId) internal {
        require(
            block.timestamp >=
            auctions[auctionId].startTime.add(auctions[auctionId].duration),
            "Auction still in progress"
        );

        if(numBids[auctionId] == 0) {
            _removeActiveAuction(auctionId);
            _cancelAuction(auctionId);
            return;
        }

        address currency = auctions[auctionId].auctionCurrency == address(0) ? wethAddress : auctions[auctionId].auctionCurrency;

        uint256 tokenOwnerProfit = auctions[auctionId].amount;

        // transfer the token to the winner and pay out the participants below
        try IERC721(auctions[auctionId].tokenContract).safeTransferFrom(address(this), auctions[auctionId].bidder, auctions[auctionId].tokenId) {} catch {
            _handleOutgoingBid(auctions[auctionId].bidder, auctions[auctionId].amount, auctions[auctionId].auctionCurrency);
            _cancelAuction(auctionId);
            return;
        }

        _handleOutgoingBid(auctions[auctionId].splitAddress, tokenOwnerProfit, auctions[auctionId].auctionCurrency);

        emit AuctionEnded(
            auctionId,
            auctions[auctionId].tokenId,
            auctions[auctionId].tokenContract,
            auctions[auctionId].tokenOwner,
            auctions[auctionId].splitAddress,
            auctions[auctionId].bidder,
            tokenOwnerProfit,
            currency
        );

        _removeActiveAuction(auctionId);

        delete auctions[auctionId];
    }

    /**
     * @notice Cancel an auction.
     * @dev Transfers the NFT back to the auction creator and emits an AuctionCanceled event
     * Owner can cancel an auction at any time.
     */
    function cancelAuction(uint256 auctionId) external override nonReentrant onlyOwner auctionExists(auctionId) {
        _removeActiveAuction(auctionId);
        _cancelAuction(auctionId);
    }

    /**
     * @notice Remove an auction from the list of active auctions.
     */
    function _removeActiveAuction(uint256 auctionId) internal {
        for (uint256 i = 0; i < activeAuctionCount; i++) {
            if (activeAuctionIds[i] == auctionId) {
                // Swap with the last element if i is not the last element
                if (i != activeAuctionCount - 1) {
                    activeAuctionIds[i] = activeAuctionIds[activeAuctionCount - 1];
                }
                // Remove the last element
                activeAuctionIds.pop();
                activeAuctionCount--;
                break;
            }
        }
    }

    /**
     * @dev Given an amount and a currency, transfer the currency to this contract.
     * If the currency is ETH (0x0), attempt to wrap the amount as WETH
     */
    function _handleIncomingBid(uint256 amount, address currency) internal {
        // If this is an ETH bid, ensure they sent enough and convert it to WETH under the hood
        if(currency == address(0)) {
            require(msg.value == amount, "Sent ETH Value does not match specified bid amount");
            IWETH(wethAddress).deposit{value: amount}();
        } else {
            // We must check the balance that was actually transferred to the auction,
            // as some tokens impose a transfer fee and would not actually transfer the
            // full amount to the market, resulting in potentally locked funds
            IERC20 token = IERC20(currency);
            uint256 beforeBalance = token.balanceOf(address(this));
            token.safeTransferFrom(msg.sender, address(this), amount);
            uint256 afterBalance = token.balanceOf(address(this));
            require(beforeBalance.add(amount) == afterBalance, "Token transfer call did not transfer expected amount");
        }
    }

    function _handleOutgoingBid(address to, uint256 amount, address currency) internal {
        // If the auction is in ETH, unwrap it from its underlying WETH and try to send it to the recipient.
        if(currency == address(0)) {
            IWETH(wethAddress).withdraw(amount);

            // If the ETH transfer fails (sigh), rewrap the ETH and try send it as WETH.
            if(!_safeTransferETH(to, amount)) {
                IWETH(wethAddress).deposit{value: amount}();
                IERC20(wethAddress).safeTransfer(to, amount);
            }
        } else {
            IERC20(currency).safeTransfer(to, amount);
        }
    }

    function _safeTransferETH(address to, uint256 value) internal returns (bool) {
        (bool success, ) = to.call{value: value}(new bytes(0));
        return success;
    }

    function _cancelAuction(uint256 auctionId) internal {
        address tokenOwner = auctions[auctionId].tokenOwner;
        IERC721(auctions[auctionId].tokenContract).safeTransferFrom(address(this), tokenOwner, auctions[auctionId].tokenId);

        emit AuctionCanceled(auctionId, auctions[auctionId].tokenId, auctions[auctionId].tokenContract, tokenOwner);
        delete auctions[auctionId];
    }

    function _approveAuction(uint256 auctionId, bool approved) internal {
        auctions[auctionId].approved = approved;
        emit AuctionApprovalUpdated(auctionId, auctions[auctionId].tokenId, auctions[auctionId].tokenContract, approved);
    }

    function _exists(uint256 auctionId) internal view returns(bool) {
        return auctions[auctionId].tokenOwner != address(0);
    }

    // TODO: consider reverting if the message sender is not WETH
    receive() external payable {}
    fallback() external payable {}
}

File 2 of 13 : 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 13 : 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 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 5 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 6 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 7 of 13 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 9 of 13 : 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 10 of 13 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 11 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 12 of 13 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 13 of 13 : IYecheAuction.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.11;  
pragma experimental ABIEncoderV2;

/**
 * @title Interface for Auction Houses
 */
interface IYecheAuctionHouseV2 {
    struct Auction {
        // ID for the ERC721 token
        uint256 tokenId;
        // Address for the ERC721 contract
        address tokenContract;
        // Whether or not the auction contract owner has approved the auction to start
        bool approved;
        // The current highest bid amount
        uint256 amount;
        // The length of time to run the auction for, after the first bid was made
        uint256 duration;
        // The start time of the auction, set on creation
        uint256 startTime;
        // The minimum price of the first bid
        uint256 reservePrice;
        // The address that should receive the funds once the NFT is sold.
        address tokenOwner;
        // The address of the current highest bid
        address payable bidder;
        // The split address for this NFT.
        address payable splitAddress;
        // The address of the ERC-20 currency to run the auction with.
        // If set to 0x0, the auction will be run in ETH
        address auctionCurrency;
    }

    struct Bid {
        address payable bidder;
        uint256 amount;
        uint256 timestamp;
    }

    event AuctionCreated(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        uint256 duration,
        uint256 reservePrice,
        address tokenOwner,
        address splitAddress,
        address auctionCurrency
    );

    event AuctionApprovalUpdated(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        bool approved
    );

    event AuctionReservePriceUpdated(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        uint256 reservePrice
    );

    event AuctionBid(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        address sender,
        uint256 value,
        bool firstBid,
        bool extended
    );

    event AuctionDurationExtended(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        uint256 duration
    );

    event AuctionEnded(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        address tokenOwner,
        address splitAddress,
        address winner,
        uint256 amount,
        address auctionCurrency
    );

    event AuctionCanceled(
        uint256 indexed auctionId,
        uint256 indexed tokenId,
        address indexed tokenContract,
        address tokenOwner
    );

    function createAuction(
        uint256 tokenId,
        address tokenContract,
        uint256 duration,
        uint256 reservePrice,
        address payable splitAddress,
        address auctionCurrency
    ) external returns (uint256);

    function getCurAuctionId() external view returns (uint256);

    function getAuctionId(address tokenContract, uint256 tokenId) external view returns (uint256);

    function getBidHistory(uint256 auctionId) external view returns (Bid[] memory);

    function getActiveAuctionIds() external view returns (uint256[] memory);

    function getUserBid(address user, uint256 minAuctionId, uint256 maxAuctionId) external view returns (bool);

    function setAuctionApproval(uint256 auctionId, bool approved) external;

    function setAuctionReservePrice(uint256 auctionId, uint256 reservePrice) external;

    function createBid(uint256 auctionId, uint256 amount) external payable;

    function endAuction(uint256 auctionId) external;

    function areThereExpiredAuctions() external view returns (bool);

    function getTimeRemaining(uint256 auctionId) external view returns (uint256);

    function endExpiredAuctions() external;

    function cancelAuction(uint256 auctionId) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"AuctionApprovalUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bool","name":"firstBid","type":"bool"},{"indexed":false,"internalType":"bool","name":"extended","type":"bool"}],"name":"AuctionBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOwner","type":"address"}],"name":"AuctionCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reservePrice","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":false,"internalType":"address","name":"splitAddress","type":"address"},{"indexed":false,"internalType":"address","name":"auctionCurrency","type":"address"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"AuctionDurationExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":false,"internalType":"address","name":"splitAddress","type":"address"},{"indexed":false,"internalType":"address","name":"winner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"auctionCurrency","type":"address"}],"name":"AuctionEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"reservePrice","type":"uint256"}],"name":"AuctionReservePriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"_auctionIdTracker","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activeAuctionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activeAuctionIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"areThereExpiredAuctions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"auctions","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"bool","name":"approved","type":"bool"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"reservePrice","type":"uint256"},{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address payable","name":"bidder","type":"address"},{"internalType":"address payable","name":"splitAddress","type":"address"},{"internalType":"address","name":"auctionCurrency","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"bidHistory","outputs":[{"internalType":"address payable","name":"bidder","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"cancelAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"reservePrice","type":"uint256"},{"internalType":"address payable","name":"splitAddress","type":"address"},{"internalType":"address","name":"auctionCurrency","type":"address"}],"name":"createAuction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"endAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endExpiredAuctions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveAuctionIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getAuctionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getBidHistory","outputs":[{"components":[{"internalType":"address payable","name":"bidder","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IYecheAuctionHouseV2.Bid[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurAuctionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getTimeRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"minAuctionId","type":"uint256"},{"internalType":"uint256","name":"maxAuctionId","type":"uint256"}],"name":"getUserBid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBidIncrementPercentage","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"numBids","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setAuctionApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"},{"internalType":"uint256","name":"reservePrice","type":"uint256"}],"name":"setAuctionReservePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenToAuction","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":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userBid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526000600a553480156200001657600080fd5b5060405162002de438038062002de48339810160408190526200003991620000d2565b620000443362000082565b600180556006805461012c600590815560ff196001600160a01b0390941661010002939093166001600160a81b031990911617909117905562000104565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000e557600080fd5b81516001600160a01b0381168114620000fd57600080fd5b9392505050565b612cd080620001146000396000f3fe6080604052600436106101a35760003560e01c80638da5cb5b116100e0578063c0738dce11610084578063ec91f2a411610061578063ec91f2a414610627578063eff15dc21461063d578063f2fde38b14610652578063fdc5f3d11461067257005b8063c0738dce146105c5578063c26011e1146105f2578063dd9f1b2d1461061257005b8063973ddb4a116100bd578063973ddb4a14610546578063b296024d14610566578063b7751c7114610592578063b9a2de3a146105a557005b80638da5cb5b146104db578063937d97a5146104f957806396b5a7551461052657005b806361ab546e1161014757806372e2867d1161012457806372e2867d146104325780637792ba5f146104485780637d95c73f146104805780638cd42991146104bb57005b806361ab546e146103895780636f8a41e1146103fd578063715018a61461041d57005b80634f0e0ef3116101805780634f0e0ef3146102165780634ff1ae831461025357806351e9e6aa14610283578063571a26a01461029857005b80632c6ea90d146101ac5780633ff9d326146101df5780634c73b0ad146101ff57005b366101aa57005b005b3480156101b857600080fd5b506101cc6101c73660046128af565b610694565b6040519081526020015b60405180910390f35b3480156101eb57600080fd5b506101cc6101fa3660046128dd565b6106b5565b34801561020b57600080fd5b50600b546101cc9081565b34801561022257600080fd5b5060065461023b9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101d6565b34801561025f57600080fd5b5061027361026e366004612909565b610715565b60405190151581526020016101d6565b34801561028f57600080fd5b506101cc610774565b3480156102a457600080fd5b506103246102b33660046128af565b6007602081905260009182526040909120805460018201546002830154600384015460048501546005860154600687015497870154600888015460099098015496986001600160a01b0380881699600160a01b90980460ff169896979596949593949181169392811692811691168b565b604080519b8c526001600160a01b039a8b1660208d0152981515988b019890985260608a0196909652608089019490945260a088019290925260c0870152841660e08601528316610100850152821661012084015216610140820152610160016101d6565b34801561039557600080fd5b506103d86103a436600461293e565b600260208181526000938452604080852090915291835291208054600182015491909201546001600160a01b039092169183565b604080516001600160a01b0390941684526020840192909252908201526060016101d6565b34801561040957600080fd5b506101aa61041836600461293e565b610784565b34801561042957600080fd5b506101aa6108b2565b34801561043e57600080fd5b506101cc600a5481565b34801561045457600080fd5b506101cc6104633660046128dd565b600860209081526000928352604080842090915290825290205481565b34801561048c57600080fd5b5061027361049b366004612960565b600360209081526000928352604080842090915290825290205460ff1681565b3480156104c757600080fd5b506101cc6104d63660046128af565b6108c6565b3480156104e757600080fd5b506000546001600160a01b031661023b565b34801561050557600080fd5b506101cc6105143660046128af565b60046020526000908152604090205481565b34801561053257600080fd5b506101aa6105413660046128af565b61092b565b34801561055257600080fd5b506101aa61056136600461299e565b6109bb565b34801561057257600080fd5b506006546105809060ff1681565b60405160ff90911681526020016101d6565b6101aa6105a036600461293e565b610ae9565b3480156105b157600080fd5b506101aa6105c03660046128af565b611056565b3480156105d157600080fd5b506105e56105e03660046128af565b6110d5565b6040516101d691906129c3565b3480156105fe57600080fd5b506101cc61060d366004612a25565b6111f9565b34801561061e57600080fd5b506101aa6117da565b34801561063357600080fd5b506101cc60055481565b34801561064957600080fd5b50610273611863565b34801561065e57600080fd5b506101aa61066d366004612a8c565b6118e6565b34801561067e57600080fd5b50610687611973565b6040516101d69190612aa9565b600981815481106106a457600080fd5b600091825260209091200154905081565b6001600160a01b03821660009081526008602090815260408083208484529091528120546106fd816000908152600760205260409020600601546001600160a01b0316151590565b1561070957905061070f565b60009150505b92915050565b6000825b8281116107675760008181526003602090815260408083206001600160a01b038916845290915290205460ff161561075557600191505061076d565b8061075f81612b03565b915050610719565b50600090505b9392505050565b600061077f600b5490565b905090565b61078c6119cb565b60008281526007602052604090206006015482906001600160a01b03166107f25760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064015b60405180910390fd5b6000838152600460205260409020541561084e5760405162461bcd60e51b815260206004820152601b60248201527f41756374696f6e2068617320616c72656164792073746172746564000000000060448201526064016107e9565b600083815260076020908152604091829020600581018590556001810154905492518581526001600160a01b03909116929186917f01e6a465ec1edd582d333147c7b7edf5998164f2cf2269dcb9c93d46c67bd317910160405180910390a4505050565b6108ba6119cb565b6108c46000611a25565b565b60008181526007602052604081206004015481036108e657506000919050565b6000828152600760205260408120600381015460049091015461091491429161090e91611a82565b90611a8e565b905080156109225792915050565b50600092915050565b610933611a9a565b61093b6119cb565b60008181526007602052604090206006015481906001600160a01b031661099c5760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b6109a582611af3565b6109ae82611bda565b506109b860018055565b50565b6109c36119cb565b60008281526007602052604090206006015482906001600160a01b0316610a245760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b60008381526004602052604090205415610a805760405162461bcd60e51b815260206004820152601b60248201527f41756374696f6e2068617320616c72656164792073746172746564000000000060448201526064016107e9565b600083815260076020526040812042600490910155600980546001810182559082527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01849055600a805491610ad583612b03565b9190505550610ae48383611d4d565b505050565b60008281526007602052604090206006015482906001600160a01b0316610b4a5760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b610b52611a9a565b6000838152600760208190526040909120908101546001909101546001600160a01b0390911690600160a01b900460ff16610bf55760405162461bcd60e51b815260206004820152602a60248201527f41756374696f6e206d75737420626520617070726f76656420627920636f6e7460448201527f72616374206f776e65720000000000000000000000000000000000000000000060648201526084016107e9565b6000848152600760205260409020600401541580610c33575060008481526007602052604090206003810154600490910154610c3091611a82565b42105b610c7f5760405162461bcd60e51b815260206004820152600f60248201527f41756374696f6e2065787069726564000000000000000000000000000000000060448201526064016107e9565b600084815260076020526040902060050154831015610ce05760405162461bcd60e51b815260206004820152601f60248201527f4d7573742073656e64206174206c65617374207265736572766550726963650060448201526064016107e9565b600654600085815260076020526040902060020154610d2b91610d1391606491610d0d919060ff16611de9565b90611df5565b60008681526007602052604090206002015490611a82565b831015610da2576040805162461bcd60e51b81526020600482015260248101919091527f4d7573742073656e64206d6f7265207468616e206c617374206269642062792060448201527f6d696e426964496e6372656d656e7450657263656e7461676520616d6f756e7460648201526084016107e9565b60008481526004602052604090205415801590610dc757506001600160a01b03811615155b15610df95760008481526007602052604090206002810154600990910154610df99183916001600160a01b0316611e01565b600084815260076020526040902060090154610e1f9084906001600160a01b0316611f33565b60008481526007602081815260408084206002808201899055930180543373ffffffffffffffffffffffffffffffffffffffff199182168117909255600384528286208287528452828620805460ff1916600190811790915583516060810185529283528285018a8152428486019081528c89528787528589206004808952878b2080548c52918952968a20955186549095166001600160a01b039095169490941785559051918401919091555191909401558784529052805491610ee383612b03565b909155505060055460008581526007602052604081206003810154600490910154919291610f1691429161090e91611a82565b1015610f755760008581526007602052604090206003810154600490910154610f5d90610f5690610f4d90429061090e9086611a82565b60055490611a8e565b8290611a82565b60008781526007602052604090206003015550600190505b6000858152600760209081526040918290206001810154905483513381529283018890526001600160a01b03868116159484019490945284151560608401529216919087907fda6b779568630ce5e5658b317174df474d5b335541ed9471bd8424a017f3be6d9060800160405180910390a4801561104b576000858152600760209081526040918290206001810154815460039092015493519384526001600160a01b031692909188917f55cf2b31608fbe49fa31cd0285b6b6cce46f56d26c8c59980a2af5a0ffbdd5db910160405180910390a45b5050610ae460018055565b60008181526007602052604090206006015481906001600160a01b03166110b75760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b6110bf611a9a565b6110c882612199565b6110d160018055565b5050565b6000818152600460205260408120546060919067ffffffffffffffff81111561110057611100612b1c565b60405190808252806020026020018201604052801561115e57816020015b61114b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b81526020019060019003908161111e5790505b50905060005b6000848152600460205260409020548110156111f2576000848152600260208181526040808420858552825292839020835160608101855281546001600160a01b03168152600182015492810192909252909101549181019190915282518390839081106111d4576111d4612b32565b602002602001018190525080806111ea90612b03565b915050611164565b5092915050565b6000611203611a9a565b61120b6119cb565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f80ac58cd0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038716906301ffc9a790602401602060405180830381865afa158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612b48565b61131e5760405162461bcd60e51b815260206004820152602f60248201527f746f6b656e436f6e747261637420646f6573206e6f7420737570706f7274204560448201527f524337323120696e74657266616365000000000000000000000000000000000060648201526084016107e9565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018890526000906001600160a01b03881690636352211e90602401602060405180830381865afa15801561137f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a39190612b65565b6040517f081812fc000000000000000000000000000000000000000000000000000000008152600481018a90529091506001600160a01b0388169063081812fc90602401602060405180830381865afa158015611404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114289190612b65565b6001600160a01b0316336001600160a01b0316148061144f5750336001600160a01b038216145b6114c15760405162461bcd60e51b815260206004820152602d60248201527f43616c6c6572206d75737420626520617070726f766564206f72206f776e657260448201527f20666f7220746f6b656e2069640000000000000000000000000000000000000060648201526084016107e9565b60006114cc600b5490565b905080600860008a6001600160a01b03166001600160a01b0316815260200190815260200160002060008b8152602001908152602001600020819055506040518061016001604052808a8152602001896001600160a01b031681526020016000151581526020016000815260200188815260200160008152602001878152602001836001600160a01b0316815260200160006001600160a01b03168152602001866001600160a01b03168152602001856001600160a01b0316815250600760008381526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a81548160ff021916908315150217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e08201518160060160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101008201518160070160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101208201518160080160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101408201518160090160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550905050876001600160a01b03166323b872dd83308c6040518463ffffffff1660e01b8152600401611723939291906001600160a01b039384168152919092166020820152604081019190915260600190565b600060405180830381600087803b15801561173d57600080fd5b505af1158015611751573d6000803e3d6000fd5b50505050611763600b80546001019055565b60408051888152602081018890526001600160a01b0384811682840152878116606083015286811660808301529151918a16918b9184917f9a777614c98c43080ce0efee7aa53535347d0eb9246ded93a9d6284462d6db329181900360a00190a49150506117d060018055565b9695505050505050565b6117e2611a9a565b60005b600a548110156118595760006009828154811061180457611804612b32565b60009182526020808320909101548083526007909152604090912060038101546004909101549192506118379190611a82565b42106118465761184681612199565b508061185181612b03565b9150506117e5565b506108c460018055565b6000805b600a548110156118de5760006009828154811061188657611886612b32565b6000918252602080832090910154808352600790915260409091206003810154600482015492935090916118b991611a82565b42106118c9576001935050505090565b505080806118d690612b03565b915050611867565b506000905090565b6118ee6119cb565b6001600160a01b03811661196a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107e9565b6109b881611a25565b606060098054806020026020016040519081016040528092919081815260200182805480156119c157602002820191906000526020600020905b8154815260200190600101908083116119ad575b5050505050905090565b6000546001600160a01b031633146108c45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e9565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061076d8284612b82565b600061076d8284612b95565b600260015403611aec5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107e9565b6002600155565b60005b600a548110156110d1578160098281548110611b1457611b14612b32565b906000526020600020015403611bc8576001600a54611b339190612b95565b8114611b855760096001600a54611b4a9190612b95565b81548110611b5a57611b5a612b32565b906000526020600020015460098281548110611b7857611b78612b32565b6000918252602090912001555b6009805480611b9657611b96612ba8565b60019003818190600052602060002001600090559055600a6000815480929190611bbf90612bbe565b91905055505050565b80611bd281612b03565b915050611af6565b600081815260076020526040908190206006810154600182015491549251632142170760e11b81523060048201526001600160a01b039182166024820181905260448201949094529116906342842e0e90606401600060405180830381600087803b158015611c4857600080fd5b505af1158015611c5c573d6000803e3d6000fd5b5050506000838152600760209081526040918290206001810154905492516001600160a01b038681168252909116935085917f6091afcbe8514686c43b167ca4f1b03e24446d29d8490d496e438f8a2c763439910160405180910390a4506000908152600760208190526040822082815560018101805474ffffffffffffffffffffffffffffffffffffffffff19169055600281018390556003810183905560048101839055600581019290925560068201805473ffffffffffffffffffffffffffffffffffffffff1990811690915590820180548216905560088201805482169055600990910180549091169055565b60008281526007602052604090819020600181018054841515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff82168117909255915492516001600160a01b039182169190921617919084907fec35d321ab4972475f131e184c0c0fe52c5a58a29d74f7db2969af2f6dd93a1f90611ddd90861515815260200190565b60405180910390a45050565b600061076d8284612bd5565b600061076d8284612bec565b6001600160a01b038116611f1f576006546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611e7257600080fd5b505af1158015611e86573d6000803e3d6000fd5b50505050611e9483836124a9565b610ae457600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ee857600080fd5b505af1158015611efc573d6000803e3d6000fd5b5050600654610ae4935061010090046001600160a01b0316915085905084612520565b610ae46001600160a01b0382168484612520565b6001600160a01b03811661202357813414611fb65760405162461bcd60e51b815260206004820152603260248201527f53656e74204554482056616c756520646f6573206e6f74206d6174636820737060448201527f656369666965642062696420616d6f756e74000000000000000000000000000060648201526084016107e9565b600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561200657600080fd5b505af115801561201a573d6000803e3d6000fd5b50505050505050565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561206c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120909190612c0e565b90506120a76001600160a01b0383163330876125c9565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156120ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121129190612c0e565b90508061211f8387611a82565b146121925760405162461bcd60e51b815260206004820152603460248201527f546f6b656e207472616e736665722063616c6c20646964206e6f74207472616e60448201527f7366657220657870656374656420616d6f756e7400000000000000000000000060648201526084016107e9565b5050505050565b600081815260076020526040902060038101546004909101546121bb91611a82565b42101561220a5760405162461bcd60e51b815260206004820152601960248201527f41756374696f6e207374696c6c20696e2070726f67726573730000000000000060448201526064016107e9565b60008181526004602052604081205490036122315761222881611af3565b6109b881611bda565b6000818152600760205260408120600901546001600160a01b031615612271576000828152600760205260409020600901546001600160a01b0316612283565b60065461010090046001600160a01b03165b600083815260076020819052604091829020600281015460018201549282015491549351632142170760e11b81523060048201526001600160a01b039283166024820152604481019490945293945016906342842e0e90606401600060405180830381600087803b1580156122f757600080fd5b505af1925050508015612308575060015b61234d576000838152600760208190526040909120908101546002820154600990920154612344926001600160a01b0392831692909116611e01565b610ae483611bda565b6000838152600760205260409020600881015460099091015461237e916001600160a01b0390811691849116611e01565b6000838152600760208181526040928390206001810154815460068301546008840154939095015486516001600160a01b039687168152938616948401949094529284168286015260608201869052868416608083015293519290931692909186917f2d6506b7f62562d1cddc37447325e834adee367daa4215eab46d9ec52ee284f3919081900360a00190a461241483611af3565b50506000908152600760208190526040822082815560018101805474ffffffffffffffffffffffffffffffffffffffffff19169055600281018390556003810183905560048101839055600581019290925560068201805473ffffffffffffffffffffffffffffffffffffffff1990811690915590820180548216905560088201805482169055600990910180549091169055565b60408051600080825260208201928390529182916001600160a01b0386169185916124d391612c4b565b60006040518083038185875af1925050503d8060008114612510576040519150601f19603f3d011682016040523d82523d6000602084013e612515565b606091505b509095945050505050565b6040516001600160a01b038316602482015260448101829052610ae49084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612620565b6040516001600160a01b038085166024830152831660448201526064810182905261261a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612565565b50505050565b6000612675826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127089092919063ffffffff16565b90508051600014806126965750808060200190518101906126969190612b48565b610ae45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107e9565b6060612717848460008561271f565b949350505050565b6060824710156127975760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107e9565b600080866001600160a01b031685876040516127b39190612c4b565b60006040518083038185875af1925050503d80600081146127f0576040519150601f19603f3d011682016040523d82523d6000602084013e6127f5565b606091505b509150915061280687838387612811565b979650505050505050565b60608315612880578251600003612879576001600160a01b0385163b6128795760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107e9565b5081612717565b61271783838151156128955781518083602001fd5b8060405162461bcd60e51b81526004016107e99190612c67565b6000602082840312156128c157600080fd5b5035919050565b6001600160a01b03811681146109b857600080fd5b600080604083850312156128f057600080fd5b82356128fb816128c8565b946020939093013593505050565b60008060006060848603121561291e57600080fd5b8335612929816128c8565b95602085013595506040909401359392505050565b6000806040838503121561295157600080fd5b50508035926020909101359150565b6000806040838503121561297357600080fd5b823591506020830135612985816128c8565b809150509250929050565b80151581146109b857600080fd5b600080604083850312156129b157600080fd5b82359150602083013561298581612990565b602080825282518282018190526000919060409081850190868401855b82811015612a1857815180516001600160a01b03168552868101518786015285015185850152606090930192908501906001016129e0565b5091979650505050505050565b60008060008060008060c08789031215612a3e57600080fd5b863595506020870135612a50816128c8565b945060408701359350606087013592506080870135612a6e816128c8565b915060a0870135612a7e816128c8565b809150509295509295509295565b600060208284031215612a9e57600080fd5b813561076d816128c8565b6020808252825182820181905260009190848201906040850190845b81811015612ae157835183529284019291840191600101612ac5565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600060018201612b1557612b15612aed565b5060010190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215612b5a57600080fd5b815161076d81612990565b600060208284031215612b7757600080fd5b815161076d816128c8565b8082018082111561070f5761070f612aed565b8181038181111561070f5761070f612aed565b634e487b7160e01b600052603160045260246000fd5b600081612bcd57612bcd612aed565b506000190190565b808202811582820484141761070f5761070f612aed565b600082612c0957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612c2057600080fd5b5051919050565b60005b83811015612c42578181015183820152602001612c2a565b50506000910152565b60008251612c5d818460208701612c27565b9190910192915050565b6020815260008251806020840152612c86816040850160208701612c27565b601f01601f1916919091016040019291505056fea26469706673582212200012ba0b446dceeaf5583173ef9ea4aabd0445ad38a3d0ce21c4aecec6180b5964736f6c63430008130033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x6080604052600436106101a35760003560e01c80638da5cb5b116100e0578063c0738dce11610084578063ec91f2a411610061578063ec91f2a414610627578063eff15dc21461063d578063f2fde38b14610652578063fdc5f3d11461067257005b8063c0738dce146105c5578063c26011e1146105f2578063dd9f1b2d1461061257005b8063973ddb4a116100bd578063973ddb4a14610546578063b296024d14610566578063b7751c7114610592578063b9a2de3a146105a557005b80638da5cb5b146104db578063937d97a5146104f957806396b5a7551461052657005b806361ab546e1161014757806372e2867d1161012457806372e2867d146104325780637792ba5f146104485780637d95c73f146104805780638cd42991146104bb57005b806361ab546e146103895780636f8a41e1146103fd578063715018a61461041d57005b80634f0e0ef3116101805780634f0e0ef3146102165780634ff1ae831461025357806351e9e6aa14610283578063571a26a01461029857005b80632c6ea90d146101ac5780633ff9d326146101df5780634c73b0ad146101ff57005b366101aa57005b005b3480156101b857600080fd5b506101cc6101c73660046128af565b610694565b6040519081526020015b60405180910390f35b3480156101eb57600080fd5b506101cc6101fa3660046128dd565b6106b5565b34801561020b57600080fd5b50600b546101cc9081565b34801561022257600080fd5b5060065461023b9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101d6565b34801561025f57600080fd5b5061027361026e366004612909565b610715565b60405190151581526020016101d6565b34801561028f57600080fd5b506101cc610774565b3480156102a457600080fd5b506103246102b33660046128af565b6007602081905260009182526040909120805460018201546002830154600384015460048501546005860154600687015497870154600888015460099098015496986001600160a01b0380881699600160a01b90980460ff169896979596949593949181169392811692811691168b565b604080519b8c526001600160a01b039a8b1660208d0152981515988b019890985260608a0196909652608089019490945260a088019290925260c0870152841660e08601528316610100850152821661012084015216610140820152610160016101d6565b34801561039557600080fd5b506103d86103a436600461293e565b600260208181526000938452604080852090915291835291208054600182015491909201546001600160a01b039092169183565b604080516001600160a01b0390941684526020840192909252908201526060016101d6565b34801561040957600080fd5b506101aa61041836600461293e565b610784565b34801561042957600080fd5b506101aa6108b2565b34801561043e57600080fd5b506101cc600a5481565b34801561045457600080fd5b506101cc6104633660046128dd565b600860209081526000928352604080842090915290825290205481565b34801561048c57600080fd5b5061027361049b366004612960565b600360209081526000928352604080842090915290825290205460ff1681565b3480156104c757600080fd5b506101cc6104d63660046128af565b6108c6565b3480156104e757600080fd5b506000546001600160a01b031661023b565b34801561050557600080fd5b506101cc6105143660046128af565b60046020526000908152604090205481565b34801561053257600080fd5b506101aa6105413660046128af565b61092b565b34801561055257600080fd5b506101aa61056136600461299e565b6109bb565b34801561057257600080fd5b506006546105809060ff1681565b60405160ff90911681526020016101d6565b6101aa6105a036600461293e565b610ae9565b3480156105b157600080fd5b506101aa6105c03660046128af565b611056565b3480156105d157600080fd5b506105e56105e03660046128af565b6110d5565b6040516101d691906129c3565b3480156105fe57600080fd5b506101cc61060d366004612a25565b6111f9565b34801561061e57600080fd5b506101aa6117da565b34801561063357600080fd5b506101cc60055481565b34801561064957600080fd5b50610273611863565b34801561065e57600080fd5b506101aa61066d366004612a8c565b6118e6565b34801561067e57600080fd5b50610687611973565b6040516101d69190612aa9565b600981815481106106a457600080fd5b600091825260209091200154905081565b6001600160a01b03821660009081526008602090815260408083208484529091528120546106fd816000908152600760205260409020600601546001600160a01b0316151590565b1561070957905061070f565b60009150505b92915050565b6000825b8281116107675760008181526003602090815260408083206001600160a01b038916845290915290205460ff161561075557600191505061076d565b8061075f81612b03565b915050610719565b50600090505b9392505050565b600061077f600b5490565b905090565b61078c6119cb565b60008281526007602052604090206006015482906001600160a01b03166107f25760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064015b60405180910390fd5b6000838152600460205260409020541561084e5760405162461bcd60e51b815260206004820152601b60248201527f41756374696f6e2068617320616c72656164792073746172746564000000000060448201526064016107e9565b600083815260076020908152604091829020600581018590556001810154905492518581526001600160a01b03909116929186917f01e6a465ec1edd582d333147c7b7edf5998164f2cf2269dcb9c93d46c67bd317910160405180910390a4505050565b6108ba6119cb565b6108c46000611a25565b565b60008181526007602052604081206004015481036108e657506000919050565b6000828152600760205260408120600381015460049091015461091491429161090e91611a82565b90611a8e565b905080156109225792915050565b50600092915050565b610933611a9a565b61093b6119cb565b60008181526007602052604090206006015481906001600160a01b031661099c5760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b6109a582611af3565b6109ae82611bda565b506109b860018055565b50565b6109c36119cb565b60008281526007602052604090206006015482906001600160a01b0316610a245760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b60008381526004602052604090205415610a805760405162461bcd60e51b815260206004820152601b60248201527f41756374696f6e2068617320616c72656164792073746172746564000000000060448201526064016107e9565b600083815260076020526040812042600490910155600980546001810182559082527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01849055600a805491610ad583612b03565b9190505550610ae48383611d4d565b505050565b60008281526007602052604090206006015482906001600160a01b0316610b4a5760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b610b52611a9a565b6000838152600760208190526040909120908101546001909101546001600160a01b0390911690600160a01b900460ff16610bf55760405162461bcd60e51b815260206004820152602a60248201527f41756374696f6e206d75737420626520617070726f76656420627920636f6e7460448201527f72616374206f776e65720000000000000000000000000000000000000000000060648201526084016107e9565b6000848152600760205260409020600401541580610c33575060008481526007602052604090206003810154600490910154610c3091611a82565b42105b610c7f5760405162461bcd60e51b815260206004820152600f60248201527f41756374696f6e2065787069726564000000000000000000000000000000000060448201526064016107e9565b600084815260076020526040902060050154831015610ce05760405162461bcd60e51b815260206004820152601f60248201527f4d7573742073656e64206174206c65617374207265736572766550726963650060448201526064016107e9565b600654600085815260076020526040902060020154610d2b91610d1391606491610d0d919060ff16611de9565b90611df5565b60008681526007602052604090206002015490611a82565b831015610da2576040805162461bcd60e51b81526020600482015260248101919091527f4d7573742073656e64206d6f7265207468616e206c617374206269642062792060448201527f6d696e426964496e6372656d656e7450657263656e7461676520616d6f756e7460648201526084016107e9565b60008481526004602052604090205415801590610dc757506001600160a01b03811615155b15610df95760008481526007602052604090206002810154600990910154610df99183916001600160a01b0316611e01565b600084815260076020526040902060090154610e1f9084906001600160a01b0316611f33565b60008481526007602081815260408084206002808201899055930180543373ffffffffffffffffffffffffffffffffffffffff199182168117909255600384528286208287528452828620805460ff1916600190811790915583516060810185529283528285018a8152428486019081528c89528787528589206004808952878b2080548c52918952968a20955186549095166001600160a01b039095169490941785559051918401919091555191909401558784529052805491610ee383612b03565b909155505060055460008581526007602052604081206003810154600490910154919291610f1691429161090e91611a82565b1015610f755760008581526007602052604090206003810154600490910154610f5d90610f5690610f4d90429061090e9086611a82565b60055490611a8e565b8290611a82565b60008781526007602052604090206003015550600190505b6000858152600760209081526040918290206001810154905483513381529283018890526001600160a01b03868116159484019490945284151560608401529216919087907fda6b779568630ce5e5658b317174df474d5b335541ed9471bd8424a017f3be6d9060800160405180910390a4801561104b576000858152600760209081526040918290206001810154815460039092015493519384526001600160a01b031692909188917f55cf2b31608fbe49fa31cd0285b6b6cce46f56d26c8c59980a2af5a0ffbdd5db910160405180910390a45b5050610ae460018055565b60008181526007602052604090206006015481906001600160a01b03166110b75760405162461bcd60e51b8152602060048201526015602482015274105d58dd1a5bdb88191bd95cdb89dd08195e1a5cdd605a1b60448201526064016107e9565b6110bf611a9a565b6110c882612199565b6110d160018055565b5050565b6000818152600460205260408120546060919067ffffffffffffffff81111561110057611100612b1c565b60405190808252806020026020018201604052801561115e57816020015b61114b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b81526020019060019003908161111e5790505b50905060005b6000848152600460205260409020548110156111f2576000848152600260208181526040808420858552825292839020835160608101855281546001600160a01b03168152600182015492810192909252909101549181019190915282518390839081106111d4576111d4612b32565b602002602001018190525080806111ea90612b03565b915050611164565b5092915050565b6000611203611a9a565b61120b6119cb565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f80ac58cd0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038716906301ffc9a790602401602060405180830381865afa158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612b48565b61131e5760405162461bcd60e51b815260206004820152602f60248201527f746f6b656e436f6e747261637420646f6573206e6f7420737570706f7274204560448201527f524337323120696e74657266616365000000000000000000000000000000000060648201526084016107e9565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018890526000906001600160a01b03881690636352211e90602401602060405180830381865afa15801561137f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a39190612b65565b6040517f081812fc000000000000000000000000000000000000000000000000000000008152600481018a90529091506001600160a01b0388169063081812fc90602401602060405180830381865afa158015611404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114289190612b65565b6001600160a01b0316336001600160a01b0316148061144f5750336001600160a01b038216145b6114c15760405162461bcd60e51b815260206004820152602d60248201527f43616c6c6572206d75737420626520617070726f766564206f72206f776e657260448201527f20666f7220746f6b656e2069640000000000000000000000000000000000000060648201526084016107e9565b60006114cc600b5490565b905080600860008a6001600160a01b03166001600160a01b0316815260200190815260200160002060008b8152602001908152602001600020819055506040518061016001604052808a8152602001896001600160a01b031681526020016000151581526020016000815260200188815260200160008152602001878152602001836001600160a01b0316815260200160006001600160a01b03168152602001866001600160a01b03168152602001856001600160a01b0316815250600760008381526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a81548160ff021916908315150217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e08201518160060160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101008201518160070160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101208201518160080160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101408201518160090160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550905050876001600160a01b03166323b872dd83308c6040518463ffffffff1660e01b8152600401611723939291906001600160a01b039384168152919092166020820152604081019190915260600190565b600060405180830381600087803b15801561173d57600080fd5b505af1158015611751573d6000803e3d6000fd5b50505050611763600b80546001019055565b60408051888152602081018890526001600160a01b0384811682840152878116606083015286811660808301529151918a16918b9184917f9a777614c98c43080ce0efee7aa53535347d0eb9246ded93a9d6284462d6db329181900360a00190a49150506117d060018055565b9695505050505050565b6117e2611a9a565b60005b600a548110156118595760006009828154811061180457611804612b32565b60009182526020808320909101548083526007909152604090912060038101546004909101549192506118379190611a82565b42106118465761184681612199565b508061185181612b03565b9150506117e5565b506108c460018055565b6000805b600a548110156118de5760006009828154811061188657611886612b32565b6000918252602080832090910154808352600790915260409091206003810154600482015492935090916118b991611a82565b42106118c9576001935050505090565b505080806118d690612b03565b915050611867565b506000905090565b6118ee6119cb565b6001600160a01b03811661196a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107e9565b6109b881611a25565b606060098054806020026020016040519081016040528092919081815260200182805480156119c157602002820191906000526020600020905b8154815260200190600101908083116119ad575b5050505050905090565b6000546001600160a01b031633146108c45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e9565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061076d8284612b82565b600061076d8284612b95565b600260015403611aec5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107e9565b6002600155565b60005b600a548110156110d1578160098281548110611b1457611b14612b32565b906000526020600020015403611bc8576001600a54611b339190612b95565b8114611b855760096001600a54611b4a9190612b95565b81548110611b5a57611b5a612b32565b906000526020600020015460098281548110611b7857611b78612b32565b6000918252602090912001555b6009805480611b9657611b96612ba8565b60019003818190600052602060002001600090559055600a6000815480929190611bbf90612bbe565b91905055505050565b80611bd281612b03565b915050611af6565b600081815260076020526040908190206006810154600182015491549251632142170760e11b81523060048201526001600160a01b039182166024820181905260448201949094529116906342842e0e90606401600060405180830381600087803b158015611c4857600080fd5b505af1158015611c5c573d6000803e3d6000fd5b5050506000838152600760209081526040918290206001810154905492516001600160a01b038681168252909116935085917f6091afcbe8514686c43b167ca4f1b03e24446d29d8490d496e438f8a2c763439910160405180910390a4506000908152600760208190526040822082815560018101805474ffffffffffffffffffffffffffffffffffffffffff19169055600281018390556003810183905560048101839055600581019290925560068201805473ffffffffffffffffffffffffffffffffffffffff1990811690915590820180548216905560088201805482169055600990910180549091169055565b60008281526007602052604090819020600181018054841515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff82168117909255915492516001600160a01b039182169190921617919084907fec35d321ab4972475f131e184c0c0fe52c5a58a29d74f7db2969af2f6dd93a1f90611ddd90861515815260200190565b60405180910390a45050565b600061076d8284612bd5565b600061076d8284612bec565b6001600160a01b038116611f1f576006546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611e7257600080fd5b505af1158015611e86573d6000803e3d6000fd5b50505050611e9483836124a9565b610ae457600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ee857600080fd5b505af1158015611efc573d6000803e3d6000fd5b5050600654610ae4935061010090046001600160a01b0316915085905084612520565b610ae46001600160a01b0382168484612520565b6001600160a01b03811661202357813414611fb65760405162461bcd60e51b815260206004820152603260248201527f53656e74204554482056616c756520646f6573206e6f74206d6174636820737060448201527f656369666965642062696420616d6f756e74000000000000000000000000000060648201526084016107e9565b600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561200657600080fd5b505af115801561201a573d6000803e3d6000fd5b50505050505050565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561206c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120909190612c0e565b90506120a76001600160a01b0383163330876125c9565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156120ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121129190612c0e565b90508061211f8387611a82565b146121925760405162461bcd60e51b815260206004820152603460248201527f546f6b656e207472616e736665722063616c6c20646964206e6f74207472616e60448201527f7366657220657870656374656420616d6f756e7400000000000000000000000060648201526084016107e9565b5050505050565b600081815260076020526040902060038101546004909101546121bb91611a82565b42101561220a5760405162461bcd60e51b815260206004820152601960248201527f41756374696f6e207374696c6c20696e2070726f67726573730000000000000060448201526064016107e9565b60008181526004602052604081205490036122315761222881611af3565b6109b881611bda565b6000818152600760205260408120600901546001600160a01b031615612271576000828152600760205260409020600901546001600160a01b0316612283565b60065461010090046001600160a01b03165b600083815260076020819052604091829020600281015460018201549282015491549351632142170760e11b81523060048201526001600160a01b039283166024820152604481019490945293945016906342842e0e90606401600060405180830381600087803b1580156122f757600080fd5b505af1925050508015612308575060015b61234d576000838152600760208190526040909120908101546002820154600990920154612344926001600160a01b0392831692909116611e01565b610ae483611bda565b6000838152600760205260409020600881015460099091015461237e916001600160a01b0390811691849116611e01565b6000838152600760208181526040928390206001810154815460068301546008840154939095015486516001600160a01b039687168152938616948401949094529284168286015260608201869052868416608083015293519290931692909186917f2d6506b7f62562d1cddc37447325e834adee367daa4215eab46d9ec52ee284f3919081900360a00190a461241483611af3565b50506000908152600760208190526040822082815560018101805474ffffffffffffffffffffffffffffffffffffffffff19169055600281018390556003810183905560048101839055600581019290925560068201805473ffffffffffffffffffffffffffffffffffffffff1990811690915590820180548216905560088201805482169055600990910180549091169055565b60408051600080825260208201928390529182916001600160a01b0386169185916124d391612c4b565b60006040518083038185875af1925050503d8060008114612510576040519150601f19603f3d011682016040523d82523d6000602084013e612515565b606091505b509095945050505050565b6040516001600160a01b038316602482015260448101829052610ae49084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612620565b6040516001600160a01b038085166024830152831660448201526064810182905261261a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612565565b50505050565b6000612675826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127089092919063ffffffff16565b90508051600014806126965750808060200190518101906126969190612b48565b610ae45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107e9565b6060612717848460008561271f565b949350505050565b6060824710156127975760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107e9565b600080866001600160a01b031685876040516127b39190612c4b565b60006040518083038185875af1925050503d80600081146127f0576040519150601f19603f3d011682016040523d82523d6000602084013e6127f5565b606091505b509150915061280687838387612811565b979650505050505050565b60608315612880578251600003612879576001600160a01b0385163b6128795760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107e9565b5081612717565b61271783838151156128955781518083602001fd5b8060405162461bcd60e51b81526004016107e99190612c67565b6000602082840312156128c157600080fd5b5035919050565b6001600160a01b03811681146109b857600080fd5b600080604083850312156128f057600080fd5b82356128fb816128c8565b946020939093013593505050565b60008060006060848603121561291e57600080fd5b8335612929816128c8565b95602085013595506040909401359392505050565b6000806040838503121561295157600080fd5b50508035926020909101359150565b6000806040838503121561297357600080fd5b823591506020830135612985816128c8565b809150509250929050565b80151581146109b857600080fd5b600080604083850312156129b157600080fd5b82359150602083013561298581612990565b602080825282518282018190526000919060409081850190868401855b82811015612a1857815180516001600160a01b03168552868101518786015285015185850152606090930192908501906001016129e0565b5091979650505050505050565b60008060008060008060c08789031215612a3e57600080fd5b863595506020870135612a50816128c8565b945060408701359350606087013592506080870135612a6e816128c8565b915060a0870135612a7e816128c8565b809150509295509295509295565b600060208284031215612a9e57600080fd5b813561076d816128c8565b6020808252825182820181905260009190848201906040850190845b81811015612ae157835183529284019291840191600101612ac5565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600060018201612b1557612b15612aed565b5060010190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215612b5a57600080fd5b815161076d81612990565b600060208284031215612b7757600080fd5b815161076d816128c8565b8082018082111561070f5761070f612aed565b8181038181111561070f5761070f612aed565b634e487b7160e01b600052603160045260246000fd5b600081612bcd57612bcd612aed565b506000190190565b808202811582820484141761070f5761070f612aed565b600082612c0957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612c2057600080fd5b5051919050565b60005b83811015612c42578181015183820152602001612c2a565b50506000910152565b60008251612c5d818460208701612c27565b9190910192915050565b6020815260008251806020840152612c86816040850160208701612c27565b601f01601f1916919091016040019291505056fea26469706673582212200012ba0b446dceeaf5583173ef9ea4aabd0445ad38a3d0ce21c4aecec6180b5964736f6c63430008130033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


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.