false
true
0

Contract Address Details

0x004eC26D3648E7631063C201fc856aA433b9dfC9

Contract Name
Coupon721
Creator
0x6e2657–efdae5 at 0x787995–e17693
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
27553647
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
Coupon721




Optimization enabled
true
Compiler version
v0.8.9+commit.e5eed63a




Optimization runs
200
EVM Version
london




Verified at
2026-05-17T10:44:21.240976Z

contracts/Pina/coupon/Coupon.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "../token/IDollar.sol";
import "./Juicing721.sol";
import "../dao/IDAO.sol";

contract Coupon721 is Juicing721 {
    using SafeMath for uint256;
    using Strings for uint256;

    struct Coupon {
        uint256 level;
        uint256 value;
        uint256 discount;
        uint256 maxSupply;
        uint256 couponEpochDecay;
        string name;
        address artist;
        string artistName;
    }

    struct CouponInfo {
        Coupon c;
        uint256 purchaseEpoch;
        uint256 redeemableEpoch;
        uint256 purchaseValue;
    }

    /*
    coupon config
    */
    uint256 private constant peg = 1e18; // 1 dollar
    //default coupon
    Coupon private c1;
    Coupon private c2;
    Coupon private c3;
    Coupon private c4;

    mapping(uint256 => Coupon) private coupon;
    mapping(uint256 => CouponInfo) private couponInfo;

    IDAO private dao;
    IDollar private dollar;

    string internal baseImgURI;

    function initialize(address _dollar) public initializer {
        __ERC721_init("Meme Coupon", "Coupon");
        __ERC721URIStorage_init();
        __AccessControlEnumerable_init();

        _setDefaultRoyalty(msg.sender, 500);
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        dollar = IDollar(_dollar);

        c1 = Coupon(1, 1000e18, 100, 1000, 240, "", address(0), ""); // 1,000 pina, 1000 supply, no discount, 2 month redeemable
        c2 = Coupon(2, 10000e18, 98, 100, 480, "", address(0), ""); // 10,000 pina, 100 supply, 98% discount, 4 month redeemable
        c3 = Coupon(3, 100000e18, 96, 10, 960, "", address(0), ""); // 100,000 pina, 10 supply, 96% discount, 8 month redeemable
        c4 = Coupon(4, 1000000e18, 94, 3, 1440, "", address(0), ""); // 100,000 pina, 3 supply, 94% discount, 12 month redeemable
    }

    function setDao(address daoAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
        dao = IDAO(daoAddress);
    }

    /*
        URI on-chain
    */

    function getBaseImgURI() internal view returns (string memory) {
        return baseImgURI;
    }

    function setBaseImgURI(string memory _baseImgURI)
        public
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        baseImgURI = _baseImgURI;
    }

    function _generateImgURI(uint256 _baseTokenID) internal view returns (string memory) {
        return
            string(
            abi.encodePacked(getBaseImgURI(), _baseTokenID.toString())
        );
     }

    function _generateAttribute(uint256 value, uint256 purchaseValue, uint256 redeemableEpoch, string memory artistName) internal pure returns (string memory) {
        bytes memory attributes = '[';
        attributes = abi.encodePacked(attributes, attributeJson('value', value.div(1e18).toString()));
        attributes = abi.encodePacked(attributes, ',', attributeJson('burnt', purchaseValue.div(1e18).toString()));
        attributes = abi.encodePacked(attributes, ',', attributeJson('redeemable', redeemableEpoch.toString()));
        attributes = abi.encodePacked(attributes, ',', attributeJson('artist', artistName));
        attributes = abi.encodePacked(attributes, ']');
        return string(attributes);
    }

    function attributeJson(string memory traitType, string memory traitValue) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                '{',
                    abi.encodePacked('"trait_type": "', traitType, '",'),
                    abi.encodePacked('"value": "', traitValue, '"'),
                '}'
            );
    }

    function getTokenURI(uint256 baseTokenID, uint256 tokenId, string memory name, uint256 value, uint256 purchaseValue, uint256 redeemableEpoch, string memory artistName) internal view returns (string memory){        
        bytes memory dataURI = abi.encodePacked(
        '{',
            '"name": "',name," #", tokenId.sub(baseTokenID).toString(), '",',
            '"description": "$PINA Coupons on chain, https://www.dontdiememe.com/pina",',
            '"image": "', _generateImgURI(baseTokenID), '",',
            '"attributes": ', _generateAttribute(value, purchaseValue, redeemableEpoch, artistName), '',
        '}'
        );
        return string(
            abi.encodePacked(
                "data:application/json;base64,",
                Base64.encode(dataURI)
            )
        );
    }

    /*
        help functions
    */
    function ownerOf(uint256[] calldata tokenIds)
        public
        view
        returns (address)
    {
        require(tokenIds.length > 0, "invalid tokenids");
        address ownerAddress = ownerOf(tokenIds[0]);
        uint256 n = tokenIds.length;
        for (uint256 i = 0; i < n; ++i) {
            require(ownerOf(tokenIds[i]) == ownerAddress, "different owners");
        }
        return ownerAddress;
    }

    function getCoupon(uint256 _baseTokenID)
        external
        view
        returns (Coupon memory)
    {
        return coupon[_baseTokenID];
    }

    function getCouponInfo(uint256 _tokenID)
        external
        view
        returns (CouponInfo memory)
    {
        return couponInfo[_tokenID];
    }

    function getCouponPrice(uint256 _baseTokenID)
        public
        view
        returns (uint256)
    {
        uint256 _price = dao.getPrice();
        if(dao.bootstrapping()){
            _price = 9e17; //fix to 0.9$ during the bootstrapping phase
        }
        if(_price < 33e16){ //min 0.33$
            _price = 33e16;
        }
        Coupon memory c = coupon[_baseTokenID];
        uint256 cPrice = _price.mul(c.value).div(peg);
        uint256 cPriceDiscount = cPrice.mul(c.discount).div(100).div(1e18).mul(1e18);
        return cPriceDiscount;
    }

    function getCouponPurchaseValue(uint256 _tokenID)
        public
        view
        returns (uint256)
    {
        CouponInfo memory cInfo = couponInfo[_tokenID];
        return cInfo.purchaseValue;
    }

    function getCouponValue(uint256 _tokenID) public view returns (uint256) {
        CouponInfo memory cInfo = couponInfo[_tokenID];
        return cInfo.c.value;
    }

    function getCouponsValue(uint256[] calldata tokenIds)
        public
        view
        returns (uint256)
    {
        uint256 value = 0;
        uint256 n = tokenIds.length;
        for (uint256 i = 0; i < n; ++i) {
            CouponInfo memory cInfo = couponInfo[tokenIds[i]];
            value = value.add(cInfo.c.value);
        }
        return value;
    }

    /*
    coupon core functions
    */
    function createCoupon(
        uint256 _type,
        string memory _name,
        address _artist,
        string memory _artistName
    ) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256 baseTokenID) {
        require(_type <= 3, "invalid type");
        Coupon memory c;
        if (_type == 0) c = c1;
        else if (_type == 1) c = c2;
        else if (_type == 2) c = c3;
        else if (_type == 3) c = c4;
        c.name = _name;
        c.artist = _artist;
        c.artistName = _artistName;
        baseTokenID = create(c.maxSupply);
        coupon[baseTokenID] = c;
    }

    function createCoupon(
        uint256 _level,
        uint256 _value,
        uint256 _discount,
        uint256 _maxSupply,
        uint256 _couponEpochDecay,
        string memory _name,
        address _artist,
        string memory _artistName
    ) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256 baseTokenID) {
        Coupon memory c;
        c.level = _level;
        c.value = _value;
        c.discount = _discount;
        c.maxSupply = _maxSupply;
        c.couponEpochDecay = _couponEpochDecay;
        c.name = _name;
        c.artist = _artist;
        c.artistName = _artistName;

        baseTokenID = create(c.maxSupply);
        coupon[baseTokenID] = c;
    }

    function purchaseCoupon(uint256 _baseTokenID) external {
        uint256 _purchasePrice = getCouponPrice(_baseTokenID);
        require(
            dollar.balanceOf(msg.sender) >= _purchasePrice,
            "not enough balance"
        );

        dollar.burnFrom(msg.sender, _purchasePrice);

        uint256 _currentEpoch = dao.epoch();
        Coupon memory c = coupon[_baseTokenID];
        if(c.artist != address(0)){
            uint256 artistFee = _purchasePrice.div(100);  // 1% fee
            _purchasePrice = _purchasePrice.sub(artistFee);
            dollar.mint(c.artist, artistFee);
        }
        CouponInfo memory cInfo;
        cInfo.c = c;
        cInfo.purchaseValue = _purchasePrice;
        cInfo.purchaseEpoch = _currentEpoch;
        cInfo.redeemableEpoch = _currentEpoch.add(c.couponEpochDecay);

        uint256 tokenID = mint(msg.sender, _baseTokenID);
        _setTokenURI(tokenID, getTokenURI(_baseTokenID, tokenID, cInfo.c.name, cInfo.c.value, cInfo.purchaseValue, cInfo.redeemableEpoch, cInfo.c.artistName));
        couponInfo[tokenID] = cInfo;
    }

    function redeemCoupon(uint256 _tokenID) external {
        require(msg.sender == ownerOf(_tokenID), "not the owner");
        uint256 _currentEpoch = dao.epoch();
        CouponInfo memory cInfo = couponInfo[_tokenID];
        uint256 epochPeriod = dao.epochPeriod();
        require(_currentEpoch >= cInfo.redeemableEpoch.mul(21600).div(epochPeriod), "not redeemable now!");

        dollar.mint(msg.sender, cInfo.purchaseValue);
        _burn(_tokenID);
    }

    function setTokenURI(uint256 baseTokenID, uint256 tokenID, string memory name, uint256 value, uint256 purchaseValue, uint256 redeemableEpoch, string memory artistName) external onlyRole(DEFAULT_ADMIN_ROLE){   
        _setTokenURI(tokenID, getTokenURI(baseTokenID, tokenID, name, value, purchaseValue, redeemableEpoch, artistName));
    }

    // function owner() public view virtual returns (address) {
    //     return getRoleMember(0x0000000000000000000000000000000000000000000000000000000000000000, 0);
    // }
    address private _owner;

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

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

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
        

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

/IERC2981.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}
          

/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

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

/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
          

/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

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

/IAccessControlUpgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

/Juicing721.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./Meme721.sol";

contract Juicing721 is MEME721 {
    mapping(uint256 => uint256) private juicingStarted;
    mapping(uint256 => uint256) private juicingTaskId;

    event Juiced(uint256 indexed tokenId, uint256 indexed taskId);

    event UnJuiced(uint256 indexed tokenId, uint256 indexed taskId);

    function juicingStatus(uint256 tokenId)
        external
        view
        returns (
            bool juicing,
            uint256 start,
            uint256 task
        )
    {
        start = juicingStarted[tokenId];
        task = juicingTaskId[tokenId];
        if (start != 0) {
            juicing = true;
        } else {
            juicing = false;
        }
    }

    function _beforeTokenTransfer(
        address,
        address,
        uint256 tokenId,
        uint256
    ) internal virtual override {
        require(juicingStarted[tokenId] == 0, "can't transfer while juicing");
    }

    function toggleJuicing(
        uint256 tokenId,
        bool juicing,
        uint256 taskId
    ) internal {
        require(taskId > 0, "invalid task id");
        if (juicing) {
            juicingStarted[tokenId] = block.timestamp;
            juicingTaskId[tokenId] = taskId;
            emit Juiced(tokenId, taskId);
        } else {
            require(taskId == juicingTaskId[tokenId], "wrong taskid");
            juicingStarted[tokenId] = 0;
            juicingTaskId[tokenId] = 0;
            emit UnJuiced(tokenId, taskId);
        }
    }

    function toggleJuicing(
        uint256[] calldata tokenIds,
        bool juicing,
        uint256 taskId
    ) external onlyRole(JUICING_ROLE) {
        uint256 n = tokenIds.length;
        for (uint256 i = 0; i < n; ++i) {
            toggleJuicing(tokenIds[i], juicing, taskId);
        }
    }
}
          

/StringsUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = MathUpgradeable.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, MathUpgradeable.log256(value) + 1);
        }
    }

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

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

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

/ERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable 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.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721Upgradeable.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, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721Upgradeable.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

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

    /**
     * @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(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

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

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

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

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[44] private __gap;
}
          

/IAccessControlEnumerableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
          

/AccessControlUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(account),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
          

/IDollar.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

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

interface IDollar is IERC20 {
    function burn(uint256 amount) external;

    function burnFrom(address account, uint256 amount) external;

    function mint(address account, uint256 amount) external;
}
          

/ERC2981.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}
          

/ERC165Upgradeable.sol

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
          

/IERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

/extensions/IERC721MetadataUpgradeable.sol

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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);
}
          

/AccessControlEnumerableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
          

/IDAO.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface IDAO {
    function getPrice() external view returns (uint256);
    function bootstrapping() external view returns (bool);
    function epoch() external view returns (uint256);
    function epochPeriod() external view returns (uint256);
}
          

/Base64.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}
          

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

/MathUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

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

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}
          

/Meme721.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Base64.sol";

contract MEME721 is
    AccessControlEnumerableUpgradeable,
    ERC2981,
    ERC721URIStorageUpgradeable
{
    using SafeMath for uint256;
    using Strings for uint256;

    uint256 private constant MAX_BASE_SUPPLY = 1000000;

    string internal baseTokenURI;
    uint256 private _baseID;
    mapping(uint256 => address) public creators;
    mapping(uint256 => uint256) public tokenSupply;
    mapping(uint256 => uint256) public tokenMaxSupply;
    mapping(uint256 => uint256) public currentTokenID;

    bytes32 public constant JUICING_ROLE = keccak256("JUICING_ROLE");

    function totalSupply(uint256 _id) public view returns (uint256) {
        return tokenSupply[_id];
    }

    function maxSupply(uint256 _id) public view returns (uint256) {
        return tokenMaxSupply[_id];
    }

    function create(uint256 _maxSupply) internal returns (uint256 tokenId) {
        require(_maxSupply < MAX_BASE_SUPPLY, "invalid supply");
        uint256 _baseTokenID = _getNextBaseID();
        _incrementBaseID();
        creators[_baseTokenID] = msg.sender;
        tokenSupply[_baseTokenID] = 0;
        tokenMaxSupply[_baseTokenID] = _maxSupply;
        return _baseTokenID;
    }

    function mint(address _to, uint256 _baseTokenID)
        internal
        returns (uint256)
    {
        require(
            creators[_baseTokenID] != address(0),
            "baseTokenID not been created"
        );
        require(
            tokenSupply[_baseTokenID] < tokenMaxSupply[_baseTokenID],
            "Max supply reached"
        );
        uint256 tokenID = _getNextTokenID(_baseTokenID);
        _mint(_to, tokenID);
        _incrementTokenId(_baseTokenID);
        tokenSupply[_baseTokenID] = tokenSupply[_baseTokenID].add(1);
        return tokenID;
    }

    function _getBaseID(uint256 tokenID) internal pure returns (uint256) {
        return tokenID.div(MAX_BASE_SUPPLY).mul(MAX_BASE_SUPPLY);
    }

    function _getNextBaseID() private view returns (uint256) {
        return _baseID.add(MAX_BASE_SUPPLY);
    }

    function _incrementBaseID() private {
        _baseID = _baseID.add(MAX_BASE_SUPPLY);
    }

    function _getNextTokenID(uint256 _baseTokenID)
        private
        view
        returns (uint256)
    {
        return (currentTokenID[_baseTokenID].add(1)).add(_baseTokenID);
    }

    function _incrementTokenId(uint256 _baseTokenID) private {
        currentTokenID[_baseTokenID]++;
    }

    /// @dev Returns an URI for a given token ID
    function _baseURI() internal view virtual override returns (string memory) {
        return "";
    }

    /// @dev Sets the base token URI prefix.
    function setBaseTokenURI(string memory _baseTokenURI)
        public
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        baseTokenURI = _baseTokenURI;
    }

    // function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
    //     _requireMinted(tokenId);

    //     uint256 baseTokenID = tokenId.div(MAX_BASE_SUPPLY).mul(MAX_BASE_SUPPLY);

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

    function setRoyaltyInfo(address receiver, uint96 feeBasisPoints)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _setDefaultRoyalty(receiver, feeBasisPoints);
    }

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

/SafeMath.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/EnumerableSetUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}
          

/Math.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

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

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}
          

/ContextUpgradeable.sol

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
          

/extensions/ERC721URIStorageUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable {
    function __ERC721URIStorage_init() internal onlyInitializing {
    }

    function __ERC721URIStorage_init_unchained() internal onlyInitializing {
    }
    using StringsUpgradeable for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev See {ERC721-_burn}. This override additionally checks to see if a
     * token-specific URI was set for the token, and if so, it deletes the token URI from
     * the storage mapping.
     */
    function _burn(uint256 tokenId) internal virtual override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
          

Compiler Settings

{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"london","compilationTarget":{"contracts/Pina/coupon/Coupon.sol":"Coupon721"}}
              

Contract ABI

