Sepolia Testnet

Contract

0x69e8B95d034fdd102dE3006F3EbE3B619945242B
Source Code

Overview

ETH Balance

0 ETH

Multi Chain

Multichain Addresses

0 address found via
Transaction Hash
Method
Block
From
To
Value
0x6080604041368822023-08-22 9:14:0099 days 19 hrs ago1692695640IN
 Create: EnvelopwNFT1155
0 ETH0.0308488212.54439361

Advanced mode:
Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EnvelopwNFT1155

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : EnvelopwNFT1155.sol
// SPDX-License-Identifier: MIT
// ENVELOP protocol for NFT
pragma solidity 0.8.19;

import "ERC1155Supply.sol";
import "IERC1155MetadataURI.sol";
import "Strings.sol";
import "IWrapper.sol";

/// @title WNFT (erc721)  contract in Envelop PrtocolV1 
/// @author Envelop Team
/// @notice You can use this contract with main wrapper contracts
/// @dev Not Use with WrapperLightV1
/// @custom:please see Envelop Docs Portal
contract EnvelopwNFT1155 is ERC1155Supply {
    using Strings for uint256;
    using Strings for uint160;
    
    address public wrapper;       // main protocol contarct

    // Token name
    string public name;

    // Token symbol
    string public symbol;
    
    constructor(
        string memory name_,
        string memory symbol_,
        string memory _baseurl,
        address _wrapper
    ) 
        ERC1155(_baseurl)  
    {

        _setURI(string(
            abi.encodePacked(
                _baseurl,
                block.chainid.toString(),
                "/",
                uint160(address(this)).toHexString(),
                "/"
            )
        ));
        name = name_;
        symbol = symbol_;
        wrapper = _wrapper;
    }

    function mint(address _to, uint256 _tokenId, uint256 _amount) external {
        require(wrapper == msg.sender, "Trusted address only");
        _mint(_to, _tokenId, _amount, "");
    }

    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(address _from, uint256 _tokenId, uint256 _amount) public virtual {
        require(wrapper == msg.sender, "Trusted address only");
        _burn(_from, _tokenId, _amount);
    }

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal  override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
        for (uint256 i = 0; i < ids.length; ++i) {
            ETypes.WNFT memory _wnft = IWrapper(wrapper).getWrappedToken(
                address(this),ids[i]
            );
            if (
                  (from == address(0) || to == address(0)) // mint & burn (wrap & unwrap)
               || (isContract(from))                       // transfer wNFT from any contract  
            )  
            {
                // In case Minting *new* wNFT (during new wrap)
                // In case Burn wNFT (during Unwrap) 
                // In case transfer  wNFT from any contract:
                //    - unwrap of fractal wNFT (matryoshka) 
                //    - some marketplaces and showcases
                //    - any stakings/farmings/vaults etc
                //  
                //                THERE IS NO RULE CHECKs and NO TRANSFER Fees
            } else {
                // Check Core Protocol Rules
                require(
                    !(bytes2(0x0004) == (bytes2(0x0004) & _wnft.rules)),
                    "Trasfer was disabled by author"
                );

                // Check and charge Transfer Fee and pay Royalties
                if (_wnft.fees.length > 0) {
                    IWrapper(wrapper).chargeFees(address(this), ids[i], from, to, 0x00);    
                }
            }
        }
    }
    
    function wnftInfo(uint256 tokenId) external view returns (ETypes.WNFT memory) {
        return IWrapper(wrapper).getWrappedToken(address(this), tokenId);
    }

    function uri(uint256 _tokenID) public view override 
        returns (string memory _uri) 
    {
        _uri = IWrapper(wrapper).getOriginalURI(address(this), _tokenID);
        if (bytes(_uri).length == 0) {
            _uri = string(abi.encodePacked(
                ERC1155.uri(0),
                _tokenID.toString()
                )
            );
        }
            
    }

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


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

File 2 of 16 : ERC1155Supply.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.0;

import "ERC1155.sol";

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        if (from == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] += amounts[i];
            }
        }

        if (to == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 id = ids[i];
                uint256 amount = amounts[i];
                uint256 supply = _totalSupply[id];
                require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
                unchecked {
                    _totalSupply[id] = supply - amount;
                }
            }
        }
    }
}

File 3 of 16 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "IERC1155.sol";
import "IERC1155Receiver.sol";
import "IERC1155MetadataURI.sol";
import "Address.sol";
import "Context.sol";
import "ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `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 memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - 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[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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 _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 4 of 16 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "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 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 5 of 16 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 6 of 16 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "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.
     *
     * NOTE: 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.
     *
     * NOTE: 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 7 of 16 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "IERC165.sol";

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

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

pragma solidity ^0.8.0;

import "Math.sol";

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 13 of 16 : IWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

//import "IERC721Enumerable.sol";
import "LibEnvelopTypes.sol";

interface IWrapper  {

    event WrappedV1(
        address indexed inAssetAddress,
        address indexed outAssetAddress, 
        uint256 indexed inAssetTokenId, 
        uint256 outTokenId,
        address wnftFirstOwner,
        uint256 nativeCollateralAmount,
        bytes2  rules
    );

    event UnWrappedV1(
        address indexed wrappedAddress,
        address indexed originalAddress,
        uint256 indexed wrappedId, 
        uint256 originalTokenId, 
        address beneficiary, 
        uint256 nativeCollateralAmount,
        bytes2  rules 
    );

    event CollateralAdded(
        address indexed wrappedAddress,
        uint256 indexed wrappedId,
        uint8   assetType,
        address collateralAddress,
        uint256 collateralTokenId,
        uint256 collateralBalance
    );

    event PartialUnWrapp(
        address indexed wrappedAddress,
        uint256 indexed wrappedId,
        uint256 lastCollateralIndex
    );
    event SuspiciousFail(
        address indexed wrappedAddress,
        uint256 indexed wrappedId, 
        address indexed failedContractAddress
    );

    event EnvelopFee(
        address indexed receiver,
        address indexed wNFTConatract,
        uint256 indexed wNFTTokenId,
        uint256 amount
    );

    function wrap(
        ETypes.INData calldata _inData, 
        ETypes.AssetItem[] calldata _collateral, 
        address _wrappFor
    ) 
        external 
        payable 
    returns (ETypes.AssetItem memory);

