ETH Price: $2,508.67 (+0.41%)

NFTfi Editable Bundle (EBNFI)
 

Overview

TokenID

114

Total Transfers

-

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
NftfiBundler

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 30 : NftfiBundler.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

import "./ERC998TopDown.sol";
import "./INftfiBundler.sol";
import "./IBundleBuilder.sol";
import "./IPermittedNFTs.sol";
import "./utils/Ownable.sol";
import "./airdrop/AirdropFlashLoan.sol";

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

/**
 * @title NftfiBundler
 * @author NFTfi
 * @dev ERC998 Top-Down Composable Non-Fungible Token that supports ERC721 children.
 */
contract NftfiBundler is ERC998TopDown, IBundleBuilder {
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeERC20 for IERC20;
    using Strings for uint256;

    address public immutable permittedNfts;
    address public immutable airdropFlashLoan;

    string public baseURI;

    /**
     * @dev Stores name and symbol
     *
     * @param _admin - Initial admin of this contract.
     * @param _name name of the token contract
     * @param _symbol symbol of the token contract
     */
    constructor(
        address _admin,
        string memory _name,
        string memory _symbol,
        string memory _customBaseURI,
        address _permittedNfts,
        address _airdropFlashLoan
    ) ERC721(_name, _symbol) ERC998TopDown(_admin) {
        permittedNfts = _permittedNfts;
        airdropFlashLoan = _airdropFlashLoan;
        _setBaseURI(_customBaseURI);
    }

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

    /**
     * @notice Tells if an asset is permitted or not
     * @param _asset address of the asset
     * @return true if permitted, false otherwise
     */
    function permittedAsset(address _asset) public view returns (bool) {
        IPermittedNFTs permittedNFTs = IPermittedNFTs(permittedNfts);
        return permittedNFTs.getNFTPermit(_asset) > 0;
    }

    /**
     * @dev used to build a bundle from the BundleElements struct,
     * returns the id of the created bundle
     *
     * @param _bundleElements - the lists of erc721 tokens that are to be bundled
     */
    function buildBundle(BundleElementERC721[] memory _bundleElements) external override returns (uint256) {
        uint256 tokenId = safeMint(msg.sender);
        _addBundleElements(tokenId, _bundleElements);
        return tokenId;
    }

    /**
     * @dev Adds a set of BundleElementERC721 objects to the specified token ID.
     *
     * @param _tokenId The ID of the token to add the bundle elements to.
     * @param _bundleElements The array of BundleElementERC721 objects to add.
     */
    function addBundleElements(uint256 _tokenId, BundleElementERC721[] memory _bundleElements) external {
        _addBundleElements(_tokenId, _bundleElements);
    }

    /**
     * @dev Removes a set of BundleElementERC721 objects to the specified token ID.
     *
     * @param _tokenId The ID of the token to remove the bundle elements from.
     * @param _bundleElements The array of BundleElementERC721 objects to remove.
     */
    function removeBundleElements(uint256 _tokenId, BundleElementERC721[] memory _bundleElements) external {
        _removeBundleElements(_tokenId, _bundleElements);
    }

    /**
     * @dev Adds and removes a set of BundleElementERC721 objects from the specified token ID.
     *
     * @param _tokenId The ID of the token to add and remove the bundle elements from.
     * @param _toAdd The array of BundleElementERC721 objects to add.
     * @param _toRemove The array of BundleElementERC721 objects to remove.
     */
    function addAndRemoveBundleElements(
        uint256 _tokenId,
        BundleElementERC721[] memory _toAdd,
        BundleElementERC721[] memory _toRemove
    ) external {
        _addBundleElements(_tokenId, _toAdd);
        _removeBundleElements(_tokenId, _toRemove);
    }

    /**
     * @notice Remove all the children from the bundle
     * @dev This method may run out of gas if the list of children is too big. In that case, children can be removed
     *      individually.
     * @param _tokenId the id of the bundle
     * @param _receiver address of the receiver of the children
     */
    function decomposeBundle(uint256 _tokenId, address _receiver) external override {
        _validateReceiver(_receiver);
        _validateTransferSender(_tokenId);

        // In each iteration all contracts children are removed, so eventually all contracts are removed
        while (childContracts[_tokenId].length() > 0) {
            address childContract = childContracts[_tokenId].at(0);

            // In each iteration a child is removed, so eventually all contracts children are removed
            while (childTokens[_tokenId][childContract].length() > 0) {
                uint256 childId = childTokens[_tokenId][childContract].at(0);

                _removeChild(_tokenId, childContract, childId);

                try IERC721(childContract).safeTransferFrom(address(this), _receiver, childId) {
                    // solhint-disable-previous-line no-empty-blocks
                } catch {
                    _oldNFTsTransfer(_receiver, childContract, childId);
                }
                emit TransferChild(_tokenId, _receiver, childContract, childId);
            }
        }
    }

    /**
     * @notice Remove all the children from the bundle and send to personla bundler.
     * If bundle contains a legacy ERC721 element, this will not work.
     * @dev This method may run out of gas if the list of children is too big. In that case, children can be removed
     *      individually.
     * @param _tokenId the id of the bundle
     * @param _personalBundler address of the receiver of the children
     */
    function sendElementsToPersonalBundler(uint256 _tokenId, address _personalBundler) external virtual {
        _validateReceiver(_personalBundler);
        _validateTransferSender(_tokenId);
        require(_personalBundler != address(this), "cannot send to self");
        require(
            IERC165(_personalBundler).supportsInterface(type(IERC998ERC721TopDown).interfaceId),
            "has to implement IERC998ERC721TopDown"
        );
        uint256 personalBundleId = 1;
        //make sure sendeer owns personal bundler token
        require(IERC721(_personalBundler).ownerOf(personalBundleId) == msg.sender, "has to own personal bundle token");

        // In each iteration all contracts children are removed, so eventually all contracts are removed
        while (childContracts[_tokenId].length() > 0) {
            address childContract = childContracts[_tokenId].at(0);

            // In each iteration a child is removed, so eventually all contracts children are removed
            while (childTokens[_tokenId][childContract].length() > 0) {
                uint256 childId = childTokens[_tokenId][childContract].at(0);

                _removeChild(_tokenId, childContract, childId);

                try
                    IERC721(childContract).safeTransferFrom(
                        address(this),
                        _personalBundler,
                        childId,
                        abi.encodePacked(personalBundleId)
                    )
                {
                    // solhint-disable-previous-line no-empty-blocks
                } catch {
                    revert("only safe transfer");
                }
                emit TransferChild(_tokenId, _personalBundler, childContract, childId);
            }
        }
    }

    /**
     * @dev Internal function to add a set of BundleElementERC721 objects to the specified token ID.
     *
     * @param _tokenId The ID of the token to add the bundle elements to.
     * @param _bundleElements The array of BundleElementERC721 objects to add.
     */
    function _addBundleElements(uint256 _tokenId, BundleElementERC721[] memory _bundleElements) internal {
        require(_bundleElements.length > 0, "bundle is empty");
        uint256 elementNumber = _bundleElements.length;
        for (uint256 i; i != elementNumber; ++i) {
            require(permittedAsset(_bundleElements[i].tokenContract), "erc721 not permitted");
            if (_bundleElements[i].safeTransferable) {
                uint256 nuberOfIds = _bundleElements[i].ids.length;
                for (uint256 j; j != nuberOfIds; ++j) {
                    IERC721(_bundleElements[i].tokenContract).safeTransferFrom(
                        msg.sender,
                        address(this),
                        _bundleElements[i].ids[j],
                        abi.encodePacked(_tokenId)
                    );
                }
            } else {
                uint256 nuberOfIds = _bundleElements[i].ids.length;
                for (uint256 j; j != nuberOfIds; ++j) {
                    getChild(msg.sender, _tokenId, _bundleElements[i].tokenContract, _bundleElements[i].ids[j]);
                }
            }
        }

        emit AddBundleElements(_tokenId, _bundleElements);
    }

    /**
     * @dev Internal function to remove a set of BundleElementERC721 objects to the specified token ID.
     *
     * @param _tokenId The ID of the token to remove the bundle elements from.
     * @param _bundleElements The array of BundleElementERC721 objects to remove.
     */
    function _removeBundleElements(uint256 _tokenId, BundleElementERC721[] memory _bundleElements) internal {
        require(_bundleElements.length > 0, "bundle is empty");
        uint256 elementNumber = _bundleElements.length;
        for (uint256 i; i != elementNumber; ++i) {
            address erc721Contract = _bundleElements[i].tokenContract;
            uint256 nuberOfIds = _bundleElements[i].ids.length;
            for (uint256 j; j != nuberOfIds; ++j) {
                uint256 childId = _bundleElements[i].ids[j];
                _validateChildTransfer(_tokenId, erc721Contract, childId);
                _removeChild(_tokenId, erc721Contract, childId);
                if (_bundleElements[i].safeTransferable) {
                    IERC721(erc721Contract).safeTransferFrom(address(this), msg.sender, childId);
                } else {
                    _oldNFTsTransfer(msg.sender, erc721Contract, childId);
                }
                emit TransferChild(_tokenId, msg.sender, erc721Contract, childId);
            }
        }

        emit RemoveBundleElements(_tokenId, _bundleElements);
    }

    /**
     * @dev Update the state to receive a ERC721 child
     * Overrides the implementation to check if the asset is permitted
     * @param _from The owner of the child token
     * @param _tokenId The token receiving the child
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The token that is being transferred to the parent
     */
    function _receiveChild(
        address _from,
        uint256 _tokenId,
        address _childContract,
        uint256 _childTokenId
    ) internal virtual override {
        require(permittedAsset(_childContract), "erc721 not permitted");
        super._receiveChild(_from, _tokenId, _childContract, _childTokenId);
    }

    /**
     * @dev Override validation if it is a transfer from the airdropFlashLoan contract giving back the flashloan.
     * Validates the data from a child transfer and receives it otherwise
     * @param _from The owner of the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The token that is being transferred to the parent
     * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId
     */
    function _validateAndReceiveChild(
        address _from,
        address _childContract,
        uint256 _childTokenId,
        bytes memory _data
    ) internal virtual override {
        if (_from == airdropFlashLoan) {
            return;
        } else {
            super._validateAndReceiveChild(_from, _childContract, _childTokenId, _data);
        }
    }

    /**
     * @notice this function initiates a flashloan to pull an airdrop from a tartget contract
     *
     * @param _nftContract - contract address of the target nft of the drop
     * @param _nftId - id of the target nft of the drop
     * @param _target - address of the airdropping contract
     * @param _data - function selector to be called on the airdropping contract
     * @param _nftAirdrop - address of the used claiming nft in the drop
     * @param _nftAirdropId - id of the used claiming nft in the drop
     * @param _is1155 -
     * @param _nftAirdropAmount - amount in case of 1155
     */
    function pullAirdrop(
        address _nftContract,
        uint256 _nftId,
        address _target,
        bytes calldata _data,
        address _nftAirdrop,
        uint256 _nftAirdropId,
        bool _is1155,
        uint256 _nftAirdropAmount,
        address _beneficiary
    ) external {
        uint256 tokenId = childTokenOwner[_nftContract][_nftId];
        address rootOwner = address(uint160(uint256(rootOwnerOf(tokenId))));
        require(rootOwner == msg.sender, "pullAirdrop msg.sender not eligible");

        IERC721(_nftContract).safeTransferFrom(address(this), airdropFlashLoan, _nftId);

        AirdropFlashLoan(airdropFlashLoan).pullAirdrop(
            _nftContract,
            _nftId,
            _target,
            _data,
            _nftAirdrop,
            _nftAirdropId,
            _is1155,
            _nftAirdropAmount,
            _beneficiary
        );

        //take back collateral
        IERC721(_nftContract).safeTransferFrom(airdropFlashLoan, address(this), _nftId);
    }

    /**
     * @notice used by the owner account to be able to drain ERC721 tokens received as airdrops
     * for the locked  collateral NFT-s
     * @param _tokenAddress - address of the token contract for the token to be sent out
     * @param _tokenId - id token to be sent out
     * @param _receiver - receiver of the token
     */
    function rescueERC721(
        address _tokenAddress,
        uint256 _tokenId,
        address _receiver
    ) external onlyOwner {
        IERC721 tokenContract = IERC721(_tokenAddress);
        require(childTokenOwner[_tokenAddress][_tokenId] == 0, "token is in bundle");
        require(tokenContract.ownerOf(_tokenId) == address(this), "nft not owned");
        tokenContract.safeTransferFrom(address(this), _receiver, _tokenId);
    }

    /**
     * @notice used by the owner account to be able to drain ERC20 tokens received as airdrops
     * for the locked  collateral NFT-s
     * @param _tokenAddress - address of the token contract for the token to be sent out
     * @param _receiver - receiver of the token
     */
    function rescueERC20(address _tokenAddress, address _receiver) external onlyOwner {
        IERC20 tokenContract = IERC20(_tokenAddress);
        uint256 amount = tokenContract.balanceOf(address(this));
        require(amount > 0, "no tokens owned");
        tokenContract.safeTransfer(_receiver, amount);
    }

    /**
     * @dev Sets baseURI.
     * @param _customBaseURI - Base URI
     */
    function setBaseURI(string memory _customBaseURI) external onlyOwner {
        _setBaseURI(_customBaseURI);
    }

    /**
     * @dev Sets baseURI.
     */
    function _setBaseURI(string memory _customBaseURI) internal virtual {
        baseURI = bytes(_customBaseURI).length > 0
            ? string(abi.encodePacked(_customBaseURI, _getChainID().toString(), "/"))
            : "";
    }

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

    /**
     * @dev This function gets the current chain ID.
     */
    function _getChainID() internal view returns (uint256) {
        uint256 id;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            id := chainid()
        }
        return id;
    }
}

