POL Price: $0.476383 (-0.64%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Pause527012582024-01-24 16:03:27358 days ago1706112207IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0029329862.47429517
Settle Current A...498157272023-11-11 14:01:42432 days ago1699711302IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.04162703115.51931851
Settle Current A...497080242023-11-08 21:12:50435 days ago1699477970IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.09271086177.82402943
Settle Current A...496639192023-11-07 18:54:57436 days ago1699383297IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0718526199.39835903
Settle Current A...496232732023-11-06 18:45:28437 days ago1699296328IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.04045049112.25429829
Settle Current A...458323442023-08-02 20:28:08533 days ago1691008088IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0352675297.87101981
Settle Current A...455347022023-07-26 9:17:00540 days ago1690363020IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.053094147.34133441
Settle Current A...438209562023-06-12 8:46:29584 days ago1686559589IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.08715817241.8728919
Settle Current A...403678972023-03-15 8:54:46673 days ago1678870486IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0534151148.23241908
Settle Current A...399945392023-03-05 13:42:58683 days ago1678023778IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.00484958123.13291274
Settle Current A...399945352023-03-05 13:42:50683 days ago1678023770IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.04431061122.96651266
Settle Current A...385883662023-01-27 13:25:15720 days ago1674825915IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0437682121.46128149
Settle Current A...379613622023-01-11 23:09:40736 days ago1673478580IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.016241845.07268326
Settle Current A...376166942023-01-03 9:10:46744 days ago1672737046IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0307411358.96301734
Settle Current A...372966002022-12-26 11:15:47752 days ago1672053347IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0158697644.04022205
Settle Current A...370541862022-12-20 10:31:04758 days ago1671532264IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0306105584.94745
Settle Current A...368866102022-12-16 4:06:57762 days ago1671163617IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0237977566.04122916
Settle Current A...366805512022-12-11 1:21:02767 days ago1670721662IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0145407240.3520039
Settle Current A...365632652022-12-08 4:18:06770 days ago1670473086IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0115131331.95014186
Settle Current A...360102992022-11-24 13:58:27784 days ago1669298307IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0299393983.0848912
Settle Current A...359116812022-11-22 4:23:40786 days ago1669091020IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0108104130.00000008
Settle Current A...357596212022-11-18 11:52:16790 days ago1668772336IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0116645732.37040428
Settle Current A...354657842022-11-11 5:08:06797 days ago1668143286IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.023782966
Settle Current A...352298422022-11-05 11:43:28803 days ago1667648608IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0300108757.5623384
Settle Current A...351596952022-11-03 18:44:35805 days ago1667501075IN
0xC9F32Fc6...5c2f1C1A7
0 POL0.0220442761.17514438
View all transactions

Latest 1 internal transaction

Parent Transaction Hash Block From To
258185332022-03-11 4:23:171042 days ago1646972597
0xC9F32Fc6...5c2f1C1A7
 Contract Creation0 POL
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DogsAuctionHouse

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 28 : DogsAuctionHouse.sol
// SPDX-License-Identifier: GPL-3.0

/// @title The Degen Dogs auction house


// LICENSE
//
// DogsAuctionHouse.sol is a modified version of Nounders DAO's NounsAuctionHouse.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/8f614378f93c1f6fec35a254eb424f70e84925dd/packages/nouns-contracts/contracts/NounsAuctionHouse.sol
//
// NounsAuctionHouse.sol is a modified version of Zora's AuctionHouse.sol:
// https://github.com/ourzora/auction-house/blob/54a12ec1a6cf562e49f0a4917990474b11350a2d/contracts/AuctionHouse.sol
//
// AuctionHouse.sol source code Copyright Zora licensed under the GPL-3.0 license.
// With modifications by Nounders DAO and Degen Dogs Club.

pragma solidity ^0.8.0;

import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import { ReentrancyGuardUpgradeable } from '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import { OwnableUpgradeable } from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IDogsAuctionHouse } from './interfaces/IDogsAuctionHouse.sol';
import { IDogsToken } from './interfaces/IDogsToken.sol';
import { IWETH } from './interfaces/IWETH.sol';
import { BidTokens } from './BidTokens.sol';

contract DogsAuctionHouse is IDogsAuctionHouse, PausableUpgradeable, ReentrancyGuardUpgradeable, OwnableUpgradeable {
    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    // The Degen Dogs ERC721 token contract
    IDogsToken public dogs;

    // The address of the WETH contract
    address public weth;

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

    // The minimum price accepted in an auction
    uint256 public reservePrice;

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

    // The duration of a single auction
    uint256 public duration;

    // The voting rewards token
    BidTokens public bidToken;

    // The active auction
    IDogsAuctionHouse.Auction public auction;

    /**
     * @notice Initialize the auction house and base contracts,
     * populate configuration values, and pause the contract.
     * @dev This function can only be called once.
     */
    function initialize(
        IDogsToken _dogs,
        address _weth,
        uint256 _timeBuffer,
        uint256 _reservePrice,
        uint8 _minBidIncrementPercentage,
        uint256 _duration,
        string calldata bidTokenName,
        string calldata bidTokenSymbol
    ) external initializer {
        __Pausable_init();
        __ReentrancyGuard_init();
        __Ownable_init();

        _pause();

        dogs = _dogs;
        weth = _weth;
        timeBuffer = _timeBuffer;
        reservePrice = _reservePrice;
        minBidIncrementPercentage = _minBidIncrementPercentage;
        duration = _duration;
        bidToken = new BidTokens(bidTokenName, bidTokenSymbol);

        IERC20 token = IERC20(weth);
        token.approve(address(dogs), 2**256 - 1);
    }

    /**
     * @notice Settle the current auction, mint a new Dog, and put it up for auction.
     */
    function settleCurrentAndCreateNewAuction() external override nonReentrant whenNotPaused {
        _settleAuction();
        _createAuction();
    }

    /**
     * @notice Settle the current auction.
     * @dev This function can only be called when the contract is paused.
     */
    function settleAuction() external override whenPaused nonReentrant {
        _settleAuction();
    }

    /**
     * @notice Create a bid for a Dog, with a given amount.
     * @dev This contract only accepts payment in ETH.
     */
    function createBid(uint256 dogId, uint256 amount) external payable override nonReentrant {
        IDogsAuctionHouse.Auction memory _auction = auction;

        require(_auction.dogId == dogId, 'Dog not up for auction');
        require(block.timestamp < _auction.endTime, 'Auction expired');
        require(amount >= reservePrice, 'Must send at least reservePrice');
        require(
            amount >= _auction.amount + ((_auction.amount * minBidIncrementPercentage) / 100),
            'Must send more than last bid by minBidIncrementPercentage amount'
        );

        _handleIncomingBid(amount, weth);

        address payable lastBidder = _auction.bidder;

        // Refund the last bidder, if applicable
        if (lastBidder != address(0)) {
            //_safeTransferETHWithFallback(lastBidder, _auction.amount);
            _handleOutgoingBid(lastBidder, _auction.amount, weth);
        }

        auction.amount = amount;
        auction.bidder = payable(msg.sender);

        if (msg.sender != lastBidder) {
            bidToken.mint(msg.sender, amount.mul(1000));
        }

        // Extend the auction if the bid was received within `timeBuffer` of the auction end time
        bool extended = _auction.endTime - block.timestamp < timeBuffer;
        if (extended) {
            auction.endTime = _auction.endTime = block.timestamp + timeBuffer;
        }

        emit AuctionBid(_auction.dogId, msg.sender, amount, extended);

        if (extended) {
            emit AuctionExtended(_auction.dogId, _auction.endTime);
        }
    }

    /**
     * @notice Pause the Dogs auction house.
     * @dev This function can only be called by the owner when the
     * contract is unpaused. While no new auctions can be started when paused,
     * anyone can settle an ongoing auction.
     */
    function pause() external override onlyOwner {
        _pause();
    }

    /**
     * @notice Unpause the Dogs auction house.
     * @dev This function can only be called by the owner when the
     * contract is paused. If required, this function will start a new auction.
     */
    function unpause() external override onlyOwner {
        _unpause();

        if (auction.startTime == 0 || auction.settled) {
            _createAuction();
        }
    }

    /**
     * @notice Set the auction time buffer.
     * @dev Only callable by the owner.
     */
    function setTimeBuffer(uint256 _timeBuffer) external override onlyOwner {
        timeBuffer = _timeBuffer;

        emit AuctionTimeBufferUpdated(_timeBuffer);
    }

    /**
     * @notice Set the auction duration.
     * @dev Only callable by the owner.
     */
    function setDuration(uint256 _duration) external override onlyOwner {
        duration = _duration;

        emit AuctionDurationUpdated(_duration);
    }

    /**
     * @notice Set the auction reserve price.
     * @dev Only callable by the owner.
     */
    function setReservePrice(uint256 _reservePrice) external override onlyOwner {
        reservePrice = _reservePrice;

        emit AuctionReservePriceUpdated(_reservePrice);
    }

    /**
     * @notice Set the auction minimum bid increment percentage.
     * @dev Only callable by the owner.
     */
    function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {
        minBidIncrementPercentage = _minBidIncrementPercentage;

        emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);
    }

    /**
     * @notice Get the auction duration for {id}
     * @dev Checks hardcoded early cadence schedule and then defaults to {duration} after that
     */
    function _getDuration(uint256 id) internal view returns(uint256) {
        if ( id > 50 ) {
            return duration;
        } else if ( id > 46 ) {
            // 12 hours
            return 60*60*12;
        } else if ( id > 39 ) {
            // 8 hours
            return 60*60*8;
        } else if ( id > 26 ) {
            // 4 hours
            return 60*60*4;
        } else if ( id == 1 ) {
            // 72 hours - Ukraine Dog
            return 60*60*24*3;
        } else {
            // 2 hours up to id 26
            return 60*60*2;
        }
    }

    /**
     * @notice Create an auction.
     * @dev Store the auction details in the `auction` state variable and emit an AuctionCreated event.
     * If the mint reverts, the minter was updated without pausing this contract first. To remedy this,
     * catch the revert and pause this contract.
     */
    function _createAuction() internal {
        try dogs.mint() returns (uint256 dogId) {
            uint256 startTime = block.timestamp;
            uint256 endTime = startTime + _getDuration(dogId);

            auction = Auction({
                dogId: dogId,
                amount: 0,
                startTime: startTime,
                endTime: endTime,
                bidder: payable(0),
                settled: false
            });

            emit AuctionCreated(dogId, startTime, endTime);
        } catch Error(string memory) {
            _pause();
        }
    }

    /**
     * @notice Settle an auction, finalizing the bid and paying out to the owner.
     * @dev If there are no bids, the Dog is burned.
     */
    function _settleAuction() internal {
        IDogsAuctionHouse.Auction memory _auction = auction;

        require(_auction.startTime != 0, "Auction hasn't begun");
        require(!_auction.settled, 'Auction has already been settled');
        require(block.timestamp >= _auction.endTime, "Auction hasn't completed");

        auction.settled = true;
        dogs.issue(_auction.bidder, _auction.dogId, _auction.amount);
        bidToken.mint(msg.sender, _auction.amount.mul(1000));

        emit AuctionSettled(_auction.dogId, _auction.bidder, _auction.amount);
    }

    /**
     * @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(weth).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(weth).withdraw(amount);

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

    /**
     * @notice Transfer ETH. If the ETH transfer fails, wrap the ETH and try send it as WETH.
     */
    function _safeTransferETHWithFallback(address to, uint256 amount) internal {
        if (!_safeTransferETH(to, amount)) {
            IWETH(weth).deposit{ value: amount }();
            IERC20(weth).transfer(to, amount);
        }
    }

    /**
     * @notice Transfer ETH and return the success status.
     * @dev This function only forwards 30,000 gas to the callee.
     */
    function _safeTransferETH(address to, uint256 value) internal returns (bool) {
        (bool success, ) = to.call{ value: value, gas: 30_000 }(new bytes(0));
        return success;
    }
}