[{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Juiced","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"taskId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"UnJuiced","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"taskId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"JUICING_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"baseTokenID","internalType":"uint256"}],"name":"createCoupon","inputs":[{"type":"uint256","name":"_level","internalType":"uint256"},{"type":"uint256","name":"_value","internalType":"uint256"},{"type":"uint256","name":"_discount","internalType":"uint256"},{"type":"uint256","name":"_maxSupply","internalType":"uint256"},{"type":"uint256","name":"_couponEpochDecay","internalType":"uint256"},{"type":"string","name":"_name","internalType":"string"},{"type":"address","name":"_artist","internalType":"address"},{"type":"string","name":"_artistName","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"baseTokenID","internalType":"uint256"}],"name":"createCoupon","inputs":[{"type":"uint256","name":"_type","internalType":"uint256"},{"type":"string","name":"_name","internalType":"string"},{"type":"address","name":"_artist","internalType":"address"},{"type":"string","name":"_artistName","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"creators","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentTokenID","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct Coupon721.Coupon","components":[{"type":"uint256","name":"level","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"discount","internalType":"uint256"},{"type":"uint256","name":"maxSupply","internalType":"uint256"},{"type":"uint256","name":"couponEpochDecay","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"address","name":"artist","internalType":"address"},{"type":"string","name":"artistName","internalType":"string"}]}],"name":"getCoupon","inputs":[{"type":"uint256","name":"_baseTokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct Coupon721.CouponInfo","components":[{"type":"tuple","name":"c","internalType":"struct Coupon721.Coupon","components":[{"type":"uint256","name":"level","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"discount","internalType":"uint256"},{"type":"uint256","name":"maxSupply","internalType":"uint256"},{"type":"uint256","name":"couponEpochDecay","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"address","name":"artist","internalType":"address"},{"type":"string","name":"artistName","internalType":"string"}]},{"type":"uint256","name":"purchaseEpoch","internalType":"uint256"},{"type":"uint256","name":"redeemableEpoch","internalType":"uint256"},{"type":"uint256","name":"purchaseValue","internalType":"uint256"}]}],"name":"getCouponInfo","inputs":[{"type":"uint256","name":"_tokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCouponPrice","inputs":[{"type":"uint256","name":"_baseTokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCouponPurchaseValue","inputs":[{"type":"uint256","name":"_tokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCouponValue","inputs":[{"type":"uint256","name":"_tokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCouponsValue","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_dollar","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"juicing","internalType":"bool"},{"type":"uint256","name":"start","internalType":"uint256"},{"type":"uint256","name":"task","internalType":"uint256"}],"name":"juicingStatus","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxSupply","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"purchaseCoupon","inputs":[{"type":"uint256","name":"_baseTokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"redeemCoupon","inputs":[{"type":"uint256","name":"_tokenID","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"royaltyInfo","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"uint256","name":"_salePrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseImgURI","inputs":[{"type":"string","name":"_baseImgURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseTokenURI","inputs":[{"type":"string","name":"_baseTokenURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDao","inputs":[{"type":"address","name":"daoAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRoyaltyInfo","inputs":[{"type":"address","name":"receiver","internalType":"address"},{"type":"uint96","name":"feeBasisPoints","internalType":"uint96"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenURI","inputs":[{"type":"uint256","name":"baseTokenID","internalType":"uint256"},{"type":"uint256","name":"tokenID","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"purchaseValue","internalType":"uint256"},{"type":"uint256","name":"redeemableEpoch","internalType":"uint256"},{"type":"string","name":"artistName","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleJuicing","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"},{"type":"bool","name":"juicing","internalType":"bool"},{"type":"uint256","name":"taskId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenMaxSupply","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenSupply","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50615a8680620000216000396000f3fe608060405234801561001057600080fd5b50600436106102f05760003560e01c806370a082311161019d578063b88d4fde116100e9578063c87b56dd116100a2578063d547741f1161007c578063d547741f1461074e578063e985e9c514610761578063f2fde38b1461079d578063f4896d0e146107b057600080fd5b8063c87b56dd146106fe578063ca15c87314610711578063cd53d08e1461072457600080fd5b8063b88d4fde14610661578063bd85b03914610674578063be77ccf514610695578063bffb9620146106c5578063c4d66de8146106d8578063c84f818b146106eb57600080fd5b8063936e3169116101565780639b8909a5116101305780639b8909a5146106135780639ebac91414610633578063a217fddf14610646578063a22cb4651461064e57600080fd5b8063936e3169146105d857806394ac9968146105f857806395d89b411461060b57600080fd5b806370a082311461056e578063715018a614610581578063869f7594146105895780638da5cb5b146105aa5780639010d07c146105b257806391d14854146105c557600080fd5b80632f2ff15d1161025c57806342842e0e1161021557806353ca516d116101ef57806353ca516d146105225780636352211e146105355780636637b8821461054857806367034fbe1461055b57600080fd5b806342842e0e146104e957806347591135146104fc5780634ffab34b1461050f57600080fd5b80632f2ff15d1461046357806330176e1314610476578063356ea6c61461048957806336568abe146104b05780633755f665146104c35780633d6a8d34146104d657600080fd5b806323b872dd116102ae57806323b872dd146103b4578063248a9ca3146103c7578063248b47fe146103ea5780632693ebf2146103fd57806326fffb721461041e5780632a55205a1461043157600080fd5b80624221f0146102f557806301ffc9a71461032957806302fa7c471461034c57806306fdde0314610361578063081812fc14610376578063095ea7b3146103a1575b600080fd5b610316610303366004614cd3565b6101336020526000908152604090205481565b6040519081526020015b60405180910390f35b61033c610337366004614d02565b6107d1565b6040519015158152602001610320565b61035f61035a366004614d3b565b6107e2565b005b6103696107fc565b6040516103209190614dd6565b610389610384366004614cd3565b61088e565b6040516001600160a01b039091168152602001610320565b61035f6103af366004614de9565b6108b5565b61035f6103c2366004614e13565b6109cb565b6103166103d5366004614cd3565b60009081526065602052604090206001015490565b61035f6103f8366004614efa565b6109fc565b61031661040b366004614cd3565b6101326020526000908152604090205481565b61035f61042c366004614cd3565b610a29565b61044461043f366004614f8d565b610f51565b604080516001600160a01b039093168352602083019190915201610320565b61035f610471366004614faf565b610fff565b61035f610484366004614fdb565b611024565b6103167f84f866be4904f319a18e8cf4db8f4b76d6ec7d27860173c125ec640353a62a7981565b61035f6104be366004614faf565b611043565b6103166104d136600461500f565b6110c1565b6103166104e4366004614cd3565b6111c7565b61035f6104f7366004614e13565b611389565b61038961050a3660046150f7565b6113a4565b61035f61051d366004614cd3565b61149a565b610316610530366004614cd3565b61189c565b610389610543366004614cd3565b611a64565b61035f610556366004615138565b611ac4565b61035f610569366004614fdb565b611af3565b61031661057c366004615138565b611b12565b61035f611b98565b610316610597366004614cd3565b6000908152610133602052604090205490565b610389611bac565b6103896105c0366004614f8d565b611bbd565b61033c6105d3366004614faf565b611bdc565b6105eb6105e6366004614cd3565b611c07565b60405161032091906151d0565b61035f6106063660046151f1565b611da3565b610369611e15565b610626610621366004614cd3565b611e24565b604051610320919061524d565b6103166106413660046150f7565b611fe8565b610316600081565b61035f61065c366004615293565b612200565b61035f61066f3660046152bf565b61220b565b610316610682366004614cd3565b6000908152610132602052604090205490565b6106a86106a3366004614cd3565b61223d565b604080519315158452602084019290925290820152606001610320565b6103166106d336600461533a565b612274565b61035f6106e6366004615138565b612758565b6103166106f9366004614cd3565b612c81565b61036961070c366004614cd3565b612fbd565b61031661071f366004614cd3565b6130ce565b610389610732366004614cd3565b610131602052600090815260409020546001600160a01b031681565b61035f61075c366004614faf565b6130e5565b61033c61076f3660046153ab565b6001600160a01b03918216600090815260d06020908152604080832093909416825291909152205460ff1690565b61035f6107ab366004615138565b61310a565b6103166107be366004614cd3565b6101346020526000908152604090205481565b60006107dc82613183565b92915050565b60006107ed816131c3565b6107f783836131cd565b505050565b606060cb805461080b906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610837906153d5565b80156108845780601f1061085957610100808354040283529160200191610884565b820191906000526020600020905b81548152906001019060200180831161086757829003601f168201915b5050505050905090565b6000610899826132ca565b50600090815260cf60205260409020546001600160a01b031690565b60006108c082611a64565b9050806001600160a01b0316836001600160a01b031614156109335760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061094f575061094f813361076f565b6109c15760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161092a565b6107f78383613329565b6109d53382613397565b6109f15760405162461bcd60e51b815260040161092a90615410565b6107f7838383613415565b6000610a07816131c3565b610a1f87610a1a8a8a8a8a8a8a8a613586565b61360c565b5050505050505050565b6000610a3482612c81565b61015a546040516370a0823160e01b815233600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b158015610a7d57600080fd5b505afa158015610a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab5919061545d565b1015610af85760405162461bcd60e51b81526020600482015260126024820152716e6f7420656e6f7567682062616c616e636560701b604482015260640161092a565b61015a5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610b4557600080fd5b505af1158015610b59573d6000803e3d6000fd5b50505050600061015960009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bae57600080fd5b505afa158015610bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be6919061545d565b905060006101576000858152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054610c4c906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610c78906153d5565b8015610cc55780601f10610c9a57610100808354040283529160200191610cc5565b820191906000526020600020905b815481529060010190602001808311610ca857829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191610cf5906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610d21906153d5565b8015610d6e5780601f10610d4357610100808354040283529160200191610d6e565b820191906000526020600020905b815481529060010190602001808311610d5157829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615610e16576000610d9b8460646136a6565b9050610da784826136b2565b61015a5460c08401516040516340c10f1960e01b81526001600160a01b0391821660048201526024810185905292965016906340c10f1990604401600060405180830381600087803b158015610dfc57600080fd5b505af1158015610e10573d6000803e3d6000fd5b50505050505b610e1e614b88565b81815260608101849052602081018390526080820151610e3f9084906136be565b60408201526000610e5033876136ca565b9050610e8581610a1a8884866000015160a00151876000015160200151886060015189604001518a6000015160e00151613586565b60008181526101586020908152604091829020845180518255808301516001830155928301516002820155606083015160038201556080830151600482015560a08301518051869492938492610ee49260058501929190910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051610f26916007840191602090910190614bb6565b5050506020820151600882015560408201516009820155606090910151600a90910155505050505050565b600082815260ca602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610fc657506040805180820190915260c9546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610fe5906001600160601b03168761548c565b610fef91906154ab565b91519350909150505b9250929050565b60008281526065602052604090206001015461101a816131c3565b6107f783836137e1565b600061102f816131c3565b81516107f79061012f906020850190614bb6565b6001600160a01b03811633146110b35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161092a565b6110bd8282613803565b5050565b6000806110cd816131c3565b6110d5614c3a565b8a8152602081018a905260408101899052606081018890526080810187905260a081018690526001600160a01b03851660c082015260e0810184905261111a88613825565b6000818152610157602090815260409182902084518155818501516001820155918401516002830155606084015160038301556080840151600483015560a0840151805193965084936111739260058501920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e082015180516111b5916007840191602090910190614bb6565b50905050505098975050505050505050565b6000818152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805485949392849290918491610120850191611232906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461125e906153d5565b80156112ab5780601f10611280576101008083540402835291602001916112ab565b820191906000526020600020905b81548152906001019060200180831161128e57829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916112db906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611307906153d5565b80156113545780601f1061132957610100808354040283529160200191611354565b820191906000526020600020905b81548152906001019060200180831161133757829003601f168201915b5050509190925250505081526008820154602082015260098201546040820152600a9091015460609182015201519392505050565b6107f78383836040518060200160405280600081525061220b565b6000816113e65760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420746f6b656e69647360801b604482015260640161092a565b600061140a848460008181106113fe576113fe6154cd565b90506020020135611a64565b90508260005b8181101561149057826001600160a01b03166114378787848181106113fe576113fe6154cd565b6001600160a01b0316146114805760405162461bcd60e51b815260206004820152601060248201526f646966666572656e74206f776e65727360801b604482015260640161092a565b611489816154e3565b9050611410565b5090949350505050565b6114a381611a64565b6001600160a01b0316336001600160a01b0316146114f35760405162461bcd60e51b815260206004820152600d60248201526c3737ba103a34329037bbb732b960991b604482015260640161092a565b610159546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611571919061545d565b6000838152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805495965093949293919284928491610120850191906115e0906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461160c906153d5565b80156116595780601f1061162e57610100808354040283529160200191611659565b820191906000526020600020905b81548152906001019060200180831161163c57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611689906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546116b5906153d5565b80156117025780601f106116d757610100808354040283529160200191611702565b820191906000526020600020905b8154815290600101906020018083116116e557829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a820154815250509050600061015960009054906101000a90046001600160a01b03166001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561178057600080fd5b505afa158015611794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b8919061545d565b90506117dd816117d761546085604001516138bb90919063ffffffff16565b906136a6565b8310156118225760405162461bcd60e51b81526020600482015260136024820152726e6f742072656465656d61626c65206e6f772160681b604482015260640161092a565b61015a5460608301516040516340c10f1960e01b815233600482015260248101919091526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561187557600080fd5b505af1158015611889573d6000803e3d6000fd5b50505050611896846138c7565b50505050565b6000818152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805485949392849290918491610120850191611907906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611933906153d5565b80156119805780601f1061195557610100808354040283529160200191611980565b820191906000526020600020905b81548152906001019060200180831161196357829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916119b0906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546119dc906153d5565b8015611a295780601f106119fe57610100808354040283529160200191611a29565b820191906000526020600020905b815481529060010190602001808311611a0c57829003601f168201915b505050919092525050508152600882015460208083019190915260098301546040830152600a90920154606090910152905101519392505050565b600081815260cd60205260408120546001600160a01b0316806107dc5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161092a565b6000611acf816131c3565b5061015980546001600160a01b0319166001600160a01b0392909216919091179055565b6000611afe816131c3565b81516107f79061015b906020850190614bb6565b60006001600160a01b038216611b7c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161092a565b506001600160a01b0316600090815260ce602052604090205490565b611ba0613907565b611baa6000613966565b565b6000611bb88180611bbd565b905090565b6000828152609760205260408120611bd590836139b9565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611c0f614c3a565b6101576000838152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054611c71906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611c9d906153d5565b8015611cea5780601f10611cbf57610100808354040283529160200191611cea565b820191906000526020600020905b815481529060010190602001808311611ccd57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611d1a906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611d46906153d5565b8015611d935780601f10611d6857610100808354040283529160200191611d93565b820191906000526020600020905b815481529060010190602001808311611d7657829003601f168201915b5050505050815250509050919050565b7f84f866be4904f319a18e8cf4db8f4b76d6ec7d27860173c125ec640353a62a79611dcd816131c3565b8360005b81811015611e0c57611dfc878783818110611dee57611dee6154cd565b9050602002013586866139c5565b611e05816154e3565b9050611dd1565b50505050505050565b606060cc805461080b906153d5565b611e2c614b88565b600082815261015860205260409081902081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e08401526004820154610100840152600582018054849291849161012085019190611e94906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611ec0906153d5565b8015611f0d5780601f10611ee257610100808354040283529160200191611f0d565b820191906000526020600020905b815481529060010190602001808311611ef057829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611f3d906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611f69906153d5565b8015611fb65780601f10611f8b57610100808354040283529160200191611fb6565b820191906000526020600020905b815481529060010190602001808311611f9957829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a820154815250509050919050565b60008082815b81811015611490576000610158600088888581811061200f5761200f6154cd565b90506020020135815260200190815260200160002060405180608001604052908160008201604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054612082906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546120ae906153d5565b80156120fb5780601f106120d0576101008083540402835291602001916120fb565b820191906000526020600020905b8154815290600101906020018083116120de57829003601f168201915b505050918352505060068201546001600160a01b0316602082015260078201805460409092019161212b906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612157906153d5565b80156121a45780601f10612179576101008083540402835291602001916121a4565b820191906000526020600020905b81548152906001019060200180831161218757829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a8201548152505090506121ec816000015160200151856136be90919063ffffffff16565b935050806121f9906154e3565b9050611fee565b6110bd338383613af8565b6122153383613397565b6122315760405162461bcd60e51b815260040161092a90615410565b61189684848484613bc7565b600081815261013560209081526040808320546101369092528220548115612268576001925061226d565b600092505b9193909250565b600080612280816131c3565b60038611156122c05760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964207479706560a01b604482015260640161092a565b6122c8614c3a565b8661244e57604080516101008101825261013780548252610138546020830152610139549282019290925261013a54606082015261013b54608082015261013c805491929160a08401919061231c906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612348906153d5565b80156123955780601f1061236a57610100808354040283529160200191612395565b820191906000526020600020905b81548152906001019060200180831161237857829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916123c5906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546123f1906153d5565b801561243e5780601f106124135761010080835404028352916020019161243e565b820191906000526020600020905b81548152906001019060200180831161242157829003601f168201915b5050505050815250509050612684565b86600114156124a657604080516101008101825261013f805482526101405460208301526101415492820192909252610142546060820152610143546080820152610144805491929160a08401919061231c906153d5565b86600214156124fe57604080516101008101825261014780548252610148546020830152610149549282019290925261014a54606082015261014b54608082015261014c805491929160a08401919061231c906153d5565b866003141561268457604080516101008101825261014f805482526101505460208301526101515492820192909252610152546060820152610153546080820152610154805491929160a084019190612556906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612582906153d5565b80156125cf5780601f106125a4576101008083540402835291602001916125cf565b820191906000526020600020905b8154815290600101906020018083116125b257829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916125ff906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461262b906153d5565b80156126785780601f1061264d57610100808354040283529160200191612678565b820191906000526020600020905b81548152906001019060200180831161265b57829003601f168201915b50505050508152505090505b60a081018690526001600160a01b03851660c082015260e0810184905260608101516126af90613825565b6000818152610157602090815260409182902084518155818501516001820155918401516002830155606084015160038301556080840151600483015560a0840151805193965084936127089260058501920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e0820151805161274a916007840191602090910190614bb6565b509050505050949350505050565b600054610100900460ff16158080156127785750600054600160ff909116105b806127925750303b158015612792575060005460ff166001145b6127f55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161092a565b6000805460ff191660011790558015612818576000805461ff0019166101001790555b6128636040518060400160405280600b81526020016a26b2b6b29021b7bab837b760a91b8152506040518060400160405280600681526020016521b7bab837b760d11b815250613bfa565b61286b613c2b565b612873613c2b565b61287f336101f46131cd565b61288a6000336137e1565b61015a80546001600160a01b0319166001600160a01b038416179055604080516101008101825260018152683635c9adc5dea00000602080830191825260648385019081526103e86060850190815260f06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e087019790975285516101379081559451610138559151610139555161013a555161013b5592518051929391926129439261013c920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612985916007840191602090910190614bb6565b505060408051610100810182526002815269021e19e0c9bab2400000602080830191825260628385019081526064606085019081526101e06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e0870197909752855161013f90815594516101405591516101415551610142555161014355925180519294509092612a28926101449290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612a6a916007840191602090910190614bb6565b505060408051610100810182526003815269152d02c7e14af680000060208083019182526060838501818152600a9185019182526103c06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e08701979097528551610147908155945161014855905161014955905161014a555161014b55925180519294509092612b0d9261014c9290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612b4f916007840191602090910190614bb6565b505060408051610100810182526004815269d3c21bcecceda10000006020808301918252605e8385019081526003606085019081526105a06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e0870197909752855161014f90815594516101505591516101515551610152555161015355925180519294509092612bf2926101549290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612c34916007840191602090910190614bb6565b5090505080156110bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60008061015960009054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b815260040160206040518083038186803b158015612cd357600080fd5b505afa158015612ce7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0b919061545d565b905061015960009054906101000a90046001600160a01b03166001600160a01b031663dd77a05b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d5c57600080fd5b505afa158015612d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9491906154fe565b15612da45750670c7d713b49da00005b670494654067e10000811015612dbf5750670494654067e100005b60006101576000858152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054612e23906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612e4f906153d5565b8015612e9c5780601f10612e7157610100808354040283529160200191612e9c565b820191906000526020600020905b815481529060010190602001808311612e7f57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191612ecc906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612ef8906153d5565b8015612f455780601f10612f1a57610100808354040283529160200191612f45565b820191906000526020600020905b815481529060010190602001808311612f2857829003601f168201915b50505050508152505090506000612f75670de0b6b3a76400006117d78460200151866138bb90919063ffffffff16565b90506000612fb3670de0b6b3a7640000612fad670de0b6b3a76400006117d760646117d78960400151896138bb90919063ffffffff16565b906138bb565b9695505050505050565b6060612fc8826132ca565b600082815260fd602052604081208054612fe1906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461300d906153d5565b801561305a5780601f1061302f5761010080835404028352916020019161305a565b820191906000526020600020905b81548152906001019060200180831161303d57829003601f168201915b50505050509050600061307860408051602081019091526000815290565b905080516000141561308b575092915050565b8151156130bd5780826040516020016130a5929190615537565b60405160208183030381529060405292505050919050565b6130c684613c52565b949350505050565b60008181526097602052604081206107dc90613cc5565b600082815260656020526040902060010154613100816131c3565b6107f78383613803565b613112613907565b6001600160a01b0381166131775760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161092a565b61318081613966565b50565b60006001600160e01b031982166380ac58cd60e01b14806131b457506001600160e01b03198216635b5e139f60e01b145b806107dc57506107dc82613ccf565b6131808133613d04565b6127106001600160601b038216111561323b5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161092a565b6001600160a01b0382166132915760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161092a565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b9091021760c955565b600081815260cd60205260409020546001600160a01b03166131805760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161092a565b600081815260cf6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061335e82611a64565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806133a383611a64565b9050806001600160a01b0316846001600160a01b031614806133ea57506001600160a01b03808216600090815260d0602090815260408083209388168352929052205460ff165b806130c65750836001600160a01b03166134038461088e565b6001600160a01b031614949350505050565b826001600160a01b031661342882611a64565b6001600160a01b03161461344e5760405162461bcd60e51b815260040161092a90615566565b6001600160a01b0382166134b05760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161092a565b6134bd8383836001613d5d565b826001600160a01b03166134d082611a64565b6001600160a01b0316146134f65760405162461bcd60e51b815260040161092a90615566565b600081815260cf6020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260ce855283862080546000190190559087168086528386208054600101905586865260cd90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b606060008661359d6135988a8c6136b2565b613dba565b6135a68b613e56565b6135b289898989613e90565b6040516020016135c594939291906155ab565b60405160208183030381529060405290506135df81614018565b6040516020016135ef91906156dd565b604051602081830303815290604052915050979650505050505050565b600082815260cd60205260409020546001600160a01b03166136875760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161092a565b600082815260fd6020908152604090912082516107f792840190614bb6565b6000611bd582846154ab565b6000611bd58284615722565b6000611bd58284615739565b600081815261013160205260408120546001600160a01b031661372f5760405162461bcd60e51b815260206004820152601c60248201527f62617365546f6b656e4944206e6f74206265656e206372656174656400000000604482015260640161092a565b60008281526101336020908152604080832054610132909252909120541061378e5760405162461bcd60e51b815260206004820152601260248201527113585e081cdd5c1c1b1e481c995858da195960721b604482015260640161092a565b60006137998361416b565b90506137a58482614192565b6137ae8361432b565b600083815261013260205260409020546137c99060016136be565b60008481526101326020526040902055905092915050565b6137eb828261434e565b60008281526097602052604090206107f790826143d4565b61380d82826143e9565b60008281526097602052604090206107f79082614450565b6000620f4240821061386a5760405162461bcd60e51b815260206004820152600e60248201526d696e76616c696420737570706c7960901b604482015260640161092a565b6000613874614465565b905061387e614479565b60008181526101316020908152604080832080546001600160a01b0319163317905561013282528083208390556101339091529020929092555090565b6000611bd5828461548c565b6138d081614490565b600081815260fd6020526040902080546138e9906153d5565b15905061318057600081815260fd6020526040812061318091614c88565b33613910611bac565b6001600160a01b031614611baa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161092a565b61015c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611bd58383614533565b60008111613a075760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081d185cdac81a59608a1b604482015260640161092a565b8115613a5c5760008381526101356020908152604080832042905561013690915280822083905551829185917f365c7d7284755ed19e809683dfd787da1e8115e86c37612909e022f8ec85126f9190a3505050565b600083815261013660205260409020548114613aa95760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c81d185cdada5960a21b604482015260640161092a565b60008381526101356020908152604080832083905561013690915280822082905551829185917f29461b419f1938cf901704b3e90c50de5ce021544424551b5d65869b605f9dc69190a3505050565b816001600160a01b0316836001600160a01b03161415613b5a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161092a565b6001600160a01b03838116600081815260d06020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bd2848484613415565b613bde8484848461455d565b6118965760405162461bcd60e51b815260040161092a90615751565b600054610100900460ff16613c215760405162461bcd60e51b815260040161092a906157a3565b6110bd8282614667565b600054610100900460ff16611baa5760405162461bcd60e51b815260040161092a906157a3565b6060613c5d826132ca565b6000613c7460408051602081019091526000815290565b90506000815111613c945760405180602001604052806000815250611bd5565b80613c9e846146b5565b604051602001613caf929190615537565b6040516020818303038152906040529392505050565b60006107dc825490565b60006001600160e01b0319821663152a902d60e11b14806107dc57506301ffc9a760e01b6001600160e01b03198316146107dc565b613d0e8282611bdc565b6110bd57613d1b81614749565b613d2683602061475b565b604051602001613d379291906157ee565b60408051601f198184030181529082905262461bcd60e51b825261092a91600401614dd6565b60008281526101356020526040902054156118965760405162461bcd60e51b815260206004820152601c60248201527f63616e2774207472616e73666572207768696c65206a756963696e6700000000604482015260640161092a565b60606000613dc7836148f6565b60010190506000816001600160401b03811115613de657613de6614e4f565b6040519080825280601f01601f191660200182016040528015613e10576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613e4957613e4e565b613e1a565b509392505050565b6060613e606149ce565b613e6983613dba565b604051602001613e7a929190615537565b6040516020818303038152906040529050919050565b60408051808201825260018152605b60f81b6020808301919091528251808401909352600583526476616c756560d81b908301526060918190613ee790613ee26135988a670de0b6b3a76400006136a6565b6149de565b604051602001613ef8929190615537565b60408051601f198184030181528282019091526005825264189d5c9b9d60da1b602083015291508190613f3a90613ee261359889670de0b6b3a76400006136a6565b604051602001613f4b929190615863565b60408051601f19818403018152828201909152600a82526972656465656d61626c6560b01b602083015291508190613f8690613ee287613dba565b604051602001613f97929190615863565b60408051601f198184030181528282019091526006825265185c9d1a5cdd60d21b602083015291508190613fcb90856149de565b604051602001613fdc929190615863565b604051602081830303815290604052905080604051602001613ffe919061589f565b60408051808303601f190181529190529695505050505050565b606081516000141561403857505060408051602081019091526000815290565b6000604051806060016040528060408152602001615a1160409139905060006003845160026140679190615739565b61407191906154ab565b61407c90600461548c565b6001600160401b0381111561409357614093614e4f565b6040519080825280601f01601f1916602001820160405280156140bd576020820181803683370190505b509050600182016020820185865187015b80821015614129576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506140ce565b5050600386510660018114614145576002811461415857614160565b603d6001830353603d6002830353614160565b603d60018303535b509195945050505050565b600081815261013460205260408120546107dc90839061418c9060016136be565b906136be565b6001600160a01b0382166141e85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161092a565b600081815260cd60205260409020546001600160a01b03161561424d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161092a565b61425b600083836001613d5d565b600081815260cd60205260409020546001600160a01b0316156142c05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161092a565b6001600160a01b038216600081815260ce602090815260408083208054600101905584835260cd90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815261013460205260408120805491614346836154e3565b919050555050565b6143588282611bdc565b6110bd5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556143903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611bd5836001600160a01b038416614a46565b6143f38282611bdc565b156110bd5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611bd5836001600160a01b038416614a95565b61013054600090611bb890620f42406136be565b6101305461448a90620f42406136be565b61013055565b600061449b82611a64565b90506144ab816000846001613d5d565b6144b482611a64565b600083815260cf6020908152604080832080546001600160a01b03199081169091556001600160a01b03851680855260ce8452828520805460001901905587855260cd909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082600001828154811061454a5761454a6154cd565b9060005260206000200154905092915050565b60006001600160a01b0384163b1561465f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906145a19033908990889088906004016158c4565b602060405180830381600087803b1580156145bb57600080fd5b505af19250505080156145eb575060408051601f3d908101601f191682019092526145e8918101906158f7565b60015b614645573d808015614619576040519150601f19603f3d011682016040523d82523d6000602084013e61461e565b606091505b50805161463d5760405162461bcd60e51b815260040161092a90615751565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506130c6565b5060016130c6565b600054610100900460ff1661468e5760405162461bcd60e51b815260040161092a906157a3565b81516146a19060cb906020850190614bb6565b5080516107f79060cc906020840190614bb6565b606060006146c2836148f6565b60010190506000816001600160401b038111156146e1576146e1614e4f565b6040519080825280601f01601f19166020018201604052801561470b576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461474457613e4e565b614715565b60606107dc6001600160a01b03831660145b6060600061476a83600261548c565b614775906002615739565b6001600160401b0381111561478c5761478c614e4f565b6040519080825280601f01601f1916602001820160405280156147b6576020820181803683370190505b509050600360fc1b816000815181106147d1576147d16154cd565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614800576148006154cd565b60200101906001600160f81b031916908160001a905350600061482484600261548c565b61482f906001615739565b90505b60018111156148a7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614863576148636154cd565b1a60f81b828281518110614879576148796154cd565b60200101906001600160f81b031916908160001a90535060049490941c936148a081615914565b9050614832565b508315611bd55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161092a565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106149355772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614961576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061497f57662386f26fc10000830492506010015b6305f5e1008310614997576305f5e100830492506008015b61271083106149ab57612710830492506004015b606483106149bd576064830492506002015b600a83106107dc5760010192915050565b606061015b805461080b906153d5565b6060826040516020016149f1919061592b565b60405160208183030381529060405282604051602001614a11919061596f565b60408051601f1981840301815290829052614a2f92916020016159ad565b604051602081830303815290604052905092915050565b6000818152600183016020526040812054614a8d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107dc565b5060006107dc565b60008181526001830160205260408120548015614b7e576000614ab9600183615722565b8554909150600090614acd90600190615722565b9050818114614b32576000866000018281548110614aed57614aed6154cd565b9060005260206000200154905080876000018481548110614b1057614b106154cd565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b4357614b436159fa565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107dc565b60009150506107dc565b6040518060800160405280614b9b614c3a565b81526020016000815260200160008152602001600081525090565b828054614bc2906153d5565b90600052602060002090601f016020900481019282614be45760008555614c2a565b82601f10614bfd57805160ff1916838001178555614c2a565b82800160010185558215614c2a579182015b82811115614c2a578251825591602001919060010190614c0f565b50614c36929150614cbe565b5090565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016060815260200160006001600160a01b03168152602001606081525090565b508054614c94906153d5565b6000825580601f10614ca4575050565b601f01602090049060005260206000209081019061318091905b5b80821115614c365760008155600101614cbf565b600060208284031215614ce557600080fd5b5035919050565b6001600160e01b03198116811461318057600080fd5b600060208284031215614d1457600080fd5b8135611bd581614cec565b80356001600160a01b0381168114614d3657600080fd5b919050565b60008060408385031215614d4e57600080fd5b614d5783614d1f565b915060208301356001600160601b0381168114614d7357600080fd5b809150509250929050565b60005b83811015614d99578181015183820152602001614d81565b838111156118965750506000910152565b60008151808452614dc2816020860160208601614d7e565b601f01601f19169290920160200192915050565b602081526000611bd56020830184614daa565b60008060408385031215614dfc57600080fd5b614e0583614d1f565b946020939093013593505050565b600080600060608486031215614e2857600080fd5b614e3184614d1f565b9250614e3f60208501614d1f565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115614e7f57614e7f614e4f565b604051601f8501601f19908116603f01168101908282118183101715614ea757614ea7614e4f565b81604052809350858152868686011115614ec057600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112614eeb57600080fd5b611bd583833560208501614e65565b600080600080600080600060e0888a031215614f1557600080fd5b873596506020880135955060408801356001600160401b0380821115614f3a57600080fd5b614f468b838c01614eda565b965060608a0135955060808a0135945060a08a0135935060c08a0135915080821115614f7157600080fd5b50614f7e8a828b01614eda565b91505092959891949750929550565b60008060408385031215614fa057600080fd5b50508035926020909101359150565b60008060408385031215614fc257600080fd5b82359150614fd260208401614d1f565b90509250929050565b600060208284031215614fed57600080fd5b81356001600160401b0381111561500357600080fd5b6130c684828501614eda565b600080600080600080600080610100898b03121561502c57600080fd5b883597506020890135965060408901359550606089013594506080890135935060a08901356001600160401b038082111561506657600080fd5b6150728c838d01614eda565b945061508060c08c01614d1f565b935060e08b013591508082111561509657600080fd5b506150a38b828c01614eda565b9150509295985092959890939650565b60008083601f8401126150c557600080fd5b5081356001600160401b038111156150dc57600080fd5b6020830191508360208260051b8501011115610ff857600080fd5b6000806020838503121561510a57600080fd5b82356001600160401b0381111561512057600080fd5b61512c858286016150b3565b90969095509350505050565b60006020828403121561514a57600080fd5b611bd582614d1f565b6000610100825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a08301518160a086015261519b82860182614daa565b91505060018060a01b0360c08401511660c085015260e083015184820360e08601526151c78282614daa565b95945050505050565b602081526000611bd56020830184615153565b801515811461318057600080fd5b6000806000806060858703121561520757600080fd5b84356001600160401b0381111561521d57600080fd5b615229878288016150b3565b909550935050602085013561523d816151e3565b9396929550929360400135925050565b60208152600082516080602084015261526960a0840182615153565b90506020840151604084015260408401516060840152606084015160808401528091505092915050565b600080604083850312156152a657600080fd5b6152af83614d1f565b91506020830135614d73816151e3565b600080600080608085870312156152d557600080fd5b6152de85614d1f565b93506152ec60208601614d1f565b92506040850135915060608501356001600160401b0381111561530e57600080fd5b8501601f8101871361531f57600080fd5b61532e87823560208401614e65565b91505092959194509250565b6000806000806080858703121561535057600080fd5b8435935060208501356001600160401b038082111561536e57600080fd5b61537a88838901614eda565b945061538860408801614d1f565b9350606087013591508082111561539e57600080fd5b5061532e87828801614eda565b600080604083850312156153be57600080fd5b6153c783614d1f565b9150614fd260208401614d1f565b600181811c908216806153e957607f821691505b6020821081141561540a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60006020828403121561546f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156154a6576154a6615476565b500290565b6000826154c857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006000198214156154f7576154f7615476565b5060010190565b60006020828403121561551057600080fd5b8151611bd5816151e3565b6000815161552d818560208601614d7e565b9290920192915050565b60008351615549818460208801614d7e565b83519083019061555d818360208801614d7e565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b607b60f81b815268113730b6b2911d101160b91b600182015284516000906155da81600a850160208a01614d7e565b61202360f01b600a9184019182015285516155fc81600c840160208a01614d7e565b61088b60f21b600c92909101918201527f226465736372697074696f6e223a20222450494e4120436f75706f6e73206f6e600e8201527f20636861696e2c2068747470733a2f2f7777772e646f6e746469656d656d652e602e8201526918dbdb4bdc1a5b98488b60b21b604e820152691134b6b0b3b2911d101160b11b60588201526156d26156c56156bf6156a5615697606286018a61551b565b61088b60f21b815260020190565b6d01130ba3a3934b13aba32b9911d160951b8152600e0190565b8661551b565b607d60f81b815260010190565b979650505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161571581601d850160208701614d7e565b91909101601d0192915050565b60008282101561573457615734615476565b500390565b6000821982111561574c5761574c615476565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615826816017850160208801614d7e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615857816028840160208801614d7e565b01602801949350505050565b60008351615875818460208801614d7e565b600b60fa1b9083019081528351615893816001840160208801614d7e565b01600101949350505050565b600082516158b1818460208701614d7e565b605d60f81b920191825250600101919050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fb390830184614daa565b60006020828403121561590957600080fd5b8151611bd581614cec565b60008161592357615923615476565b506000190190565b6e113a3930b4ba2fba3cb832911d101160891b8152815160009061595681600f850160208701614d7e565b61088b60f21b600f939091019283015250601101919050565b69113b30b63ab2911d101160b11b8152815160009061599581600a850160208701614d7e565b601160f91b600a939091019283015250600b01919050565b607b60f81b8152600083516159c9816001850160208801614d7e565b8351908301906159e0816001840160208801614d7e565b607d60f81b60019290910191820152600201949350505050565b634e487b7160e01b600052603160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c1491f8c67751d07e597646466bb51a37330c9bdc2b811e39cca9dee646cbfbc64736f6c63430008090033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102f05760003560e01c806370a082311161019d578063b88d4fde116100e9578063c87b56dd116100a2578063d547741f1161007c578063d547741f1461074e578063e985e9c514610761578063f2fde38b1461079d578063f4896d0e146107b057600080fd5b8063c87b56dd146106fe578063ca15c87314610711578063cd53d08e1461072457600080fd5b8063b88d4fde14610661578063bd85b03914610674578063be77ccf514610695578063bffb9620146106c5578063c4d66de8146106d8578063c84f818b146106eb57600080fd5b8063936e3169116101565780639b8909a5116101305780639b8909a5146106135780639ebac91414610633578063a217fddf14610646578063a22cb4651461064e57600080fd5b8063936e3169146105d857806394ac9968146105f857806395d89b411461060b57600080fd5b806370a082311461056e578063715018a614610581578063869f7594146105895780638da5cb5b146105aa5780639010d07c146105b257806391d14854146105c557600080fd5b80632f2ff15d1161025c57806342842e0e1161021557806353ca516d116101ef57806353ca516d146105225780636352211e146105355780636637b8821461054857806367034fbe1461055b57600080fd5b806342842e0e146104e957806347591135146104fc5780634ffab34b1461050f57600080fd5b80632f2ff15d1461046357806330176e1314610476578063356ea6c61461048957806336568abe146104b05780633755f665146104c35780633d6a8d34146104d657600080fd5b806323b872dd116102ae57806323b872dd146103b4578063248a9ca3146103c7578063248b47fe146103ea5780632693ebf2146103fd57806326fffb721461041e5780632a55205a1461043157600080fd5b80624221f0146102f557806301ffc9a71461032957806302fa7c471461034c57806306fdde0314610361578063081812fc14610376578063095ea7b3146103a1575b600080fd5b610316610303366004614cd3565b6101336020526000908152604090205481565b6040519081526020015b60405180910390f35b61033c610337366004614d02565b6107d1565b6040519015158152602001610320565b61035f61035a366004614d3b565b6107e2565b005b6103696107fc565b6040516103209190614dd6565b610389610384366004614cd3565b61088e565b6040516001600160a01b039091168152602001610320565b61035f6103af366004614de9565b6108b5565b61035f6103c2366004614e13565b6109cb565b6103166103d5366004614cd3565b60009081526065602052604090206001015490565b61035f6103f8366004614efa565b6109fc565b61031661040b366004614cd3565b6101326020526000908152604090205481565b61035f61042c366004614cd3565b610a29565b61044461043f366004614f8d565b610f51565b604080516001600160a01b039093168352602083019190915201610320565b61035f610471366004614faf565b610fff565b61035f610484366004614fdb565b611024565b6103167f84f866be4904f319a18e8cf4db8f4b76d6ec7d27860173c125ec640353a62a7981565b61035f6104be366004614faf565b611043565b6103166104d136600461500f565b6110c1565b6103166104e4366004614cd3565b6111c7565b61035f6104f7366004614e13565b611389565b61038961050a3660046150f7565b6113a4565b61035f61051d366004614cd3565b61149a565b610316610530366004614cd3565b61189c565b610389610543366004614cd3565b611a64565b61035f610556366004615138565b611ac4565b61035f610569366004614fdb565b611af3565b61031661057c366004615138565b611b12565b61035f611b98565b610316610597366004614cd3565b6000908152610133602052604090205490565b610389611bac565b6103896105c0366004614f8d565b611bbd565b61033c6105d3366004614faf565b611bdc565b6105eb6105e6366004614cd3565b611c07565b60405161032091906151d0565b61035f6106063660046151f1565b611da3565b610369611e15565b610626610621366004614cd3565b611e24565b604051610320919061524d565b6103166106413660046150f7565b611fe8565b610316600081565b61035f61065c366004615293565b612200565b61035f61066f3660046152bf565b61220b565b610316610682366004614cd3565b6000908152610132602052604090205490565b6106a86106a3366004614cd3565b61223d565b604080519315158452602084019290925290820152606001610320565b6103166106d336600461533a565b612274565b61035f6106e6366004615138565b612758565b6103166106f9366004614cd3565b612c81565b61036961070c366004614cd3565b612fbd565b61031661071f366004614cd3565b6130ce565b610389610732366004614cd3565b610131602052600090815260409020546001600160a01b031681565b61035f61075c366004614faf565b6130e5565b61033c61076f3660046153ab565b6001600160a01b03918216600090815260d06020908152604080832093909416825291909152205460ff1690565b61035f6107ab366004615138565b61310a565b6103166107be366004614cd3565b6101346020526000908152604090205481565b60006107dc82613183565b92915050565b60006107ed816131c3565b6107f783836131cd565b505050565b606060cb805461080b906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610837906153d5565b80156108845780601f1061085957610100808354040283529160200191610884565b820191906000526020600020905b81548152906001019060200180831161086757829003601f168201915b5050505050905090565b6000610899826132ca565b50600090815260cf60205260409020546001600160a01b031690565b60006108c082611a64565b9050806001600160a01b0316836001600160a01b031614156109335760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061094f575061094f813361076f565b6109c15760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161092a565b6107f78383613329565b6109d53382613397565b6109f15760405162461bcd60e51b815260040161092a90615410565b6107f7838383613415565b6000610a07816131c3565b610a1f87610a1a8a8a8a8a8a8a8a613586565b61360c565b5050505050505050565b6000610a3482612c81565b61015a546040516370a0823160e01b815233600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b158015610a7d57600080fd5b505afa158015610a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab5919061545d565b1015610af85760405162461bcd60e51b81526020600482015260126024820152716e6f7420656e6f7567682062616c616e636560701b604482015260640161092a565b61015a5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610b4557600080fd5b505af1158015610b59573d6000803e3d6000fd5b50505050600061015960009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bae57600080fd5b505afa158015610bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be6919061545d565b905060006101576000858152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054610c4c906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610c78906153d5565b8015610cc55780601f10610c9a57610100808354040283529160200191610cc5565b820191906000526020600020905b815481529060010190602001808311610ca857829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191610cf5906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610d21906153d5565b8015610d6e5780601f10610d4357610100808354040283529160200191610d6e565b820191906000526020600020905b815481529060010190602001808311610d5157829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615610e16576000610d9b8460646136a6565b9050610da784826136b2565b61015a5460c08401516040516340c10f1960e01b81526001600160a01b0391821660048201526024810185905292965016906340c10f1990604401600060405180830381600087803b158015610dfc57600080fd5b505af1158015610e10573d6000803e3d6000fd5b50505050505b610e1e614b88565b81815260608101849052602081018390526080820151610e3f9084906136be565b60408201526000610e5033876136ca565b9050610e8581610a1a8884866000015160a00151876000015160200151886060015189604001518a6000015160e00151613586565b60008181526101586020908152604091829020845180518255808301516001830155928301516002820155606083015160038201556080830151600482015560a08301518051869492938492610ee49260058501929190910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051610f26916007840191602090910190614bb6565b5050506020820151600882015560408201516009820155606090910151600a90910155505050505050565b600082815260ca602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610fc657506040805180820190915260c9546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610fe5906001600160601b03168761548c565b610fef91906154ab565b91519350909150505b9250929050565b60008281526065602052604090206001015461101a816131c3565b6107f783836137e1565b600061102f816131c3565b81516107f79061012f906020850190614bb6565b6001600160a01b03811633146110b35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161092a565b6110bd8282613803565b5050565b6000806110cd816131c3565b6110d5614c3a565b8a8152602081018a905260408101899052606081018890526080810187905260a081018690526001600160a01b03851660c082015260e0810184905261111a88613825565b6000818152610157602090815260409182902084518155818501516001820155918401516002830155606084015160038301556080840151600483015560a0840151805193965084936111739260058501920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e082015180516111b5916007840191602090910190614bb6565b50905050505098975050505050505050565b6000818152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805485949392849290918491610120850191611232906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461125e906153d5565b80156112ab5780601f10611280576101008083540402835291602001916112ab565b820191906000526020600020905b81548152906001019060200180831161128e57829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916112db906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611307906153d5565b80156113545780601f1061132957610100808354040283529160200191611354565b820191906000526020600020905b81548152906001019060200180831161133757829003601f168201915b5050509190925250505081526008820154602082015260098201546040820152600a9091015460609182015201519392505050565b6107f78383836040518060200160405280600081525061220b565b6000816113e65760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420746f6b656e69647360801b604482015260640161092a565b600061140a848460008181106113fe576113fe6154cd565b90506020020135611a64565b90508260005b8181101561149057826001600160a01b03166114378787848181106113fe576113fe6154cd565b6001600160a01b0316146114805760405162461bcd60e51b815260206004820152601060248201526f646966666572656e74206f776e65727360801b604482015260640161092a565b611489816154e3565b9050611410565b5090949350505050565b6114a381611a64565b6001600160a01b0316336001600160a01b0316146114f35760405162461bcd60e51b815260206004820152600d60248201526c3737ba103a34329037bbb732b960991b604482015260640161092a565b610159546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611571919061545d565b6000838152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805495965093949293919284928491610120850191906115e0906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461160c906153d5565b80156116595780601f1061162e57610100808354040283529160200191611659565b820191906000526020600020905b81548152906001019060200180831161163c57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611689906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546116b5906153d5565b80156117025780601f106116d757610100808354040283529160200191611702565b820191906000526020600020905b8154815290600101906020018083116116e557829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a820154815250509050600061015960009054906101000a90046001600160a01b03166001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561178057600080fd5b505afa158015611794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b8919061545d565b90506117dd816117d761546085604001516138bb90919063ffffffff16565b906136a6565b8310156118225760405162461bcd60e51b81526020600482015260136024820152726e6f742072656465656d61626c65206e6f772160681b604482015260640161092a565b61015a5460608301516040516340c10f1960e01b815233600482015260248101919091526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561187557600080fd5b505af1158015611889573d6000803e3d6000fd5b50505050611896846138c7565b50505050565b6000818152610158602052604080822081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e0840152600482015461010084015260058201805485949392849290918491610120850191611907906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611933906153d5565b80156119805780601f1061195557610100808354040283529160200191611980565b820191906000526020600020905b81548152906001019060200180831161196357829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916119b0906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546119dc906153d5565b8015611a295780601f106119fe57610100808354040283529160200191611a29565b820191906000526020600020905b815481529060010190602001808311611a0c57829003601f168201915b505050919092525050508152600882015460208083019190915260098301546040830152600a90920154606090910152905101519392505050565b600081815260cd60205260408120546001600160a01b0316806107dc5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161092a565b6000611acf816131c3565b5061015980546001600160a01b0319166001600160a01b0392909216919091179055565b6000611afe816131c3565b81516107f79061015b906020850190614bb6565b60006001600160a01b038216611b7c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161092a565b506001600160a01b0316600090815260ce602052604090205490565b611ba0613907565b611baa6000613966565b565b6000611bb88180611bbd565b905090565b6000828152609760205260408120611bd590836139b9565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611c0f614c3a565b6101576000838152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054611c71906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611c9d906153d5565b8015611cea5780601f10611cbf57610100808354040283529160200191611cea565b820191906000526020600020905b815481529060010190602001808311611ccd57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611d1a906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611d46906153d5565b8015611d935780601f10611d6857610100808354040283529160200191611d93565b820191906000526020600020905b815481529060010190602001808311611d7657829003601f168201915b5050505050815250509050919050565b7f84f866be4904f319a18e8cf4db8f4b76d6ec7d27860173c125ec640353a62a79611dcd816131c3565b8360005b81811015611e0c57611dfc878783818110611dee57611dee6154cd565b9050602002013586866139c5565b611e05816154e3565b9050611dd1565b50505050505050565b606060cc805461080b906153d5565b611e2c614b88565b600082815261015860205260409081902081516101808101909252805460808301908152600182015460a0840152600282015460c0840152600382015460e08401526004820154610100840152600582018054849291849161012085019190611e94906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611ec0906153d5565b8015611f0d5780601f10611ee257610100808354040283529160200191611f0d565b820191906000526020600020905b815481529060010190602001808311611ef057829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191611f3d906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054611f69906153d5565b8015611fb65780601f10611f8b57610100808354040283529160200191611fb6565b820191906000526020600020905b815481529060010190602001808311611f9957829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a820154815250509050919050565b60008082815b81811015611490576000610158600088888581811061200f5761200f6154cd565b90506020020135815260200190815260200160002060405180608001604052908160008201604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054612082906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546120ae906153d5565b80156120fb5780601f106120d0576101008083540402835291602001916120fb565b820191906000526020600020905b8154815290600101906020018083116120de57829003601f168201915b505050918352505060068201546001600160a01b0316602082015260078201805460409092019161212b906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612157906153d5565b80156121a45780601f10612179576101008083540402835291602001916121a4565b820191906000526020600020905b81548152906001019060200180831161218757829003601f168201915b50505050508152505081526020016008820154815260200160098201548152602001600a8201548152505090506121ec816000015160200151856136be90919063ffffffff16565b935050806121f9906154e3565b9050611fee565b6110bd338383613af8565b6122153383613397565b6122315760405162461bcd60e51b815260040161092a90615410565b61189684848484613bc7565b600081815261013560209081526040808320546101369092528220548115612268576001925061226d565b600092505b9193909250565b600080612280816131c3565b60038611156122c05760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964207479706560a01b604482015260640161092a565b6122c8614c3a565b8661244e57604080516101008101825261013780548252610138546020830152610139549282019290925261013a54606082015261013b54608082015261013c805491929160a08401919061231c906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612348906153d5565b80156123955780601f1061236a57610100808354040283529160200191612395565b820191906000526020600020905b81548152906001019060200180831161237857829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916123c5906153d5565b80601f01602080910402602001604051908101604052809291908181526020018280546123f1906153d5565b801561243e5780601f106124135761010080835404028352916020019161243e565b820191906000526020600020905b81548152906001019060200180831161242157829003601f168201915b5050505050815250509050612684565b86600114156124a657604080516101008101825261013f805482526101405460208301526101415492820192909252610142546060820152610143546080820152610144805491929160a08401919061231c906153d5565b86600214156124fe57604080516101008101825261014780548252610148546020830152610149549282019290925261014a54606082015261014b54608082015261014c805491929160a08401919061231c906153d5565b866003141561268457604080516101008101825261014f805482526101505460208301526101515492820192909252610152546060820152610153546080820152610154805491929160a084019190612556906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612582906153d5565b80156125cf5780601f106125a4576101008083540402835291602001916125cf565b820191906000526020600020905b8154815290600101906020018083116125b257829003601f168201915b505050918352505060068201546001600160a01b031660208201526007820180546040909201916125ff906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461262b906153d5565b80156126785780601f1061264d57610100808354040283529160200191612678565b820191906000526020600020905b81548152906001019060200180831161265b57829003601f168201915b50505050508152505090505b60a081018690526001600160a01b03851660c082015260e0810184905260608101516126af90613825565b6000818152610157602090815260409182902084518155818501516001820155918401516002830155606084015160038301556080840151600483015560a0840151805193965084936127089260058501920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e0820151805161274a916007840191602090910190614bb6565b509050505050949350505050565b600054610100900460ff16158080156127785750600054600160ff909116105b806127925750303b158015612792575060005460ff166001145b6127f55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161092a565b6000805460ff191660011790558015612818576000805461ff0019166101001790555b6128636040518060400160405280600b81526020016a26b2b6b29021b7bab837b760a91b8152506040518060400160405280600681526020016521b7bab837b760d11b815250613bfa565b61286b613c2b565b612873613c2b565b61287f336101f46131cd565b61288a6000336137e1565b61015a80546001600160a01b0319166001600160a01b038416179055604080516101008101825260018152683635c9adc5dea00000602080830191825260648385019081526103e86060850190815260f06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e087019790975285516101379081559451610138559151610139555161013a555161013b5592518051929391926129439261013c920190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612985916007840191602090910190614bb6565b505060408051610100810182526002815269021e19e0c9bab2400000602080830191825260628385019081526064606085019081526101e06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e0870197909752855161013f90815594516101405591516101415551610142555161014355925180519294509092612a28926101449290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612a6a916007840191602090910190614bb6565b505060408051610100810182526003815269152d02c7e14af680000060208083019182526060838501818152600a9185019182526103c06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e08701979097528551610147908155945161014855905161014955905161014a555161014b55925180519294509092612b0d9261014c9290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612b4f916007840191602090910190614bb6565b505060408051610100810182526004815269d3c21bcecceda10000006020808301918252605e8385019081526003606085019081526105a06080860190815286518085018852600080825260a0880191825260c088018190528851808701909952885260e0870197909752855161014f90815594516101505591516101515551610152555161015355925180519294509092612bf2926101549290910190614bb6565b5060c08201516006820180546001600160a01b0319166001600160a01b0390921691909117905560e08201518051612c34916007840191602090910190614bb6565b5090505080156110bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60008061015960009054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b815260040160206040518083038186803b158015612cd357600080fd5b505afa158015612ce7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0b919061545d565b905061015960009054906101000a90046001600160a01b03166001600160a01b031663dd77a05b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d5c57600080fd5b505afa158015612d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9491906154fe565b15612da45750670c7d713b49da00005b670494654067e10000811015612dbf5750670494654067e100005b60006101576000858152602001908152602001600020604051806101000160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582018054612e23906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612e4f906153d5565b8015612e9c5780601f10612e7157610100808354040283529160200191612e9c565b820191906000526020600020905b815481529060010190602001808311612e7f57829003601f168201915b505050918352505060068201546001600160a01b03166020820152600782018054604090920191612ecc906153d5565b80601f0160208091040260200160405190810160405280929190818152602001828054612ef8906153d5565b8015612f455780601f10612f1a57610100808354040283529160200191612f45565b820191906000526020600020905b815481529060010190602001808311612f2857829003601f168201915b50505050508152505090506000612f75670de0b6b3a76400006117d78460200151866138bb90919063ffffffff16565b90506000612fb3670de0b6b3a7640000612fad670de0b6b3a76400006117d760646117d78960400151896138bb90919063ffffffff16565b906138bb565b9695505050505050565b6060612fc8826132ca565b600082815260fd602052604081208054612fe1906153d5565b80601f016020809104026020016040519081016040528092919081815260200182805461300d906153d5565b801561305a5780601f1061302f5761010080835404028352916020019161305a565b820191906000526020600020905b81548152906001019060200180831161303d57829003601f168201915b50505050509050600061307860408051602081019091526000815290565b905080516000141561308b575092915050565b8151156130bd5780826040516020016130a5929190615537565b60405160208183030381529060405292505050919050565b6130c684613c52565b949350505050565b60008181526097602052604081206107dc90613cc5565b600082815260656020526040902060010154613100816131c3565b6107f78383613803565b613112613907565b6001600160a01b0381166131775760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161092a565b61318081613966565b50565b60006001600160e01b031982166380ac58cd60e01b14806131b457506001600160e01b03198216635b5e139f60e01b145b806107dc57506107dc82613ccf565b6131808133613d04565b6127106001600160601b038216111561323b5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161092a565b6001600160a01b0382166132915760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161092a565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b9091021760c955565b600081815260cd60205260409020546001600160a01b03166131805760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161092a565b600081815260cf6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061335e82611a64565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806133a383611a64565b9050806001600160a01b0316846001600160a01b031614806133ea57506001600160a01b03808216600090815260d0602090815260408083209388168352929052205460ff165b806130c65750836001600160a01b03166134038461088e565b6001600160a01b031614949350505050565b826001600160a01b031661342882611a64565b6001600160a01b03161461344e5760405162461bcd60e51b815260040161092a90615566565b6001600160a01b0382166134b05760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161092a565b6134bd8383836001613d5d565b826001600160a01b03166134d082611a64565b6001600160a01b0316146134f65760405162461bcd60e51b815260040161092a90615566565b600081815260cf6020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260ce855283862080546000190190559087168086528386208054600101905586865260cd90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b606060008661359d6135988a8c6136b2565b613dba565b6135a68b613e56565b6135b289898989613e90565b6040516020016135c594939291906155ab565b60405160208183030381529060405290506135df81614018565b6040516020016135ef91906156dd565b604051602081830303815290604052915050979650505050505050565b600082815260cd60205260409020546001600160a01b03166136875760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161092a565b600082815260fd6020908152604090912082516107f792840190614bb6565b6000611bd582846154ab565b6000611bd58284615722565b6000611bd58284615739565b600081815261013160205260408120546001600160a01b031661372f5760405162461bcd60e51b815260206004820152601c60248201527f62617365546f6b656e4944206e6f74206265656e206372656174656400000000604482015260640161092a565b60008281526101336020908152604080832054610132909252909120541061378e5760405162461bcd60e51b815260206004820152601260248201527113585e081cdd5c1c1b1e481c995858da195960721b604482015260640161092a565b60006137998361416b565b90506137a58482614192565b6137ae8361432b565b600083815261013260205260409020546137c99060016136be565b60008481526101326020526040902055905092915050565b6137eb828261434e565b60008281526097602052604090206107f790826143d4565b61380d82826143e9565b60008281526097602052604090206107f79082614450565b6000620f4240821061386a5760405162461bcd60e51b815260206004820152600e60248201526d696e76616c696420737570706c7960901b604482015260640161092a565b6000613874614465565b905061387e614479565b60008181526101316020908152604080832080546001600160a01b0319163317905561013282528083208390556101339091529020929092555090565b6000611bd5828461548c565b6138d081614490565b600081815260fd6020526040902080546138e9906153d5565b15905061318057600081815260fd6020526040812061318091614c88565b33613910611bac565b6001600160a01b031614611baa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161092a565b61015c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611bd58383614533565b60008111613a075760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081d185cdac81a59608a1b604482015260640161092a565b8115613a5c5760008381526101356020908152604080832042905561013690915280822083905551829185917f365c7d7284755ed19e809683dfd787da1e8115e86c37612909e022f8ec85126f9190a3505050565b600083815261013660205260409020548114613aa95760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c81d185cdada5960a21b604482015260640161092a565b60008381526101356020908152604080832083905561013690915280822082905551829185917f29461b419f1938cf901704b3e90c50de5ce021544424551b5d65869b605f9dc69190a3505050565b816001600160a01b0316836001600160a01b03161415613b5a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161092a565b6001600160a01b03838116600081815260d06020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bd2848484613415565b613bde8484848461455d565b6118965760405162461bcd60e51b815260040161092a90615751565b600054610100900460ff16613c215760405162461bcd60e51b815260040161092a906157a3565b6110bd8282614667565b600054610100900460ff16611baa5760405162461bcd60e51b815260040161092a906157a3565b6060613c5d826132ca565b6000613c7460408051602081019091526000815290565b90506000815111613c945760405180602001604052806000815250611bd5565b80613c9e846146b5565b604051602001613caf929190615537565b6040516020818303038152906040529392505050565b60006107dc825490565b60006001600160e01b0319821663152a902d60e11b14806107dc57506301ffc9a760e01b6001600160e01b03198316146107dc565b613d0e8282611bdc565b6110bd57613d1b81614749565b613d2683602061475b565b604051602001613d379291906157ee565b60408051601f198184030181529082905262461bcd60e51b825261092a91600401614dd6565b60008281526101356020526040902054156118965760405162461bcd60e51b815260206004820152601c60248201527f63616e2774207472616e73666572207768696c65206a756963696e6700000000604482015260640161092a565b60606000613dc7836148f6565b60010190506000816001600160401b03811115613de657613de6614e4f565b6040519080825280601f01601f191660200182016040528015613e10576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613e4957613e4e565b613e1a565b509392505050565b6060613e606149ce565b613e6983613dba565b604051602001613e7a929190615537565b6040516020818303038152906040529050919050565b60408051808201825260018152605b60f81b6020808301919091528251808401909352600583526476616c756560d81b908301526060918190613ee790613ee26135988a670de0b6b3a76400006136a6565b6149de565b604051602001613ef8929190615537565b60408051601f198184030181528282019091526005825264189d5c9b9d60da1b602083015291508190613f3a90613ee261359889670de0b6b3a76400006136a6565b604051602001613f4b929190615863565b60408051601f19818403018152828201909152600a82526972656465656d61626c6560b01b602083015291508190613f8690613ee287613dba565b604051602001613f97929190615863565b60408051601f198184030181528282019091526006825265185c9d1a5cdd60d21b602083015291508190613fcb90856149de565b604051602001613fdc929190615863565b604051602081830303815290604052905080604051602001613ffe919061589f565b60408051808303601f190181529190529695505050505050565b606081516000141561403857505060408051602081019091526000815290565b6000604051806060016040528060408152602001615a1160409139905060006003845160026140679190615739565b61407191906154ab565b61407c90600461548c565b6001600160401b0381111561409357614093614e4f565b6040519080825280601f01601f1916602001820160405280156140bd576020820181803683370190505b509050600182016020820185865187015b80821015614129576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506140ce565b5050600386510660018114614145576002811461415857614160565b603d6001830353603d6002830353614160565b603d60018303535b509195945050505050565b600081815261013460205260408120546107dc90839061418c9060016136be565b906136be565b6001600160a01b0382166141e85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161092a565b600081815260cd60205260409020546001600160a01b03161561424d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161092a565b61425b600083836001613d5d565b600081815260cd60205260409020546001600160a01b0316156142c05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161092a565b6001600160a01b038216600081815260ce602090815260408083208054600101905584835260cd90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815261013460205260408120805491614346836154e3565b919050555050565b6143588282611bdc565b6110bd5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556143903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611bd5836001600160a01b038416614a46565b6143f38282611bdc565b156110bd5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611bd5836001600160a01b038416614a95565b61013054600090611bb890620f42406136be565b6101305461448a90620f42406136be565b61013055565b600061449b82611a64565b90506144ab816000846001613d5d565b6144b482611a64565b600083815260cf6020908152604080832080546001600160a01b03199081169091556001600160a01b03851680855260ce8452828520805460001901905587855260cd909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082600001828154811061454a5761454a6154cd565b9060005260206000200154905092915050565b60006001600160a01b0384163b1561465f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906145a19033908990889088906004016158c4565b602060405180830381600087803b1580156145bb57600080fd5b505af19250505080156145eb575060408051601f3d908101601f191682019092526145e8918101906158f7565b60015b614645573d808015614619576040519150601f19603f3d011682016040523d82523d6000602084013e61461e565b606091505b50805161463d5760405162461bcd60e51b815260040161092a90615751565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506130c6565b5060016130c6565b600054610100900460ff1661468e5760405162461bcd60e51b815260040161092a906157a3565b81516146a19060cb906020850190614bb6565b5080516107f79060cc906020840190614bb6565b606060006146c2836148f6565b60010190506000816001600160401b038111156146e1576146e1614e4f565b6040519080825280601f01601f19166020018201604052801561470b576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461474457613e4e565b614715565b60606107dc6001600160a01b03831660145b6060600061476a83600261548c565b614775906002615739565b6001600160401b0381111561478c5761478c614e4f565b6040519080825280601f01601f1916602001820160405280156147b6576020820181803683370190505b509050600360fc1b816000815181106147d1576147d16154cd565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614800576148006154cd565b60200101906001600160f81b031916908160001a905350600061482484600261548c565b61482f906001615739565b90505b60018111156148a7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614863576148636154cd565b1a60f81b828281518110614879576148796154cd565b60200101906001600160f81b031916908160001a90535060049490941c936148a081615914565b9050614832565b508315611bd55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161092a565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106149355772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614961576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061497f57662386f26fc10000830492506010015b6305f5e1008310614997576305f5e100830492506008015b61271083106149ab57612710830492506004015b606483106149bd576064830492506002015b600a83106107dc5760010192915050565b606061015b805461080b906153d5565b6060826040516020016149f1919061592b565b60405160208183030381529060405282604051602001614a11919061596f565b60408051601f1981840301815290829052614a2f92916020016159ad565b604051602081830303815290604052905092915050565b6000818152600183016020526040812054614a8d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107dc565b5060006107dc565b60008181526001830160205260408120548015614b7e576000614ab9600183615722565b8554909150600090614acd90600190615722565b9050818114614b32576000866000018281548110614aed57614aed6154cd565b9060005260206000200154905080876000018481548110614b1057614b106154cd565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b4357614b436159fa565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107dc565b60009150506107dc565b6040518060800160405280614b9b614c3a565b81526020016000815260200160008152602001600081525090565b828054614bc2906153d5565b90600052602060002090601f016020900481019282614be45760008555614c2a565b82601f10614bfd57805160ff1916838001178555614c2a565b82800160010185558215614c2a579182015b82811115614c2a578251825591602001919060010190614c0f565b50614c36929150614cbe565b5090565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016060815260200160006001600160a01b03168152602001606081525090565b508054614c94906153d5565b6000825580601f10614ca4575050565b601f01602090049060005260206000209081019061318091905b5b80821115614c365760008155600101614cbf565b600060208284031215614ce557600080fd5b5035919050565b6001600160e01b03198116811461318057600080fd5b600060208284031215614d1457600080fd5b8135611bd581614cec565b80356001600160a01b0381168114614d3657600080fd5b919050565b60008060408385031215614d4e57600080fd5b614d5783614d1f565b915060208301356001600160601b0381168114614d7357600080fd5b809150509250929050565b60005b83811015614d99578181015183820152602001614d81565b838111156118965750506000910152565b60008151808452614dc2816020860160208601614d7e565b601f01601f19169290920160200192915050565b602081526000611bd56020830184614daa565b60008060408385031215614dfc57600080fd5b614e0583614d1f565b946020939093013593505050565b600080600060608486031215614e2857600080fd5b614e3184614d1f565b9250614e3f60208501614d1f565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115614e7f57614e7f614e4f565b604051601f8501601f19908116603f01168101908282118183101715614ea757614ea7614e4f565b81604052809350858152868686011115614ec057600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112614eeb57600080fd5b611bd583833560208501614e65565b600080600080600080600060e0888a031215614f1557600080fd5b873596506020880135955060408801356001600160401b0380821115614f3a57600080fd5b614f468b838c01614eda565b965060608a0135955060808a0135945060a08a0135935060c08a0135915080821115614f7157600080fd5b50614f7e8a828b01614eda565b91505092959891949750929550565b60008060408385031215614fa057600080fd5b50508035926020909101359150565b60008060408385031215614fc257600080fd5b82359150614fd260208401614d1f565b90509250929050565b600060208284031215614fed57600080fd5b81356001600160401b0381111561500357600080fd5b6130c684828501614eda565b600080600080600080600080610100898b03121561502c57600080fd5b883597506020890135965060408901359550606089013594506080890135935060a08901356001600160401b038082111561506657600080fd5b6150728c838d01614eda565b945061508060c08c01614d1f565b935060e08b013591508082111561509657600080fd5b506150a38b828c01614eda565b9150509295985092959890939650565b60008083601f8401126150c557600080fd5b5081356001600160401b038111156150dc57600080fd5b6020830191508360208260051b8501011115610ff857600080fd5b6000806020838503121561510a57600080fd5b82356001600160401b0381111561512057600080fd5b61512c858286016150b3565b90969095509350505050565b60006020828403121561514a57600080fd5b611bd582614d1f565b6000610100825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a08301518160a086015261519b82860182614daa565b91505060018060a01b0360c08401511660c085015260e083015184820360e08601526151c78282614daa565b95945050505050565b602081526000611bd56020830184615153565b801515811461318057600080fd5b6000806000806060858703121561520757600080fd5b84356001600160401b0381111561521d57600080fd5b615229878288016150b3565b909550935050602085013561523d816151e3565b9396929550929360400135925050565b60208152600082516080602084015261526960a0840182615153565b90506020840151604084015260408401516060840152606084015160808401528091505092915050565b600080604083850312156152a657600080fd5b6152af83614d1f565b91506020830135614d73816151e3565b600080600080608085870312156152d557600080fd5b6152de85614d1f565b93506152ec60208601614d1f565b92506040850135915060608501356001600160401b0381111561530e57600080fd5b8501601f8101871361531f57600080fd5b61532e87823560208401614e65565b91505092959194509250565b6000806000806080858703121561535057600080fd5b8435935060208501356001600160401b038082111561536e57600080fd5b61537a88838901614eda565b945061538860408801614d1f565b9350606087013591508082111561539e57600080fd5b5061532e87828801614eda565b600080604083850312156153be57600080fd5b6153c783614d1f565b9150614fd260208401614d1f565b600181811c908216806153e957607f821691505b6020821081141561540a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60006020828403121561546f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156154a6576154a6615476565b500290565b6000826154c857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006000198214156154f7576154f7615476565b5060010190565b60006020828403121561551057600080fd5b8151611bd5816151e3565b6000815161552d818560208601614d7e565b9290920192915050565b60008351615549818460208801614d7e565b83519083019061555d818360208801614d7e565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b607b60f81b815268113730b6b2911d101160b91b600182015284516000906155da81600a850160208a01614d7e565b61202360f01b600a9184019182015285516155fc81600c840160208a01614d7e565b61088b60f21b600c92909101918201527f226465736372697074696f6e223a20222450494e4120436f75706f6e73206f6e600e8201527f20636861696e2c2068747470733a2f2f7777772e646f6e746469656d656d652e602e8201526918dbdb4bdc1a5b98488b60b21b604e820152691134b6b0b3b2911d101160b11b60588201526156d26156c56156bf6156a5615697606286018a61551b565b61088b60f21b815260020190565b6d01130ba3a3934b13aba32b9911d160951b8152600e0190565b8661551b565b607d60f81b815260010190565b979650505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161571581601d850160208701614d7e565b91909101601d0192915050565b60008282101561573457615734615476565b500390565b6000821982111561574c5761574c615476565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615826816017850160208801614d7e565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615857816028840160208801614d7e565b01602801949350505050565b60008351615875818460208801614d7e565b600b60fa1b9083019081528351615893816001840160208801614d7e565b01600101949350505050565b600082516158b1818460208701614d7e565b605d60f81b920191825250600101919050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fb390830184614daa565b60006020828403121561590957600080fd5b8151611bd581614cec565b60008161592357615923615476565b506000190190565b6e113a3930b4ba2fba3cb832911d101160891b8152815160009061595681600f850160208701614d7e565b61088b60f21b600f939091019283015250601101919050565b69113b30b63ab2911d101160b11b8152815160009061599581600a850160208701614d7e565b601160f91b600a939091019283015250600b01919050565b607b60f81b8152600083516159c9816001850160208801614d7e565b8351908301906159e0816001840160208801614d7e565b607d60f81b60019290910191820152600201949350505050565b634e487b7160e01b600052603160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c1491f8c67751d07e597646466bb51a37330c9bdc2b811e39cca9dee646cbfbc64736f6c63430008090033