Token MaxxStake

 

Overview

TokenID:
6946

Transfers:
-

 
Loading
[ Download CSV Export  ] 
Loading
Loading

OVERVIEW

MAXX Finance is a Staking token on the Polygon blockchain, offering up to 80% APY. Maxx Finance are backed by ownership of validator nodes and have a community DAO.

Market

Volume (24H):$3.80
Market Capitalization:$86,754.00
Circulating Supply:31,383,720,119.00 SMAXX
Market Data Source: Coinmarketcap


Update? Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume
1
Quickswap
0X6D9C0B104E5AF90A6D11A13EB77288E533333301-0X0D500B1D8E8EF31E21C99D1DB9A6444D3ADF1270$0.00
0.0000000 Btc
$3.71
1,374,124.894 0X6D9C0B104E5AF90A6D11A13EB77288E533333301
100.0000%
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MaxxStake

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : MaxxStake.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import {ILiquidityAmplifier} from "./interfaces/ILiquidityAmplifier.sol";
import {IMaxxFinance} from "./interfaces/IMaxxFinance.sol";
import {IMAXXBoost} from "./interfaces/IMAXXBoost.sol";
import {IFreeClaim} from "./interfaces/IFreeClaim.sol";
import {IStake} from "./interfaces/IStake.sol";