File 2 of 28 : SafeMath.sol
// SPDX-License-Identifier: MIT

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 no longer needed starting with Solidity 0.8. 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 substraction 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 3 of 28 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

File 4 of 28 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal initializer {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 5 of 28 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

    function __Ownable_init_unchained() internal initializer {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}

File 6 of 28 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

File 7 of 28 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    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));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 28 : IDogsAuctionHouse.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for Degen Dogs Auction Houses


pragma solidity ^0.8.0;

interface IDogsAuctionHouse {
    struct Auction {
        // ID for the Dog (ERC721 token ID)
        uint256 dogId;
        // The current highest bid amount
        uint256 amount;
        // The time that the auction started
        uint256 startTime;
        // The time that the auction is scheduled to end
        uint256 endTime;
        // The address of the current highest bid
        address payable bidder;
        // Whether or not the auction has been settled
        bool settled;
    }

    event AuctionCreated(uint256 indexed dogId, uint256 startTime, uint256 endTime);

    event AuctionBid(uint256 indexed dogId, address sender, uint256 value, bool extended);

    event AuctionExtended(uint256 indexed dogId, uint256 endTime);

    event AuctionSettled(uint256 indexed dogId, address winner, uint256 amount);

    event AuctionTimeBufferUpdated(uint256 timeBuffer);

    event AuctionDurationUpdated(uint256 duration);

    event AuctionReservePriceUpdated(uint256 reservePrice);

    event AuctionMinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage);

    function settleAuction() external;

    function settleCurrentAndCreateNewAuction() external;

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

    function pause() external;

    function unpause() external;

    function setTimeBuffer(uint256 timeBuffer) external;

    function setDuration(uint256 duration) external;

    function setReservePrice(uint256 reservePrice) external;

    function setMinBidIncrementPercentage(uint8 minBidIncrementPercentage) external;
}

File 9 of 28 : IDogsToken.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for DegenDogsToken

pragma solidity ^0.8.0;

import { IERC721 } from '@openzeppelin/contracts/token/ERC721/IERC721.sol';

interface IDogsToken is IERC721 {
    event DogCreated(uint256 indexed tokenId);

    event DogBurned(uint256 indexed tokenId);

    event MinterUpdated(address minter);

    event MinterLocked();

    function mint() external returns (uint256);

    function issue(address newOwner, uint256 tokenId, uint256 amount) external;

    function burn(uint256 tokenId) external;

    function setMinter(address minter) external;

    function lockMinter() external;

}

File 10 of 28 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 wad) external;

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

File 11 of 28 : BidTokens.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";

contract BidTokens is ERC20, Ownable, ERC20Permit, ERC20Votes {
    constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }

    // @dev The following functions are overrides required by Solidity.

    function _afterTokenTransfer(address from, address to, uint256 amount)
        internal
        override(ERC20, ERC20Votes)
    {
        super._afterTokenTransfer(from, to, amount);
    }

    function _mint(address to, uint256 amount)
        internal
        override(ERC20, ERC20Votes)
    {
        super._mint(to, amount);
    }

    function _burn(address account, uint256 amount)
        internal
        override(ERC20, ERC20Votes)
    {
        super._burn(account, amount);
    }
}

File 12 of 28 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 13 of 28 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 14 of 28 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

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

File 15 of 28 : IERC721.sol
// SPDX-License-Identifier: MIT

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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

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

File 16 of 28 : IERC165.sol
// SPDX-License-Identifier: MIT

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 17 of 28 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 18 of 28 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 19 of 28 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 20 of 28 : ERC20Votes.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-ERC20Permit.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/ECDSA.sol";

/**
 * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,
 * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
 *
 * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
 *
 * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
 * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
 * power can be queried through the public accessors {getVotes} and {getPastVotes}.
 *
 * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
 * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
 * Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
 * will significantly increase the base gas cost of transfers.
 *
 * _Available since v4.2._
 */
abstract contract ERC20Votes is ERC20Permit {
    struct Checkpoint {
        uint32 fromBlock;
        uint224 votes;
    }

    bytes32 private constant _DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    mapping(address => address) private _delegates;
    mapping(address => Checkpoint[]) private _checkpoints;
    Checkpoint[] private _totalSupplyCheckpoints;

    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Get the `pos`-th checkpoint for `account`.
     */
    function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
        return _checkpoints[account][pos];
    }

    /**
     * @dev Get number of checkpoints for `account`.
     */
    function numCheckpoints(address account) public view virtual returns (uint32) {
        return SafeCast.toUint32(_checkpoints[account].length);
    }

    /**
     * @dev Get the address `account` is currently delegating to.
     */
    function delegates(address account) public view virtual returns (address) {
        return _delegates[account];
    }

    /**
     * @dev Gets the current votes balance for `account`
     */
    function getVotes(address account) public view returns (uint256) {
        uint256 pos = _checkpoints[account].length;
        return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
    }

    /**
     * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_checkpoints[account], blockNumber);
    }

    /**
     * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
     * It is but NOT the sum of all the delegated votes!
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
    }

    /**
     * @dev Lookup a value in a list of (sorted) checkpoints.
     */
    function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
        // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
        //
        // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
        // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
        // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
        // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)
        // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
        // out of bounds (in which case we're looking too far in the past and the result is 0).
        // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
        // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
        // the same.
        uint256 high = ckpts.length;
        uint256 low = 0;
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (ckpts[mid].fromBlock > blockNumber) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        return high == 0 ? 0 : ckpts[high - 1].votes;
    }

    /**
     * @dev Delegate votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) public virtual {
        return _delegate(_msgSender(), delegatee);
    }

    /**
     * @dev Delegates votes from signer to `delegatee`
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(block.timestamp <= expiry, "ERC20Votes: signature expired");
        address signer = ECDSA.recover(
            _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
            v,
            r,
            s
        );
        require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
        return _delegate(signer, delegatee);
    }

    /**
     * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
     */
    function _maxSupply() internal view virtual returns (uint224) {
        return type(uint224).max;
    }

    /**
     * @dev Snapshots the totalSupply after it has been increased.
     */
    function _mint(address account, uint256 amount) internal virtual override {
        super._mint(account, amount);
        require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");

        _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
    }

    /**
     * @dev Snapshots the totalSupply after it has been decreased.
     */
    function _burn(address account, uint256 amount) internal virtual override {
        super._burn(account, amount);

        _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
    }

    /**
     * @dev Move voting power when tokens are transferred.
     *
     * Emits a {DelegateVotesChanged} event.
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._afterTokenTransfer(from, to, amount);

        _moveVotingPower(delegates(from), delegates(to), amount);
    }

    /**
     * @dev Change delegation for `delegator` to `delegatee`.
     *
     * Emits events {DelegateChanged} and {DelegateVotesChanged}.
     */
    function _delegate(address delegator, address delegatee) internal virtual {
        address currentDelegate = delegates(delegator);
        uint256 delegatorBalance = balanceOf(delegator);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveVotingPower(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveVotingPower(
        address src,
        address dst,
        uint256 amount
    ) private {
        if (src != dst && amount > 0) {
            if (src != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
                emit DelegateVotesChanged(src, oldWeight, newWeight);
            }

            if (dst != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
                emit DelegateVotesChanged(dst, oldWeight, newWeight);
            }
        }
    }

    function _writeCheckpoint(
        Checkpoint[] storage ckpts,
        function(uint256, uint256) view returns (uint256) op,
        uint256 delta
    ) private returns (uint256 oldWeight, uint256 newWeight) {
        uint256 pos = ckpts.length;
        oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
        newWeight = op(oldWeight, delta);

        if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
            ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
        } else {
            ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
        }
    }

    function _add(uint256 a, uint256 b) private pure returns (uint256) {
        return a + b;
    }

    function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
        return a - b;
    }
}

File 21 of 28 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 22 of 28 : Context.sol
// SPDX-License-Identifier: MIT

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 23 of 28 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT

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 24 of 28 : draft-EIP712.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 25 of 28 : ECDSA.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

File 26 of 28 : Counters.sol
// SPDX-License-Identifier: MIT

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 27 of 28 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