File 2 of 30 : ERC998TopDown.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "./utils/Ownable.sol";
import "./IERC998ERC721TopDown.sol";
import "./IERC998ERC721TopDownEnumerable.sol";

/**
 * @title ERC998TopDown
 * @author NFTfi
 * @dev ERC998ERC721 Top-Down Composable Non-Fungible Token.
 * See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
 * This implementation does not support children to be nested bundles, erc20 nor bottom-up
 */
abstract contract ERC998TopDown is
    ERC721Enumerable,
    IERC998ERC721TopDown,
    IERC998ERC721TopDownEnumerable,
    ReentrancyGuard,
    Ownable,
    Pausable
{
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.AddressSet;

    // return this.rootOwnerOf.selector ^ this.rootOwnerOfChild.selector ^
    //   this.tokenOwnerOf.selector ^ this.ownerOfChild.selector;
    bytes32 public constant ERC998_MAGIC_VALUE = 0xcd740db500000000000000000000000000000000000000000000000000000000;
    bytes32 internal constant ERC998_MAGIC_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000;

    uint256 public tokenCount = 0;

    // tokenId => child contract
    mapping(uint256 => EnumerableSet.AddressSet) internal childContracts;

    // tokenId => (child address => array of child tokens)
    mapping(uint256 => mapping(address => EnumerableSet.UintSet)) internal childTokens;

    // child address => childId => tokenId
    // this is used for ERC721 type tokens
    mapping(address => mapping(uint256 => uint256)) internal childTokenOwner;

    /**
     * @dev Stores the admin
     *
     * @param _admin address capable of pausing
     */
    constructor(address _admin) Ownable(_admin) {
        // solhint-disable-previous-line no-empty-blocks
    }

    /**
     * @notice Tells whether the ERC721 type child exists or not
     * @param _childContract The contract address of the child token
     * @param _childTokenId The tokenId of the child
     * @return True if the child exists, false otherwise
     */
    function childExists(address _childContract, uint256 _childTokenId) external view virtual returns (bool) {
        uint256 tokenId = childTokenOwner[_childContract][_childTokenId];
        return tokenId != 0;
    }

    /**
     * @notice Get the total number of child contracts with tokens that are owned by _tokenId
     * @param _tokenId The parent token of child tokens in child contracts
     * @return uint256 The total number of child contracts with tokens owned by _tokenId
     */
    function totalChildContracts(uint256 _tokenId) public view virtual override returns (uint256) {
        return childContracts[_tokenId].length();
    }

    /**
     * @notice Get child contract by tokenId and index
     * @param _tokenId The parent token of child tokens in child contract
     * @param _index The index position of the child contract
     * @return childContract The contract found at the _tokenId and index
     */
    function childContractByIndex(uint256 _tokenId, uint256 _index)
        external
        view
        virtual
        override
        returns (address childContract)
    {
        return childContracts[_tokenId].at(_index);
    }

    /**
     * @notice Get the total number of child tokens owned by tokenId that exist in a child contract
     * @param _tokenId The parent token of child tokens
     * @param _childContract The child contract containing the child tokens
     * @return uint256 The total number of child tokens found in child contract that are owned by _tokenId
     */
    function totalChildTokens(uint256 _tokenId, address _childContract) external view override returns (uint256) {
        return childTokens[_tokenId][_childContract].length();
    }

    /**
     * @notice Get child token owned by _tokenId, in child contract, at index position
     * @param _tokenId The parent token of the child token
     * @param _childContract The child contract of the child token
     * @param _index The index position of the child token
     * @return childTokenId The child tokenId for the parent token, child token and index
     */
    function childTokenByIndex(
        uint256 _tokenId,
        address _childContract,
        uint256 _index
    ) external view virtual override returns (uint256 childTokenId) {
        return childTokens[_tokenId][_childContract].at(_index);
    }

    /**
     * @notice Get the parent tokenId and its owner of a ERC721 child token
     * @param _childContract The contract address of the child token
     * @param _childTokenId The tokenId of the child
     * @return parentTokenOwner The parent address of the parent token and ERC998 magic value
     * @return parentTokenId The parent tokenId of _childTokenId
     */
    function ownerOfChild(address _childContract, uint256 _childTokenId)
        external
        view
        virtual
        override
        returns (bytes32 parentTokenOwner, uint256 parentTokenId)
    {
        parentTokenId = childTokenOwner[_childContract][_childTokenId];
        require(parentTokenId != 0, "child token does not exist");
        address parentTokenOwnerAddress = ownerOf(parentTokenId);
        // solhint-disable-next-line no-inline-assembly
        assembly {
            parentTokenOwner := or(ERC998_MAGIC_VALUE, parentTokenOwnerAddress)
        }
    }

    /**
     * @notice Get the root owner of tokenId
     * @param _tokenId The token to query for a root owner address
     * @return rootOwner The root owner at the top of tree of tokens and ERC998 magic value.
     */
    function rootOwnerOf(uint256 _tokenId) public view virtual override returns (bytes32 rootOwner) {
        return rootOwnerOfChild(address(0), _tokenId);
    }

    /**
     * @notice Get the root owner of a child token
     * @dev Returns the owner at the top of the tree of composables
     * Use Cases handled:
     * - Case 1: Token owner is this contract and token.
     * - Case 2: Token owner is other external top-down composable
     * - Case 3: Token owner is other contract
     * - Case 4: Token owner is user
     * @param _childContract The contract address of the child token
     * @param _childTokenId The tokenId of the child
     * @return rootOwner The root owner at the top of tree of tokens and ERC998 magic value
     */
    function rootOwnerOfChild(address _childContract, uint256 _childTokenId)
        public
        view
        virtual
        override
        returns (bytes32 rootOwner)
    {
        address rootOwnerAddress;
        if (_childContract != address(0)) {
            (rootOwnerAddress, _childTokenId) = _ownerOfChild(_childContract, _childTokenId);
        } else {
            rootOwnerAddress = ownerOf(_childTokenId);
        }

        if (rootOwnerAddress.isContract()) {
            try IERC998ERC721TopDown(rootOwnerAddress).rootOwnerOfChild(address(this), _childTokenId) returns (
                bytes32 returnedRootOwner
            ) {
                // Case 2: Token owner is other external top-down composable
                if (returnedRootOwner & ERC998_MAGIC_MASK == ERC998_MAGIC_VALUE) {
                    return returnedRootOwner;
                }
            } catch {
                // solhint-disable-previous-line no-empty-blocks
            }
        }

        // Case 3: Token owner is other contract
        // Or
        // Case 4: Token owner is user
        // solhint-disable-next-line no-inline-assembly
        assembly {
            rootOwner := or(ERC998_MAGIC_VALUE, rootOwnerAddress)
        }
        return rootOwner;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     * The interface id 0x1efdf36a is added. The spec claims it to be the interface id of IERC998ERC721TopDown.
     * But it is not.
     * It is added anyway in case some contract checks it being compliant with the spec.
     */
    function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC721Enumerable) returns (bool) {
        return
            _interfaceId == type(IERC998ERC721TopDown).interfaceId ||
            _interfaceId == type(IERC998ERC721TopDownEnumerable).interfaceId ||
            _interfaceId == 0x1efdf36a ||
            super.supportsInterface(_interfaceId);
    }

    /**
     * @notice Mints a new bundle
     * @param _to The address that owns the new bundle
     * @return The id of the new bundle
     */
    function safeMint(address _to) public virtual whenNotPaused returns (uint256) {
        uint256 id = ++tokenCount;
        _safeMint(_to, id);

        return id;
    }

    /**
     * @notice Transfer child token from top-down composable to address
     * @param _fromTokenId The owning token to transfer from
     * @param _to The address that receives the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     */
    function safeTransferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) external virtual override nonReentrant {
        _transferChild(_fromTokenId, _to, _childContract, _childTokenId);
        IERC721(_childContract).safeTransferFrom(address(this), _to, _childTokenId);
        emit TransferChild(_fromTokenId, _to, _childContract, _childTokenId);
    }

    /**
     * @notice Transfer child token from top-down composable to address or other top-down composable
     * @param _fromTokenId The owning token to transfer from
     * @param _to The address that receives the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     * @param _data Additional data with no specified format
     */
    function safeTransferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId,
        bytes memory _data
    ) external virtual override nonReentrant {
        _transferChild(_fromTokenId, _to, _childContract, _childTokenId);
        if (_to == address(this)) {
            _validateAndReceiveChild(msg.sender, _childContract, _childTokenId, _data);
        } else {
            IERC721(_childContract).safeTransferFrom(address(this), _to, _childTokenId, _data);
            emit TransferChild(_fromTokenId, _to, _childContract, _childTokenId);
        }
    }

    /**
     * @dev Transfer child token from top-down composable to address
     * @param _fromTokenId The owning token to transfer from
     * @param _to The address that receives the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     */
    function transferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) external virtual override nonReentrant {
        _transferChild(_fromTokenId, _to, _childContract, _childTokenId);
        _oldNFTsTransfer(_to, _childContract, _childTokenId);
        emit TransferChild(_fromTokenId, _to, _childContract, _childTokenId);
    }

    /**
     * @notice NOT SUPPORTED
     * Intended to transfer bottom-up composable child token from top-down composable to other ERC721 token.
     */
    function transferChildToParent(
        uint256,
        address,
        uint256,
        address,
        uint256,
        bytes memory
    ) external virtual override {
        revert("BOTTOM_UP_CHILD_NOT_SUPPORTED");
    }

    /**
     * @notice Transfer a child token from an ERC721 contract to a composable. Used for old tokens that does not
     * have a safeTransferFrom method like cryptokitties
     * @dev This contract has to be approved first in _childContract
     * @param _from The address that owns the child token.
     * @param _tokenId The token that becomes the parent owner
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the child token
     */
    function getChild(
        address _from,
        uint256 _tokenId,
        address _childContract,
        uint256 _childTokenId
    ) public virtual override whenNotPaused nonReentrant {
        require(_from == msg.sender, "_from should be msg.sender");
        _receiveChild(_from, _tokenId, _childContract, _childTokenId);
        IERC721(_childContract).transferFrom(_from, address(this), _childTokenId);
    }

    /**
     * @notice A token receives a child token
     * param The address that caused the transfer
     * @param _from The owner of the child token
     * @param _childTokenId The token that is being transferred to the parent
     * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId
     * @return the selector of this method
     */
    function onERC721Received(
        address,
        address _from,
        uint256 _childTokenId,
        bytes calldata _data
    ) external virtual override whenNotPaused nonReentrant returns (bytes4) {
        _validateAndReceiveChild(_from, msg.sender, _childTokenId, _data);
        return this.onERC721Received.selector;
    }

    /**
     * @dev ERC721 implementation hook that is called before any token transfer. Prevents nested bundles
     * @param _from address of the current owner of the token
     * @param _to destination address
     * @param _tokenId id of the token to transfer
     */
    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal virtual override {
        require(_to != address(this), "nested bundles not allowed");
        super._beforeTokenTransfer(_from, _to, _tokenId);
    }

    /**
     * @dev Validates the child transfer parameters and remove the child from the bundle
     * @param _fromTokenId The owning token to transfer from
     * @param _to The address that receives the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     */
    function _transferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) internal virtual {
        _validateReceiver(_to);
        _validateChildTransfer(_fromTokenId, _childContract, _childTokenId);
        _removeChild(_fromTokenId, _childContract, _childTokenId);
    }

    /**
     * @dev Validates the child transfer parameters
     * @param _fromTokenId The owning token to transfer from
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     */
    function _validateChildTransfer(
        uint256 _fromTokenId,
        address _childContract,
        uint256 _childTokenId
    ) internal virtual {
        uint256 tokenId = childTokenOwner[_childContract][_childTokenId];
        require(tokenId != 0, "_transferChild _childContract _childTokenId not found");
        require(tokenId == _fromTokenId, "ComposableTopDown: _transferChild wrong tokenId found");
        _validateTransferSender(tokenId);
    }

    /**
     * @dev Validates the receiver of a child transfer
     * @param _to The address that receives the child token
     */
    function _validateReceiver(address _to) internal virtual {
        require(_to != address(0), "child transfer to zero address");
    }

    /**
     * @dev Updates the state to remove a child
     * @param _tokenId The owning token to transfer from
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The tokenId of the token that is being transferred
     */
    function _removeChild(
        uint256 _tokenId,
        address _childContract,
        uint256 _childTokenId
    ) internal virtual {
        // remove child token
        childTokens[_tokenId][_childContract].remove(_childTokenId);
        delete childTokenOwner[_childContract][_childTokenId];

        // remove contract
        if (childTokens[_tokenId][_childContract].length() == 0) {
            childContracts[_tokenId].remove(_childContract);
        }
    }

    /**
     * @dev Validates the data from a child transfer and receives it
     * @param _from The owner of the child token
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The token that is being transferred to the parent
     * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId
     */
    function _validateAndReceiveChild(
        address _from,
        address _childContract,
        uint256 _childTokenId,
        bytes memory _data
    ) internal virtual {
        require(_data.length > 0, "data must contain tokenId to transfer the child token to");
        // convert up to 32 bytes of _data to uint256, owner nft tokenId passed as uint in bytes
        uint256 tokenId = _parseTokenId(_data);
        _receiveChild(_from, tokenId, _childContract, _childTokenId);
    }

    /**
     * @dev Update the state to receive a child
     * @param _from The owner of the child token
     * @param _tokenId The token receiving the child
     * @param _childContract The ERC721 contract of the child token
     * @param _childTokenId The token that is being transferred to the parent
     */
    function _receiveChild(
        address _from,
        uint256 _tokenId,
        address _childContract,
        uint256 _childTokenId
    ) internal virtual {
        require(_exists(_tokenId), "bundle tokenId does not exist");
        uint256 childTokensLength = childTokens[_tokenId][_childContract].length();
        if (childTokensLength == 0) {
            childContracts[_tokenId].add(_childContract);
        }
        childTokens[_tokenId][_childContract].add(_childTokenId);
        childTokenOwner[_childContract][_childTokenId] = _tokenId;
        emit ReceivedChild(_from, _tokenId, _childContract, _childTokenId);
    }

    /**
     * @dev Returns the owner of a child
     * @param _childContract The contract address of the child token
     * @param _childTokenId The tokenId of the child
     * @return parentTokenOwner The parent address of the parent token and ERC998 magic value
     * @return parentTokenId The parent tokenId of _childTokenId
     */
    function _ownerOfChild(address _childContract, uint256 _childTokenId)
        internal
        view
        virtual
        returns (address parentTokenOwner, uint256 parentTokenId)
    {
        parentTokenId = childTokenOwner[_childContract][_childTokenId];
        require(parentTokenId != 0, "child token does not exist");
        return (ownerOf(parentTokenId), parentTokenId);
    }

    /**
     * @dev Convert up to 32 bytes of_data to uint256, owner nft tokenId passed as uint in bytes
     * @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId
     * @return tokenId the token Id encoded in the data
     */
    function _parseTokenId(bytes memory _data) internal pure virtual returns (uint256 tokenId) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            tokenId := mload(add(_data, 0x20))
        }
    }

    /**
     * @dev Transfers the NFT using method compatible with old token contracts
     * @param _to address of the receiver of the children
     * @param _childContract The contract address of the child token
     * @param _childTokenId The tokenId of the child
     */
    function _oldNFTsTransfer(
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) internal {
        // This is here to be compatible with cryptokitties and other old contracts that require being owner and
        // approved before transferring.
        // Does not work with current standard which does not allow approving self, so we must let it fail in that case.
        try IERC721(_childContract).approve(address(this), _childTokenId) {
            // solhint-disable-previous-line no-empty-blocks
        } catch {
            // solhint-disable-previous-line no-empty-blocks
        }

        IERC721(_childContract).transferFrom(address(this), _to, _childTokenId);
    }

    /**
     * @notice Validates that the sender is authorized to perform a child transfer
     * @param _fromTokenId The owning token to transfer from
     */
    function _validateTransferSender(uint256 _fromTokenId) internal virtual {
        address rootOwner = address(uint160(uint256(rootOwnerOf(_fromTokenId))));
        require(
            rootOwner == msg.sender ||
                getApproved(_fromTokenId) == msg.sender ||
                isApprovedForAll(rootOwner, msg.sender),
            "transferChild msg.sender not eligible"
        );
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - Only the owner can call this method.
     * - The contract must not be paused.
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - Only the owner can call this method.
     * - The contract must be paused.
     */
    function unpause() external onlyOwner {
        _unpause();
    }
}

