ETH Price: $3,386.73 (-1.35%)

MAX PAIN AND FRENS OPEN EDITION BY XCOPY (MAXPAINANDFRENSOPENEDITIONBYXCOPY)
 

Overview

TokenID

171000100510

Total Transfers

-

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Welcome to the home of MAX PAIN AND FRENS BY XCOPY.

# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
NiftyBuilderInstance

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 1500 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2023-03-08
*/

// SPDX-License-Identifier: MIT

// File: contracts/core/NiftyEntity.sol

/**
 * @dev Authenticator of state mutating operations for Nifty Gateway contracts. 
 *
 * addresses for stateful operations. 
 *
 * Rinkeby: 0xCefBf44ff649B6E0Bc63785699c6F1690b8cF73b
 * Mainnet: 0x6e53130dDfF21E3BC963Ee902005223b9A202106
 */
contract NiftyEntity {
   
   // Address of {NiftyRegistry} contract. 
   address internal immutable niftyRegistryContract;
   
   /**
    * @dev Determines whether accounts are allowed to invoke state mutating operations on child contracts.
    */
    modifier onlyValidSender() {
        NiftyRegistry niftyRegistry = NiftyRegistry(niftyRegistryContract);
        bool isValid = niftyRegistry.isValidNiftySender(msg.sender);
        require(isValid, "NiftyEntity: Invalid msg.sender");
        _;
    }
    
   /**
    * @param _niftyRegistryContract Points to the repository of authenticated
    */
    constructor(address _niftyRegistryContract) {
        niftyRegistryContract = _niftyRegistryContract;
    }
}

/**
 * @dev Defined to mediate interaction with externally deployed {NiftyRegistry} dependency. 
 */
interface NiftyRegistry {
   function isValidNiftySender(address sending_key) external view returns (bool);
}

// File: contracts/interface/IERC165.sol

/**
 * @title IERC165
 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
 */
interface IERC165 {

  /**
   * @notice Query if a contract implements an interface
   * @param interfaceId The interface identifier, as specified in ERC-165
   * @dev Interface identification is specified in ERC-165. This function
   * uses less than 30,000 gas.
   */
  function supportsInterface(bytes4 interfaceId)
    external
    view
    returns (bool);
}

// File: contracts/interface/IERC721.sol

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

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

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

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

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

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

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

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

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

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

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

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

// File: contracts/interface/IERC721Receiver.sol

/**
 * @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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

// File: contracts/interface/IERC721Metadata.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: contracts/util/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: contracts/util/Strings.sol

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "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);
    }

}

// File: contracts/standard/ERC165.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: contracts/core/ERC721.sol

/**
 * @dev Nifty Gateway implementation of Non-Fungible Token Standard.
 */
contract ERC721 is NiftyEntity, Context, ERC165, IERC721, IERC721Metadata {

    // Tracked individual instance spawned by {BuilderShop} contract. 
    uint immutable public _id;

    // Number of distinct NFTs housed in this contract. 
    uint immutable public _typeCount;

    // Intial receiver of all newly minted NFTs.
    address immutable public _defaultOwner;

    // Component(s) of 'tokenId' calculation. 
    uint immutable public topLevelMultiplier;
    uint immutable public midLevelMultiplier;

    // Token name.
    string private _name;

    // Token symbol.
    string private _symbol;

    // Token artifact location.
    string private _baseURI;

    // Mapping from Nifty type to name of token.
    mapping(uint256 => string) private _niftyTypeName;

    // Mapping from Nifty type to IPFS hash of canonical artifcat file.
    mapping(uint256 => string) private _niftyTypeIPFSHashes;

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

    // Mapping owner address to token count, by aggregating all _typeCount NFTs in the contact.
    mapping (address => uint256) internal _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 token collection.
     *
     * @param name_ Of the collection being deployed.
     * @param symbol_ Shorthand token identifier, for wallets, etc.
     * @param id_ Number instance deployed by {BuilderShop} contract.
     * @param baseURI_ The location where the artifact assets are stored.
     * @param typeCount_ The number of different Nifty types (different 
     * individual NFTs) associated with the deployed collection.
     * @param defaultOwner_ Intial receiver of all newly minted NFTs.
     * @param niftyRegistryContract Points to the repository of authenticated
     * addresses for stateful operations. 
     */
    constructor(string memory name_, 
                string memory symbol_,
                uint256 id_,
                string memory baseURI_,
                uint256 typeCount_,
                address defaultOwner_, 
                address niftyRegistryContract) NiftyEntity(niftyRegistryContract) {
        _name = name_;
        _symbol = symbol_;
        _id = id_;
        _baseURI = baseURI_;
        _typeCount = typeCount_;
        _defaultOwner = defaultOwner_;

        midLevelMultiplier = 100000;
        topLevelMultiplier = id_ * 1000000000;
    }

    /**
     * @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 Returns the link to artificat location for a given token by 'tokenId'.
     * Throws if the token ID does not exist. May return an empty string.
     * @param tokenId uint256 ID of the token to query.
     * @return The location where the artifact assets are stored.
     */
    function tokenURI(uint256 tokenId) external view override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
        string memory tokenIdStr = Strings.toString(tokenId);
        return string(abi.encodePacked(_baseURI, tokenIdStr));
    }

    /**
     * @dev Returns an IPFS hash for a given token ID.
     * Throws if the token ID does not exist. May return an empty string.
     * @param tokenId uint256 ID of the token to query.
     * @return IPFS hash for this (_typeCount) NFT. 
     */
    function tokenIPFSHash(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: IPFS hash query for nonexistent token");
        uint256 niftyType = _getNiftyTypeId(tokenId);
        return _niftyTypeIPFSHashes[niftyType];
    }
    
    /**
     * @dev Determine which NFT in the contract (_typeCount) is associated 
     * with this 'tokenId'.
     */
    function _getNiftyTypeId(uint256 tokenId) internal view returns (uint256) {
        if(tokenId <= topLevelMultiplier) {
            return 0;
        } else {
            return (tokenId - topLevelMultiplier) / midLevelMultiplier;
        }        
    }

    /**
     * @dev Returns the Name for a given token ID.
     * Throws if the token ID does not exist. May return an empty string.
     * @param tokenId uint256 ID of the token to query
     */
    function tokenName(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token");
        uint256 niftyType = _getNiftyTypeId(tokenId);
        return _niftyTypeName[niftyType];
    }
   
    /**
     * @dev Internal function to set the token IPFS hash for a nifty type.
     * @param niftyType uint256 ID component of the token to set its IPFS hash
     * @param ipfs_hash string IPFS link to assign
     */
    function _setTokenIPFSHashNiftyType(uint256 niftyType, string memory ipfs_hash) internal {
        require(bytes(_niftyTypeIPFSHashes[niftyType]).length == 0, "ERC721Metadata: IPFS hash already set");
        _niftyTypeIPFSHashes[niftyType] = ipfs_hash;
    }

    /**
     * @dev Internal function to set the name for a nifty type.
     * @param niftyType uint256 of nifty type name to be set
     * @param nifty_type_name name of nifty type
     */
    function _setNiftyTypeName(uint256 niftyType, string memory nifty_type_name) internal {
        _niftyTypeName[niftyType] = nifty_type_name;
    }

    /**
     * @dev Base URI for computing {tokenURI}.
     */
    function _setBaseURI(string memory baseURI_) internal {
        _baseURI = baseURI_;
    }

    /**
     * @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 {
        require(operator != _msgSender(), "ERC721: approve to caller");
        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

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

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

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

        emit Transfer(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 of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

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

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

        emit Transfer(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 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 (isContract(to)) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
}

// File: contracts/interface/IERC20.sol

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

// File: contracts/util/Address.sol

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// File: contracts/util/SafeERC20.sol

pragma solidity ^0.8.0;



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

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

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

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

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

// File: contracts/interface/ICloneablePaymentSplitter.sol

interface ICloneablePaymentSplitter is IERC165 {
    
    event PayeeAdded(address account, uint256 shares);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
    event PaymentReceived(address from, uint256 amount);
    
    function initialize(address[] calldata payees, uint256[] calldata shares_) external;        
    function totalShares() external view returns (uint256);    
    function totalReleased() external view returns (uint256);
    function totalReleased(IERC20 token) external view returns (uint256);
    function shares(address account) external view returns (uint256);    
    function released(address account) external view returns (uint256);
    function released(IERC20 token, address account) external view returns (uint256);
    function payee(uint256 index) external view returns (address);    
    function release(address payable account) external;
    function release(IERC20 token, address account) external;
    function pendingPayment(address account) external view returns (uint256);
    function pendingPayment(IERC20 token, address account) external view returns (uint256);
}

// File: contracts/interface/IERC2981.sol

pragma solidity ^0.8.0;


///
/// @dev Interface for the NFT Royalty Standard
///
interface IERC2981 is IERC165 {
    /// ERC165 bytes to add to interface array - set in parent contract
    /// implementing this standard
    ///
    /// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
    /// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
    /// _registerInterface(_INTERFACE_ID_ERC2981);

    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _salePrice - the sale price of the NFT asset specified by _tokenId
    /// @return receiver - address of who should be sent the royalty payment
    /// @return royaltyAmount - the royalty payment amount for _salePrice
    function royaltyInfo(
        uint256 _tokenId,
        uint256 _salePrice
    ) external view returns (
        address receiver,
        uint256 royaltyAmount
    );
}

// File: contracts/standard/ERC721Burnable.sol

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

// File: contracts/util/Clones.sol

pragma solidity ^0.8.0;

// OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol)
// OpenZeppelin Contract Commit Hash: 6bd6b76d1156e20e45d1016f355d154141c7e5b9                                      

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

// File: contracts/core/NiftyBuilderInstance.sol

/** 
 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  .***   XXXXXXXXXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  ,*********  XXXXXXXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXXXXXXX  ***************  XXXXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXXXX  .*******************  XXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXX  ***********    **********  XXXXXXXX
 * XXXXXXXXXXXXXXXXXXXX   ***********       ***********  XXXXXX
 * XXXXXXXXXXXXXXXXXX  ***********         ***************  XXX
 * XXXXXXXXXXXXXXXX  ***********           ****    ********* XX
 * XXXXXXXXXXXXXXXX *********      ***    ***      *********  X
 * XXXXXXXXXXXXXXXX  **********  *****          *********** XXX
 * XXXXXXXXXXXX   /////.*************         ***********  XXXX
 * XXXXXXXXX  /////////...***********      ************  XXXXXX
 * XXXXXXX/ ///////////..... /////////   ///////////   XXXXXXXX
 * XXXXXX  /    //////.........///////////////////   XXXXXXXXXX
 * XXXXXXXXXX .///////...........//////////////   XXXXXXXXXXXXX
 * XXXXXXXXX .///////.....//..////  /////////  XXXXXXXXXXXXXXXX
 * XXXXXXX# /////////////////////  XXXXXXXXXXXXXXXXXXXXXXXXXXXX
 * XXXXX   ////////////////////   XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 * XX   ////////////// //////   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 *
 * @dev Nifty Gateway extension of customized NFT contract, encapsulates
 * logic for minting new tokens, and concluding the minting process. 
 */
