ETH Price: $3,486.89 (+2.00%)

Contract

0x845dD2a7eE2a92A0518AB2135365Ed63fdbA0C88
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...214516112024-12-21 14:54:353 days ago1734792875IN
0x845dD2a7...3fdbA0C88
0 ETH0.000460339.98014993
Set Approval For...214515932024-12-21 14:50:593 days ago1734792659IN
0x845dD2a7...3fdbA0C88
0 ETH0.000443339.61164684
Set Approval For...214205512024-12-17 6:45:597 days ago1734417959IN
0x845dD2a7...3fdbA0C88
0 ETH0.000439169.52113246
Set Approval For...213568612024-12-08 9:25:3516 days ago1733649935IN
0x845dD2a7...3fdbA0C88
0 ETH0.000387318.38177197
Set Approval For...213417412024-12-06 6:44:1118 days ago1733467451IN
0x845dD2a7...3fdbA0C88
0 ETH0.0006508414.11055151
Approve For All ...213297152024-12-04 14:25:1120 days ago1733322311IN
0x845dD2a7...3fdbA0C88
0 ETH0.0022170148.04561895
Set Approval For...213091782024-12-01 17:32:4723 days ago1733074367IN
0x845dD2a7...3fdbA0C88
0 ETH0.0009465920.52248916
Approve For All ...213044872024-12-01 1:50:4723 days ago1733017847IN
0x845dD2a7...3fdbA0C88
0 ETH0.0005256311.39108301
Approve For All ...212538672024-11-23 23:57:3530 days ago1732406255IN
0x845dD2a7...3fdbA0C88
0 ETH0.0005108111.07004919
Mint212465902024-11-22 23:35:4731 days ago1732318547IN
0x845dD2a7...3fdbA0C88
0 ETH0.0033160313.18644431
Transfer Seed212465072024-11-22 23:18:5931 days ago1732317539IN
0x845dD2a7...3fdbA0C88
0 ETH0.0007073714.87080462
Safe Transfer Fr...212444902024-11-22 16:33:2332 days ago1732293203IN
0x845dD2a7...3fdbA0C88
0 ETH0.0013134314.78524242
Safe Transfer Fr...211750512024-11-13 0:01:1141 days ago1731456071IN
0x845dD2a7...3fdbA0C88
0 ETH0.0018290420.59223867
Set Approval For...210652402024-10-28 16:11:2357 days ago1730131883IN
0x845dD2a7...3fdbA0C88
0 ETH0.0006492814.07662942
Safe Transfer Fr...209968092024-10-19 3:04:2366 days ago1729307063IN
0x845dD2a7...3fdbA0C88
0 ETH0.000843569.49597553
Approve For All ...209763952024-10-16 6:40:5969 days ago1729060859IN
0x845dD2a7...3fdbA0C88
0 ETH0.000449069.73183987
Safe Transfer Fr...209143852024-10-07 14:48:4778 days ago1728312527IN
0x845dD2a7...3fdbA0C88
0 ETH0.0050594349.05977719
Set Approval For...208671332024-10-01 0:43:1184 days ago1727743391IN
0x845dD2a7...3fdbA0C88
0 ETH0.000302466.54559549
Set Approval For...208671262024-10-01 0:41:4784 days ago1727743307IN
0x845dD2a7...3fdbA0C88
0 ETH0.000304636.60451285
Mint208538292024-09-29 4:12:3586 days ago1727583155IN
0x845dD2a7...3fdbA0C88
0 ETH0.001503055.68143175
Transfer Seed208524492024-09-28 23:34:5986 days ago1727566499IN
0x845dD2a7...3fdbA0C88
0 ETH0.000190786.26269093
Transfer Seed208524322024-09-28 23:31:3586 days ago1727566295IN
0x845dD2a7...3fdbA0C88
0 ETH0.000188526.19096521
Mint208523032024-09-28 23:05:4786 days ago1727564747IN
0x845dD2a7...3fdbA0C88
0 ETH0.001528136.07668129
Mint208519362024-09-28 21:51:5987 days ago1727560319IN
0x845dD2a7...3fdbA0C88
0 ETH0.001423255.59729064
Safe Transfer Fr...208518662024-09-28 21:37:4787 days ago1727559467IN
0x845dD2a7...3fdbA0C88
0 ETH0.000549736.18745541
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
QQL

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200000 runs

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

import "./ERC721TokenUriDelegate.sol";
import "./ERC721OperatorFilter.sol";
import "./MintPass.sol";

contract QQL is
    Ownable,
    ERC721OperatorFilter,
    ERC721TokenUriDelegate,
    ERC721Enumerable
{
    MintPass immutable pass_;
    uint256 nextTokenId_ = 1;
    mapping(uint256 => bytes32) tokenSeed_;
    mapping(bytes32 => uint256) seedToTokenId_;
    mapping(uint256 => string) scriptPieces_;

    /// By default, an artist has the right to mint all of their seeds. However,
    /// they may irrevocably transfer that right, at which point the current owner
    /// of the right has exclusive opportunity to mint it.
    mapping(bytes32 => address) seedOwners_;
    /// If seed approval is given, then the approved party may claim rights for any
    /// seed.
    mapping(address => mapping(address => bool)) approvalForAllSeeds_;

    mapping(uint256 => address payable) tokenRoyaltyRecipient_;
    address payable projectRoyaltyRecipient_;
    uint256 constant PROJECT_ROYALTY_BPS = 500; // 5%
    uint256 constant TOKEN_ROYALTY_BPS = 200; // 2%
    uint256 immutable unlockTimestamp_;
    uint256 immutable maxPremintPassId_;

    event SeedTransfer(
        address indexed from,
        address indexed to,
        bytes32 indexed seed
    );
    event ApprovalForAllSeeds(
        address indexed owner,
        address indexed operator,
        bool approved
    );

    event TokenRoyaltyRecipientChange(
        uint256 indexed tokenId,
        address indexed newRecipient
    );

    event ProjectRoyaltyRecipientChange(address indexed newRecipient);

    constructor(
        MintPass pass,
        uint256 maxPremintPassId,
        uint256 unlockTimestamp
    ) ERC721("", "") {
        pass_ = pass;
        maxPremintPassId_ = maxPremintPassId;
        unlockTimestamp_ = unlockTimestamp;
    }

    function name() public pure override returns (string memory) {
        return "QQL";
    }

    function symbol() public pure override returns (string memory) {
        return "QQL";
    }

    function setScriptPiece(uint256 id, string memory data) external onlyOwner {
        if (bytes(scriptPieces_[id]).length != 0)
            revert("QQL: script pieces are immutable");

        scriptPieces_[id] = data;
    }

    function scriptPiece(uint256 id) external view returns (string memory) {
        return scriptPieces_[id];
    }

    function transferSeed(
        address from,
        address to,
        bytes32 seed
    ) external {
        if (!isApprovedOrOwnerForSeed(msg.sender, seed))
            revert("QQL: unauthorized for seed");
        if (ownerOfSeed(seed) != from) revert("QQL: wrong owner for seed");
        if (to == address(0)) revert("QQL: can't send seed to zero address");
        emit SeedTransfer(from, to, seed);
        seedOwners_[seed] = to;
    }

    function ownerOfSeed(bytes32 seed) public view returns (address) {
        address explicitOwner = seedOwners_[seed];
        if (explicitOwner == address(0)) {
            return address(bytes20(seed));
        }
        return explicitOwner;
    }

    function approveForAllSeeds(address operator, bool approved) external {
        address artist = msg.sender;
        approvalForAllSeeds_[artist][operator] = approved;
        emit ApprovalForAllSeeds(msg.sender, operator, approved);
    }

    function isApprovedForAllSeeds(address owner, address operator)
        external
        view
        returns (bool)
    {
        return approvalForAllSeeds_[owner][operator];
    }

    function isApprovedOrOwnerForSeed(address operator, bytes32 seed)
        public
        view
        returns (bool)
    {
        address seedOwner = ownerOfSeed(seed);
        if (seedOwner == operator) {
            return true;
        }
        return approvalForAllSeeds_[seedOwner][operator];
    }

    function mint(uint256 mintPassId, bytes32 seed) external returns (uint256) {
        return mintTo(mintPassId, seed, msg.sender);
    }

    /// Consumes the specified mint pass to mint a QQL with the specified seed,
    /// which will be owned by the specified recipient. The royalty stream will
    /// be owned by the original parametric artist (the address embedded in the
    /// seed).
    ///
    /// The caller must be authorized by the owner of the mint pass to operate
    /// the mint pass, and the recipient must be authorized by the owner of the
    /// seed to operate the seed.
    ///
    /// Returns the ID of the newly minted QQL token.
    function mintTo(
        uint256 mintPassId,
        bytes32 seed,
        address recipient
    ) public returns (uint256) {
        if (!isApprovedOrOwnerForSeed(recipient, seed))
            revert("QQL: unauthorized for seed");
        if (!pass_.isApprovedOrOwner(msg.sender, mintPassId))
            revert("QQL: unauthorized for pass");
        if (seedToTokenId_[seed] != 0) revert("QQL: seed already used");
        if (
            block.timestamp < unlockTimestamp_ && mintPassId > maxPremintPassId_
        ) revert("QQL: mint pass not yet unlocked");

        uint256 tokenId = nextTokenId_++;
        tokenSeed_[tokenId] = seed;
        seedToTokenId_[seed] = tokenId;
        // Royalty recipient is always the original artist, which may be
        // distinct from the minter (`msg.sender`).
        tokenRoyaltyRecipient_[tokenId] = payable(address(bytes20(seed)));
        pass_.burn(mintPassId);
        _safeMint(recipient, tokenId);
        return tokenId;
    }

    function parametricArtist(uint256 tokenId) external view returns (address) {
        bytes32 seed = tokenSeed_[tokenId];
        if (seed == bytes32(0)) revert("QQL: token does not exist");
        return address(bytes20(seed));
    }

    function setProjectRoyaltyRecipient(address payable recipient)
        public
        onlyOwner
    {
        projectRoyaltyRecipient_ = recipient;
        emit ProjectRoyaltyRecipientChange(recipient);
    }

    function projectRoyaltyRecipient() external view returns (address payable) {
        return projectRoyaltyRecipient_;
    }

    function tokenRoyaltyRecipient(uint256 tokenId)
        external
        view
        returns (address)
    {
        return tokenRoyaltyRecipient_[tokenId];
    }

    function changeTokenRoyaltyRecipient(
        uint256 tokenId,
        address payable newRecipient
    ) external {
        if (tokenRoyaltyRecipient_[tokenId] != msg.sender) {
            revert("QQL: unauthorized");
        }
        if (newRecipient == address(0)) {
            revert("QQL: can't set zero address as token royalty recipient");
        }
        emit TokenRoyaltyRecipientChange(tokenId, newRecipient);
        tokenRoyaltyRecipient_[tokenId] = newRecipient;
    }

    function getRoyalties(uint256 tokenId)
        external
        view
        returns (address payable[] memory recipients, uint256[] memory bps)
    {
        recipients = new address payable[](2);
        bps = new uint256[](2);
        recipients[0] = projectRoyaltyRecipient_;
        recipients[1] = tokenRoyaltyRecipient_[tokenId];
        if (recipients[1] == address(0)) {
            revert("QQL: royalty for nonexistent token");
        }
        bps[0] = PROJECT_ROYALTY_BPS;
        bps[1] = TOKEN_ROYALTY_BPS;
    }

    /// Returns the seed associated with the given QQL token. Returns
    /// `bytes32(0)` if and only if the token does not exist.
    function tokenSeed(uint256 tokenId) external view returns (bytes32) {
        return tokenSeed_[tokenId];
    }

    /// Returns the token ID associated with the given seed. Returns 0 if
    /// and only if no token was ever minted with that seed.
    function seedToTokenId(bytes32 seed) external view returns (uint256) {
        return seedToTokenId_[seed];
    }

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

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    )
        internal
        virtual
        override(ERC721, ERC721Enumerable, ERC721OperatorFilter)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721TokenUriDelegate, ERC721)
        returns (string memory)
    {
        return super.tokenURI(tokenId);
    }

    function unlockTimestamp() public view returns (uint256) {
        return unlockTimestamp_;
    }

    function maxPremintPassId() public view returns (uint256) {
        return maxPremintPassId_;
    }
}