File 3 of 30 : INftfiBundler.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

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

interface INftfiBundler is IERC721 {
    function safeMint(address _to) external returns (uint256);

    function decomposeBundle(uint256 _tokenId, address _receiver) external;
}

File 4 of 30 : IBundleBuilder.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.17;

interface IBundleBuilder {
    /**
     * @notice data of a erc721 bundle element
     *
     * @param tokenContract - address of the token contract
     * @param id - id of the token
     * @param safeTransferable - wether the implementing token contract has a safeTransfer function or not
     */
    struct BundleElementERC721 {
        address tokenContract;
        uint256[] ids;
        bool safeTransferable;
    }

    /**
     * @notice used to build a bundle from the BundleElements struct,
     * returns the id of the created bundle
     *
     * @param _bundleElements - the lists of erc721 tokens that are to be bundled
     */
    function buildBundle(BundleElementERC721[] memory _bundleElements) external returns (uint256);

    /**
     * @notice Remove all the children from the bundle
     * @dev This method may run out of gas if the list of children is too big. In that case, children can be removed
     *      individually or in smaller batches.
     * @param _tokenId the id of the bundle
     * @param _receiver address of the receiver of the children
     */
    function decomposeBundle(uint256 _tokenId, address _receiver) external;

    event AddBundleElements(uint256 indexed _tokenId, BundleElementERC721[] _bundleElements);
    event RemoveBundleElements(uint256 indexed _tokenId, BundleElementERC721[] _bundleElements);
}

File 5 of 30 : IPermittedNFTs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.17;

interface IPermittedNFTs {
    function getNFTPermit(address _nftContract) external view returns (bytes32);
}

File 6 of 30 : Ownable.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.17;

import "@openzeppelin/contracts/utils/Context.sol";

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

    address private _ownerCandidate;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor(address _initialOwner) {
        _setOwner(_initialOwner);
    }

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

    function acceptTransferOwnership() public virtual {
        require(_ownerCandidate == _msgSender(), "Ownable: not owner candidate");
        _setOwner(_ownerCandidate);
        delete _ownerCandidate;
    }

    function cancelTransferOwnership() public virtual onlyOwner {
        delete _ownerCandidate;
    }

    function rejectTransferOwnership() public virtual {
        require(_ownerCandidate == _msgSender(), "Ownable: not owner candidate");
        delete _ownerCandidate;
    }

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

    /**
     * @dev Sets the owner.
     */
    function _setOwner(address _newOwner) internal {
        address oldOwner = _owner;
        _owner = _newOwner;
        emit OwnershipTransferred(oldOwner, _newOwner);
    }
}

File 7 of 30 : AirdropFlashLoan.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

/**
 * @title AirdropFlashLoan
 * @author NFTfi
 * @dev
 */
contract AirdropFlashLoan is ERC721Holder, ERC1155Holder, ReentrancyGuard {
    using Address for address;
    using SafeERC20 for IERC20;

    /**
     * @notice this function initiates a flashloan to pull an airdrop from a tartget contract
     *
     * @param _nftContract - contract address of the target nft of the drop
     * @param _nftId - id of the target nft of the drop
     * @param _target - address of the airdropping contract
     * @param _data - function selector to be called on the airdropping contract
     * @param _nftAirdrop - address of the used claiming nft in the drop
     * @param _nftAirdropId - id of the used claiming nft in the drop
     * @param _is1155 -
     * @param _nftAirdropAmount - amount in case of 1155
     * @param _beneficiary - address receiving the drop
     */
    function pullAirdrop(
        address _nftContract,
        uint256 _nftId,
        address _target,
        bytes calldata _data,
        address _nftAirdrop,
        uint256 _nftAirdropId,
        bool _is1155,
        uint256 _nftAirdropAmount,
        address _beneficiary
    ) external nonReentrant {
        // assumes that the collateral nft has been transferreded to this contract before calling this function
        _target.functionCall(_data);

        // return the collateral
        IERC721(_nftContract).approve(msg.sender, _nftId);

        // in case that arbitray function from _target does not send the airdrop to a specified address
        if (_nftAirdrop != address(0) && _beneficiary != address(0)) {
            // send the airdrop to the beneficiary
            if (_is1155) {
                IERC1155(_nftAirdrop).safeTransferFrom(
                    address(this),
                    _beneficiary,
                    _nftAirdropId,
                    _nftAirdropAmount,
                    "0x"
                );
            } else {
                IERC721(_nftAirdrop).safeTransferFrom(address(this), _beneficiary, _nftAirdropId);
            }
        }
    }

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

File 8 of 30 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 9 of 30 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 10 of 30 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 11 of 30 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 30 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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 13 of 30 : Address.sol
// SPDX-License-Identifier: MIT

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

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 14 of 30 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 15 of 30 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

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

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

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

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

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

File 16 of 30 : IERC998ERC721TopDown.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface IERC998ERC721TopDown {
    event ReceivedChild(
        address indexed _from,
        uint256 indexed _tokenId,
        address indexed _childContract,
        uint256 _childTokenId
    );
    event TransferChild(
        uint256 indexed tokenId,
        address indexed _to,
        address indexed _childContract,
        uint256 _childTokenId
    );

    function onERC721Received(
        address _operator,
        address _from,
        uint256 _childTokenId,
        bytes calldata _data
    ) external returns (bytes4);

    function transferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) external;

    function safeTransferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId
    ) external;

    function safeTransferChild(
        uint256 _fromTokenId,
        address _to,
        address _childContract,
        uint256 _childTokenId,
        bytes memory _data
    ) external;

    function transferChildToParent(
        uint256 _fromTokenId,
        address _toContract,
        uint256 _toTokenId,
        address _childContract,
        uint256 _childTokenId,
        bytes memory _data
    ) external;

    // getChild function enables older contracts like cryptokitties to be transferred into a composable
    // The _childContract must approve this contract. Then getChild can be called.
    function getChild(
        address _from,
        uint256 _tokenId,
        address _childContract,
        uint256 _childTokenId
    ) external;

    function rootOwnerOf(uint256 _tokenId) external view returns (bytes32 rootOwner);

    function rootOwnerOfChild(address _childContract, uint256 _childTokenId) external view returns (bytes32 rootOwner);

    function ownerOfChild(address _childContract, uint256 _childTokenId)
        external
        view
        returns (bytes32 parentTokenOwner, uint256 parentTokenId);
}

File 17 of 30 : IERC998ERC721TopDownEnumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface IERC998ERC721TopDownEnumerable {
    function totalChildContracts(uint256 _tokenId) external view returns (uint256);

    function childContractByIndex(uint256 _tokenId, uint256 _index) external view returns (address childContract);

    function totalChildTokens(uint256 _tokenId, address _childContract) external view returns (uint256);

    function childTokenByIndex(
        uint256 _tokenId,
        address _childContract,
        uint256 _index
    ) external view returns (uint256 childTokenId);
}