contract NiftyBuilderInstance is ERC721, ERC721Burnable, IERC2981 {

    event RoyaltyReceiverUpdated(uint256 indexed niftyType, address previousReceiver, address newReceiver);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);

    // The artist associated with the collection.
    string private _creator;    

    uint256 immutable public _percentageTotal;
    mapping(uint256 => uint256) public _percentageRoyalty;

    mapping (uint256 => address) _royaltySplitters;
    mapping (uint256 => address) _royaltyReceivers;

    // Number of NFTs minted for a given 'typeCount'. 
    mapping (uint256 => uint256) public _mintCount;

    /**
     * @dev Serves as a gas cost optimized boolean flag 
     * to indicate whether the minting process has been 
     * concluded for a given 'typeCount', correspinds 
     * to the {_getFinalized} and {setFinalized}.
     */
    mapping (uint256 => bytes32) private _finalized;    

    /**
     * @dev Emitted when tokens are created.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed fromAddress, address indexed toAddress);

    /**
     * @dev Ultimate instantiation of a Nifty Gateway NFT collection. 
     * 
     * @param name Of the collection being deployed.
     * @param symbol Shorthand token identifier, for wallets, etc.
     * @param id Number instance deployed by {BuilderShop} contract.
     * @param typeCount The number of different Nifty types (different 
     * individual NFTs) associated with the deployed collection.
     * @param baseURI The location where the artifact assets are stored.
     * @param creator_ The artist associated with the collection.
     * @param niftyRegistryContract Points to the repository of authenticated
     * addresses for stateful operations. 
     * @param defaultOwner Intial receiver of all newly minted NFTs.
     */
    constructor(
        string memory name,
        string memory symbol,
        uint256 id,
        uint256 typeCount,
        string memory baseURI,
        string memory creator_,        
        address niftyRegistryContract,
        address defaultOwner) ERC721(name, symbol, id, baseURI, typeCount, defaultOwner, niftyRegistryContract) {
        
        _creator = creator_;
        _percentageTotal = 10000;        
    }

    function setRoyaltyBips(uint256 niftyType, uint256 percentageRoyalty_) external onlyValidSender {
        require(percentageRoyalty_ <= _percentageTotal, "NiftyBuilderInstance: Illegal argument more than 100%");
        _percentageRoyalty[niftyType] = percentageRoyalty_;
    }

    function royaltyInfo(uint256 tokenId, uint256 salePrice) public override view returns (address, uint256) {        
        require(_exists(tokenId), "NiftyBuilderInstance: operator query for nonexistent token");
        uint256 niftyType = _getNiftyTypeId(tokenId);
        uint256 royaltyAmount = (salePrice * _percentageRoyalty[niftyType]) / _percentageTotal;
        address royaltyReceiver = _getRoyaltyReceiverByNiftyType(niftyType);
        require(royaltyReceiver != address(0), "NiftyBuilderInstance: No royalty receiver");
        return (royaltyReceiver, royaltyAmount);
    }

    // This function must be called after builder shop instance is created - it can be called again
    // to change the split; call this once per nifty type to set up royalty payments properly
    function initializeRoyalties(address splitterImplementation, uint256 niftyType, address[] calldata payees, uint256[] calldata shares_) external onlyValidSender {
        address previousReceiver = _getRoyaltyReceiverByNiftyType(niftyType);
        address newReceiver = address(0);
        if(payees.length == 1) {
            newReceiver = payees[0];
            _royaltyReceivers[niftyType] = newReceiver;
            delete _royaltySplitters[niftyType];
        } else {            
            delete _royaltyReceivers[niftyType];
            require(IERC165(splitterImplementation).supportsInterface(type(ICloneablePaymentSplitter).interfaceId), "Not a valid payment splitter");
            newReceiver = payable (Clones.clone(splitterImplementation));
            ICloneablePaymentSplitter(newReceiver).initialize(payees, shares_);
            _royaltySplitters[niftyType] = newReceiver;        
        }

        emit RoyaltyReceiverUpdated(niftyType, previousReceiver, newReceiver);        
    }

    function getRoyaltyReceiverByTokenId(uint256 tokenId) public view returns (address) {        
        return _getRoyaltyReceiverByNiftyType(_getNiftyTypeId(tokenId));
    }

    function getRoyaltyReceiverByNiftyType(uint256 niftyType) public view returns (address) {
        return _getRoyaltyReceiverByNiftyType(niftyType);
    }

    function releaseRoyalties(address payable account) external {
        uint256 totalPaymentAmount = 0;
        for(uint256 niftyType = 1; niftyType <= _typeCount; niftyType++) {
            address paymentSplitterAddress = _royaltySplitters[niftyType];
            if(paymentSplitterAddress != address(0)) {
                ICloneablePaymentSplitter paymentSplitter = ICloneablePaymentSplitter(paymentSplitterAddress);    
                uint256 pendingPaymentAmount = paymentSplitter.pendingPayment(account);
                if(pendingPaymentAmount > 0) {
                    totalPaymentAmount += pendingPaymentAmount;
                    paymentSplitter.release(account);
                }
            }            
        }

        if(totalPaymentAmount > 0) {
            emit PaymentReleased(account, totalPaymentAmount);
        }    
    }

    function releaseRoyalties(IERC20 token, address account) external {
        uint256 totalPaymentAmount = 0;
        for(uint256 niftyType = 1; niftyType <= _typeCount; niftyType++) {
            address paymentSplitterAddress = _royaltySplitters[niftyType];
            if(paymentSplitterAddress != address(0)) {
                ICloneablePaymentSplitter paymentSplitter = ICloneablePaymentSplitter(paymentSplitterAddress);    
                uint256 pendingPaymentAmount = paymentSplitter.pendingPayment(token, account);
                if(pendingPaymentAmount > 0) {
                    totalPaymentAmount += pendingPaymentAmount;
                    paymentSplitter.release(token, account);
                }
            }            
        }

        if(totalPaymentAmount > 0) {
            emit ERC20PaymentReleased(token, account, totalPaymentAmount);
        }    
    }
    
    function pendingRoyaltyPayment(address account) external view returns (uint256) {
        uint256 totalPaymentAmount = 0;
        for(uint256 niftyType = 1; niftyType <= _typeCount; niftyType++) {
            address paymentSplitterAddress = _royaltySplitters[niftyType];
            if(paymentSplitterAddress != address(0)) {
                ICloneablePaymentSplitter paymentSplitter = ICloneablePaymentSplitter(paymentSplitterAddress);    
                totalPaymentAmount += paymentSplitter.pendingPayment(account);
            }            
        }
        return totalPaymentAmount;
    }

    function pendingRoyaltyPayment(IERC20 token, address account) external view returns (uint256) {
        uint256 totalPaymentAmount = 0;
        for(uint256 niftyType = 1; niftyType <= _typeCount; niftyType++) {
            address paymentSplitterAddress = _royaltySplitters[niftyType];
            if(paymentSplitterAddress != address(0)) {
                ICloneablePaymentSplitter paymentSplitter = ICloneablePaymentSplitter(paymentSplitterAddress);    
                totalPaymentAmount += paymentSplitter.pendingPayment(token, account);
            }            
        }
        return totalPaymentAmount;
    }

    /**
     * @dev Generate canonical Nifty Gateway token representation. 
     * Nifty contracts have a data model called a 'niftyType' (typeCount) 
     * The 'niftyType' refers to a specific nifty in our contract, note 
     * that it gives no information about the edition size. In a given 
     * contract, 'niftyType' 1 could be an edition of 10, while 'niftyType' 
     * 2 is a 1/1, etc.
     * The token IDs are encoded as follows: {id}{niftyType}{edition #}
     * 'niftyType' has 4 digits, and edition number has 5 digits, to allow 
     * for 99999 possible 'niftyType' and 99999 of each edition in each contract.
     * Example token id: [5000100270]
     * This is from contract #5, it is 'niftyType' 1 in the contract, and it is 
     * edition #270 of 'niftyType' 1.
     * Example token id: [5000110000]
     * This is from contract #5, it is 'niftyType' 1 in the contract, and it is 
     * edition #10000 of 'niftyType' 1.
     */
    function _encodeTokenId(uint256 niftyType, uint256 tokenNumber) private view returns (uint256) {
        return (topLevelMultiplier + (niftyType * midLevelMultiplier) + tokenNumber);
    }

    /**
     * @dev Determine whether it is possible to mint additional NFTs for this 'niftyType'.
     */
    function _getFinalized(uint256 niftyType) public view returns (bool) {
        bytes32 chunk = _finalized[niftyType / 256];
        return (chunk & bytes32(1 << (niftyType % 256))) != 0x0;
    }

    /**
     * @dev Prevent the minting of additional NFTs of this 'niftyType'.
     */
    function setFinalized(uint256 niftyType) public onlyValidSender {
        uint256 quotient = niftyType / 256;
        bytes32 chunk = _finalized[quotient];
        _finalized[quotient] = chunk | bytes32(1 << (niftyType % 256));
    }

    /**
     * @dev The artist of this collection.
     */
    function creator() public view virtual returns (string memory) {
        return _creator;
    }

    /**
     * @dev Assign the root location where the artifact assets are stored.
     */
    function setBaseURI(string memory baseURI) public onlyValidSender {
        _setBaseURI(baseURI);
    }

    /**
     * @dev Allow owner to change nifty name, by 'niftyType'.
     */
    function setNiftyName(uint256 niftyType, string memory niftyName) public onlyValidSender {
        _setNiftyTypeName(niftyType, niftyName);
    }

    /**
     * @dev Assign the IPFS hash of canonical artifcat file, by 'niftyType'.
     */   
    function setNiftyIPFSHash(uint256 niftyType, string memory hashIPFS) public onlyValidSender {
        _setTokenIPFSHashNiftyType(niftyType, hashIPFS);
    }

    /**
     * @dev Create specified number of nifties en masse.
     * Once an NFT collection is spawned by the factory contract, we make calls to set the IPFS
     * hash (above) for each Nifty type in the collection. 
     * Subsequently calls are issued to this function to mint the appropriate number of tokens 
     * for the project.
     */
    function mintNifty(uint256 niftyType, uint256 count) public onlyValidSender {
        require(!_getFinalized(niftyType), "NiftyBuilderInstance: minting concluded for nifty type");
            
        uint256 tokenNumber = _mintCount[niftyType] + 1;
        uint256 tokenId00 = _encodeTokenId(niftyType, tokenNumber);
        uint256 tokenId01 = tokenId00 + count - 1;
        
        for (uint256 tokenId = tokenId00; tokenId <= tokenId01; tokenId++) {
            _owners[tokenId] = _defaultOwner;
        }
        _mintCount[niftyType] += count;
        _balances[_defaultOwner] += count;

        emit ConsecutiveTransfer(tokenId00, tokenId01, address(0), _defaultOwner);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }    

    function _getRoyaltyReceiverByNiftyType(uint256 niftyType) private view returns (address) {
        if(_royaltyReceivers[niftyType] != address(0)) {            
            return _royaltyReceivers[niftyType];
        } else if(_royaltySplitters[niftyType] != address(0)) {            
            return _royaltySplitters[niftyType];
        }

        return address(0);   
    }
}

