Contract 0xb73c3c17b52c3002273896d94f154abb027562c4

Contract Overview

Balance:
0 AVAX

AVAX Value:
$0.00

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x57e77fe902d3d286659ab51cccb90ae3f4843cabb627daa0badbb301b596cd80Set Approval For...255242292023-01-28 13:15:561 day 13 hrs ago0xf94dfff330fdc8ac582e7e72b4ced5e90d1bced4 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00115785 25
0x7d44a436d0799bf22afd42616de637c2b5b8f6939c8566afbdf77f5546b4d071Set Approval For...255241532023-01-28 13:13:221 day 13 hrs ago0x8671d9fd5e1dce35867da59a1426fedb77995a8e IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00115785 25
0xc6b97f9087a5919fbf6d0278b5aba040c8a1fceee2ebc3f20661ed99df77b373Set Approval For...254598212023-01-27 0:49:533 days 1 hr ago0xe1f6e0d69b30386b12f9b7d024f99c299eb0d587 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00069759374 26.41
0xd230e52b4f1e03ce8f874e92b1646b5b92bad8c3cbd7e8f1b28fa1667b896679Set Approval For...254597922023-01-27 0:48:503 days 1 hr ago0xe1f6e0d69b30386b12f9b7d024f99c299eb0d587 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00124492032 26.88
0x324f98807ba602e60b92b57626344197127497620b9add29670e2bf4684c28d8Mint Upgrade254444552023-01-26 16:08:243 days 10 hrs ago0x397fcacc9b35d464ed4ec2330d6b5172b61a5822 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.004349275 25
0x40d49a33a0d8d5dfb79c20b9ab7664973b73ab893f8710af289b4d5c728d7764Set Approval For...253526422023-01-24 12:10:155 days 14 hrs ago0xca7eb80d8a532d87440545aefd72fbd7207224c1 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00126785775 27.425
0xfd33738e5b6417cb969313cec496593090d571d05b1a7c6087ab468a21d71285Mint Upgrade253162502023-01-23 15:29:516 days 10 hrs ago0x9633c6edcf77b260c78015fd996f80200f5ada69 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.008097203702 26.373022815
0x99674b9c3f340c7e0a1cdc612b99a5424f7f97a7c094dae7f5a479dba1a5408cMint Upgrade252459322023-01-21 23:36:278 days 2 hrs ago0xd47248d5cc7bd078d111b9bae350587621a5aab6 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00509251037 29.272179676
0xc36f78081e9e3da12f921990ec8e4ae5387f2cef2f4fb6870f202acd74602f1cSet Approval For...251770732023-01-20 8:32:349 days 17 hrs ago0xe2321a99d054eeebe31ded3451a294136b0d1ffe IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.000773853 26.5
0x7be0ee77f77ea834373cb55370eabb97dd02152f8b5b79319fbca782f975334cSafe Transfer Fr...250863802023-01-18 4:55:0111 days 21 hrs ago0xb489f130ba29ff68ec0276d1a331cda724cb7b27 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00186877525
0x05628ff197efeefe079d3378baaf2422b2dc0396ee620038f2bbb040267fe806Safe Transfer Fr...250814272023-01-18 2:04:2612 days 19 mins ago0x374d9b88a052fc10d336fb6d3fdfb9d00ec6a590 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00149923826
0x0f3598918ccb021de3a1094aef0a3f8d2dfda9f59a45400b9d9172c447f72f46Safe Transfer Fr...250814142023-01-18 2:03:5712 days 20 mins ago0x374d9b88a052fc10d336fb6d3fdfb9d00ec6a590 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00149923826
0x9d1d77fbe6b4e5bc7f30e937c62aaf9a7e0aeceea2e7d36d2a7737735376efa6Safe Transfer Fr...250813982023-01-18 2:03:2412 days 20 mins ago0x374d9b88a052fc10d336fb6d3fdfb9d00ec6a590 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00149923826
0xa19df8662f8683256d3a43335965b5d41c58ea0b7e06fd34e1dac5601a0c5b46Safe Transfer Fr...250813722023-01-18 2:02:3212 days 21 mins ago0x374d9b88a052fc10d336fb6d3fdfb9d00ec6a590 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00149923826
0x95497299e97707192141a95b2f0de50497931df854018df9f7402fbf45cb942bSafe Transfer Fr...250812812023-01-18 1:59:2912 days 24 mins ago0x374d9b88a052fc10d336fb6d3fdfb9d00ec6a590 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00149923826
0xccee9ae87dbf9b6b9d79969635d789196ee9b9d9236bdd5b61c4b36f12c83aebSet Approval For...249396272023-01-14 17:43:2115 days 8 hrs ago0xf2daad03d10af657ec1333974214c4a35ae245dc IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.001273635 27.5
0x07ca350796c9088688c065e757573cd70e6b29bb7775551d4275eb4957d8c323Safe Transfer Fr...249379172023-01-14 16:45:4315 days 9 hrs ago0x6df8fd661646b5e332079a7ae9d8464e4578dce1 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.0015854025 27.5
0x79d629ddca11188c077a98e2e2356ff3220823761229cddb5458d442fe33ed98Safe Transfer Fr...249378032023-01-14 16:41:5415 days 9 hrs ago0x6df8fd661646b5e332079a7ae9d8464e4578dce1 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.0015857325 27.5
0xdd5909485be2b89636fbbc74f55aa3c0f3a98708c6105d6630c37676a31c599bSafe Transfer Fr...249377422023-01-14 16:39:5115 days 9 hrs ago0x6df8fd661646b5e332079a7ae9d8464e4578dce1 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.0020559825 27.5
0x2ab96a88ba5cebb954061dbb3c39f83bc7f8e8b22ef5bb27a722d1007534e8feSet Approval For...248257892023-01-12 2:03:5118 days 20 mins ago0x9a379096dbf27099c0bbe112d03bd1cd2f3425c3 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00122315274 26.41
0xd7b8df1377f7288f29b6e479b87d33bc15b7404311d642bc18587d32cc332409Set Approval For...248005912023-01-11 12:06:1818 days 14 hrs ago0x7cb552152e2b28f9f6911c51b69b0d8d1fadafe1 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.001273635 27.5
0x52995d63bdcc3f0ce42b2d6ff562c7dd80f424740b445db720b59439b8572a46Safe Transfer Fr...247834592023-01-11 2:05:1819 days 18 mins ago0xb489f130ba29ff68ec0276d1a331cda724cb7b27 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00186877525
0x2c34569c9e009d63a14bb0d94556babd102cd8cbd28f9123c8e78cf114cf6ec1Set Approval For...247787182023-01-10 23:23:1119 days 3 hrs ago0x68d27176a5a747b91854cb7e32313f958a814a4d IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.000717002259 27.14478155
0xe7ca2b72efa0662b96d430701b9e223aab57c9b3678de0b83cfd090588038d65Safe Transfer Fr...247438432023-01-10 3:35:2719 days 22 hrs ago0xf2d850d518e4e165c17e6a9c7aa1ffdb00ca0244 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00144127525
0xf66cf8b07457c1cf1497dd1f6f7707b8cec97eb58403c04639f96ba4b26db97cSafe Transfer Fr...247438202023-01-10 3:34:4119 days 22 hrs ago0xf2d850d518e4e165c17e6a9c7aa1ffdb00ca0244 IN  0xb73c3c17b52c3002273896d94f154abb027562c40 AVAX0.00186877525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Upgrade

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : Upgrade.sol
// Tool
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "./VintageWine.sol";