File 18 of 30 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        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 Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

    /**
     * @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 (to.isContract()) {
            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 {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

File 19 of 30 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

File 21 of 30 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 22 of 30 : Context.sol
// SPDX-License-Identifier: MIT

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 23 of 30 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 24 of 30 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 25 of 30 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 26 of 30 : ERC721Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 27 of 30 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 28 of 30 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}

File 29 of 30 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 30 of 30 : IERC20.sol
// SPDX-License-Identifier: MIT

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_customBaseURI","type":"string"},{"internalType":"address","name":"_permittedNfts","type":"address"},{"internalType":"address","name":"_airdropFlashLoan","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"indexed":false,"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_bundleElements","type":"tuple[]"}],"name":"AddBundleElements","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"ReceivedChild","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"indexed":false,"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_bundleElements","type":"tuple[]"}],"name":"RemoveBundleElements","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"TransferChild","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ERC998_MAGIC_VALUE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_toAdd","type":"tuple[]"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_toRemove","type":"tuple[]"}],"name":"addAndRemoveBundleElements","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_bundleElements","type":"tuple[]"}],"name":"addBundleElements","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"airdropFlashLoan","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_bundleElements","type":"tuple[]"}],"name":"buildBundle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"childContractByIndex","outputs":[{"internalType":"address","name":"childContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"childExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"childTokenByIndex","outputs":[{"internalType":"uint256","name":"childTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"decomposeBundle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"getChild","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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"ownerOfChild","outputs":[{"internalType":"bytes32","name":"parentTokenOwner","type":"bytes32"},{"internalType":"uint256","name":"parentTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"permittedAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permittedNfts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"address","name":"_nftAirdrop","type":"address"},{"internalType":"uint256","name":"_nftAirdropId","type":"uint256"},{"internalType":"bool","name":"_is1155","type":"bool"},{"internalType":"uint256","name":"_nftAirdropAmount","type":"uint256"},{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"pullAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rejectTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bool","name":"safeTransferable","type":"bool"}],"internalType":"struct IBundleBuilder.BundleElementERC721[]","name":"_bundleElements","type":"tuple[]"}],"name":"removeBundleElements","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwnerCandidate","type":"address"}],"name":"requestTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"rescueERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"rootOwnerOf","outputs":[{"internalType":"bytes32","name":"rootOwner","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"rootOwnerOfChild","outputs":[{"internalType":"bytes32","name":"rootOwner","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"safeMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"safeTransferChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_personalBundler","type":"address"}],"name":"sendElementsToPersonalBundler","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":"_customBaseURI","type":"string"}],"name":"setBaseURI","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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"totalChildContracts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_childContract","type":"address"}],"name":"totalChildTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_childContract","type":"address"},{"internalType":"uint256","name":"_childTokenId","type":"uint256"}],"name":"transferChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"transferChildToParent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040526000600d553480156200001657600080fd5b50604051620054f1380380620054f183398101604081905262000039916200036f565b8580868660006200004b8382620004c7565b5060016200005a8282620004c7565b50506001600a55506200006d81620000a6565b5050600c805460ff60a01b191690556001600160a01b03808316608052811660a0526200009a83620000f8565b50505050505062000690565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081511162000118576040518060200160405280600081525062000152565b806200012f466200016560201b6200232f1760201c565b6040516020016200014292919062000593565b6040516020818303038152906040525b601190620001619082620004c7565b5050565b6060816000036200018d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115620001bd5780620001a481620005e8565b9150620001b59050600a836200061a565b915062000191565b6000816001600160401b03811115620001da57620001da620002a2565b6040519080825280601f01601f19166020018201604052801562000205576020820181803683370190505b5090505b84156200027d576200021d60018362000631565b91506200022c600a866200064d565b6200023990603062000664565b60f81b8183815181106200025157620002516200067a565b60200101906001600160f81b031916908160001a90535062000275600a866200061a565b945062000209565b949350505050565b80516001600160a01b03811681146200029d57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002d5578181015183820152602001620002bb565b50506000910152565b600082601f830112620002f057600080fd5b81516001600160401b03808211156200030d576200030d620002a2565b604051601f8301601f19908116603f01168101908282118183101715620003385762000338620002a2565b816040528381528660208588010111156200035257600080fd5b62000365846020830160208901620002b8565b9695505050505050565b60008060008060008060c087890312156200038957600080fd5b620003948762000285565b60208801519096506001600160401b0380821115620003b257600080fd5b620003c08a838b01620002de565b96506040890151915080821115620003d757600080fd5b620003e58a838b01620002de565b95506060890151915080821115620003fc57600080fd5b506200040b89828a01620002de565b9350506200041c6080880162000285565b91506200042c60a0880162000285565b90509295509295509295565b600181811c908216806200044d57607f821691505b6020821081036200046e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004c257600081815260208120601f850160051c810160208610156200049d5750805b601f850160051c820191505b81811015620004be57828155600101620004a9565b5050505b505050565b81516001600160401b03811115620004e357620004e3620002a2565b620004fb81620004f4845462000438565b8462000474565b602080601f8311600181146200053357600084156200051a5750858301515b600019600386901b1c1916600185901b178555620004be565b600085815260208120601f198616915b82811015620005645788860151825594840194600190910190840162000543565b5085821015620005835787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008351620005a7818460208801620002b8565b835190830190620005bd818360208801620002b8565b602f60f81b9101908152600101949350505050565b634e487b7160e01b600052601160045260246000fd5b600060018201620005fd57620005fd620005d2565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826200062c576200062c62000604565b500490565b81810381811115620006475762000647620005d2565b92915050565b6000826200065f576200065f62000604565b500690565b80820180821115620006475762000647620005d2565b634e487b7160e01b600052603260045260246000fd5b60805160a051614e18620006d96000396000818161061b0152818161139401528181611419015281816114a5015261250601526000818161036701526110f20152614e186000f3fe608060405234801561001057600080fd5b506004361061035d5760003560e01c8063676a196a116101d35780639f181b5e11610104578063bff86757116100a2578063e985e9c51161007c578063e985e9c514610766578063eadb80b814610779578063ed81cdda146107a1578063fa3e4705146107b457600080fd5b8063bff867571461072d578063c87b56dd14610740578063df7490861461075357600080fd5b8063a7103afa116100de578063a7103afa146106e1578063b88d4fde146106f4578063ba6b5f9614610707578063bef44f181461071a57600080fd5b80639f181b5e146106b2578063a22cb465146106bb578063a57a63b2146106ce57600080fd5b80638d81f51e116101715780638daf2d611161014b5780638daf2d611461067c57806392fede001461068f57806395d89b41146106975780639d6fa6181461069f57600080fd5b80638d81f51e146106455780638da5cb5b146106585780638da7d0b51461066957600080fd5b80637b371107116101ad5780637b371107146105fb5780637eef089614610603578063804f3fb2146106165780638456cb591461063d57600080fd5b8063676a196a146105cd5780636c0360eb146105e057806370a08231146105e857600080fd5b80632f745c59116102ad5780634f6ccce71161024b5780635c975abb116102255780635c975abb1461058d5780635d799f871461059f5780635f992fdd146105b25780636352211e146105ba57600080fd5b80634f6ccce71461052f57806355f804b3146105425780635680a3ad1461055557600080fd5b80633f4ba83a116102875780633f4ba83a146104ee57806340d097c3146104f657806342842e0e1461050957806343a61a8e1461051c57600080fd5b80632f745c59146104b557806334854fda146104c857806335b21ceb146104db57600080fd5b80630d5a621b1161031a57806318160ddd116102f457806318160ddd146104795780631d98f3c51461048157806322ab2e6f1461049457806323b872dd146104a257600080fd5b80630d5a621b14610419578063150b7a021461042c578063160b01a11461045857600080fd5b806301cf69021461036257806301ffc9a7146103a657806306fdde03146103c9578063081812fc146103de57806308937f62146103f1578063095ea7b314610406575b600080fd5b6103897f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6103b96103b4366004613eef565b6107c7565b604051901515815260200161039d565b6103d161080d565b60405161039d9190613f5c565b6103896103ec366004613f6f565b61089f565b6104046103ff366004614082565b610939565b005b6104046104143660046140ff565b610981565b61038961042736600461412b565b610a96565b61043f61043a36600461418e565b610ab5565b6040516001600160e01b0319909116815260200161039d565b61046b610466366004614200565b610b65565b60405190815260200161039d565b60085461046b565b61040461048f366004614238565b610b99565b61046b63cd740db560e01b81565b6104046104b0366004614280565b610c75565b61046b6104c33660046140ff565b610ca6565b61046b6104d636600461442d565b610d3c565b61046b6104e9366004614461565b610d54565b610404610d7f565b61046b610504366004614491565b610db3565b610404610517366004614280565b610e07565b61046b61052a366004613f6f565b610e22565b61046b61053d366004613f6f565b610e2f565b6104046105503660046144ae565b610ec2565b6103b96105633660046140ff565b6001600160a01b039190911660009081526010602090815260408083209383529290522054151590565b600c54600160a01b900460ff166103b9565b6104046105ad3660046144f6565b610ef8565b610404610fed565b6103896105c8366004613f6f565b611059565b6103b96105db366004614491565b6110d0565b6103d161116a565b61046b6105f6366004614491565b6111f8565b61040461127f565b610404610611366004614524565b6112ee565b6103897f000000000000000000000000000000000000000000000000000000000000000081565b610404611524565b6104046106533660046145e3565b611556565b600b546001600160a01b0316610389565b61046b610677366004613f6f565b611657565b61040461068a366004614461565b61166e565b610404611a04565b6103d1611a2e565b6104046106ad366004614491565b611a3d565b61046b600d5481565b6104046106c9366004614658565b611aee565b6104046106dc366004614686565b611bb2565b6104046106ef366004614686565b611bc0565b6104046107023660046146cc565b611bca565b610404610715366004614737565b611bfc565b610404610728366004614238565b611d1e565b61040461073b36600461476f565b611d90565b6103d161074e366004613f6f565b611da4565b610404610761366004614461565b611e7e565b6103b96107743660046144f6565b611fe4565b61078c6107873660046140ff565b612012565b6040805192835260208301919091520161039d565b61046b6107af3660046140ff565b6120a4565b6104046107c23660046147db565b612184565b60006001600160e01b03198216630a85bd0160e11b14806107f857506001600160e01b03198216639fa4074560e01b145b8061080757506108078261242f565b92915050565b60606000805461081c9061481d565b80601f01602080910402602001604051908101604052809291908181526020018280546108489061481d565b80156108955780601f1061086a57610100808354040283529160200191610895565b820191906000526020600020905b81548152906001019060200180831161087857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661091d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152601d60248201527f424f54544f4d5f55505f4348494c445f4e4f545f535550504f525445440000006044820152606401610914565b600061098c82611059565b9050806001600160a01b0316836001600160a01b0316036109f95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610914565b336001600160a01b0382161480610a155750610a158133611fe4565b610a875760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610914565b610a91838361248a565b505050565b6000828152600e60205260408120610aae90836124f8565b9392505050565b600c54600090600160a01b900460ff1615610ae25760405162461bcd60e51b815260040161091490614857565b6002600a5403610b045760405162461bcd60e51b815260040161091490614881565b6002600a81905550610b4e85338686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061250492505050565b50630a85bd0160e11b6001600a5595945050505050565b6000838152600f602090815260408083206001600160a01b03861684529091528120610b9190836124f8565b949350505050565b6002600a5403610bbb5760405162461bcd60e51b815260040161091490614881565b6002600a55610bcc8484848461254a565b604051632142170760e11b81526001600160a01b038316906342842e0e90610bfc903090879086906004016148b8565b600060405180830381600087803b158015610c1657600080fd5b505af1158015610c2a573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051610c6291815260200190565b60405180910390a450506001600a555050565b610c7f3382612569565b610c9b5760405162461bcd60e51b8152600401610914906148dc565b610a91838383612638565b6000610cb1836111f8565b8210610d135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610914565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600080610d4833610db3565b905061080781846127e3565b6000828152600f602090815260408083206001600160a01b03851684529091528120610aae90612ac8565b600b546001600160a01b03163314610da95760405162461bcd60e51b81526004016109149061492d565b610db1612ad2565b565b600c54600090600160a01b900460ff1615610de05760405162461bcd60e51b815260040161091490614857565b6000600d60008154610df190614978565b918290555090506108078382612b6f565b919050565b610a9183838360405180602001604052806000815250611bca565b60006108076000836120a4565b6000610e3a60085490565b8210610e9d5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610914565b60088281548110610eb057610eb0614991565b90600052602060002001549050919050565b600b546001600160a01b03163314610eec5760405162461bcd60e51b81526004016109149061492d565b610ef581612b89565b50565b600b546001600160a01b03163314610f225760405162461bcd60e51b81526004016109149061492d565b6040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f91906149a7565b905060008111610fd35760405162461bcd60e51b815260206004820152600f60248201526e1b9bc81d1bdad95b9cc81bdddb9959608a1b6044820152606401610914565b610fe76001600160a01b0383168483612bdf565b50505050565b600c546001600160a01b031633146110475760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e646964617465000000006044820152606401610914565b600c80546001600160a01b0319169055565b6000818152600260205260408120546001600160a01b0316806108075760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610914565b604051636651f11d60e01b81526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000091839190831690636651f11d90602401602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116291906149a7565b119392505050565b601180546111779061481d565b80601f01602080910402602001604051908101604052809291908181526020018280546111a39061481d565b80156111f05780601f106111c5576101008083540402835291602001916111f0565b820191906000526020600020905b8154815290600101906020018083116111d357829003601f168201915b505050505081565b60006001600160a01b0382166112635760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610914565b506001600160a01b031660009081526003602052604090205490565b600c546001600160a01b031633146112d95760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e646964617465000000006044820152606401610914565b600c54611047906001600160a01b0316612c31565b6001600160a01b038a1660009081526010602090815260408083208c84529091528120549061131c82610e22565b90506001600160a01b03811633146113825760405162461bcd60e51b815260206004820152602360248201527f70756c6c41697264726f70206d73672e73656e646572206e6f7420656c696769604482015262626c6560e81b6064820152608401610914565b8b6001600160a01b03166342842e0e307f00000000000000000000000000000000000000000000000000000000000000008e6040518463ffffffff1660e01b81526004016113d2939291906148b8565b600060405180830381600087803b1580156113ec57600080fd5b505af1158015611400573d6000803e3d6000fd5b5050604051633f77844b60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250637eef08969150611462908f908f908f908f908f908f908f908f908f908f906004016149c0565b600060405180830381600087803b15801561147c57600080fd5b505af1158015611490573d6000803e3d6000fd5b505050508b6001600160a01b03166342842e0e7f0000000000000000000000000000000000000000000000000000000000000000308e6040518463ffffffff1660e01b81526004016114e4939291906148b8565b600060405180830381600087803b1580156114fe57600080fd5b505af1158015611512573d6000803e3d6000fd5b50505050505050505050505050505050565b600b546001600160a01b0316331461154e5760405162461bcd60e51b81526004016109149061492d565b610db1612c83565b6002600a54036115785760405162461bcd60e51b815260040161091490614881565b6002600a556115898585858561254a565b306001600160a01b038516036115aa576115a533848484612504565b61164b565b604051635c46a7ef60e11b81526001600160a01b0384169063b88d4fde906115dc903090889087908790600401614a42565b600060405180830381600087803b1580156115f657600080fd5b505af115801561160a573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b031686600080516020614dec8339815191528560405161164291815260200190565b60405180910390a45b50506001600a55505050565b6000818152600e6020526040812061080790612ac8565b61167781612ce8565b61168082612d3e565b306001600160a01b038216036116ce5760405162461bcd60e51b815260206004820152601360248201527231b0b73737ba1039b2b732103a379039b2b63360691b6044820152606401610914565b6040516301ffc9a760e01b815263cde244d960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015611719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173d9190614a7f565b6117975760405162461bcd60e51b815260206004820152602560248201527f68617320746f20696d706c656d656e742049455243393938455243373231546f604482015264382237bbb760d91b6064820152608401610914565b6040516331a9108f60e11b81526001600482018190529033906001600160a01b03841690636352211e90602401602060405180830381865afa1580156117e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118059190614a9c565b6001600160a01b03161461185b5760405162461bcd60e51b815260206004820181905260248201527f68617320746f206f776e20706572736f6e616c2062756e646c6520746f6b656e6044820152606401610914565b6000838152600e6020526040812061187290612ac8565b1115610a91576000838152600e6020526040812061189090826124f8565b90505b6000848152600f602090815260408083206001600160a01b038516845290915281206118be90612ac8565b11156119fe576000848152600f602090815260408083206001600160a01b038516845290915281206118f090826124f8565b90506118fd858383612ddc565b816001600160a01b031663b88d4fde3086848760405160200161192291815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016119509493929190614a42565b600060405180830381600087803b15801561196a57600080fd5b505af192505050801561197b575060015b6119bc5760405162461bcd60e51b815260206004820152601260248201527137b7363c9039b0b332903a3930b739b332b960711b6044820152606401610914565b816001600160a01b0316846001600160a01b031686600080516020614dec833981519152846040516119f091815260200190565b60405180910390a450611893565b5061185b565b600b546001600160a01b031633146110475760405162461bcd60e51b81526004016109149061492d565b60606001805461081c9061481d565b600b546001600160a01b03163314611a675760405162461bcd60e51b81526004016109149061492d565b6001600160a01b038116611acc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610914565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b03831603611b465760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610914565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611bbc82826127e3565b5050565b611bbc8282612e68565b611bd43383612569565b611bf05760405162461bcd60e51b8152600401610914906148dc565b610fe78484848461307e565b600c54600160a01b900460ff1615611c265760405162461bcd60e51b815260040161091490614857565b6002600a5403611c485760405162461bcd60e51b815260040161091490614881565b6002600a556001600160a01b0384163314611ca55760405162461bcd60e51b815260206004820152601a60248201527f5f66726f6d2073686f756c64206265206d73672e73656e6465720000000000006044820152606401610914565b611cb1848484846130b1565b6040516323b872dd60e01b81526001600160a01b038316906323b872dd90611ce1908790309086906004016148b8565b600060405180830381600087803b158015611cfb57600080fd5b505af1158015611d0f573d6000803e3d6000fd5b50506001600a55505050505050565b6002600a5403611d405760405162461bcd60e51b815260040161091490614881565b6002600a55611d518484848461254a565b611d5c838383613109565b816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051610c6291815260200190565b611d9a83836127e3565b610a918382612e68565b6000818152600260205260409020546060906001600160a01b0316611e235760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610914565b6000611e2d6131ca565b90506000815111611e4d5760405180602001604052806000815250610aae565b80611e578461232f565b604051602001611e68929190614ab9565b6040516020818303038152906040529392505050565b611e8781612ce8565b611e9082612d3e565b6000828152600e60205260408120611ea790612ac8565b1115611bbc576000828152600e60205260408120611ec590826124f8565b90505b6000838152600f602090815260408083206001600160a01b03851684529091528120611ef390612ac8565b1115611fde576000838152600f602090815260408083206001600160a01b03851684529091528120611f2590826124f8565b9050611f32848383612ddc565b604051632142170760e11b81526001600160a01b038316906342842e0e90611f62903090879086906004016148b8565b600060405180830381600087803b158015611f7c57600080fd5b505af1925050508015611f8d575060015b611f9c57611f9c838383613109565b816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051611fd091815260200190565b60405180910390a450611ec8565b50611e90565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6001600160a01b03821660009081526010602090815260408083208484529091528120548082036120855760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f742065786973740000000000006044820152606401610914565b600061209082611059565b63cd740db560e01b17959194509092505050565b6000806001600160a01b038416156120c9576120c084846131d9565b935090506120d5565b6120d283611059565b90505b6001600160a01b0381163b15612174576040516376c0e6ed60e11b8152306004820152602481018490526001600160a01b0382169063ed81cdda90604401602060405180830381865afa92505050801561214c575060408051601f3d908101601f19168201909252612149918101906149a7565b60015b156121745763328bf24b60e01b6001600160e01b03198216016121725791506108079050565b505b63cd740db560e01b179392505050565b600b546001600160a01b031633146121ae5760405162461bcd60e51b81526004016109149061492d565b6001600160a01b03831660009081526010602090815260408083208584529091529020548390156122165760405162461bcd60e51b8152602060048201526012602482015271746f6b656e20697320696e2062756e646c6560701b6044820152606401610914565b6040516331a9108f60e11b81526004810184905230906001600160a01b03831690636352211e90602401602060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122819190614a9c565b6001600160a01b0316146122c75760405162461bcd60e51b815260206004820152600d60248201526c1b999d081b9bdd081bdddb9959609a1b6044820152606401610914565b604051632142170760e11b81526001600160a01b038216906342842e0e906122f7903090869088906004016148b8565b600060405180830381600087803b15801561231157600080fd5b505af1158015612325573d6000803e3d6000fd5b5050505050505050565b6060816000036123565750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612380578061236a81614978565b91506123799050600a83614afe565b915061235a565b6000816001600160401b0381111561239a5761239a613f9d565b6040519080825280601f01601f1916602001820160405280156123c4576020820181803683370190505b5090505b8415610b91576123d9600183614b12565b91506123e6600a86614b25565b6123f1906030614b39565b60f81b81838151811061240657612406614991565b60200101906001600160f81b031916908160001a905350612428600a86614afe565b94506123c8565b60006001600160e01b0319821663cde244d960e01b148061246057506001600160e01b031982166328d12bf960e21b145b8061247b5750630f7ef9b560e11b6001600160e01b03198316145b8061080757506108078261325f565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124bf82611059565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610aae8383613284565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03160315610fe757610fe7848484846132ae565b61255383612ce8565b61255e848383613347565b610fe7848383612ddc565b6000818152600260205260408120546001600160a01b03166125e25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610914565b60006125ed83611059565b9050806001600160a01b0316846001600160a01b031614806126285750836001600160a01b031661261d8461089f565b6001600160a01b0316145b80610b915750610b918185611fe4565b826001600160a01b031661264b82611059565b6001600160a01b0316146126b35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610914565b6001600160a01b0382166127155760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610914565b61272083838361344f565b61272b60008261248a565b6001600160a01b0383166000908152600360205260408120805460019290612754908490614b12565b90915550506001600160a01b0382166000908152600360205260408120805460019290612782908490614b39565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008151116128265760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b6044820152606401610914565b805160005b818114612a8a5761285883828151811061284757612847614991565b6020026020010151600001516110d0565b61289b5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b6044820152606401610914565b8281815181106128ad576128ad614991565b602002602001015160400151156129db5760008382815181106128d2576128d2614991565b60200260200101516020015151905060005b8181146129d4578483815181106128fd576128fd614991565b6020026020010151600001516001600160a01b031663b88d4fde333088878151811061292b5761292b614991565b602002602001015160200151858151811061294857612948614991565b60200260200101518a60405160200161296391815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016129919493929190614a42565b600060405180830381600087803b1580156129ab57600080fd5b505af11580156129bf573d6000803e3d6000fd5b50505050806129cd90614978565b90506128e4565b5050612a7a565b60008382815181106129ef576129ef614991565b60200260200101516020015151905060005b818114612a7757612a673387878681518110612a1f57612a1f614991565b602002602001015160000151888781518110612a3d57612a3d614991565b6020026020010151602001518581518110612a5a57612a5a614991565b6020026020010151611bfc565b612a7081614978565b9050612a01565b50505b612a8381614978565b905061282b565b50827faeecfeb34aeb11fe7449e04fbc8fc80d3ddd8eeb67b35e6c1b8e1b7e3d8f025783604051612abb9190614b4c565b60405180910390a2505050565b6000610807825490565b600c54600160a01b900460ff16612b225760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610914565b600c805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611bbc8282604051806020016040528060008152506134b2565b6000815111612ba75760405180602001604052806000815250612bd2565b80612bb14661232f565b604051602001612bc2929190614c02565b6040516020818303038152906040525b601190611bbc9082614c8b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a919084906134e5565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c54600160a01b900460ff1615612cad5760405162461bcd60e51b815260040161091490614857565b600c805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612b523390565b6001600160a01b038116610ef55760405162461bcd60e51b815260206004820152601e60248201527f6368696c64207472616e7366657220746f207a65726f206164647265737300006044820152606401610914565b6000612d4982610e22565b90506001600160a01b038116331480612d72575033612d678361089f565b6001600160a01b0316145b80612d825750612d828133611fe4565b611bbc5760405162461bcd60e51b815260206004820152602560248201527f7472616e736665724368696c64206d73672e73656e646572206e6f7420656c696044820152646769626c6560d81b6064820152608401610914565b6000838152600f602090815260408083206001600160a01b03861684529091529020612e0890826135b7565b506001600160a01b03821660008181526010602090815260408083208584528252808320839055868352600f825280832093835292905220612e4990612ac8565b600003610a91576000838152600e60205260409020610fe790836135c3565b6000815111612eab5760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b6044820152606401610914565b805160005b81811461304d576000838281518110612ecb57612ecb614991565b60200260200101516000015190506000848381518110612eed57612eed614991565b60200260200101516020015151905060005b818114613039576000868581518110612f1a57612f1a614991565b6020026020010151602001518281518110612f3757612f37614991565b60200260200101519050612f4c888583613347565b612f57888583612ddc565b868581518110612f6957612f69614991565b60200260200101516040015115612fe157604051632142170760e11b81526001600160a01b038516906342842e0e90612faa903090339086906004016148b8565b600060405180830381600087803b158015612fc457600080fd5b505af1158015612fd8573d6000803e3d6000fd5b50505050612fec565b612fec338583613109565b836001600160a01b0316336001600160a01b031689600080516020614dec8339815191528460405161302091815260200190565b60405180910390a45061303281614978565b9050612eff565b5050508061304690614978565b9050612eb0565b50827ff60c055f56c20fcc9ca127b02b3958fad33fb25c41c195093e037d94fcc2700883604051612abb9190614b4c565b613089848484612638565b613095848484846135d8565b610fe75760405162461bcd60e51b815260040161091490614d4a565b6130ba826110d0565b6130fd5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b6044820152606401610914565b610fe7848484846136d9565b60405163095ea7b360e01b8152306004820152602481018290526001600160a01b0383169063095ea7b390604401600060405180830381600087803b15801561315157600080fd5b505af1925050508015613162575060015b506040516323b872dd60e01b81526001600160a01b038316906323b872dd90613193903090879086906004016148b8565b600060405180830381600087803b1580156131ad57600080fd5b505af11580156131c1573d6000803e3d6000fd5b50505050505050565b60606011805461081c9061481d565b6001600160a01b038216600090815260106020908152604080832084845290915281205480820361324c5760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f742065786973740000000000006044820152606401610914565b61325581611059565b91505b9250929050565b60006001600160e01b0319821663780e9d6360e01b1480610807575061080782613820565b600082600001828154811061329b5761329b614991565b9060005260206000200154905092915050565b60008151116133255760405162461bcd60e51b815260206004820152603860248201527f64617461206d75737420636f6e7461696e20746f6b656e496420746f2074726160448201527f6e7366657220746865206368696c6420746f6b656e20746f00000000000000006064820152608401610914565b6000613332826020015190565b9050613340858286866130b1565b5050505050565b6001600160a01b0382166000908152601060209081526040808320848452909152812054908190036133d95760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665724368696c64205f6368696c64436f6e7472616374205f636044820152741a1a5b19151bdad95b9259081b9bdd08199bdd5b99605a1b6064820152608401610914565b8381146134465760405162461bcd60e51b815260206004820152603560248201527f436f6d706f7361626c65546f70446f776e3a205f7472616e736665724368696c60448201527419081ddc9bdb99c81d1bdad95b925908199bdd5b99605a1b6064820152608401610914565b610fe781612d3e565b306001600160a01b038316036134a75760405162461bcd60e51b815260206004820152601a60248201527f6e65737465642062756e646c6573206e6f7420616c6c6f7765640000000000006044820152606401610914565b610a91838383613870565b6134bc8383613928565b6134c960008484846135d8565b610a915760405162461bcd60e51b815260040161091490614d4a565b600061353a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a769092919063ffffffff16565b805190915015610a9157808060200190518101906135589190614a7f565b610a915760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610914565b6000610aae8383613a85565b6000610aae836001600160a01b038416613a85565b60006001600160a01b0384163b156136ce57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061361c903390899088908890600401614a42565b6020604051808303816000875af1925050508015613657575060408051601f3d908101601f1916820190925261365491810190614d9c565b60015b6136b4573d808015613685576040519150601f19603f3d011682016040523d82523d6000602084013e61368a565b606091505b5080516000036136ac5760405162461bcd60e51b815260040161091490614d4a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610b91565b506001949350505050565b6000838152600260205260409020546001600160a01b031661373d5760405162461bcd60e51b815260206004820152601d60248201527f62756e646c6520746f6b656e496420646f6573206e6f742065786973740000006044820152606401610914565b6000838152600f602090815260408083206001600160a01b0386168452909152812061376890612ac8565b90508060000361378c576000848152600e6020526040902061378a9084613b78565b505b6000848152600f602090815260408083206001600160a01b038716845290915290206137b89083613b8d565b506001600160a01b038381166000818152601060209081526040808320878452825291829020889055905185815291928792908916917f0371ddf2288ad1ba92626a7e31c86a9d006e592cfe57d7d946ef08b13457c08b910160405180910390a45050505050565b60006001600160e01b031982166380ac58cd60e01b148061385157506001600160e01b03198216635b5e139f60e01b145b8061080757506301ffc9a760e01b6001600160e01b0319831614610807565b6001600160a01b0383166138cb576138c681600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6138ee565b816001600160a01b0316836001600160a01b0316146138ee576138ee8382613b99565b6001600160a01b03821661390557610a9181613c36565b826001600160a01b0316826001600160a01b031614610a9157610a918282613ce5565b6001600160a01b03821661397e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610914565b6000818152600260205260409020546001600160a01b0316156139e35760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610914565b6139ef6000838361344f565b6001600160a01b0382166000908152600360205260408120805460019290613a18908490614b39565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060610b918484600085613d29565b60008181526001830160205260408120548015613b6e576000613aa9600183614b12565b8554909150600090613abd90600190614b12565b9050818114613b22576000866000018281548110613add57613add614991565b9060005260206000200154905080876000018481548110613b0057613b00614991565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b3357613b33614db9565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610807565b6000915050610807565b6000610aae836001600160a01b038416613e51565b6000610aae8383613e51565b60006001613ba6846111f8565b613bb09190614b12565b600083815260076020526040902054909150808214613c03576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090613c4890600190614b12565b60008381526009602052604081205460088054939450909284908110613c7057613c70614991565b906000526020600020015490508060088381548110613c9157613c91614991565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613cc957613cc9614db9565b6001900381819060005260206000200160009055905550505050565b6000613cf0836111f8565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015613d8a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610914565b843b613dd85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610914565b600080866001600160a01b03168587604051613df49190614dcf565b60006040518083038185875af1925050503d8060008114613e31576040519150601f19603f3d011682016040523d82523d6000602084013e613e36565b606091505b5091509150613e46828286613ea0565b979650505050505050565b6000818152600183016020526040812054613e9857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610807565b506000610807565b60608315613eaf575081610aae565b825115613ebf5782518084602001fd5b8160405162461bcd60e51b81526004016109149190613f5c565b6001600160e01b031981168114610ef557600080fd5b600060208284031215613f0157600080fd5b8135610aae81613ed9565b60005b83811015613f27578181015183820152602001613f0f565b50506000910152565b60008151808452613f48816020860160208601613f0c565b601f01601f19169290920160200192915050565b602081526000610aae6020830184613f30565b600060208284031215613f8157600080fd5b5035919050565b6001600160a01b0381168114610ef557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613fd557613fd5613f9d565b60405290565b604051601f8201601f191681016001600160401b038111828210171561400357614003613f9d565b604052919050565b60006001600160401b0383111561402457614024613f9d565b614037601f8401601f1916602001613fdb565b905082815283838301111561404b57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261407357600080fd5b610aae8383356020850161400b565b60008060008060008060c0878903121561409b57600080fd5b8635955060208701356140ad81613f88565b94506040870135935060608701356140c481613f88565b92506080870135915060a08701356001600160401b038111156140e657600080fd5b6140f289828a01614062565b9150509295509295509295565b6000806040838503121561411257600080fd5b823561411d81613f88565b946020939093013593505050565b6000806040838503121561413e57600080fd5b50508035926020909101359150565b60008083601f84011261415f57600080fd5b5081356001600160401b0381111561417657600080fd5b60208301915083602082850101111561325857600080fd5b6000806000806000608086880312156141a657600080fd5b85356141b181613f88565b945060208601356141c181613f88565b93506040860135925060608601356001600160401b038111156141e357600080fd5b6141ef8882890161414d565b969995985093965092949392505050565b60008060006060848603121561421557600080fd5b83359250602084013561422781613f88565b929592945050506040919091013590565b6000806000806080858703121561424e57600080fd5b84359350602085013561426081613f88565b9250604085013561427081613f88565b9396929550929360600135925050565b60008060006060848603121561429557600080fd5b83356142a081613f88565b9250602084013561422781613f88565b60006001600160401b038211156142c9576142c9613f9d565b5060051b60200190565b8015158114610ef557600080fd5b8035610e02816142d3565b600082601f8301126142fd57600080fd5b8135602061431261430d836142b0565b613fdb565b82815260059290921b8401810191818101908684111561433157600080fd5b8286015b848110156144225780356001600160401b03808211156143555760008081fd5b908801906060828b03601f190181131561436f5760008081fd5b614377613fb3565b8784013561438481613f88565b81526040848101358481111561439a5760008081fd5b85019350603f84018d136143ae5760008081fd5b888401356143be61430d826142b0565b81815260059190911b85018201908a8101908f8311156143de5760008081fd5b958301955b828710156143fc5786358252958b0195908b01906143e3565b848c01525061440e90508584016142e1565b908201528652505050918301918301614335565b509695505050505050565b60006020828403121561443f57600080fd5b81356001600160401b0381111561445557600080fd5b610b91848285016142ec565b6000806040838503121561447457600080fd5b82359150602083013561448681613f88565b809150509250929050565b6000602082840312156144a357600080fd5b8135610aae81613f88565b6000602082840312156144c057600080fd5b81356001600160401b038111156144d657600080fd5b8201601f810184136144e757600080fd5b610b918482356020840161400b565b6000806040838503121561450957600080fd5b823561451481613f88565b9150602083013561448681613f88565b6000806000806000806000806000806101208b8d03121561454457600080fd5b8a3561454f81613f88565b995060208b0135985060408b013561456681613f88565b975060608b01356001600160401b0381111561458157600080fd5b61458d8d828e0161414d565b90985096505060808b01356145a181613f88565b945060a08b0135935060c08b01356145b8816142d3565b925060e08b013591506101008b01356145d081613f88565b809150509295989b9194979a5092959850565b600080600080600060a086880312156145fb57600080fd5b85359450602086013561460d81613f88565b9350604086013561461d81613f88565b92506060860135915060808601356001600160401b0381111561463f57600080fd5b61464b88828901614062565b9150509295509295909350565b6000806040838503121561466b57600080fd5b823561467681613f88565b91506020830135614486816142d3565b6000806040838503121561469957600080fd5b8235915060208301356001600160401b038111156146b657600080fd5b6146c2858286016142ec565b9150509250929050565b600080600080608085870312156146e257600080fd5b84356146ed81613f88565b935060208501356146fd81613f88565b92506040850135915060608501356001600160401b0381111561471f57600080fd5b61472b87828801614062565b91505092959194509250565b6000806000806080858703121561474d57600080fd5b843561475881613f88565b935060208501359250604085013561427081613f88565b60008060006060848603121561478457600080fd5b8335925060208401356001600160401b03808211156147a257600080fd5b6147ae878388016142ec565b935060408601359150808211156147c457600080fd5b506147d1868287016142ec565b9150509250925092565b6000806000606084860312156147f057600080fd5b83356147fb81613f88565b925060208401359150604084013561481281613f88565b809150509250925092565b600181811c9082168061483157607f821691505b60208210810361485157634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001820161498a5761498a614962565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156149b957600080fd5b5051919050565b6001600160a01b038b81168252602082018b9052898116604083015261012060608301819052820188905260009061014090898b838601376000848b0183015290971660808301525060a081019490945291151560c084015260e08301526001600160a01b0316610100820152601f909201601f191690910101949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614a7590830184613f30565b9695505050505050565b600060208284031215614a9157600080fd5b8151610aae816142d3565b600060208284031215614aae57600080fd5b8151610aae81613f88565b60008351614acb818460208801613f0c565b835190830190614adf818360208801613f0c565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614b0d57614b0d614ae8565b500490565b8181038181111561080757610807614962565b600082614b3457614b34614ae8565b500690565b8082018082111561080757610807614962565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b84811015614bf357898403603f19018652825180516001600160a01b031685528881015160608a8701819052815190870181905260808701918b019085905b80821015614bd35782518452928c0192918c019160019190910190614bb3565b505050908801511515948801949094529487019491870191600101614b74565b50919998505050505050505050565b60008351614c14818460208801613f0c565b835190830190614c28818360208801613f0c565b602f60f81b9101908152600101949350505050565b601f821115610a9157600081815260208120601f850160051c81016020861015614c645750805b601f850160051c820191505b81811015614c8357828155600101614c70565b505050505050565b81516001600160401b03811115614ca457614ca4613f9d565b614cb881614cb2845461481d565b84614c3d565b602080601f831160018114614ced5760008415614cd55750858301515b600019600386901b1c1916600185901b178555614c83565b600085815260208120601f198616915b82811015614d1c57888601518255948401946001909101908401614cfd565b5085821015614d3a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614dae57600080fd5b8151610aae81613ed9565b634e487b7160e01b600052603160045260246000fd5b60008251614de1818460208701613f0c565b919091019291505056fe0ef52e516fb5aec15a5d3587e5480481b702b26db93c8430eca78b61990fd3f6a164736f6c6343000811000a000000000000000000000000dca17eedc1aa3dbb14361678566b2da5a1bb4c3100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e9652000000000000000000000000000000000000000000000000000000000000000154e46546669204564697461626c652042756e646c650000000000000000000000000000000000000000000000000000000000000000000000000000000000000545424e4649000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f68747470733a2f2f6d657461646174612e6e667466692e636f6d2f62756e646c65732f76312f6564697461626c652f0000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061035d5760003560e01c8063676a196a116101d35780639f181b5e11610104578063bff86757116100a2578063e985e9c51161007c578063e985e9c514610766578063eadb80b814610779578063ed81cdda146107a1578063fa3e4705146107b457600080fd5b8063bff867571461072d578063c87b56dd14610740578063df7490861461075357600080fd5b8063a7103afa116100de578063a7103afa146106e1578063b88d4fde146106f4578063ba6b5f9614610707578063bef44f181461071a57600080fd5b80639f181b5e146106b2578063a22cb465146106bb578063a57a63b2146106ce57600080fd5b80638d81f51e116101715780638daf2d611161014b5780638daf2d611461067c57806392fede001461068f57806395d89b41146106975780639d6fa6181461069f57600080fd5b80638d81f51e146106455780638da5cb5b146106585780638da7d0b51461066957600080fd5b80637b371107116101ad5780637b371107146105fb5780637eef089614610603578063804f3fb2146106165780638456cb591461063d57600080fd5b8063676a196a146105cd5780636c0360eb146105e057806370a08231146105e857600080fd5b80632f745c59116102ad5780634f6ccce71161024b5780635c975abb116102255780635c975abb1461058d5780635d799f871461059f5780635f992fdd146105b25780636352211e146105ba57600080fd5b80634f6ccce71461052f57806355f804b3146105425780635680a3ad1461055557600080fd5b80633f4ba83a116102875780633f4ba83a146104ee57806340d097c3146104f657806342842e0e1461050957806343a61a8e1461051c57600080fd5b80632f745c59146104b557806334854fda146104c857806335b21ceb146104db57600080fd5b80630d5a621b1161031a57806318160ddd116102f457806318160ddd146104795780631d98f3c51461048157806322ab2e6f1461049457806323b872dd146104a257600080fd5b80630d5a621b14610419578063150b7a021461042c578063160b01a11461045857600080fd5b806301cf69021461036257806301ffc9a7146103a657806306fdde03146103c9578063081812fc146103de57806308937f62146103f1578063095ea7b314610406575b600080fd5b6103897f000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac81565b6040516001600160a01b0390911681526020015b60405180910390f35b6103b96103b4366004613eef565b6107c7565b604051901515815260200161039d565b6103d161080d565b60405161039d9190613f5c565b6103896103ec366004613f6f565b61089f565b6104046103ff366004614082565b610939565b005b6104046104143660046140ff565b610981565b61038961042736600461412b565b610a96565b61043f61043a36600461418e565b610ab5565b6040516001600160e01b0319909116815260200161039d565b61046b610466366004614200565b610b65565b60405190815260200161039d565b60085461046b565b61040461048f366004614238565b610b99565b61046b63cd740db560e01b81565b6104046104b0366004614280565b610c75565b61046b6104c33660046140ff565b610ca6565b61046b6104d636600461442d565b610d3c565b61046b6104e9366004614461565b610d54565b610404610d7f565b61046b610504366004614491565b610db3565b610404610517366004614280565b610e07565b61046b61052a366004613f6f565b610e22565b61046b61053d366004613f6f565b610e2f565b6104046105503660046144ae565b610ec2565b6103b96105633660046140ff565b6001600160a01b039190911660009081526010602090815260408083209383529290522054151590565b600c54600160a01b900460ff166103b9565b6104046105ad3660046144f6565b610ef8565b610404610fed565b6103896105c8366004613f6f565b611059565b6103b96105db366004614491565b6110d0565b6103d161116a565b61046b6105f6366004614491565b6111f8565b61040461127f565b610404610611366004614524565b6112ee565b6103897f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e9652081565b610404611524565b6104046106533660046145e3565b611556565b600b546001600160a01b0316610389565b61046b610677366004613f6f565b611657565b61040461068a366004614461565b61166e565b610404611a04565b6103d1611a2e565b6104046106ad366004614491565b611a3d565b61046b600d5481565b6104046106c9366004614658565b611aee565b6104046106dc366004614686565b611bb2565b6104046106ef366004614686565b611bc0565b6104046107023660046146cc565b611bca565b610404610715366004614737565b611bfc565b610404610728366004614238565b611d1e565b61040461073b36600461476f565b611d90565b6103d161074e366004613f6f565b611da4565b610404610761366004614461565b611e7e565b6103b96107743660046144f6565b611fe4565b61078c6107873660046140ff565b612012565b6040805192835260208301919091520161039d565b61046b6107af3660046140ff565b6120a4565b6104046107c23660046147db565b612184565b60006001600160e01b03198216630a85bd0160e11b14806107f857506001600160e01b03198216639fa4074560e01b145b8061080757506108078261242f565b92915050565b60606000805461081c9061481d565b80601f01602080910402602001604051908101604052809291908181526020018280546108489061481d565b80156108955780601f1061086a57610100808354040283529160200191610895565b820191906000526020600020905b81548152906001019060200180831161087857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661091d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152601d60248201527f424f54544f4d5f55505f4348494c445f4e4f545f535550504f525445440000006044820152606401610914565b600061098c82611059565b9050806001600160a01b0316836001600160a01b0316036109f95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610914565b336001600160a01b0382161480610a155750610a158133611fe4565b610a875760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610914565b610a91838361248a565b505050565b6000828152600e60205260408120610aae90836124f8565b9392505050565b600c54600090600160a01b900460ff1615610ae25760405162461bcd60e51b815260040161091490614857565b6002600a5403610b045760405162461bcd60e51b815260040161091490614881565b6002600a81905550610b4e85338686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061250492505050565b50630a85bd0160e11b6001600a5595945050505050565b6000838152600f602090815260408083206001600160a01b03861684529091528120610b9190836124f8565b949350505050565b6002600a5403610bbb5760405162461bcd60e51b815260040161091490614881565b6002600a55610bcc8484848461254a565b604051632142170760e11b81526001600160a01b038316906342842e0e90610bfc903090879086906004016148b8565b600060405180830381600087803b158015610c1657600080fd5b505af1158015610c2a573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051610c6291815260200190565b60405180910390a450506001600a555050565b610c7f3382612569565b610c9b5760405162461bcd60e51b8152600401610914906148dc565b610a91838383612638565b6000610cb1836111f8565b8210610d135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610914565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600080610d4833610db3565b905061080781846127e3565b6000828152600f602090815260408083206001600160a01b03851684529091528120610aae90612ac8565b600b546001600160a01b03163314610da95760405162461bcd60e51b81526004016109149061492d565b610db1612ad2565b565b600c54600090600160a01b900460ff1615610de05760405162461bcd60e51b815260040161091490614857565b6000600d60008154610df190614978565b918290555090506108078382612b6f565b919050565b610a9183838360405180602001604052806000815250611bca565b60006108076000836120a4565b6000610e3a60085490565b8210610e9d5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610914565b60088281548110610eb057610eb0614991565b90600052602060002001549050919050565b600b546001600160a01b03163314610eec5760405162461bcd60e51b81526004016109149061492d565b610ef581612b89565b50565b600b546001600160a01b03163314610f225760405162461bcd60e51b81526004016109149061492d565b6040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f91906149a7565b905060008111610fd35760405162461bcd60e51b815260206004820152600f60248201526e1b9bc81d1bdad95b9cc81bdddb9959608a1b6044820152606401610914565b610fe76001600160a01b0383168483612bdf565b50505050565b600c546001600160a01b031633146110475760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e646964617465000000006044820152606401610914565b600c80546001600160a01b0319169055565b6000818152600260205260408120546001600160a01b0316806108075760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610914565b604051636651f11d60e01b81526001600160a01b0382811660048301526000917f000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac91839190831690636651f11d90602401602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116291906149a7565b119392505050565b601180546111779061481d565b80601f01602080910402602001604051908101604052809291908181526020018280546111a39061481d565b80156111f05780601f106111c5576101008083540402835291602001916111f0565b820191906000526020600020905b8154815290600101906020018083116111d357829003601f168201915b505050505081565b60006001600160a01b0382166112635760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610914565b506001600160a01b031660009081526003602052604090205490565b600c546001600160a01b031633146112d95760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e646964617465000000006044820152606401610914565b600c54611047906001600160a01b0316612c31565b6001600160a01b038a1660009081526010602090815260408083208c84529091528120549061131c82610e22565b90506001600160a01b03811633146113825760405162461bcd60e51b815260206004820152602360248201527f70756c6c41697264726f70206d73672e73656e646572206e6f7420656c696769604482015262626c6560e81b6064820152608401610914565b8b6001600160a01b03166342842e0e307f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e965208e6040518463ffffffff1660e01b81526004016113d2939291906148b8565b600060405180830381600087803b1580156113ec57600080fd5b505af1158015611400573d6000803e3d6000fd5b5050604051633f77844b60e11b81526001600160a01b037f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e96520169250637eef08969150611462908f908f908f908f908f908f908f908f908f908f906004016149c0565b600060405180830381600087803b15801561147c57600080fd5b505af1158015611490573d6000803e3d6000fd5b505050508b6001600160a01b03166342842e0e7f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e96520308e6040518463ffffffff1660e01b81526004016114e4939291906148b8565b600060405180830381600087803b1580156114fe57600080fd5b505af1158015611512573d6000803e3d6000fd5b50505050505050505050505050505050565b600b546001600160a01b0316331461154e5760405162461bcd60e51b81526004016109149061492d565b610db1612c83565b6002600a54036115785760405162461bcd60e51b815260040161091490614881565b6002600a556115898585858561254a565b306001600160a01b038516036115aa576115a533848484612504565b61164b565b604051635c46a7ef60e11b81526001600160a01b0384169063b88d4fde906115dc903090889087908790600401614a42565b600060405180830381600087803b1580156115f657600080fd5b505af115801561160a573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b031686600080516020614dec8339815191528560405161164291815260200190565b60405180910390a45b50506001600a55505050565b6000818152600e6020526040812061080790612ac8565b61167781612ce8565b61168082612d3e565b306001600160a01b038216036116ce5760405162461bcd60e51b815260206004820152601360248201527231b0b73737ba1039b2b732103a379039b2b63360691b6044820152606401610914565b6040516301ffc9a760e01b815263cde244d960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015611719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173d9190614a7f565b6117975760405162461bcd60e51b815260206004820152602560248201527f68617320746f20696d706c656d656e742049455243393938455243373231546f604482015264382237bbb760d91b6064820152608401610914565b6040516331a9108f60e11b81526001600482018190529033906001600160a01b03841690636352211e90602401602060405180830381865afa1580156117e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118059190614a9c565b6001600160a01b03161461185b5760405162461bcd60e51b815260206004820181905260248201527f68617320746f206f776e20706572736f6e616c2062756e646c6520746f6b656e6044820152606401610914565b6000838152600e6020526040812061187290612ac8565b1115610a91576000838152600e6020526040812061189090826124f8565b90505b6000848152600f602090815260408083206001600160a01b038516845290915281206118be90612ac8565b11156119fe576000848152600f602090815260408083206001600160a01b038516845290915281206118f090826124f8565b90506118fd858383612ddc565b816001600160a01b031663b88d4fde3086848760405160200161192291815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016119509493929190614a42565b600060405180830381600087803b15801561196a57600080fd5b505af192505050801561197b575060015b6119bc5760405162461bcd60e51b815260206004820152601260248201527137b7363c9039b0b332903a3930b739b332b960711b6044820152606401610914565b816001600160a01b0316846001600160a01b031686600080516020614dec833981519152846040516119f091815260200190565b60405180910390a450611893565b5061185b565b600b546001600160a01b031633146110475760405162461bcd60e51b81526004016109149061492d565b60606001805461081c9061481d565b600b546001600160a01b03163314611a675760405162461bcd60e51b81526004016109149061492d565b6001600160a01b038116611acc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610914565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b03831603611b465760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610914565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611bbc82826127e3565b5050565b611bbc8282612e68565b611bd43383612569565b611bf05760405162461bcd60e51b8152600401610914906148dc565b610fe78484848461307e565b600c54600160a01b900460ff1615611c265760405162461bcd60e51b815260040161091490614857565b6002600a5403611c485760405162461bcd60e51b815260040161091490614881565b6002600a556001600160a01b0384163314611ca55760405162461bcd60e51b815260206004820152601a60248201527f5f66726f6d2073686f756c64206265206d73672e73656e6465720000000000006044820152606401610914565b611cb1848484846130b1565b6040516323b872dd60e01b81526001600160a01b038316906323b872dd90611ce1908790309086906004016148b8565b600060405180830381600087803b158015611cfb57600080fd5b505af1158015611d0f573d6000803e3d6000fd5b50506001600a55505050505050565b6002600a5403611d405760405162461bcd60e51b815260040161091490614881565b6002600a55611d518484848461254a565b611d5c838383613109565b816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051610c6291815260200190565b611d9a83836127e3565b610a918382612e68565b6000818152600260205260409020546060906001600160a01b0316611e235760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610914565b6000611e2d6131ca565b90506000815111611e4d5760405180602001604052806000815250610aae565b80611e578461232f565b604051602001611e68929190614ab9565b6040516020818303038152906040529392505050565b611e8781612ce8565b611e9082612d3e565b6000828152600e60205260408120611ea790612ac8565b1115611bbc576000828152600e60205260408120611ec590826124f8565b90505b6000838152600f602090815260408083206001600160a01b03851684529091528120611ef390612ac8565b1115611fde576000838152600f602090815260408083206001600160a01b03851684529091528120611f2590826124f8565b9050611f32848383612ddc565b604051632142170760e11b81526001600160a01b038316906342842e0e90611f62903090879086906004016148b8565b600060405180830381600087803b158015611f7c57600080fd5b505af1925050508015611f8d575060015b611f9c57611f9c838383613109565b816001600160a01b0316836001600160a01b031685600080516020614dec83398151915284604051611fd091815260200190565b60405180910390a450611ec8565b50611e90565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6001600160a01b03821660009081526010602090815260408083208484529091528120548082036120855760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f742065786973740000000000006044820152606401610914565b600061209082611059565b63cd740db560e01b17959194509092505050565b6000806001600160a01b038416156120c9576120c084846131d9565b935090506120d5565b6120d283611059565b90505b6001600160a01b0381163b15612174576040516376c0e6ed60e11b8152306004820152602481018490526001600160a01b0382169063ed81cdda90604401602060405180830381865afa92505050801561214c575060408051601f3d908101601f19168201909252612149918101906149a7565b60015b156121745763328bf24b60e01b6001600160e01b03198216016121725791506108079050565b505b63cd740db560e01b179392505050565b600b546001600160a01b031633146121ae5760405162461bcd60e51b81526004016109149061492d565b6001600160a01b03831660009081526010602090815260408083208584529091529020548390156122165760405162461bcd60e51b8152602060048201526012602482015271746f6b656e20697320696e2062756e646c6560701b6044820152606401610914565b6040516331a9108f60e11b81526004810184905230906001600160a01b03831690636352211e90602401602060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122819190614a9c565b6001600160a01b0316146122c75760405162461bcd60e51b815260206004820152600d60248201526c1b999d081b9bdd081bdddb9959609a1b6044820152606401610914565b604051632142170760e11b81526001600160a01b038216906342842e0e906122f7903090869088906004016148b8565b600060405180830381600087803b15801561231157600080fd5b505af1158015612325573d6000803e3d6000fd5b5050505050505050565b6060816000036123565750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612380578061236a81614978565b91506123799050600a83614afe565b915061235a565b6000816001600160401b0381111561239a5761239a613f9d565b6040519080825280601f01601f1916602001820160405280156123c4576020820181803683370190505b5090505b8415610b91576123d9600183614b12565b91506123e6600a86614b25565b6123f1906030614b39565b60f81b81838151811061240657612406614991565b60200101906001600160f81b031916908160001a905350612428600a86614afe565b94506123c8565b60006001600160e01b0319821663cde244d960e01b148061246057506001600160e01b031982166328d12bf960e21b145b8061247b5750630f7ef9b560e11b6001600160e01b03198316145b8061080757506108078261325f565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124bf82611059565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610aae8383613284565b7f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e965206001600160a01b0316846001600160a01b03160315610fe757610fe7848484846132ae565b61255383612ce8565b61255e848383613347565b610fe7848383612ddc565b6000818152600260205260408120546001600160a01b03166125e25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610914565b60006125ed83611059565b9050806001600160a01b0316846001600160a01b031614806126285750836001600160a01b031661261d8461089f565b6001600160a01b0316145b80610b915750610b918185611fe4565b826001600160a01b031661264b82611059565b6001600160a01b0316146126b35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610914565b6001600160a01b0382166127155760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610914565b61272083838361344f565b61272b60008261248a565b6001600160a01b0383166000908152600360205260408120805460019290612754908490614b12565b90915550506001600160a01b0382166000908152600360205260408120805460019290612782908490614b39565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008151116128265760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b6044820152606401610914565b805160005b818114612a8a5761285883828151811061284757612847614991565b6020026020010151600001516110d0565b61289b5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b6044820152606401610914565b8281815181106128ad576128ad614991565b602002602001015160400151156129db5760008382815181106128d2576128d2614991565b60200260200101516020015151905060005b8181146129d4578483815181106128fd576128fd614991565b6020026020010151600001516001600160a01b031663b88d4fde333088878151811061292b5761292b614991565b602002602001015160200151858151811061294857612948614991565b60200260200101518a60405160200161296391815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016129919493929190614a42565b600060405180830381600087803b1580156129ab57600080fd5b505af11580156129bf573d6000803e3d6000fd5b50505050806129cd90614978565b90506128e4565b5050612a7a565b60008382815181106129ef576129ef614991565b60200260200101516020015151905060005b818114612a7757612a673387878681518110612a1f57612a1f614991565b602002602001015160000151888781518110612a3d57612a3d614991565b6020026020010151602001518581518110612a5a57612a5a614991565b6020026020010151611bfc565b612a7081614978565b9050612a01565b50505b612a8381614978565b905061282b565b50827faeecfeb34aeb11fe7449e04fbc8fc80d3ddd8eeb67b35e6c1b8e1b7e3d8f025783604051612abb9190614b4c565b60405180910390a2505050565b6000610807825490565b600c54600160a01b900460ff16612b225760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610914565b600c805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611bbc8282604051806020016040528060008152506134b2565b6000815111612ba75760405180602001604052806000815250612bd2565b80612bb14661232f565b604051602001612bc2929190614c02565b6040516020818303038152906040525b601190611bbc9082614c8b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a919084906134e5565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c54600160a01b900460ff1615612cad5760405162461bcd60e51b815260040161091490614857565b600c805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612b523390565b6001600160a01b038116610ef55760405162461bcd60e51b815260206004820152601e60248201527f6368696c64207472616e7366657220746f207a65726f206164647265737300006044820152606401610914565b6000612d4982610e22565b90506001600160a01b038116331480612d72575033612d678361089f565b6001600160a01b0316145b80612d825750612d828133611fe4565b611bbc5760405162461bcd60e51b815260206004820152602560248201527f7472616e736665724368696c64206d73672e73656e646572206e6f7420656c696044820152646769626c6560d81b6064820152608401610914565b6000838152600f602090815260408083206001600160a01b03861684529091529020612e0890826135b7565b506001600160a01b03821660008181526010602090815260408083208584528252808320839055868352600f825280832093835292905220612e4990612ac8565b600003610a91576000838152600e60205260409020610fe790836135c3565b6000815111612eab5760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b6044820152606401610914565b805160005b81811461304d576000838281518110612ecb57612ecb614991565b60200260200101516000015190506000848381518110612eed57612eed614991565b60200260200101516020015151905060005b818114613039576000868581518110612f1a57612f1a614991565b6020026020010151602001518281518110612f3757612f37614991565b60200260200101519050612f4c888583613347565b612f57888583612ddc565b868581518110612f6957612f69614991565b60200260200101516040015115612fe157604051632142170760e11b81526001600160a01b038516906342842e0e90612faa903090339086906004016148b8565b600060405180830381600087803b158015612fc457600080fd5b505af1158015612fd8573d6000803e3d6000fd5b50505050612fec565b612fec338583613109565b836001600160a01b0316336001600160a01b031689600080516020614dec8339815191528460405161302091815260200190565b60405180910390a45061303281614978565b9050612eff565b5050508061304690614978565b9050612eb0565b50827ff60c055f56c20fcc9ca127b02b3958fad33fb25c41c195093e037d94fcc2700883604051612abb9190614b4c565b613089848484612638565b613095848484846135d8565b610fe75760405162461bcd60e51b815260040161091490614d4a565b6130ba826110d0565b6130fd5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b6044820152606401610914565b610fe7848484846136d9565b60405163095ea7b360e01b8152306004820152602481018290526001600160a01b0383169063095ea7b390604401600060405180830381600087803b15801561315157600080fd5b505af1925050508015613162575060015b506040516323b872dd60e01b81526001600160a01b038316906323b872dd90613193903090879086906004016148b8565b600060405180830381600087803b1580156131ad57600080fd5b505af11580156131c1573d6000803e3d6000fd5b50505050505050565b60606011805461081c9061481d565b6001600160a01b038216600090815260106020908152604080832084845290915281205480820361324c5760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f742065786973740000000000006044820152606401610914565b61325581611059565b91505b9250929050565b60006001600160e01b0319821663780e9d6360e01b1480610807575061080782613820565b600082600001828154811061329b5761329b614991565b9060005260206000200154905092915050565b60008151116133255760405162461bcd60e51b815260206004820152603860248201527f64617461206d75737420636f6e7461696e20746f6b656e496420746f2074726160448201527f6e7366657220746865206368696c6420746f6b656e20746f00000000000000006064820152608401610914565b6000613332826020015190565b9050613340858286866130b1565b5050505050565b6001600160a01b0382166000908152601060209081526040808320848452909152812054908190036133d95760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665724368696c64205f6368696c64436f6e7472616374205f636044820152741a1a5b19151bdad95b9259081b9bdd08199bdd5b99605a1b6064820152608401610914565b8381146134465760405162461bcd60e51b815260206004820152603560248201527f436f6d706f7361626c65546f70446f776e3a205f7472616e736665724368696c60448201527419081ddc9bdb99c81d1bdad95b925908199bdd5b99605a1b6064820152608401610914565b610fe781612d3e565b306001600160a01b038316036134a75760405162461bcd60e51b815260206004820152601a60248201527f6e65737465642062756e646c6573206e6f7420616c6c6f7765640000000000006044820152606401610914565b610a91838383613870565b6134bc8383613928565b6134c960008484846135d8565b610a915760405162461bcd60e51b815260040161091490614d4a565b600061353a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a769092919063ffffffff16565b805190915015610a9157808060200190518101906135589190614a7f565b610a915760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610914565b6000610aae8383613a85565b6000610aae836001600160a01b038416613a85565b60006001600160a01b0384163b156136ce57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061361c903390899088908890600401614a42565b6020604051808303816000875af1925050508015613657575060408051601f3d908101601f1916820190925261365491810190614d9c565b60015b6136b4573d808015613685576040519150601f19603f3d011682016040523d82523d6000602084013e61368a565b606091505b5080516000036136ac5760405162461bcd60e51b815260040161091490614d4a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610b91565b506001949350505050565b6000838152600260205260409020546001600160a01b031661373d5760405162461bcd60e51b815260206004820152601d60248201527f62756e646c6520746f6b656e496420646f6573206e6f742065786973740000006044820152606401610914565b6000838152600f602090815260408083206001600160a01b0386168452909152812061376890612ac8565b90508060000361378c576000848152600e6020526040902061378a9084613b78565b505b6000848152600f602090815260408083206001600160a01b038716845290915290206137b89083613b8d565b506001600160a01b038381166000818152601060209081526040808320878452825291829020889055905185815291928792908916917f0371ddf2288ad1ba92626a7e31c86a9d006e592cfe57d7d946ef08b13457c08b910160405180910390a45050505050565b60006001600160e01b031982166380ac58cd60e01b148061385157506001600160e01b03198216635b5e139f60e01b145b8061080757506301ffc9a760e01b6001600160e01b0319831614610807565b6001600160a01b0383166138cb576138c681600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6138ee565b816001600160a01b0316836001600160a01b0316146138ee576138ee8382613b99565b6001600160a01b03821661390557610a9181613c36565b826001600160a01b0316826001600160a01b031614610a9157610a918282613ce5565b6001600160a01b03821661397e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610914565b6000818152600260205260409020546001600160a01b0316156139e35760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610914565b6139ef6000838361344f565b6001600160a01b0382166000908152600360205260408120805460019290613a18908490614b39565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060610b918484600085613d29565b60008181526001830160205260408120548015613b6e576000613aa9600183614b12565b8554909150600090613abd90600190614b12565b9050818114613b22576000866000018281548110613add57613add614991565b9060005260206000200154905080876000018481548110613b0057613b00614991565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b3357613b33614db9565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610807565b6000915050610807565b6000610aae836001600160a01b038416613e51565b6000610aae8383613e51565b60006001613ba6846111f8565b613bb09190614b12565b600083815260076020526040902054909150808214613c03576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090613c4890600190614b12565b60008381526009602052604081205460088054939450909284908110613c7057613c70614991565b906000526020600020015490508060088381548110613c9157613c91614991565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613cc957613cc9614db9565b6001900381819060005260206000200160009055905550505050565b6000613cf0836111f8565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015613d8a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610914565b843b613dd85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610914565b600080866001600160a01b03168587604051613df49190614dcf565b60006040518083038185875af1925050503d8060008114613e31576040519150601f19603f3d011682016040523d82523d6000602084013e613e36565b606091505b5091509150613e46828286613ea0565b979650505050505050565b6000818152600183016020526040812054613e9857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610807565b506000610807565b60608315613eaf575081610aae565b825115613ebf5782518084602001fd5b8160405162461bcd60e51b81526004016109149190613f5c565b6001600160e01b031981168114610ef557600080fd5b600060208284031215613f0157600080fd5b8135610aae81613ed9565b60005b83811015613f27578181015183820152602001613f0f565b50506000910152565b60008151808452613f48816020860160208601613f0c565b601f01601f19169290920160200192915050565b602081526000610aae6020830184613f30565b600060208284031215613f8157600080fd5b5035919050565b6001600160a01b0381168114610ef557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613fd557613fd5613f9d565b60405290565b604051601f8201601f191681016001600160401b038111828210171561400357614003613f9d565b604052919050565b60006001600160401b0383111561402457614024613f9d565b614037601f8401601f1916602001613fdb565b905082815283838301111561404b57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261407357600080fd5b610aae8383356020850161400b565b60008060008060008060c0878903121561409b57600080fd5b8635955060208701356140ad81613f88565b94506040870135935060608701356140c481613f88565b92506080870135915060a08701356001600160401b038111156140e657600080fd5b6140f289828a01614062565b9150509295509295509295565b6000806040838503121561411257600080fd5b823561411d81613f88565b946020939093013593505050565b6000806040838503121561413e57600080fd5b50508035926020909101359150565b60008083601f84011261415f57600080fd5b5081356001600160401b0381111561417657600080fd5b60208301915083602082850101111561325857600080fd5b6000806000806000608086880312156141a657600080fd5b85356141b181613f88565b945060208601356141c181613f88565b93506040860135925060608601356001600160401b038111156141e357600080fd5b6141ef8882890161414d565b969995985093965092949392505050565b60008060006060848603121561421557600080fd5b83359250602084013561422781613f88565b929592945050506040919091013590565b6000806000806080858703121561424e57600080fd5b84359350602085013561426081613f88565b9250604085013561427081613f88565b9396929550929360600135925050565b60008060006060848603121561429557600080fd5b83356142a081613f88565b9250602084013561422781613f88565b60006001600160401b038211156142c9576142c9613f9d565b5060051b60200190565b8015158114610ef557600080fd5b8035610e02816142d3565b600082601f8301126142fd57600080fd5b8135602061431261430d836142b0565b613fdb565b82815260059290921b8401810191818101908684111561433157600080fd5b8286015b848110156144225780356001600160401b03808211156143555760008081fd5b908801906060828b03601f190181131561436f5760008081fd5b614377613fb3565b8784013561438481613f88565b81526040848101358481111561439a5760008081fd5b85019350603f84018d136143ae5760008081fd5b888401356143be61430d826142b0565b81815260059190911b85018201908a8101908f8311156143de5760008081fd5b958301955b828710156143fc5786358252958b0195908b01906143e3565b848c01525061440e90508584016142e1565b908201528652505050918301918301614335565b509695505050505050565b60006020828403121561443f57600080fd5b81356001600160401b0381111561445557600080fd5b610b91848285016142ec565b6000806040838503121561447457600080fd5b82359150602083013561448681613f88565b809150509250929050565b6000602082840312156144a357600080fd5b8135610aae81613f88565b6000602082840312156144c057600080fd5b81356001600160401b038111156144d657600080fd5b8201601f810184136144e757600080fd5b610b918482356020840161400b565b6000806040838503121561450957600080fd5b823561451481613f88565b9150602083013561448681613f88565b6000806000806000806000806000806101208b8d03121561454457600080fd5b8a3561454f81613f88565b995060208b0135985060408b013561456681613f88565b975060608b01356001600160401b0381111561458157600080fd5b61458d8d828e0161414d565b90985096505060808b01356145a181613f88565b945060a08b0135935060c08b01356145b8816142d3565b925060e08b013591506101008b01356145d081613f88565b809150509295989b9194979a5092959850565b600080600080600060a086880312156145fb57600080fd5b85359450602086013561460d81613f88565b9350604086013561461d81613f88565b92506060860135915060808601356001600160401b0381111561463f57600080fd5b61464b88828901614062565b9150509295509295909350565b6000806040838503121561466b57600080fd5b823561467681613f88565b91506020830135614486816142d3565b6000806040838503121561469957600080fd5b8235915060208301356001600160401b038111156146b657600080fd5b6146c2858286016142ec565b9150509250929050565b600080600080608085870312156146e257600080fd5b84356146ed81613f88565b935060208501356146fd81613f88565b92506040850135915060608501356001600160401b0381111561471f57600080fd5b61472b87828801614062565b91505092959194509250565b6000806000806080858703121561474d57600080fd5b843561475881613f88565b935060208501359250604085013561427081613f88565b60008060006060848603121561478457600080fd5b8335925060208401356001600160401b03808211156147a257600080fd5b6147ae878388016142ec565b935060408601359150808211156147c457600080fd5b506147d1868287016142ec565b9150509250925092565b6000806000606084860312156147f057600080fd5b83356147fb81613f88565b925060208401359150604084013561481281613f88565b809150509250925092565b600181811c9082168061483157607f821691505b60208210810361485157634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001820161498a5761498a614962565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156149b957600080fd5b5051919050565b6001600160a01b038b81168252602082018b9052898116604083015261012060608301819052820188905260009061014090898b838601376000848b0183015290971660808301525060a081019490945291151560c084015260e08301526001600160a01b0316610100820152601f909201601f191690910101949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614a7590830184613f30565b9695505050505050565b600060208284031215614a9157600080fd5b8151610aae816142d3565b600060208284031215614aae57600080fd5b8151610aae81613f88565b60008351614acb818460208801613f0c565b835190830190614adf818360208801613f0c565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614b0d57614b0d614ae8565b500490565b8181038181111561080757610807614962565b600082614b3457614b34614ae8565b500690565b8082018082111561080757610807614962565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b84811015614bf357898403603f19018652825180516001600160a01b031685528881015160608a8701819052815190870181905260808701918b019085905b80821015614bd35782518452928c0192918c019160019190910190614bb3565b505050908801511515948801949094529487019491870191600101614b74565b50919998505050505050505050565b60008351614c14818460208801613f0c565b835190830190614c28818360208801613f0c565b602f60f81b9101908152600101949350505050565b601f821115610a9157600081815260208120601f850160051c81016020861015614c645750805b601f850160051c820191505b81811015614c8357828155600101614c70565b505050505050565b81516001600160401b03811115614ca457614ca4613f9d565b614cb881614cb2845461481d565b84614c3d565b602080601f831160018114614ced5760008415614cd55750858301515b600019600386901b1c1916600185901b178555614c83565b600085815260208120601f198616915b82811015614d1c57888601518255948401946001909101908401614cfd565b5085821015614d3a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614dae57600080fd5b8151610aae81613ed9565b634e487b7160e01b600052603160045260246000fd5b60008251614de1818460208701613f0c565b919091019291505056fe0ef52e516fb5aec15a5d3587e5480481b702b26db93c8430eca78b61990fd3f6a164736f6c6343000811000a

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

000000000000000000000000dca17eedc1aa3dbb14361678566b2da5a1bb4c3100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e9652000000000000000000000000000000000000000000000000000000000000000154e46546669204564697461626c652042756e646c650000000000000000000000000000000000000000000000000000000000000000000000000000000000000545424e4649000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f68747470733a2f2f6d657461646174612e6e667466692e636f6d2f62756e646c65732f76312f6564697461626c652f0000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _admin (address): 0xDcA17eeDc1aa3dbB14361678566b2dA5A1Bb4C31
Arg [1] : _name (string): NFTfi Editable Bundle
Arg [2] : _symbol (string): EBNFI
Arg [3] : _customBaseURI (string): https://metadata.nftfi.com/bundles/v1/editable/
Arg [4] : _permittedNfts (address): 0xaDDE73498902F61BfCB702e94C31c13C534879AC
Arg [5] : _airdropFlashLoan (address): 0xDcb004c4AB4B9c12e6Bb4ed7992BB78218e96520

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000dca17eedc1aa3dbb14361678566b2da5a1bb4c31
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [4] : 000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac
Arg [5] : 000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e96520
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000015
Arg [7] : 4e46546669204564697461626c652042756e646c650000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 45424e4649000000000000000000000000000000000000000000000000000000
Arg [10] : 000000000000000000000000000000000000000000000000000000000000002f
Arg [11] : 68747470733a2f2f6d657461646174612e6e667466692e636f6d2f62756e646c
Arg [12] : 65732f76312f6564697461626c652f0000000000000000000000000000000000


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.