    // function wrapUnsafe(
    //     ETypes.INData calldata _inData, 
    //     ETypes.AssetItem[] calldata _collateral, 
    //     address _wrappFor
    // ) 
    //     external 
    //     payable
    // returns (ETypes.AssetItem memory);

    function addCollateral(
        address _wNFTAddress, 
        uint256 _wNFTTokenId, 
        ETypes.AssetItem[] calldata _collateral
    ) external payable;

    // function addCollateralUnsafe(
    //     address _wNFTAddress, 
    //     uint256 _wNFTTokenId, 
    //     ETypes.AssetItem[] calldata _collateral
    // ) 
    //     external 
    //     payable;

    function unWrap(
        address _wNFTAddress, 
        uint256 _wNFTTokenId
    ) external; 

    function unWrap(
        ETypes.AssetType _wNFTType, 
        address _wNFTAddress, 
        uint256 _wNFTTokenId
    ) external; 

    function unWrap(
        ETypes.AssetType _wNFTType, 
        address _wNFTAddress, 
        uint256 _wNFTTokenId, 
        bool _isEmergency
    ) external;

    function chargeFees(
        address _wNFTAddress, 
        uint256 _wNFTTokenId, 
        address _from, 
        address _to,
        bytes1 _feeType
    ) 
        external  
        returns (bool);   

    ////////////////////////////////////////////////////////////////////// 
    
    function MAX_COLLATERAL_SLOTS() external view returns (uint256);
    function protocolTechToken() external view returns (address);
    function protocolWhiteList() external view returns (address);
    //function trustedOperators(address _operator) external view returns (bool); 
    //function lastWNFTId(ETypes.AssetType _assetType) external view returns (ETypes.NFTItem); 

    function getWrappedToken(address _wNFTAddress, uint256 _wNFTTokenId) 
        external 
        view 
        returns (ETypes.WNFT memory);

    function getOriginalURI(address _wNFTAddress, uint256 _wNFTTokenId) 
        external 
        view 
        returns(string memory); 
    
    function getCollateralBalanceAndIndex(
        address _wNFTAddress, 
        uint256 _wNFTTokenId,
        ETypes.AssetType _collateralType, 
        address _erc,
        uint256 _tokenId
    ) external view returns (uint256, uint256);
   
}

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

pragma solidity ^0.8.0;

import "IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

import "IERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 16 : LibEnvelopTypes.sol
// SPDX-License-Identifier: MIT
// ENVELOP(NIFTSY) protocol V1 for NFT. 
pragma solidity 0.8.19;