// File: contracts/core/BuilderShop.sol

pragma solidity ^0.8.6;



/**
 *   ::::::::::::::::::::::::::::::::::::::::::::
 * ::::::::::::::::::::::::::::::::::::::::::::::::
 * ::::::::::::::::::::::::::::::::::::::::::::::::
 * ::::::::::::NNNNNNNNN:::::::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNNNN::::::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNNNNN:::::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNNNNNN::::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNNNNNNN:::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNNNNNNNN::NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN:NNNNNN:NNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN::NNNNNNNNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN:::NNNNNNNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN::::NNNNNNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN:::::NNNNNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN::::::NNNNNNNNNN::::::::::::
 * ::::::::::::NNNNNNNN:::::::NNNNNNNNN::::::::::::
 * ::::::::::::::::::::::::::::::::::::::::::::::::
 * ::::::::::::::::::::::::::::::::::::::::::::::::
 *   ::::::::::::::::::::::::::::::::::::::::::::
 *  
 * @dev Nexus of the Nifty Gateway smartcontract constellation.
 * {BuilderShop} is a factory contract, when a new collection
 * is slated for deployment, a call is made to this factory 
 * contract to create it. 
 */
contract BuilderShop is NiftyEntity {

    /**
     * @dev Tracks the latest {NiftyBuilderInstance} deployment, supplied as constructor 
     * argument. Every time a new contract is deployed from this "master" factory contract, 
     * it is given a contract id that is one higher than the previous contract deployed.
     */
    uint public _id;

    // Provided as a argument to {NiftyBuilderInstance} deployment.
    address public _defaultOwner;

    // Reference for validation of posible {NiftyBuilderInstance} by address.
    mapping (address => bool) public validBuilderInstance;

    // Log the creation of each {NiftyBuilderInstance} deployment. 
    event BuilderInstanceCreated(address instanceAddress, uint id);

    /**
     * @param niftyRegistryContract Points to the mainnet repository of addresses
     * allowed to invoke state mutating operations via the modifier 'onlyValidSender'.
     * @param defaultOwner_ The address to which all tokens are initially minted.
     */
    constructor(address niftyRegistryContract,
                address defaultOwner_) NiftyEntity(niftyRegistryContract) {
        _defaultOwner = defaultOwner_;
    }

    /**
     * @dev Configurable address for defaultOwner.
     * @param defaultOwner account to which newly minted tokens are allocated.
     */ 
    function setDefaultOwner(address defaultOwner) onlyValidSender external {
        _defaultOwner = defaultOwner;
    }

    /**
     * @dev Allow anyone to check if a contract address is a valid nifty gateway contract.
     * @param instanceAddress address of potential spawned {NiftyBuilderInstance}.
     * @return bool whether or not the contract was initialized by this {BuilderShop}.
     */
    function isValidBuilderInstance(address instanceAddress) external view returns (bool) {
        return (validBuilderInstance[instanceAddress]);
    }

    /**
     * @dev Collections on the platform are associated with a call to this 
     * function which will generate a {NiftyBuilderInstance} to house the 
     * NFTs for that particular artist release. 
     * 
     * @param name Of the collection being deployed.
     * @param symbol Shorthand token identifier, for wallets, etc.
     * @param typeCount The number of different Nifty types (different 
     * individual NFTs) associated with the deployed collection.
     * @param baseURI The location where the artifact assets are stored.
     * @param creator The artist associated with the collection.
     */
    function createNewBuilderInstance(
        string memory name,
        string memory symbol,
        uint256 typeCount,
        string memory baseURI,
        string memory creator) external onlyValidSender { 
        
        _id += 1;

        NiftyBuilderInstance instance = new NiftyBuilderInstance(
            name,
            symbol,
            _id,
            typeCount,
            baseURI,
            creator,
            niftyRegistryContract,
            _defaultOwner
        );
        address instanceAddress = address(instance);
        validBuilderInstance[instanceAddress] = true;

        emit BuilderInstanceCreated(instanceAddress, _id);
    }
   
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"typeCount","type":"uint256"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"creator_","type":"string"},{"internalType":"address","name":"niftyRegistryContract","type":"address"},{"internalType":"address","name":"defaultOwner","type":"address"}],"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":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"niftyType","type":"uint256"},{"indexed":false,"internalType":"address","name":"previousReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"newReceiver","type":"address"}],"name":"RoyaltyReceiverUpdated","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":[],"name":"_defaultOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"}],"name":"_getFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_id","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_mintCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_percentageRoyalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_percentageTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_typeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"niftyType","type":"uint256"}],"name":"getRoyaltyReceiverByNiftyType","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRoyaltyReceiverByTokenId","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"splitterImplementation","type":"address"},{"internalType":"uint256","name":"niftyType","type":"uint256"},{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares_","type":"uint256[]"}],"name":"initializeRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"midLevelMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintNifty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"pendingRoyaltyPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"pendingRoyaltyPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"releaseRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"releaseRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"}],"name":"setFinalized","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"},{"internalType":"string","name":"hashIPFS","type":"string"}],"name":"setNiftyIPFSHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"},{"internalType":"string","name":"niftyName","type":"string"}],"name":"setNiftyName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"niftyType","type":"uint256"},{"internalType":"uint256","name":"percentageRoyalty_","type":"uint256"}],"name":"setRoyaltyBips","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":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenIPFSHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"topLevelMultiplier","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"}]