import "./libraries/ERC2981.sol";

interface IGrape {
    function totalSupply() external view returns (uint256);

    function decimals() external view returns (uint8);

    function getOwner() external view returns (address);

    function balanceOf(address owner) external view returns (uint256);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function allowance(address _owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    function burn(uint256 amount) external;

    function burnFrom(address account, uint256 amount) external;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

contract Upgrade is Ownable, Pausable, RoyaltiesAddon, ERC2981 {
    using SafeERC20 for IERC20;
    using Strings for uint256;

    struct UpgradeInfo {
        uint256 tokenId;
        uint256 level;
        uint256 _yield;
    }
    // Struct

    struct Level {
        uint256 supply;
        uint256 maxSupply;
        uint256 priceVintageWine;
        uint256 priceGrape;
        uint256 yield;
    }

    // Var

    VintageWine vintageWine;
    IGrape grape;
    // address public wineryAddress;

    string public BASE_URI;
    uint256 private royaltiesFees;

    uint256 public startTime;

    mapping(uint256 => Level) public levels;
    uint256 currentLevelIndex;

    uint256 public upgradesMinted = 0;

    uint256 public constant LP_TAX_PERCENT = 2;

    mapping(uint256 => uint256) private tokenLevel;

    // Events

    event onUpgradeCreated(uint256 level);

    // Constructor

    constructor(
        VintageWine _vintageWine,
        address _grape,
        string memory _BASE_URI
    )
        ERC721(
            "Vintner Tools",
            "VINTNER-TOOLS"
        )
    {
        vintageWine = _vintageWine;
        grape = IGrape(_grape);
        BASE_URI = _BASE_URI;

        // first three upgrades
        levels[0] = Level({
            supply: 0,
            maxSupply: 2500,
            priceVintageWine: 300 * 1e18,
            priceGrape: 20 * 1e18,
            yield: 1
        });
        levels[1] = Level({
            supply: 0,
            maxSupply: 2200,
            priceVintageWine: 600 * 1e18,
            priceGrape: 50 * 1e18,
            yield: 3
        });
        levels[2] = Level({
            supply: 0,
            maxSupply: 2000,
            priceVintageWine: 1000 * 1e18,
            priceGrape: 80 * 1e18,
            yield: 5
        });
        currentLevelIndex = 2;
    }

    // Views

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721, ERC2981)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    function mintingStarted() public view returns (bool) {
        return startTime != 0 && block.timestamp > startTime;
    }

    function getYield(uint256 _tokenId) public view returns (uint256) {
        require(_exists(_tokenId), "token does not exist");
        return levels[tokenLevel[_tokenId]].yield;
    }

    function getLevel(uint256 _tokenId) public view returns (uint256) {
        require(_exists(_tokenId), "token does not exist");
        return tokenLevel[_tokenId];
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return BASE_URI;
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(_tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );
        uint256 levelFixed = tokenLevel[_tokenId] + 1;
        return
            string(
                abi.encodePacked(
                    _baseURI(),
                    "/",
                    levelFixed.toString(),
                    ".json"
                )
            );
    }

    function isApprovedForAll(address _owner, address _operator)
        public
        view
        override
        returns (bool)
    {
        if (wineryAddress != address(0) && _operator == wineryAddress)
            return true;
        return super.isApprovedForAll(_owner, _operator);
    }

    // ADMIN

    function addLevel(
        uint256 _maxSupply,
        uint256 _priceVintageWine,
        uint256 _priceGrape,
        uint256 _yield
    ) external onlyOwner {
        currentLevelIndex++;
        levels[currentLevelIndex] = Level({
            supply: 0,
            maxSupply: _maxSupply,
            priceVintageWine: _priceVintageWine,
            priceGrape: _priceGrape,
            yield: _yield
        });
    }

    function changeLevel(
        uint256 _index,
        uint256 _maxSupply,
        uint256 _priceVintageWine,
        uint256 _priceGrape,
        uint256 _yield
    ) external onlyOwner {
        require(_index <= currentLevelIndex, "invalid level");
        levels[_index] = Level({
            supply: 0,
            maxSupply: _maxSupply,
            priceVintageWine: _priceVintageWine,
            priceGrape: _priceGrape,
            yield: _yield
        });
    }

    function setVintageWine(VintageWine _vintageWine) external onlyOwner {
        vintageWine = _vintageWine;
    }

    function setGrape(address _grape) external onlyOwner {
        grape = IGrape(_grape);
    }

    function setWineryAddress(address _wineryAddress) external onlyOwner {
        wineryAddress = _wineryAddress;
    }

    function setStartTime(uint256 _startTime) external onlyOwner {
        require(_startTime > block.timestamp, "startTime must be in future");
        require(!mintingStarted(), "minting already started");
        startTime = _startTime;
    }

    function setBaseURI(string calldata _BASE_URI) external onlyOwner {
        BASE_URI = _BASE_URI;
    }

    function forwardERC20s(
        IERC20 _token,
        uint256 _amount,
        address target
    ) external onlyOwner {
        _token.safeTransfer(target, _amount);
    }

    // Minting

    function _createUpgrades(
        uint256 qty,
        uint256 level,
        address to
    ) internal {
        for (uint256 i = 0; i < qty; i++) {
            upgradesMinted += 1;
            levels[level].supply += 1;
            tokenLevel[upgradesMinted] = level;
            _safeMint(to, upgradesMinted);
            emit onUpgradeCreated(level);
        }
    }

    function mintUpgrade(uint256 _level, uint256 _qty) external whenNotPaused {
        require(mintingStarted(), "Tools sales are not open");
        require(_qty > 0 && _qty <= 10, "quantity must be between 1 and 10");
        require(_level <= currentLevelIndex, "invalid level");
        require(
            (levels[_level].supply + _qty) <= levels[_level].maxSupply,
            "you can't mint that many right now"
        );

        uint256 transactionCostVintageWine = levels[_level].priceVintageWine *
            _qty;
        uint256 transactionCostGrape = levels[_level].priceGrape * _qty;
        require(
            vintageWine.balanceOf(_msgSender()) >= transactionCostVintageWine,
            "not have enough VINTAGE"
        );
        require(
            grape.balanceOf(_msgSender()) >= transactionCostGrape,
            "not have enough GRAPE"
        );

        _createUpgrades(_qty, _level, _msgSender());

        vintageWine.burn(
            _msgSender(),
            (transactionCostVintageWine * (100 - LP_TAX_PERCENT)) / 100
        );
        grape.transferFrom(_msgSender(), address(this), transactionCostGrape);
        grape.burn((transactionCostGrape * (100 - LP_TAX_PERCENT)) / 100);

        vintageWine.transferForUpgradesFees(
            _msgSender(),
            (transactionCostVintageWine * LP_TAX_PERCENT) / 100
        );
    }

    /// @dev sets royalties address
    /// for royalties addon
    /// for 2981
    function setRoyaltiesAddress(address _royaltiesAddress) public onlyOwner {
        super._setRoyaltiesAddress(_royaltiesAddress);
    }

    /// @dev sets royalties fees
    function setRoyaltiesFees(uint256 _royaltiesFees) public onlyOwner {
        royaltiesFees = _royaltiesFees;
    }

    /// @inheritdoc	IERC2981
    function royaltyInfo(uint256 tokenId, uint256 value)
        external
        view
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        if (tokenId > 0)
            return (royaltiesAddress, (value * royaltiesFees) / 100);
        else return (royaltiesAddress, 0);
    }