File 2 of 20 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 20 : ERC721TokenUriDelegate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./ITokenUriDelegate.sol";

abstract contract ERC721TokenUriDelegate is ERC721, Ownable {
    ITokenUriDelegate private tokenUriDelegate_;

    function setTokenUriDelegate(ITokenUriDelegate delegate) public onlyOwner {
        tokenUriDelegate_ = delegate;
    }

    function tokenUriDelegate() public view returns (ITokenUriDelegate) {
        return tokenUriDelegate_;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        if (!_exists(tokenId)) revert("ERC721: invalid token ID");
        ITokenUriDelegate delegate = tokenUriDelegate_;
        if (address(delegate) == address(0)) return "";
        return delegate.tokenURI(tokenId);
    }
}

File 5 of 20 : ERC721OperatorFilter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./IOperatorFilter.sol";

abstract contract ERC721OperatorFilter is ERC721, Ownable {
    IOperatorFilter private operatorFilter_;

    function setOperatorFilter(IOperatorFilter filter) public onlyOwner {
        operatorFilter_ = filter;
    }

    function operatorFilter() public view returns (IOperatorFilter) {
        return operatorFilter_;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override(ERC721) {
        if (
            from != address(0) &&
            to != address(0) &&
            !_mayTransfer(msg.sender, tokenId)
        ) {
            revert("ERC721OperatorFilter: illegal operator");
        }
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _mayTransfer(address operator, uint256 tokenId)
        private
        view
        returns (bool)
    {
        IOperatorFilter filter = operatorFilter_;
        if (address(filter) == address(0)) return true;
        if (operator == ownerOf(tokenId)) return true;
        return filter.mayTransfer(msg.sender);
    }
}

File 6 of 20 : MintPass.sol
// SPDX-License-Identifier: BUSL-1.1 (see LICENSE)
pragma solidity ^0.8.8;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

import "./ERC721TokenUriDelegate.sol";
import "./ERC721OperatorFilter.sol";
import "./IManifold.sol";

/// @dev
/// Parameters for a piecewise-constant price function with the following
/// shape:
///
/// (1) Prior to `startTimestamp`, the price is `type(uint256).max`.
///
/// (2) At `startTimestamp`, the price jumps to `startGwei` gwei.
///     Every `dropPeriodSeconds` seconds, the price drops as follows:.
///
///     (a) Each of the first `n1` drops is for `c1 * dropGwei` gwei.
///     (b) Each of the next `n2` drops is for `c2 * dropGwei` gwei.
///     (c) Each of the next `n3` drops is for `c3 * dropGwei` gwei.
///     (d) Each subsequent drop is for `c4 * dropGwei` gwei.
///
/// (3) The price never drops below `reserveGwei` gwei.
///
/// For example, suppose that `dropPeriodSeconds` is 60, `startGwei` is 100e9,
/// `dropGwei` is 5e8, `[n1, n2, n3]` is `[10, 15, 20]`, and `[c1, c2, c3, c4]`
/// is [8, 4, 2, 1]`. Then: the price starts at 100 ETH, then drops in 4 ETH
/// increments down to 60 ETH, then drops in 2 ETH increments down to 30 ETH,
/// then drops in 1 ETH increments down to 10 ETH, then drops in 0.5 ETH
/// increments down to the reserve price.
///
/// As a special case, if `startTimestamp == 0`, the auction is considered to
/// not be scheduled yet, and the price is `type(uint256).max` at all times.
struct AuctionSchedule {
    uint40 startTimestamp;
    uint16 dropPeriodSeconds;
    uint48 startGwei;
    uint48 dropGwei;
    uint48 reserveGwei;
    uint8 n1;
    uint8 n2;
    uint8 n3;
    uint8 c1;
    uint8 c2;
    uint8 c3;
    uint8 c4;
}

library ScheduleMath {
    /// @dev The result of this function must be (weakly) monotonically
    /// decreasing. If the reported price were to increase, then users who
    /// bought mint passes at multiple price points might receive a smaller
    /// rebate than they had expected, and the owner might not be able to
    /// withdraw all the proceeds.
    function currentPrice(AuctionSchedule memory s, uint256 timestamp)
        internal
        pure
        returns (uint256)
    {
        if (s.startTimestamp == 0) return type(uint256).max;
        if (timestamp < s.startTimestamp) return type(uint256).max;
        if (s.dropPeriodSeconds == 0) return s.reserveGwei * 1 gwei;

        uint256 secondsElapsed = timestamp - s.startTimestamp;
        uint256 drops = secondsElapsed / s.dropPeriodSeconds;

        uint256 priceGwei = s.startGwei;
        uint256 dropGwei = s.dropGwei;

        uint256 inf = type(uint256).max;
        (drops, priceGwei) = doDrop(s.n1, drops, priceGwei, s.c1 * dropGwei);
        (drops, priceGwei) = doDrop(s.n2, drops, priceGwei, s.c2 * dropGwei);
        (drops, priceGwei) = doDrop(s.n3, drops, priceGwei, s.c3 * dropGwei);
        (drops, priceGwei) = doDrop(inf, drops, priceGwei, s.c4 * dropGwei);

        if (priceGwei < s.reserveGwei) priceGwei = s.reserveGwei;
        return priceGwei * 1 gwei;
    }

    function doDrop(
        uint256 limit,
        uint256 remaining,
        uint256 priceGwei,
        uint256 dropGwei
    ) private pure returns (uint256 _remaining, uint256 _priceGwei) {
        uint256 effectiveDrops = remaining;
        if (effectiveDrops > limit) effectiveDrops = limit;
        (bool ok, uint256 totalDropGwei) = SafeMath.tryMul(
            effectiveDrops,
            dropGwei
        );
        if (!ok || totalDropGwei > priceGwei) totalDropGwei = priceGwei;
        priceGwei -= totalDropGwei;
        return (remaining - effectiveDrops, priceGwei);
    }
}

/// @dev
/// A record of each buyer's interactions with the auction contract.
/// The buyer's outstanding rebate can be calculated from this receipt combined
/// with the current (or final) clearing price. Specifically, the clearing
/// value of the buyer's mint passes is `clearingPrice * numPurchased`.
/// The `netPaid` amount must never be less than the clearing value; if it's
/// greater than the clearing value, then the buyer is entitled to claim the
/// difference.
struct Receipt {
    /// The total amount that the buyer paid for all mint passes that they
    /// purchased, minus the total amount of rebates claimed so far.
    uint192 netPaid;
    /// The total number of mint passes that the buyer purchased. (This does
    /// not count any mint passes created by `reserve`.)
    uint64 numPurchased;
}

/// @dev These fields are grouped because they change at the same time and can
/// be written atomically to save on storage I/O.
struct SupplyStats {
    /// The total number of mint passes that have ever been created. This
    /// counts passes created by both `purchase` and `reserve`, and does not
    /// decrease when passes are burned.
    uint64 created;
    /// The number of mint passes that have been purchased at auction. This
    /// differs from `created_` in that it does not count mint passes created
    /// for free via `reserve`.
    uint64 purchased;
}

contract MintPass is
    Ownable,
    IManifold,
    ERC721OperatorFilter,
    ERC721TokenUriDelegate,
    ERC721Enumerable
{
    using Address for address payable;
    using ScheduleMath for AuctionSchedule;

    /// The maximum number of mint passes that may ever be created.
    uint64 immutable maxCreated_;
    SupplyStats supplyStats_;

    mapping(address => Receipt) receipts_;
    /// Whether `withdrawProceeds` has been called yet.
    bool proceedsWithdrawn_;

    AuctionSchedule schedule_;
    /// The block timestamp at which the auction ended, or 0 if the auction has
    /// not yet ended (i.e., either is still ongoing or has not yet started).
    /// The auction ends when the last mint pass is created, which may be
    /// before or after the price would hit its terminal scheduled value.
    uint256 endTimestamp_;

    /// The address permitted to burn mint passes when minting QQL tokens.
    address burner_;

    address payable projectRoyaltyRecipient_;
    address payable platformRoyaltyRecipient_;
    uint256 constant PROJECT_ROYALTY_BPS = 500; // 5%
    uint256 constant PLATFORM_ROYALTY_BPS = 200; // 2%

    /// For use in an emergency where funds are locked in the contract (e.g.,
    /// the auction gets soft-locked due to a logic error and can never be
    /// completed). After an owner calls `declareEmergency()` and waits the
    /// required duration, they can withdraw any amount of funds from the
    /// contract. Doing so *will* break the contract invariants and make future
    /// behavior of `claimRebate` and `withdrawProceeds` unpredictable, so
    /// should only be used as a last resort.
    uint256 emergencyStartTimestamp_;
    uint256 constant EMERGENCY_DELAY_SECONDS = 3 days;

    /// Emitted whenever mint passes are reserved by the owner with `reserve`.
    /// Creating mint passes with `purchase` does not emit this event.
    event MintPassReservation(
        address indexed recipient,
        uint256 firstTokenId,
        uint256 count
    );

    /// Emitted whenever mint passes are purchased at auction. The `payment`
    /// field represents the amount of Ether deposited with the message call;
    /// this may be more than the current price of the purchased mint passes,
    /// adding to the buyer's rebate, or it may be less, consuming some of the
    /// rebate.
    ///
    /// Creating mint passes with `reserve` does not emit this event.
    event MintPassPurchase(
        address indexed buyer,
        uint256 firstTokenId,
        uint256 count,
        uint256 payment,
        uint256 priceEach
    );

    /// Emitted whenever a buyer claims a rebate. This may happen more than
    /// once per buyer, since rebates can be claimed incrementally as the
    /// auction goes on. The `claimed` amount may be 0 if there is no new
    /// rebate to claim, which may happen if the price has not decreased since
    /// the last claim.
    event RebateClaim(address indexed buyer, uint256 claimed);

    /// Emitted when the contract owner withdraws the auction proceeds.
    event ProceedsWithdrawal(uint256 amount);

    /// Emitted whenever the auction schedule changes, including when the
    /// auction is first scheduled. The `schedule` value is the same as the
    /// result of the `auctionSchedule()` method; see that method for more
    /// details.
    event AuctionScheduleChange(AuctionSchedule schedule);

    event ProjectRoyaltyRecipientChanged(address payable recipient);
    event PlatformRoyaltyRecipientChanged(address payable recipient);

    event EmergencyDeclared();
    event EmergencyWithdrawal(uint256 amount);

    constructor(uint64 _maxCreated) ERC721("", "") {
        maxCreated_ = _maxCreated;
    }

    function name() public pure override returns (string memory) {
        return "QQL Mint Pass";
    }

    function symbol() public pure override returns (string memory) {
        return "QQL-MP";
    }

    /// Returns the total number of mint passes ever created.
    function totalCreated() external view returns (uint256) {
        return supplyStats_.created;
    }

    /// Returns the maximum number of mint passes that can ever be created
    /// (cumulatively, not just active at one time). That is, `totalCreated()`
    /// will never exceed `maxCreated()`.
    ///
    /// When `totalCreated() == maxCreated()`, the auction is over.
    function maxCreated() external view returns (uint256) {
        return maxCreated_;
    }

    /// Returns information about how many mint passes have been reserved by
    /// the owner, how many have been purchased at auction, and the maximum
    /// number of mint passes that will ever be created. These statistics
    /// include passes that have been burned.
    function supplyStats()
        external
        view
        returns (
            uint256 reserved,
            uint256 purchased,
            uint256 max
        )
    {
        SupplyStats memory stats = supplyStats_;
        return (stats.created - stats.purchased, stats.purchased, maxCreated_);
    }

    /// Configures the mint pass auction. Can be called multiple times,
    /// including while the auction is active. Reverts if this would cause the
    /// current price to increase or if the auction is already over.
    function updateAuctionSchedule(AuctionSchedule memory schedule)
        public
        onlyOwner
    {
        if (endTimestamp_ != 0) revert("MintPass: auction ended");
        uint256 oldPrice = currentPrice();
        schedule_ = schedule;
        uint256 newPrice = currentPrice();
        if (newPrice > oldPrice) revert("MintPass: price would increase");
        emit AuctionScheduleChange(schedule);
    }

    /// Sets a new schedule that remains at the current price forevermore.
    /// If the auction is not yet started, this unschedules the auction
    /// (regardless of whether it is scheduled or not). Otherwise, the auction
    /// remains open at the current price until a further schedule update.
    function pauseAuctionSchedule() external {
        // (no `onlyOwner` modifier; check happens in `updateAuctionSchedule`)
        uint256 price = currentPrice();
        AuctionSchedule memory schedule; // zero-initialized
        if (price != type(uint256).max) {
            uint48 priceGwei = uint48(price / 1 gwei);
            assert(priceGwei * 1 gwei == price);
            schedule.startTimestamp = 1;
            schedule.dropPeriodSeconds = 0;
            schedule.reserveGwei = priceGwei;
        }
        updateAuctionSchedule(schedule);
    }

    /// Returns the parameters of the auction schedule. These parameters define
    /// the price curve over time; see `AuctionSchedule` for semantics.
    function auctionSchedule() external view returns (AuctionSchedule memory) {
        return schedule_;
    }

    /// Returns the block timestamp at which the auction ended, or 0 if the
    /// auction has not ended yet (including if it hasn't started).
    function endTimestamp() external view returns (uint256) {
        return endTimestamp_;
    }

    /// Creates `count` mint passes owned by `recipient`. The new token IDs
    /// will be allocated sequentially (even if the recipient's ERC-721 receive
    /// hook causes more mint passes to be created in the middle); the return
    /// value is the first token ID.
    ///
    /// If this creates the final mint pass, it also ends the auction by
    /// setting `endTimestamp_`. If this would create more mint passes than the
    /// max supply supports, it reverts.
    function _createMintPasses(
        address recipient,
        uint256 count,
        bool isPurchase
    ) internal returns (uint256) {
        // Can't return a valid new token ID, and, more importantly, don't want
        // to stomp `endTimestamp_` if the auction is already over.
        if (count == 0) revert("MintPass: count is zero");

        SupplyStats memory stats = supplyStats_;
        uint256 oldCreated = stats.created;

        uint256 newCreated = stats.created + count;
        if (newCreated > maxCreated_) revert("MintPass: minted out");

        // Lossless since `newCreated <= maxCreated_ <= type(uint64).max`.
        stats.created = _losslessU64(newCreated);
        if (isPurchase) {
            // Lossless since `purchased <= created <= type(uint64).max`.
            stats.purchased = _losslessU64(stats.purchased + count);
        }

        supplyStats_ = stats;
        if (newCreated == maxCreated_) endTimestamp_ = block.timestamp;

        uint256 firstTokenId = oldCreated + 1;
        uint256 nextTokenId = firstTokenId;
        for (uint256 i = 0; i < count; i++) {
            _safeMint(recipient, nextTokenId++);
        }
        return firstTokenId;
    }

    /// @dev Helper for `_createMintPasses`.
    function _losslessU64(uint256 x) internal pure returns (uint64 result) {
        result = uint64(x);
        assert(result == x);
        return result;
    }

    /// Purchases `count` mint passes at the current auction price. Reverts if
    /// the auction has not started, if the auction has minted out, or if the
    /// value associated with this message is less than required. Returns the
    /// first token ID.
    function purchase(uint256 count) external payable returns (uint256) {
        uint256 priceEach = currentPrice();
        if (priceEach == type(uint256).max) {
            // Just a nicer error message.
            revert("MintPass: auction not started");
        }

        Receipt memory receipt = receipts_[msg.sender];

        uint256 newNetPaid = receipt.netPaid + msg.value;
        receipt.netPaid = uint192(newNetPaid);
        if (receipt.netPaid != newNetPaid) {
            // Truncation here would require cumulative payments of 2^192 wei,
            // which seems implausible.
            revert("MintPass: too large");
        }

        uint256 newNumPurchased = receipt.numPurchased + count;
        receipt.numPurchased = uint64(newNumPurchased);
        if (receipt.numPurchased != newNumPurchased) {
            // Truncation here would require purchasing 2^64 passes, which
            // would likely cause out-of-gas errors anyway.
            revert("MintPass: too large");
        }

        (bool ok, uint256 priceTotal) = SafeMath.tryMul(
            priceEach,
            receipt.numPurchased
        );
        if (!ok || receipt.netPaid < priceTotal) revert("MintPass: underpaid");

        receipts_[msg.sender] = receipt;

        uint256 firstTokenId = _createMintPasses({
            recipient: msg.sender,
            count: count,
            isPurchase: true
        });
        emit MintPassPurchase(
            msg.sender,
            firstTokenId,
            count,
            msg.value,
            priceEach
        );
        return firstTokenId;
    }

    /// Creates one or more mint passes outside of the auction process, at no
    /// cost. Returns the first token ID.
    function reserve(address recipient, uint256 count)
        external
        onlyOwner
        returns (uint256)
    {
        uint256 firstTokenId = _createMintPasses({
            recipient: recipient,
            count: count,
            isPurchase: false
        });
        emit MintPassReservation(recipient, firstTokenId, count);
        return firstTokenId;
    }

    /// Gets the record of the given buyer's purchases so far. The `netPaid`
    /// value indicates the total amount paid to the contract less any rebates
    /// claimed so far. With this data, clients can compute the amount of
    /// rebate available to the buyer at any given auction price; the rebate is
    /// given by `netPaid - currentPrice * numPurchased`.
    function getReceipt(address buyer)
        external
        view
        returns (uint256 netPaid, uint256 numPurchased)
    {
        Receipt memory receipt = receipts_[buyer];
        return (receipt.netPaid, receipt.numPurchased);
    }

    /// Computes the rebate that `buyer` is currently entitled to, and returns
    /// that amount along with the value that should be stored into
    /// `receipts_[buyer]` if they claim it.
    function _computeRebate(address buyer)
        internal
        view
        returns (uint256 rebate, Receipt memory receipt)
    {
        receipt = receipts_[buyer];
        uint256 clearingCost = currentPrice() * receipt.numPurchased;
        rebate = receipt.netPaid - clearingCost;
        // This truncation should be lossless because `clearingCost` is
        // strictly less than the prior value of `receipt.netPaid`.
        receipt.netPaid = uint192(clearingCost);
    }

    /// Gets the amount that `buyer` would currently receive if they called
    /// `claimRebate()`.
    function rebateAmount(address buyer) public view returns (uint256) {
        (uint256 rebate, ) = _computeRebate(buyer);
        return rebate;
    }

    /// Claims a rebate equal to the difference between the total amount that
    /// the buyer paid for all their mint passes and the amount that their mint
    /// passes would have cost at the clearing price. The rebate is sent to the
    /// buyer's address; see `claimTo` if this is inconvenient.
    function claimRebate() external {
        claimRebateTo(payable(msg.sender));
    }

    /// Claims a rebate equal to the difference between the total amount that
    /// the buyer paid for all their mint passes and the amount that their mint
    /// passes would have cost at the clearing price.
    function claimRebateTo(address payable recipient) public {
        (uint256 rebate, Receipt memory receipt) = _computeRebate(msg.sender);
        receipts_[msg.sender] = receipt;
        emit RebateClaim(msg.sender, rebate);
        recipient.sendValue(rebate);
    }

    /// Withdraws all the auction proceeds. This values each purchased mint
    /// pass at the final clearing price. It can only be called after the
    /// auction has ended, and it can only be called once.
    function withdrawProceeds(address payable recipient) external onlyOwner {
        if (endTimestamp_ == 0) revert("MintPass: auction not ended");
        if (proceedsWithdrawn_) revert("MintPass: already withdrawn");
        proceedsWithdrawn_ = true;
        uint256 proceeds = currentPrice() * supplyStats_.purchased;
        if (proceeds > address(this).balance) {
            // The auction price shouldn't increase, so this shouldn't happen.
            // In case it does, permit rescuing what we can.
            proceeds = address(this).balance;
        }
        emit ProceedsWithdrawal(proceeds);
        recipient.sendValue(proceeds);
    }

    /// Gets the current price of a mint pass (in wei). If the auction has
    /// ended, this returns the final clearing price. If the auction has not
    /// started, this returns `type(uint256).max`.
    function currentPrice() public view returns (uint256) {
        uint256 timestamp = block.timestamp;
        uint256 _endTimestamp = endTimestamp_;
        if (_endTimestamp != 0) timestamp = _endTimestamp;
        return schedule_.currentPrice(timestamp);
    }

    /// Returns the price (in wei) that a mint pass would cost at the given
    /// timestamp, according to the auction schedule and under the (possibly
    /// counterfactual) assumption that the auction does not end before it
    /// reaches the reserve price. That is, unlike `currentPrice()`, the result
    /// of this method does not depend on whether or when the auction has
    /// actually ended.
    function priceAt(uint256 timestamp) external view returns (uint256) {
        return schedule_.currentPrice(timestamp);
    }

    /// Sets the address that's permitted to burn mint passes when minting QQL
    /// tokens.
    function setBurner(address _burner) external onlyOwner {
        burner_ = _burner;
    }

    /// Gets the address that's permitted to burn mint passes when minting QQL
    /// tokens.
    function burner() external view returns (address) {
        return burner_;
    }

    /// Burns a mint pass. Intended to be called when minting a QQL token.
    function burn(uint256 tokenId) external {
        if (msg.sender != burner_) revert("MintPass: unauthorized");
        _burn(tokenId);
    }

    /// Checks whether the given address is approved to operate the given mint
    /// pass. Reverts if the mint pass does not exist.
    ///
    /// This is equivalent to calling and combining the results of `ownerOf`,
    /// `getApproved`, and `isApprovedForAll`, but is cheaper because it
    /// requires fewer message calls.
    function isApprovedOrOwner(address operator, uint256 tokenId)
        external
        view
        returns (bool)
    {
        return _isApprovedOrOwner(operator, tokenId);
    }

    function getRoyalties(
        uint256 /*unusedTokenId */
    )
        external
        view
        returns (address payable[] memory recipients, uint256[] memory bps)
    {
        recipients = new address payable[](2);
        bps = new uint256[](2);
        recipients[0] = projectRoyaltyRecipient_;
        recipients[1] = platformRoyaltyRecipient_;
        bps[0] = PROJECT_ROYALTY_BPS;
        bps[1] = PLATFORM_ROYALTY_BPS;
    }

    function setProjectRoyaltyRecipient(address payable projectRecipient)
        external
        onlyOwner
    {
        projectRoyaltyRecipient_ = projectRecipient;
        emit ProjectRoyaltyRecipientChanged(projectRecipient);
    }

    function projectRoyaltyRecipient() external view returns (address payable) {
        return projectRoyaltyRecipient_;
    }

    function setPlatformRoyaltyRecipient(address payable platformRecipient)
        external
        onlyOwner
    {
        platformRoyaltyRecipient_ = platformRecipient;
        emit PlatformRoyaltyRecipientChanged(platformRecipient);
    }

    function platformRoyaltyRecipient()
        external
        view
        returns (address payable)
    {
        return platformRoyaltyRecipient_;
    }

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

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    )
        internal
        virtual
        override(ERC721, ERC721Enumerable, ERC721OperatorFilter)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721TokenUriDelegate, ERC721)
        returns (string memory)
    {
        return super.tokenURI(tokenId);
    }

    function declareEmergency() external onlyOwner {
        if (emergencyStartTimestamp_ != 0) return;
        emergencyStartTimestamp_ = block.timestamp;
        emit EmergencyDeclared();
    }

    function emergencyStartTimestamp() external view returns (uint256) {
        return emergencyStartTimestamp_;
    }

    function emergencyWithdraw(address payable recipient, uint256 amount)
        external
        onlyOwner
    {
        uint256 start = emergencyStartTimestamp_;
        if (start == 0 || block.timestamp < start + EMERGENCY_DELAY_SECONDS)
            revert("MintPass: declare emergency and wait");
        recipient.sendValue(amount);
        emit EmergencyWithdrawal(amount);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 10 of 20 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 17 of 20 : ITokenUriDelegate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

interface ITokenUriDelegate {
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 18 of 20 : IOperatorFilter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

interface IOperatorFilter {
    function mayTransfer(address operator) external view returns (bool);
}

File 19 of 20 : 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;
        }
    }
}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