/// @title Maxx Finance staking contract
/// @author Alta Web3 Labs - SonOfMosiah
contract MaxxStake is
    IStake,
    ERC721,
    ERC721Enumerable,
    Ownable,
    Pausable,
    ReentrancyGuard
{
    using ERC165Checker for address;
    using Counters for Counters.Counter;
    using Strings for uint256;

    /// mapping of accepted NFTs
    mapping(address => bool) public isAcceptedNft;
    /// @dev 10 = 10% boost
    mapping(address => uint256) public nftBonus;
    /// mapping of stake end times
    mapping(uint256 => uint256) public endTimes;

    // Calculation variables
    uint256 public constant LATE_DAYS = 14;
    uint256 public constant MIN_STAKE_DAYS = 7;
    uint256 public constant MAX_STAKE_DAYS = 3333;
    uint256 public constant BASE_INFLATION = 18_185; // 18.185%
    uint256 public constant BASE_INFLATION_FACTOR = 100_000;
    uint256 public constant DAYS_IN_YEAR = 365;
    uint256 public constant PERCENT_FACTOR = 1e10;
    uint256 public constant MAGIC_NUMBER = 1111;
    uint256 public constant BPB_FACTOR = 2e24;
    uint256 private constant _SHARE_FACTOR = 1e9;
    uint256 private constant _MIN_STAKE_AMOUNT = 25_000 * (10**18);

    uint256 public launchDate;

    /// @notice Maxx Finance Vault address
    address public maxxVault;
    /// @notice address of the freeClaim contract
    address public freeClaim;
    /// @notice address of the liquidityAmplifier contract
    address public liquidityAmplifier;
    /// @notice Maxx Finance token
    IMaxxFinance public maxx;

    /// @notice amount of shares all time
    uint256 public totalShares;
    /// @notice Stake Counter
    Counters.Counter public idCounter;
    /// @notice alltime stakes
    Counters.Counter public totalStakesAlltime;
    /// @notice all active stakes
    Counters.Counter public totalStakesActive;
    /// @notice number of withdrawn stakes
    Counters.Counter public totalStakesWithdrawn;

    /// @notice Array of all stakes
    StakeData[] public stakes;

    // Base URI
    string private _baseUri;
    uint256 private _lastMigrationValue;

    bool public initialized;

    constructor() ERC721("MaxxStake", "SMAXX") {
        _transferOwnership(tx.origin);
    }

    /// @dev Sets the `maxxVault` and `maxx` addresses and the `launchDate`
    function init(
        address _maxxVault,
        address _maxx,
        uint256 _launchDate
    ) external onlyOwner {
        if (initialized) {
            revert AlreadyInitialized();
        }
        initialized = true;
        maxxVault = _maxxVault;
        maxx = IMaxxFinance(_maxx);
        launchDate = _launchDate; // launch date needs to be at least 60 days after liquidity amplifier start date
        // start stake ID at 1
        idCounter.increment();
        stakes.push(StakeData("", address(0), 0, 0, 0, 0, false)); // index 0 is null stake;
    }

    /// @notice Function to stake MAXX
    /// @dev User must approve MAXX before staking
    /// @param _numDays The number of days to stake (min 7, max 3333)
    /// @param _amount The amount of MAXX to stake
    function stake(uint256 _numDays, uint256 _amount) external {
        if (_amount < _MIN_STAKE_AMOUNT) {
            revert InvalidAmount();
        }
        uint256 shares = _calcShares(_numDays, _amount);

        _stake(msg.sender, _numDays, _amount, shares);
    }

    /// @notice Function to stake MAXX
    /// @dev User must approve MAXX before staking
    /// @param _numDays The number of days to stake (min 7, max 3333)
    /// @param _amount The amount of MAXX to stake
    /// @param _tokenId // The token Id of the nft to use
    /// @param _maxxNFT // The address of the nft collection to use
    function stake(
        uint256 _numDays,
        uint256 _amount,
        uint256 _tokenId,
        address _maxxNFT
    ) external {
        if (_amount < _MIN_STAKE_AMOUNT) {
            revert InvalidAmount();
        }
        if (!isAcceptedNft[_maxxNFT]) {
            revert NftNotAccepted();
        }

        if (msg.sender != IMAXXBoost(_maxxNFT).ownerOf(_tokenId)) {
            revert IncorrectOwner();
        } else if (IMAXXBoost(_maxxNFT).getUsedState(_tokenId)) {
            revert UsedNFT();
        }
        IMAXXBoost(_maxxNFT).setUsed(_tokenId);

        uint256 shares = _calcShares(_numDays, _amount);
        shares += ((shares * nftBonus[_maxxNFT]) / 100); // add nft bonus to the shares

        _stake(msg.sender, _numDays, _amount, shares);
    }

    /// @notice Function to unstake MAXX
    /// @param _stakeId The id of the stake to unstake
    function unstake(uint256 _stakeId) external {
        StakeData memory tStake = stakes[_stakeId];
        if (!_isApprovedOrOwner(msg.sender, _stakeId)) {
            revert NotAuthorized();
        }
        if (tStake.withdrawn) {
            revert StakeAlreadyWithdrawn();
        }
        stakes[_stakeId].withdrawn = true;
        totalStakesWithdrawn.increment();
        totalStakesActive.decrement();

        _burn(_stakeId);

        uint256 withdrawableAmount;
        uint256 penaltyAmount;
        uint256 daysServed = ((block.timestamp - tStake.startDate) / 1 days);
        uint256 interestToDate = _calcInterestToDate(
            tStake.shares,
            daysServed,
            tStake.duration
        );

        uint256 fullAmount = tStake.amount + interestToDate;
        if (daysServed < (tStake.duration / 1 days)) {
            // unstaking early
            // fee assessed
            withdrawableAmount =
                ((tStake.amount + interestToDate) * daysServed) /
                (tStake.duration / 1 days);
        } else if (daysServed > (tStake.duration / 1 days) + LATE_DAYS) {
            // unstaking late
            // fee assessed
            uint256 daysLate = daysServed -
                (tStake.duration / 1 days) -
                LATE_DAYS;
            uint256 penaltyPercentage = (PERCENT_FACTOR * daysLate) /
                DAYS_IN_YEAR;
            if (penaltyPercentage > PERCENT_FACTOR) {
                withdrawableAmount = 0;
            } else {
                withdrawableAmount =
                    ((tStake.amount + interestToDate) *
                        (PERCENT_FACTOR - penaltyPercentage)) /
                    PERCENT_FACTOR;
            }
        } else {
            // unstaking on time
            withdrawableAmount = tStake.amount + interestToDate;
        }
        penaltyAmount = fullAmount - withdrawableAmount;
        uint256 maxxBalance = maxx.balanceOf(address(this));

        if (fullAmount > maxxBalance) {
            maxx.mint(address(this), fullAmount - maxxBalance); // mint additional tokens to this contract
        }

        if (withdrawableAmount > 0) {
            if (!maxx.transfer(msg.sender, withdrawableAmount)) {
                // transfer the withdrawable amount to the user
                revert TransferFailed();
            }
        }
        if (penaltyAmount > 0) {
            if (!maxx.transfer(maxxVault, penaltyAmount / 2)) {
                // transfer half the penalty amount to the maxx vault
                revert TransferFailed();
            }
            maxx.burn(penaltyAmount / 2); // burn the other half of the penalty amount
        }

        emit Unstake(_stakeId, msg.sender, withdrawableAmount);
    }

    /// @notice Function to transfer stake ownership
    /// @param _to The new owner of the stake
    /// @param _stakeId The id of the stake
    function transfer(address _to, uint256 _stakeId) external {
        address stakeOwner = ownerOf(_stakeId);
        if (msg.sender != stakeOwner) {
            revert NotAuthorized();
        }
        _transfer(msg.sender, _to, _stakeId);
    }

    /// @notice This function changes the name of a stake
    /// @param _stakeId The id of the stake
    /// @param _stakeName The new name of the stake
    function changeStakeName(uint256 _stakeId, string memory _stakeName)
        external
    {
        address stakeOwner = ownerOf(_stakeId);
        if (
            msg.sender != stakeOwner &&
            !isApprovedForAll(stakeOwner, msg.sender)
        ) {
            revert NotAuthorized();
        }

        stakes[_stakeId].name = _stakeName;
        emit StakeNameChange(_stakeId, _stakeName);
    }

    /// @notice Function to stake MAXX from liquidity amplifier contract
    /// @param _numDays The number of days to stake for
    /// @param _amount The amount of MAXX to stake
    function amplifierStake(
        address _owner,
        uint256 _numDays,
        uint256 _amount
    ) external returns (uint256 stakeId, uint256 shares) {
        if (msg.sender != liquidityAmplifier) {
            revert NotAuthorized();
        }

        shares = _calcShares(_numDays, _amount);
        if (_numDays >= DAYS_IN_YEAR) {
            shares = (shares * 11) / 10;
        }

        stakeId = _stake(_owner, _numDays, _amount, shares);
        return (stakeId, shares);
    }

    /// @notice Function to stake MAXX from FreeClaim contract
    /// @param _owner The owner of the stake
    /// @param _numDays The number of days to stake for
    /// @param _amount The amount of MAXX to stake
    function freeClaimStake(
        address _owner,
        uint256 _numDays,
        uint256 _amount
    ) external returns (uint256 stakeId, uint256 shares) {
        if (msg.sender != freeClaim) {
            revert NotAuthorized();
        }

        shares = _calcShares(_numDays, _amount);

        stakeId = _stake(_owner, _numDays, _amount, shares);

        return (stakeId, shares);
    }

    /// @notice Stake unstaked free claims in batches
    /// @param amount The amount of free claims to stake
    function migrateUnstakedFreeClaims(uint256 amount) external onlyOwner {
        uint256[] memory claimIds = IFreeClaim(freeClaim)
            .getUnstakedClaimsSlice(
                _lastMigrationValue,
                _lastMigrationValue + amount
            );

        for (uint256 i = 0; i < amount; i++) {
            IFreeClaim(freeClaim).stakeClaim(
                _lastMigrationValue + i,
                claimIds[i]
            );
        }
        _lastMigrationValue += amount;
    }

    /// @notice Burn stakes that are over a year late
    /// @param stakeIds The ids of the stakes to burn
    function burnDeadStakes(uint256[] calldata stakeIds) external onlyOwner {
        uint256 penaltyAmount;
        for (uint256 i = 0; i < stakeIds.length; i++) {
            StakeData memory tStake = stakes[stakeIds[i]];
            uint256 daysServed = (block.timestamp - tStake.startDate) / 1 days;
            uint256 interestToDate = _calcInterestToDate(
                tStake.shares,
                daysServed,
                tStake.duration
            );
            uint256 fullAmount = tStake.amount + interestToDate;
            uint256 daysLate = daysServed - (tStake.duration / 1 days);
            if (daysLate > DAYS_IN_YEAR && !tStake.withdrawn) {
                stakes[stakeIds[i]].withdrawn = true;
                totalStakesWithdrawn.increment();
                totalStakesActive.decrement();

                _burn(stakeIds[i]);
                penaltyAmount += fullAmount;
                emit Unstake(stakeIds[i], tStake.owner, 0);
            }
        }
        uint256 maxxBalance = maxx.balanceOf(address(this));
        if (penaltyAmount > maxxBalance) {
            maxx.mint(address(this), penaltyAmount - maxxBalance);
        }
        if (penaltyAmount > 0) {
            if (!maxx.transfer(maxxVault, penaltyAmount / 2)) {
                // transfer half the penalty amount to the maxx vault
                revert TransferFailed();
            }
            maxx.burn(penaltyAmount / 2); // burn the other half of the penalty amount
        }
    }

    /// @notice Funciton to set liquidityAmplifier contract address
    /// @param _liquidityAmplifier The address of the liquidityAmplifier contract
    function setLiquidityAmplifier(address _liquidityAmplifier)
        external
        onlyOwner
    {
        liquidityAmplifier = _liquidityAmplifier;
        emit LiquidityAmplifierSet(_liquidityAmplifier);
    }

    /// @notice Function to set freeClaim contract address
    /// @param _freeClaim The address of the freeClaim contract
    function setFreeClaim(address _freeClaim) external onlyOwner {
        freeClaim = _freeClaim;
        emit FreeClaimSet(_freeClaim);
    }

    /// @notice Add an accepted NFT
    /// @param _nft The address of the NFT contract
    function addAcceptedNft(address _nft) external onlyOwner {
        isAcceptedNft[_nft] = true;
        emit AcceptedNftAdded(_nft);
    }

    /// @notice Remove an accepted NFT
    /// @param _nft The address of the NFT to remove
    function removeAcceptedNft(address _nft) external onlyOwner {
        isAcceptedNft[_nft] = false;
        emit AcceptedNftRemoved(_nft);
    }

    /// @notice Set the staking bonus for `_nft` to `_bonus`
    /// @param _nft The NFT contract address
    /// @param _bonus The bonus percentage (e.g. 20 = 20%)
    function setNftBonus(address _nft, uint256 _bonus) external onlyOwner {
        nftBonus[_nft] = _bonus;
        emit NftBonusSet(_nft, _bonus);
    }

    /// @notice Set the baseURI for the token collection
    /// @param baseURI_ The baseURI for the token collection
    function setBaseURI(string memory baseURI_) external onlyOwner {
        _baseUri = baseURI_;
        emit BaseURISet(baseURI_);
    }

    /// @notice Function to change the start date
    /// @dev Cannot change the start date after the day has passed
    /// @param _launchDate New start date
    function changeLaunchDate(uint256 _launchDate) external onlyOwner {
        if (block.timestamp >= launchDate || block.timestamp >= _launchDate) {
            revert LaunchDatePassed();
        }
        launchDate = _launchDate;
        emit LaunchDateUpdated(_launchDate);
    }

    /// @notice Get the stakes array
    /// @return stakes The stakes array
    function getAllStakes() external view returns (StakeData[] memory) {
        return stakes;
    }

    /// @notice Get the `count` stakes starting from `index`
    /// @param index The index to start from
    /// @param count The number of stakes to return
    /// @return result An array of StakeData
    function getStakes(uint256 index, uint256 count)
        external
        view
        returns (StakeData[] memory result)
    {
        uint256 inserts;
        for (uint256 i = index; i < index + count; i++) {
            result[inserts] = (stakes[i]);
            ++inserts;
        }
        return result;
    }

    /// @notice This function will return day `day` since the launch date
    /// @return day The number of days passed since `launchDate`
    function getDaysSinceLaunch() public view returns (uint256 day) {
        day = (block.timestamp - launchDate) / 1 days;
        return day;
    }

    /// @notice Function that returns whether `interfaceId` is supported by this contract
    /// @param interfaceId The interface ID to check
    /// @return Whether `interfaceId` is supported
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable, IERC165)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /// @notice Returns the token URI
    /// @param stakeId The id of the stake
    /// @return The token URI
    function tokenURI(uint256 stakeId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        _requireMinted(stakeId);

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length > 0
                ? string(abi.encodePacked(baseURI, stakeId.toString()))
                : "";
    }

    /// @return shareFactor The current share factor
    function getShareFactor() public view returns (uint256 shareFactor) {
        uint256 day = getDaysSinceLaunch();
        if (day >= MAX_STAKE_DAYS) {
            return 0;
        }
        shareFactor =
            _SHARE_FACTOR -
            ((getDaysSinceLaunch() * _SHARE_FACTOR) / MAX_STAKE_DAYS);

        return shareFactor;
    }

    function _stake(
        address _owner,
        uint256 _numDays,
        uint256 _amount,
        uint256 _shares
    ) internal returns (uint256 stakeId) {
        // Check that stake duration is valid
        if (_numDays < MIN_STAKE_DAYS) {
            revert StakeTooShort();
        } else if (_numDays > MAX_STAKE_DAYS) {
            revert StakeTooLong();
        }

        if (
            maxx.hasRole(maxx.MINTER_ROLE(), msg.sender) &&
            maxx.balanceOf(_owner) == _amount &&
            msg.sender != freeClaim &&
            msg.sender != liquidityAmplifier
        ) {
            maxx.mint(msg.sender, 1);
        }

        // transfer tokens to this contract -- removed from circulating supply
        if (!maxx.transferFrom(msg.sender, address(this), _amount)) {
            revert TransferFailed();
        }

        totalShares += _shares;
        totalStakesAlltime.increment();
        totalStakesActive.increment();

        uint256 duration = uint256(_numDays) * 1 days;
        stakeId = idCounter.current();
        assert(stakeId == stakes.length);
        stakes.push(
            StakeData(
                "",
                _owner,
                _amount,
                _shares,
                duration,
                block.timestamp,
                false
            )
        );

        endTimes[stakeId] = block.timestamp + duration;

        _mint(_owner, stakeId);

        emit Stake(idCounter.current(), _owner, _numDays, _amount);
        idCounter.increment();
        return stakeId;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        stakes[tokenId].owner = to;
        super._beforeTokenTransfer(from, to, tokenId);
    }

    /// @dev Calculate shares using following formula: (amount / (2-SF)) + (((amount / (2-SF)) * (Duration-1)) / MN)
    /// @return shares The number of shares for the full-term stake
    function _calcShares(uint256 duration, uint256 _amount)
        internal
        view
        returns (uint256 shares)
    {
        uint256 shareFactor = getShareFactor();

        uint256 basicShares = (_amount * _SHARE_FACTOR) /
            ((2 * _SHARE_FACTOR) - shareFactor);
        uint256 bpbBonus = _amount / (BPB_FACTOR / 10);
        if (bpbBonus > 100) {
            bpbBonus = 100;
        }
        uint256 bpbShares = (basicShares * bpbBonus) / 1_000; // bigger pays better
        uint256 lpbShares = ((basicShares + bpbShares) * (duration - 1)) /
            MAGIC_NUMBER; // longer pays better
        shares = basicShares + bpbShares + lpbShares;
        return shares;
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual override returns (string memory) {
        return _baseUri;
    }

    /// @dev Calculate interest for a given number of shares and duration
    /// @return interestToDate The interest accrued to date
    function _calcInterestToDate(
        uint256 _stakeTotalShares,
        uint256 _daysServed,
        uint256 _duration
    ) internal pure returns (uint256 interestToDate) {
        uint256 stakeDuration = _duration / 1 days;
        uint256 fullDurationInterest = (_stakeTotalShares *
            BASE_INFLATION *
            stakeDuration) /
            DAYS_IN_YEAR /
            BASE_INFLATION_FACTOR;

        uint256 currentDurationInterest = (_daysServed *
            _stakeTotalShares *
            stakeDuration *
            BASE_INFLATION) /
            stakeDuration /
            BASE_INFLATION_FACTOR /
            DAYS_IN_YEAR;

        if (currentDurationInterest > fullDurationInterest) {
            interestToDate = fullDurationInterest;
        } else {
            interestToDate = currentDurationInterest;
        }
        return interestToDate;
    }
}

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

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

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

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

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

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

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

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

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