6101606040523480156200001257600080fd5b5060405162003ab238038062003ab283398101604081905262000035916200027e565b6001600160601b0319606083901b16608052875188908890889087908990869088906200006a9060009060208a019062000104565b5085516200008090600190602089019062000104565b5060a085905283516200009b90600290602087019062000104565b5060c08390526001600160601b0319606083901b1660e052620186a061012052620000cb85633b9aca0062000370565b6101005250508751620000ed9550600994506020890193509150620001049050565b50506127106101405250620003f195505050505050565b82805462000112906200039e565b90600052602060002090601f01602090048101928262000136576000855562000181565b82601f106200015157805160ff191683800117855562000181565b8280016001018555821562000181579182015b828111156200018157825182559160200191906001019062000164565b506200018f92915062000193565b5090565b5b808211156200018f576000815560010162000194565b80516001600160a01b0381168114620001c257600080fd5b919050565b600082601f830112620001d957600080fd5b81516001600160401b0380821115620001f657620001f6620003db565b604051601f8301601f19908116603f01168101908282118183101715620002215762000221620003db565b816040528381526020925086838588010111156200023e57600080fd5b600091505b8382101562000262578582018301518183018401529082019062000243565b83821115620002745760008385830101525b9695505050505050565b600080600080600080600080610100898b0312156200029c57600080fd5b88516001600160401b0380821115620002b457600080fd5b620002c28c838d01620001c7565b995060208b0151915080821115620002d957600080fd5b620002e78c838d01620001c7565b985060408b0151975060608b0151965060808b01519150808211156200030c57600080fd5b6200031a8c838d01620001c7565b955060a08b01519150808211156200033157600080fd5b50620003408b828c01620001c7565b9350506200035160c08a01620001aa565b91506200036160e08a01620001aa565b90509295985092959890939650565b60008160001904831182151516156200039957634e487b7160e01b600052601160045260246000fd5b500290565b600181811c90821680620003b357607f821691505b60208210811415620003d557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160c05160e05160601c6101005161012051610140516135d4620004de6000396000818161058301528181610b0e015261151e0152600081816103d8015281816123e00152612945015260008181610549015281816123b10152818161240401526129700152600081816103b1015281816110fe0152818161116901526111bc0152600081816103ff01528181610cdc01528181611b4f01528181611c47015261216701526000610321015260008181610bef01528181610f430152818161122d01528181611446015281816115e6015281816119640152611fcb01526135d46000f3fe608060405234801561001057600080fd5b50600436106102c75760003560e01c80636352211e1161017b578063a80ce4b4116100d8578063d37166301161008c578063e725f87711610071578063e725f87714610665578063e985e9c514610678578063f5abac49146106b457600080fd5b8063d37166301461063f578063d7a853be1461065257600080fd5b8063b536d0fa116100bd578063b536d0fa14610606578063b88d4fde14610619578063c87b56dd1461062c57600080fd5b8063a80ce4b4146105d3578063acd074f5146105e657600080fd5b80638ddadb201161012f57806395d89b411161011457806395d89b41146105a55780639dd5e481146105ad578063a22cb465146105c057600080fd5b80638ddadb201461056b5780639121ac0d1461057e57600080fd5b80637889cc16116101605780637889cc161461051e5780638a0fc1da146105315780638ca00c0d1461054457600080fd5b80636352211e146104f857806370a082311461050b57600080fd5b80632276f3f21161022957806342842e0e116101dd5780634fba84ca116101c25780634fba84ca146104b257806355f804b3146104c55780635f2ef9dc146104d857600080fd5b806342842e0e1461048c57806342966c681461049f57600080fd5b80632a55205a1161020e5780632a55205a146104345780632b6db05514610466578063396478d31461047957600080fd5b80632276f3f2146103fa57806323b872dd1461042157600080fd5b806306fdde0311610280578063095ea7b311610265578063095ea7b314610397578063139fed7c146103ac5780631a521760146103d357600080fd5b806306fdde031461037c578063081812fc1461038457600080fd5b806302d05d3f116102b157806302d05d3f14610307578063051802371461031c578063051c62ae1461035157600080fd5b8062cd587c146102cc57806301ffc9a7146102f4575b600080fd5b6102df6102da36600461319f565b6106c7565b60405190151581526020015b60405180910390f35b6102df610302366004613130565b610705565b61030f610749565b6040516102eb9190613402565b6103437f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016102eb565b61036461035f36600461319f565b6107db565b6040516001600160a01b0390911681526020016102eb565b61030f6107ee565b61036461039236600461319f565b6107fd565b6103aa6103a536600461305b565b6108a8565b005b6103647f000000000000000000000000000000000000000000000000000000000000000081565b6103437f000000000000000000000000000000000000000000000000000000000000000081565b6103437f000000000000000000000000000000000000000000000000000000000000000081565b6103aa61042f366004612f6c565b6109da565b610447610442366004613218565b610a62565b604080516001600160a01b0390931683526020830191909152016102eb565b6103aa6104743660046131d1565b610bda565b6103aa610487366004612f16565b610cd5565b6103aa61049a366004612f6c565b610e8c565b6103aa6104ad36600461319f565b610ea7565b6103aa6104c0366004613218565b610f2e565b6103aa6104d336600461316a565b611218565b6103436104e636600461319f565b600d6020526000908152604090205481565b61036461050636600461319f565b61130c565b610343610519366004612f16565b611397565b6103aa61052c366004613218565b611431565b61036461053f36600461319f565b6115c6565b6103437f000000000000000000000000000000000000000000000000000000000000000081565b6103aa610579366004613087565b6115d1565b6103437f000000000000000000000000000000000000000000000000000000000000000081565b61030f611940565b6103aa6105bb36600461319f565b61194f565b6103aa6105ce36600461302d565b611a82565b6103436105e1366004612f33565b611b47565b6103436105f436600461319f565b600a6020526000908152604090205481565b610343610614366004612f16565b611c3f565b6103aa610627366004612fad565b611d2e565b61030f61063a36600461319f565b611db6565b61030f61064d36600461319f565b611e7b565b6103aa6106603660046131d1565b611fb6565b61030f61067336600461319f565b6120ab565b6102df610686366004612f33565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b6103aa6106c2366004612f33565b612160565b600080600e816106d96101008661342d565b8152602001908152602001600020549050610100836106f891906134f9565b6001901b16151592915050565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061074357506107438261232b565b92915050565b606060098054610758906134a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610784906134a3565b80156107d15780601f106107a6576101008083540402835291602001916107d1565b820191906000526020600020905b8154815290600101906020018083116107b457829003601f168201915b5050505050905090565b60006107436107e9836123ad565b612438565b606060008054610758906134a3565b6000818152600560205260408120546001600160a01b031661088c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006108b38261130c565b9050806001600160a01b0316836001600160a01b0316141561093d5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610883565b336001600160a01b038216148061095957506109598133610686565b6109cb5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610883565b6109d583836124b2565b505050565b6109e5335b82612520565b610a575760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610883565b6109d5838383612628565b60008281526005602052604081205481906001600160a01b0316610aee5760405162461bcd60e51b815260206004820152603a60248201527f4e696674794275696c646572496e7374616e63653a206f70657261746f72207160448201527f7565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000006064820152608401610883565b6000610af9856123ad565b6000818152600a6020526040812054919250907f000000000000000000000000000000000000000000000000000000000000000090610b389087613441565b610b42919061342d565b90506000610b4f83612438565b90506001600160a01b038116610bcd5760405162461bcd60e51b815260206004820152602960248201527f4e696674794275696c646572496e7374616e63653a204e6f20726f79616c747960448201527f20726563656976657200000000000000000000000000000000000000000000006064820152608401610883565b93509150505b9250929050565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b158015610c3e57600080fd5b505afa158015610c52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c769190613113565b905080610cc55760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b610ccf84846127f5565b50505050565b600060015b7f00000000000000000000000000000000000000000000000000000000000000008111610e3e576000818152600b60205260409020546001600160a01b03168015610e2b57604051632bab85df60e21b81526001600160a01b038581166004830152829160009183169063aeae177c9060240160206040518083038186803b158015610d6557600080fd5b505afa158015610d79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9d91906131b8565b90508015610e2857610daf8186613415565b6040517f191655870000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015291965090831690631916558790602401600060405180830381600087803b158015610e0f57600080fd5b505af1158015610e23573d6000803e3d6000fd5b505050505b50505b5080610e36816134de565b915050610cda565b508015610e8857604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15b5050565b6109d583838360405180602001604052806000815250611d2e565b610eb0336109df565b610f225760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f766564000000000000000000000000000000006064820152608401610883565b610f2b816128a2565b50565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b158015610f9257600080fd5b505afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca9190613113565b9050806110195760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b611022846106c7565b156110955760405162461bcd60e51b815260206004820152603660248201527f4e696674794275696c646572496e7374616e63653a206d696e74696e6720636f60448201527f6e636c7564656420666f72206e696674792074797065000000000000000000006064820152608401610883565b6000848152600d60205260408120546110af906001613415565b905060006110bd868361293d565b9050600060016110cd8784613415565b6110d79190613460565b9050815b81811161113b57600081815260056020526040902080546001600160a01b0319167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031617905580611133816134de565b9150506110db565b506000878152600d60205260408120805488929061115a908490613415565b90915550506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016600090815260066020526040812080548892906111a7908490613415565b90915550506040518181526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169060009084907fdeaa91b6123d068f5821d0fb0678463d1a8a6079fe8af5de3ce5e896dcf9133d9060200160405180910390a450505050505050565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561127c57600080fd5b505afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190613113565b9050806113035760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b6109d5836129a5565b6000818152600560205260408120546001600160a01b0316806107435760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610883565b60006001600160a01b0382166114155760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610883565b506001600160a01b031660009081526006602052604090205490565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561149557600080fd5b505afa1580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190613113565b90508061151c5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b7f00000000000000000000000000000000000000000000000000000000000000008311156115b25760405162461bcd60e51b815260206004820152603560248201527f4e696674794275696c646572496e7374616e63653a20496c6c6567616c20617260448201527f67756d656e74206d6f7265207468616e203130302500000000000000000000006064820152608401610883565b50506000918252600a602052604090912055565b600061074382612438565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561163557600080fd5b505afa158015611649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166d9190613113565b9050806116bc5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b60006116c788612438565b90506000600187141561173f57878760008181106116e7576116e7613539565b90506020020160208101906116fc9190612f16565b60008a8152600c6020908152604080832080546001600160a01b0386166001600160a01b031991821617909155600b9092529091208054909116905590506118ef565b6000898152600c60205260409081902080546001600160a01b0319169055516301ffc9a760e01b81527f37de79fc0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038b16906301ffc9a79060240160206040518083038186803b1580156117ba57600080fd5b505afa1580156117ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f29190613113565b61183e5760405162461bcd60e51b815260206004820152601c60248201527f4e6f7420612076616c6964207061796d656e742073706c6974746572000000006044820152606401610883565b6118478a6129b8565b6040517f7fbbe46f0000000000000000000000000000000000000000000000000000000081529091506001600160a01b03821690637fbbe46f90611895908b908b908b908b90600401613365565b600060405180830381600087803b1580156118af57600080fd5b505af11580156118c3573d6000803e3d6000fd5b50505060008a8152600b6020526040902080546001600160a01b0319166001600160a01b038416179055505b604080516001600160a01b038085168252831660208201528a917f834a47bfbb51ad808d8649527d9bf540f58cc71dc1093ae2249c8b230575ce98910160405180910390a250505050505050505050565b606060018054610758906134a3565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b1580156119b357600080fd5b505afa1580156119c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119eb9190613113565b905080611a3a5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b6000611a486101008561342d565b6000818152600e6020526040902054909150611a66610100866134f9565b6000928352600e6020526040909220600190921b179055505050565b6001600160a01b038216331415611adb5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610883565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60008060015b7f00000000000000000000000000000000000000000000000000000000000000008111611c37576000818152600b60205260409020546001600160a01b03168015611c245760405163049268bd60e31b81526001600160a01b038781166004830152868116602483015282919082169063249345e89060440160206040518083038186803b158015611bde57600080fd5b505afa158015611bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1691906131b8565b611c209085613415565b9350505b5080611c2f816134de565b915050611b4d565b509392505050565b60008060015b7f00000000000000000000000000000000000000000000000000000000000000008111611d27576000818152600b60205260409020546001600160a01b03168015611d1457604051632bab85df60e21b81526001600160a01b03868116600483015282919082169063aeae177c9060240160206040518083038186803b158015611cce57600080fd5b505afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0691906131b8565b611d109085613415565b9350505b5080611d1f816134de565b915050611c45565b5092915050565b611d383383612520565b611daa5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610883565b610ccf84848484612a6e565b6000818152600560205260409020546060906001600160a01b0316611e435760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610883565b6000611e4e83612af7565b9050600281604051602001611e64929190613282565b604051602081830303815290604052915050919050565b6000818152600560205260409020546060906001600160a01b0316611f085760405162461bcd60e51b815260206004820152603560248201527f4552433732314d657461646174613a204950465320686173682071756572792060448201527f666f72206e6f6e6578697374656e7420746f6b656e00000000000000000000006064820152608401610883565b6000611f13836123ad565b6000818152600460205260409020805491925090611f30906134a3565b80601f0160208091040260200160405190810160405280929190818152602001828054611f5c906134a3565b8015611fa95780601f10611f7e57610100808354040283529160200191611fa9565b820191906000526020600020905b815481529060010190602001808311611f8c57829003601f168201915b5050505050915050919050565b6040516371be737d60e11b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561201a57600080fd5b505afa15801561202e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120529190613113565b9050806120a15760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b610ccf8484612c29565b6000818152600560205260409020546060906001600160a01b03166121385760405162461bcd60e51b815260206004820152603060248201527f4552433732314d657461646174613a204e616d6520717565727920666f72206e60448201527f6f6e6578697374656e7420746f6b656e000000000000000000000000000000006064820152608401610883565b6000612143836123ad565b6000818152600360205260409020805491925090611f30906134a3565b600060015b7f000000000000000000000000000000000000000000000000000000000000000081116122d9576000818152600b60205260409020546001600160a01b031680156122c65760405163049268bd60e31b81526001600160a01b0386811660048301528581166024830152829160009183169063249345e89060440160206040518083038186803b1580156121f857600080fd5b505afa15801561220c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223091906131b8565b905080156122c3576122428186613415565b6040517f48b750440000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301528881166024830152919650908316906348b7504490604401600060405180830381600087803b1580156122aa57600080fd5b505af11580156122be573d6000803e3d6000fd5b505050505b50505b50806122d1816134de565b915050612165565b5080156109d557604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061238e57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061074357506301ffc9a760e01b6001600160e01b0319831614610743565b60007f000000000000000000000000000000000000000000000000000000000000000082116123de57506000919050565b7f00000000000000000000000000000000000000000000000000000000000000006124297f000000000000000000000000000000000000000000000000000000000000000084613460565b610743919061342d565b919050565b6000818152600c60205260408120546001600160a01b03161561247157506000908152600c60205260409020546001600160a01b031690565b6000828152600b60205260409020546001600160a01b0316156124aa57506000908152600b60205260409020546001600160a01b031690565b506000919050565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124e78261130c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600560205260408120546001600160a01b03166125aa5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610883565b60006125b58361130c565b9050806001600160a01b0316846001600160a01b031614806125f05750836001600160a01b03166125e5846107fd565b6001600160a01b0316145b8061262057506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661263b8261130c565b6001600160a01b0316146126b75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610883565b6001600160a01b0382166127325760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610883565b61273d6000826124b2565b6001600160a01b0383166000908152600660205260408120805460019290612766908490613460565b90915550506001600160a01b0382166000908152600660205260408120805460019290612794908490613415565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828152600460205260409020805461280e906134a3565b1590506128835760405162461bcd60e51b815260206004820152602560248201527f4552433732314d657461646174613a2049504653206861736820616c7265616460448201527f79207365740000000000000000000000000000000000000000000000000000006064820152608401610883565b600082815260046020908152604090912082516109d592840190612da2565b60006128ad8261130c565b90506128ba6000836124b2565b6001600160a01b03811660009081526006602052604081208054600192906128e3908490613460565b909155505060008281526005602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60008161296a7f000000000000000000000000000000000000000000000000000000000000000085613441565b612994907f0000000000000000000000000000000000000000000000000000000000000000613415565b61299e9190613415565b9392505050565b8051610e88906002906020840190612da2565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b0381166124335760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610883565b612a79848484612628565b612a8584848484612c48565b610ccf5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610883565b606081612b3757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612b615780612b4b816134de565b9150612b5a9050600a8361342d565b9150612b3b565b60008167ffffffffffffffff811115612b7c57612b7c61354f565b6040519080825280601f01601f191660200182016040528015612ba6576020820181803683370190505b5090505b841561262057612bbb600183613460565b9150612bc8600a866134f9565b612bd3906030613415565b60f81b818381518110612be857612be8613539565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612c22600a8661342d565b9450612baa565b600082815260036020908152604090912082516109d592840190612da2565b6000833b15612d9757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c83903390899088908890600401613329565b602060405180830381600087803b158015612c9d57600080fd5b505af1925050508015612ccd575060408051601f3d908101601f19168201909252612cca9181019061314d565b60015b612d7d573d808015612cfb576040519150601f19603f3d011682016040523d82523d6000602084013e612d00565b606091505b508051612d755760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610883565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612620565b506001949350505050565b828054612dae906134a3565b90600052602060002090601f016020900481019282612dd05760008555612e16565b82601f10612de957805160ff1916838001178555612e16565b82800160010185558215612e16579182015b82811115612e16578251825591602001919060010190612dfb565b50612e22929150612e26565b5090565b5b80821115612e225760008155600101612e27565b600067ffffffffffffffff80841115612e5657612e5661354f565b604051601f8501601f19908116603f01168101908282118183101715612e7e57612e7e61354f565b81604052809350858152868686011115612e9757600080fd5b858560208301376000602087830101525050509392505050565b60008083601f840112612ec357600080fd5b50813567ffffffffffffffff811115612edb57600080fd5b6020830191508360208260051b8501011115610bd357600080fd5b600082601f830112612f0757600080fd5b61299e83833560208501612e3b565b600060208284031215612f2857600080fd5b813561299e81613565565b60008060408385031215612f4657600080fd5b8235612f5181613565565b91506020830135612f6181613565565b809150509250929050565b600080600060608486031215612f8157600080fd5b8335612f8c81613565565b92506020840135612f9c81613565565b929592945050506040919091013590565b60008060008060808587031215612fc357600080fd5b8435612fce81613565565b93506020850135612fde81613565565b925060408501359150606085013567ffffffffffffffff81111561300157600080fd5b8501601f8101871361301257600080fd5b61302187823560208401612e3b565b91505092959194509250565b6000806040838503121561304057600080fd5b823561304b81613565565b91506020830135612f618161357a565b6000806040838503121561306e57600080fd5b823561307981613565565b946020939093013593505050565b600080600080600080608087890312156130a057600080fd5b86356130ab81613565565b955060208701359450604087013567ffffffffffffffff808211156130cf57600080fd5b6130db8a838b01612eb1565b909650945060608901359150808211156130f457600080fd5b5061310189828a01612eb1565b979a9699509497509295939492505050565b60006020828403121561312557600080fd5b815161299e8161357a565b60006020828403121561314257600080fd5b813561299e81613588565b60006020828403121561315f57600080fd5b815161299e81613588565b60006020828403121561317c57600080fd5b813567ffffffffffffffff81111561319357600080fd5b61262084828501612ef6565b6000602082840312156131b157600080fd5b5035919050565b6000602082840312156131ca57600080fd5b5051919050565b600080604083850312156131e457600080fd5b82359150602083013567ffffffffffffffff81111561320257600080fd5b61320e85828601612ef6565b9150509250929050565b6000806040838503121561322b57600080fd5b50508035926020909101359150565b60008151808452613252816020860160208601613477565b601f01601f19169290920160200192915050565b60008151613278818560208601613477565b9290920192915050565b600080845481600182811c91508083168061329e57607f831692505b60208084108214156132be57634e487b7160e01b86526022600452602486fd5b8180156132d257600181146132e357613310565b60ff19861689528489019650613310565b60008b81526020902060005b868110156133085781548b8201529085019083016132ef565b505084890196505b5050505050506133208185613266565b95945050505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261335b608083018461323a565b9695505050505050565b6040808252810184905260008560608301825b878110156133a857823561338b81613565565b6001600160a01b0316825260209283019290910190600101613378565b5083810360208501528481527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8511156133e157600080fd5b8460051b915081866020830137600091016020019081529695505050505050565b60208152600061299e602083018461323a565b600082198211156134285761342861350d565b500190565b60008261343c5761343c613523565b500490565b600081600019048311821515161561345b5761345b61350d565b500290565b6000828210156134725761347261350d565b500390565b60005b8381101561349257818101518382015260200161347a565b83811115610ccf5750506000910152565b600181811c908216806134b757607f821691505b602082108114156134d857634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156134f2576134f261350d565b5060010190565b60008261350857613508613523565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f2b57600080fd5b8015158114610f2b57600080fd5b6001600160e01b031981168114610f2b57600080fdfea2646970667358221220fa1f2c25c9387dca1499fcd6364d92939002770f7e2dfbf46ec0fb1f14fe47f164736f6c634300080600330000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002200000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d500000000000000000000000000000000000000000000000000000000000000284d4158205041494e20414e44204652454e53204f50454e2045444954494f4e2042592058434f505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000214d41585041494e414e444652454e534f50454e45444954494f4e425958434f505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002668747470733a2f2f6170692e6e69667479676174657761792e636f6d2f78636f70792d6f652f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000558434f5059000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102c75760003560e01c80636352211e1161017b578063a80ce4b4116100d8578063d37166301161008c578063e725f87711610071578063e725f87714610665578063e985e9c514610678578063f5abac49146106b457600080fd5b8063d37166301461063f578063d7a853be1461065257600080fd5b8063b536d0fa116100bd578063b536d0fa14610606578063b88d4fde14610619578063c87b56dd1461062c57600080fd5b8063a80ce4b4146105d3578063acd074f5146105e657600080fd5b80638ddadb201161012f57806395d89b411161011457806395d89b41146105a55780639dd5e481146105ad578063a22cb465146105c057600080fd5b80638ddadb201461056b5780639121ac0d1461057e57600080fd5b80637889cc16116101605780637889cc161461051e5780638a0fc1da146105315780638ca00c0d1461054457600080fd5b80636352211e146104f857806370a082311461050b57600080fd5b80632276f3f21161022957806342842e0e116101dd5780634fba84ca116101c25780634fba84ca146104b257806355f804b3146104c55780635f2ef9dc146104d857600080fd5b806342842e0e1461048c57806342966c681461049f57600080fd5b80632a55205a1161020e5780632a55205a146104345780632b6db05514610466578063396478d31461047957600080fd5b80632276f3f2146103fa57806323b872dd1461042157600080fd5b806306fdde0311610280578063095ea7b311610265578063095ea7b314610397578063139fed7c146103ac5780631a521760146103d357600080fd5b806306fdde031461037c578063081812fc1461038457600080fd5b806302d05d3f116102b157806302d05d3f14610307578063051802371461031c578063051c62ae1461035157600080fd5b8062cd587c146102cc57806301ffc9a7146102f4575b600080fd5b6102df6102da36600461319f565b6106c7565b60405190151581526020015b60405180910390f35b6102df610302366004613130565b610705565b61030f610749565b6040516102eb9190613402565b6103437f00000000000000000000000000000000000000000000000000000000000000ab81565b6040519081526020016102eb565b61036461035f36600461319f565b6107db565b6040516001600160a01b0390911681526020016102eb565b61030f6107ee565b61036461039236600461319f565b6107fd565b6103aa6103a536600461305b565b6108a8565b005b6103647f000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d581565b6103437f00000000000000000000000000000000000000000000000000000000000186a081565b6103437f000000000000000000000000000000000000000000000000000000000000000181565b6103aa61042f366004612f6c565b6109da565b610447610442366004613218565b610a62565b604080516001600160a01b0390931683526020830191909152016102eb565b6103aa6104743660046131d1565b610bda565b6103aa610487366004612f16565b610cd5565b6103aa61049a366004612f6c565b610e8c565b6103aa6104ad36600461319f565b610ea7565b6103aa6104c0366004613218565b610f2e565b6103aa6104d336600461316a565b611218565b6103436104e636600461319f565b600d6020526000908152604090205481565b61036461050636600461319f565b61130c565b610343610519366004612f16565b611397565b6103aa61052c366004613218565b611431565b61036461053f36600461319f565b6115c6565b6103437f00000000000000000000000000000000000000000000000000000027d064ee0081565b6103aa610579366004613087565b6115d1565b6103437f000000000000000000000000000000000000000000000000000000000000271081565b61030f611940565b6103aa6105bb36600461319f565b61194f565b6103aa6105ce36600461302d565b611a82565b6103436105e1366004612f33565b611b47565b6103436105f436600461319f565b600a6020526000908152604090205481565b610343610614366004612f16565b611c3f565b6103aa610627366004612fad565b611d2e565b61030f61063a36600461319f565b611db6565b61030f61064d36600461319f565b611e7b565b6103aa6106603660046131d1565b611fb6565b61030f61067336600461319f565b6120ab565b6102df610686366004612f33565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b6103aa6106c2366004612f33565b612160565b600080600e816106d96101008661342d565b8152602001908152602001600020549050610100836106f891906134f9565b6001901b16151592915050565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061074357506107438261232b565b92915050565b606060098054610758906134a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610784906134a3565b80156107d15780601f106107a6576101008083540402835291602001916107d1565b820191906000526020600020905b8154815290600101906020018083116107b457829003601f168201915b5050505050905090565b60006107436107e9836123ad565b612438565b606060008054610758906134a3565b6000818152600560205260408120546001600160a01b031661088c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006108b38261130c565b9050806001600160a01b0316836001600160a01b0316141561093d5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610883565b336001600160a01b038216148061095957506109598133610686565b6109cb5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610883565b6109d583836124b2565b505050565b6109e5335b82612520565b610a575760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610883565b6109d5838383612628565b60008281526005602052604081205481906001600160a01b0316610aee5760405162461bcd60e51b815260206004820152603a60248201527f4e696674794275696c646572496e7374616e63653a206f70657261746f72207160448201527f7565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000006064820152608401610883565b6000610af9856123ad565b6000818152600a6020526040812054919250907f000000000000000000000000000000000000000000000000000000000000271090610b389087613441565b610b42919061342d565b90506000610b4f83612438565b90506001600160a01b038116610bcd5760405162461bcd60e51b815260206004820152602960248201527f4e696674794275696c646572496e7374616e63653a204e6f20726f79616c747960448201527f20726563656976657200000000000000000000000000000000000000000000006064820152608401610883565b93509150505b9250929050565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b158015610c3e57600080fd5b505afa158015610c52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c769190613113565b905080610cc55760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b610ccf84846127f5565b50505050565b600060015b7f00000000000000000000000000000000000000000000000000000000000000018111610e3e576000818152600b60205260409020546001600160a01b03168015610e2b57604051632bab85df60e21b81526001600160a01b038581166004830152829160009183169063aeae177c9060240160206040518083038186803b158015610d6557600080fd5b505afa158015610d79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9d91906131b8565b90508015610e2857610daf8186613415565b6040517f191655870000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015291965090831690631916558790602401600060405180830381600087803b158015610e0f57600080fd5b505af1158015610e23573d6000803e3d6000fd5b505050505b50505b5080610e36816134de565b915050610cda565b508015610e8857604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15b5050565b6109d583838360405180602001604052806000815250611d2e565b610eb0336109df565b610f225760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f766564000000000000000000000000000000006064820152608401610883565b610f2b816128a2565b50565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b158015610f9257600080fd5b505afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca9190613113565b9050806110195760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b611022846106c7565b156110955760405162461bcd60e51b815260206004820152603660248201527f4e696674794275696c646572496e7374616e63653a206d696e74696e6720636f60448201527f6e636c7564656420666f72206e696674792074797065000000000000000000006064820152608401610883565b6000848152600d60205260408120546110af906001613415565b905060006110bd868361293d565b9050600060016110cd8784613415565b6110d79190613460565b9050815b81811161113b57600081815260056020526040902080546001600160a01b0319167f000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d56001600160a01b031617905580611133816134de565b9150506110db565b506000878152600d60205260408120805488929061115a908490613415565b90915550506001600160a01b037f000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d516600090815260066020526040812080548892906111a7908490613415565b90915550506040518181526001600160a01b037f000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d5169060009084907fdeaa91b6123d068f5821d0fb0678463d1a8a6079fe8af5de3ce5e896dcf9133d9060200160405180910390a450505050505050565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561127c57600080fd5b505afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190613113565b9050806113035760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b6109d5836129a5565b6000818152600560205260408120546001600160a01b0316806107435760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610883565b60006001600160a01b0382166114155760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610883565b506001600160a01b031660009081526006602052604090205490565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561149557600080fd5b505afa1580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190613113565b90508061151c5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b7f00000000000000000000000000000000000000000000000000000000000027108311156115b25760405162461bcd60e51b815260206004820152603560248201527f4e696674794275696c646572496e7374616e63653a20496c6c6567616c20617260448201527f67756d656e74206d6f7265207468616e203130302500000000000000000000006064820152608401610883565b50506000918252600a602052604090912055565b600061074382612438565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561163557600080fd5b505afa158015611649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166d9190613113565b9050806116bc5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b60006116c788612438565b90506000600187141561173f57878760008181106116e7576116e7613539565b90506020020160208101906116fc9190612f16565b60008a8152600c6020908152604080832080546001600160a01b0386166001600160a01b031991821617909155600b9092529091208054909116905590506118ef565b6000898152600c60205260409081902080546001600160a01b0319169055516301ffc9a760e01b81527f37de79fc0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038b16906301ffc9a79060240160206040518083038186803b1580156117ba57600080fd5b505afa1580156117ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f29190613113565b61183e5760405162461bcd60e51b815260206004820152601c60248201527f4e6f7420612076616c6964207061796d656e742073706c6974746572000000006044820152606401610883565b6118478a6129b8565b6040517f7fbbe46f0000000000000000000000000000000000000000000000000000000081529091506001600160a01b03821690637fbbe46f90611895908b908b908b908b90600401613365565b600060405180830381600087803b1580156118af57600080fd5b505af11580156118c3573d6000803e3d6000fd5b50505060008a8152600b6020526040902080546001600160a01b0319166001600160a01b038416179055505b604080516001600160a01b038085168252831660208201528a917f834a47bfbb51ad808d8649527d9bf540f58cc71dc1093ae2249c8b230575ce98910160405180910390a250505050505050505050565b606060018054610758906134a3565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b1580156119b357600080fd5b505afa1580156119c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119eb9190613113565b905080611a3a5760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b6000611a486101008561342d565b6000818152600e6020526040902054909150611a66610100866134f9565b6000928352600e6020526040909220600190921b179055505050565b6001600160a01b038216331415611adb5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610883565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60008060015b7f00000000000000000000000000000000000000000000000000000000000000018111611c37576000818152600b60205260409020546001600160a01b03168015611c245760405163049268bd60e31b81526001600160a01b038781166004830152868116602483015282919082169063249345e89060440160206040518083038186803b158015611bde57600080fd5b505afa158015611bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1691906131b8565b611c209085613415565b9350505b5080611c2f816134de565b915050611b4d565b509392505050565b60008060015b7f00000000000000000000000000000000000000000000000000000000000000018111611d27576000818152600b60205260409020546001600160a01b03168015611d1457604051632bab85df60e21b81526001600160a01b03868116600483015282919082169063aeae177c9060240160206040518083038186803b158015611cce57600080fd5b505afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0691906131b8565b611d109085613415565b9350505b5080611d1f816134de565b915050611c45565b5092915050565b611d383383612520565b611daa5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610883565b610ccf84848484612a6e565b6000818152600560205260409020546060906001600160a01b0316611e435760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610883565b6000611e4e83612af7565b9050600281604051602001611e64929190613282565b604051602081830303815290604052915050919050565b6000818152600560205260409020546060906001600160a01b0316611f085760405162461bcd60e51b815260206004820152603560248201527f4552433732314d657461646174613a204950465320686173682071756572792060448201527f666f72206e6f6e6578697374656e7420746f6b656e00000000000000000000006064820152608401610883565b6000611f13836123ad565b6000818152600460205260409020805491925090611f30906134a3565b80601f0160208091040260200160405190810160405280929190818152602001828054611f5c906134a3565b8015611fa95780601f10611f7e57610100808354040283529160200191611fa9565b820191906000526020600020905b815481529060010190602001808311611f8c57829003601f168201915b5050505050915050919050565b6040516371be737d60e11b81523360048201527f0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106906000906001600160a01b0383169063e37ce6fa9060240160206040518083038186803b15801561201a57600080fd5b505afa15801561202e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120529190613113565b9050806120a15760405162461bcd60e51b815260206004820152601f60248201527f4e69667479456e746974793a20496e76616c6964206d73672e73656e646572006044820152606401610883565b610ccf8484612c29565b6000818152600560205260409020546060906001600160a01b03166121385760405162461bcd60e51b815260206004820152603060248201527f4552433732314d657461646174613a204e616d6520717565727920666f72206e60448201527f6f6e6578697374656e7420746f6b656e000000000000000000000000000000006064820152608401610883565b6000612143836123ad565b6000818152600360205260409020805491925090611f30906134a3565b600060015b7f000000000000000000000000000000000000000000000000000000000000000181116122d9576000818152600b60205260409020546001600160a01b031680156122c65760405163049268bd60e31b81526001600160a01b0386811660048301528581166024830152829160009183169063249345e89060440160206040518083038186803b1580156121f857600080fd5b505afa15801561220c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223091906131b8565b905080156122c3576122428186613415565b6040517f48b750440000000000000000000000000000000000000000000000000000000081526001600160a01b0389811660048301528881166024830152919650908316906348b7504490604401600060405180830381600087803b1580156122aa57600080fd5b505af11580156122be573d6000803e3d6000fd5b505050505b50505b50806122d1816134de565b915050612165565b5080156109d557604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061238e57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061074357506301ffc9a760e01b6001600160e01b0319831614610743565b60007f00000000000000000000000000000000000000000000000000000027d064ee0082116123de57506000919050565b7f00000000000000000000000000000000000000000000000000000000000186a06124297f00000000000000000000000000000000000000000000000000000027d064ee0084613460565b610743919061342d565b919050565b6000818152600c60205260408120546001600160a01b03161561247157506000908152600c60205260409020546001600160a01b031690565b6000828152600b60205260409020546001600160a01b0316156124aa57506000908152600b60205260409020546001600160a01b031690565b506000919050565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124e78261130c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600560205260408120546001600160a01b03166125aa5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610883565b60006125b58361130c565b9050806001600160a01b0316846001600160a01b031614806125f05750836001600160a01b03166125e5846107fd565b6001600160a01b0316145b8061262057506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661263b8261130c565b6001600160a01b0316146126b75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610883565b6001600160a01b0382166127325760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610883565b61273d6000826124b2565b6001600160a01b0383166000908152600660205260408120805460019290612766908490613460565b90915550506001600160a01b0382166000908152600660205260408120805460019290612794908490613415565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828152600460205260409020805461280e906134a3565b1590506128835760405162461bcd60e51b815260206004820152602560248201527f4552433732314d657461646174613a2049504653206861736820616c7265616460448201527f79207365740000000000000000000000000000000000000000000000000000006064820152608401610883565b600082815260046020908152604090912082516109d592840190612da2565b60006128ad8261130c565b90506128ba6000836124b2565b6001600160a01b03811660009081526006602052604081208054600192906128e3908490613460565b909155505060008281526005602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60008161296a7f00000000000000000000000000000000000000000000000000000000000186a085613441565b612994907f00000000000000000000000000000000000000000000000000000027d064ee00613415565b61299e9190613415565b9392505050565b8051610e88906002906020840190612da2565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b0381166124335760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610883565b612a79848484612628565b612a8584848484612c48565b610ccf5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610883565b606081612b3757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612b615780612b4b816134de565b9150612b5a9050600a8361342d565b9150612b3b565b60008167ffffffffffffffff811115612b7c57612b7c61354f565b6040519080825280601f01601f191660200182016040528015612ba6576020820181803683370190505b5090505b841561262057612bbb600183613460565b9150612bc8600a866134f9565b612bd3906030613415565b60f81b818381518110612be857612be8613539565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612c22600a8661342d565b9450612baa565b600082815260036020908152604090912082516109d592840190612da2565b6000833b15612d9757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c83903390899088908890600401613329565b602060405180830381600087803b158015612c9d57600080fd5b505af1925050508015612ccd575060408051601f3d908101601f19168201909252612cca9181019061314d565b60015b612d7d573d808015612cfb576040519150601f19603f3d011682016040523d82523d6000602084013e612d00565b606091505b508051612d755760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610883565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612620565b506001949350505050565b828054612dae906134a3565b90600052602060002090601f016020900481019282612dd05760008555612e16565b82601f10612de957805160ff1916838001178555612e16565b82800160010185558215612e16579182015b82811115612e16578251825591602001919060010190612dfb565b50612e22929150612e26565b5090565b5b80821115612e225760008155600101612e27565b600067ffffffffffffffff80841115612e5657612e5661354f565b604051601f8501601f19908116603f01168101908282118183101715612e7e57612e7e61354f565b81604052809350858152868686011115612e9757600080fd5b858560208301376000602087830101525050509392505050565b60008083601f840112612ec357600080fd5b50813567ffffffffffffffff811115612edb57600080fd5b6020830191508360208260051b8501011115610bd357600080fd5b600082601f830112612f0757600080fd5b61299e83833560208501612e3b565b600060208284031215612f2857600080fd5b813561299e81613565565b60008060408385031215612f4657600080fd5b8235612f5181613565565b91506020830135612f6181613565565b809150509250929050565b600080600060608486031215612f8157600080fd5b8335612f8c81613565565b92506020840135612f9c81613565565b929592945050506040919091013590565b60008060008060808587031215612fc357600080fd5b8435612fce81613565565b93506020850135612fde81613565565b925060408501359150606085013567ffffffffffffffff81111561300157600080fd5b8501601f8101871361301257600080fd5b61302187823560208401612e3b565b91505092959194509250565b6000806040838503121561304057600080fd5b823561304b81613565565b91506020830135612f618161357a565b6000806040838503121561306e57600080fd5b823561307981613565565b946020939093013593505050565b600080600080600080608087890312156130a057600080fd5b86356130ab81613565565b955060208701359450604087013567ffffffffffffffff808211156130cf57600080fd5b6130db8a838b01612eb1565b909650945060608901359150808211156130f457600080fd5b5061310189828a01612eb1565b979a9699509497509295939492505050565b60006020828403121561312557600080fd5b815161299e8161357a565b60006020828403121561314257600080fd5b813561299e81613588565b60006020828403121561315f57600080fd5b815161299e81613588565b60006020828403121561317c57600080fd5b813567ffffffffffffffff81111561319357600080fd5b61262084828501612ef6565b6000602082840312156131b157600080fd5b5035919050565b6000602082840312156131ca57600080fd5b5051919050565b600080604083850312156131e457600080fd5b82359150602083013567ffffffffffffffff81111561320257600080fd5b61320e85828601612ef6565b9150509250929050565b6000806040838503121561322b57600080fd5b50508035926020909101359150565b60008151808452613252816020860160208601613477565b601f01601f19169290920160200192915050565b60008151613278818560208601613477565b9290920192915050565b600080845481600182811c91508083168061329e57607f831692505b60208084108214156132be57634e487b7160e01b86526022600452602486fd5b8180156132d257600181146132e357613310565b60ff19861689528489019650613310565b60008b81526020902060005b868110156133085781548b8201529085019083016132ef565b505084890196505b5050505050506133208185613266565b95945050505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261335b608083018461323a565b9695505050505050565b6040808252810184905260008560608301825b878110156133a857823561338b81613565565b6001600160a01b0316825260209283019290910190600101613378565b5083810360208501528481527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8511156133e157600080fd5b8460051b915081866020830137600091016020019081529695505050505050565b60208152600061299e602083018461323a565b600082198211156134285761342861350d565b500190565b60008261343c5761343c613523565b500490565b600081600019048311821515161561345b5761345b61350d565b500290565b6000828210156134725761347261350d565b500390565b60005b8381101561349257818101518382015260200161347a565b83811115610ccf5750506000910152565b600181811c908216806134b757607f821691505b602082108114156134d857634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156134f2576134f261350d565b5060010190565b60008261350857613508613523565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f2b57600080fd5b8015158114610f2b57600080fd5b6001600160e01b031981168114610f2b57600080fdfea2646970667358221220fa1f2c25c9387dca1499fcd6364d92939002770f7e2dfbf46ec0fb1f14fe47f164736f6c63430008060033

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