    // // Returns information for multiples upgrades
    // function batchedUpgradesOfOwner(
    //     address _owner,
    //     uint256 _offset,
    //     uint256 _maxSize
    // ) public view returns (UpgradeInfo[] memory) {
    //     if (_offset >= balanceOf(_owner)) {
    //         return new UpgradeInfo[](0);
    //     }

    //     uint256 outputSize = _maxSize;
    //     if (_offset + _maxSize >= balanceOf(_owner)) {
    //         outputSize = balanceOf(_owner) - _offset;
    //     }
    //     UpgradeInfo[] memory upgrades = new UpgradeInfo[](outputSize);

    //     for (uint256 i = 0; i < outputSize; i++) {
    //         uint256 tokenId = tokenOfOwnerByIndex(_owner, _offset + i); // tokenOfOwnerByIndex comes from IERC721Enumerable

    //         upgrades[i] = UpgradeInfo({
    //             tokenId: tokenId,
    //             level: tokenLevel[tokenId],
    //             _yield: levels[tokenLevel[tokenId]].yield
    //         });
    //     }
    //     return upgrades;
    // }
}

File 2 of 18 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

File 3 of 18 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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: balance query for the zero address"
        );
        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: owner query for nonexistent token"
        );
        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)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        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 owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721: approved query for nonexistent token"
        );

        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: transfer caller is not 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: transfer caller is not 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)
    {
        require(
            _exists(tokenId),
            "ERC721: operator query for nonexistent token"
        );
        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 a {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 a {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 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 {
                    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 4 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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 5 of 18 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

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

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

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

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

File 6 of 18 : VintageWine.sol
// Pizza Token
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

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

contract VintageWine is ERC20("Vintage", "VINTAGE"), Ownable {
    uint256 public constant ONE_VINTAGEWINE = 1e18;
    uint256 public constant NUM_PROMOTIONAL_VINTAGEWINE = 500_000;
    uint256 public constant NUM_VINTAGEWINE_USDC_LP = 50_000_000;

    uint256 public NUM_VINTAGEWINE_AVAX_LP = 30_000_000;

    address public cellarAddress;
    address public wineryAddress;
    // address public vintnerAddress;
    address public upgradeAddress;

    bool public promotionalVintageWineMinted = false;
    bool public avaxLPVintageWineMinted = false;
    bool public USDCLPVintageWineMinted = false;

    // ADMIN

    /**
     * winery yields vintageWine
     */
    function setWineryAddress(address _wineryAddress) external onlyOwner {
        wineryAddress = _wineryAddress;
    }

    function setCellarAddress(address _cellarAddress) external onlyOwner {
        cellarAddress = _cellarAddress;
    }

    function setUpgradeAddress(address _upgradeAddress) external onlyOwner {
        upgradeAddress = _upgradeAddress;
    }

    /**
     * vintner consumes vintageWine
     * vintner address can only be set once
     */
    // function setVintnerAddress(address _vintnerAddress) external onlyOwner {
    //     require(
    //         address(vintnerAddress) == address(0),
    //         "vintner address already set"
    //     );
    //     vintnerAddress = _vintnerAddress;
    // }

    function mintVintageWine(address _to, uint256 amount) external onlyOwner {
        _mint(_to, amount);
    }

    function mintPromotionalVintageWine(address _to) external onlyOwner {
        require(
            !promotionalVintageWineMinted,
            "promotional vintageWine has already been minted"
        );
        promotionalVintageWineMinted = true;
        _mint(_to, NUM_PROMOTIONAL_VINTAGEWINE * ONE_VINTAGEWINE);
    }

    function mintAvaxLPVintageWine() external onlyOwner {
        require(
            !avaxLPVintageWineMinted,
            "avax vintageWine LP has already been minted"
        );
        avaxLPVintageWineMinted = true;
        _mint(owner(), NUM_VINTAGEWINE_AVAX_LP * ONE_VINTAGEWINE);
    }

    function mintUSDCLPVintageWine() external onlyOwner {
        require(
            !USDCLPVintageWineMinted,
            "USDC vintageWine LP has already been minted"
        );
        USDCLPVintageWineMinted = true;
        _mint(owner(), NUM_VINTAGEWINE_USDC_LP * ONE_VINTAGEWINE);
    }

    function setNumVintageWineAvaxLp(uint256 _numVintageWineAvaxLp)
        external
        onlyOwner
    {
        NUM_VINTAGEWINE_AVAX_LP = _numVintageWineAvaxLp;
    }

    // external

    function mint(address _to, uint256 _amount) external {
        require(
            wineryAddress != address(0) &&
                // vintnerAddress != address(0) &&
                cellarAddress != address(0) &&
                upgradeAddress != address(0),
            "missing initial requirements"
        );
        require(
            _msgSender() == wineryAddress || _msgSender() == owner(),
            "msgsender does not have permission"
        );
        _mint(_to, _amount);
    }

    function burn(address _from, uint256 _amount) external {
        require(
            // vintnerAddress != address(0) &&
            cellarAddress != address(0) && upgradeAddress != address(0),
            "missing initial requirements"
        );
        require(
            // _msgSender() == vintnerAddress ||
            _msgSender() == cellarAddress || _msgSender() == upgradeAddress,
            "msgsender does not have permission"
        );
        _burn(_from, _amount);
    }

    function transferToCellar(address _from, uint256 _amount) external {
        require(cellarAddress != address(0), "missing initial requirements");
        require(
            _msgSender() == cellarAddress,
            "only the cellar contract can call transferToCellar"
        );
        _transfer(_from, cellarAddress, _amount);
    }

    function transferForUpgradesFees(address _from, uint256 _amount) external {
        require(upgradeAddress != address(0), "missing initial requirements");
        require(
            _msgSender() == upgradeAddress,
            "only the upgrade contract can call transferForUpgradesFees"
        );
        _transfer(_from, upgradeAddress, _amount);
    }
}

File 7 of 18 : ERC2981.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

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

/// @title IERC2981
/// @dev Interface for the ERC2981 - Token Royalty standard
interface IERC2981 {
    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _value - the sale price of the NFT asset specified by _tokenId
    /// @return _receiver - address of who should be sent the royalty payment
    /// @return _royaltyAmount - the royalty payment amount for value sale price
    function royaltyInfo(uint256 _tokenId, uint256 _value)
        external
        view
        returns (address _receiver, uint256 _royaltyAmount);
}

interface RoyaltiesInterface {
    function claimCommunity(address collectionAddress, uint256 tokenId)
        external;
}

abstract contract RoyaltiesAddon is ERC721 {
    address public royaltiesAddress;
    address public wineryAddress;

    /**
     * @dev internal set royalties address
     * @param _royaltiesAddress address of the Royalties.sol
     */
    function _setRoyaltiesAddress(address _royaltiesAddress) internal {
        royaltiesAddress = _royaltiesAddress;
    }

    function _setWineryAddress(address _wineryAddress) internal {
        wineryAddress = _wineryAddress;
    }

    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the royalties get auto claim on transfer
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (
            from != wineryAddress &&
            to != wineryAddress &&
            royaltiesAddress != address(0) &&
            from != address(0) &&
            !Address.isContract(from)
        ) {
            RoyaltiesInterface(royaltiesAddress).claimCommunity(
                address(this),
                tokenId
            );
        }
    }
}

/// @dev This is a contract used to add ERC2981 support to ERC721 and 1155
abstract contract ERC2981 is ERC165, IERC2981 {
    bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;

    /// @inheritdoc	ERC165
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == _INTERFACE_ID_ERC2981 ||
            super.supportsInterface(interfaceId);
    }
}

File 8 of 18 : 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 9 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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

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

File 10 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

    /**
     * @dev 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 11 of 18 : 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 12 of 18 : 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 13 of 18 : 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 14 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

File 15 of 18 : 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 16 of 18 : 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 17 of 18 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

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

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

File 18 of 18 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

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

Contract ABI

[{"inputs":[{"internalType":"contract VintageWine","name":"_vintageWine","type":"address"},{"internalType":"address","name":"_grape","type":"address"},{"internalType":"string","name":"_BASE_URI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"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":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":"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":false,"internalType":"uint256","name":"level","type":"uint256"}],"name":"onUpgradeCreated","type":"event"},{"inputs":[],"name":"BASE_URI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LP_TAX_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_priceVintageWine","type":"uint256"},{"internalType":"uint256","name":"_priceGrape","type":"uint256"},{"internalType":"uint256","name":"_yield","type":"uint256"}],"name":"addLevel","outputs":[],"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":"_index","type":"uint256"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_priceVintageWine","type":"uint256"},{"internalType":"uint256","name":"_priceGrape","type":"uint256"},{"internalType":"uint256","name":"_yield","type":"uint256"}],"name":"changeLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"target","type":"address"}],"name":"forwardERC20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levels","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"priceVintageWine","type":"uint256"},{"internalType":"uint256","name":"priceGrape","type":"uint256"},{"internalType":"uint256","name":"yield","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_level","type":"uint256"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"mintUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintingStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltiesAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","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":"_BASE_URI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_grape","type":"address"}],"name":"setGrape","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltiesAddress","type":"address"}],"name":"setRoyaltiesAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_royaltiesFees","type":"uint256"}],"name":"setRoyaltiesFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"}],"name":"setStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract VintageWine","name":"_vintageWine","type":"address"}],"name":"setVintageWine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wineryAddress","type":"address"}],"name":"setWineryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":[],"name":"upgradesMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wineryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405260006010553480156200001657600080fd5b506040516200318c3803806200318c833981016040819052620000399162000543565b6040518060400160405280600d81526020016c56696e746e657220546f6f6c7360981b8152506040518060400160405280600d81526020016c56494e544e45522d544f4f4c5360981b8152506200009f620000996200041a60201b60201c565b6200041e565b6000805460ff60a01b191690558151620000c19060019060208501906200046e565b508051620000d79060029060208401906200046e565b5050600980546001600160a01b038087166001600160a01b031992831617909255600a8054928616929091169190911790555080516200011f90600b9060208401906200046e565b50506040805160a0808201835260008083526109c46020808501918252681043561a88293000008587019081526801158e460913d00000606080880191825260016080808a01828152888052600e8088529a517fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c5596517fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881d5593517fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881e5591517fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881f5593517fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f88205587518087018952858152610898818501908152682086ac351052600000828b019081526802b5e3af16b188000083880190815260038487019081529489528a875292517fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be9582075590517fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be95820855517fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be95820955517fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be95820a55517fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be95820b55865194850187528385526107d0858301908152683635c9adc5dea000009786019788526804563918244f40000093860193845260059186019182526002948590529590915292517f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f04815592517f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f04825592517f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f04835590517f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f048455517f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f048555600f55506200068a9050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8280546200047c906200064d565b90600052602060002090601f016020900481019282620004a05760008555620004eb565b82601f10620004bb57805160ff1916838001178555620004eb565b82800160010185558215620004eb579182015b82811115620004eb578251825591602001919060010190620004ce565b50620004f9929150620004fd565b5090565b5b80821115620004f95760008155600101620004fe565b6001600160a01b03811681146200052a57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156200055957600080fd5b8351620005668162000514565b809350506020808501516200057b8162000514565b60408601519093506001600160401b03808211156200059957600080fd5b818701915087601f830112620005ae57600080fd5b815181811115620005c357620005c36200052d565b604051601f8201601f19908116603f01168101908382118183101715620005ee57620005ee6200052d565b816040528281528a868487010111156200060757600080fd5b600093505b828410156200062b57848401860151818501870152928501926200060c565b828411156200063d5760008684830101525b8096505050505050509250925092565b600181811c908216806200066257607f821691505b602082108114156200068457634e487b7160e01b600052602260045260246000fd5b50919050565b612af2806200069a6000396000f3fe608060405234801561001057600080fd5b506004361061022d5760003560e01c80636f8608e41161013b578063abbc6d3f116100b8578063dbddb26a1161007c578063dbddb26a14610500578063dc95c4a714610508578063e06b97171461051b578063e985e9c51461052e578063f2fde38b1461054157600080fd5b8063abbc6d3f1461045a578063b2596a6714610462578063b3af2456146104c7578063b88d4fde146104da578063c87b56dd146104ed57600080fd5b80637cc8ef63116100ff5780637cc8ef631461041157806386481d40146104245780638da5cb5b1461043757806395d89b411461043f578063a22cb4651461044757600080fd5b80636f8608e4146103d257806370a08231146103da578063715018a6146103ed578063735d09a6146103f557806378e979251461040857600080fd5b806323b872dd116101c957806342842e0e1161018d57806342842e0e1461037457806343f37b981461038757806355f804b31461039a5780635c975abb146103ad5780636352211e146103bf57600080fd5b806323b872dd146103075780632a55205a1461031a5780632ecd520e1461033b578063328825351461034e5780633e0a322d1461036157600080fd5b806301ffc9a714610232578063047f3af11461025a57806306fdde03146102715780630805d88414610286578063081812fc14610299578063095ea7b3146102b9578063097f0e3c146102ce578063097f1f2f146102e15780630b8faf2d146102f4575b600080fd5b61024561024036600461236c565b610554565b60405190151581526020015b60405180910390f35b61026360105481565b604051908152602001610251565b610279610565565b60405161025191906123e1565b6102636102943660046123f4565b6105f7565b6102ac6102a73660046123f4565b61064a565b604051610251919061240d565b6102cc6102c7366004612436565b6106d2565b005b6102cc6102dc3660046123f4565b6107e3565b6102cc6102ef366004612462565b610817565b6102cc610302366004612462565b610868565b6102cc61031536600461247f565b6108b9565b61032d6103283660046124c0565b6108ea565b6040516102519291906124e2565b6102cc6103493660046124fb565b61093d565b6007546102ac906001600160a01b031681565b6102cc61036f3660046123f4565b6109da565b6102cc61038236600461247f565b610aac565b6102cc61039536600461252d565b610ac7565b6102cc6103a836600461256f565b610b0a565b600054600160a01b900460ff16610245565b6102ac6103cd3660046123f4565b610b45565b610245610bbc565b6102636103e8366004612462565b610bd7565b6102cc610c5e565b6008546102ac906001600160a01b031681565b610263600d5481565b6102cc61041f3660046124c0565b610c99565b6102636104323660046123f4565b611203565b6102ac61123d565b61027961124c565b6102cc6104553660046125ef565b61125b565b610263600281565b61049f6104703660046123f4565b600e60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a001610251565b6102cc6104d5366004612462565b61126a565b6102cc6104e836600461263e565b6112bb565b6102796104fb3660046123f4565b6112f3565b6102796113b7565b6102cc610516366004612462565b611445565b6102cc61052936600461271e565b611495565b61024561053c366004612759565b61153c565b6102cc61054f366004612462565b6115a4565b600061055f82611641565b92915050565b60606001805461057490612787565b80601f01602080910402602001604051908101604052809291908181526020018280546105a090612787565b80156105ed5780601f106105c2576101008083540402835291602001916105ed565b820191906000526020600020905b8154815290600101906020018083116105d057829003601f168201915b5050505050905090565b600061060282611666565b6106275760405162461bcd60e51b815260040161061e906127c2565b60405180910390fd5b506000908152601160209081526040808320548352600e90915290206004015490565b600061065582611666565b6106b65760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161061e565b506000908152600560205260409020546001600160a01b031690565b60006106dd82610b45565b9050806001600160a01b0316836001600160a01b0316141561074b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161061e565b336001600160a01b03821614806107675750610767813361153c565b6107d45760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b606482015260840161061e565b6107de8383611683565b505050565b336107ec61123d565b6001600160a01b0316146108125760405162461bcd60e51b815260040161061e906127f0565b600c55565b3361082061123d565b6001600160a01b0316146108465760405162461bcd60e51b815260040161061e906127f0565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b3361087161123d565b6001600160a01b0316146108975760405162461bcd60e51b815260040161061e906127f0565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6108c333826116f1565b6108df5760405162461bcd60e51b815260040161061e90612825565b6107de8383836117bb565b600080831561092557600754600c546001600160a01b0390911690606490610912908661288c565b61091c91906128c1565b91509150610936565b50506007546001600160a01b031660005b9250929050565b3361094661123d565b6001600160a01b03161461096c5760405162461bcd60e51b815260040161061e906127f0565b600f805490600061097c836128d5565b90915550506040805160a081018252600080825260208083019788528284019687526060830195865260808301948552600f548252600e90529190912090518155935160018501559151600284015551600383015551600490910155565b336109e361123d565b6001600160a01b031614610a095760405162461bcd60e51b815260040161061e906127f0565b428111610a585760405162461bcd60e51b815260206004820152601b60248201527f737461727454696d65206d75737420626520696e206675747572650000000000604482015260640161061e565b610a60610bbc565b15610aa75760405162461bcd60e51b81526020600482015260176024820152761b5a5b9d1a5b99c8185b1c9958591e481cdd185c9d1959604a1b604482015260640161061e565b600d55565b6107de838383604051806020016040528060008152506112bb565b33610ad061123d565b6001600160a01b031614610af65760405162461bcd60e51b815260040161061e906127f0565b6107de6001600160a01b0384168284611962565b33610b1361123d565b6001600160a01b031614610b395760405162461bcd60e51b815260040161061e906127f0565b6107de600b83836122bd565b6000818152600360205260408120546001600160a01b03168061055f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161061e565b6000600d54600014158015610bd25750600d5442115b905090565b60006001600160a01b038216610c425760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161061e565b506001600160a01b031660009081526004602052604090205490565b33610c6761123d565b6001600160a01b031614610c8d5760405162461bcd60e51b815260040161061e906127f0565b610c9760006119b8565b565b600054600160a01b900460ff1615610ce65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161061e565b610cee610bbc565b610d355760405162461bcd60e51b81526020600482015260186024820152772a37b7b6399039b0b632b99030b932903737ba1037b832b760411b604482015260640161061e565b600081118015610d465750600a8111155b610d9c5760405162461bcd60e51b815260206004820152602160248201527f7175616e74697479206d757374206265206265747765656e203120616e6420316044820152600360fc1b606482015260840161061e565b600f54821115610dbe5760405162461bcd60e51b815260040161061e906128f0565b6000828152600e6020526040902060018101549054610dde908390612917565b1115610e375760405162461bcd60e51b815260206004820152602260248201527f796f752063616e2774206d696e742074686174206d616e79207269676874206e6044820152616f7760f01b606482015260840161061e565b6000828152600e6020526040812060020154610e5490839061288c565b6000848152600e602052604081206003015491925090610e7590849061288c565b60095490915082906001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610ea8919061240d565b602060405180830381865afa158015610ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee9919061292f565b1015610f315760405162461bcd60e51b81526020600482015260176024820152766e6f74206861766520656e6f7567682056494e5441474560481b604482015260640161061e565b600a546040516370a0823160e01b815282916001600160a01b0316906370a0823190610f6190339060040161240d565b602060405180830381865afa158015610f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa2919061292f565b1015610fe85760405162461bcd60e51b81526020600482015260156024820152746e6f74206861766520656e6f75676820475241504560581b604482015260640161061e565b610ff3838533611a08565b6009546001600160a01b0316639dc29fac336064611012600282612948565b61101c908761288c565b61102691906128c1565b6040518363ffffffff1660e01b81526004016110439291906124e2565b600060405180830381600087803b15801561105d57600080fd5b505af1158015611071573d6000803e3d6000fd5b5050600a546001600160a01b031691506323b872dd9050336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018490526064016020604051808303816000875af11580156110dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611100919061295f565b50600a546001600160a01b03166342966c68606461111f600282612948565b611129908561288c565b61113391906128c1565b6040518263ffffffff1660e01b815260040161115191815260200190565b600060405180830381600087803b15801561116b57600080fd5b505af115801561117f573d6000803e3d6000fd5b50506009546001600160a01b0316915063bca6c75390503360646111a460028761288c565b6111ae91906128c1565b6040518363ffffffff1660e01b81526004016111cb9291906124e2565b600060405180830381600087803b1580156111e557600080fd5b505af11580156111f9573d6000803e3d6000fd5b5050505050505050565b600061120e82611666565b61122a5760405162461bcd60e51b815260040161061e906127c2565b5060009081526011602052604090205490565b6000546001600160a01b031690565b60606002805461057490612787565b611266338383611ab5565b5050565b3361127361123d565b6001600160a01b0316146112995760405162461bcd60e51b815260040161061e906127f0565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6112c533836116f1565b6112e15760405162461bcd60e51b815260040161061e90612825565b6112ed84848484611b80565b50505050565b60606112fe82611666565b6113625760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161061e565b60008281526011602052604081205461137c906001612917565b9050611386611bb3565b61138f82611bc2565b6040516020016113a092919061297c565b604051602081830303815290604052915050919050565b600b80546113c490612787565b80601f01602080910402602001604051908101604052809291908181526020018280546113f090612787565b801561143d5780601f106114125761010080835404028352916020019161143d565b820191906000526020600020905b81548152906001019060200180831161142057829003601f168201915b505050505081565b3361144e61123d565b6001600160a01b0316146114745760405162461bcd60e51b815260040161061e906127f0565b600780546001600160a01b0319166001600160a01b03831617905550565b50565b3361149e61123d565b6001600160a01b0316146114c45760405162461bcd60e51b815260040161061e906127f0565b600f548511156114e65760405162461bcd60e51b815260040161061e906128f0565b6040805160a081018252600080825260208083019788528284019687526060830195865260808301948552978152600e909752952094518555925160018501559051600284015551600383015551600490910155565b6008546000906001600160a01b03161580159061156657506008546001600160a01b038381169116145b156115735750600161055f565b6001600160a01b0380841660009081526006602090815260408083209386168352929052205460ff165b9392505050565b336115ad61123d565b6001600160a01b0316146115d35760405162461bcd60e51b815260040161061e906127f0565b6001600160a01b0381166116385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061e565b611492816119b8565b60006001600160e01b0319821663152a902d60e11b148061055f575061055f82611cc0565b6000908152600360205260409020546001600160a01b0316151590565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906116b882610b45565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006116fc82611666565b61175d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161061e565b600061176883610b45565b9050806001600160a01b0316846001600160a01b0316148061178f575061178f818561153c565b806117b35750836001600160a01b03166117a88461064a565b6001600160a01b0316145b949350505050565b826001600160a01b03166117ce82610b45565b6001600160a01b0316146118325760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161061e565b6001600160a01b0382166118945760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161061e565b61189f838383611d10565b6118aa600082611683565b6001600160a01b03831660009081526004602052604081208054600192906118d3908490612948565b90915550506001600160a01b0382166000908152600460205260408120805460019290611901908490612917565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107de8363a9059cbb60e01b84846040516024016119819291906124e2565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611de8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005b838110156112ed57600160106000828254611a269190612917565b90915550506000838152600e60205260408120805460019290611a4a908490612917565b909155505060108054600090815260116020526040902084905554611a70908390611eba565b6040518381527fbd8dec1c83646f9f8c3ca8465376ed8174df592e995a30a206944b013ca6bcb59060200160405180910390a180611aad816128d5565b915050611a0b565b816001600160a01b0316836001600160a01b03161415611b135760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161061e565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611b8b8484846117bb565b611b9784848484611ed4565b6112ed5760405162461bcd60e51b815260040161061e906129ca565b6060600b805461057490612787565b606081611be65750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611c105780611bfa816128d5565b9150611c099050600a836128c1565b9150611bea565b60008167ffffffffffffffff811115611c2b57611c2b612628565b6040519080825280601f01601f191660200182016040528015611c55576020820181803683370190505b5090505b84156117b357611c6a600183612948565b9150611c77600a86612a1c565b611c82906030612917565b60f81b818381518110611c9757611c97612a30565b60200101906001600160f81b031916908160001a905350611cb9600a866128c1565b9450611c59565b60006001600160e01b031982166380ac58cd60e01b1480611cf157506001600160e01b03198216635b5e139f60e01b145b8061055f57506301ffc9a760e01b6001600160e01b031983161461055f565b6008546001600160a01b03848116911614801590611d3c57506008546001600160a01b03838116911614155b8015611d5257506007546001600160a01b031615155b8015611d6657506001600160a01b03831615155b8015611d7a57506001600160a01b0383163b155b156107de5760075460405163a4d97fdb60e01b81526001600160a01b039091169063a4d97fdb90611db190309085906004016124e2565b600060405180830381600087803b158015611dcb57600080fd5b505af1158015611ddf573d6000803e3d6000fd5b50505050505050565b6000611e3d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fd29092919063ffffffff16565b8051909150156107de5780806020019051810190611e5b919061295f565b6107de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161061e565b611266828260405180602001604052806000815250611fe1565b60006001600160a01b0384163b15611fc757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f18903390899088908890600401612a46565b6020604051808303816000875af1925050508015611f53575060408051601f3d908101601f19168201909252611f5091810190612a83565b60015b611fad573d808015611f81576040519150601f19603f3d011682016040523d82523d6000602084013e611f86565b606091505b508051611fa55760405162461bcd60e51b815260040161061e906129ca565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117b3565b506001949350505050565b60606117b38484600085612014565b611feb8383612145565b611ff86000848484611ed4565b6107de5760405162461bcd60e51b815260040161061e906129ca565b6060824710156120755760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161061e565b6001600160a01b0385163b6120cc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161061e565b600080866001600160a01b031685876040516120e89190612aa0565b60006040518083038185875af1925050503d8060008114612125576040519150601f19603f3d011682016040523d82523d6000602084013e61212a565b606091505b509150915061213a828286612284565b979650505050505050565b6001600160a01b03821661219b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161061e565b6121a481611666565b156121f15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161061e565b6121fd60008383611d10565b6001600160a01b0382166000908152600460205260408120805460019290612226908490612917565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060831561229357508161159d565b8251156122a35782518084602001fd5b8160405162461bcd60e51b815260040161061e91906123e1565b8280546122c990612787565b90600052602060002090601f0160209004810192826122eb5760008555612331565b82601f106123045782800160ff19823516178555612331565b82800160010185558215612331579182015b82811115612331578235825591602001919060010190612316565b5061233d929150612341565b5090565b5b8082111561233d5760008155600101612342565b6001600160e01b03198116811461149257600080fd5b60006020828403121561237e57600080fd5b813561159d81612356565b60005b838110156123a457818101518382015260200161238c565b838111156112ed5750506000910152565b600081518084526123cd816020860160208601612389565b601f01601f19169290920160200192915050565b60208152600061159d60208301846123b5565b60006020828403121561240657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b038116811461149257600080fd5b6000806040838503121561244957600080fd5b823561245481612421565b946020939093013593505050565b60006020828403121561247457600080fd5b813561159d81612421565b60008060006060848603121561249457600080fd5b833561249f81612421565b925060208401356124af81612421565b929592945050506040919091013590565b600080604083850312156124d357600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b6000806000806080858703121561251157600080fd5b5050823594602084013594506040840135936060013592509050565b60008060006060848603121561254257600080fd5b833561254d81612421565b925060208401359150604084013561256481612421565b809150509250925092565b6000806020838503121561258257600080fd5b823567ffffffffffffffff8082111561259a57600080fd5b818501915085601f8301126125ae57600080fd5b8135818111156125bd57600080fd5b8660208285010111156125cf57600080fd5b60209290920196919550909350505050565b801515811461149257600080fd5b6000806040838503121561260257600080fd5b823561260d81612421565b9150602083013561261d816125e1565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561265457600080fd5b843561265f81612421565b9350602085013561266f81612421565b925060408501359150606085013567ffffffffffffffff8082111561269357600080fd5b818701915087601f8301126126a757600080fd5b8135818111156126b9576126b9612628565b604051601f8201601f19908116603f011681019083821181831017156126e1576126e1612628565b816040528281528a60208487010111156126fa57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080600080600060a0868803121561273657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561276c57600080fd5b823561277781612421565b9150602083013561261d81612421565b600181811c9082168061279b57607f821691505b602082108114156127bc57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601490820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156128a6576128a6612876565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826128d0576128d06128ab565b500490565b60006000198214156128e9576128e9612876565b5060010190565b6020808252600d908201526c1a5b9d985b1a59081b195d995b609a1b604082015260600190565b6000821982111561292a5761292a612876565b500190565b60006020828403121561294157600080fd5b5051919050565b60008282101561295a5761295a612876565b500390565b60006020828403121561297157600080fd5b815161159d816125e1565b6000835161298e818460208801612389565b602f60f81b90830190815283516129ac816001840160208801612389565b64173539b7b760d91b60019290910191820152600601949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600082612a2b57612a2b6128ab565b500690565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612a79908301846123b5565b9695505050505050565b600060208284031215612a9557600080fd5b815161159d81612356565b60008251612ab2818460208701612389565b919091019291505056fea2646970667358221220bee3e286b78fae76486e23a2c59ec466b1efa37aed370936dce7e35112eef7e064736f6c634300080b003300000000000000000000000001af64ef39aeb5612202aa07b3a3829f20c395fd0000000000000000000000005541d83efad1f281571b343977648b75d95cdac20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003268747470733a2f2f746f6f6c732d6a736f6e2e73332e75732d776573742d312e616d617a6f6e6177732e636f6d2f6a736f6e0000000000000000000000000000

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

00000000000000000000000001af64ef39aeb5612202aa07b3a3829f20c395fd0000000000000000000000005541d83efad1f281571b343977648b75d95cdac20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003268747470733a2f2f746f6f6c732d6a736f6e2e73332e75732d776573742d312e616d617a6f6e6177732e636f6d2f6a736f6e0000000000000000000000000000

-----Decoded View---------------
Arg [0] : _vintageWine (address): 0x01af64ef39aeb5612202aa07b3a3829f20c395fd
Arg [1] : _grape (address): 0x5541d83efad1f281571b343977648b75d95cdac2
Arg [2] : _BASE_URI (string): https://tools-json.s3.us-west-1.amazonaws.com/json

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000001af64ef39aeb5612202aa07b3a3829f20c395fd
Arg [1] : 0000000000000000000000005541d83efad1f281571b343977648b75d95cdac2
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [4] : 68747470733a2f2f746f6f6c732d6a736f6e2e73332e75732d776573742d312e
Arg [5] : 616d617a6f6e6177732e636f6d2f6a736f6e0000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.