File 28 of 28 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"dogId","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bool","name":"extended","type":"bool"}],"name":"AuctionBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"dogId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"AuctionDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"dogId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"AuctionExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minBidIncrementPercentage","type":"uint256"}],"name":"AuctionMinBidIncrementPercentageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reservePrice","type":"uint256"}],"name":"AuctionReservePriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"dogId","type":"uint256"},{"indexed":false,"internalType":"address","name":"winner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AuctionSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timeBuffer","type":"uint256"}],"name":"AuctionTimeBufferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"auction","outputs":[{"internalType":"uint256","name":"dogId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address payable","name":"bidder","type":"address"},{"internalType":"bool","name":"settled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bidToken","outputs":[{"internalType":"contract BidTokens","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dogId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"dogs","outputs":[{"internalType":"contract IDogsToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDogsToken","name":"_dogs","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"uint256","name":"_timeBuffer","type":"uint256"},{"internalType":"uint256","name":"_reservePrice","type":"uint256"},{"internalType":"uint8","name":"_minBidIncrementPercentage","type":"uint8"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"string","name":"bidTokenName","type":"string"},{"internalType":"string","name":"bidTokenSymbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minBidIncrementPercentage","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reservePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_minBidIncrementPercentage","type":"uint8"}],"name":"setMinBidIncrementPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_reservePrice","type":"uint256"}],"name":"setReservePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timeBuffer","type":"uint256"}],"name":"setTimeBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleCurrentAndCreateNewAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeBuffer","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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50614e45806100206000396000f3fe6080604052600436106200019a5760003560e01c8063a4d0a17e11620000df578063dfafd4fd116200008b578063f2fde38b1162000061578063f2fde38b14620003f5578063f34e2426146200041a578063f6be71d11462000432576200019a565b8063dfafd4fd14620003ad578063ec91f2a414620003c5578063f25efffc14620003dd576200019a565b8063b7751c7111620000c1578063b7751c711462000359578063ce9c7c0d1462000370578063db2e1eed1462000395576200019a565b8063a4d0a17e146200031a578063b296024d1462000332576200019a565b80635c975abb116200014b5780637d9f6db511620001215780637d9f6db514620002be5780638456cb5914620002ea5780638da5cb5b1462000302576200019a565b80635c975abb146200025a5780637120334b1462000281578063715018a614620002a6576200019a565b80633f4ba83a11620001815780633f4ba83a14620001f65780633fc8cef3146200020e57806358f61f0d1462000235576200019a565b80630fb5a6b4146200019f57806336ebdb3814620001cf575b600080fd5b348015620001ac57600080fd5b50620001b762000457565b604051620001c69190620025c8565b60405180910390f35b348015620001dc57600080fd5b50620001f4620001ee36600462001f7e565b6200045d565b005b3480156200020357600080fd5b50620001f4620004f8565b3480156200021b57600080fd5b506200022662000573565b604051620001c6919062001fe3565b3480156200024257600080fd5b50620001f46200025436600462001e5a565b62000582565b3480156200026757600080fd5b50620002726200079c565b604051620001c6919062002078565b3480156200028e57600080fd5b50620001f4620002a036600462001f2a565b620007a6565b348015620002b357600080fd5b50620001f462000823565b348015620002cb57600080fd5b50620002d662000875565b604051620001c696959493929190620025df565b348015620002f757600080fd5b50620001f46200089c565b3480156200030f57600080fd5b5062000226620008ec565b3480156200032757600080fd5b50620001f4620008fb565b3480156200033f57600080fd5b506200034a62000960565b604051620001c6919062002612565b620001f46200036a36600462001f5c565b62000969565b3480156200037d57600080fd5b50620001f46200038f36600462001f2a565b62000c6e565b348015620003a257600080fd5b50620001b762000ceb565b348015620003ba57600080fd5b506200022662000cf1565b348015620003d257600080fd5b50620001b762000d00565b348015620003ea57600080fd5b50620001f462000d06565b3480156200040257600080fd5b50620001f46200041436600462001e19565b62000d6f565b3480156200042757600080fd5b506200022662000dec565b3480156200043f57600080fd5b50620001f46200045136600462001f2a565b62000dfb565b60ce5481565b6200046762000e78565b6001600160a01b03166200047a620008ec565b6001600160a01b031614620004ac5760405162461bcd60e51b8152600401620004a39062002334565b60405180910390fd5b60cd805460ff191660ff83161790556040517fec5ccd96cc77b6219e9d44143df916af68fc169339ea7de5008ff15eae13450d90620004ed90839062002612565b60405180910390a150565b6200050262000e78565b6001600160a01b031662000515620008ec565b6001600160a01b0316146200053e5760405162461bcd60e51b8152600401620004a39062002334565b6200054862000e7c565b60d254158062000561575060d454600160a01b900460ff165b1562000571576200057162000ef3565b565b60ca546001600160a01b031681565b600054610100900460ff16806200059c575060005460ff16155b620005bb5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620005e7576000805460ff1961ff0019909116610100171660011790555b620005f16200107e565b620005fb6200110c565b620006056200117b565b6200060f620011f4565b60c980546001600160a01b03808e1673ffffffffffffffffffffffffffffffffffffffff199283161790925560ca8054928d169290911691909117905560cb89905560cc88905560cd805460ff891660ff1990911617905560ce8690556040518590859085908590620006829062001daf565b62000691949392919062002083565b604051809103906000f080158015620006ae573d6000803e3d6000fd5b5060cf805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392831617905560ca5460c9546040517f095ea7b300000000000000000000000000000000000000000000000000000000815291831692839263095ea7b392620007249216906000199060040162001ff7565b602060405180830381600087803b1580156200073f57600080fd5b505af115801562000754573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077a919062001e38565b505080156200078f576000805461ff00191690555b5050505050505050505050565b60335460ff165b90565b620007b062000e78565b6001600160a01b0316620007c3620008ec565b6001600160a01b031614620007ec5760405162461bcd60e51b8152600401620004a39062002334565b60cb8190556040517f1b55d9f7002bda4490f467e326f22a4a847629c0f2d1ed421607d318d25b410d90620004ed908390620025c8565b6200082d62000e78565b6001600160a01b031662000840620008ec565b6001600160a01b031614620008695760405162461bcd60e51b8152600401620004a39062002334565b62000571600062001256565b60d05460d15460d25460d35460d4546001600160a01b03811690600160a01b900460ff1686565b620008a662000e78565b6001600160a01b0316620008b9620008ec565b6001600160a01b031614620008e25760405162461bcd60e51b8152600401620004a39062002334565b62000571620011f4565b6097546001600160a01b031690565b620009056200079c565b620009245760405162461bcd60e51b8152600401620004a390620020e3565b600260655414156200094a5760405162461bcd60e51b8152600401620004a390620024c6565b600260655562000959620012b5565b6001606555565b60cd5460ff1681565b600260655414156200098f5760405162461bcd60e51b8152600401620004a390620024c6565b60026065556040805160c08101825260d05480825260d154602083015260d2549282019290925260d354606082015260d4546001600160a01b0381166080830152600160a01b900460ff16151560a082015290831462000a035760405162461bcd60e51b8152600401620004a39062002534565b8060600151421062000a295760405162461bcd60e51b8152600401620004a390620024fd565b60cc5482101562000a4e5760405162461bcd60e51b8152600401620004a3906200220b565b60cd54602082015160649162000a6a9160ff909116906200265c565b62000a7691906200263b565b816020015162000a87919062002620565b82101562000aa95760405162461bcd60e51b8152600401620004a390620022d6565b60ca5462000ac29083906001600160a01b0316620014ed565b60808101516001600160a01b0381161562000af557602082015160ca5462000af59183916001600160a01b0316620016eb565b60d183905560d4805473ffffffffffffffffffffffffffffffffffffffff1916339081179091556001600160a01b0382161462000ba05760cf546001600160a01b03166340c10f193362000b4c866103e862001831565b6040518363ffffffff1660e01b815260040162000b6b92919062001ff7565b600060405180830381600087803b15801562000b8657600080fd5b505af115801562000b9b573d6000803e3d6000fd5b505050505b600060cb5442846060015162000bb791906200267e565b109050801562000bdb5760cb5462000bd0904262002620565b6060840181905260d3555b82516040517f1159164c56f277e6fc99c11731bd380e0347deb969b75523398734c252706ea39062000c139033908890869062002055565b60405180910390a2801562000c6257825160608401516040517f6e912a3a9105bdd2af817ba5adc14e6c127c1035b5b648faa29ca0d58ab8ff4e9162000c5991620025c8565b60405180910390a25b50506001606555505050565b62000c7862000e78565b6001600160a01b031662000c8b620008ec565b6001600160a01b03161462000cb45760405162461bcd60e51b8152600401620004a39062002334565b60cc8190556040517f6ab2e127d7fdf53b8f304e59d3aab5bfe97979f52a85479691a6fab27a28a6b290620004ed908390620025c8565b60cc5481565b60cf546001600160a01b031681565b60cb5481565b6002606554141562000d2c5760405162461bcd60e51b8152600401620004a390620024c6565b600260655562000d3b6200079c565b1562000d5b5760405162461bcd60e51b8152600401620004a39062002242565b62000d65620012b5565b6200095962000ef3565b62000d7962000e78565b6001600160a01b031662000d8c620008ec565b6001600160a01b03161462000db55760405162461bcd60e51b8152600401620004a39062002334565b6001600160a01b03811662000dde5760405162461bcd60e51b8152600401620004a3906200211a565b62000de98162001256565b50565b60c9546001600160a01b031681565b62000e0562000e78565b6001600160a01b031662000e18620008ec565b6001600160a01b03161462000e415760405162461bcd60e51b8152600401620004a39062002334565b60ce8190556040517faab6389d8f1c16ba1deb6e9831f5c5442cf4fcf99bf5bfa867460be408a9111890620004ed908390620025c8565b3390565b62000e866200079c565b62000ea55760405162461bcd60e51b8152600401620004a390620020e3565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa62000eda62000e78565b60405162000ee9919062001fe3565b60405180910390a1565b60c960009054906101000a90046001600160a01b03166001600160a01b0316631249c58b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801562000f4457600080fd5b505af192505050801562000f77575060408051601f3d908101601f1916820190925262000f749181019062001f43565b60015b62000fb45762000f86620026e3565b8062000f93575062000fa4565b62000f9d620011f4565b5062000fae565b3d6000803e3d6000fd5b62000571565b42600062000fc28362001846565b62000fce908362002620565b6040805160c081018252858152600060208201819052818301869052606082018490526080820181905260a090910181905260d086905560d15560d284905560d382905560d480547fffffffffffffffffffffff0000000000000000000000000000000000000000001690555190915083907fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca90620010719085908590620025d1565b60405180910390a2505050565b600054610100900460ff168062001098575060005460ff16155b620010b75760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620010e3576000805460ff1961ff0019909116610100171660011790555b620010ed620018b7565b620010f762001930565b801562000de9576000805461ff001916905550565b600054610100900460ff168062001126575060005460ff16155b620011455760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001171576000805460ff1961ff0019909116610100171660011790555b620010f7620019b4565b600054610100900460ff168062001195575060005460ff16155b620011b45760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620011e0576000805460ff1961ff0019909116610100171660011790555b620011ea620018b7565b620010f762001a33565b620011fe6200079c565b156200121e5760405162461bcd60e51b8152600401620004a39062002242565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25862000eda62000e78565b609780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805160c08101825260d054815260d154602082015260d25491810182905260d354606082015260d4546001600160a01b0381166080830152600160a01b900460ff16151560a082015290620013205760405162461bcd60e51b8152600401620004a390620021d4565b8060a0015115620013455760405162461bcd60e51b8152600401620004a390620023c6565b80606001514210156200136c5760405162461bcd60e51b8152600401620004a3906200248f565b60d480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560c9546080820151825160208401516040517fdfe5ef480000000000000000000000000000000000000000000000000000000081526001600160a01b039094169363dfe5ef4893620013f3939092909160040162002010565b600060405180830381600087803b1580156200140e57600080fd5b505af115801562001423573d6000803e3d6000fd5b505060cf5460208401516001600160a01b0390911692506340c10f199150339062001451906103e862001831565b6040518363ffffffff1660e01b81526004016200147092919062001ff7565b600060405180830381600087803b1580156200148b57600080fd5b505af1158015620014a0573d6000803e3d6000fd5b50508251608084015160208501516040519294507fc9f72b276a388619c6d185d146697036241880c36654b1a3ffdad07c24038d999350620014e29262001ff7565b60405180910390a250565b6001600160a01b0381166200158f578134146200151e5760405162461bcd60e51b8152600401620004a39062002369565b60ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156200156f57600080fd5b505af115801562001584573d6000803e3d6000fd5b5050505050620016e7565b6040516370a0823160e01b815281906000906001600160a01b038316906370a0823190620015c290309060040162001fe3565b60206040518083038186803b158015620015db57600080fd5b505afa158015620015f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001616919062001f43565b90506200162f6001600160a01b03831633308762001aac565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906200166090309060040162001fe3565b60206040518083038186803b1580156200167957600080fd5b505afa1580156200168e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620016b4919062001f43565b905080620016c3838762001b3b565b14620016e35760405162461bcd60e51b8152600401620004a3906200256b565b5050505b5050565b6001600160a01b038116620018165760ca546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690632e1a7d4d9062001745908590600401620025c8565b600060405180830381600087803b1580156200176057600080fd5b505af115801562001775573d6000803e3d6000fd5b5050505062001785838362001b49565b620018105760ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015620017db57600080fd5b505af1158015620017f0573d6000803e3d6000fd5b505060ca546200181093506001600160a01b031691508590508462001bcb565b6200182c565b6200182c6001600160a01b038216848462001bcb565b505050565b60006200183f82846200265c565b9392505050565b600060328211156200185c575060ce54620018b2565b602e82111562001870575061a8c0620018b2565b6027821115620018845750617080620018b2565b601a821115620018985750613840620018b2565b8160011415620018ad57506203f480620018b2565b50611c205b919050565b600054610100900460ff1680620018d1575060005460ff16155b620018f05760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620010f7576000805460ff1961ff001990911661010017166001179055801562000de9576000805461ff001916905550565b600054610100900460ff16806200194a575060005460ff16155b620019695760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001995576000805460ff1961ff0019909116610100171660011790555b6033805460ff19169055801562000de9576000805461ff001916905550565b600054610100900460ff1680620019ce575060005460ff16155b620019ed5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001a19576000805460ff1961ff0019909116610100171660011790555b6001606555801562000de9576000805461ff001916905550565b600054610100900460ff168062001a4d575060005460ff16155b62001a6c5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001a98576000805460ff1961ff0019909116610100171660011790555b620010f762001aa662000e78565b62001256565b62001b35846323b872dd60e01b85858560405160240162001ad09392919062002031565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262001bed565b50505050565b60006200183f828462002620565b6040805160008082526020820190925281906001600160a01b0385169061753090859060405162001b7b919062001fc5565b600060405180830381858888f193505050503d806000811462001bbb576040519150601f19603f3d011682016040523d82523d6000602084013e62001bc0565b606091505b509095945050505050565b6200182c8363a9059cbb60e01b848460405160240162001ad092919062001ff7565b600062001c44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662001c849092919063ffffffff16565b8051909150156200182c578080602001905181019062001c65919062001e38565b6200182c5760405162461bcd60e51b8152600401620004a39062002432565b606062001c95848460008562001c9d565b949350505050565b60608247101562001cc25760405162461bcd60e51b8152600401620004a39062002177565b62001ccd8562001d6b565b62001cec5760405162461bcd60e51b8152600401620004a390620023fb565b600080866001600160a01b0316858760405162001d0a919062001fc5565b60006040518083038185875af1925050503d806000811462001d49576040519150601f19603f3d011682016040523d82523d6000602084013e62001d4e565b606091505b509150915062001d6082828662001d71565b979650505050505050565b3b151590565b6060831562001d825750816200183f565b82511562001d935782518084602001fd5b8160405162461bcd60e51b8152600401620004a39190620020ae565b61266580620027ab83390190565b60008083601f84011262001dcf578182fd5b50813567ffffffffffffffff81111562001de7578182fd5b60208301915083602082850101111562001e0057600080fd5b9250929050565b803560ff81168114620018b257600080fd5b60006020828403121562001e2b578081fd5b81356200183f8162002794565b60006020828403121562001e4a578081fd5b815180151581146200183f578182fd5b6000806000806000806000806000806101008b8d03121562001e7a578586fd5b8a3562001e878162002794565b995060208b013562001e998162002794565b985060408b0135975060608b0135965062001eb760808c0162001e07565b955060a08b0135945060c08b013567ffffffffffffffff8082111562001edb578586fd5b62001ee98e838f0162001dbd565b909650945060e08d013591508082111562001f02578384fd5b5062001f118d828e0162001dbd565b915080935050809150509295989b9194979a5092959850565b60006020828403121562001f3c578081fd5b5035919050565b60006020828403121562001f55578081fd5b5051919050565b6000806040838503121562001f6f578182fd5b50508035926020909101359150565b60006020828403121562001f90578081fd5b6200183f8262001e07565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b6000825162001fd981846020870162002698565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0393909316835260208301919091521515604082015260600190565b901515815260200190565b6000604082526200209960408301868862001f9b565b828103602084015262001d6081858762001f9b565b6000602082528251806020840152620020cf81604085016020870162002698565b601f01601f19169190910160400192915050565b60208082526014908201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f41756374696f6e206861736e277420626567756e000000000000000000000000604082015260600190565b6020808252601f908201527f4d7573742073656e64206174206c656173742072657365727665507269636500604082015260600190565b60208082526010908201527f5061757361626c653a2070617573656400000000000000000000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201527f647920696e697469616c697a6564000000000000000000000000000000000000606082015260800190565b602080825260409082018190527f4d7573742073656e64206d6f7265207468616e206c6173742062696420627920908201527f6d696e426964496e6372656d656e7450657263656e7461676520616d6f756e74606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526032908201527f53656e74204554482056616c756520646f6573206e6f74206d6174636820737060408201527f656369666965642062696420616d6f756e740000000000000000000000000000606082015260800190565b6020808252818101527f41756374696f6e2068617320616c7265616479206265656e20736574746c6564604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f41756374696f6e206861736e277420636f6d706c657465640000000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600f908201527f41756374696f6e20657870697265640000000000000000000000000000000000604082015260600190565b60208082526016908201527f446f67206e6f7420757020666f722061756374696f6e00000000000000000000604082015260600190565b60208082526034908201527f546f6b656e207472616e736665722063616c6c20646964206e6f74207472616e60408201527f7366657220657870656374656420616d6f756e74000000000000000000000000606082015260800190565b90815260200190565b918252602082015260400190565b9586526020860194909452604085019290925260608401526001600160a01b03166080830152151560a082015260c00190565b60ff91909116815260200190565b60008219821115620026365762002636620026c7565b500190565b6000826200265757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620026795762002679620026c7565b500290565b600082821015620026935762002693620026c7565b500390565b60005b83811015620026b55781810151838201526020016200269b565b8381111562001b355750506000910152565b634e487b7160e01b600052601160045260246000fd5b60e01c90565b600060443d1015620026f557620007a3565b600481823e6308c379a06200270b8251620026dd565b146200271757620007a3565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715620027495750505050620007a3565b82840192508251915080821115620027655750505050620007a3565b503d830160208284010111156200277f57505050620007a3565b601f01601f1916810160200160405291505090565b6001600160a01b038116811462000de957600080fdfe6101406040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610120523480156200003757600080fd5b5060405162002665380380620026658339810160408190526200005a916200030b565b8180604051806040016040528060018152602001603160f81b8152508484816003908051906020019062000090929190620001ba565b508051620000a6906004906020840190620001ba565b505050620000c3620000bd6200012860201b60201c565b6200012c565b815160208084019190912082519183019190912060c082905260e08190524660a0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620001138184846200017e565b6080526101005250620003f195505050505050565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600083838346306040516020016200019b95949392919062000372565b6040516020818303038152906040528051906020012090509392505050565b828054620001c8906200039e565b90600052602060002090601f016020900481019282620001ec576000855562000237565b82601f106200020757805160ff191683800117855562000237565b8280016001018555821562000237579182015b82811115620002375782518255916020019190600101906200021a565b506200024592915062000249565b5090565b5b808211156200024557600081556001016200024a565b600082601f83011262000271578081fd5b81516001600160401b03808211156200028e576200028e620003db565b6040516020601f8401601f1916820181018381118382101715620002b657620002b6620003db565b6040528382528584018101871015620002cd578485fd5b8492505b83831015620002f05785830181015182840182015291820191620002d1565b838311156200030157848185840101525b5095945050505050565b600080604083850312156200031e578182fd5b82516001600160401b038082111562000335578384fd5b620003438683870162000260565b9350602085015191508082111562000359578283fd5b50620003688582860162000260565b9150509250929050565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b600281046001821680620003b357607f821691505b60208210811415620003d557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160e051610100516101205161222462000441600039600061093a01526000610d4f01526000610d9101526000610d7001526000610cfd01526000610d2601526122246000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c8063715018a6116100ee578063a457c2d711610097578063d505accf11610071578063d505accf14610361578063dd62ed3e14610374578063f1127ed814610387578063f2fde38b146103a7576101ae565b8063a457c2d714610328578063a9059cbb1461033b578063c3cda5201461034e576101ae565b80638e539e8c116100c85780638e539e8c146102fa57806395d89b411461030d5780639ab24eb014610315576101ae565b8063715018a6146102d75780637ecebe00146102df5780638da5cb5b146102f2576101ae565b8063395093511161015b578063587cde1e11610135578063587cde1e146102715780635c19a95c146102915780636fcfff45146102a457806370a08231146102c4576101ae565b806339509351146102365780633a46b1a81461024957806340c10f191461025c576101ae565b806323b872dd1161018c57806323b872dd14610206578063313ce567146102195780633644e5151461022e576101ae565b806306fdde03146101b3578063095ea7b3146101d157806318160ddd146101f1575b600080fd5b6101bb6103ba565b6040516101c89190611a3e565b60405180910390f35b6101e46101df366004611868565b61044d565b6040516101c89190611988565b6101f961046a565b6040516101c89190611993565b6101e46102143660046117c4565b610470565b610221610509565b6040516101c89190612146565b6101f961050e565b6101e4610244366004611868565b61051d565b6101f9610257366004611868565b610571565b61026f61026a366004611868565b6105bb565b005b61028461027f366004611778565b610608565b6040516101c89190611974565b61026f61029f366004611778565b610629565b6102b76102b2366004611778565b61063d565b6040516101c89190612135565b6101f96102d2366004611778565b610665565b61026f610680565b6101f96102ed366004611778565b6106cb565b6102846106ec565b6101f9610308366004611926565b6106fb565b6101bb610727565b6101f9610323366004611778565b610736565b6101e4610336366004611868565b6107cb565b6101e4610349366004611868565b610844565b61026f61035c366004611891565b610858565b61026f61036f3660046117ff565b610916565b6101f9610382366004611792565b6109f8565b61039a6103953660046118e8565b610a23565b6040516101c89190612101565b61026f6103b5366004611778565b610aa9565b6060600380546103c9906121a3565b80601f01602080910402602001604051908101604052809291908181526020018280546103f5906121a3565b80156104425780601f1061041757610100808354040283529160200191610442565b820191906000526020600020905b81548152906001019060200180831161042557829003601f168201915b505050505090505b90565b600061046161045a610b17565b8484610b1b565b50600192915050565b60025490565b600061047d848484610bcf565b6001600160a01b03841660009081526001602052604081208161049e610b17565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104ea5760405162461bcd60e51b81526004016104e190611e0a565b60405180910390fd5b6104fe856104f6610b17565b858403610b1b565b506001949350505050565b601290565b6000610518610cf9565b905090565b600061046161052a610b17565b848460016000610538610b17565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461056c9190612154565b610b1b565b60004382106105925760405162461bcd60e51b81526004016104e190611b25565b6001600160a01b03831660009081526008602052604090206105b49083610dbc565b9392505050565b6105c3610b17565b6001600160a01b03166105d46106ec565b6001600160a01b0316146105fa5760405162461bcd60e51b81526004016104e190611ec4565b6106048282610e95565b5050565b6001600160a01b03808216600090815260076020526040902054165b919050565b61063a610634610b17565b82610e9f565b50565b6001600160a01b03811660009081526008602052604081205461065f90610f2c565b92915050565b6001600160a01b031660009081526020819052604090205490565b610688610b17565b6001600160a01b03166106996106ec565b6001600160a01b0316146106bf5760405162461bcd60e51b81526004016104e190611ec4565b6106c96000610f56565b565b6001600160a01b038116600090815260066020526040812061065f90610fb5565b6005546001600160a01b031690565b600043821061071c5760405162461bcd60e51b81526004016104e190611b25565b61065f600983610dbc565b6060600480546103c9906121a3565b6001600160a01b03811660009081526008602052604081205480156107b8576001600160a01b038316600090815260086020526040902061077860018361218c565b8154811061079657634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b03166107bb565b60005b6001600160e01b03169392505050565b600080600160006107da610b17565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156108265760405162461bcd60e51b81526004016104e19061206d565b61083a610831610b17565b85858403610b1b565b5060019392505050565b6000610461610851610b17565b8484610bcf565b834211156108785760405162461bcd60e51b81526004016104e190611b5c565b60006108da6108d27fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8989896040516020016108b794939291906119d0565b60405160208183030381529060405280519060200120610fb9565b858585610fcc565b90506108e581610ff4565b86146109035760405162461bcd60e51b81526004016104e190611bca565b61090d8188610e9f565b50505050505050565b834211156109365760405162461bcd60e51b81526004016104e190611cbb565b60007f00000000000000000000000000000000000000000000000000000000000000008888886109658c610ff4565b8960405160200161097b9695949392919061199c565b604051602081830303815290604052805190602001209050600061099e82610fb9565b905060006109ae82878787610fcc565b9050896001600160a01b0316816001600160a01b0316146109e15760405162461bcd60e51b81526004016104e190611dd3565b6109ec8a8a8a610b1b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a2b611739565b6001600160a01b0383166000908152600860205260409020805463ffffffff8416908110610a6957634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b610ab1610b17565b6001600160a01b0316610ac26106ec565b6001600160a01b031614610ae85760405162461bcd60e51b81526004016104e190611ec4565b6001600160a01b038116610b0e5760405162461bcd60e51b81526004016104e190611c01565b61063a81610f56565b3390565b6001600160a01b038316610b415760405162461bcd60e51b81526004016104e190612010565b6001600160a01b038216610b675760405162461bcd60e51b81526004016104e190611c5e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610bc2908590611993565b60405180910390a3505050565b6001600160a01b038316610bf55760405162461bcd60e51b81526004016104e190611f56565b6001600160a01b038216610c1b5760405162461bcd60e51b81526004016104e190611ac8565b610c26838383611026565b6001600160a01b03831660009081526020819052604090205481811015610c5f5760405162461bcd60e51b81526004016104e190611cf2565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610c96908490612154565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ce09190611993565b60405180910390a3610cf384848461102b565b50505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461415610d4a57507f000000000000000000000000000000000000000000000000000000000000000061044a565b610db57f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611036565b905061044a565b8154600090815b81811015610e2e576000610dd78284611070565b905084868281548110610dfa57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015463ffffffff161115610e1a57809250610e28565b610e25816001612154565b91505b50610dc3565b8115610e805784610e4060018461218c565b81548110610e5e57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b0316610e83565b60005b6001600160e01b031695945050505050565b610604828261108b565b6000610eaa83610608565b90506000610eb784610665565b6001600160a01b03858116600081815260076020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610cf38284836110da565b600063ffffffff821115610f525760405162461bcd60e51b81526004016104e190611fb3565b5090565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b5490565b600061065f610fc6610cf9565b83611205565b6000806000610fdd87878787611238565b91509150610fea81611318565b5095945050505050565b6001600160a01b038116600090815260066020526040812061101581610fb5565b915061102081611445565b50919050565b505050565b61102683838361144e565b600083838346306040516020016110519594939291906119f4565b6040516020818303038152906040528051906020012090509392505050565b600061107f600284841861216c565b6105b490848416612154565b6110958282611474565b61109d61153c565b6001600160e01b03166110ae61046a565b11156110cc5760405162461bcd60e51b81526004016104e190611e67565b610cf3600961154783611553565b816001600160a01b0316836001600160a01b0316141580156110fc5750600081115b15611026576001600160a01b03831615611181576001600160a01b038316600090815260086020526040812081906111379061170485611553565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611176929190612127565b60405180910390a250505b6001600160a01b03821615611026576001600160a01b038216600090815260086020526040812081906111b79061154785611553565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516111f6929190612127565b60405180910390a25050505050565b6000828260405160200161121a92919061193e565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561126f575060009050600361130f565b8460ff16601b1415801561128757508460ff16601c14155b15611298575060009050600461130f565b6000600187878787604051600081526020016040526040516112bd9493929190611a20565b6020604051602081039080840390855afa1580156112df573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113085760006001925092505061130f565b9150600090505b94509492505050565b600081600481111561133a57634e487b7160e01b600052602160045260246000fd5b14156113455761063a565b600181600481111561136757634e487b7160e01b600052602160045260246000fd5b14156113855760405162461bcd60e51b81526004016104e190611a91565b60028160048111156113a757634e487b7160e01b600052602160045260246000fd5b14156113c55760405162461bcd60e51b81526004016104e190611b93565b60038160048111156113e757634e487b7160e01b600052602160045260246000fd5b14156114055760405162461bcd60e51b81526004016104e190611d4f565b600481600481111561142757634e487b7160e01b600052602160045260246000fd5b141561063a5760405162461bcd60e51b81526004016104e190611d91565b80546001019055565b611459838383611026565b61102661146584610608565b61146e84610608565b836110da565b6001600160a01b03821661149a5760405162461bcd60e51b81526004016104e1906120ca565b6114a660008383611026565b80600260008282546114b89190612154565b90915550506001600160a01b038216600090815260208190526040812080548392906114e5908490612154565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611528908590611993565b60405180910390a36106046000838361102b565b6001600160e01b0390565b60006105b48284612154565b8254600090819080156115ac578561156c60018361218c565b8154811061158a57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b03166115af565b60005b6001600160e01b031692506115c883858763ffffffff16565b9150600081118015611614575043866115e260018461218c565b8154811061160057634e487b7160e01b600052603260045260246000fd5b60009182526020909120015463ffffffff16145b156116825761162282611710565b8661162e60018461218c565b8154811061164c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b031602179055506116fb565b85604051806040016040528061169743610f2c565b63ffffffff1681526020016116ab85611710565b6001600160e01b039081169091528254600181018455600093845260209384902083519101805493909401519091166401000000000263ffffffff91821663ffffffff1990931692909217161790555b50935093915050565b60006105b4828461218c565b60006001600160e01b03821115610f525760405162461bcd60e51b81526004016104e190611ef9565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461062457600080fd5b803560ff8116811461062457600080fd5b600060208284031215611789578081fd5b6105b482611750565b600080604083850312156117a4578081fd5b6117ad83611750565b91506117bb60208401611750565b90509250929050565b6000806000606084860312156117d8578081fd5b6117e184611750565b92506117ef60208501611750565b9150604084013590509250925092565b600080600080600080600060e0888a031215611819578283fd5b61182288611750565b965061183060208901611750565b9550604088013594506060880135935061184c60808901611767565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561187a578182fd5b61188383611750565b946020939093013593505050565b60008060008060008060c087890312156118a9578182fd5b6118b287611750565b955060208701359450604087013593506118ce60608801611767565b92506080870135915060a087013590509295509295509295565b600080604083850312156118fa578182fd5b61190383611750565b9150602083013563ffffffff8116811461191b578182fd5b809150509250929050565b600060208284031215611937578081fd5b5035919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611a6a57858101830151858201604001528201611a4e565b81811115611a7b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604082015260600190565b6020808252601d908201527f4552433230566f7465733a207369676e61747572652065787069726564000000604082015260600190565b6020808252601f908201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604082015260600190565b60208082526019908201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160408201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60408201527f766572666c6f77696e6720766f74657300000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526027908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260408201527f3234206269747300000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360408201527f3220626974730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b815163ffffffff1681526020918201516001600160e01b03169181019190915260400190565b918252602082015260400190565b63ffffffff91909116815260200190565b60ff91909116815260200190565b60008219821115612167576121676121d8565b500190565b60008261218757634e487b7160e01b81526012600452602481fd5b500490565b60008282101561219e5761219e6121d8565b500390565b6002810460018216806121b757607f821691505b6020821081141561102057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fdfea2646970667358221220fb3ef5eb5b06936b43ea49dc523223f4dc5f5fca7ba14d125bde4b7ffb46070e64736f6c63430008000033a2646970667358221220192bb2cc4e118eaf774eb537b15bfe3258b608b0c7e0a3612442bfb1312a58ec64736f6c63430008000033