0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002200000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d500000000000000000000000000000000000000000000000000000000000000284d4158205041494e20414e44204652454e53204f50454e2045444954494f4e2042592058434f505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000214d41585041494e414e444652454e534f50454e45444954494f4e425958434f505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002668747470733a2f2f6170692e6e69667479676174657761792e636f6d2f78636f70792d6f652f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000558434f5059000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): MAX PAIN AND FRENS OPEN EDITION BY XCOPY
Arg [1] : symbol (string): MAXPAINANDFRENSOPENEDITIONBYXCOPY
Arg [2] : id (uint256): 171
Arg [3] : typeCount (uint256): 1
Arg [4] : baseURI (string): https://api.niftygateway.com/xcopy-oe/
Arg [5] : creator_ (string): XCOPY
Arg [6] : niftyRegistryContract (address): 0x6e53130dDfF21E3BC963Ee902005223b9A202106
Arg [7] : defaultOwner (address): 0xE052113bd7D7700d623414a0a4585BCaE754E9d5

-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000ab
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [6] : 0000000000000000000000006e53130ddff21e3bc963ee902005223b9a202106
Arg [7] : 000000000000000000000000e052113bd7d7700d623414a0a4585bcae754e9d5
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [9] : 4d4158205041494e20414e44204652454e53204f50454e2045444954494f4e20
Arg [10] : 42592058434f5059000000000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [12] : 4d41585041494e414e444652454e534f50454e45444954494f4e425958434f50
Arg [13] : 5900000000000000000000000000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000026
Arg [15] : 68747470733a2f2f6170692e6e69667479676174657761792e636f6d2f78636f
Arg [16] : 70792d6f652f0000000000000000000000000000000000000000000000000000
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [18] : 58434f5059000000000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.