/// @title Flibrary ETypes in Envelop PrtocolV1 
/// @author Envelop Team
/// @notice This contract implement main protocol's data types
library ETypes {

    enum AssetType {EMPTY, NATIVE, ERC20, ERC721, ERC1155, FUTURE1, FUTURE2, FUTURE3}
    
    struct Asset {
        AssetType assetType;
        address contractAddress;
    }

    struct AssetItem {
        Asset asset;
        uint256 tokenId;
        uint256 amount;
    }

    struct NFTItem {
        address contractAddress;
        uint256 tokenId;   
    }

    struct Fee {
        bytes1 feeType;
        uint256 param;
        address token; 
    }

    struct Lock {
        bytes1 lockType;
        uint256 param; 
    }

    struct Royalty {
        address beneficiary;
        uint16 percent;
    }

    struct WNFT {
        AssetItem inAsset;
        AssetItem[] collateral;
        address unWrapDestination;
        Fee[] fees;
        Lock[] locks;
        Royalty[] royalties;
        bytes2 rules;

    }

    struct INData {
        AssetItem inAsset;
        address unWrapDestination;
        Fee[] fees;
        Lock[] locks;
        Royalty[] royalties;
        AssetType outType;
        uint256 outBalance;      //0- for 721 and any amount for 1155
        bytes2 rules;

    }

    struct WhiteListItem {
        bool enabledForFee;
        bool enabledForCollateral;
        bool enabledRemoveFromCollateral;
        address transferFeeModel;
    }

    struct Rules {
        bytes2 onlythis;
        bytes2 disabled;
    }

}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "libraries": {
    "EnvelopwNFT1155.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"_baseurl","type":"string"},{"internalType":"address","name":"_wrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"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":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"_uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"wnftInfo","outputs":[{"components":[{"components":[{"components":[{"internalType":"enum ETypes.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ETypes.Asset","name":"asset","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ETypes.AssetItem","name":"inAsset","type":"tuple"},{"components":[{"components":[{"internalType":"enum ETypes.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ETypes.Asset","name":"asset","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ETypes.AssetItem[]","name":"collateral","type":"tuple[]"},{"internalType":"address","name":"unWrapDestination","type":"address"},{"components":[{"internalType":"bytes1","name":"feeType","type":"bytes1"},{"internalType":"uint256","name":"param","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"internalType":"struct ETypes.Fee[]","name":"fees","type":"tuple[]"},{"components":[{"internalType":"bytes1","name":"lockType","type":"bytes1"},{"internalType":"uint256","name":"param","type":"uint256"}],"internalType":"struct ETypes.Lock[]","name":"locks","type":"tuple[]"},{"components":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint16","name":"percent","type":"uint16"}],"internalType":"struct ETypes.Royalty[]","name":"royalties","type":"tuple[]"},{"internalType":"bytes2","name":"rules","type":"bytes2"}],"internalType":"struct ETypes.WNFT","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506040516200303d3803806200303d833981016040819052620000349162000582565b816200004081620000ce565b5062000086826200005146620000e0565b6200005c3062000179565b604051602001620000709392919062000635565b60408051601f19818403018152919052620000ce565b600562000094858262000724565b506006620000a3848262000724565b50600480546001600160a01b0319166001600160a01b03929092169190911790555062000866915050565b6002620000dc828262000724565b5050565b60606000620000ef836200019a565b60010190506000816001600160401b03811115620001115762000111620004b5565b6040519080825280601f01601f1916602001820160405280156200013c576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846200014657509392505050565b606062000194826200018b8162000283565b600101620002f2565b92915050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310620001e4577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef8100000000831062000211576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106200023057662386f26fc10000830492506010015b6305f5e100831062000249576305f5e100830492506008015b61271083106200025e57612710830492506004015b6064831062000271576064830492506002015b600a8310620001945760010192915050565b600080608083901c156200029c5760809290921c916010015b604083901c15620002b25760409290921c916008015b602083901c15620002c85760209290921c916004015b601083901c15620002de5760109290921c916002015b600883901c15620001945760010192915050565b606060006200030383600262000806565b6200031090600262000820565b6001600160401b038111156200032a576200032a620004b5565b6040519080825280601f01601f19166020018201604052801562000355576020820181803683370190505b509050600360fc1b8160008151811062000373576200037362000836565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620003a557620003a562000836565b60200101906001600160f81b031916908160001a9053506000620003cb84600262000806565b620003d890600162000820565b90505b60018111156200045a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811062000410576200041062000836565b1a60f81b82828151811062000429576200042962000836565b60200101906001600160f81b031916908160001a90535060049490941c9362000452816200084c565b9050620003db565b508315620004ae5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640160405180910390fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004e8578181015183820152602001620004ce565b50506000910152565b600082601f8301126200050357600080fd5b81516001600160401b0380821115620005205762000520620004b5565b604051601f8301601f19908116603f011681019082821181831017156200054b576200054b620004b5565b816040528381528660208588010111156200056557600080fd5b62000578846020830160208901620004cb565b9695505050505050565b600080600080608085870312156200059957600080fd5b84516001600160401b0380821115620005b157600080fd5b620005bf88838901620004f1565b95506020870151915080821115620005d657600080fd5b620005e488838901620004f1565b94506040870151915080821115620005fb57600080fd5b506200060a87828801620004f1565b606087015190935090506001600160a01b03811681146200062a57600080fd5b939692955090935050565b6000845162000649818460208901620004cb565b8451908301906200065f818360208901620004cb565b602f60f81b9101818152845190919062000681816001850160208901620004cb565b600192019182015260020195945050505050565b600181811c90821680620006aa57607f821691505b602082108103620006cb57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200071f57600081815260208120601f850160051c81016020861015620006fa5750805b601f850160051c820191505b818110156200071b5782815560010162000706565b5050505b505050565b81516001600160401b03811115620007405762000740620004b5565b620007588162000751845462000695565b84620006d1565b602080601f831160018114620007905760008415620007775750858301515b600019600386901b1c1916600185901b1785556200071b565b600085815260208120601f198616915b82811015620007c157888601518255948401946001909101908401620007a0565b5085821015620007e05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620001945762000194620007f0565b80820180821115620001945762000194620007f0565b634e487b7160e01b600052603260045260246000fd5b6000816200085e576200085e620007f0565b506000190190565b6127c780620008766000396000f3fe608060405234801561001057600080fd5b50600436106100ff5760003560e01c80634f558e7911610097578063bd85b03911610066578063bd85b03914610245578063e985e9c514610265578063f242432a146102a1578063f5298aca146102b457600080fd5b80634f558e79146101dd57806395d89b41146101ff578063a22cb46514610207578063ac210cc71461021a57600080fd5b8063156e29f6116100d3578063156e29f614610175578063212edc321461018a5780632eb2c2d6146101aa5780634e1273f4146101bd57600080fd5b8062fdd58e1461010457806301ffc9a71461012a57806306fdde031461014d5780630e89341c14610162575b600080fd5b61011761011236600461178e565b6102c7565b6040519081526020015b60405180910390f35b61013d6101383660046117d0565b610360565b6040519015158152602001610121565b6101556103a0565b6040516101219190611844565b610155610170366004611857565b61042e565b610188610183366004611870565b6104f1565b005b61019d610198366004611857565b610562565b6040516101219190611a1d565b6101886101b8366004611caf565b61063c565b6101d06101cb366004611d5c565b610688565b6040516101219190611e58565b61013d6101eb366004611857565b600090815260036020526040902054151590565b6101556107b1565b610188610215366004611e79565b6107be565b60045461022d906001600160a01b031681565b6040516001600160a01b039091168152602001610121565b610117610253366004611857565b60009081526003602052604090205490565b61013d610273366004611eb2565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6101886102af366004611ee0565b6107cd565b6101886102c2366004611870565b610812565b60006001600160a01b0383166103375760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061039157506001600160e01b031982166303a24d0760e21b145b8061035a575061035a8261086e565b600580546103ad90611f48565b80601f01602080910402602001604051908101604052809291908181526020018280546103d990611f48565b80156104265780601f106103fb57610100808354040283529160200191610426565b820191906000526020600020905b81548152906001019060200180831161040957829003601f168201915b505050505081565b60048054604051639a7b050960e01b81523092810192909252602482018390526060916001600160a01b0390911690639a7b050990604401600060405180830381865afa158015610483573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104ab9190810190611f82565b905080516000036104ec576104c060006108be565b6104c983610952565b6040516020016104da929190612003565b60405160208183030381529060405290505b919050565b6004546001600160a01b031633146105425760405162461bcd60e51b8152602060048201526014602482015273547275737465642061646472657373206f6e6c7960601b604482015260640161032e565b61055d838383604051806020016040528060008152506109e4565b505050565b604080516101808101825260006101408201818152610160830182905260e083019081526101008301829052610120830182905282526060602083018190529282018190528282018390526080820183905260a082019290925260c08101919091526004805460405163c424d4f760e01b81523092810192909252602482018490526001600160a01b03169063c424d4f790604401600060405180830381865afa158015610614573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261035a9190810190612355565b6001600160a01b03851633148061065857506106588533610273565b6106745760405162461bcd60e51b815260040161032e90612464565b6106818585858585610b07565b5050505050565b606081518351146106ed5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b606482015260840161032e565b600083516001600160401b0381111561070857610708611aea565b604051908082528060200260200182016040528015610731578160200160208202803683370190505b50905060005b84518110156107a95761077c858281518110610755576107556124b2565b602002602001015185838151811061076f5761076f6124b2565b60200260200101516102c7565b82828151811061078e5761078e6124b2565b60209081029190910101526107a2816124de565b9050610737565b509392505050565b600680546103ad90611f48565b6107c9338383610cf2565b5050565b6001600160a01b0385163314806107e957506107e98533610273565b6108055760405162461bcd60e51b815260040161032e90612464565b6106818585858585610dd2565b6004546001600160a01b031633146108635760405162461bcd60e51b8152602060048201526014602482015273547275737465642061646472657373206f6e6c7960601b604482015260640161032e565b61055d838383610f0a565b60006001600160e01b03198216636cdb3d1360e11b148061089f57506001600160e01b031982166303a24d0760e21b145b8061035a57506301ffc9a760e01b6001600160e01b031983161461035a565b6060600280546108cd90611f48565b80601f01602080910402602001604051908101604052809291908181526020018280546108f990611f48565b80156109465780601f1061091b57610100808354040283529160200191610946565b820191906000526020600020905b81548152906001019060200180831161092957829003601f168201915b50505050509050919050565b6060600061095f8361109a565b60010190506000816001600160401b0381111561097e5761097e611aea565b6040519080825280601f01601f1916602001820160405280156109a8576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846109b257509392505050565b6001600160a01b038416610a445760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161032e565b336000610a5085611172565b90506000610a5d85611172565b9050610a6e836000898585896111bd565b6000868152602081815260408083206001600160a01b038b16845290915281208054879290610a9e9084906124f7565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610afe836000898989896113e7565b50505050505050565b8151835114610b695760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161032e565b6001600160a01b038416610b8f5760405162461bcd60e51b815260040161032e9061250a565b33610b9e8187878787876111bd565b60005b8451811015610c84576000858281518110610bbe57610bbe6124b2565b602002602001015190506000858381518110610bdc57610bdc6124b2565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610c2c5760405162461bcd60e51b815260040161032e9061254f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290610c699084906124f7565b9250508190555050505080610c7d906124de565b9050610ba1565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610cd4929190612599565b60405180910390a4610cea818787878787611542565b505050505050565b816001600160a01b0316836001600160a01b031603610d655760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b606482015260840161032e565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416610df85760405162461bcd60e51b815260040161032e9061250a565b336000610e0485611172565b90506000610e1185611172565b9050610e218389898585896111bd565b6000868152602081815260408083206001600160a01b038c16845290915290205485811015610e625760405162461bcd60e51b815260040161032e9061254f565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290610e9f9084906124f7565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610eff848a8a8a8a8a6113e7565b505050505050505050565b6001600160a01b038316610f6c5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b606482015260840161032e565b336000610f7884611172565b90506000610f8584611172565b9050610fa5838760008585604051806020016040528060008152506111bd565b6000858152602081815260408083206001600160a01b038a168452909152902054848110156110225760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b606482015260840161032e565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052610afe565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106110d95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611105576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061112357662386f26fc10000830492506010015b6305f5e100831061113b576305f5e100830492506008015b612710831061114f57612710830492506004015b60648310611161576064830492506002015b600a831061035a5760010192915050565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106111ac576111ac6124b2565b602090810291909101015292915050565b6111cb8686868686866115fd565b60005b8351811015610afe5760045484516000916001600160a01b03169063c424d4f7903090889086908110611203576112036124b2565b60200260200101516040518363ffffffff1660e01b815260040161123c9291906001600160a01b03929092168252602082015260400190565b600060405180830381865afa158015611259573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112819190810190612355565b90506001600160a01b03871615806112a057506001600160a01b038616155b806112ab5750863b15155b6113d65760c0810151600160f21b908116900361130a5760405162461bcd60e51b815260206004820152601e60248201527f54726173666572207761732064697361626c656420627920617574686f720000604482015260640161032e565b606081015151156113d65760045485516001600160a01b0390911690637f6d4c93903090889086908110611340576113406124b2565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b0392831660048201526024810191909152818b16604482015290891660648201526000608482015260a4016020604051808303816000875af11580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d491906125c7565b505b506113e0816124de565b90506111ce565b6001600160a01b0384163b15610cea5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061142b90899089908890889088906004016125e4565b6020604051808303816000875af1925050508015611466575060408051601f3d908101601f1916820190925261146391810190612629565b60015b61151257611472612646565b806308c379a0036114ab5750611486612662565b8061149157506114ad565b8060405162461bcd60e51b815260040161032e9190611844565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606482015260840161032e565b6001600160e01b0319811663f23a6e6160e01b14610afe5760405162461bcd60e51b815260040161032e906126eb565b6001600160a01b0384163b15610cea5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906115869089908990889088908890600401612733565b6020604051808303816000875af19250505080156115c1575060408051601f3d908101601f191682019092526115be91810190612629565b60015b6115cd57611472612646565b6001600160e01b0319811663bc197c8160e01b14610afe5760405162461bcd60e51b815260040161032e906126eb565b6001600160a01b0385166116845760005b835181101561168257828181518110611629576116296124b2565b602002602001015160036000868481518110611647576116476124b2565b60200260200101518152602001908152602001600020600082825461166c91906124f7565b9091555061167b9050816124de565b905061160e565b505b6001600160a01b038416610cea5760005b8351811015610afe5760008482815181106116b2576116b26124b2565b6020026020010151905060008483815181106116d0576116d06124b2565b60200260200101519050600060036000848152602001908152602001600020549050818110156117535760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b606482015260840161032e565b6000928352600360205260409092209103905561176f816124de565b9050611695565b6001600160a01b038116811461178b57600080fd5b50565b600080604083850312156117a157600080fd5b82356117ac81611776565b946020939093013593505050565b6001600160e01b03198116811461178b57600080fd5b6000602082840312156117e257600080fd5b81356117ed816117ba565b9392505050565b60005b8381101561180f5781810151838201526020016117f7565b50506000910152565b600081518084526118308160208601602086016117f4565b601f01601f19169290920160200192915050565b6020815260006117ed6020830184611818565b60006020828403121561186957600080fd5b5035919050565b60008060006060848603121561188557600080fd5b833561189081611776565b95602085013595506040909401359392505050565b80518051600881106118c757634e487b7160e01b600052602160045260246000fd5b83526020908101516001600160a01b0316818401528101516040808401919091520151606090910152565b600081518084526020808501945080840160005b8381101561192c576119198783516118a5565b6080969096019590820190600101611906565b509495945050505050565b600081518084526020808501945080840160005b8381101561192c57815180516001600160f81b031916885283810151848901526040908101516001600160a01b0316908801526060909601959082019060010161194b565b600081518084526020808501945080840160005b8381101561192c57815180516001600160f81b031916885283015183880152604090960195908201906001016119a4565b600081518084526020808501945080840160005b8381101561192c57815180516001600160a01b0316885283015161ffff1683880152604090960195908201906001016119e9565b60208152611a2f6020820183516118a5565b600060208301516101408060a0850152611a4d6101608501836118f2565b91506040850151611a6960c08601826001600160a01b03169052565b506060850151601f19808685030160e0870152611a868483611937565b9350608087015191508086850301610100870152611aa48483611990565b935060a08701519150808685030161012087015250611ac383826119d5565b92505060c0850151611ae0828601826001600160f01b0319169052565b5090949350505050565b634e487b7160e01b600052604160045260246000fd5b606081018181106001600160401b0382111715611b1f57611b1f611aea565b60405250565b604081018181106001600160401b0382111715611b1f57611b1f611aea565b601f8201601f191681016001600160401b0381118282101715611b6957611b69611aea565b6040525050565b60405160e081016001600160401b0381118282101715611b9257611b92611aea565b60405290565b60006001600160401b03821115611bb157611bb1611aea565b5060051b60200190565b600082601f830112611bcc57600080fd5b81356020611bd982611b98565b604051611be68282611b44565b83815260059390931b8501820192828101915086841115611c0657600080fd5b8286015b84811015611c215780358352918301918301611c0a565b509695505050505050565b60006001600160401b03821115611c4557611c45611aea565b50601f01601f191660200190565b600082601f830112611c6457600080fd5b8135611c6f81611c2c565b604051611c7c8282611b44565b828152856020848701011115611c9157600080fd5b82602086016020830137600092810160200192909252509392505050565b600080600080600060a08688031215611cc757600080fd5b8535611cd281611776565b94506020860135611ce281611776565b935060408601356001600160401b0380821115611cfe57600080fd5b611d0a89838a01611bbb565b94506060880135915080821115611d2057600080fd5b611d2c89838a01611bbb565b93506080880135915080821115611d4257600080fd5b50611d4f88828901611c53565b9150509295509295909350565b60008060408385031215611d6f57600080fd5b82356001600160401b0380821115611d8657600080fd5b818501915085601f830112611d9a57600080fd5b81356020611da782611b98565b604051611db48282611b44565b83815260059390931b8501820192828101915089841115611dd457600080fd5b948201945b83861015611dfb578535611dec81611776565b82529482019490820190611dd9565b96505086013592505080821115611e1157600080fd5b50611e1e85828601611bbb565b9150509250929050565b600081518084526020808501945080840160005b8381101561192c57815187529582019590820190600101611e3c565b6020815260006117ed6020830184611e28565b801515811461178b57600080fd5b60008060408385031215611e8c57600080fd5b8235611e9781611776565b91506020830135611ea781611e6b565b809150509250929050565b60008060408385031215611ec557600080fd5b8235611ed081611776565b91506020830135611ea781611776565b600080600080600060a08688031215611ef857600080fd5b8535611f0381611776565b94506020860135611f1381611776565b9350604086013592506060860135915060808601356001600160401b03811115611f3c57600080fd5b611d4f88828901611c53565b600181811c90821680611f5c57607f821691505b602082108103611f7c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611f9457600080fd5b81516001600160401b03811115611faa57600080fd5b8201601f81018413611fbb57600080fd5b8051611fc681611c2c565b604051611fd38282611b44565b828152866020848601011115611fe857600080fd5b611ff98360208301602087016117f4565b9695505050505050565b600083516120158184602088016117f4565b8351908301906120298183602088016117f4565b01949350505050565b80516104ec81611776565b6000818303608081121561205057600080fd5b60405161205c81611b00565b809250604082121561206d57600080fd5b604051915061207b82611b25565b83516008811061208a57600080fd5b8252602084015161209a81611776565b806020840152508181526040840151602082015260608401516040820152505092915050565b600082601f8301126120d157600080fd5b815160206120de82611b98565b6040516120eb8282611b44565b83815260079390931b850182019282810191508684111561210b57600080fd5b8286015b84811015611c2157612121888261203d565b83529183019160800161210f565b80516001600160f81b0319811681146104ec57600080fd5b600082601f83011261215857600080fd5b8151602061216582611b98565b604080516121738382611b44565b8481526060948502870184019484820193508886111561219257600080fd5b8488015b868110156121ea5781818b0312156121ae5760008081fd5b83516121b981611b00565b6121c28261212f565b81528682015187820152848201516121d981611776565b818601528552938501938101612196565b509098975050505050505050565b600082601f83011261220957600080fd5b8151602061221682611b98565b604080516122248382611b44565b84815260069490941b860183019383810192508785111561224457600080fd5b8387015b8581101561228b5782818a0312156122605760008081fd5b825161226b81611b25565b6122748261212f565b815281860151868201528452928401928201612248565b50979650505050505050565b600082601f8301126122a857600080fd5b815160206122b582611b98565b604080516122c38382611b44565b84815260069490941b86018301938381019250878511156122e357600080fd5b8387015b8581101561228b5782818a0312156122ff5760008081fd5b825161230a81611b25565b815161231581611776565b81528186015161ffff8116811461232c5760008081fd5b8187015284529284019282016122e7565b80516001600160f01b0319811681146104ec57600080fd5b60006020828403121561236757600080fd5b81516001600160401b038082111561237e57600080fd5b90830190610140828603121561239357600080fd5b61239b611b70565b6123a5868461203d565b81526080830151828111156123b957600080fd5b6123c5878286016120c0565b6020830152506123d760a08401612032565b604082015260c0830151828111156123ee57600080fd5b6123fa87828601612147565b60608301525060e08301518281111561241257600080fd5b61241e878286016121f8565b6080830152506101008301518281111561243757600080fd5b61244387828601612297565b60a083015250612456610120840161233d565b60c082015295945050505050565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016124f0576124f06124c8565b5060010190565b8082018082111561035a5761035a6124c8565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006125ac6040830185611e28565b82810360208401526125be8185611e28565b95945050505050565b6000602082840312156125d957600080fd5b81516117ed81611e6b565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061261e90830184611818565b979650505050505050565b60006020828403121561263b57600080fd5b81516117ed816117ba565b600060033d111561265f5760046000803e5060005160e01c5b90565b600060443d10156126705790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561269f57505050505090565b82850191508151818111156126b75750505050505090565b843d87010160208285010111156126d15750505050505090565b6126e060208286010187611b44565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b0386811682528516602082015260a06040820181905260009061275f90830186611e28565b82810360608401526127718186611e28565b905082810360808401526127858185611818565b9897505050505050505056fea2646970667358221220ec678a6f01089b2be1272ae27620b37ceade0d55ae0a156b790f3c94187ffc2564736f6c63430008130033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000f544bb8427dc23ec69034c203b2b09860812ddfa000000000000000000000000000000000000000000000000000000000000001c454e56454c4f50203131353520774e465420436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000004774e465400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002068747470733a2f2f6170692e656e76656c6f702e69732f6d657461646174612f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c80634f558e7911610097578063bd85b03911610066578063bd85b03914610245578063e985e9c514610265578063f242432a146102a1578063f5298aca146102b457600080fd5b80634f558e79146101dd57806395d89b41146101ff578063a22cb46514610207578063ac210cc71461021a57600080fd5b8063156e29f6116100d3578063156e29f614610175578063212edc321461018a5780632eb2c2d6146101aa5780634e1273f4146101bd57600080fd5b8062fdd58e1461010457806301ffc9a71461012a57806306fdde031461014d5780630e89341c14610162575b600080fd5b61011761011236600461178e565b6102c7565b6040519081526020015b60405180910390f35b61013d6101383660046117d0565b610360565b6040519015158152602001610121565b6101556103a0565b6040516101219190611844565b610155610170366004611857565b61042e565b610188610183366004611870565b6104f1565b005b61019d610198366004611857565b610562565b6040516101219190611a1d565b6101886101b8366004611caf565b61063c565b6101d06101cb366004611d5c565b610688565b6040516101219190611e58565b61013d6101eb366004611857565b600090815260036020526040902054151590565b6101556107b1565b610188610215366004611e79565b6107be565b60045461022d906001600160a01b031681565b6040516001600160a01b039091168152602001610121565b610117610253366004611857565b60009081526003602052604090205490565b61013d610273366004611eb2565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6101886102af366004611ee0565b6107cd565b6101886102c2366004611870565b610812565b60006001600160a01b0383166103375760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061039157506001600160e01b031982166303a24d0760e21b145b8061035a575061035a8261086e565b600580546103ad90611f48565b80601f01602080910402602001604051908101604052809291908181526020018280546103d990611f48565b80156104265780601f106103fb57610100808354040283529160200191610426565b820191906000526020600020905b81548152906001019060200180831161040957829003601f168201915b505050505081565b60048054604051639a7b050960e01b81523092810192909252602482018390526060916001600160a01b0390911690639a7b050990604401600060405180830381865afa158015610483573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104ab9190810190611f82565b905080516000036104ec576104c060006108be565b6104c983610952565b6040516020016104da929190612003565b60405160208183030381529060405290505b919050565b6004546001600160a01b031633146105425760405162461bcd60e51b8152602060048201526014602482015273547275737465642061646472657373206f6e6c7960601b604482015260640161032e565b61055d838383604051806020016040528060008152506109e4565b505050565b604080516101808101825260006101408201818152610160830182905260e083019081526101008301829052610120830182905282526060602083018190529282018190528282018390526080820183905260a082019290925260c08101919091526004805460405163c424d4f760e01b81523092810192909252602482018490526001600160a01b03169063c424d4f790604401600060405180830381865afa158015610614573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261035a9190810190612355565b6001600160a01b03851633148061065857506106588533610273565b6106745760405162461bcd60e51b815260040161032e90612464565b6106818585858585610b07565b5050505050565b606081518351146106ed5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b606482015260840161032e565b600083516001600160401b0381111561070857610708611aea565b604051908082528060200260200182016040528015610731578160200160208202803683370190505b50905060005b84518110156107a95761077c858281518110610755576107556124b2565b602002602001015185838151811061076f5761076f6124b2565b60200260200101516102c7565b82828151811061078e5761078e6124b2565b60209081029190910101526107a2816124de565b9050610737565b509392505050565b600680546103ad90611f48565b6107c9338383610cf2565b5050565b6001600160a01b0385163314806107e957506107e98533610273565b6108055760405162461bcd60e51b815260040161032e90612464565b6106818585858585610dd2565b6004546001600160a01b031633146108635760405162461bcd60e51b8152602060048201526014602482015273547275737465642061646472657373206f6e6c7960601b604482015260640161032e565b61055d838383610f0a565b60006001600160e01b03198216636cdb3d1360e11b148061089f57506001600160e01b031982166303a24d0760e21b145b8061035a57506301ffc9a760e01b6001600160e01b031983161461035a565b6060600280546108cd90611f48565b80601f01602080910402602001604051908101604052809291908181526020018280546108f990611f48565b80156109465780601f1061091b57610100808354040283529160200191610946565b820191906000526020600020905b81548152906001019060200180831161092957829003601f168201915b50505050509050919050565b6060600061095f8361109a565b60010190506000816001600160401b0381111561097e5761097e611aea565b6040519080825280601f01601f1916602001820160405280156109a8576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846109b257509392505050565b6001600160a01b038416610a445760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161032e565b336000610a5085611172565b90506000610a5d85611172565b9050610a6e836000898585896111bd565b6000868152602081815260408083206001600160a01b038b16845290915281208054879290610a9e9084906124f7565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610afe836000898989896113e7565b50505050505050565b8151835114610b695760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161032e565b6001600160a01b038416610b8f5760405162461bcd60e51b815260040161032e9061250a565b33610b9e8187878787876111bd565b60005b8451811015610c84576000858281518110610bbe57610bbe6124b2565b602002602001015190506000858381518110610bdc57610bdc6124b2565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610c2c5760405162461bcd60e51b815260040161032e9061254f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290610c699084906124f7565b9250508190555050505080610c7d906124de565b9050610ba1565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610cd4929190612599565b60405180910390a4610cea818787878787611542565b505050505050565b816001600160a01b0316836001600160a01b031603610d655760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b606482015260840161032e565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416610df85760405162461bcd60e51b815260040161032e9061250a565b336000610e0485611172565b90506000610e1185611172565b9050610e218389898585896111bd565b6000868152602081815260408083206001600160a01b038c16845290915290205485811015610e625760405162461bcd60e51b815260040161032e9061254f565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290610e9f9084906124f7565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610eff848a8a8a8a8a6113e7565b505050505050505050565b6001600160a01b038316610f6c5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b606482015260840161032e565b336000610f7884611172565b90506000610f8584611172565b9050610fa5838760008585604051806020016040528060008152506111bd565b6000858152602081815260408083206001600160a01b038a168452909152902054848110156110225760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b606482015260840161032e565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052610afe565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106110d95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611105576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061112357662386f26fc10000830492506010015b6305f5e100831061113b576305f5e100830492506008015b612710831061114f57612710830492506004015b60648310611161576064830492506002015b600a831061035a5760010192915050565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106111ac576111ac6124b2565b602090810291909101015292915050565b6111cb8686868686866115fd565b60005b8351811015610afe5760045484516000916001600160a01b03169063c424d4f7903090889086908110611203576112036124b2565b60200260200101516040518363ffffffff1660e01b815260040161123c9291906001600160a01b03929092168252602082015260400190565b600060405180830381865afa158015611259573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112819190810190612355565b90506001600160a01b03871615806112a057506001600160a01b038616155b806112ab5750863b15155b6113d65760c0810151600160f21b908116900361130a5760405162461bcd60e51b815260206004820152601e60248201527f54726173666572207761732064697361626c656420627920617574686f720000604482015260640161032e565b606081015151156113d65760045485516001600160a01b0390911690637f6d4c93903090889086908110611340576113406124b2565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b0392831660048201526024810191909152818b16604482015290891660648201526000608482015260a4016020604051808303816000875af11580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d491906125c7565b505b506113e0816124de565b90506111ce565b6001600160a01b0384163b15610cea5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061142b90899089908890889088906004016125e4565b6020604051808303816000875af1925050508015611466575060408051601f3d908101601f1916820190925261146391810190612629565b60015b61151257611472612646565b806308c379a0036114ab5750611486612662565b8061149157506114ad565b8060405162461bcd60e51b815260040161032e9190611844565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606482015260840161032e565b6001600160e01b0319811663f23a6e6160e01b14610afe5760405162461bcd60e51b815260040161032e906126eb565b6001600160a01b0384163b15610cea5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906115869089908990889088908890600401612733565b6020604051808303816000875af19250505080156115c1575060408051601f3d908101601f191682019092526115be91810190612629565b60015b6115cd57611472612646565b6001600160e01b0319811663bc197c8160e01b14610afe5760405162461bcd60e51b815260040161032e906126eb565b6001600160a01b0385166116845760005b835181101561168257828181518110611629576116296124b2565b602002602001015160036000868481518110611647576116476124b2565b60200260200101518152602001908152602001600020600082825461166c91906124f7565b9091555061167b9050816124de565b905061160e565b505b6001600160a01b038416610cea5760005b8351811015610afe5760008482815181106116b2576116b26124b2565b6020026020010151905060008483815181106116d0576116d06124b2565b60200260200101519050600060036000848152602001908152602001600020549050818110156117535760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b606482015260840161032e565b6000928352600360205260409092209103905561176f816124de565b9050611695565b6001600160a01b038116811461178b57600080fd5b50565b600080604083850312156117a157600080fd5b82356117ac81611776565b946020939093013593505050565b6001600160e01b03198116811461178b57600080fd5b6000602082840312156117e257600080fd5b81356117ed816117ba565b9392505050565b60005b8381101561180f5781810151838201526020016117f7565b50506000910152565b600081518084526118308160208601602086016117f4565b601f01601f19169290920160200192915050565b6020815260006117ed6020830184611818565b60006020828403121561186957600080fd5b5035919050565b60008060006060848603121561188557600080fd5b833561189081611776565b95602085013595506040909401359392505050565b80518051600881106118c757634e487b7160e01b600052602160045260246000fd5b83526020908101516001600160a01b0316818401528101516040808401919091520151606090910152565b600081518084526020808501945080840160005b8381101561192c576119198783516118a5565b6080969096019590820190600101611906565b509495945050505050565b600081518084526020808501945080840160005b8381101561192c57815180516001600160f81b031916885283810151848901526040908101516001600160a01b0316908801526060909601959082019060010161194b565b600081518084526020808501945080840160005b8381101561192c57815180516001600160f81b031916885283015183880152604090960195908201906001016119a4565b600081518084526020808501945080840160005b8381101561192c57815180516001600160a01b0316885283015161ffff1683880152604090960195908201906001016119e9565b60208152611a2f6020820183516118a5565b600060208301516101408060a0850152611a4d6101608501836118f2565b91506040850151611a6960c08601826001600160a01b03169052565b506060850151601f19808685030160e0870152611a868483611937565b9350608087015191508086850301610100870152611aa48483611990565b935060a08701519150808685030161012087015250611ac383826119d5565b92505060c0850151611ae0828601826001600160f01b0319169052565b5090949350505050565b634e487b7160e01b600052604160045260246000fd5b606081018181106001600160401b0382111715611b1f57611b1f611aea565b60405250565b604081018181106001600160401b0382111715611b1f57611b1f611aea565b601f8201601f191681016001600160401b0381118282101715611b6957611b69611aea565b6040525050565b60405160e081016001600160401b0381118282101715611b9257611b92611aea565b60405290565b60006001600160401b03821115611bb157611bb1611aea565b5060051b60200190565b600082601f830112611bcc57600080fd5b81356020611bd982611b98565b604051611be68282611b44565b83815260059390931b8501820192828101915086841115611c0657600080fd5b8286015b84811015611c215780358352918301918301611c0a565b509695505050505050565b60006001600160401b03821115611c4557611c45611aea565b50601f01601f191660200190565b600082601f830112611c6457600080fd5b8135611c6f81611c2c565b604051611c7c8282611b44565b828152856020848701011115611c9157600080fd5b82602086016020830137600092810160200192909252509392505050565b600080600080600060a08688031215611cc757600080fd5b8535611cd281611776565b94506020860135611ce281611776565b935060408601356001600160401b0380821115611cfe57600080fd5b611d0a89838a01611bbb565b94506060880135915080821115611d2057600080fd5b611d2c89838a01611bbb565b93506080880135915080821115611d4257600080fd5b50611d4f88828901611c53565b9150509295509295909350565b60008060408385031215611d6f57600080fd5b82356001600160401b0380821115611d8657600080fd5b818501915085601f830112611d9a57600080fd5b81356020611da782611b98565b604051611db48282611b44565b83815260059390931b8501820192828101915089841115611dd457600080fd5b948201945b83861015611dfb578535611dec81611776565b82529482019490820190611dd9565b96505086013592505080821115611e1157600080fd5b50611e1e85828601611bbb565b9150509250929050565b600081518084526020808501945080840160005b8381101561192c57815187529582019590820190600101611e3c565b6020815260006117ed6020830184611e28565b801515811461178b57600080fd5b60008060408385031215611e8c57600080fd5b8235611e9781611776565b91506020830135611ea781611e6b565b809150509250929050565b60008060408385031215611ec557600080fd5b8235611ed081611776565b91506020830135611ea781611776565b600080600080600060a08688031215611ef857600080fd5b8535611f0381611776565b94506020860135611f1381611776565b9350604086013592506060860135915060808601356001600160401b03811115611f3c57600080fd5b611d4f88828901611c53565b600181811c90821680611f5c57607f821691505b602082108103611f7c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611f9457600080fd5b81516001600160401b03811115611faa57600080fd5b8201601f81018413611fbb57600080fd5b8051611fc681611c2c565b604051611fd38282611b44565b828152866020848601011115611fe857600080fd5b611ff98360208301602087016117f4565b9695505050505050565b600083516120158184602088016117f4565b8351908301906120298183602088016117f4565b01949350505050565b80516104ec81611776565b6000818303608081121561205057600080fd5b60405161205c81611b00565b809250604082121561206d57600080fd5b604051915061207b82611b25565b83516008811061208a57600080fd5b8252602084015161209a81611776565b806020840152508181526040840151602082015260608401516040820152505092915050565b600082601f8301126120d157600080fd5b815160206120de82611b98565b6040516120eb8282611b44565b83815260079390931b850182019282810191508684111561210b57600080fd5b8286015b84811015611c2157612121888261203d565b83529183019160800161210f565b80516001600160f81b0319811681146104ec57600080fd5b600082601f83011261215857600080fd5b8151602061216582611b98565b604080516121738382611b44565b8481526060948502870184019484820193508886111561219257600080fd5b8488015b868110156121ea5781818b0312156121ae5760008081fd5b83516121b981611b00565b6121c28261212f565b81528682015187820152848201516121d981611776565b818601528552938501938101612196565b509098975050505050505050565b600082601f83011261220957600080fd5b8151602061221682611b98565b604080516122248382611b44565b84815260069490941b860183019383810192508785111561224457600080fd5b8387015b8581101561228b5782818a0312156122605760008081fd5b825161226b81611b25565b6122748261212f565b815281860151868201528452928401928201612248565b50979650505050505050565b600082601f8301126122a857600080fd5b815160206122b582611b98565b604080516122c38382611b44565b84815260069490941b86018301938381019250878511156122e357600080fd5b8387015b8581101561228b5782818a0312156122ff5760008081fd5b825161230a81611b25565b815161231581611776565b81528186015161ffff8116811461232c5760008081fd5b8187015284529284019282016122e7565b80516001600160f01b0319811681146104ec57600080fd5b60006020828403121561236757600080fd5b81516001600160401b038082111561237e57600080fd5b90830190610140828603121561239357600080fd5b61239b611b70565b6123a5868461203d565b81526080830151828111156123b957600080fd5b6123c5878286016120c0565b6020830152506123d760a08401612032565b604082015260c0830151828111156123ee57600080fd5b6123fa87828601612147565b60608301525060e08301518281111561241257600080fd5b61241e878286016121f8565b6080830152506101008301518281111561243757600080fd5b61244387828601612297565b60a083015250612456610120840161233d565b60c082015295945050505050565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016124f0576124f06124c8565b5060010190565b8082018082111561035a5761035a6124c8565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006125ac6040830185611e28565b82810360208401526125be8185611e28565b95945050505050565b6000602082840312156125d957600080fd5b81516117ed81611e6b565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061261e90830184611818565b979650505050505050565b60006020828403121561263b57600080fd5b81516117ed816117ba565b600060033d111561265f5760046000803e5060005160e01c5b90565b600060443d10156126705790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561269f57505050505090565b82850191508151818111156126b75750505050505090565b843d87010160208285010111156126d15750505050505090565b6126e060208286010187611b44565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b0386811682528516602082015260a06040820181905260009061275f90830186611e28565b82810360608401526127718186611e28565b905082810360808401526127858185611818565b9897505050505050505056fea2646970667358221220ec678a6f01089b2be1272ae27620b37ceade0d55ae0a156b790f3c94187ffc2564736f6c63430008130033

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

000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000f544bb8427dc23ec69034c203b2b09860812ddfa000000000000000000000000000000000000000000000000000000000000001c454e56454c4f50203131353520774e465420436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000004774e465400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002068747470733a2f2f6170692e656e76656c6f702e69732f6d657461646174612f

-----Decoded View---------------
Arg [0] : name_ (string): ENVELOP 1155 wNFT Collection
Arg [1] : symbol_ (string): wNFT
Arg [2] : _baseurl (string): https://api.envelop.is/metadata/
Arg [3] : _wrapper (address): 0xf544BB8427DC23EC69034C203b2B09860812DDfa

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 000000000000000000000000f544bb8427dc23ec69034c203b2b09860812ddfa
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001c
Arg [5] : 454e56454c4f50203131353520774e465420436f6c6c656374696f6e00000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [7] : 774e465400000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [9] : 68747470733a2f2f6170692e656e76656c6f702e69732f6d657461646174612f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

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