Deployed Bytecode

0x6080604052600436106200019a5760003560e01c8063a4d0a17e11620000df578063dfafd4fd116200008b578063f2fde38b1162000061578063f2fde38b14620003f5578063f34e2426146200041a578063f6be71d11462000432576200019a565b8063dfafd4fd14620003ad578063ec91f2a414620003c5578063f25efffc14620003dd576200019a565b8063b7751c7111620000c1578063b7751c711462000359578063ce9c7c0d1462000370578063db2e1eed1462000395576200019a565b8063a4d0a17e146200031a578063b296024d1462000332576200019a565b80635c975abb116200014b5780637d9f6db511620001215780637d9f6db514620002be5780638456cb5914620002ea5780638da5cb5b1462000302576200019a565b80635c975abb146200025a5780637120334b1462000281578063715018a614620002a6576200019a565b80633f4ba83a11620001815780633f4ba83a14620001f65780633fc8cef3146200020e57806358f61f0d1462000235576200019a565b80630fb5a6b4146200019f57806336ebdb3814620001cf575b600080fd5b348015620001ac57600080fd5b50620001b762000457565b604051620001c69190620025c8565b60405180910390f35b348015620001dc57600080fd5b50620001f4620001ee36600462001f7e565b6200045d565b005b3480156200020357600080fd5b50620001f4620004f8565b3480156200021b57600080fd5b506200022662000573565b604051620001c6919062001fe3565b3480156200024257600080fd5b50620001f46200025436600462001e5a565b62000582565b3480156200026757600080fd5b50620002726200079c565b604051620001c6919062002078565b3480156200028e57600080fd5b50620001f4620002a036600462001f2a565b620007a6565b348015620002b357600080fd5b50620001f462000823565b348015620002cb57600080fd5b50620002d662000875565b604051620001c696959493929190620025df565b348015620002f757600080fd5b50620001f46200089c565b3480156200030f57600080fd5b5062000226620008ec565b3480156200032757600080fd5b50620001f4620008fb565b3480156200033f57600080fd5b506200034a62000960565b604051620001c6919062002612565b620001f46200036a36600462001f5c565b62000969565b3480156200037d57600080fd5b50620001f46200038f36600462001f2a565b62000c6e565b348015620003a257600080fd5b50620001b762000ceb565b348015620003ba57600080fd5b506200022662000cf1565b348015620003d257600080fd5b50620001b762000d00565b348015620003ea57600080fd5b50620001f462000d06565b3480156200040257600080fd5b50620001f46200041436600462001e19565b62000d6f565b3480156200042757600080fd5b506200022662000dec565b3480156200043f57600080fd5b50620001f46200045136600462001f2a565b62000dfb565b60ce5481565b6200046762000e78565b6001600160a01b03166200047a620008ec565b6001600160a01b031614620004ac5760405162461bcd60e51b8152600401620004a39062002334565b60405180910390fd5b60cd805460ff191660ff83161790556040517fec5ccd96cc77b6219e9d44143df916af68fc169339ea7de5008ff15eae13450d90620004ed90839062002612565b60405180910390a150565b6200050262000e78565b6001600160a01b031662000515620008ec565b6001600160a01b0316146200053e5760405162461bcd60e51b8152600401620004a39062002334565b6200054862000e7c565b60d254158062000561575060d454600160a01b900460ff165b1562000571576200057162000ef3565b565b60ca546001600160a01b031681565b600054610100900460ff16806200059c575060005460ff16155b620005bb5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620005e7576000805460ff1961ff0019909116610100171660011790555b620005f16200107e565b620005fb6200110c565b620006056200117b565b6200060f620011f4565b60c980546001600160a01b03808e1673ffffffffffffffffffffffffffffffffffffffff199283161790925560ca8054928d169290911691909117905560cb89905560cc88905560cd805460ff891660ff1990911617905560ce8690556040518590859085908590620006829062001daf565b62000691949392919062002083565b604051809103906000f080158015620006ae573d6000803e3d6000fd5b5060cf805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392831617905560ca5460c9546040517f095ea7b300000000000000000000000000000000000000000000000000000000815291831692839263095ea7b392620007249216906000199060040162001ff7565b602060405180830381600087803b1580156200073f57600080fd5b505af115801562000754573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077a919062001e38565b505080156200078f576000805461ff00191690555b5050505050505050505050565b60335460ff165b90565b620007b062000e78565b6001600160a01b0316620007c3620008ec565b6001600160a01b031614620007ec5760405162461bcd60e51b8152600401620004a39062002334565b60cb8190556040517f1b55d9f7002bda4490f467e326f22a4a847629c0f2d1ed421607d318d25b410d90620004ed908390620025c8565b6200082d62000e78565b6001600160a01b031662000840620008ec565b6001600160a01b031614620008695760405162461bcd60e51b8152600401620004a39062002334565b62000571600062001256565b60d05460d15460d25460d35460d4546001600160a01b03811690600160a01b900460ff1686565b620008a662000e78565b6001600160a01b0316620008b9620008ec565b6001600160a01b031614620008e25760405162461bcd60e51b8152600401620004a39062002334565b62000571620011f4565b6097546001600160a01b031690565b620009056200079c565b620009245760405162461bcd60e51b8152600401620004a390620020e3565b600260655414156200094a5760405162461bcd60e51b8152600401620004a390620024c6565b600260655562000959620012b5565b6001606555565b60cd5460ff1681565b600260655414156200098f5760405162461bcd60e51b8152600401620004a390620024c6565b60026065556040805160c08101825260d05480825260d154602083015260d2549282019290925260d354606082015260d4546001600160a01b0381166080830152600160a01b900460ff16151560a082015290831462000a035760405162461bcd60e51b8152600401620004a39062002534565b8060600151421062000a295760405162461bcd60e51b8152600401620004a390620024fd565b60cc5482101562000a4e5760405162461bcd60e51b8152600401620004a3906200220b565b60cd54602082015160649162000a6a9160ff909116906200265c565b62000a7691906200263b565b816020015162000a87919062002620565b82101562000aa95760405162461bcd60e51b8152600401620004a390620022d6565b60ca5462000ac29083906001600160a01b0316620014ed565b60808101516001600160a01b0381161562000af557602082015160ca5462000af59183916001600160a01b0316620016eb565b60d183905560d4805473ffffffffffffffffffffffffffffffffffffffff1916339081179091556001600160a01b0382161462000ba05760cf546001600160a01b03166340c10f193362000b4c866103e862001831565b6040518363ffffffff1660e01b815260040162000b6b92919062001ff7565b600060405180830381600087803b15801562000b8657600080fd5b505af115801562000b9b573d6000803e3d6000fd5b505050505b600060cb5442846060015162000bb791906200267e565b109050801562000bdb5760cb5462000bd0904262002620565b6060840181905260d3555b82516040517f1159164c56f277e6fc99c11731bd380e0347deb969b75523398734c252706ea39062000c139033908890869062002055565b60405180910390a2801562000c6257825160608401516040517f6e912a3a9105bdd2af817ba5adc14e6c127c1035b5b648faa29ca0d58ab8ff4e9162000c5991620025c8565b60405180910390a25b50506001606555505050565b62000c7862000e78565b6001600160a01b031662000c8b620008ec565b6001600160a01b03161462000cb45760405162461bcd60e51b8152600401620004a39062002334565b60cc8190556040517f6ab2e127d7fdf53b8f304e59d3aab5bfe97979f52a85479691a6fab27a28a6b290620004ed908390620025c8565b60cc5481565b60cf546001600160a01b031681565b60cb5481565b6002606554141562000d2c5760405162461bcd60e51b8152600401620004a390620024c6565b600260655562000d3b6200079c565b1562000d5b5760405162461bcd60e51b8152600401620004a39062002242565b62000d65620012b5565b6200095962000ef3565b62000d7962000e78565b6001600160a01b031662000d8c620008ec565b6001600160a01b03161462000db55760405162461bcd60e51b8152600401620004a39062002334565b6001600160a01b03811662000dde5760405162461bcd60e51b8152600401620004a3906200211a565b62000de98162001256565b50565b60c9546001600160a01b031681565b62000e0562000e78565b6001600160a01b031662000e18620008ec565b6001600160a01b03161462000e415760405162461bcd60e51b8152600401620004a39062002334565b60ce8190556040517faab6389d8f1c16ba1deb6e9831f5c5442cf4fcf99bf5bfa867460be408a9111890620004ed908390620025c8565b3390565b62000e866200079c565b62000ea55760405162461bcd60e51b8152600401620004a390620020e3565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa62000eda62000e78565b60405162000ee9919062001fe3565b60405180910390a1565b60c960009054906101000a90046001600160a01b03166001600160a01b0316631249c58b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801562000f4457600080fd5b505af192505050801562000f77575060408051601f3d908101601f1916820190925262000f749181019062001f43565b60015b62000fb45762000f86620026e3565b8062000f93575062000fa4565b62000f9d620011f4565b5062000fae565b3d6000803e3d6000fd5b62000571565b42600062000fc28362001846565b62000fce908362002620565b6040805160c081018252858152600060208201819052818301869052606082018490526080820181905260a090910181905260d086905560d15560d284905560d382905560d480547fffffffffffffffffffffff0000000000000000000000000000000000000000001690555190915083907fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca90620010719085908590620025d1565b60405180910390a2505050565b600054610100900460ff168062001098575060005460ff16155b620010b75760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620010e3576000805460ff1961ff0019909116610100171660011790555b620010ed620018b7565b620010f762001930565b801562000de9576000805461ff001916905550565b600054610100900460ff168062001126575060005460ff16155b620011455760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001171576000805460ff1961ff0019909116610100171660011790555b620010f7620019b4565b600054610100900460ff168062001195575060005460ff16155b620011b45760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620011e0576000805460ff1961ff0019909116610100171660011790555b620011ea620018b7565b620010f762001a33565b620011fe6200079c565b156200121e5760405162461bcd60e51b8152600401620004a39062002242565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25862000eda62000e78565b609780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805160c08101825260d054815260d154602082015260d25491810182905260d354606082015260d4546001600160a01b0381166080830152600160a01b900460ff16151560a082015290620013205760405162461bcd60e51b8152600401620004a390620021d4565b8060a0015115620013455760405162461bcd60e51b8152600401620004a390620023c6565b80606001514210156200136c5760405162461bcd60e51b8152600401620004a3906200248f565b60d480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560c9546080820151825160208401516040517fdfe5ef480000000000000000000000000000000000000000000000000000000081526001600160a01b039094169363dfe5ef4893620013f3939092909160040162002010565b600060405180830381600087803b1580156200140e57600080fd5b505af115801562001423573d6000803e3d6000fd5b505060cf5460208401516001600160a01b0390911692506340c10f199150339062001451906103e862001831565b6040518363ffffffff1660e01b81526004016200147092919062001ff7565b600060405180830381600087803b1580156200148b57600080fd5b505af1158015620014a0573d6000803e3d6000fd5b50508251608084015160208501516040519294507fc9f72b276a388619c6d185d146697036241880c36654b1a3ffdad07c24038d999350620014e29262001ff7565b60405180910390a250565b6001600160a01b0381166200158f578134146200151e5760405162461bcd60e51b8152600401620004a39062002369565b60ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156200156f57600080fd5b505af115801562001584573d6000803e3d6000fd5b5050505050620016e7565b6040516370a0823160e01b815281906000906001600160a01b038316906370a0823190620015c290309060040162001fe3565b60206040518083038186803b158015620015db57600080fd5b505afa158015620015f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001616919062001f43565b90506200162f6001600160a01b03831633308762001aac565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906200166090309060040162001fe3565b60206040518083038186803b1580156200167957600080fd5b505afa1580156200168e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620016b4919062001f43565b905080620016c3838762001b3b565b14620016e35760405162461bcd60e51b8152600401620004a3906200256b565b5050505b5050565b6001600160a01b038116620018165760ca546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690632e1a7d4d9062001745908590600401620025c8565b600060405180830381600087803b1580156200176057600080fd5b505af115801562001775573d6000803e3d6000fd5b5050505062001785838362001b49565b620018105760ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015620017db57600080fd5b505af1158015620017f0573d6000803e3d6000fd5b505060ca546200181093506001600160a01b031691508590508462001bcb565b6200182c565b6200182c6001600160a01b038216848462001bcb565b505050565b60006200183f82846200265c565b9392505050565b600060328211156200185c575060ce54620018b2565b602e82111562001870575061a8c0620018b2565b6027821115620018845750617080620018b2565b601a821115620018985750613840620018b2565b8160011415620018ad57506203f480620018b2565b50611c205b919050565b600054610100900460ff1680620018d1575060005460ff16155b620018f05760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff16158015620010f7576000805460ff1961ff001990911661010017166001179055801562000de9576000805461ff001916905550565b600054610100900460ff16806200194a575060005460ff16155b620019695760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001995576000805460ff1961ff0019909116610100171660011790555b6033805460ff19169055801562000de9576000805461ff001916905550565b600054610100900460ff1680620019ce575060005460ff16155b620019ed5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001a19576000805460ff1961ff0019909116610100171660011790555b6001606555801562000de9576000805461ff001916905550565b600054610100900460ff168062001a4d575060005460ff16155b62001a6c5760405162461bcd60e51b8152600401620004a39062002279565b600054610100900460ff1615801562001a98576000805460ff1961ff0019909116610100171660011790555b620010f762001aa662000e78565b62001256565b62001b35846323b872dd60e01b85858560405160240162001ad09392919062002031565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262001bed565b50505050565b60006200183f828462002620565b6040805160008082526020820190925281906001600160a01b0385169061753090859060405162001b7b919062001fc5565b600060405180830381858888f193505050503d806000811462001bbb576040519150601f19603f3d011682016040523d82523d6000602084013e62001bc0565b606091505b509095945050505050565b6200182c8363a9059cbb60e01b848460405160240162001ad092919062001ff7565b600062001c44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662001c849092919063ffffffff16565b8051909150156200182c578080602001905181019062001c65919062001e38565b6200182c5760405162461bcd60e51b8152600401620004a39062002432565b606062001c95848460008562001c9d565b949350505050565b60608247101562001cc25760405162461bcd60e51b8152600401620004a39062002177565b62001ccd8562001d6b565b62001cec5760405162461bcd60e51b8152600401620004a390620023fb565b600080866001600160a01b0316858760405162001d0a919062001fc5565b60006040518083038185875af1925050503d806000811462001d49576040519150601f19603f3d011682016040523d82523d6000602084013e62001d4e565b606091505b509150915062001d6082828662001d71565b979650505050505050565b3b151590565b6060831562001d825750816200183f565b82511562001d935782518084602001fd5b8160405162461bcd60e51b8152600401620004a39190620020ae565b61266580620027ab83390190565b60008083601f84011262001dcf578182fd5b50813567ffffffffffffffff81111562001de7578182fd5b60208301915083602082850101111562001e0057600080fd5b9250929050565b803560ff81168114620018b257600080fd5b60006020828403121562001e2b578081fd5b81356200183f8162002794565b60006020828403121562001e4a578081fd5b815180151581146200183f578182fd5b6000806000806000806000806000806101008b8d03121562001e7a578586fd5b8a3562001e878162002794565b995060208b013562001e998162002794565b985060408b0135975060608b0135965062001eb760808c0162001e07565b955060a08b0135945060c08b013567ffffffffffffffff8082111562001edb578586fd5b62001ee98e838f0162001dbd565b909650945060e08d013591508082111562001f02578384fd5b5062001f118d828e0162001dbd565b915080935050809150509295989b9194979a5092959850565b60006020828403121562001f3c578081fd5b5035919050565b60006020828403121562001f55578081fd5b5051919050565b6000806040838503121562001f6f578182fd5b50508035926020909101359150565b60006020828403121562001f90578081fd5b6200183f8262001e07565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b6000825162001fd981846020870162002698565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0393909316835260208301919091521515604082015260600190565b901515815260200190565b6000604082526200209960408301868862001f9b565b828103602084015262001d6081858762001f9b565b6000602082528251806020840152620020cf81604085016020870162002698565b601f01601f19169190910160400192915050565b60208082526014908201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f41756374696f6e206861736e277420626567756e000000000000000000000000604082015260600190565b6020808252601f908201527f4d7573742073656e64206174206c656173742072657365727665507269636500604082015260600190565b60208082526010908201527f5061757361626c653a2070617573656400000000000000000000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201527f647920696e697469616c697a6564000000000000000000000000000000000000606082015260800190565b602080825260409082018190527f4d7573742073656e64206d6f7265207468616e206c6173742062696420627920908201527f6d696e426964496e6372656d656e7450657263656e7461676520616d6f756e74606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526032908201527f53656e74204554482056616c756520646f6573206e6f74206d6174636820737060408201527f656369666965642062696420616d6f756e740000000000000000000000000000606082015260800190565b6020808252818101527f41756374696f6e2068617320616c7265616479206265656e20736574746c6564604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f41756374696f6e206861736e277420636f6d706c657465640000000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600f908201527f41756374696f6e20657870697265640000000000000000000000000000000000604082015260600190565b60208082526016908201527f446f67206e6f7420757020666f722061756374696f6e00000000000000000000604082015260600190565b60208082526034908201527f546f6b656e207472616e736665722063616c6c20646964206e6f74207472616e60408201527f7366657220657870656374656420616d6f756e74000000000000000000000000606082015260800190565b90815260200190565b918252602082015260400190565b9586526020860194909452604085019290925260608401526001600160a01b03166080830152151560a082015260c00190565b60ff91909116815260200190565b60008219821115620026365762002636620026c7565b500190565b6000826200265757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620026795762002679620026c7565b500290565b600082821015620026935762002693620026c7565b500390565b60005b83811015620026b55781810151838201526020016200269b565b8381111562001b355750506000910152565b634e487b7160e01b600052601160045260246000fd5b60e01c90565b600060443d1015620026f557620007a3565b600481823e6308c379a06200270b8251620026dd565b146200271757620007a3565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715620027495750505050620007a3565b82840192508251915080821115620027655750505050620007a3565b503d830160208284010111156200277f57505050620007a3565b601f01601f1916810160200160405291505090565b6001600160a01b038116811462000de957600080fdfe6101406040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610120523480156200003757600080fd5b5060405162002665380380620026658339810160408190526200005a916200030b565b8180604051806040016040528060018152602001603160f81b8152508484816003908051906020019062000090929190620001ba565b508051620000a6906004906020840190620001ba565b505050620000c3620000bd6200012860201b60201c565b6200012c565b815160208084019190912082519183019190912060c082905260e08190524660a0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620001138184846200017e565b6080526101005250620003f195505050505050565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600083838346306040516020016200019b95949392919062000372565b6040516020818303038152906040528051906020012090509392505050565b828054620001c8906200039e565b90600052602060002090601f016020900481019282620001ec576000855562000237565b82601f106200020757805160ff191683800117855562000237565b8280016001018555821562000237579182015b82811115620002375782518255916020019190600101906200021a565b506200024592915062000249565b5090565b5b808211156200024557600081556001016200024a565b600082601f83011262000271578081fd5b81516001600160401b03808211156200028e576200028e620003db565b6040516020601f8401601f1916820181018381118382101715620002b657620002b6620003db565b6040528382528584018101871015620002cd578485fd5b8492505b83831015620002f05785830181015182840182015291820191620002d1565b838311156200030157848185840101525b5095945050505050565b600080604083850312156200031e578182fd5b82516001600160401b038082111562000335578384fd5b620003438683870162000260565b9350602085015191508082111562000359578283fd5b50620003688582860162000260565b9150509250929050565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b600281046001821680620003b357607f821691505b60208210811415620003d557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160e051610100516101205161222462000441600039600061093a01526000610d4f01526000610d9101526000610d7001526000610cfd01526000610d2601526122246000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c8063715018a6116100ee578063a457c2d711610097578063d505accf11610071578063d505accf14610361578063dd62ed3e14610374578063f1127ed814610387578063f2fde38b146103a7576101ae565b8063a457c2d714610328578063a9059cbb1461033b578063c3cda5201461034e576101ae565b80638e539e8c116100c85780638e539e8c146102fa57806395d89b411461030d5780639ab24eb014610315576101ae565b8063715018a6146102d75780637ecebe00146102df5780638da5cb5b146102f2576101ae565b8063395093511161015b578063587cde1e11610135578063587cde1e146102715780635c19a95c146102915780636fcfff45146102a457806370a08231146102c4576101ae565b806339509351146102365780633a46b1a81461024957806340c10f191461025c576101ae565b806323b872dd1161018c57806323b872dd14610206578063313ce567146102195780633644e5151461022e576101ae565b806306fdde03146101b3578063095ea7b3146101d157806318160ddd146101f1575b600080fd5b6101bb6103ba565b6040516101c89190611a3e565b60405180910390f35b6101e46101df366004611868565b61044d565b6040516101c89190611988565b6101f961046a565b6040516101c89190611993565b6101e46102143660046117c4565b610470565b610221610509565b6040516101c89190612146565b6101f961050e565b6101e4610244366004611868565b61051d565b6101f9610257366004611868565b610571565b61026f61026a366004611868565b6105bb565b005b61028461027f366004611778565b610608565b6040516101c89190611974565b61026f61029f366004611778565b610629565b6102b76102b2366004611778565b61063d565b6040516101c89190612135565b6101f96102d2366004611778565b610665565b61026f610680565b6101f96102ed366004611778565b6106cb565b6102846106ec565b6101f9610308366004611926565b6106fb565b6101bb610727565b6101f9610323366004611778565b610736565b6101e4610336366004611868565b6107cb565b6101e4610349366004611868565b610844565b61026f61035c366004611891565b610858565b61026f61036f3660046117ff565b610916565b6101f9610382366004611792565b6109f8565b61039a6103953660046118e8565b610a23565b6040516101c89190612101565b61026f6103b5366004611778565b610aa9565b6060600380546103c9906121a3565b80601f01602080910402602001604051908101604052809291908181526020018280546103f5906121a3565b80156104425780601f1061041757610100808354040283529160200191610442565b820191906000526020600020905b81548152906001019060200180831161042557829003601f168201915b505050505090505b90565b600061046161045a610b17565b8484610b1b565b50600192915050565b60025490565b600061047d848484610bcf565b6001600160a01b03841660009081526001602052604081208161049e610b17565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104ea5760405162461bcd60e51b81526004016104e190611e0a565b60405180910390fd5b6104fe856104f6610b17565b858403610b1b565b506001949350505050565b601290565b6000610518610cf9565b905090565b600061046161052a610b17565b848460016000610538610b17565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461056c9190612154565b610b1b565b60004382106105925760405162461bcd60e51b81526004016104e190611b25565b6001600160a01b03831660009081526008602052604090206105b49083610dbc565b9392505050565b6105c3610b17565b6001600160a01b03166105d46106ec565b6001600160a01b0316146105fa5760405162461bcd60e51b81526004016104e190611ec4565b6106048282610e95565b5050565b6001600160a01b03808216600090815260076020526040902054165b919050565b61063a610634610b17565b82610e9f565b50565b6001600160a01b03811660009081526008602052604081205461065f90610f2c565b92915050565b6001600160a01b031660009081526020819052604090205490565b610688610b17565b6001600160a01b03166106996106ec565b6001600160a01b0316146106bf5760405162461bcd60e51b81526004016104e190611ec4565b6106c96000610f56565b565b6001600160a01b038116600090815260066020526040812061065f90610fb5565b6005546001600160a01b031690565b600043821061071c5760405162461bcd60e51b81526004016104e190611b25565b61065f600983610dbc565b6060600480546103c9906121a3565b6001600160a01b03811660009081526008602052604081205480156107b8576001600160a01b038316600090815260086020526040902061077860018361218c565b8154811061079657634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b03166107bb565b60005b6001600160e01b03169392505050565b600080600160006107da610b17565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156108265760405162461bcd60e51b81526004016104e19061206d565b61083a610831610b17565b85858403610b1b565b5060019392505050565b6000610461610851610b17565b8484610bcf565b834211156108785760405162461bcd60e51b81526004016104e190611b5c565b60006108da6108d27fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8989896040516020016108b794939291906119d0565b60405160208183030381529060405280519060200120610fb9565b858585610fcc565b90506108e581610ff4565b86146109035760405162461bcd60e51b81526004016104e190611bca565b61090d8188610e9f565b50505050505050565b834211156109365760405162461bcd60e51b81526004016104e190611cbb565b60007f00000000000000000000000000000000000000000000000000000000000000008888886109658c610ff4565b8960405160200161097b9695949392919061199c565b604051602081830303815290604052805190602001209050600061099e82610fb9565b905060006109ae82878787610fcc565b9050896001600160a01b0316816001600160a01b0316146109e15760405162461bcd60e51b81526004016104e190611dd3565b6109ec8a8a8a610b1b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610a2b611739565b6001600160a01b0383166000908152600860205260409020805463ffffffff8416908110610a6957634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b610ab1610b17565b6001600160a01b0316610ac26106ec565b6001600160a01b031614610ae85760405162461bcd60e51b81526004016104e190611ec4565b6001600160a01b038116610b0e5760405162461bcd60e51b81526004016104e190611c01565b61063a81610f56565b3390565b6001600160a01b038316610b415760405162461bcd60e51b81526004016104e190612010565b6001600160a01b038216610b675760405162461bcd60e51b81526004016104e190611c5e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610bc2908590611993565b60405180910390a3505050565b6001600160a01b038316610bf55760405162461bcd60e51b81526004016104e190611f56565b6001600160a01b038216610c1b5760405162461bcd60e51b81526004016104e190611ac8565b610c26838383611026565b6001600160a01b03831660009081526020819052604090205481811015610c5f5760405162461bcd60e51b81526004016104e190611cf2565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610c96908490612154565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ce09190611993565b60405180910390a3610cf384848461102b565b50505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461415610d4a57507f000000000000000000000000000000000000000000000000000000000000000061044a565b610db57f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611036565b905061044a565b8154600090815b81811015610e2e576000610dd78284611070565b905084868281548110610dfa57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015463ffffffff161115610e1a57809250610e28565b610e25816001612154565b91505b50610dc3565b8115610e805784610e4060018461218c565b81548110610e5e57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b0316610e83565b60005b6001600160e01b031695945050505050565b610604828261108b565b6000610eaa83610608565b90506000610eb784610665565b6001600160a01b03858116600081815260076020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610cf38284836110da565b600063ffffffff821115610f525760405162461bcd60e51b81526004016104e190611fb3565b5090565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b5490565b600061065f610fc6610cf9565b83611205565b6000806000610fdd87878787611238565b91509150610fea81611318565b5095945050505050565b6001600160a01b038116600090815260066020526040812061101581610fb5565b915061102081611445565b50919050565b505050565b61102683838361144e565b600083838346306040516020016110519594939291906119f4565b6040516020818303038152906040528051906020012090509392505050565b600061107f600284841861216c565b6105b490848416612154565b6110958282611474565b61109d61153c565b6001600160e01b03166110ae61046a565b11156110cc5760405162461bcd60e51b81526004016104e190611e67565b610cf3600961154783611553565b816001600160a01b0316836001600160a01b0316141580156110fc5750600081115b15611026576001600160a01b03831615611181576001600160a01b038316600090815260086020526040812081906111379061170485611553565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611176929190612127565b60405180910390a250505b6001600160a01b03821615611026576001600160a01b038216600090815260086020526040812081906111b79061154785611553565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516111f6929190612127565b60405180910390a25050505050565b6000828260405160200161121a92919061193e565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561126f575060009050600361130f565b8460ff16601b1415801561128757508460ff16601c14155b15611298575060009050600461130f565b6000600187878787604051600081526020016040526040516112bd9493929190611a20565b6020604051602081039080840390855afa1580156112df573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113085760006001925092505061130f565b9150600090505b94509492505050565b600081600481111561133a57634e487b7160e01b600052602160045260246000fd5b14156113455761063a565b600181600481111561136757634e487b7160e01b600052602160045260246000fd5b14156113855760405162461bcd60e51b81526004016104e190611a91565b60028160048111156113a757634e487b7160e01b600052602160045260246000fd5b14156113c55760405162461bcd60e51b81526004016104e190611b93565b60038160048111156113e757634e487b7160e01b600052602160045260246000fd5b14156114055760405162461bcd60e51b81526004016104e190611d4f565b600481600481111561142757634e487b7160e01b600052602160045260246000fd5b141561063a5760405162461bcd60e51b81526004016104e190611d91565b80546001019055565b611459838383611026565b61102661146584610608565b61146e84610608565b836110da565b6001600160a01b03821661149a5760405162461bcd60e51b81526004016104e1906120ca565b6114a660008383611026565b80600260008282546114b89190612154565b90915550506001600160a01b038216600090815260208190526040812080548392906114e5908490612154565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611528908590611993565b60405180910390a36106046000838361102b565b6001600160e01b0390565b60006105b48284612154565b8254600090819080156115ac578561156c60018361218c565b8154811061158a57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015464010000000090046001600160e01b03166115af565b60005b6001600160e01b031692506115c883858763ffffffff16565b9150600081118015611614575043866115e260018461218c565b8154811061160057634e487b7160e01b600052603260045260246000fd5b60009182526020909120015463ffffffff16145b156116825761162282611710565b8661162e60018461218c565b8154811061164c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b031602179055506116fb565b85604051806040016040528061169743610f2c565b63ffffffff1681526020016116ab85611710565b6001600160e01b039081169091528254600181018455600093845260209384902083519101805493909401519091166401000000000263ffffffff91821663ffffffff1990931692909217161790555b50935093915050565b60006105b4828461218c565b60006001600160e01b03821115610f525760405162461bcd60e51b81526004016104e190611ef9565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461062457600080fd5b803560ff8116811461062457600080fd5b600060208284031215611789578081fd5b6105b482611750565b600080604083850312156117a4578081fd5b6117ad83611750565b91506117bb60208401611750565b90509250929050565b6000806000606084860312156117d8578081fd5b6117e184611750565b92506117ef60208501611750565b9150604084013590509250925092565b600080600080600080600060e0888a031215611819578283fd5b61182288611750565b965061183060208901611750565b9550604088013594506060880135935061184c60808901611767565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561187a578182fd5b61188383611750565b946020939093013593505050565b60008060008060008060c087890312156118a9578182fd5b6118b287611750565b955060208701359450604087013593506118ce60608801611767565b92506080870135915060a087013590509295509295509295565b600080604083850312156118fa578182fd5b61190383611750565b9150602083013563ffffffff8116811461191b578182fd5b809150509250929050565b600060208284031215611937578081fd5b5035919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611a6a57858101830151858201604001528201611a4e565b81811115611a7b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604082015260600190565b6020808252601d908201527f4552433230566f7465733a207369676e61747572652065787069726564000000604082015260600190565b6020808252601f908201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604082015260600190565b60208082526019908201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160408201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60408201527f766572666c6f77696e6720766f74657300000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526027908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260408201527f3234206269747300000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360408201527f3220626974730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b815163ffffffff1681526020918201516001600160e01b03169181019190915260400190565b918252602082015260400190565b63ffffffff91909116815260200190565b60ff91909116815260200190565b60008219821115612167576121676121d8565b500190565b60008261218757634e487b7160e01b81526012600452602481fd5b500490565b60008282101561219e5761219e6121d8565b500390565b6002810460018216806121b757607f821691505b6020821081141561102057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fdfea2646970667358221220fb3ef5eb5b06936b43ea49dc523223f4dc5f5fca7ba14d125bde4b7ffb46070e64736f6c63430008000033a2646970667358221220192bb2cc4e118eaf774eb537b15bfe3258b608b0c7e0a3612442bfb1312a58ec64736f6c63430008000033

Block Transaction 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
[ 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.