ETH Price: $2,972.82 (-1.57%)
Gas: 2 Gwei

Token

NFTfi Editable Bundle (EBNFI)
 

Overview

Max Total Supply

31 EBNFI

Holders

13

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
4 EBNFI
0x8a32121d737ce9c7b7b6e17cc7f10d7c2d5f8adc
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 29 : 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, Ownable {
    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) Ownable(_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 {
        _validateTransferSender(_tokenId);
        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];

                _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 29 : 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 "./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
{
    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;

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

File 3 of 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 29 : 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 16 of 29 : 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 17 of 29 : 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 18 of 29 : 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 19 of 29 : 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 20 of 29 : 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 21 of 29 : 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 22 of 29 : 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 23 of 29 : 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 24 of 29 : 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 25 of 29 : 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 26 of 29 : 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 27 of 29 : 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 28 of 29 : 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 29 of 29 : 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":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"},{"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":[{"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"}]

60c06040526000600b553480156200001657600080fd5b506040516200525a3803806200525a833981016040819052620000399162000360565b85858560006200004a8382620004b8565b506001620000598282620004b8565b50506001600a55506200006c8162000097565b506001600160a01b03808316608052811660a0526200008b83620000e9565b50505050505062000681565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081511162000109576040518060200160405280600081525062000143565b8062000120466200015660201b620021d01760201c565b6040516020016200013392919062000584565b6040516020818303038152906040525b601190620001529082620004b8565b5050565b6060816000036200017e5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115620001ae57806200019581620005d9565b9150620001a69050600a836200060b565b915062000182565b6000816001600160401b03811115620001cb57620001cb62000293565b6040519080825280601f01601f191660200182016040528015620001f6576020820181803683370190505b5090505b84156200026e576200020e60018362000622565b91506200021d600a866200063e565b6200022a90603062000655565b60f81b8183815181106200024257620002426200066b565b60200101906001600160f81b031916908160001a90535062000266600a866200060b565b9450620001fa565b949350505050565b80516001600160a01b03811681146200028e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002c6578181015183820152602001620002ac565b50506000910152565b600082601f830112620002e157600080fd5b81516001600160401b0380821115620002fe57620002fe62000293565b604051601f8301601f19908116603f0116810190828211818310171562000329576200032962000293565b816040528381528660208588010111156200034357600080fd5b62000356846020830160208901620002a9565b9695505050505050565b60008060008060008060c087890312156200037a57600080fd5b620003858762000276565b60208801519096506001600160401b0380821115620003a357600080fd5b620003b18a838b01620002cf565b96506040890151915080821115620003c857600080fd5b620003d68a838b01620002cf565b95506060890151915080821115620003ed57600080fd5b50620003fc89828a01620002cf565b9350506200040d6080880162000276565b91506200041d60a0880162000276565b90509295509295509295565b600181811c908216806200043e57607f821691505b6020821081036200045f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004b357600081815260208120601f850160051c810160208610156200048e5750805b601f850160051c820191505b81811015620004af578281556001016200049a565b5050505b505050565b81516001600160401b03811115620004d457620004d462000293565b620004ec81620004e5845462000429565b8462000465565b602080601f8311600181146200052457600084156200050b5750858301515b600019600386901b1c1916600185901b178555620004af565b600085815260208120601f198616915b82811015620005555788860151825594840194600190910190840162000534565b5085821015620005745787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835162000598818460208801620002a9565b835190830190620005ae818360208801620002a9565b602f60f81b9101908152600101949350505050565b634e487b7160e01b600052601160045260246000fd5b600060018201620005ee57620005ee620005c3565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826200061d576200061d620005f5565b500490565b81810381811115620006385762000638620005c3565b92915050565b600082620006505762000650620005f5565b500690565b80820180821115620006385762000638620005c3565b634e487b7160e01b600052603260045260246000fd5b60805160a051614b90620006ca600039600081816105b00152818161129101528181611316015281816113a201526123a70152600081816103160152610fef0152614b906000f3fe608060405234801561001057600080fd5b506004361061030c5760003560e01c80636c0360eb1161019d578063a22cb465116100e9578063bff86757116100a2578063e985e9c51161007c578063e985e9c5146106f3578063eadb80b814610706578063ed81cdda1461072e578063fa3e47051461074157600080fd5b8063bff86757146106ba578063c87b56dd146106cd578063df749086146106e057600080fd5b8063a22cb46514610648578063a57a63b21461065b578063a7103afa1461066e578063b88d4fde14610681578063ba6b5f9614610694578063bef44f18146106a757600080fd5b80638da5cb5b1161015657806392fede001161013057806392fede001461061c57806395d89b41146106245780639d6fa6181461062c5780639f181b5e1461063f57600080fd5b80638da5cb5b146105e55780638da7d0b5146105f65780638daf2d611461060957600080fd5b80636c0360eb1461057557806370a082311461057d5780637b371107146105905780637eef089614610598578063804f3fb2146105ab5780638d81f51e146105d257600080fd5b80632f745c591161025c5780634f6ccce7116102155780635d799f87116101ef5780635d799f87146105345780635f992fdd146105475780636352211e1461054f578063676a196a1461056257600080fd5b80634f6ccce7146104d657806355f804b3146104e95780635680a3ad146104fc57600080fd5b80632f745c591461046457806334854fda1461047757806335b21ceb1461048a57806340d097c31461049d57806342842e0e146104b057806343a61a8e146104c357600080fd5b80630d5a621b116102c957806318160ddd116102a357806318160ddd146104285780631d98f3c51461043057806322ab2e6f1461044357806323b872dd1461045157600080fd5b80630d5a621b146103c8578063150b7a02146103db578063160b01a11461040757600080fd5b806301cf69021461031157806301ffc9a71461035557806306fdde0314610378578063081812fc1461038d57806308937f62146103a0578063095ea7b3146103b5575b600080fd5b6103387f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b610368610363366004613c8c565b610754565b604051901515815260200161034c565b61038061079a565b60405161034c9190613cf9565b61033861039b366004613d0c565b61082c565b6103b36103ae366004613e1f565b6108c6565b005b6103b36103c3366004613e9c565b61090e565b6103386103d6366004613ec8565b610a23565b6103ee6103e9366004613f2b565b610a42565b6040516001600160e01b0319909116815260200161034c565b61041a610415366004613f9d565b610ac7565b60405190815260200161034c565b60085461041a565b6103b361043e366004613fd5565b610afb565b61041a63cd740db560e01b81565b6103b361045f36600461401d565b610bd7565b61041a610472366004613e9c565b610c08565b61041a6104853660046141cf565b610c9e565b61041a610498366004614203565b610cb6565b61041a6104ab366004614233565b610ce1565b6103b36104be36600461401d565b610d04565b61041a6104d1366004613d0c565b610d1f565b61041a6104e4366004613d0c565b610d2c565b6103b36104f7366004614250565b610dbf565b61036861050a366004613e9c565b6001600160a01b03919091166000908152600e602090815260408083209383529290522054151590565b6103b3610542366004614298565b610df5565b6103b3610eea565b61033861055d366004613d0c565b610f56565b610368610570366004614233565b610fcd565b610380611067565b61041a61058b366004614233565b6110f5565b6103b361117c565b6103b36105a63660046142c6565b6111eb565b6103387f000000000000000000000000000000000000000000000000000000000000000081565b6103b36105e0366004614385565b611421565b600f546001600160a01b0316610338565b61041a610604366004613d0c565b611522565b6103b3610617366004614203565b611539565b6103b36118cf565b6103806118f9565b6103b361063a366004614233565b611908565b61041a600b5481565b6103b36106563660046143fa565b6119b9565b6103b3610669366004614428565b611a7d565b6103b361067c366004614428565b611a8b565b6103b361068f36600461446e565b611a95565b6103b36106a23660046144d9565b611ac7565b6103b36106b5366004613fd5565b611bbf565b6103b36106c8366004614511565b611c31565b6103806106db366004613d0c565b611c45565b6103b36106ee366004614203565b611d1f565b610368610701366004614298565b611e85565b610719610714366004613e9c565b611eb3565b6040805192835260208301919091520161034c565b61041a61073c366004613e9c565b611f45565b6103b361074f36600461457d565b612025565b60006001600160e01b03198216630a85bd0160e11b148061078557506001600160e01b03198216639fa4074560e01b145b806107945750610794826122d0565b92915050565b6060600080546107a9906145bf565b80601f01602080910402602001604051908101604052809291908181526020018280546107d5906145bf565b80156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166108aa5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152601d60248201527f424f54544f4d5f55505f4348494c445f4e4f545f535550504f5254454400000060448201526064016108a1565b600061091982610f56565b9050806001600160a01b0316836001600160a01b0316036109865760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108a1565b336001600160a01b03821614806109a257506109a28133611e85565b610a145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016108a1565b610a1e838361232b565b505050565b6000828152600c60205260408120610a3b9083612399565b9392505050565b60006002600a5403610a665760405162461bcd60e51b81526004016108a1906145f9565b6002600a81905550610ab085338686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123a592505050565b50630a85bd0160e11b6001600a5595945050505050565b6000838152600d602090815260408083206001600160a01b03861684529091528120610af39083612399565b949350505050565b6002600a5403610b1d5760405162461bcd60e51b81526004016108a1906145f9565b6002600a55610b2e848484846123eb565b604051632142170760e11b81526001600160a01b038316906342842e0e90610b5e90309087908690600401614630565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051610bc491815260200190565b60405180910390a450506001600a555050565b610be1338261240a565b610bfd5760405162461bcd60e51b81526004016108a190614654565b610a1e8383836124d9565b6000610c13836110f5565b8210610c755760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016108a1565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600080610caa33610ce1565b90506107948184612684565b6000828152600d602090815260408083206001600160a01b03851684529091528120610a3b90612969565b600080600b60008154610cf3906146bb565b918290555090506107948382612973565b610a1e83838360405180602001604052806000815250611a95565b6000610794600083611f45565b6000610d3760085490565b8210610d9a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016108a1565b60088281548110610dad57610dad6146d4565b90600052602060002001549050919050565b600f546001600160a01b03163314610de95760405162461bcd60e51b81526004016108a1906146ea565b610df28161298d565b50565b600f546001600160a01b03163314610e1f5760405162461bcd60e51b81526004016108a1906146ea565b6040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8c919061471f565b905060008111610ed05760405162461bcd60e51b815260206004820152600f60248201526e1b9bc81d1bdad95b9cc81bdddb9959608a1b60448201526064016108a1565b610ee46001600160a01b03831684836129e3565b50505050565b6010546001600160a01b03163314610f445760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e6469646174650000000060448201526064016108a1565b601080546001600160a01b0319169055565b6000818152600260205260408120546001600160a01b0316806107945760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016108a1565b604051636651f11d60e01b81526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000091839190831690636651f11d90602401602060405180830381865afa15801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f919061471f565b119392505050565b60118054611074906145bf565b80601f01602080910402602001604051908101604052809291908181526020018280546110a0906145bf565b80156110ed5780601f106110c2576101008083540402835291602001916110ed565b820191906000526020600020905b8154815290600101906020018083116110d057829003601f168201915b505050505081565b60006001600160a01b0382166111605760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016108a1565b506001600160a01b031660009081526003602052604090205490565b6010546001600160a01b031633146111d65760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e6469646174650000000060448201526064016108a1565b601054610f44906001600160a01b0316612a35565b6001600160a01b038a166000908152600e602090815260408083208c84529091528120549061121982610d1f565b90506001600160a01b038116331461127f5760405162461bcd60e51b815260206004820152602360248201527f70756c6c41697264726f70206d73672e73656e646572206e6f7420656c696769604482015262626c6560e81b60648201526084016108a1565b8b6001600160a01b03166342842e0e307f00000000000000000000000000000000000000000000000000000000000000008e6040518463ffffffff1660e01b81526004016112cf93929190614630565b600060405180830381600087803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b5050604051633f77844b60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250637eef0896915061135f908f908f908f908f908f908f908f908f908f908f90600401614738565b600060405180830381600087803b15801561137957600080fd5b505af115801561138d573d6000803e3d6000fd5b505050508b6001600160a01b03166342842e0e7f0000000000000000000000000000000000000000000000000000000000000000308e6040518463ffffffff1660e01b81526004016113e193929190614630565b600060405180830381600087803b1580156113fb57600080fd5b505af115801561140f573d6000803e3d6000fd5b50505050505050505050505050505050565b6002600a54036114435760405162461bcd60e51b81526004016108a1906145f9565b6002600a55611454858585856123eb565b306001600160a01b0385160361147557611470338484846123a5565b611516565b604051635c46a7ef60e11b81526001600160a01b0384169063b88d4fde906114a79030908890879087906004016147ba565b600060405180830381600087803b1580156114c157600080fd5b505af11580156114d5573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b031686600080516020614b648339815191528560405161150d91815260200190565b60405180910390a45b50506001600a55505050565b6000818152600c6020526040812061079490612969565b61154281612a87565b61154b82612add565b306001600160a01b038216036115995760405162461bcd60e51b815260206004820152601360248201527231b0b73737ba1039b2b732103a379039b2b63360691b60448201526064016108a1565b6040516301ffc9a760e01b815263cde244d960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160891906147f7565b6116625760405162461bcd60e51b815260206004820152602560248201527f68617320746f20696d706c656d656e742049455243393938455243373231546f604482015264382237bbb760d91b60648201526084016108a1565b6040516331a9108f60e11b81526001600482018190529033906001600160a01b03841690636352211e90602401602060405180830381865afa1580156116ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d09190614814565b6001600160a01b0316146117265760405162461bcd60e51b815260206004820181905260248201527f68617320746f206f776e20706572736f6e616c2062756e646c6520746f6b656e60448201526064016108a1565b6000838152600c6020526040812061173d90612969565b1115610a1e576000838152600c6020526040812061175b9082612399565b90505b6000848152600d602090815260408083206001600160a01b0385168452909152812061178990612969565b11156118c9576000848152600d602090815260408083206001600160a01b038516845290915281206117bb9082612399565b90506117c8858383612b7b565b816001600160a01b031663b88d4fde308684876040516020016117ed91815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161181b94939291906147ba565b600060405180830381600087803b15801561183557600080fd5b505af1925050508015611846575060015b6118875760405162461bcd60e51b815260206004820152601260248201527137b7363c9039b0b332903a3930b739b332b960711b60448201526064016108a1565b816001600160a01b0316846001600160a01b031686600080516020614b64833981519152846040516118bb91815260200190565b60405180910390a45061175e565b50611726565b600f546001600160a01b03163314610f445760405162461bcd60e51b81526004016108a1906146ea565b6060600180546107a9906145bf565b600f546001600160a01b031633146119325760405162461bcd60e51b81526004016108a1906146ea565b6001600160a01b0381166119975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108a1565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b03831603611a115760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108a1565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611a878282612684565b5050565b611a878282612c07565b611a9f338361240a565b611abb5760405162461bcd60e51b81526004016108a190614654565b610ee484848484612e1b565b6002600a5403611ae95760405162461bcd60e51b81526004016108a1906145f9565b6002600a556001600160a01b0384163314611b465760405162461bcd60e51b815260206004820152601a60248201527f5f66726f6d2073686f756c64206265206d73672e73656e64657200000000000060448201526064016108a1565b611b5284848484612e4e565b6040516323b872dd60e01b81526001600160a01b038316906323b872dd90611b8290879030908690600401614630565b600060405180830381600087803b158015611b9c57600080fd5b505af1158015611bb0573d6000803e3d6000fd5b50506001600a55505050505050565b6002600a5403611be15760405162461bcd60e51b81526004016108a1906145f9565b6002600a55611bf2848484846123eb565b611bfd838383612ea6565b816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051610bc491815260200190565b611c3b8383612684565b610a1e8382612c07565b6000818152600260205260409020546060906001600160a01b0316611cc45760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016108a1565b6000611cce612f67565b90506000815111611cee5760405180602001604052806000815250610a3b565b80611cf8846121d0565b604051602001611d09929190614831565b6040516020818303038152906040529392505050565b611d2881612a87565b611d3182612add565b6000828152600c60205260408120611d4890612969565b1115611a87576000828152600c60205260408120611d669082612399565b90505b6000838152600d602090815260408083206001600160a01b03851684529091528120611d9490612969565b1115611e7f576000838152600d602090815260408083206001600160a01b03851684529091528120611dc69082612399565b9050611dd3848383612b7b565b604051632142170760e11b81526001600160a01b038316906342842e0e90611e0390309087908690600401614630565b600060405180830381600087803b158015611e1d57600080fd5b505af1925050508015611e2e575060015b611e3d57611e3d838383612ea6565b816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051611e7191815260200190565b60405180910390a450611d69565b50611d31565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054808203611f265760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f7420657869737400000000000060448201526064016108a1565b6000611f3182610f56565b63cd740db560e01b17959194509092505050565b6000806001600160a01b03841615611f6a57611f618484612f76565b93509050611f76565b611f7383610f56565b90505b6001600160a01b0381163b15612015576040516376c0e6ed60e11b8152306004820152602481018490526001600160a01b0382169063ed81cdda90604401602060405180830381865afa925050508015611fed575060408051601f3d908101601f19168201909252611fea9181019061471f565b60015b156120155763328bf24b60e01b6001600160e01b03198216016120135791506107949050565b505b63cd740db560e01b179392505050565b600f546001600160a01b0316331461204f5760405162461bcd60e51b81526004016108a1906146ea565b6001600160a01b0383166000908152600e602090815260408083208584529091529020548390156120b75760405162461bcd60e51b8152602060048201526012602482015271746f6b656e20697320696e2062756e646c6560701b60448201526064016108a1565b6040516331a9108f60e11b81526004810184905230906001600160a01b03831690636352211e90602401602060405180830381865afa1580156120fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121229190614814565b6001600160a01b0316146121685760405162461bcd60e51b815260206004820152600d60248201526c1b999d081b9bdd081bdddb9959609a1b60448201526064016108a1565b604051632142170760e11b81526001600160a01b038216906342842e0e9061219890309086908890600401614630565b600060405180830381600087803b1580156121b257600080fd5b505af11580156121c6573d6000803e3d6000fd5b5050505050505050565b6060816000036121f75750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612221578061220b816146bb565b915061221a9050600a83614876565b91506121fb565b6000816001600160401b0381111561223b5761223b613d3a565b6040519080825280601f01601f191660200182016040528015612265576020820181803683370190505b5090505b8415610af35761227a60018361488a565b9150612287600a8661489d565b6122929060306148b1565b60f81b8183815181106122a7576122a76146d4565b60200101906001600160f81b031916908160001a9053506122c9600a86614876565b9450612269565b60006001600160e01b0319821663cde244d960e01b148061230157506001600160e01b031982166328d12bf960e21b145b8061231c5750630f7ef9b560e11b6001600160e01b03198316145b80610794575061079482612ffc565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061236082610f56565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610a3b8383613021565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03160315610ee457610ee48484848461304b565b6123f483612a87565b6123ff8483836130e4565b610ee4848383612b7b565b6000818152600260205260408120546001600160a01b03166124835760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016108a1565b600061248e83610f56565b9050806001600160a01b0316846001600160a01b031614806124c95750836001600160a01b03166124be8461082c565b6001600160a01b0316145b80610af35750610af38185611e85565b826001600160a01b03166124ec82610f56565b6001600160a01b0316146125545760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016108a1565b6001600160a01b0382166125b65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108a1565b6125c18383836131ec565b6125cc60008261232b565b6001600160a01b03831660009081526003602052604081208054600192906125f590849061488a565b90915550506001600160a01b03821660009081526003602052604081208054600192906126239084906148b1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008151116126c75760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b60448201526064016108a1565b805160005b81811461292b576126f98382815181106126e8576126e86146d4565b602002602001015160000151610fcd565b61273c5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b60448201526064016108a1565b82818151811061274e5761274e6146d4565b6020026020010151604001511561287c576000838281518110612773576127736146d4565b60200260200101516020015151905060005b8181146128755784838151811061279e5761279e6146d4565b6020026020010151600001516001600160a01b031663b88d4fde33308887815181106127cc576127cc6146d4565b60200260200101516020015185815181106127e9576127e96146d4565b60200260200101518a60405160200161280491815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161283294939291906147ba565b600060405180830381600087803b15801561284c57600080fd5b505af1158015612860573d6000803e3d6000fd5b505050508061286e906146bb565b9050612785565b505061291b565b6000838281518110612890576128906146d4565b60200260200101516020015151905060005b8181146129185761290833878786815181106128c0576128c06146d4565b6020026020010151600001518887815181106128de576128de6146d4565b60200260200101516020015185815181106128fb576128fb6146d4565b6020026020010151611ac7565b612911816146bb565b90506128a2565b50505b612924816146bb565b90506126cc565b50827faeecfeb34aeb11fe7449e04fbc8fc80d3ddd8eeb67b35e6c1b8e1b7e3d8f02578360405161295c91906148c4565b60405180910390a2505050565b6000610794825490565b611a8782826040518060200160405280600081525061324f565b60008151116129ab57604051806020016040528060008152506129d6565b806129b5466121d0565b6040516020016129c692919061497a565b6040516020818303038152906040525b601190611a879082614a03565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a1e908490613282565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116610df25760405162461bcd60e51b815260206004820152601e60248201527f6368696c64207472616e7366657220746f207a65726f2061646472657373000060448201526064016108a1565b6000612ae882610d1f565b90506001600160a01b038116331480612b11575033612b068361082c565b6001600160a01b0316145b80612b215750612b218133611e85565b611a875760405162461bcd60e51b815260206004820152602560248201527f7472616e736665724368696c64206d73672e73656e646572206e6f7420656c696044820152646769626c6560d81b60648201526084016108a1565b6000838152600d602090815260408083206001600160a01b03861684529091529020612ba79082613354565b506001600160a01b0382166000818152600e602090815260408083208584528252808320839055868352600d825280832093835292905220612be890612969565b600003610a1e576000838152600c60205260409020610ee49083613360565b612c1082612add565b6000815111612c535760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b60448201526064016108a1565b805160005b818114612dea576000838281518110612c7357612c736146d4565b60200260200101516000015190506000848381518110612c9557612c956146d4565b60200260200101516020015151905060005b818114612dd6576000868581518110612cc257612cc26146d4565b6020026020010151602001518281518110612cdf57612cdf6146d4565b60200260200101519050612cf4888583612b7b565b868581518110612d0657612d066146d4565b60200260200101516040015115612d7e57604051632142170760e11b81526001600160a01b038516906342842e0e90612d4790309033908690600401614630565b600060405180830381600087803b158015612d6157600080fd5b505af1158015612d75573d6000803e3d6000fd5b50505050612d89565b612d89338583612ea6565b836001600160a01b0316336001600160a01b031689600080516020614b6483398151915284604051612dbd91815260200190565b60405180910390a450612dcf816146bb565b9050612ca7565b50505080612de3906146bb565b9050612c58565b50827ff60c055f56c20fcc9ca127b02b3958fad33fb25c41c195093e037d94fcc270088360405161295c91906148c4565b612e268484846124d9565b612e3284848484613375565b610ee45760405162461bcd60e51b81526004016108a190614ac2565b612e5782610fcd565b612e9a5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b60448201526064016108a1565b610ee484848484613476565b60405163095ea7b360e01b8152306004820152602481018290526001600160a01b0383169063095ea7b390604401600060405180830381600087803b158015612eee57600080fd5b505af1925050508015612eff575060015b506040516323b872dd60e01b81526001600160a01b038316906323b872dd90612f3090309087908690600401614630565b600060405180830381600087803b158015612f4a57600080fd5b505af1158015612f5e573d6000803e3d6000fd5b50505050505050565b6060601180546107a9906145bf565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054808203612fe95760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f7420657869737400000000000060448201526064016108a1565b612ff281610f56565b91505b9250929050565b60006001600160e01b0319821663780e9d6360e01b14806107945750610794826135bd565b6000826000018281548110613038576130386146d4565b9060005260206000200154905092915050565b60008151116130c25760405162461bcd60e51b815260206004820152603860248201527f64617461206d75737420636f6e7461696e20746f6b656e496420746f2074726160448201527f6e7366657220746865206368696c6420746f6b656e20746f000000000000000060648201526084016108a1565b60006130cf826020015190565b90506130dd85828686612e4e565b5050505050565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054908190036131765760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665724368696c64205f6368696c64436f6e7472616374205f636044820152741a1a5b19151bdad95b9259081b9bdd08199bdd5b99605a1b60648201526084016108a1565b8381146131e35760405162461bcd60e51b815260206004820152603560248201527f436f6d706f7361626c65546f70446f776e3a205f7472616e736665724368696c60448201527419081ddc9bdb99c81d1bdad95b925908199bdd5b99605a1b60648201526084016108a1565b610ee481612add565b306001600160a01b038316036132445760405162461bcd60e51b815260206004820152601a60248201527f6e65737465642062756e646c6573206e6f7420616c6c6f77656400000000000060448201526064016108a1565b610a1e83838361360d565b61325983836136c5565b6132666000848484613375565b610a1e5760405162461bcd60e51b81526004016108a190614ac2565b60006132d7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138139092919063ffffffff16565b805190915015610a1e57808060200190518101906132f591906147f7565b610a1e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108a1565b6000610a3b8383613822565b6000610a3b836001600160a01b038416613822565b60006001600160a01b0384163b1561346b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906133b99033908990889088906004016147ba565b6020604051808303816000875af19250505080156133f4575060408051601f3d908101601f191682019092526133f191810190614b14565b60015b613451573d808015613422576040519150601f19603f3d011682016040523d82523d6000602084013e613427565b606091505b5080516000036134495760405162461bcd60e51b81526004016108a190614ac2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610af3565b506001949350505050565b6000838152600260205260409020546001600160a01b03166134da5760405162461bcd60e51b815260206004820152601d60248201527f62756e646c6520746f6b656e496420646f6573206e6f7420657869737400000060448201526064016108a1565b6000838152600d602090815260408083206001600160a01b0386168452909152812061350590612969565b905080600003613529576000848152600c602052604090206135279084613915565b505b6000848152600d602090815260408083206001600160a01b03871684529091529020613555908361392a565b506001600160a01b038381166000818152600e60209081526040808320878452825291829020889055905185815291928792908916917f0371ddf2288ad1ba92626a7e31c86a9d006e592cfe57d7d946ef08b13457c08b910160405180910390a45050505050565b60006001600160e01b031982166380ac58cd60e01b14806135ee57506001600160e01b03198216635b5e139f60e01b145b8061079457506301ffc9a760e01b6001600160e01b0319831614610794565b6001600160a01b0383166136685761366381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61368b565b816001600160a01b0316836001600160a01b03161461368b5761368b8382613936565b6001600160a01b0382166136a257610a1e816139d3565b826001600160a01b0316826001600160a01b031614610a1e57610a1e8282613a82565b6001600160a01b03821661371b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108a1565b6000818152600260205260409020546001600160a01b0316156137805760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108a1565b61378c600083836131ec565b6001600160a01b03821660009081526003602052604081208054600192906137b59084906148b1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060610af38484600085613ac6565b6000818152600183016020526040812054801561390b57600061384660018361488a565b855490915060009061385a9060019061488a565b90508181146138bf57600086600001828154811061387a5761387a6146d4565b906000526020600020015490508087600001848154811061389d5761389d6146d4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806138d0576138d0614b31565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610794565b6000915050610794565b6000610a3b836001600160a01b038416613bee565b6000610a3b8383613bee565b60006001613943846110f5565b61394d919061488a565b6000838152600760205260409020549091508082146139a0576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906139e59060019061488a565b60008381526009602052604081205460088054939450909284908110613a0d57613a0d6146d4565b906000526020600020015490508060088381548110613a2e57613a2e6146d4565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613a6657613a66614b31565b6001900381819060005260206000200160009055905550505050565b6000613a8d836110f5565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015613b275760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108a1565b843b613b755760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a1565b600080866001600160a01b03168587604051613b919190614b47565b60006040518083038185875af1925050503d8060008114613bce576040519150601f19603f3d011682016040523d82523d6000602084013e613bd3565b606091505b5091509150613be3828286613c3d565b979650505050505050565b6000818152600183016020526040812054613c3557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610794565b506000610794565b60608315613c4c575081610a3b565b825115613c5c5782518084602001fd5b8160405162461bcd60e51b81526004016108a19190613cf9565b6001600160e01b031981168114610df257600080fd5b600060208284031215613c9e57600080fd5b8135610a3b81613c76565b60005b83811015613cc4578181015183820152602001613cac565b50506000910152565b60008151808452613ce5816020860160208601613ca9565b601f01601f19169290920160200192915050565b602081526000610a3b6020830184613ccd565b600060208284031215613d1e57600080fd5b5035919050565b6001600160a01b0381168114610df257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613d7257613d72613d3a565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613da057613da0613d3a565b604052919050565b60006001600160401b03831115613dc157613dc1613d3a565b613dd4601f8401601f1916602001613d78565b9050828152838383011115613de857600080fd5b828260208301376000602084830101529392505050565b600082601f830112613e1057600080fd5b610a3b83833560208501613da8565b60008060008060008060c08789031215613e3857600080fd5b863595506020870135613e4a81613d25565b9450604087013593506060870135613e6181613d25565b92506080870135915060a08701356001600160401b03811115613e8357600080fd5b613e8f89828a01613dff565b9150509295509295509295565b60008060408385031215613eaf57600080fd5b8235613eba81613d25565b946020939093013593505050565b60008060408385031215613edb57600080fd5b50508035926020909101359150565b60008083601f840112613efc57600080fd5b5081356001600160401b03811115613f1357600080fd5b602083019150836020828501011115612ff557600080fd5b600080600080600060808688031215613f4357600080fd5b8535613f4e81613d25565b94506020860135613f5e81613d25565b93506040860135925060608601356001600160401b03811115613f8057600080fd5b613f8c88828901613eea565b969995985093965092949392505050565b600080600060608486031215613fb257600080fd5b833592506020840135613fc481613d25565b929592945050506040919091013590565b60008060008060808587031215613feb57600080fd5b843593506020850135613ffd81613d25565b9250604085013561400d81613d25565b9396929550929360600135925050565b60008060006060848603121561403257600080fd5b833561403d81613d25565b92506020840135613fc481613d25565b60006001600160401b0382111561406657614066613d3a565b5060051b60200190565b8015158114610df257600080fd5b803561408981614070565b919050565b600082601f83011261409f57600080fd5b813560206140b46140af8361404d565b613d78565b82815260059290921b840181019181810190868411156140d357600080fd5b8286015b848110156141c45780356001600160401b03808211156140f75760008081fd5b908801906060828b03601f19018113156141115760008081fd5b614119613d50565b8784013561412681613d25565b81526040848101358481111561413c5760008081fd5b85019350603f84018d136141505760008081fd5b888401356141606140af8261404d565b81815260059190911b85018201908a8101908f8311156141805760008081fd5b958301955b8287101561419e5786358252958b0195908b0190614185565b848c0152506141b0905085840161407e565b9082015286525050509183019183016140d7565b509695505050505050565b6000602082840312156141e157600080fd5b81356001600160401b038111156141f757600080fd5b610af38482850161408e565b6000806040838503121561421657600080fd5b82359150602083013561422881613d25565b809150509250929050565b60006020828403121561424557600080fd5b8135610a3b81613d25565b60006020828403121561426257600080fd5b81356001600160401b0381111561427857600080fd5b8201601f8101841361428957600080fd5b610af384823560208401613da8565b600080604083850312156142ab57600080fd5b82356142b681613d25565b9150602083013561422881613d25565b6000806000806000806000806000806101208b8d0312156142e657600080fd5b8a356142f181613d25565b995060208b0135985060408b013561430881613d25565b975060608b01356001600160401b0381111561432357600080fd5b61432f8d828e01613eea565b90985096505060808b013561434381613d25565b945060a08b0135935060c08b013561435a81614070565b925060e08b013591506101008b013561437281613d25565b809150509295989b9194979a5092959850565b600080600080600060a0868803121561439d57600080fd5b8535945060208601356143af81613d25565b935060408601356143bf81613d25565b92506060860135915060808601356001600160401b038111156143e157600080fd5b6143ed88828901613dff565b9150509295509295909350565b6000806040838503121561440d57600080fd5b823561441881613d25565b9150602083013561422881614070565b6000806040838503121561443b57600080fd5b8235915060208301356001600160401b0381111561445857600080fd5b6144648582860161408e565b9150509250929050565b6000806000806080858703121561448457600080fd5b843561448f81613d25565b9350602085013561449f81613d25565b92506040850135915060608501356001600160401b038111156144c157600080fd5b6144cd87828801613dff565b91505092959194509250565b600080600080608085870312156144ef57600080fd5b84356144fa81613d25565b935060208501359250604085013561400d81613d25565b60008060006060848603121561452657600080fd5b8335925060208401356001600160401b038082111561454457600080fd5b6145508783880161408e565b9350604086013591508082111561456657600080fd5b506145738682870161408e565b9150509250925092565b60008060006060848603121561459257600080fd5b833561459d81613d25565b92506020840135915060408401356145b481613d25565b809150509250925092565b600181811c908216806145d357607f821691505b6020821081036145f357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016146cd576146cd6146a5565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561473157600080fd5b5051919050565b6001600160a01b038b81168252602082018b9052898116604083015261012060608301819052820188905260009061014090898b838601376000848b0183015290971660808301525060a081019490945291151560c084015260e08301526001600160a01b0316610100820152601f909201601f191690910101949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906147ed90830184613ccd565b9695505050505050565b60006020828403121561480957600080fd5b8151610a3b81614070565b60006020828403121561482657600080fd5b8151610a3b81613d25565b60008351614843818460208801613ca9565b835190830190614857818360208801613ca9565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261488557614885614860565b500490565b81810381811115610794576107946146a5565b6000826148ac576148ac614860565b500690565b80820180821115610794576107946146a5565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b8481101561496b57898403603f19018652825180516001600160a01b031685528881015160608a8701819052815190870181905260808701918b019085905b8082101561494b5782518452928c0192918c01916001919091019061492b565b5050509088015115159488019490945294870194918701916001016148ec565b50919998505050505050505050565b6000835161498c818460208801613ca9565b8351908301906149a0818360208801613ca9565b602f60f81b9101908152600101949350505050565b601f821115610a1e57600081815260208120601f850160051c810160208610156149dc5750805b601f850160051c820191505b818110156149fb578281556001016149e8565b505050505050565b81516001600160401b03811115614a1c57614a1c613d3a565b614a3081614a2a84546145bf565b846149b5565b602080601f831160018114614a655760008415614a4d5750858301515b600019600386901b1c1916600185901b1785556149fb565b600085815260208120601f198616915b82811015614a9457888601518255948401946001909101908401614a75565b5085821015614ab25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614b2657600080fd5b8151610a3b81613c76565b634e487b7160e01b600052603160045260246000fd5b60008251614b59818460208701613ca9565b919091019291505056fe0ef52e516fb5aec15a5d3587e5480481b702b26db93c8430eca78b61990fd3f6a164736f6c6343000811000a000000000000000000000000dca17eedc1aa3dbb14361678566b2da5a1bb4c3100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e9652000000000000000000000000000000000000000000000000000000000000000154e46546669204564697461626c652042756e646c650000000000000000000000000000000000000000000000000000000000000000000000000000000000000545424e4649000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f68747470733a2f2f6d657461646174612e6e667466692e636f6d2f62756e646c65732f76312f6564697461626c652f0000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061030c5760003560e01c80636c0360eb1161019d578063a22cb465116100e9578063bff86757116100a2578063e985e9c51161007c578063e985e9c5146106f3578063eadb80b814610706578063ed81cdda1461072e578063fa3e47051461074157600080fd5b8063bff86757146106ba578063c87b56dd146106cd578063df749086146106e057600080fd5b8063a22cb46514610648578063a57a63b21461065b578063a7103afa1461066e578063b88d4fde14610681578063ba6b5f9614610694578063bef44f18146106a757600080fd5b80638da5cb5b1161015657806392fede001161013057806392fede001461061c57806395d89b41146106245780639d6fa6181461062c5780639f181b5e1461063f57600080fd5b80638da5cb5b146105e55780638da7d0b5146105f65780638daf2d611461060957600080fd5b80636c0360eb1461057557806370a082311461057d5780637b371107146105905780637eef089614610598578063804f3fb2146105ab5780638d81f51e146105d257600080fd5b80632f745c591161025c5780634f6ccce7116102155780635d799f87116101ef5780635d799f87146105345780635f992fdd146105475780636352211e1461054f578063676a196a1461056257600080fd5b80634f6ccce7146104d657806355f804b3146104e95780635680a3ad146104fc57600080fd5b80632f745c591461046457806334854fda1461047757806335b21ceb1461048a57806340d097c31461049d57806342842e0e146104b057806343a61a8e146104c357600080fd5b80630d5a621b116102c957806318160ddd116102a357806318160ddd146104285780631d98f3c51461043057806322ab2e6f1461044357806323b872dd1461045157600080fd5b80630d5a621b146103c8578063150b7a02146103db578063160b01a11461040757600080fd5b806301cf69021461031157806301ffc9a71461035557806306fdde0314610378578063081812fc1461038d57806308937f62146103a0578063095ea7b3146103b5575b600080fd5b6103387f000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac81565b6040516001600160a01b0390911681526020015b60405180910390f35b610368610363366004613c8c565b610754565b604051901515815260200161034c565b61038061079a565b60405161034c9190613cf9565b61033861039b366004613d0c565b61082c565b6103b36103ae366004613e1f565b6108c6565b005b6103b36103c3366004613e9c565b61090e565b6103386103d6366004613ec8565b610a23565b6103ee6103e9366004613f2b565b610a42565b6040516001600160e01b0319909116815260200161034c565b61041a610415366004613f9d565b610ac7565b60405190815260200161034c565b60085461041a565b6103b361043e366004613fd5565b610afb565b61041a63cd740db560e01b81565b6103b361045f36600461401d565b610bd7565b61041a610472366004613e9c565b610c08565b61041a6104853660046141cf565b610c9e565b61041a610498366004614203565b610cb6565b61041a6104ab366004614233565b610ce1565b6103b36104be36600461401d565b610d04565b61041a6104d1366004613d0c565b610d1f565b61041a6104e4366004613d0c565b610d2c565b6103b36104f7366004614250565b610dbf565b61036861050a366004613e9c565b6001600160a01b03919091166000908152600e602090815260408083209383529290522054151590565b6103b3610542366004614298565b610df5565b6103b3610eea565b61033861055d366004613d0c565b610f56565b610368610570366004614233565b610fcd565b610380611067565b61041a61058b366004614233565b6110f5565b6103b361117c565b6103b36105a63660046142c6565b6111eb565b6103387f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e9652081565b6103b36105e0366004614385565b611421565b600f546001600160a01b0316610338565b61041a610604366004613d0c565b611522565b6103b3610617366004614203565b611539565b6103b36118cf565b6103806118f9565b6103b361063a366004614233565b611908565b61041a600b5481565b6103b36106563660046143fa565b6119b9565b6103b3610669366004614428565b611a7d565b6103b361067c366004614428565b611a8b565b6103b361068f36600461446e565b611a95565b6103b36106a23660046144d9565b611ac7565b6103b36106b5366004613fd5565b611bbf565b6103b36106c8366004614511565b611c31565b6103806106db366004613d0c565b611c45565b6103b36106ee366004614203565b611d1f565b610368610701366004614298565b611e85565b610719610714366004613e9c565b611eb3565b6040805192835260208301919091520161034c565b61041a61073c366004613e9c565b611f45565b6103b361074f36600461457d565b612025565b60006001600160e01b03198216630a85bd0160e11b148061078557506001600160e01b03198216639fa4074560e01b145b806107945750610794826122d0565b92915050565b6060600080546107a9906145bf565b80601f01602080910402602001604051908101604052809291908181526020018280546107d5906145bf565b80156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166108aa5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152601d60248201527f424f54544f4d5f55505f4348494c445f4e4f545f535550504f5254454400000060448201526064016108a1565b600061091982610f56565b9050806001600160a01b0316836001600160a01b0316036109865760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108a1565b336001600160a01b03821614806109a257506109a28133611e85565b610a145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016108a1565b610a1e838361232b565b505050565b6000828152600c60205260408120610a3b9083612399565b9392505050565b60006002600a5403610a665760405162461bcd60e51b81526004016108a1906145f9565b6002600a81905550610ab085338686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123a592505050565b50630a85bd0160e11b6001600a5595945050505050565b6000838152600d602090815260408083206001600160a01b03861684529091528120610af39083612399565b949350505050565b6002600a5403610b1d5760405162461bcd60e51b81526004016108a1906145f9565b6002600a55610b2e848484846123eb565b604051632142170760e11b81526001600160a01b038316906342842e0e90610b5e90309087908690600401614630565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051610bc491815260200190565b60405180910390a450506001600a555050565b610be1338261240a565b610bfd5760405162461bcd60e51b81526004016108a190614654565b610a1e8383836124d9565b6000610c13836110f5565b8210610c755760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016108a1565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600080610caa33610ce1565b90506107948184612684565b6000828152600d602090815260408083206001600160a01b03851684529091528120610a3b90612969565b600080600b60008154610cf3906146bb565b918290555090506107948382612973565b610a1e83838360405180602001604052806000815250611a95565b6000610794600083611f45565b6000610d3760085490565b8210610d9a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016108a1565b60088281548110610dad57610dad6146d4565b90600052602060002001549050919050565b600f546001600160a01b03163314610de95760405162461bcd60e51b81526004016108a1906146ea565b610df28161298d565b50565b600f546001600160a01b03163314610e1f5760405162461bcd60e51b81526004016108a1906146ea565b6040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8c919061471f565b905060008111610ed05760405162461bcd60e51b815260206004820152600f60248201526e1b9bc81d1bdad95b9cc81bdddb9959608a1b60448201526064016108a1565b610ee46001600160a01b03831684836129e3565b50505050565b6010546001600160a01b03163314610f445760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e6469646174650000000060448201526064016108a1565b601080546001600160a01b0319169055565b6000818152600260205260408120546001600160a01b0316806107945760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016108a1565b604051636651f11d60e01b81526001600160a01b0382811660048301526000917f000000000000000000000000adde73498902f61bfcb702e94c31c13c534879ac91839190831690636651f11d90602401602060405180830381865afa15801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f919061471f565b119392505050565b60118054611074906145bf565b80601f01602080910402602001604051908101604052809291908181526020018280546110a0906145bf565b80156110ed5780601f106110c2576101008083540402835291602001916110ed565b820191906000526020600020905b8154815290600101906020018083116110d057829003601f168201915b505050505081565b60006001600160a01b0382166111605760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016108a1565b506001600160a01b031660009081526003602052604090205490565b6010546001600160a01b031633146111d65760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a206e6f74206f776e65722063616e6469646174650000000060448201526064016108a1565b601054610f44906001600160a01b0316612a35565b6001600160a01b038a166000908152600e602090815260408083208c84529091528120549061121982610d1f565b90506001600160a01b038116331461127f5760405162461bcd60e51b815260206004820152602360248201527f70756c6c41697264726f70206d73672e73656e646572206e6f7420656c696769604482015262626c6560e81b60648201526084016108a1565b8b6001600160a01b03166342842e0e307f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e965208e6040518463ffffffff1660e01b81526004016112cf93929190614630565b600060405180830381600087803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b5050604051633f77844b60e11b81526001600160a01b037f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e96520169250637eef0896915061135f908f908f908f908f908f908f908f908f908f908f90600401614738565b600060405180830381600087803b15801561137957600080fd5b505af115801561138d573d6000803e3d6000fd5b505050508b6001600160a01b03166342842e0e7f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e96520308e6040518463ffffffff1660e01b81526004016113e193929190614630565b600060405180830381600087803b1580156113fb57600080fd5b505af115801561140f573d6000803e3d6000fd5b50505050505050505050505050505050565b6002600a54036114435760405162461bcd60e51b81526004016108a1906145f9565b6002600a55611454858585856123eb565b306001600160a01b0385160361147557611470338484846123a5565b611516565b604051635c46a7ef60e11b81526001600160a01b0384169063b88d4fde906114a79030908890879087906004016147ba565b600060405180830381600087803b1580156114c157600080fd5b505af11580156114d5573d6000803e3d6000fd5b50505050826001600160a01b0316846001600160a01b031686600080516020614b648339815191528560405161150d91815260200190565b60405180910390a45b50506001600a55505050565b6000818152600c6020526040812061079490612969565b61154281612a87565b61154b82612add565b306001600160a01b038216036115995760405162461bcd60e51b815260206004820152601360248201527231b0b73737ba1039b2b732103a379039b2b63360691b60448201526064016108a1565b6040516301ffc9a760e01b815263cde244d960e01b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160891906147f7565b6116625760405162461bcd60e51b815260206004820152602560248201527f68617320746f20696d706c656d656e742049455243393938455243373231546f604482015264382237bbb760d91b60648201526084016108a1565b6040516331a9108f60e11b81526001600482018190529033906001600160a01b03841690636352211e90602401602060405180830381865afa1580156116ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d09190614814565b6001600160a01b0316146117265760405162461bcd60e51b815260206004820181905260248201527f68617320746f206f776e20706572736f6e616c2062756e646c6520746f6b656e60448201526064016108a1565b6000838152600c6020526040812061173d90612969565b1115610a1e576000838152600c6020526040812061175b9082612399565b90505b6000848152600d602090815260408083206001600160a01b0385168452909152812061178990612969565b11156118c9576000848152600d602090815260408083206001600160a01b038516845290915281206117bb9082612399565b90506117c8858383612b7b565b816001600160a01b031663b88d4fde308684876040516020016117ed91815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161181b94939291906147ba565b600060405180830381600087803b15801561183557600080fd5b505af1925050508015611846575060015b6118875760405162461bcd60e51b815260206004820152601260248201527137b7363c9039b0b332903a3930b739b332b960711b60448201526064016108a1565b816001600160a01b0316846001600160a01b031686600080516020614b64833981519152846040516118bb91815260200190565b60405180910390a45061175e565b50611726565b600f546001600160a01b03163314610f445760405162461bcd60e51b81526004016108a1906146ea565b6060600180546107a9906145bf565b600f546001600160a01b031633146119325760405162461bcd60e51b81526004016108a1906146ea565b6001600160a01b0381166119975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108a1565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b03831603611a115760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108a1565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611a878282612684565b5050565b611a878282612c07565b611a9f338361240a565b611abb5760405162461bcd60e51b81526004016108a190614654565b610ee484848484612e1b565b6002600a5403611ae95760405162461bcd60e51b81526004016108a1906145f9565b6002600a556001600160a01b0384163314611b465760405162461bcd60e51b815260206004820152601a60248201527f5f66726f6d2073686f756c64206265206d73672e73656e64657200000000000060448201526064016108a1565b611b5284848484612e4e565b6040516323b872dd60e01b81526001600160a01b038316906323b872dd90611b8290879030908690600401614630565b600060405180830381600087803b158015611b9c57600080fd5b505af1158015611bb0573d6000803e3d6000fd5b50506001600a55505050505050565b6002600a5403611be15760405162461bcd60e51b81526004016108a1906145f9565b6002600a55611bf2848484846123eb565b611bfd838383612ea6565b816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051610bc491815260200190565b611c3b8383612684565b610a1e8382612c07565b6000818152600260205260409020546060906001600160a01b0316611cc45760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016108a1565b6000611cce612f67565b90506000815111611cee5760405180602001604052806000815250610a3b565b80611cf8846121d0565b604051602001611d09929190614831565b6040516020818303038152906040529392505050565b611d2881612a87565b611d3182612add565b6000828152600c60205260408120611d4890612969565b1115611a87576000828152600c60205260408120611d669082612399565b90505b6000838152600d602090815260408083206001600160a01b03851684529091528120611d9490612969565b1115611e7f576000838152600d602090815260408083206001600160a01b03851684529091528120611dc69082612399565b9050611dd3848383612b7b565b604051632142170760e11b81526001600160a01b038316906342842e0e90611e0390309087908690600401614630565b600060405180830381600087803b158015611e1d57600080fd5b505af1925050508015611e2e575060015b611e3d57611e3d838383612ea6565b816001600160a01b0316836001600160a01b031685600080516020614b6483398151915284604051611e7191815260200190565b60405180910390a450611d69565b50611d31565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054808203611f265760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f7420657869737400000000000060448201526064016108a1565b6000611f3182610f56565b63cd740db560e01b17959194509092505050565b6000806001600160a01b03841615611f6a57611f618484612f76565b93509050611f76565b611f7383610f56565b90505b6001600160a01b0381163b15612015576040516376c0e6ed60e11b8152306004820152602481018490526001600160a01b0382169063ed81cdda90604401602060405180830381865afa925050508015611fed575060408051601f3d908101601f19168201909252611fea9181019061471f565b60015b156120155763328bf24b60e01b6001600160e01b03198216016120135791506107949050565b505b63cd740db560e01b179392505050565b600f546001600160a01b0316331461204f5760405162461bcd60e51b81526004016108a1906146ea565b6001600160a01b0383166000908152600e602090815260408083208584529091529020548390156120b75760405162461bcd60e51b8152602060048201526012602482015271746f6b656e20697320696e2062756e646c6560701b60448201526064016108a1565b6040516331a9108f60e11b81526004810184905230906001600160a01b03831690636352211e90602401602060405180830381865afa1580156120fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121229190614814565b6001600160a01b0316146121685760405162461bcd60e51b815260206004820152600d60248201526c1b999d081b9bdd081bdddb9959609a1b60448201526064016108a1565b604051632142170760e11b81526001600160a01b038216906342842e0e9061219890309086908890600401614630565b600060405180830381600087803b1580156121b257600080fd5b505af11580156121c6573d6000803e3d6000fd5b5050505050505050565b6060816000036121f75750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612221578061220b816146bb565b915061221a9050600a83614876565b91506121fb565b6000816001600160401b0381111561223b5761223b613d3a565b6040519080825280601f01601f191660200182016040528015612265576020820181803683370190505b5090505b8415610af35761227a60018361488a565b9150612287600a8661489d565b6122929060306148b1565b60f81b8183815181106122a7576122a76146d4565b60200101906001600160f81b031916908160001a9053506122c9600a86614876565b9450612269565b60006001600160e01b0319821663cde244d960e01b148061230157506001600160e01b031982166328d12bf960e21b145b8061231c5750630f7ef9b560e11b6001600160e01b03198316145b80610794575061079482612ffc565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061236082610f56565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610a3b8383613021565b7f000000000000000000000000dcb004c4ab4b9c12e6bb4ed7992bb78218e965206001600160a01b0316846001600160a01b03160315610ee457610ee48484848461304b565b6123f483612a87565b6123ff8483836130e4565b610ee4848383612b7b565b6000818152600260205260408120546001600160a01b03166124835760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016108a1565b600061248e83610f56565b9050806001600160a01b0316846001600160a01b031614806124c95750836001600160a01b03166124be8461082c565b6001600160a01b0316145b80610af35750610af38185611e85565b826001600160a01b03166124ec82610f56565b6001600160a01b0316146125545760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016108a1565b6001600160a01b0382166125b65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108a1565b6125c18383836131ec565b6125cc60008261232b565b6001600160a01b03831660009081526003602052604081208054600192906125f590849061488a565b90915550506001600160a01b03821660009081526003602052604081208054600192906126239084906148b1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008151116126c75760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b60448201526064016108a1565b805160005b81811461292b576126f98382815181106126e8576126e86146d4565b602002602001015160000151610fcd565b61273c5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b60448201526064016108a1565b82818151811061274e5761274e6146d4565b6020026020010151604001511561287c576000838281518110612773576127736146d4565b60200260200101516020015151905060005b8181146128755784838151811061279e5761279e6146d4565b6020026020010151600001516001600160a01b031663b88d4fde33308887815181106127cc576127cc6146d4565b60200260200101516020015185815181106127e9576127e96146d4565b60200260200101518a60405160200161280491815260200190565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161283294939291906147ba565b600060405180830381600087803b15801561284c57600080fd5b505af1158015612860573d6000803e3d6000fd5b505050508061286e906146bb565b9050612785565b505061291b565b6000838281518110612890576128906146d4565b60200260200101516020015151905060005b8181146129185761290833878786815181106128c0576128c06146d4565b6020026020010151600001518887815181106128de576128de6146d4565b60200260200101516020015185815181106128fb576128fb6146d4565b6020026020010151611ac7565b612911816146bb565b90506128a2565b50505b612924816146bb565b90506126cc565b50827faeecfeb34aeb11fe7449e04fbc8fc80d3ddd8eeb67b35e6c1b8e1b7e3d8f02578360405161295c91906148c4565b60405180910390a2505050565b6000610794825490565b611a8782826040518060200160405280600081525061324f565b60008151116129ab57604051806020016040528060008152506129d6565b806129b5466121d0565b6040516020016129c692919061497a565b6040516020818303038152906040525b601190611a879082614a03565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a1e908490613282565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116610df25760405162461bcd60e51b815260206004820152601e60248201527f6368696c64207472616e7366657220746f207a65726f2061646472657373000060448201526064016108a1565b6000612ae882610d1f565b90506001600160a01b038116331480612b11575033612b068361082c565b6001600160a01b0316145b80612b215750612b218133611e85565b611a875760405162461bcd60e51b815260206004820152602560248201527f7472616e736665724368696c64206d73672e73656e646572206e6f7420656c696044820152646769626c6560d81b60648201526084016108a1565b6000838152600d602090815260408083206001600160a01b03861684529091529020612ba79082613354565b506001600160a01b0382166000818152600e602090815260408083208584528252808320839055868352600d825280832093835292905220612be890612969565b600003610a1e576000838152600c60205260409020610ee49083613360565b612c1082612add565b6000815111612c535760405162461bcd60e51b815260206004820152600f60248201526e62756e646c6520697320656d70747960881b60448201526064016108a1565b805160005b818114612dea576000838281518110612c7357612c736146d4565b60200260200101516000015190506000848381518110612c9557612c956146d4565b60200260200101516020015151905060005b818114612dd6576000868581518110612cc257612cc26146d4565b6020026020010151602001518281518110612cdf57612cdf6146d4565b60200260200101519050612cf4888583612b7b565b868581518110612d0657612d066146d4565b60200260200101516040015115612d7e57604051632142170760e11b81526001600160a01b038516906342842e0e90612d4790309033908690600401614630565b600060405180830381600087803b158015612d6157600080fd5b505af1158015612d75573d6000803e3d6000fd5b50505050612d89565b612d89338583612ea6565b836001600160a01b0316336001600160a01b031689600080516020614b6483398151915284604051612dbd91815260200190565b60405180910390a450612dcf816146bb565b9050612ca7565b50505080612de3906146bb565b9050612c58565b50827ff60c055f56c20fcc9ca127b02b3958fad33fb25c41c195093e037d94fcc270088360405161295c91906148c4565b612e268484846124d9565b612e3284848484613375565b610ee45760405162461bcd60e51b81526004016108a190614ac2565b612e5782610fcd565b612e9a5760405162461bcd60e51b8152602060048201526014602482015273195c98cdcc8c481b9bdd081c195c9b5a5d1d195960621b60448201526064016108a1565b610ee484848484613476565b60405163095ea7b360e01b8152306004820152602481018290526001600160a01b0383169063095ea7b390604401600060405180830381600087803b158015612eee57600080fd5b505af1925050508015612eff575060015b506040516323b872dd60e01b81526001600160a01b038316906323b872dd90612f3090309087908690600401614630565b600060405180830381600087803b158015612f4a57600080fd5b505af1158015612f5e573d6000803e3d6000fd5b50505050505050565b6060601180546107a9906145bf565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054808203612fe95760405162461bcd60e51b815260206004820152601a60248201527f6368696c6420746f6b656e20646f6573206e6f7420657869737400000000000060448201526064016108a1565b612ff281610f56565b91505b9250929050565b60006001600160e01b0319821663780e9d6360e01b14806107945750610794826135bd565b6000826000018281548110613038576130386146d4565b9060005260206000200154905092915050565b60008151116130c25760405162461bcd60e51b815260206004820152603860248201527f64617461206d75737420636f6e7461696e20746f6b656e496420746f2074726160448201527f6e7366657220746865206368696c6420746f6b656e20746f000000000000000060648201526084016108a1565b60006130cf826020015190565b90506130dd85828686612e4e565b5050505050565b6001600160a01b0382166000908152600e60209081526040808320848452909152812054908190036131765760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665724368696c64205f6368696c64436f6e7472616374205f636044820152741a1a5b19151bdad95b9259081b9bdd08199bdd5b99605a1b60648201526084016108a1565b8381146131e35760405162461bcd60e51b815260206004820152603560248201527f436f6d706f7361626c65546f70446f776e3a205f7472616e736665724368696c60448201527419081ddc9bdb99c81d1bdad95b925908199bdd5b99605a1b60648201526084016108a1565b610ee481612add565b306001600160a01b038316036132445760405162461bcd60e51b815260206004820152601a60248201527f6e65737465642062756e646c6573206e6f7420616c6c6f77656400000000000060448201526064016108a1565b610a1e83838361360d565b61325983836136c5565b6132666000848484613375565b610a1e5760405162461bcd60e51b81526004016108a190614ac2565b60006132d7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138139092919063ffffffff16565b805190915015610a1e57808060200190518101906132f591906147f7565b610a1e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108a1565b6000610a3b8383613822565b6000610a3b836001600160a01b038416613822565b60006001600160a01b0384163b1561346b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906133b99033908990889088906004016147ba565b6020604051808303816000875af19250505080156133f4575060408051601f3d908101601f191682019092526133f191810190614b14565b60015b613451573d808015613422576040519150601f19603f3d011682016040523d82523d6000602084013e613427565b606091505b5080516000036134495760405162461bcd60e51b81526004016108a190614ac2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610af3565b506001949350505050565b6000838152600260205260409020546001600160a01b03166134da5760405162461bcd60e51b815260206004820152601d60248201527f62756e646c6520746f6b656e496420646f6573206e6f7420657869737400000060448201526064016108a1565b6000838152600d602090815260408083206001600160a01b0386168452909152812061350590612969565b905080600003613529576000848152600c602052604090206135279084613915565b505b6000848152600d602090815260408083206001600160a01b03871684529091529020613555908361392a565b506001600160a01b038381166000818152600e60209081526040808320878452825291829020889055905185815291928792908916917f0371ddf2288ad1ba92626a7e31c86a9d006e592cfe57d7d946ef08b13457c08b910160405180910390a45050505050565b60006001600160e01b031982166380ac58cd60e01b14806135ee57506001600160e01b03198216635b5e139f60e01b145b8061079457506301ffc9a760e01b6001600160e01b0319831614610794565b6001600160a01b0383166136685761366381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61368b565b816001600160a01b0316836001600160a01b03161461368b5761368b8382613936565b6001600160a01b0382166136a257610a1e816139d3565b826001600160a01b0316826001600160a01b031614610a1e57610a1e8282613a82565b6001600160a01b03821661371b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108a1565b6000818152600260205260409020546001600160a01b0316156137805760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108a1565b61378c600083836131ec565b6001600160a01b03821660009081526003602052604081208054600192906137b59084906148b1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060610af38484600085613ac6565b6000818152600183016020526040812054801561390b57600061384660018361488a565b855490915060009061385a9060019061488a565b90508181146138bf57600086600001828154811061387a5761387a6146d4565b906000526020600020015490508087600001848154811061389d5761389d6146d4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806138d0576138d0614b31565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610794565b6000915050610794565b6000610a3b836001600160a01b038416613bee565b6000610a3b8383613bee565b60006001613943846110f5565b61394d919061488a565b6000838152600760205260409020549091508082146139a0576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906139e59060019061488a565b60008381526009602052604081205460088054939450909284908110613a0d57613a0d6146d4565b906000526020600020015490508060088381548110613a2e57613a2e6146d4565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613a6657613a66614b31565b6001900381819060005260206000200160009055905550505050565b6000613a8d836110f5565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015613b275760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108a1565b843b613b755760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108a1565b600080866001600160a01b03168587604051613b919190614b47565b60006040518083038185875af1925050503d8060008114613bce576040519150601f19603f3d011682016040523d82523d6000602084013e613bd3565b606091505b5091509150613be3828286613c3d565b979650505050505050565b6000818152600183016020526040812054613c3557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610794565b506000610794565b60608315613c4c575081610a3b565b825115613c5c5782518084602001fd5b8160405162461bcd60e51b81526004016108a19190613cf9565b6001600160e01b031981168114610df257600080fd5b600060208284031215613c9e57600080fd5b8135610a3b81613c76565b60005b83811015613cc4578181015183820152602001613cac565b50506000910152565b60008151808452613ce5816020860160208601613ca9565b601f01601f19169290920160200192915050565b602081526000610a3b6020830184613ccd565b600060208284031215613d1e57600080fd5b5035919050565b6001600160a01b0381168114610df257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613d7257613d72613d3a565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613da057613da0613d3a565b604052919050565b60006001600160401b03831115613dc157613dc1613d3a565b613dd4601f8401601f1916602001613d78565b9050828152838383011115613de857600080fd5b828260208301376000602084830101529392505050565b600082601f830112613e1057600080fd5b610a3b83833560208501613da8565b60008060008060008060c08789031215613e3857600080fd5b863595506020870135613e4a81613d25565b9450604087013593506060870135613e6181613d25565b92506080870135915060a08701356001600160401b03811115613e8357600080fd5b613e8f89828a01613dff565b9150509295509295509295565b60008060408385031215613eaf57600080fd5b8235613eba81613d25565b946020939093013593505050565b60008060408385031215613edb57600080fd5b50508035926020909101359150565b60008083601f840112613efc57600080fd5b5081356001600160401b03811115613f1357600080fd5b602083019150836020828501011115612ff557600080fd5b600080600080600060808688031215613f4357600080fd5b8535613f4e81613d25565b94506020860135613f5e81613d25565b93506040860135925060608601356001600160401b03811115613f8057600080fd5b613f8c88828901613eea565b969995985093965092949392505050565b600080600060608486031215613fb257600080fd5b833592506020840135613fc481613d25565b929592945050506040919091013590565b60008060008060808587031215613feb57600080fd5b843593506020850135613ffd81613d25565b9250604085013561400d81613d25565b9396929550929360600135925050565b60008060006060848603121561403257600080fd5b833561403d81613d25565b92506020840135613fc481613d25565b60006001600160401b0382111561406657614066613d3a565b5060051b60200190565b8015158114610df257600080fd5b803561408981614070565b919050565b600082601f83011261409f57600080fd5b813560206140b46140af8361404d565b613d78565b82815260059290921b840181019181810190868411156140d357600080fd5b8286015b848110156141c45780356001600160401b03808211156140f75760008081fd5b908801906060828b03601f19018113156141115760008081fd5b614119613d50565b8784013561412681613d25565b81526040848101358481111561413c5760008081fd5b85019350603f84018d136141505760008081fd5b888401356141606140af8261404d565b81815260059190911b85018201908a8101908f8311156141805760008081fd5b958301955b8287101561419e5786358252958b0195908b0190614185565b848c0152506141b0905085840161407e565b9082015286525050509183019183016140d7565b509695505050505050565b6000602082840312156141e157600080fd5b81356001600160401b038111156141f757600080fd5b610af38482850161408e565b6000806040838503121561421657600080fd5b82359150602083013561422881613d25565b809150509250929050565b60006020828403121561424557600080fd5b8135610a3b81613d25565b60006020828403121561426257600080fd5b81356001600160401b0381111561427857600080fd5b8201601f8101841361428957600080fd5b610af384823560208401613da8565b600080604083850312156142ab57600080fd5b82356142b681613d25565b9150602083013561422881613d25565b6000806000806000806000806000806101208b8d0312156142e657600080fd5b8a356142f181613d25565b995060208b0135985060408b013561430881613d25565b975060608b01356001600160401b0381111561432357600080fd5b61432f8d828e01613eea565b90985096505060808b013561434381613d25565b945060a08b0135935060c08b013561435a81614070565b925060e08b013591506101008b013561437281613d25565b809150509295989b9194979a5092959850565b600080600080600060a0868803121561439d57600080fd5b8535945060208601356143af81613d25565b935060408601356143bf81613d25565b92506060860135915060808601356001600160401b038111156143e157600080fd5b6143ed88828901613dff565b9150509295509295909350565b6000806040838503121561440d57600080fd5b823561441881613d25565b9150602083013561422881614070565b6000806040838503121561443b57600080fd5b8235915060208301356001600160401b0381111561445857600080fd5b6144648582860161408e565b9150509250929050565b6000806000806080858703121561448457600080fd5b843561448f81613d25565b9350602085013561449f81613d25565b92506040850135915060608501356001600160401b038111156144c157600080fd5b6144cd87828801613dff565b91505092959194509250565b600080600080608085870312156144ef57600080fd5b84356144fa81613d25565b935060208501359250604085013561400d81613d25565b60008060006060848603121561452657600080fd5b8335925060208401356001600160401b038082111561454457600080fd5b6145508783880161408e565b9350604086013591508082111561456657600080fd5b506145738682870161408e565b9150509250925092565b60008060006060848603121561459257600080fd5b833561459d81613d25565b92506020840135915060408401356145b481613d25565b809150509250925092565b600181811c908216806145d357607f821691505b6020821081036145f357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600182016146cd576146cd6146a5565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561473157600080fd5b5051919050565b6001600160a01b038b81168252602082018b9052898116604083015261012060608301819052820188905260009061014090898b838601376000848b0183015290971660808301525060a081019490945291151560c084015260e08301526001600160a01b0316610100820152601f909201601f191690910101949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906147ed90830184613ccd565b9695505050505050565b60006020828403121561480957600080fd5b8151610a3b81614070565b60006020828403121561482657600080fd5b8151610a3b81613d25565b60008351614843818460208801613ca9565b835190830190614857818360208801613ca9565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261488557614885614860565b500490565b81810381811115610794576107946146a5565b6000826148ac576148ac614860565b500690565b80820180821115610794576107946146a5565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b8481101561496b57898403603f19018652825180516001600160a01b031685528881015160608a8701819052815190870181905260808701918b019085905b8082101561494b5782518452928c0192918c01916001919091019061492b565b5050509088015115159488019490945294870194918701916001016148ec565b50919998505050505050505050565b6000835161498c818460208801613ca9565b8351908301906149a0818360208801613ca9565b602f60f81b9101908152600101949350505050565b601f821115610a1e57600081815260208120601f850160051c810160208610156149dc5750805b601f850160051c820191505b818110156149fb578281556001016149e8565b505050505050565b81516001600160401b03811115614a1c57614a1c613d3a565b614a3081614a2a84546145bf565b846149b5565b602080601f831160018114614a655760008415614a4d5750858301515b600019600386901b1c1916600185901b1785556149fb565b600085815260208120601f198616915b82811015614a9457888601518255948401946001909101908401614a75565b5085821015614ab25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614b2657600080fd5b8151610a3b81613c76565b634e487b7160e01b600052603160045260246000fd5b60008251614b59818460208701613ca9565b919091019291505056fe0ef52e516fb5aec15a5d3587e5480481b702b26db93c8430eca78b61990fd3f6a164736f6c6343000811000a

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  ]
[ 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.