/**
 * @dev Royalty interface for creator core classes
 */
interface IManifold {
    /**
     * @dev Get royalites of a token.  Returns list of receivers and basisPoints
     *
     *  bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
     *
     *  => 0xbb3bafd6 = 0xbb3bafd6
     */
    function getRoyalties(uint256 tokenId)
        external
        view
        returns (address payable[] memory recipients, uint256[] memory bps);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract MintPass","name":"pass","type":"address"},{"internalType":"uint256","name":"maxPremintPassId","type":"uint256"},{"internalType":"uint256","name":"unlockTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAllSeeds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRecipient","type":"address"}],"name":"ProjectRoyaltyRecipientChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"SeedTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"newRecipient","type":"address"}],"name":"TokenRoyaltyRecipientChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approveForAllSeeds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"newRecipient","type":"address"}],"name":"changeTokenRoyaltyRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRoyalties","outputs":[{"internalType":"address payable[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"bps","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAllSeeds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"isApprovedOrOwnerForSeed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPremintPassId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintPassId","type":"uint256"},{"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintPassId","type":"uint256"},{"internalType":"bytes32","name":"seed","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"}],"name":"mintTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"operatorFilter","outputs":[{"internalType":"contract IOperatorFilter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"ownerOfSeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"parametricArtist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectRoyaltyRecipient","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"scriptPiece","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"seedToTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorFilter","name":"filter","type":"address"}],"name":"setOperatorFilter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"}],"name":"setProjectRoyaltyRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"data","type":"string"}],"name":"setScriptPiece","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITokenUriDelegate","name":"delegate","type":"address"}],"name":"setTokenUriDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenRoyaltyRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenUriDelegate","outputs":[{"internalType":"contract ITokenUriDelegate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"transferSeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60e06040526001600d553480156200001657600080fd5b5060405162003db538038062003db58339810160408190526200003991620001b1565b60408051602080820180845260008084528451928301909452838252825192939192620000689291906200010b565b5080516200007e9060019060208401906200010b565b5050506200009b62000095620000b560201b60201c565b620000b9565b6001600160a01b0390921660805260c05260a05262000233565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200011990620001f6565b90600052602060002090601f0160209004810192826200013d576000855562000188565b82601f106200015857805160ff191683800117855562000188565b8280016001018555821562000188579182015b82811115620001885782518255916020019190600101906200016b565b50620001969291506200019a565b5090565b5b808211156200019657600081556001016200019b565b600080600060608486031215620001c757600080fd5b83516001600160a01b0381168114620001df57600080fd5b602085015160409095015190969495509392505050565b600181811c908216806200020b57607f821691505b602082108114156200022d57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c051613b3d62000278600039600081816104860152611d940152600081816106140152611d6a015260008181611bfd0152611ebb0152613b3d6000f3fe608060405234801561001057600080fd5b50600436106102de5760003560e01c806370a0823111610186578063b5d29710116100e3578063ca9992aa11610097578063e985e9c511610071578063e985e9c5146106de578063edcbd7e614610727578063f2fde38b1461074757600080fd5b8063ca9992aa146106a5578063d783925b146106b8578063ddfbd8dd146106cb57600080fd5b8063bb3bafd6116100c8578063bb3bafd61461065e578063c620c3fb1461067f578063c87b56dd1461069257600080fd5b8063b5d2971014610638578063b88d4fde1461064b57600080fd5b806394a5a1d01161013a578063a22cb4651161011f578063a22cb465146105ec578063a8f1757f146105ff578063aa082a9d1461061257600080fd5b806394a5a1d0146105d957806395d89b411461030b57600080fd5b806371bbda4a1161016b57806371bbda4a1461055f578063857b0143146105725780638da5cb5b146105bb57600080fd5b806370a0823114610544578063715018a61461055757600080fd5b806342842e0e1161023f5780635d590c76116101f357806362b974e2116101cd57806362b974e2146104dd5780636352211e14610513578063689843e01461052657600080fd5b80635d590c76146104845780635f516836146104aa57806362261a35146104ca57600080fd5b80634dc2d4b4116102245780634dc2d4b4146104405780634f6ccce71461045e57806359160e5d1461047157600080fd5b806342842e0e1461041a57806345b2d1cb1461042d57600080fd5b806318160ddd1161029657806323b872dd1161027b57806323b872dd146103d65780632f745c59146103e9578063412a208a146103fc57600080fd5b806318160ddd146103bb57806321eda556146103c357600080fd5b8063081812fc116102c7578063081812fc1461034d578063095ea7b3146103855780631801fbe51461039a57600080fd5b806301ffc9a7146102e357806306fdde031461030b575b600080fd5b6102f66102f13660046133f6565b61075a565b60405190151581526020015b60405180910390f35b60408051808201909152600381527f51514c000000000000000000000000000000000000000000000000000000000060208201525b6040516103029190613489565b61036061035b36600461349c565b61076b565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610302565b6103986103933660046134d7565b61084a565b005b6103ad6103a8366004613503565b6109d7565b604051908152602001610302565b600b546103ad565b6103986103d1366004613533565b6109eb565b6103986103e436600461356c565b610a83565b6103ad6103f73660046134d7565b610b24565b60145473ffffffffffffffffffffffffffffffffffffffff16610360565b61039861042836600461356c565b610bf3565b61039861043b36600461356c565b610c0e565b60085473ffffffffffffffffffffffffffffffffffffffff16610360565b6103ad61046c36600461349c565b610e6c565b61039861047f3660046136af565b610f2a565b7f00000000000000000000000000000000000000000000000000000000000000006103ad565b6103ad6104b836600461349c565b6000908152600e602052604090205490565b6103606104d836600461349c565b61104c565b6103606104eb36600461349c565b60009081526013602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61036061052136600461349c565b61107e565b60075473ffffffffffffffffffffffffffffffffffffffff16610360565b6103ad61055236600461370a565b611130565b6103986111fe565b61034061056d36600461349c565b61128b565b6102f6610580366004613727565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260126020908152604080832093909416825291909152205460ff1690565b60065473ffffffffffffffffffffffffffffffffffffffff16610360565b6103606105e736600461349c565b61132d565b6103986105fa366004613533565b6113ac565b61039861060d366004613755565b6113bb565b7f00000000000000000000000000000000000000000000000000000000000000006103ad565b6102f66106463660046134d7565b611581565b61039861065936600461377a565b61160b565b61067161066c36600461349c565b6116b3565b6040516103029291906137fa565b61039861068d36600461370a565b6118cb565b6103406106a036600461349c565b611993565b6103986106b336600461370a565b61199e565b6103986106c636600461370a565b611a8e565b6103ad6106d936600461388b565b611b56565b6102f66106ec366004613727565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103ad61073536600461349c565b6000908152600f602052604090205490565b61039861075536600461370a565b611f3e565b60006107658261206e565b92915050565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16610821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006108558261107e565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610818565b3373ffffffffffffffffffffffffffffffffffffffff8216148061093c575061093c81336106ec565b6109c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610818565b6109d283836120c4565b505050565b60006109e4838333611b56565b9392505050565b33600081815260126020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155905190815283917f25a50ac352a9cae63b4a40180f9681ac9f38861e577f4ead5aeb25d8ed2a017f91015b60405180910390a3505050565b610a8d3382612164565b610b19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610818565b6109d28383836122d3565b6000610b2f83611130565b8210610bbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610818565b5073ffffffffffffffffffffffffffffffffffffffff919091166000908152600960209081526040808320938352929052205490565b6109d28383836040518060200160405280600081525061160b565b610c183382611581565b610c7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220736565640000000000006044820152606401610818565b8273ffffffffffffffffffffffffffffffffffffffff16610c9e8261104c565b73ffffffffffffffffffffffffffffffffffffffff1614610d1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f51514c3a2077726f6e67206f776e657220666f722073656564000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff8216610dbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f51514c3a2063616e27742073656e64207365656420746f207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610818565b808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f418094cd04bff0c05a600d7ee9d694f8b2aa890d16b5a246562e779ece510a2460405160405180910390a4600090815260116020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6000610e77600b5490565b8210610f05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610818565b600b8281548110610f1857610f186138c4565b90600052602060002001549050919050565b60065473ffffffffffffffffffffffffffffffffffffffff163314610fab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b60008281526010602052604090208054610fc4906138f3565b15905061102d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f51514c3a20736372697074207069656365732061726520696d6d757461626c656044820152606401610818565b600082815260106020908152604090912082516109d29284019061332f565b60008181526011602052604081205473ffffffffffffffffffffffffffffffffffffffff168061076557505060601c90565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610818565b600073ffffffffffffffffffffffffffffffffffffffff82166111d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610818565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60065473ffffffffffffffffffffffffffffffffffffffff16331461127f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b6112896000612545565b565b60008181526010602052604090208054606091906112a8906138f3565b80601f01602080910402602001604051908101604052809291908181526020018280546112d4906138f3565b80156113215780601f106112f657610100808354040283529160200191611321565b820191906000526020600020905b81548152906001019060200180831161130457829003601f168201915b50505050509050919050565b6000818152600e6020526040812054806113a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f51514c3a20746f6b656e20646f6573206e6f74206578697374000000000000006044820152606401610818565b60601c92915050565b6113b73383836125bc565b5050565b60008281526013602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611448576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f51514c3a20756e617574686f72697a65640000000000000000000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff81166114eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f51514c3a2063616e277420736574207a65726f2061646472657373206173207460448201527f6f6b656e20726f79616c747920726563697069656e74000000000000000000006064820152608401610818565b60405173ffffffffffffffffffffffffffffffffffffffff82169083907f5e28702fb6ecf87ce91295a9ed08dee62b0967832abe222594e8157ec37590da90600090a360009182526013602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008061158d8361104c565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cd576001915050610765565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526012602090815260408083209387168352929052205460ff16905092915050565b6116153383612164565b6116a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610818565b6116ad848484846126e2565b50505050565b60408051600280825260608083018452928392919060208301908036833750506040805160028082526060820183529395509291506020830190803683375050601454845192935073ffffffffffffffffffffffffffffffffffffffff1691849150600090611724576117246138c4565b73ffffffffffffffffffffffffffffffffffffffff928316602091820292909201810191909152600085815260139091526040902054835191169083906001908110611772576117726138c4565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600073ffffffffffffffffffffffffffffffffffffffff16826001815181106117d7576117d76138c4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f51514c3a20726f79616c747920666f72206e6f6e6578697374656e7420746f6b60448201527f656e0000000000000000000000000000000000000000000000000000000000006064820152608401610818565b6101f481600081518110611899576118996138c4565b60200260200101818152505060c8816001815181106118ba576118ba6138c4565b602002602001018181525050915091565b60065473ffffffffffffffffffffffffffffffffffffffff16331461194c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b606061076582612785565b60065473ffffffffffffffffffffffffffffffffffffffff163314611a1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b601480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f90712049541fc428936e5cccdd411501c97558a219b20fc098a035b40a2e4d9890600090a250565b60065473ffffffffffffffffffffffffffffffffffffffff163314611b0f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000611b628284611581565b611bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220736565640000000000006044820152606401610818565b6040517f430c2081000000000000000000000000000000000000000000000000000000008152336004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063430c20819060440160206040518083038186803b158015611c5457600080fd5b505afa158015611c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8c9190613947565b611cf2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220706173730000000000006044820152606401610818565b6000838152600f602052604090205415611d68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f51514c3a207365656420616c72656164792075736564000000000000000000006044820152606401610818565b7f000000000000000000000000000000000000000000000000000000000000000042108015611db657507f000000000000000000000000000000000000000000000000000000000000000084115b15611e1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f51514c3a206d696e742070617373206e6f742079657420756e6c6f636b6564006044820152606401610818565b600d805460009182611e2e83613993565b909155506000818152600e60209081526040808320889055878352600f825280832084905583835260139091529081902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016606088901c179055517f42966c68000000000000000000000000000000000000000000000000000000008152600481018790529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b158015611f1457600080fd5b505af1158015611f28573d6000803e3d6000fd5b50505050611f368382612907565b949350505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611fbf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff8116612062576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610818565b61206b81612545565b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610765575061076582612921565b600081815260046020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155819061211e8261107e565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610818565b60006122208361107e565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061228e575073ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083209388168352929052205460ff165b80611f3657508373ffffffffffffffffffffffffffffffffffffffff166122b48461076b565b73ffffffffffffffffffffffffffffffffffffffff1614949350505050565b8273ffffffffffffffffffffffffffffffffffffffff166122f38261107e565b73ffffffffffffffffffffffffffffffffffffffff1614612396576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610818565b73ffffffffffffffffffffffffffffffffffffffff8216612438576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610818565b612443838383612a04565b61244e6000826120c4565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604081208054600192906124849084906139cc565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054600192906124bf9084906139e3565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101610a76565b6126ed8484846122d3565b6126f984848484612a0f565b6116ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b60008181526002602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16612813576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610818565b60085473ffffffffffffffffffffffffffffffffffffffff1680612847575050604080516020810190915260008152919050565b6040517fc87b56dd0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063c87b56dd9060240160006040518083038186803b1580156128ad57600080fd5b505afa1580156128c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526109e491908101906139fb565b6113b7828260405180602001604052806000815250612c0e565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806129b457507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061076557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610765565b6109d2838383612cb1565b600073ffffffffffffffffffffffffffffffffffffffff84163b15612c03576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290612a86903390899088908890600401613a72565b602060405180830381600087803b158015612aa057600080fd5b505af1925050508015612aee575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612aeb91810190613abb565b60015b612bb8573d808015612b1c576040519150601f19603f3d011682016040523d82523d6000602084013e612b21565b606091505b508051612bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611f36565b506001949350505050565b612c188383612dc2565b612c256000848484612a0f565b6109d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b612cbc838383612f90565b73ffffffffffffffffffffffffffffffffffffffff8316612d2457612d1f81600b80546000838152600c60205260408120829055600182018355919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90155565b612d61565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612d6157612d61838261306a565b73ffffffffffffffffffffffffffffffffffffffff8216612d85576109d281613121565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146109d2576109d282826131d0565b73ffffffffffffffffffffffffffffffffffffffff8216612e3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610818565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1615612ecb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610818565b612ed760008383612a04565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260408120805460019290612f0d9084906139e3565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b73ffffffffffffffffffffffffffffffffffffffff831615801590612fca575073ffffffffffffffffffffffffffffffffffffffff821615155b8015612fdd5750612fdb3382613221565b155b156109d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610818565b6000600161307784611130565b61308191906139cc565b6000838152600a60205260409020549091508082146130e15773ffffffffffffffffffffffffffffffffffffffff841660009081526009602090815260408083208584528252808320548484528184208190558352600a90915290208190555b506000918252600a6020908152604080842084905573ffffffffffffffffffffffffffffffffffffffff9094168352600981528383209183525290812055565b600b54600090613133906001906139cc565b6000838152600c6020526040812054600b805493945090928490811061315b5761315b6138c4565b9060005260206000200154905080600b838154811061317c5761317c6138c4565b6000918252602080832090910192909255828152600c9091526040808220849055858252812055600b8054806131b4576131b4613ad8565b6001900381819060005260206000200160009055905550505050565b60006131db83611130565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526009602090815260408083208684528252808320859055938252600a9052919091209190915550565b60075460009073ffffffffffffffffffffffffffffffffffffffff168061324c576001915050610765565b6132558361107e565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415613292576001915050610765565b6040517f192c596e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063192c596e9060240160206040518083038186803b1580156132f757600080fd5b505afa15801561330b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f369190613947565b82805461333b906138f3565b90600052602060002090601f01602090048101928261335d57600085556133a3565b82601f1061337657805160ff19168380011785556133a3565b828001600101855582156133a3579182015b828111156133a3578251825591602001919060010190613388565b506133af9291506133b3565b5090565b5b808211156133af57600081556001016133b4565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461206b57600080fd5b60006020828403121561340857600080fd5b81356109e4816133c8565b60005b8381101561342e578181015183820152602001613416565b838111156116ad5750506000910152565b60008151808452613457816020860160208601613413565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006109e4602083018461343f565b6000602082840312156134ae57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461206b57600080fd5b600080604083850312156134ea57600080fd5b82356134f5816134b5565b946020939093013593505050565b6000806040838503121561351657600080fd5b50508035926020909101359150565b801515811461206b57600080fd5b6000806040838503121561354657600080fd5b8235613551816134b5565b9150602083013561356181613525565b809150509250929050565b60008060006060848603121561358157600080fd5b833561358c816134b5565b9250602084013561359c816134b5565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613623576136236135ad565b604052919050565b600067ffffffffffffffff821115613645576136456135ad565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600061368461367f8461362b565b6135dc565b905082815283838301111561369857600080fd5b828260208301376000602084830101529392505050565b600080604083850312156136c257600080fd5b82359150602083013567ffffffffffffffff8111156136e057600080fd5b8301601f810185136136f157600080fd5b61370085823560208401613671565b9150509250929050565b60006020828403121561371c57600080fd5b81356109e4816134b5565b6000806040838503121561373a57600080fd5b8235613745816134b5565b91506020830135613561816134b5565b6000806040838503121561376857600080fd5b823591506020830135613561816134b5565b6000806000806080858703121561379057600080fd5b843561379b816134b5565b935060208501356137ab816134b5565b925060408501359150606085013567ffffffffffffffff8111156137ce57600080fd5b8501601f810187136137df57600080fd5b6137ee87823560208401613671565b91505092959194509250565b604080825283519082018190526000906020906060840190828701845b8281101561384957815173ffffffffffffffffffffffffffffffffffffffff1684529284019290840190600101613817565b5050508381038285015284518082528583019183019060005b8181101561387e57835183529284019291840191600101613862565b5090979650505050505050565b6000806000606084860312156138a057600080fd5b833592506020840135915060408401356138b9816134b5565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181811c9082168061390757607f821691505b60208210811415613941577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561395957600080fd5b81516109e481613525565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156139c5576139c5613964565b5060010190565b6000828210156139de576139de613964565b500390565b600082198211156139f6576139f6613964565b500190565b600060208284031215613a0d57600080fd5b815167ffffffffffffffff811115613a2457600080fd5b8201601f81018413613a3557600080fd5b8051613a4361367f8261362b565b818152856020838501011115613a5857600080fd5b613a69826020830160208601613413565b95945050505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152613ab1608083018461343f565b9695505050505050565b600060208284031215613acd57600080fd5b81516109e4816133c8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220ca3ba97ed8409289b7c50fb56363d81066ca20adac7ab00fc04e783c5394d8ee64736f6c63430008090033000000000000000000000000c73b17179bf0c59cd5860bb25247d1d1092c1088000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000063372090

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102de5760003560e01c806370a0823111610186578063b5d29710116100e3578063ca9992aa11610097578063e985e9c511610071578063e985e9c5146106de578063edcbd7e614610727578063f2fde38b1461074757600080fd5b8063ca9992aa146106a5578063d783925b146106b8578063ddfbd8dd146106cb57600080fd5b8063bb3bafd6116100c8578063bb3bafd61461065e578063c620c3fb1461067f578063c87b56dd1461069257600080fd5b8063b5d2971014610638578063b88d4fde1461064b57600080fd5b806394a5a1d01161013a578063a22cb4651161011f578063a22cb465146105ec578063a8f1757f146105ff578063aa082a9d1461061257600080fd5b806394a5a1d0146105d957806395d89b411461030b57600080fd5b806371bbda4a1161016b57806371bbda4a1461055f578063857b0143146105725780638da5cb5b146105bb57600080fd5b806370a0823114610544578063715018a61461055757600080fd5b806342842e0e1161023f5780635d590c76116101f357806362b974e2116101cd57806362b974e2146104dd5780636352211e14610513578063689843e01461052657600080fd5b80635d590c76146104845780635f516836146104aa57806362261a35146104ca57600080fd5b80634dc2d4b4116102245780634dc2d4b4146104405780634f6ccce71461045e57806359160e5d1461047157600080fd5b806342842e0e1461041a57806345b2d1cb1461042d57600080fd5b806318160ddd1161029657806323b872dd1161027b57806323b872dd146103d65780632f745c59146103e9578063412a208a146103fc57600080fd5b806318160ddd146103bb57806321eda556146103c357600080fd5b8063081812fc116102c7578063081812fc1461034d578063095ea7b3146103855780631801fbe51461039a57600080fd5b806301ffc9a7146102e357806306fdde031461030b575b600080fd5b6102f66102f13660046133f6565b61075a565b60405190151581526020015b60405180910390f35b60408051808201909152600381527f51514c000000000000000000000000000000000000000000000000000000000060208201525b6040516103029190613489565b61036061035b36600461349c565b61076b565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610302565b6103986103933660046134d7565b61084a565b005b6103ad6103a8366004613503565b6109d7565b604051908152602001610302565b600b546103ad565b6103986103d1366004613533565b6109eb565b6103986103e436600461356c565b610a83565b6103ad6103f73660046134d7565b610b24565b60145473ffffffffffffffffffffffffffffffffffffffff16610360565b61039861042836600461356c565b610bf3565b61039861043b36600461356c565b610c0e565b60085473ffffffffffffffffffffffffffffffffffffffff16610360565b6103ad61046c36600461349c565b610e6c565b61039861047f3660046136af565b610f2a565b7f000000000000000000000000000000000000000000000000000000000000000b6103ad565b6103ad6104b836600461349c565b6000908152600e602052604090205490565b6103606104d836600461349c565b61104c565b6103606104eb36600461349c565b60009081526013602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61036061052136600461349c565b61107e565b60075473ffffffffffffffffffffffffffffffffffffffff16610360565b6103ad61055236600461370a565b611130565b6103986111fe565b61034061056d36600461349c565b61128b565b6102f6610580366004613727565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260126020908152604080832093909416825291909152205460ff1690565b60065473ffffffffffffffffffffffffffffffffffffffff16610360565b6103606105e736600461349c565b61132d565b6103986105fa366004613533565b6113ac565b61039861060d366004613755565b6113bb565b7f00000000000000000000000000000000000000000000000000000000633720906103ad565b6102f66106463660046134d7565b611581565b61039861065936600461377a565b61160b565b61067161066c36600461349c565b6116b3565b6040516103029291906137fa565b61039861068d36600461370a565b6118cb565b6103406106a036600461349c565b611993565b6103986106b336600461370a565b61199e565b6103986106c636600461370a565b611a8e565b6103ad6106d936600461388b565b611b56565b6102f66106ec366004613727565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103ad61073536600461349c565b6000908152600f602052604090205490565b61039861075536600461370a565b611f3e565b60006107658261206e565b92915050565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16610821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006108558261107e565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610818565b3373ffffffffffffffffffffffffffffffffffffffff8216148061093c575061093c81336106ec565b6109c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610818565b6109d283836120c4565b505050565b60006109e4838333611b56565b9392505050565b33600081815260126020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155905190815283917f25a50ac352a9cae63b4a40180f9681ac9f38861e577f4ead5aeb25d8ed2a017f91015b60405180910390a3505050565b610a8d3382612164565b610b19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610818565b6109d28383836122d3565b6000610b2f83611130565b8210610bbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610818565b5073ffffffffffffffffffffffffffffffffffffffff919091166000908152600960209081526040808320938352929052205490565b6109d28383836040518060200160405280600081525061160b565b610c183382611581565b610c7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220736565640000000000006044820152606401610818565b8273ffffffffffffffffffffffffffffffffffffffff16610c9e8261104c565b73ffffffffffffffffffffffffffffffffffffffff1614610d1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f51514c3a2077726f6e67206f776e657220666f722073656564000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff8216610dbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f51514c3a2063616e27742073656e64207365656420746f207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610818565b808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f418094cd04bff0c05a600d7ee9d694f8b2aa890d16b5a246562e779ece510a2460405160405180910390a4600090815260116020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6000610e77600b5490565b8210610f05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610818565b600b8281548110610f1857610f186138c4565b90600052602060002001549050919050565b60065473ffffffffffffffffffffffffffffffffffffffff163314610fab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b60008281526010602052604090208054610fc4906138f3565b15905061102d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f51514c3a20736372697074207069656365732061726520696d6d757461626c656044820152606401610818565b600082815260106020908152604090912082516109d29284019061332f565b60008181526011602052604081205473ffffffffffffffffffffffffffffffffffffffff168061076557505060601c90565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610818565b600073ffffffffffffffffffffffffffffffffffffffff82166111d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610818565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60065473ffffffffffffffffffffffffffffffffffffffff16331461127f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b6112896000612545565b565b60008181526010602052604090208054606091906112a8906138f3565b80601f01602080910402602001604051908101604052809291908181526020018280546112d4906138f3565b80156113215780601f106112f657610100808354040283529160200191611321565b820191906000526020600020905b81548152906001019060200180831161130457829003601f168201915b50505050509050919050565b6000818152600e6020526040812054806113a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f51514c3a20746f6b656e20646f6573206e6f74206578697374000000000000006044820152606401610818565b60601c92915050565b6113b73383836125bc565b5050565b60008281526013602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611448576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f51514c3a20756e617574686f72697a65640000000000000000000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff81166114eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f51514c3a2063616e277420736574207a65726f2061646472657373206173207460448201527f6f6b656e20726f79616c747920726563697069656e74000000000000000000006064820152608401610818565b60405173ffffffffffffffffffffffffffffffffffffffff82169083907f5e28702fb6ecf87ce91295a9ed08dee62b0967832abe222594e8157ec37590da90600090a360009182526013602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008061158d8361104c565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cd576001915050610765565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526012602090815260408083209387168352929052205460ff16905092915050565b6116153383612164565b6116a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610818565b6116ad848484846126e2565b50505050565b60408051600280825260608083018452928392919060208301908036833750506040805160028082526060820183529395509291506020830190803683375050601454845192935073ffffffffffffffffffffffffffffffffffffffff1691849150600090611724576117246138c4565b73ffffffffffffffffffffffffffffffffffffffff928316602091820292909201810191909152600085815260139091526040902054835191169083906001908110611772576117726138c4565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600073ffffffffffffffffffffffffffffffffffffffff16826001815181106117d7576117d76138c4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f51514c3a20726f79616c747920666f72206e6f6e6578697374656e7420746f6b60448201527f656e0000000000000000000000000000000000000000000000000000000000006064820152608401610818565b6101f481600081518110611899576118996138c4565b60200260200101818152505060c8816001815181106118ba576118ba6138c4565b602002602001018181525050915091565b60065473ffffffffffffffffffffffffffffffffffffffff16331461194c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b606061076582612785565b60065473ffffffffffffffffffffffffffffffffffffffff163314611a1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b601480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f90712049541fc428936e5cccdd411501c97558a219b20fc098a035b40a2e4d9890600090a250565b60065473ffffffffffffffffffffffffffffffffffffffff163314611b0f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000611b628284611581565b611bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220736565640000000000006044820152606401610818565b6040517f430c2081000000000000000000000000000000000000000000000000000000008152336004820152602481018590527f000000000000000000000000c73b17179bf0c59cd5860bb25247d1d1092c108873ffffffffffffffffffffffffffffffffffffffff169063430c20819060440160206040518083038186803b158015611c5457600080fd5b505afa158015611c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8c9190613947565b611cf2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f51514c3a20756e617574686f72697a656420666f7220706173730000000000006044820152606401610818565b6000838152600f602052604090205415611d68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f51514c3a207365656420616c72656164792075736564000000000000000000006044820152606401610818565b7f000000000000000000000000000000000000000000000000000000006337209042108015611db657507f000000000000000000000000000000000000000000000000000000000000000b84115b15611e1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f51514c3a206d696e742070617373206e6f742079657420756e6c6f636b6564006044820152606401610818565b600d805460009182611e2e83613993565b909155506000818152600e60209081526040808320889055878352600f825280832084905583835260139091529081902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016606088901c179055517f42966c68000000000000000000000000000000000000000000000000000000008152600481018790529091507f000000000000000000000000c73b17179bf0c59cd5860bb25247d1d1092c108873ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b158015611f1457600080fd5b505af1158015611f28573d6000803e3d6000fd5b50505050611f368382612907565b949350505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611fbf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff8116612062576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610818565b61206b81612545565b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610765575061076582612921565b600081815260046020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155819061211e8261107e565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610818565b60006122208361107e565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061228e575073ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083209388168352929052205460ff165b80611f3657508373ffffffffffffffffffffffffffffffffffffffff166122b48461076b565b73ffffffffffffffffffffffffffffffffffffffff1614949350505050565b8273ffffffffffffffffffffffffffffffffffffffff166122f38261107e565b73ffffffffffffffffffffffffffffffffffffffff1614612396576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610818565b73ffffffffffffffffffffffffffffffffffffffff8216612438576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610818565b612443838383612a04565b61244e6000826120c4565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604081208054600192906124849084906139cc565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054600192906124bf9084906139e3565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610818565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101610a76565b6126ed8484846122d3565b6126f984848484612a0f565b6116ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b60008181526002602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16612813576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610818565b60085473ffffffffffffffffffffffffffffffffffffffff1680612847575050604080516020810190915260008152919050565b6040517fc87b56dd0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063c87b56dd9060240160006040518083038186803b1580156128ad57600080fd5b505afa1580156128c1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526109e491908101906139fb565b6113b7828260405180602001604052806000815250612c0e565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806129b457507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061076557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610765565b6109d2838383612cb1565b600073ffffffffffffffffffffffffffffffffffffffff84163b15612c03576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290612a86903390899088908890600401613a72565b602060405180830381600087803b158015612aa057600080fd5b505af1925050508015612aee575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612aeb91810190613abb565b60015b612bb8573d808015612b1c576040519150601f19603f3d011682016040523d82523d6000602084013e612b21565b606091505b508051612bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611f36565b506001949350505050565b612c188383612dc2565b612c256000848484612a0f565b6109d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610818565b612cbc838383612f90565b73ffffffffffffffffffffffffffffffffffffffff8316612d2457612d1f81600b80546000838152600c60205260408120829055600182018355919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90155565b612d61565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612d6157612d61838261306a565b73ffffffffffffffffffffffffffffffffffffffff8216612d85576109d281613121565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146109d2576109d282826131d0565b73ffffffffffffffffffffffffffffffffffffffff8216612e3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610818565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1615612ecb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610818565b612ed760008383612a04565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260408120805460019290612f0d9084906139e3565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b73ffffffffffffffffffffffffffffffffffffffff831615801590612fca575073ffffffffffffffffffffffffffffffffffffffff821615155b8015612fdd5750612fdb3382613221565b155b156109d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4552433732314f70657261746f7246696c7465723a20696c6c6567616c206f7060448201527f657261746f7200000000000000000000000000000000000000000000000000006064820152608401610818565b6000600161307784611130565b61308191906139cc565b6000838152600a60205260409020549091508082146130e15773ffffffffffffffffffffffffffffffffffffffff841660009081526009602090815260408083208584528252808320548484528184208190558352600a90915290208190555b506000918252600a6020908152604080842084905573ffffffffffffffffffffffffffffffffffffffff9094168352600981528383209183525290812055565b600b54600090613133906001906139cc565b6000838152600c6020526040812054600b805493945090928490811061315b5761315b6138c4565b9060005260206000200154905080600b838154811061317c5761317c6138c4565b6000918252602080832090910192909255828152600c9091526040808220849055858252812055600b8054806131b4576131b4613ad8565b6001900381819060005260206000200160009055905550505050565b60006131db83611130565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526009602090815260408083208684528252808320859055938252600a9052919091209190915550565b60075460009073ffffffffffffffffffffffffffffffffffffffff168061324c576001915050610765565b6132558361107e565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415613292576001915050610765565b6040517f192c596e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063192c596e9060240160206040518083038186803b1580156132f757600080fd5b505afa15801561330b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f369190613947565b82805461333b906138f3565b90600052602060002090601f01602090048101928261335d57600085556133a3565b82601f1061337657805160ff19168380011785556133a3565b828001600101855582156133a3579182015b828111156133a3578251825591602001919060010190613388565b506133af9291506133b3565b5090565b5b808211156133af57600081556001016133b4565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461206b57600080fd5b60006020828403121561340857600080fd5b81356109e4816133c8565b60005b8381101561342e578181015183820152602001613416565b838111156116ad5750506000910152565b60008151808452613457816020860160208601613413565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006109e4602083018461343f565b6000602082840312156134ae57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461206b57600080fd5b600080604083850312156134ea57600080fd5b82356134f5816134b5565b946020939093013593505050565b6000806040838503121561351657600080fd5b50508035926020909101359150565b801515811461206b57600080fd5b6000806040838503121561354657600080fd5b8235613551816134b5565b9150602083013561356181613525565b809150509250929050565b60008060006060848603121561358157600080fd5b833561358c816134b5565b9250602084013561359c816134b5565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613623576136236135ad565b604052919050565b600067ffffffffffffffff821115613645576136456135ad565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600061368461367f8461362b565b6135dc565b905082815283838301111561369857600080fd5b828260208301376000602084830101529392505050565b600080604083850312156136c257600080fd5b82359150602083013567ffffffffffffffff8111156136e057600080fd5b8301601f810185136136f157600080fd5b61370085823560208401613671565b9150509250929050565b60006020828403121561371c57600080fd5b81356109e4816134b5565b6000806040838503121561373a57600080fd5b8235613745816134b5565b91506020830135613561816134b5565b6000806040838503121561376857600080fd5b823591506020830135613561816134b5565b6000806000806080858703121561379057600080fd5b843561379b816134b5565b935060208501356137ab816134b5565b925060408501359150606085013567ffffffffffffffff8111156137ce57600080fd5b8501601f810187136137df57600080fd5b6137ee87823560208401613671565b91505092959194509250565b604080825283519082018190526000906020906060840190828701845b8281101561384957815173ffffffffffffffffffffffffffffffffffffffff1684529284019290840190600101613817565b5050508381038285015284518082528583019183019060005b8181101561387e57835183529284019291840191600101613862565b5090979650505050505050565b6000806000606084860312156138a057600080fd5b833592506020840135915060408401356138b9816134b5565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181811c9082168061390757607f821691505b60208210811415613941577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561395957600080fd5b81516109e481613525565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156139c5576139c5613964565b5060010190565b6000828210156139de576139de613964565b500390565b600082198211156139f6576139f6613964565b500190565b600060208284031215613a0d57600080fd5b815167ffffffffffffffff811115613a2457600080fd5b8201601f81018413613a3557600080fd5b8051613a4361367f8261362b565b818152856020838501011115613a5857600080fd5b613a69826020830160208601613413565b95945050505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152613ab1608083018461343f565b9695505050505050565b600060208284031215613acd57600080fd5b81516109e4816133c8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220ca3ba97ed8409289b7c50fb56363d81066ca20adac7ab00fc04e783c5394d8ee64736f6c63430008090033

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

000000000000000000000000c73b17179bf0c59cd5860bb25247d1d1092c1088000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000063372090

-----Decoded View---------------
Arg [0] : pass (address): 0xc73B17179Bf0C59cD5860Bb25247D1D1092c1088
Arg [1] : maxPremintPassId (uint256): 11
Arg [2] : unlockTimestamp (uint256): 1664557200

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c73b17179bf0c59cd5860bb25247d1d1092c1088
Arg [1] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [2] : 0000000000000000000000000000000000000000000000000000000063372090


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.