File 3 of 24 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        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());
    }
}

File 4 of 24 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` 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 tokenId
    ) 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.
     * - `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 tokenId
    ) internal virtual {}
}

File 5 of 24 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

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

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 6 of 24 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 7 of 24 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.2) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

File 8 of 24 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // 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;
    }
}

File 9 of 24 : ILiquidityAmplifier.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title The interface for the Maxx Finance liquidity amplifier contract
interface ILiquidityAmplifier {
    /// Invalid referrer address `referrer`
    /// @param referrer The address of the referrer
    error InvalidReferrer(address referrer);
    /// Liquidity Amplifier has not yet started
    error AmplifierNotStarted();
    ///Liquidity Amplifier is already complete
    error AmplifierComplete();
    /// Liquidity Amplifier is not complete
    error AmplifierNotComplete();
    /// Claim period has ended
    error ClaimExpired();
    /// Invalid input day
    /// @param day The amplifier day 1-60
    error InvalidDay(uint256 day);
    /// User has already claimed for this day
    /// @param day The amplifier day 1-60
    error AlreadyClaimed(uint256 day);
    /// User has already claimed referral rewards
    error AlreadyClaimedReferrals();
    /// The Maxx allocation has already been initialized
    error AlreadyInitialized();
    /// The Maxx Finance Staking contract hasn't been initialized
    error StakingNotInitialized();
    /// Current or proposed launch date has already passed
    error LaunchDatePassed();
    /// Unable to withdraw Matic
    error WithdrawFailed();
    /// MaxxGenesis address not set
    error MaxxGenesisNotSet();
    /// MaxxGenesis NFT not minted
    error MaxxGenesisMintFailed();
    /// Maxx transfer failed
    error MaxxTransferFailed();
    error ZeroAddress();
    error PastLaunchDate();

    /// @notice Emitted when matic is 'deposited'
    /// @param user The user depositing matic into the liquidity amplifier
    /// @param amount The amount of matic depositied
    /// @param referrer The address of the referrer (0x0 if none)
    event Deposit(
        address indexed user,
        uint256 indexed amount,
        address indexed referrer
    );

    /// @notice Emitted when MAXX is claimed from a deposit
    /// @param user The user claiming MAXX
    /// @param day The day of the amplifier claimed
    /// @param amount The amount of MAXX claimed
    event Claim(
        address indexed user,
        uint256 indexed day,
        uint256 indexed amount
    );

    /// @notice Emitted when MAXX is claimed from a referral
    /// @param user The user claiming MAXX
    /// @param amount The amount of MAXX claimed
    event ClaimReferral(address indexed user, uint256 amount);

    /// @notice Emitted when a deposit is made with a referral
    event Referral(
        address indexed user,
        address indexed referrer,
        uint256 amount
    );
    /// @notice Emitted when the Maxx Stake contract address is set
    event StakeAddressSet(address indexed stake);
    /// @notice Emitted when the Maxx Genesis NFT contract address is set
    event MaxxGenesisSet(address indexed maxxGenesis);
    /// @notice Emitted when the launch date is updated
    event LaunchDateUpdated(uint256 newLaunchDate);
    /// @notice Emitted when a Maxx Genesis NFT is minted
    event MaxxGenesisMinted(address indexed user, string code);

    /// @notice Liquidity amplifier start date
    function launchDate() external view returns (uint256);

    /// @notice This function will return all liquidity amplifier participants
    /// @return participants Array of addresses that have participated in the Liquidity Amplifier
    function getParticipants() external view returns (address[] memory);

    /// @notice This function will return all liquidity amplifier participants for `day` day
    /// @param day The day for which to return the participants
    /// @return participants Array of addresses that have participated in the Liquidity Amplifier
    function getParticipantsByDay(uint256 day)
        external
        view
        returns (address[] memory);

    /// @notice This function will return a slice of the participants array
    /// @dev This function is used to paginate the participants array
    /// @param start The starting index of the slice
    /// @param length The amount of participants to return
    /// @return participantsSlice Array slice of addresses that have participated in the Liquidity Amplifier
    /// @return newStart The new starting index for the next slice
    function getParticipantsSlice(uint256 start, uint256 length)
        external
        view
        returns (address[] memory participantsSlice, uint256 newStart);
}

File 10 of 24 : IMaxxFinance.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/IAccessControl.sol";

/// @title The interface for the Maxx Finance token contract
interface IMaxxFinance is IERC20, IAccessControl {
    /// @notice Increases the token balance of `to` by `amount`
    /// @param to The address to mint to
    /// @param amount The amount to mint
    /// Emits a {Transfer} event.
    function mint(address to, uint256 amount) external;

    /// @dev Decreases the token balance of `msg.sender` by `amount`
    /// @param amount The amount to burn
    /// Emits a {Transfer} event with `to` set to the zero address.
    function burn(uint256 amount) external;

    /// @dev Decreases the token balance of `from` by `amount`
    /// @param from The address to burn from
    /// @param amount The amount to burn
    /// Emits a {Transfer} event with `to` set to the zero address.
    function burnFrom(address from, uint256 amount) external;

    // solhint-disable-next-line func-name-mixedcase
    function MINTER_ROLE() external view returns (bytes32);
}

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

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/// @title The interface for the Maxx Finance MAXXBoost NFT contract
interface IMAXXBoost is IERC721 {
    function setUsed(uint256 _tokenId) external;

    function getUsedState(uint256 _tokenId) external view returns (bool);

    function mint(string memory _code, address _user) external returns (bool);
}

File 12 of 24 : IFreeClaim.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title The interface for the Maxx Finance Free Claim
interface IFreeClaim {
    /// User has already claimed their allotment of MAXX
    error AlreadyClaimed();

    /// Merkle proof is invalid
    error InvalidProof();

    /// Maxx cannot be the zero address
    error InvalidMaxxAddress();

    /// Merkle root cannot be zero
    error InvalidMerkleRoot();

    /// No more MAXX left to claim
    error FreeClaimEnded();

    /// Free Claim has not started yet
    error FreeClaimNotStarted();

    /// Free Claim has not ended yet
    error FreeClaimNotEnded();

    /// MAXX withdrawal failed
    error MaxxWithdrawFailed();

    /// User cannot refer themselves
    error SelfReferral();

    /// The Maxx Finance Staking contract hasn't been initialized
    error StakingNotInitialized();

    /// Only the Staking contract can call this function
    error OnlyMaxxStake();

    /// MAXX tokens not transferred to this contract
    error MaxxAllocationFailed();

    /// Launch date must be in the future
    error LaunchDateUpdateFailed();

    /// @notice Emitted when free claim is claimed
    /// @param user The user claiming free claim
    /// @param amount The amount of free claim claimed
    event UserClaim(address indexed user, uint256 amount);

    /// @notice Emitted when a referral is made
    /// @param referrer The address of the referrer
    /// @param user The user claiming free claim
    /// @param amount The amount of free claim claimed
    event Referral(
        address indexed referrer,
        address indexed user,
        uint256 amount
    );

    /// @notice Emitted when the maxx token address is set
    /// @param maxx The address of the maxx token
    event MaxxSet(address indexed maxx);

    /// @notice Emitted when the merkle root is set
    /// @param merkleRoot The merkle root
    event MerkleRootSet(bytes32 indexed merkleRoot);

    /// @notice Emitted when the launch date is updated
    /// @param launchDate The new launch date
    event LaunchDateUpdated(uint256 indexed launchDate);

    function stakeClaim(uint256 unstakedClaimId, uint256 claimId) external;

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

    function getUnstakedClaimsSlice(uint256 start, uint256 end)
        external
        view
        returns (uint256[] memory);
}

File 13 of 24 : IStake.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

/// @title The interface for the Maxx Finance staking contract
interface IStake is IERC721 {
    /// Not authorized to control the stake
    error NotAuthorized();

    /// Cannot stake less than {MIN_STAKE_DAYS} days
    error StakeTooShort();

    /// Cannot stake more than {MAX_STAKE_DAYS} days
    error StakeTooLong();

    /// Cannot stake less than 50_000 MAXX
    error InvalidAmount();

    /// Address does not own enough MAXX tokens
    error InsufficientMaxx();

    /// Stake has not yet completed
    error StakeNotComplete();

    /// Stake has already been claimed
    error StakeAlreadyWithdrawn();

    /// User does not own the NFT
    error IncorrectOwner();

    /// NFT boost has already been used
    error UsedNFT();

    /// NFT collection is not accepted
    error NftNotAccepted();

    /// Token transfer returned false (failed)
    error TransferFailed();

    /// Tokens already staked for maximum duration
    error AlreadyMaxDuration();

    /// Unstaked Free Claims have already been migrated
    error FreeClaimsAlreadyMigrated();

    /// Current or proposed launch date has already passed
    error LaunchDatePassed();

    /// Input cannot be the zero address;
    error ZeroAddress();

    /// The contract is already initialized
    error AlreadyInitialized();

    /// `_nft` does not support the IERC721 interface
    /// @param _nft the address of the NFT contract
    error InterfaceNotSupported(address _nft);

    /// @notice Emitted when MAXX is staked
    /// @param stakeId The ID of the stake
    /// @param user The user staking MAXX
    /// @param numDays The number of days staked
    /// @param amount The amount of MAXX staked
    event Stake(
        uint256 indexed stakeId,
        address indexed user,
        uint256 numDays,
        uint256 amount
    );

    /// @notice Emitted when MAXX is unstaked
    /// @param user The user unstaking MAXX
    /// @param amount The amount of MAXX unstaked
    event Unstake(
        uint256 indexed stakeId,
        address indexed user,
        uint256 amount
    );

    /// @notice Emitted when the name of a stake is changed
    /// @param stakeId The id of the stake
    /// @param name The new name of the stake
    event StakeNameChange(uint256 stakeId, string name);

    /// @notice Emitted when the launch date is updated
    event LaunchDateUpdated(uint256 newLaunchDate);
    /// @notice Emitted when the liquidityAmplifier address is updated
    event LiquidityAmplifierSet(address liquidityAmplifier);
    /// @notice Emitted when the freeClaim address is updated
    event FreeClaimSet(address freeClaim);
    event NftBonusSet(address nft, uint256 bonus);
    event BaseURISet(string baseUri);
    event AcceptedNftAdded(address nft);
    event AcceptedNftRemoved(address nft);

    struct StakeData {
        string name;
        address owner;
        uint256 amount;
        uint256 shares;
        uint256 duration;
        uint256 startDate;
        bool withdrawn;
    }

    enum MaxxNFT {
        MaxxGenesis,
        MaxxBoost
    }

    function stakes(uint256)
        external
        view
        returns (
            string memory,
            address,
            uint256,
            uint256,
            uint256,
            uint256,
            bool
        );

    function launchDate() external view returns (uint256);

    function freeClaimStake(
        address owner,
        uint256 numDays,
        uint256 amount
    ) external returns (uint256 stakeId, uint256 shares);

    function amplifierStake(
        address owner,
        uint256 numDays,
        uint256 amount
    ) external returns (uint256 stakeId, uint256 shares);
}

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

pragma solidity ^0.8.0;

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

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

File 15 of 24 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

File 16 of 24 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 17 of 24 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 18 of 24 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 20 of 24 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 22 of 24 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 23 of 24 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 24 of 24 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AlreadyMaxDuration","type":"error"},{"inputs":[],"name":"FreeClaimsAlreadyMigrated","type":"error"},{"inputs":[],"name":"IncorrectOwner","type":"error"},{"inputs":[],"name":"InsufficientMaxx","type":"error"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"InterfaceNotSupported","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"LaunchDatePassed","type":"error"},{"inputs":[],"name":"NftNotAccepted","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"StakeAlreadyWithdrawn","type":"error"},{"inputs":[],"name":"StakeNotComplete","type":"error"},{"inputs":[],"name":"StakeTooLong","type":"error"},{"inputs":[],"name":"StakeTooShort","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UsedNFT","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"}],"name":"AcceptedNftAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"}],"name":"AcceptedNftRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseUri","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"freeClaim","type":"address"}],"name":"FreeClaimSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newLaunchDate","type":"uint256"}],"name":"LaunchDateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"liquidityAmplifier","type":"address"}],"name":"LiquidityAmplifierSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"NftBonusSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"numDays","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"StakeNameChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstake","type":"event"},{"inputs":[],"name":"BASE_INFLATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BASE_INFLATION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BPB_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAYS_IN_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LATE_DAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAGIC_NUMBER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_STAKE_DAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_STAKE_DAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"addAcceptedNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_numDays","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"amplifierStake","outputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"stakeIds","type":"uint256[]"}],"name":"burnDeadStakes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_launchDate","type":"uint256"}],"name":"changeLaunchDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"},{"internalType":"string","name":"_stakeName","type":"string"}],"name":"changeStakeName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"endTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeClaim","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_numDays","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"freeClaimStake","outputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllStakes","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"bool","name":"withdrawn","type":"bool"}],"internalType":"struct IStake.StakeData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDaysSinceLaunch","outputs":[{"internalType":"uint256","name":"day","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getShareFactor","outputs":[{"internalType":"uint256","name":"shareFactor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"getStakes","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"bool","name":"withdrawn","type":"bool"}],"internalType":"struct IStake.StakeData[]","name":"result","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"idCounter","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_maxxVault","type":"address"},{"internalType":"address","name":"_maxx","type":"address"},{"internalType":"uint256","name":"_launchDate","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAcceptedNft","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityAmplifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxx","outputs":[{"internalType":"contract IMaxxFinance","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxxVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"migrateUnstakedFreeClaims","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nftBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"removeAcceptedNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_freeClaim","type":"address"}],"name":"setFreeClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_liquidityAmplifier","type":"address"}],"name":"setLiquidityAmplifier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_bonus","type":"uint256"}],"name":"setNftBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numDays","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_maxxNFT","type":"address"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numDays","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakes","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"bool","name":"withdrawn","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stakeId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakesActive","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakesAlltime","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakesWithdrawn","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051806040016040528060098152602001684d6178785374616b6560b81b815250604051806040016040528060058152602001640a69a82b0b60db1b8152508160009081620000639190620001ad565b506001620000728282620001ad565b5050506200008f62000089620000b260201b60201c565b620000b6565b600a805460ff60a01b191690556001600b55620000ac32620000b6565b62000279565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200013357607f821691505b6020821081036200015457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001a857600081815260208120601f850160051c81016020861015620001835750805b601f850160051c820191505b81811015620001a4578281556001016200018f565b5050505b505050565b81516001600160401b03811115620001c957620001c962000108565b620001e181620001da84546200011e565b846200015a565b602080601f831160018114620002195760008415620002005750858301515b600019600386901b1c1916600185901b178555620001a4565b600085815260208120601f198616915b828110156200024a5788860151825594840194600190910190840162000229565b5085821015620002695787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61430380620002896000396000f3fe608060405234801561001057600080fd5b50600436106103db5760003560e01c806362f7e51d1161020a578063a295417511610125578063d5a44f86116100b8578063e985e9c511610087578063e985e9c514610833578063eb08ab2814610846578063f2fde38b14610850578063f8eeed6214610863578063fd1c24ed1461086c57600080fd5b8063d5a44f86146107d5578063d6d20fa2146107fb578063dee18dbf1461080e578063e88d3b3e1461082057600080fd5b8063b88d4fde116100f4578063b88d4fde14610793578063b9cc9dd1146107a6578063c741eae9146107b9578063c87b56dd146107c257600080fd5b8063a295417514610747578063a9059cbb1461075a578063b22342051461076d578063b6263efb1461078057600080fd5b8063871793de1161019d578063933abacd1161016c578063933abacd1461071a57806395d89b41146107245780639812dce21461072c578063a22cb4651461073457600080fd5b8063871793de146106c35780638c3c51d8146106d65780638da5cb5b146106e9578063932b37e0146106fa57600080fd5b806370a08231116101d957806370a0823114610682578063715018a6146106955780637b0472f01461069d57806386863ec6146106b057600080fd5b806362f7e51d1461063a578063631537d11461065d5780636352211e146106675780636e8cc7f11461067a57600080fd5b80632e17de78116102fa5780633c64dab31161028d5780634f6ccce71161025c5780634f6ccce7146105f857806354d37db21461060b57806355f804b3146106155780635c975abb1461062857600080fd5b80633c64dab31461059f5780633d3875e9146105b257806342842e0e146105d25780634506a393146105e557600080fd5b80633992fba5116102c95780633992fba51461056c5780633a98ef39146105755780633c3d5adb1461057e5780633c611e051461058a57600080fd5b80632e17de78146105205780632f1efc9b146105335780632f745c591461054657806330815e561461055957600080fd5b80631658516f116103725780632051043e116103415780632051043e146104d45780632363da20146104dc57806323b872dd1461050457806326986d3f1461051757600080fd5b80631658516f1461049c57806318160ddd146104af57806319597bbc146104b75780631e3219fc146104c157600080fd5b8063095ea7b3116103ae578063095ea7b31461045f5780630e7d97d21461047457806311ad34e01461047c578063158ef93e1461048f57600080fd5b806301ffc9a7146103e0578063023789321461040857806306fdde031461041f578063081812fc14610434575b600080fd5b6103f36103ee3660046138fa565b61087f565b60405190151581526020015b60405180910390f35b61041161016d81565b6040519081526020016103ff565b610427610890565b6040516103ff9190613967565b61044761044236600461397a565b610922565b6040516001600160a01b0390911681526020016103ff565b61047261046d3660046139a8565b610949565b005b610411610a63565b61047261048a3660046139d4565b610ab9565b601c546103f39060ff1681565b6104726104aa366004613a49565b610fa1565b600854610411565b6017546104119081565b6104726104cf36600461397a565b610ffe565b61041161106a565b6104ef6104ea366004613a66565b61108d565b604080519283526020830191909152016103ff565b610472610512366004613a9b565b6110df565b610411610d0581565b61047261052e36600461397a565b611110565b6104726105413660046139a8565b61173a565b6104116105543660046139a8565b61179a565b610472610567366004613adc565b611830565b61041161045781565b61041160145481565b6104116402540be40081565b610592611a6e565b6040516103ff9190613b1d565b601354610447906001600160a01b031681565b6104116105c0366004613a49565b600d6020526000908152604090205481565b6104726105e0366004613a9b565b611baf565b6104726105f3366004613a49565b611bca565b61041161060636600461397a565b611c20565b610411620186a081565b610472610623366004613c90565b611cb3565b600a54600160a01b900460ff166103f3565b6103f3610648366004613a49565b600c6020526000908152604090205460ff1681565b6018546104119081565b61044761067536600461397a565b611cf7565b610411600e81565b610411610690366004613a49565b611d57565b610472611ddd565b6104726106ab366004613cc5565b611df1565b6104726106be366004613a9b565b611e36565b6104726106d1366004613a49565b611fa0565b6105926106e4366004613cc5565b611ff9565b600a546001600160a01b0316610447565b61041161070836600461397a565b600e6020526000908152604090205481565b6016546104119081565b61042761215e565b610411600781565b610472610742366004613cf5565b61216d565b61047261075536600461397a565b61217c565b6104726107683660046139a8565b6122e0565b601254610447906001600160a01b031681565b6104ef61078e366004613a66565b612321565b6104726107a1366004613d2e565b612389565b6104726107b4366004613a49565b6123bb565b61041161470981565b6104276107d036600461397a565b612417565b6107e86107e336600461397a565b61247e565b6040516103ff9796959493929190613dae565b610472610809366004613dfd565b612568565b6104116a01a784379d99db4200000081565b601154610447906001600160a01b031681565b6103f3610841366004613e44565b612623565b6015546104119081565b61047261085e366004613a49565b612651565b610411600f5481565b601054610447906001600160a01b031681565b600061088a826126ca565b92915050565b60606000805461089f90613e72565b80601f01602080910402602001604051908101604052809291908181526020018280546108cb90613e72565b80156109185780601f106108ed57610100808354040283529160200191610918565b820191906000526020600020905b8154815290600101906020018083116108fb57829003601f168201915b5050505050905090565b600061092d826126ef565b506000908152600460205260409020546001600160a01b031690565b600061095482611cf7565b9050806001600160a01b0316836001600160a01b0316036109c65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806109e257506109e28133612623565b610a545760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016109bd565b610a5e838361274e565b505050565b600080610a6e61106a565b9050610d058110610a8157600091505090565b610d05633b9aca00610a9161106a565b610a9b9190613ec2565b610aa59190613eef565b610ab390633b9aca00613f03565b91505090565b610ac16127bc565b6000805b82811015610d855760006019858584818110610ae357610ae3613f16565b9050602002013581548110610afa57610afa613f16565b90600052602060002090600702016040518060e0016040529081600082018054610b2390613e72565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4f90613e72565b8015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050918352505060018201546001600160a01b03166020820152600282015460408201526003820154606082015260048201546080820152600582015460a08083019190915260069092015460ff16151560c0909101528101519091506000906201518090610c0c9042613f03565b610c169190613eef565b90506000610c2d8360600151838560800151612816565b90506000818460400151610c419190613f2c565b90506000620151808560800151610c589190613eef565b610c629085613f03565b905061016d81118015610c7757508460c00151155b15610d6d57600160198a8a89818110610c9257610c92613f16565b9050602002013581548110610ca957610ca9613f16565b60009182526020909120600790910201600601805460ff1916911515919091179055601880546001019055610cde60176128c8565b610cff898988818110610cf357610cf3613f16565b9050602002013561291f565b610d098288613f2c565b965084602001516001600160a01b0316898988818110610d2b57610d2b613f16565b905060200201357f15e1b1e6a67db05b5e4e898cc13f87b8485df622bfebf03d1508efa026a2e15c6000604051610d6491815260200190565b60405180910390a35b50505050508080610d7d90613f3f565b915050610ac5565b506013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df39190613f58565b905080821115610e78576013546001600160a01b03166340c10f1930610e198486613f03565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610e5f57600080fd5b505af1158015610e73573d6000803e3d6000fd5b505050505b8115610f9b576013546010546001600160a01b039182169163a9059cbb9116610ea2600286613eef565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190613f71565b610f2e576040516312171d8360e31b815260040160405180910390fd5b6013546001600160a01b03166342966c68610f4a600285613eef565b6040518263ffffffff1660e01b8152600401610f6891815260200190565b600060405180830381600087803b158015610f8257600080fd5b505af1158015610f96573d6000803e3d6000fd5b505050505b50505050565b610fa96127bc565b601180546001600160a01b0319166001600160a01b0383169081179091556040519081527f7cd85068c6889ed3a9315f01daa39e442f4b20d74adfd2c676f19dcc4e25b449906020015b60405180910390a150565b6110066127bc565b600f54421015806110175750804210155b156110355760405163fcdcc8fd60e01b815260040160405180910390fd5b600f8190556040518181527f6e23cc4d033baf0ba37878efdabaf083a78deb3277b4ddc2294e20c1bb50227890602001610ff3565b600062015180600f544261107e9190613f03565b6110889190613eef565b905090565b60115460009081906001600160a01b031633146110bd5760405163ea8e4eb560e01b815260040160405180910390fd5b6110c784846129c6565b90506110d585858584612aa6565b9150935093915050565b6110e93382612f44565b6111055760405162461bcd60e51b81526004016109bd90613f8e565b610a5e838383612fa2565b60006019828154811061112557611125613f16565b90600052602060002090600702016040518060e001604052908160008201805461114e90613e72565b80601f016020809104026020016040519081016040528092919081815260200182805461117a90613e72565b80156111c75780601f1061119c576101008083540402835291602001916111c7565b820191906000526020600020905b8154815290600101906020018083116111aa57829003601f168201915b505050918352505060018201546001600160a01b03166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260069091015460ff16151560c09091015290506112273383612f44565b6112445760405163ea8e4eb560e01b815260040160405180910390fd5b8060c00151156112675760405163190507cd60e21b815260040160405180910390fd5b60016019838154811061127c5761127c613f16565b60009182526020909120600790910201600601805460ff19169115159190911790556018805460010190556112b160176128c8565b6112ba8261291f565b6000806000620151808460a00151426112d39190613f03565b6112dd9190613eef565b905060006112f48560600151838760800151612816565b905060008186604001516113089190613f2c565b905062015180866080015161131d9190613eef565b831015611363576201518086608001516113379190613eef565b838388604001516113489190613f2c565b6113529190613ec2565b61135c9190613eef565b945061143d565b600e6201518087608001516113789190613eef565b6113829190613f2c565b83111561142a576000600e6201518088608001516113a09190613eef565b6113aa9086613f03565b6113b49190613f03565b9050600061016d6113ca836402540be400613ec2565b6113d49190613eef565b90506402540be4008111156113ec5760009650611423565b6402540be4006113fc8282613f03565b858a6040015161140c9190613f2c565b6114169190613ec2565b6114209190613eef565b96505b505061143d565b81866040015161143a9190613f2c565b94505b6114478582613f03565b6013546040516370a0823160e01b81523060048201529195506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b99190613f58565b90508082111561153e576013546001600160a01b03166340c10f19306114df8486613f03565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561152557600080fd5b505af1158015611539573d6000803e3d6000fd5b505050505b85156115d65760135460405163a9059cbb60e01b8152336004820152602481018890526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015611595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b99190613f71565b6115d6576040516312171d8360e31b815260040160405180910390fd5b84156116f9576013546010546001600160a01b039182169163a9059cbb9116611600600289613eef565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561164b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166f9190613f71565b61168c576040516312171d8360e31b815260040160405180910390fd5b6013546001600160a01b03166342966c686116a8600288613eef565b6040518263ffffffff1660e01b81526004016116c691815260200190565b600060405180830381600087803b1580156116e057600080fd5b505af11580156116f4573d6000803e3d6000fd5b505050505b604051868152339089907f15e1b1e6a67db05b5e4e898cc13f87b8485df622bfebf03d1508efa026a2e15c9060200160405180910390a35050505050505050565b6117426127bc565b6001600160a01b0382166000818152600d6020908152604091829020849055815192835282018390527f7cc50acc58c8287583807ce34cbd5efe1822e7e281c43ac0b370327668b6b738910160405180910390a15050565b60006117a583611d57565b82106118075760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016109bd565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b69054b40b1f852bda0000083101561185b5760405163162908e360e11b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff166118945760405163eb9e83e160e01b815260040160405180910390fd5b6040516331a9108f60e11b8152600481018390526001600160a01b03821690636352211e90602401602060405180830381865afa1580156118d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fd9190613fdc565b6001600160a01b0316336001600160a01b03161461192e57604051633a6bbed360e01b815260040160405180910390fd5b60405163754cf80960e01b8152600481018390526001600160a01b0382169063754cf80990602401602060405180830381865afa158015611973573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119979190613f71565b156119b557604051630e635e7560e21b815260040160405180910390fd5b604051632150c05b60e21b8152600481018390526001600160a01b03821690638543016c90602401600060405180830381600087803b1580156119f757600080fd5b505af1158015611a0b573d6000803e3d6000fd5b505050506000611a1b85856129c6565b6001600160a01b0383166000908152600d6020526040902054909150606490611a449083613ec2565b611a4e9190613eef565b611a589082613f2c565b9050611a6633868684612aa6565b505050505050565b60606019805480602002602001604051908101604052809291908181526020016000905b82821015611ba657838290600052602060002090600702016040518060e0016040529081600082018054611ac590613e72565b80601f0160208091040260200160405190810160405280929190818152602001828054611af190613e72565b8015611b3e5780601f10611b1357610100808354040283529160200191611b3e565b820191906000526020600020905b815481529060010190602001808311611b2157829003601f168201915b50505091835250506001828101546001600160a01b0316602080840191909152600284015460408401526003840154606084015260048401546080840152600584015460a084015260069093015460ff16151560c09092019190915291835292019101611a92565b50505050905090565b610a5e83838360405180602001604052806000815250612389565b611bd26127bc565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fe1859e45f5fba8ccae8fb923300022b3ae6de178b6adb19ab1dce825ea81813090602001610ff3565b6000611c2b60085490565b8210611c8e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016109bd565b60088281548110611ca157611ca1613f16565b90600052602060002001549050919050565b611cbb6127bc565b601a611cc7828261403f565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f681604051610ff39190613967565b6000818152600260205260408120546001600160a01b03168061088a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109bd565b60006001600160a01b038216611dc15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109bd565b506001600160a01b031660009081526003602052604090205490565b611de56127bc565b611def6000613149565b565b69054b40b1f852bda00000811015611e1c5760405163162908e360e11b815260040160405180910390fd5b6000611e2883836129c6565b9050610f9b33848484612aa6565b611e3e6127bc565b601c5460ff1615611e615760405162dc149f60e41b815260040160405180910390fd5b601c805460ff19166001179055601080546001600160a01b038086166001600160a01b0319928316179092556013805492851692909116919091179055600f819055611eb1601580546001019055565b6040805161010081018252600060e08201818152825260208201819052918101829052606081018290526080810182905260a0810182905260c08101829052601980546001810182559252805190916007027f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501908190611f32908261403f565b5060208201516001820180546001600160a01b0319166001600160a01b0390921691909117905560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c0909101516006909101805460ff1916911515919091179055505050565b611fa86127bc565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916905590519182527f173d2f452d823e0dbf0d161f36a0935355316a4e721d58f98c040bbe47cf92369101610ff3565b60606000835b6120098486613f2c565b811015612156576019818154811061202357612023613f16565b90600052602060002090600702016040518060e001604052908160008201805461204c90613e72565b80601f016020809104026020016040519081016040528092919081815260200182805461207890613e72565b80156120c55780601f1061209a576101008083540402835291602001916120c5565b820191906000526020600020905b8154815290600101906020018083116120a857829003601f168201915b505050918352505060018201546001600160a01b03166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260069091015460ff16151560c090910152835184908490811061212d5761212d613f16565b60200260200101819052508161214290613f3f565b91508061214e81613f3f565b915050611fff565b505092915050565b60606001805461089f90613e72565b61217833838361319b565b5050565b6121846127bc565b601154601b546000916001600160a01b0316906399ca8beb906121a78582613f2c565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa1580156121e8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261221091908101906140ff565b905060005b828110156122c457601154601b546001600160a01b039091169062c35ba69061223f908490613f2c565b84848151811061225157612251613f16565b60200260200101516040518363ffffffff1660e01b815260040161227f929190918252602082015260400190565b600060405180830381600087803b15801561229957600080fd5b505af11580156122ad573d6000803e3d6000fd5b5050505080806122bc90613f3f565b915050612215565b5081601b60008282546122d79190613f2c565b90915550505050565b60006122eb82611cf7565b9050336001600160a01b038216146123165760405163ea8e4eb560e01b815260040160405180910390fd5b610a5e338484612fa2565b60125460009081906001600160a01b031633146123515760405163ea8e4eb560e01b815260040160405180910390fd5b61235b84846129c6565b905061016d841061237d57600a61237382600b613ec2565b6110c79190613eef565b6110d585858584612aa6565b6123933383612f44565b6123af5760405162461bcd60e51b81526004016109bd90613f8e565b610f9b84848484613269565b6123c36127bc565b6001600160a01b0381166000818152600c6020908152604091829020805460ff1916600117905590519182527ff4ba6a323cf8bea8975fe249b5064dd45949b11c8e5498d0f1e46372c14a93d29101610ff3565b6060612422826126ef565b600061242c61329c565b9050600081511161244c5760405180602001604052806000815250612477565b80612456846132ab565b604051602001612467929190614199565b6040516020818303038152906040525b9392505050565b6019818154811061248e57600080fd5b90600052602060002090600702016000915090508060000180546124b190613e72565b80601f01602080910402602001604051908101604052809291908181526020018280546124dd90613e72565b801561252a5780601f106124ff5761010080835404028352916020019161252a565b820191906000526020600020905b81548152906001019060200180831161250d57829003601f168201915b5050506001840154600285015460038601546004870154600588015460069098015496976001600160a01b0390941696929550909350919060ff1687565b600061257383611cf7565b9050336001600160a01b0382161480159061259557506125938133612623565b155b156125b35760405163ea8e4eb560e01b815260040160405180910390fd5b81601984815481106125c7576125c7613f16565b906000526020600020906007020160000190816125e4919061403f565b507f36bfb15ecf538ab5f9f0e01df1406b613c66fe6676ba6abe36f01085cd780f8e83836040516126169291906141c8565b60405180910390a1505050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6126596127bc565b6001600160a01b0381166126be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109bd565b6126c781613149565b50565b60006001600160e01b0319821663780e9d6360e01b148061088a575061088a826133ac565b6000818152600260205260409020546001600160a01b03166126c75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109bd565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061278382611cf7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600a546001600160a01b03163314611def5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109bd565b6000806128266201518084613eef565b90506000620186a061016d8361283e6147098a613ec2565b6128489190613ec2565b6128529190613eef565b61285c9190613eef565b9050600061016d620186a084614709816128768c8c613ec2565b6128809190613ec2565b61288a9190613ec2565b6128949190613eef565b61289e9190613eef565b6128a89190613eef565b9050818111156128ba578193506128be565b8093505b5050509392505050565b8054806129175760405162461bcd60e51b815260206004820152601b60248201527f436f756e7465723a2064656372656d656e74206f766572666c6f77000000000060448201526064016109bd565b600019019055565b600061292a82611cf7565b9050612938816000846133fc565b61294360008361274e565b6001600160a01b038116600090815260036020526040812080546001929061296c908490613f03565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000806129d1610a63565b90506000816129e5633b9aca006002613ec2565b6129ef9190613f03565b6129fd633b9aca0086613ec2565b612a079190613eef565b90506000612a21600a6a01a784379d99db42000000613eef565b612a2b9086613eef565b90506064811115612a3a575060645b60006103e8612a498385613ec2565b612a539190613eef565b90506000610457612a6560018a613f03565b612a6f8487613f2c565b612a799190613ec2565b612a839190613eef565b905080612a908386613f2c565b612a9a9190613f2c565b98975050505050505050565b60006007841015612aca57604051630ac39bb360e31b815260040160405180910390fd5b610d05841115612aed5760405163773839e560e11b815260040160405180910390fd5b6013546040805163d539139360e01b815290516001600160a01b03909216916391d1485491839163d5391393916004808201926020929091908290030181865afa158015612b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b639190613f58565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015612ba5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc99190613f71565b8015612c4057506013546040516370a0823160e01b81526001600160a01b038781166004830152859216906370a0823190602401602060405180830381865afa158015612c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3e9190613f58565b145b8015612c5757506011546001600160a01b03163314155b8015612c6e57506012546001600160a01b03163314155b15612cd8576013546040516340c10f1960e01b8152336004820152600160248201526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015612cbf57600080fd5b505af1158015612cd3573d6000803e3d6000fd5b505050505b6013546040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015612d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d539190613f71565b612d70576040516312171d8360e31b815260040160405180910390fd5b8160146000828254612d829190613f2c565b9091555050601680546001019055612d9e601780546001019055565b6000612dad8562015180613ec2565b9050612db860155490565b6019549092508214612dcc57612dcc6141e1565b6040805161010081018252600060e0820181815282526001600160a01b038916602083015291810186905260608101859052608081018390524260a082015260c08101829052601980546001810182559252805190916007027f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501908190612e54908261403f565b5060208201516001820180546001600160a01b0319166001600160a01b0390921691909117905560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c0909101516006909101805460ff1916911515919091179055612ec78142613f2c565b6000838152600e6020526040902055612ee08683613450565b856001600160a01b0316612ef360155490565b60408051888152602081018890527f507ac39eb33610191cd8fd54286e91c5cc464c262861643be3978f5a9f18ab02910160405180910390a3612f3a601580546001019055565b505b949350505050565b600080612f5083611cf7565b9050806001600160a01b0316846001600160a01b03161480612f775750612f778185612623565b80612f3c5750836001600160a01b0316612f9084610922565b6001600160a01b031614949350505050565b826001600160a01b0316612fb582611cf7565b6001600160a01b0316146130195760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016109bd565b6001600160a01b03821661307b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109bd565b6130868383836133fc565b61309160008261274e565b6001600160a01b03831660009081526003602052604081208054600192906130ba908490613f03565b90915550506001600160a01b03821660009081526003602052604081208054600192906130e8908490613f2c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036131fc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109bd565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613274848484612fa2565b6132808484848461359e565b610f9b5760405162461bcd60e51b81526004016109bd906141f7565b6060601a805461089f90613e72565b6060816000036132d25750506040805180820190915260018152600360fc1b602082015290565b8160005b81156132fc57806132e681613f3f565b91506132f59050600a83613eef565b91506132d6565b60008167ffffffffffffffff81111561331757613317613bd1565b6040519080825280601f01601f191660200182016040528015613341576020820181803683370190505b5090505b8415612f3c57613356600183613f03565b9150613363600a86614249565b61336e906030613f2c565b60f81b81838151811061338357613383613f16565b60200101906001600160f81b031916908160001a9053506133a5600a86613eef565b9450613345565b60006001600160e01b031982166380ac58cd60e01b14806133dd57506001600160e01b03198216635b5e139f60e01b145b8061088a57506301ffc9a760e01b6001600160e01b031983161461088a565b816019828154811061341057613410613f16565b906000526020600020906007020160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550610a5e83838361369c565b6001600160a01b0382166134a65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109bd565b6000818152600260205260409020546001600160a01b03161561350b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109bd565b613517600083836133fc565b6001600160a01b0382166000908152600360205260408120805460019290613540908490613f2c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561369457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906135e290339089908890889060040161425d565b6020604051808303816000875af192505050801561361d575060408051601f3d908101601f1916820190925261361a9181019061429a565b60015b61367a573d80801561364b576040519150601f19603f3d011682016040523d82523d6000602084013e613650565b606091505b5080516000036136725760405162461bcd60e51b81526004016109bd906141f7565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612f3c565b506001612f3c565b6001600160a01b0383166136f7576136f281600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61371a565b816001600160a01b0316836001600160a01b03161461371a5761371a8382613754565b6001600160a01b03821661373157610a5e816137f1565b826001600160a01b0316826001600160a01b031614610a5e57610a5e82826138a0565b6000600161376184611d57565b61376b9190613f03565b6000838152600760205260409020549091508082146137be576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061380390600190613f03565b6000838152600960205260408120546008805493945090928490811061382b5761382b613f16565b90600052602060002001549050806008838154811061384c5761384c613f16565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613884576138846142b7565b6001900381819060005260206000200160009055905550505050565b60006138ab83611d57565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160e01b0319811681146126c757600080fd5b60006020828403121561390c57600080fd5b8135612477816138e4565b60005b8381101561393257818101518382015260200161391a565b50506000910152565b60008151808452613953816020860160208601613917565b601f01601f19169290920160200192915050565b602081526000612477602083018461393b565b60006020828403121561398c57600080fd5b5035919050565b6001600160a01b03811681146126c757600080fd5b600080604083850312156139bb57600080fd5b82356139c681613993565b946020939093013593505050565b600080602083850312156139e757600080fd5b823567ffffffffffffffff808211156139ff57600080fd5b818501915085601f830112613a1357600080fd5b813581811115613a2257600080fd5b8660208260051b8501011115613a3757600080fd5b60209290920196919550909350505050565b600060208284031215613a5b57600080fd5b813561247781613993565b600080600060608486031215613a7b57600080fd5b8335613a8681613993565b95602085013595506040909401359392505050565b600080600060608486031215613ab057600080fd5b8335613abb81613993565b92506020840135613acb81613993565b929592945050506040919091013590565b60008060008060808587031215613af257600080fd5b8435935060208501359250604085013591506060850135613b1281613993565b939692955090935050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015613bc357603f19898403018552815160e08151818652613b6a8287018261393b565b838b01516001600160a01b0316878c0152898401518a880152606080850151908801526080808501519088015260a0848101519088015260c0938401511515939096019290925250509386019390860190600101613b44565b509098975050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c1057613c10613bd1565b604052919050565b600067ffffffffffffffff831115613c3257613c32613bd1565b613c45601f8401601f1916602001613be7565b9050828152838383011115613c5957600080fd5b828260208301376000602084830101529392505050565b600082601f830112613c8157600080fd5b61247783833560208501613c18565b600060208284031215613ca257600080fd5b813567ffffffffffffffff811115613cb957600080fd5b612f3c84828501613c70565b60008060408385031215613cd857600080fd5b50508035926020909101359150565b80151581146126c757600080fd5b60008060408385031215613d0857600080fd5b8235613d1381613993565b91506020830135613d2381613ce7565b809150509250929050565b60008060008060808587031215613d4457600080fd5b8435613d4f81613993565b93506020850135613d5f81613993565b925060408501359150606085013567ffffffffffffffff811115613d8257600080fd5b8501601f81018713613d9357600080fd5b613da287823560208401613c18565b91505092959194509250565b60e081526000613dc160e083018a61393b565b6001600160a01b039890981660208301525060408101959095526060850193909352608084019190915260a0830152151560c090910152919050565b60008060408385031215613e1057600080fd5b82359150602083013567ffffffffffffffff811115613e2e57600080fd5b613e3a85828601613c70565b9150509250929050565b60008060408385031215613e5757600080fd5b8235613e6281613993565b91506020830135613d2381613993565b600181811c90821680613e8657607f821691505b602082108103613ea657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761088a5761088a613eac565b634e487b7160e01b600052601260045260246000fd5b600082613efe57613efe613ed9565b500490565b8181038181111561088a5761088a613eac565b634e487b7160e01b600052603260045260246000fd5b8082018082111561088a5761088a613eac565b600060018201613f5157613f51613eac565b5060010190565b600060208284031215613f6a57600080fd5b5051919050565b600060208284031215613f8357600080fd5b815161247781613ce7565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b600060208284031215613fee57600080fd5b815161247781613993565b601f821115610a5e57600081815260208120601f850160051c810160208610156140205750805b601f850160051c820191505b81811015611a665782815560010161402c565b815167ffffffffffffffff81111561405957614059613bd1565b61406d816140678454613e72565b84613ff9565b602080601f8311600181146140a2576000841561408a5750858301515b600019600386901b1c1916600185901b178555611a66565b600085815260208120601f198616915b828110156140d1578886015182559484019460019091019084016140b2565b50858210156140ef5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602080838503121561411257600080fd5b825167ffffffffffffffff8082111561412a57600080fd5b818501915085601f83011261413e57600080fd5b81518181111561415057614150613bd1565b8060051b9150614161848301613be7565b818152918301840191848101908884111561417b57600080fd5b938501935b83851015612a9a57845182529385019390850190614180565b600083516141ab818460208801613917565b8351908301906141bf818360208801613917565b01949350505050565b828152604060208201526000612f3c604083018461393b565b634e487b7160e01b600052600160045260246000fd5b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008261425857614258613ed9565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906142909083018461393b565b9695505050505050565b6000602082840312156142ac57600080fd5b8151612477816138e4565b634e487b7160e01b600052603160045260246000fdfea26469706673582212204df2dfe459b93a37fa92216d167b24bde4465372d1c02368d36d98ee07a4537f64736f6c63430008110033

Loading