ETH Price: $2,100.31 (-10.43%)

Token

Gallery Chosun Collection ()
 

Overview

Max Total Supply

14

Holders

8

Total Transfers

-

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

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

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

Contract Source Code Verified (Exact Match)

Contract Name:
GalleryChosunCollection

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : Main.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";

import "./AppType.sol";
import "./Batch.sol";
import "./App.sol";

contract GalleryChosunCollection is ERC1155, ERC1155Burnable, ERC1155Supply {
    using App for AppType.State;
    using BatchFactory for AppType.State;

    AppType.State state;

    constructor() ERC1155("https://mint.valores.cc/nft/{id}/minted") {
        state.initialize();
    }

    function setURI(string memory newuri) external {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );
        _setURI(newuri);
    }

    function safeMint(
        AppType.NFT calldata nft,
        uint256 nftAmount,
        bytes memory data,
        bytes32[] calldata proof
    ) external payable {
        uint256 newTokenId = state.authorizeMint(nft, nftAmount, proof);
        _mint(msg.sender, newTokenId, nftAmount, data);
    }

    function createBatch(
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    ) external {
        state.createBatch(isOpenAt, disabled, root);
    }

    function updateBatch(
        uint256 batchId,
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    ) external {
        state.updateBatch(batchId, isOpenAt, disabled, root);
    }

    function setTierSwapAmount(
        uint256 tierId,
        address swapToken,
        uint256 swapAmount
    ) external {
        state.setTierSwapAmount(tierId, swapToken, swapAmount);
    }

    function readBatch(uint256 batchId)
        external
        view
        returns (
            uint256 isOpenAt,
            bool disabled,
            bytes32 root
        )
    {
        return state.readBatch(batchId);
    }

    function changeConfig(
        AppType.IConfigKey calldata key,
        AppType.IConfigValue calldata value
    ) external {
        state.changeConfig(key, value);
    }

    function getConfig(
        AppType.AddressConfig addressConfig,
        AppType.UintConfig uintConfig,
        AppType.BoolConfig boolConfig,
        AppType.StringConfig stringConfig
    )
        external
        view
        returns (
            address addressValue,
            uint256 uintValue,
            bool boolValue,
            string memory stringValue
        )
    {
        return
            state.getConfig(
                addressConfig,
                uintConfig,
                boolConfig,
                stringConfig
            );
    }

    function excludeNFTLeaf(AppType.NFT memory nft, bool isExcluded) external {
        state.excludeNFTLeaf(nft, isExcluded);
    }

    function name() public view returns (string memory) {
        return state.config.strings[AppType.StringConfig.APP_NAME];
    }

    function withdrawAdmin(address token, uint256 amount) external {
        state.safeWithdraw(token, amount);
    }

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155, ERC1155Supply) {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }
}

// Error Codes
// E001: Only Admin can perform this action
// E002: Batch not found
// E003: NFT Batch is not available
// E004: NFT is not found
// E005: NFT is not available
// E006: SwapToken not Allowed
// E007: Insufficient Funds sent to swap
// E008: Cannot set admin address to 0
// E009: Cannot withdraw from non-admin account
// E010: FEE_WALLET is not set
// E011: Minting is Paused

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

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/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: balance query for the zero address");
        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 {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 owner nor 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: transfer caller is not owner nor 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();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);

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

        _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 `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

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

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

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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);

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

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

        emit TransferSingle(operator, account, address(0), id, amount);
    }

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

        address operator = _msgSender();

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

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

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

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @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 `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 _beforeTokenTransfer(
        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 3 of 20 : ERC1155Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}

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

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 weither 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) {
                _totalSupply[ids[i]] -= amounts[i];
            }
        }
    }
}

File 5 of 20 : AppType.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;

library AppType {
    enum Model {
        BATCH
    }

    enum AddressConfig {
        NONE,
        ADMIN,
        FEE_WALLET
    }

    enum UintConfig {
        NONE,
        CHAIN_ID
    }

    enum BoolConfig {
        NONE,
        PAUSED
    }

    enum StringConfig {
        NONE,
        APP_NAME
    }

    struct IConfigKey {
        AddressConfig addressK;
        UintConfig uintK;
        BoolConfig boolK;
        StringConfig stringK;
    }

    struct IConfigValue {
        address addressV;
        uint256 uintV;
        bool boolV;
        string stringV;
    }

    struct Config {
        mapping(AddressConfig => address) addresses;
        mapping(UintConfig => uint256) uints;
        mapping(BoolConfig => bool) bools;
        mapping(StringConfig => string) strings;
    }

    struct NFT {
        uint256 batchId;
        uint96 royaltyPercent;
        uint256 tierId;
        address swapToken;
        string uri;
    }

    struct Batch {
        uint256 id;
        uint256 isOpenAt;
        bool disabled;
        bytes32 root;
    }

    struct State {
        mapping(Model => uint256) id;
        mapping(uint256 => Batch) batches;
        mapping(bytes32 => bool) excludedLeaves;
        mapping(uint256 => mapping(address => uint256)) tierSwapAmounts;
        Config config;
    }
}

File 6 of 20 : Batch.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;

import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./AppType.sol";
import "./Utils.sol";

library BatchFactory {
    using LeafUtils for AppType.NFT;
    using MerkleProof for bytes32[];

    event BatchCreated(
        uint256 batchId,
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    );
    event BatchUpdated(
        uint256 batchId,
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    );
    event ExcludedLeaf(bytes32 leaf, uint256 batchId, bool isExcluded);
    event AuthorizedMint(
        uint256 nftBatchId,
        string nftUri,
        uint256 tierId,
        address swapToken,
        uint256 swapAmount,
        address account,
        uint256 newTokenId
    );

    function createBatch(
        AppType.State storage state,
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    ) public {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );
        uint256 newBatchId = ++state.id[AppType.Model.BATCH];
        state.batches[newBatchId] = AppType.Batch({
            id: newBatchId,
            isOpenAt: isOpenAt,
            disabled: disabled,
            root: root
        });
        emit BatchCreated(newBatchId, isOpenAt, disabled, root);
    }

    function updateBatch(
        AppType.State storage state,
        uint256 batchId,
        uint256 isOpenAt,
        bool disabled,
        bytes32 root
    ) public {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );

        require(state.batches[batchId].id == batchId, "E002");
        AppType.Batch storage batch = state.batches[batchId];
        batch.isOpenAt = isOpenAt;
        batch.disabled = disabled;
        batch.root = root;
        emit BatchUpdated(batchId, isOpenAt, disabled, root);
    }

    function readBatch(AppType.State storage state, uint256 batchId)
        public
        view
        returns (
            uint256 isOpenAt,
            bool disabled,
            bytes32 root
        )
    {
        require(state.batches[batchId].id == batchId, "E002");
        return (
            state.batches[batchId].isOpenAt,
            state.batches[batchId].disabled,
            state.batches[batchId].root
        );
    }

    function excludeNFTLeaf(
        AppType.State storage state,
        AppType.NFT memory nft,
        bool isExcluded
    ) public {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );

        bytes32 leaf = nft.nftLeaf(state);
        state.excludedLeaves[leaf] = isExcluded;
        emit ExcludedLeaf(leaf, nft.batchId, isExcluded);
    }

    function authorizeMint(
        AppType.State storage state,
        AppType.NFT memory nft,
        uint256 nftAmount,
        bytes32[] memory proof
    ) public returns (uint256 newTokenId) {
        require(!state.config.bools[AppType.BoolConfig.PAUSED], "E011");

        {
            AppType.Batch storage nftBatch = state.batches[nft.batchId];

            require(
                nftBatch.id == nft.batchId &&
                    nftBatch.isOpenAt <= block.timestamp &&
                    !nftBatch.disabled,
                "E003"
            );

            bytes32 nftLeaf = nft.nftLeaf(state);
            require(proof.verify(nftBatch.root, nftLeaf), "E004");
            require(state.excludedLeaves[nftLeaf] == false, "E005");
        }

        uint256 swapAmount = state.tierSwapAmounts[nft.tierId][nft.swapToken];

        swapAmount = swapAmount * nftAmount;

        {
            require(swapAmount > 0, "E006");

            if (nft.swapToken == address(0)) {
                require(msg.value >= swapAmount, "E007");
            } else {
                IERC20(nft.swapToken).transferFrom(
                    msg.sender,
                    state.config.addresses[AppType.AddressConfig.FEE_WALLET],
                    swapAmount
                );
            }
        }

        newTokenId = uint256(keccak256(abi.encode(nft.uri)));

        emit AuthorizedMint(
            nft.batchId,
            nft.uri,
            nft.tierId,
            nft.swapToken,
            swapAmount,
            msg.sender,
            newTokenId
        );
    }
}

File 7 of 20 : App.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

import "./AppType.sol";

library App {
    using SafeERC20Upgradeable for IERC20Upgradeable;
    event AppInitialized(uint256 chainId, string appName);
    event TierSwapAmountSet(
        uint256 tierId,
        address swapToken,
        uint256 swapAmount
    );
    event ConfigChanged(
        AppType.AddressConfig addressConfig,
        AppType.UintConfig uintConfig,
        AppType.BoolConfig boolConfig,
        AppType.StringConfig stringConfig,
        address addressValue,
        uint256 uintValue,
        bool boolValue,
        string stringValue
    );
    event WithdrawAdmin(
        uint256 chainId,
        address token,
        uint256 amount,
        address account
    );

    function initialize(AppType.State storage state) external {
        state.config.addresses[AppType.AddressConfig.ADMIN] = msg.sender;
        state.config.addresses[
            AppType.AddressConfig.FEE_WALLET
        ] = 0xb07De92Cb6332B69D478026Ea563a2DC1661c73F;
        state.config.uints[AppType.UintConfig.CHAIN_ID] = 0x1;
        state.config.strings[
            AppType.StringConfig.APP_NAME
        ] = "Gallery Chosun Collection";

        state.tierSwapAmounts[1][address(0)] = 5e16;

        emit AppInitialized(
            state.config.uints[AppType.UintConfig.CHAIN_ID],
            state.config.strings[AppType.StringConfig.APP_NAME]
        );
    }

    function setTierSwapAmount(
        AppType.State storage state,
        uint256 tierId,
        address swapToken,
        uint256 swapAmount
    ) external {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );

        state.tierSwapAmounts[tierId][swapToken] = swapAmount;
        emit TierSwapAmountSet(tierId, swapToken, swapAmount);
    }

    function changeConfig(
        AppType.State storage state,
        AppType.IConfigKey calldata key,
        AppType.IConfigValue calldata value
    ) external {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN],
            "E001"
        );

        require(
            key.addressK != AppType.AddressConfig.ADMIN ||
                value.addressV == address(0),
            "E008"
        );

        state.config.addresses[key.addressK] = value.addressV;
        state.config.uints[key.uintK] = value.uintV;
        state.config.bools[key.boolK] = value.boolV;
        state.config.strings[key.stringK] = value.stringV;
        emit ConfigChanged(
            key.addressK,
            key.uintK,
            key.boolK,
            key.stringK,
            value.addressV,
            value.uintV,
            value.boolV,
            value.stringV
        );
    }

    function getConfig(
        AppType.State storage state,
        AppType.AddressConfig addressConfig,
        AppType.UintConfig uintConfig,
        AppType.BoolConfig boolConfig,
        AppType.StringConfig stringConfig
    )
        external
        view
        returns (
            address addressValue,
            uint256 uintValue,
            bool boolValue,
            string memory stringValue
        )
    {
        return (
            state.config.addresses[addressConfig],
            state.config.uints[uintConfig],
            state.config.bools[boolConfig],
            state.config.strings[stringConfig]
        );
    }

    function safeWithdraw(
        AppType.State storage state,
        address token,
        uint256 amount
    ) external {
        require(
            msg.sender == state.config.addresses[AppType.AddressConfig.ADMIN] ||
                msg.sender ==
                state.config.addresses[AppType.AddressConfig.FEE_WALLET],
            "E009"
        );

        require(
            state.config.addresses[AppType.AddressConfig.FEE_WALLET] !=
                address(0),
            "E010"
        );

        if (token == address(0)) {
            payable(state.config.addresses[AppType.AddressConfig.FEE_WALLET])
                .transfer(amount);
        } else {
            IERC20Upgradeable(token).safeTransfer(
                state.config.addresses[AppType.AddressConfig.FEE_WALLET],
                amount
            );
        }

        emit WithdrawAdmin(
            state.config.uints[AppType.UintConfig.CHAIN_ID],
            token,
            amount,
            state.config.addresses[AppType.AddressConfig.FEE_WALLET]
        );
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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 11 of 20 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 17 of 20 : Utils.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.13;

import "./AppType.sol";

library LeafUtils {
    function nftLeaf(AppType.NFT memory nft, AppType.State storage state)
        public
        view
        returns (bytes32 leaf)
    {
        leaf = keccak256(
            abi.encode(
                nft.batchId,
                nft.uri,
                nft.royaltyPercent,
                nft.tierId,
                state.config.strings[AppType.StringConfig.APP_NAME],
                state.config.uints[AppType.UintConfig.CHAIN_ID]
            )
        );
        return leaf;
    }
}

File 18 of 20 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 19 of 20 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/App.sol": {
      "App": "0x7a30f6062a14ba250450ef041f0ade2a16655ecf"
    },
    "contracts/Batch.sol": {
      "BatchFactory": "0x0d1122fc6538239047378362bb18cbc20ba1c36a"
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"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":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum AppType.AddressConfig","name":"addressK","type":"uint8"},{"internalType":"enum AppType.UintConfig","name":"uintK","type":"uint8"},{"internalType":"enum AppType.BoolConfig","name":"boolK","type":"uint8"},{"internalType":"enum AppType.StringConfig","name":"stringK","type":"uint8"}],"internalType":"struct AppType.IConfigKey","name":"key","type":"tuple"},{"components":[{"internalType":"address","name":"addressV","type":"address"},{"internalType":"uint256","name":"uintV","type":"uint256"},{"internalType":"bool","name":"boolV","type":"bool"},{"internalType":"string","name":"stringV","type":"string"}],"internalType":"struct AppType.IConfigValue","name":"value","type":"tuple"}],"name":"changeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"isOpenAt","type":"uint256"},{"internalType":"bool","name":"disabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"createBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"uint96","name":"royaltyPercent","type":"uint96"},{"internalType":"uint256","name":"tierId","type":"uint256"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"string","name":"uri","type":"string"}],"internalType":"struct AppType.NFT","name":"nft","type":"tuple"},{"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"excludeNFTLeaf","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":"enum AppType.AddressConfig","name":"addressConfig","type":"uint8"},{"internalType":"enum AppType.UintConfig","name":"uintConfig","type":"uint8"},{"internalType":"enum AppType.BoolConfig","name":"boolConfig","type":"uint8"},{"internalType":"enum AppType.StringConfig","name":"stringConfig","type":"uint8"}],"name":"getConfig","outputs":[{"internalType":"address","name":"addressValue","type":"address"},{"internalType":"uint256","name":"uintValue","type":"uint256"},{"internalType":"bool","name":"boolValue","type":"bool"},{"internalType":"string","name":"stringValue","type":"string"}],"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":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"readBatch","outputs":[{"internalType":"uint256","name":"isOpenAt","type":"uint256"},{"internalType":"bool","name":"disabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"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":[{"components":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"uint96","name":"royaltyPercent","type":"uint96"},{"internalType":"uint256","name":"tierId","type":"uint256"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"string","name":"uri","type":"string"}],"internalType":"struct AppType.NFT","name":"nft","type":"tuple"},{"internalType":"uint256","name":"nftAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"safeMint","outputs":[],"stateMutability":"payable","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":"uint256","name":"tierId","type":"uint256"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"}],"name":"setTierSwapAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newuri","type":"string"}],"name":"setURI","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":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"uint256","name":"isOpenAt","type":"uint256"},{"internalType":"bool","name":"disabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"updateBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405180606001604052806027815260200162002cd2602791396200003781620000a2565b506040516347c7433960e01b8152600480820152737a30f6062a14ba250450ef041f0ade2a16655ecf906347c743399060240160006040518083038186803b1580156200008357600080fd5b505af415801562000098573d6000803e3d6000fd5b505050506200019d565b8051620000b7906002906020840190620000bb565b5050565b828054620000c99062000161565b90600052602060002090601f016020900481019282620000ed576000855562000138565b82601f106200010857805160ff191683800117855562000138565b8280016001018555821562000138579182015b82811115620001385782518255916020019190600101906200011b565b50620001469291506200014a565b5090565b5b808211156200014657600081556001016200014b565b600181811c908216806200017657607f821691505b6020821081036200019757634e487b7160e01b600052602260045260246000fd5b50919050565b612b2580620001ad6000396000f3fe60806040526004361061013f5760003560e01c80634f558e79116100b6578063bd85b0391161006f578063bd85b039146103aa578063d0d77eb9146103d7578063e985e9c514610412578063f242432a1461045b578063f5298aca1461047b578063f64f2d0c1461049b57600080fd5b80634f558e79146102e85780636747fc13146103175780636804d827146103375780636b20c454146103575780638bef089a14610377578063a22cb4651461038a57600080fd5b80630920253f116101085780630920253f1461020b5780630e89341c1461022b5780632be2787a1461024b5780632eb2c2d61461026b5780634793efb91461028b5780634e1273f4146102bb57600080fd5b8062fdd58e1461014457806301ffc9a71461017757806302e99dae146101a757806302fe5305146101c957806306fdde03146101e9575b600080fd5b34801561015057600080fd5b5061016461015f366004611975565b6104bb565b6040519081526020015b60405180910390f35b34801561018357600080fd5b506101976101923660046119b7565b610552565b604051901515815260200161016e565b3480156101b357600080fd5b506101c76101c23660046119db565b6105a4565b005b3480156101d557600080fd5b506101c76101e4366004611afd565b610629565b3480156101f557600080fd5b506101fe6106a1565b60405161016e9190611b95565b34801561021757600080fd5b506101c7610226366004611bc0565b61075e565b34801561023757600080fd5b506101fe610246366004611c0e565b6107cd565b34801561025757600080fd5b506101c7610266366004611c45565b610861565b34801561027757600080fd5b506101c7610286366004611d00565b6108ae565b34801561029757600080fd5b506102ab6102a6366004611dc9565b610945565b60405161016e9493929190611e23565b3480156102c757600080fd5b506102db6102d6366004611e5c565b6109e5565b60405161016e9190611f59565b3480156102f457600080fd5b50610197610303366004611c0e565b600090815260036020526040902054151590565b34801561032357600080fd5b506101c7610332366004611975565b610b0e565b34801561034357600080fd5b506101c7610352366004611f6c565b610b5b565b34801561036357600080fd5b506101c7610372366004611fab565b610be0565b6101c7610385366004612020565b610c28565b34801561039657600080fd5b506101c76103a53660046120ed565b610cb9565b3480156103b657600080fd5b506101646103c5366004611c0e565b60009081526003602052604090205490565b3480156103e357600080fd5b506103f76103f2366004611c0e565b610d8f565b6040805193845291151560208401529082015260600161016e565b34801561041e57600080fd5b5061019761042d366004612126565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561046757600080fd5b506101c7610476366004612154565b610e1d565b34801561048757600080fd5b506101c76104963660046121bc565b610e62565b3480156104a757600080fd5b506101c76104b6366004612208565b610ea5565b60006001600160a01b03831661052c5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061058357506001600160e01b031982166303a24d0760e21b145b8061059e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b604051637f7ed2df60e01b8152600480820152602481018490526001600160a01b038316604482015260648101829052737a30f6062a14ba250450ef041f0ade2a16655ecf90637f7ed2df906084015b60006040518083038186803b15801561060c57600080fd5b505af4158015610620573d6000803e3d6000fd5b50505050505050565b600160005260086020527fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f546001600160a01b031633146106955760405162461bcd60e51b8152600401610523906020808252600490820152634530303160e01b604082015260600190565b61069e81610ee0565b50565b6001600052600b6020527f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5cf8054606091906106db906122d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610707906122d8565b80156107545780601f1061072957610100808354040283529160200191610754565b820191906000526020600020905b81548152906001019060200180831161073757829003601f168201915b5050505050905090565b604051632feccd0560e01b8152737a30f6062a14ba250450ef041f0ade2a16655ecf90632feccd0590610799906004908690869083016123a5565b60006040518083038186803b1580156107b157600080fd5b505af41580156107c5573d6000803e3d6000fd5b505050505050565b6060600280546107dc906122d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610808906122d8565b80156108555780601f1061082a57610100808354040283529160200191610855565b820191906000526020600020905b81548152906001019060200180831161083857829003601f168201915b50505050509050919050565b6040516375df32fd60e11b815260048082015260248101849052821515604482015260648101829052730d1122fc6538239047378362bb18cbc20ba1c36a9063ebbe65fa906084016105f4565b6001600160a01b0385163314806108ca57506108ca853361042d565b6109315760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610523565b61093e8585858585610ef7565b5050505050565b600080600060606004737a30f6062a14ba250450ef041f0ade2a16655ecf63b7db3c9a90918a8a8a8a6040518663ffffffff1660e01b815260040161098e959493929190612486565b600060405180830381865af41580156109ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d391908101906124d1565b929b919a509850909650945050505050565b60608151835114610a4a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610523565b600083516001600160401b03811115610a6557610a65611a13565b604051908082528060200260200182016040528015610a8e578160200160208202803683370190505b50905060005b8451811015610b0657610ad9858281518110610ab257610ab2612583565b6020026020010151858381518110610acc57610acc612583565b60200260200101516104bb565b828281518110610aeb57610aeb612583565b6020908102919091010152610aff816125af565b9050610a94565b509392505050565b604051630e3c433d60e21b81526004808201526001600160a01b038316602482015260448101829052737a30f6062a14ba250450ef041f0ade2a16655ecf906338f10cf490606401610799565b60405163ab4a15c360e01b81526004808201526024810185905260448101849052821515606482015260848101829052730d1122fc6538239047378362bb18cbc20ba1c36a9063ab4a15c39060a40160006040518083038186803b158015610bc257600080fd5b505af4158015610bd6573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316331480610bfc5750610bfc833361042d565b610c185760405162461bcd60e51b8152600401610523906125c8565b610c23838383611099565b505050565b60405163055b60e760e51b8152600090730d1122fc6538239047378362bb18cbc20ba1c36a9063ab6c1ce090610c6a906004908a908a90899089908501612611565b602060405180830381865af4158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab91906126d1565b90506107c533828787611227565b6001600160a01b0382163303610d235760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610523565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60405163fc760e8760e01b81526004808201526024810182905260009081908190730d1122fc6538239047378362bb18cbc20ba1c36a9063fc760e8790604401606060405180830381865af4158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1091906126ea565b9250925092509193909250565b6001600160a01b038516331480610e395750610e39853361042d565b610e555760405162461bcd60e51b8152600401610523906125c8565b61093e8585858585611337565b6001600160a01b038316331480610e7e5750610e7e833361042d565b610e9a5760405162461bcd60e51b8152600401610523906125c8565b610c2383838361144b565b604051634093d91f60e01b8152730d1122fc6538239047378362bb18cbc20ba1c36a90634093d91f9061079990600490869086908301612723565b8051610ef39060029060208401906118c7565b5050565b8151835114610f185760405162461bcd60e51b815260040161052390612792565b6001600160a01b038416610f3e5760405162461bcd60e51b8152600401610523906127da565b33610f4d81878787878761154c565b60005b8451811015611033576000858281518110610f6d57610f6d612583565b602002602001015190506000858381518110610f8b57610f8b612583565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610fdb5760405162461bcd60e51b81526004016105239061281f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611018908490612869565b925050819055505050508061102c906125af565b9050610f50565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611083929190612881565b60405180910390a46107c581878787878761155a565b6001600160a01b0383166110bf5760405162461bcd60e51b8152600401610523906128af565b80518251146110e05760405162461bcd60e51b815260040161052390612792565b60003390506111038185600086866040518060200160405280600081525061154c565b60005b83518110156111c857600084828151811061112357611123612583565b60200260200101519050600084838151811061114157611141612583565b602090810291909101810151600084815280835260408082206001600160a01b038c1683529093529190912054909150818110156111915760405162461bcd60e51b8152600401610523906128f2565b6000928352602083815260408085206001600160a01b038b16865290915290922091039055806111c0816125af565b915050611106565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611219929190612881565b60405180910390a450505050565b6001600160a01b0384166112875760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610523565b336112a781600087611298886116b5565b6112a1886116b5565b8761154c565b6000848152602081815260408083206001600160a01b0389168452909152812080548592906112d7908490612869565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461093e81600087878787611700565b6001600160a01b03841661135d5760405162461bcd60e51b8152600401610523906127da565b3361136d818787611298886116b5565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156113ae5760405162461bcd60e51b81526004016105239061281f565b6000858152602081815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906113eb908490612869565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610620828888888888611700565b6001600160a01b0383166114715760405162461bcd60e51b8152600401610523906128af565b336114a081856000611482876116b5565b61148b876116b5565b6040518060200160405280600081525061154c565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156114e15760405162461bcd60e51b8152600401610523906128f2565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b6107c58686868686866117bb565b6001600160a01b0384163b156107c55760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061159e9089908990889088908890600401612936565b6020604051808303816000875af19250505080156115d9575060408051601f3d908101601f191682019092526115d691810190612994565b60015b611685576115e56129b1565b806308c379a00361161e57506115f96129cd565b806116045750611620565b8060405162461bcd60e51b81526004016105239190611b95565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610523565b6001600160e01b0319811663bc197c8160e01b146106205760405162461bcd60e51b815260040161052390612a56565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106116ef576116ef612583565b602090810291909101015292915050565b6001600160a01b0384163b156107c55760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906117449089908990889088908890600401612a9e565b6020604051808303816000875af192505050801561177f575060408051601f3d908101601f1916820190925261177c91810190612994565b60015b61178b576115e56129b1565b6001600160e01b0319811663f23a6e6160e01b146106205760405162461bcd60e51b815260040161052390612a56565b6001600160a01b0385166118425760005b8351811015611840578281815181106117e7576117e7612583565b60200260200101516003600086848151811061180557611805612583565b60200260200101518152602001908152602001600020600082825461182a9190612869565b909155506118399050816125af565b90506117cc565b505b6001600160a01b0384166107c55760005b83518110156106205782818151811061186e5761186e612583565b60200260200101516003600086848151811061188c5761188c612583565b6020026020010151815260200190815260200160002060008282546118b19190612ad8565b909155506118c09050816125af565b9050611853565b8280546118d3906122d8565b90600052602060002090601f0160209004810192826118f5576000855561193b565b82601f1061190e57805160ff191683800117855561193b565b8280016001018555821561193b579182015b8281111561193b578251825591602001919060010190611920565b5061194792915061194b565b5090565b5b80821115611947576000815560010161194c565b6001600160a01b038116811461069e57600080fd5b6000806040838503121561198857600080fd5b823561199381611960565b946020939093013593505050565b6001600160e01b03198116811461069e57600080fd5b6000602082840312156119c957600080fd5b81356119d4816119a1565b9392505050565b6000806000606084860312156119f057600080fd5b833592506020840135611a0281611960565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60a081018181106001600160401b0382111715611a4857611a48611a13565b60405250565b601f8201601f191681016001600160401b0381118282101715611a7357611a73611a13565b6040525050565b60006001600160401b03821115611a9357611a93611a13565b50601f01601f191660200190565b600082601f830112611ab257600080fd5b8135611abd81611a7a565b604051611aca8282611a4e565b828152856020848701011115611adf57600080fd5b82602086016020830137600092810160200192909252509392505050565b600060208284031215611b0f57600080fd5b81356001600160401b03811115611b2557600080fd5b611b3184828501611aa1565b949350505050565b60005b83811015611b54578181015183820152602001611b3c565b83811115611b63576000848401525b50505050565b60008151808452611b81816020860160208601611b39565b601f01601f19169290920160200192915050565b6020815260006119d46020830184611b69565b600060808284031215611bba57600080fd5b50919050565b60008060a08385031215611bd357600080fd5b611bdd8484611ba8565b915060808301356001600160401b03811115611bf857600080fd5b611c0485828601611ba8565b9150509250929050565b600060208284031215611c2057600080fd5b5035919050565b801515811461069e57600080fd5b8035611c4081611c27565b919050565b600080600060608486031215611c5a57600080fd5b833592506020840135611a0281611c27565b60006001600160401b03821115611c8557611c85611a13565b5060051b60200190565b600082601f830112611ca057600080fd5b81356020611cad82611c6c565b604051611cba8282611a4e565b83815260059390931b8501820192828101915086841115611cda57600080fd5b8286015b84811015611cf55780358352918301918301611cde565b509695505050505050565b600080600080600060a08688031215611d1857600080fd5b8535611d2381611960565b94506020860135611d3381611960565b935060408601356001600160401b0380821115611d4f57600080fd5b611d5b89838a01611c8f565b94506060880135915080821115611d7157600080fd5b611d7d89838a01611c8f565b93506080880135915080821115611d9357600080fd5b50611da088828901611aa1565b9150509295509295909350565b803560038110611c4057600080fd5b6002811061069e57600080fd5b60008060008060808587031215611ddf57600080fd5b611de885611dad565b93506020850135611df881611dbc565b92506040850135611e0881611dbc565b91506060850135611e1881611dbc565b939692955090935050565b60018060a01b03851681528360208201528215156040820152608060608201526000611e526080830184611b69565b9695505050505050565b60008060408385031215611e6f57600080fd5b82356001600160401b0380821115611e8657600080fd5b818501915085601f830112611e9a57600080fd5b81356020611ea782611c6c565b604051611eb48282611a4e565b83815260059390931b8501820192828101915089841115611ed457600080fd5b948201945b83861015611efb578535611eec81611960565b82529482019490820190611ed9565b96505086013592505080821115611f1157600080fd5b50611c0485828601611c8f565b600081518084526020808501945080840160005b83811015611f4e57815187529582019590820190600101611f32565b509495945050505050565b6020815260006119d46020830184611f1e565b60008060008060808587031215611f8257600080fd5b84359350602085013592506040850135611f9b81611c27565b9396929550929360600135925050565b600080600060608486031215611fc057600080fd5b8335611fcb81611960565b925060208401356001600160401b0380821115611fe757600080fd5b611ff387838801611c8f565b9350604086013591508082111561200957600080fd5b5061201686828701611c8f565b9150509250925092565b60008060008060006080868803121561203857600080fd5b85356001600160401b038082111561204f57600080fd5b9087019060a0828a03121561206357600080fd5b909550602087013594506040870135908082111561208057600080fd5b61208c89838a01611aa1565b945060608801359150808211156120a257600080fd5b818801915088601f8301126120b657600080fd5b8135818111156120c557600080fd5b8960208260051b85010111156120da57600080fd5b9699959850939650602001949392505050565b6000806040838503121561210057600080fd5b823561210b81611960565b9150602083013561211b81611c27565b809150509250929050565b6000806040838503121561213957600080fd5b823561214481611960565b9150602083013561211b81611960565b600080600080600060a0868803121561216c57600080fd5b853561217781611960565b9450602086013561218781611960565b9350604086013592506060860135915060808601356001600160401b038111156121b057600080fd5b611da088828901611aa1565b6000806000606084860312156121d157600080fd5b83356121dc81611960565b95602085013595506040909401359392505050565b80356001600160601b0381168114611c4057600080fd5b6000806040838503121561221b57600080fd5b82356001600160401b038082111561223257600080fd5b9084019060a0828703121561224657600080fd5b60405161225281611a29565b82358152612262602084016121f1565b602082015260408301356040820152606083013561227f81611960565b606082015260808301358281111561229657600080fd5b6122a288828601611aa1565b60808301525093506122b991505060208401611c35565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b600181811c908216806122ec57607f821691505b602082108103611bba57634e487b7160e01b600052602260045260246000fd5b6003811061231c5761231c6122c2565b9052565b6002811061069e5761069e6122c2565b6000808335601e1984360301811261234757600080fd5b83016020810192503590506001600160401b0381111561236657600080fd5b80360383131561237557600080fd5b9250929050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526123bd602082016123b885611dad565b61230c565b600060208401356123cd81611dbc565b6123d681612320565b8060408401525060408401356123eb81611dbc565b6123f481612320565b80606084015250606084013561240981611dbc565b61241281612320565b608083015260c060a0830152823561242981611960565b6001600160a01b031660c0830152602083013560e0830152604083013561244f81611c27565b15156101008301526124646060840184612330565b608061012085015261247b6101408501828461237c565b979650505050505050565b85815260a0810161249a602083018761230c565b6124a385612320565b8460408301526124b284612320565b8360608301526124c183612320565b8260808301529695505050505050565b600080600080608085870312156124e757600080fd5b84516124f281611960565b60208601516040870151919550935061250a81611c27565b60608601519092506001600160401b0381111561252657600080fd5b8501601f8101871361253757600080fd5b805161254281611a7a565b60405161254f8282611a4e565b82815289602084860101111561256457600080fd5b612575836020830160208701611b39565b969995985093965050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125c1576125c1612599565b5060010190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b85815260806020820152843560808201526001600160601b03612636602087016121f1565b1660a0820152604085013560c08201526000606086013561265681611960565b6001600160a01b031660e08301526126716080870187612330565b60a06101008501526126886101208501828461237c565b6040850188905284810360608601528581529150506001600160fb1b038411156126b157600080fd5b8360051b8086602084013760009101602001908152979650505050505050565b6000602082840312156126e357600080fd5b5051919050565b6000806000606084860312156126ff57600080fd5b83519250602084015161271181611c27565b80925050604084015190509250925092565b83815260606020820152825160608201526001600160601b036020840151166080820152604083015160a082015260018060a01b0360608401511660c08201526000608084015160a060e084015261277f610100840182611b69565b9150508215156040830152949350505050565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6000821982111561287c5761287c612599565b500190565b6040815260006128946040830185611f1e565b82810360208401526128a68185611f1e565b95945050505050565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b6001600160a01b0386811682528516602082015260a06040820181905260009061296290830186611f1e565b82810360608401526129748186611f1e565b905082810360808401526129888185611b69565b98975050505050505050565b6000602082840312156129a657600080fd5b81516119d4816119a1565b600060033d11156129ca5760046000803e5060005160e01c5b90565b600060443d10156129db5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715612a0a57505050505090565b8285019150815181811115612a225750505050505090565b843d8701016020828501011115612a3c5750505050505090565b612a4b60208286010187611a4e565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061247b90830184611b69565b600082821015612aea57612aea612599565b50039056fea2646970667358221220f5ec316e9d8597d4323e2074700fc81c6103143103c45f7755c1f5016a4f36b264736f6c634300080d003368747470733a2f2f6d696e742e76616c6f7265732e63632f6e66742f7b69647d2f6d696e746564

Deployed Bytecode

0x60806040526004361061013f5760003560e01c80634f558e79116100b6578063bd85b0391161006f578063bd85b039146103aa578063d0d77eb9146103d7578063e985e9c514610412578063f242432a1461045b578063f5298aca1461047b578063f64f2d0c1461049b57600080fd5b80634f558e79146102e85780636747fc13146103175780636804d827146103375780636b20c454146103575780638bef089a14610377578063a22cb4651461038a57600080fd5b80630920253f116101085780630920253f1461020b5780630e89341c1461022b5780632be2787a1461024b5780632eb2c2d61461026b5780634793efb91461028b5780634e1273f4146102bb57600080fd5b8062fdd58e1461014457806301ffc9a71461017757806302e99dae146101a757806302fe5305146101c957806306fdde03146101e9575b600080fd5b34801561015057600080fd5b5061016461015f366004611975565b6104bb565b6040519081526020015b60405180910390f35b34801561018357600080fd5b506101976101923660046119b7565b610552565b604051901515815260200161016e565b3480156101b357600080fd5b506101c76101c23660046119db565b6105a4565b005b3480156101d557600080fd5b506101c76101e4366004611afd565b610629565b3480156101f557600080fd5b506101fe6106a1565b60405161016e9190611b95565b34801561021757600080fd5b506101c7610226366004611bc0565b61075e565b34801561023757600080fd5b506101fe610246366004611c0e565b6107cd565b34801561025757600080fd5b506101c7610266366004611c45565b610861565b34801561027757600080fd5b506101c7610286366004611d00565b6108ae565b34801561029757600080fd5b506102ab6102a6366004611dc9565b610945565b60405161016e9493929190611e23565b3480156102c757600080fd5b506102db6102d6366004611e5c565b6109e5565b60405161016e9190611f59565b3480156102f457600080fd5b50610197610303366004611c0e565b600090815260036020526040902054151590565b34801561032357600080fd5b506101c7610332366004611975565b610b0e565b34801561034357600080fd5b506101c7610352366004611f6c565b610b5b565b34801561036357600080fd5b506101c7610372366004611fab565b610be0565b6101c7610385366004612020565b610c28565b34801561039657600080fd5b506101c76103a53660046120ed565b610cb9565b3480156103b657600080fd5b506101646103c5366004611c0e565b60009081526003602052604090205490565b3480156103e357600080fd5b506103f76103f2366004611c0e565b610d8f565b6040805193845291151560208401529082015260600161016e565b34801561041e57600080fd5b5061019761042d366004612126565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561046757600080fd5b506101c7610476366004612154565b610e1d565b34801561048757600080fd5b506101c76104963660046121bc565b610e62565b3480156104a757600080fd5b506101c76104b6366004612208565b610ea5565b60006001600160a01b03831661052c5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061058357506001600160e01b031982166303a24d0760e21b145b8061059e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b604051637f7ed2df60e01b8152600480820152602481018490526001600160a01b038316604482015260648101829052737a30f6062a14ba250450ef041f0ade2a16655ecf90637f7ed2df906084015b60006040518083038186803b15801561060c57600080fd5b505af4158015610620573d6000803e3d6000fd5b50505050505050565b600160005260086020527fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f546001600160a01b031633146106955760405162461bcd60e51b8152600401610523906020808252600490820152634530303160e01b604082015260600190565b61069e81610ee0565b50565b6001600052600b6020527f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5cf8054606091906106db906122d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610707906122d8565b80156107545780601f1061072957610100808354040283529160200191610754565b820191906000526020600020905b81548152906001019060200180831161073757829003601f168201915b5050505050905090565b604051632feccd0560e01b8152737a30f6062a14ba250450ef041f0ade2a16655ecf90632feccd0590610799906004908690869083016123a5565b60006040518083038186803b1580156107b157600080fd5b505af41580156107c5573d6000803e3d6000fd5b505050505050565b6060600280546107dc906122d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610808906122d8565b80156108555780601f1061082a57610100808354040283529160200191610855565b820191906000526020600020905b81548152906001019060200180831161083857829003601f168201915b50505050509050919050565b6040516375df32fd60e11b815260048082015260248101849052821515604482015260648101829052730d1122fc6538239047378362bb18cbc20ba1c36a9063ebbe65fa906084016105f4565b6001600160a01b0385163314806108ca57506108ca853361042d565b6109315760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610523565b61093e8585858585610ef7565b5050505050565b600080600060606004737a30f6062a14ba250450ef041f0ade2a16655ecf63b7db3c9a90918a8a8a8a6040518663ffffffff1660e01b815260040161098e959493929190612486565b600060405180830381865af41580156109ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d391908101906124d1565b929b919a509850909650945050505050565b60608151835114610a4a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610523565b600083516001600160401b03811115610a6557610a65611a13565b604051908082528060200260200182016040528015610a8e578160200160208202803683370190505b50905060005b8451811015610b0657610ad9858281518110610ab257610ab2612583565b6020026020010151858381518110610acc57610acc612583565b60200260200101516104bb565b828281518110610aeb57610aeb612583565b6020908102919091010152610aff816125af565b9050610a94565b509392505050565b604051630e3c433d60e21b81526004808201526001600160a01b038316602482015260448101829052737a30f6062a14ba250450ef041f0ade2a16655ecf906338f10cf490606401610799565b60405163ab4a15c360e01b81526004808201526024810185905260448101849052821515606482015260848101829052730d1122fc6538239047378362bb18cbc20ba1c36a9063ab4a15c39060a40160006040518083038186803b158015610bc257600080fd5b505af4158015610bd6573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316331480610bfc5750610bfc833361042d565b610c185760405162461bcd60e51b8152600401610523906125c8565b610c23838383611099565b505050565b60405163055b60e760e51b8152600090730d1122fc6538239047378362bb18cbc20ba1c36a9063ab6c1ce090610c6a906004908a908a90899089908501612611565b602060405180830381865af4158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab91906126d1565b90506107c533828787611227565b6001600160a01b0382163303610d235760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610523565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60405163fc760e8760e01b81526004808201526024810182905260009081908190730d1122fc6538239047378362bb18cbc20ba1c36a9063fc760e8790604401606060405180830381865af4158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1091906126ea565b9250925092509193909250565b6001600160a01b038516331480610e395750610e39853361042d565b610e555760405162461bcd60e51b8152600401610523906125c8565b61093e8585858585611337565b6001600160a01b038316331480610e7e5750610e7e833361042d565b610e9a5760405162461bcd60e51b8152600401610523906125c8565b610c2383838361144b565b604051634093d91f60e01b8152730d1122fc6538239047378362bb18cbc20ba1c36a90634093d91f9061079990600490869086908301612723565b8051610ef39060029060208401906118c7565b5050565b8151835114610f185760405162461bcd60e51b815260040161052390612792565b6001600160a01b038416610f3e5760405162461bcd60e51b8152600401610523906127da565b33610f4d81878787878761154c565b60005b8451811015611033576000858281518110610f6d57610f6d612583565b602002602001015190506000858381518110610f8b57610f8b612583565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610fdb5760405162461bcd60e51b81526004016105239061281f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611018908490612869565b925050819055505050508061102c906125af565b9050610f50565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611083929190612881565b60405180910390a46107c581878787878761155a565b6001600160a01b0383166110bf5760405162461bcd60e51b8152600401610523906128af565b80518251146110e05760405162461bcd60e51b815260040161052390612792565b60003390506111038185600086866040518060200160405280600081525061154c565b60005b83518110156111c857600084828151811061112357611123612583565b60200260200101519050600084838151811061114157611141612583565b602090810291909101810151600084815280835260408082206001600160a01b038c1683529093529190912054909150818110156111915760405162461bcd60e51b8152600401610523906128f2565b6000928352602083815260408085206001600160a01b038b16865290915290922091039055806111c0816125af565b915050611106565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611219929190612881565b60405180910390a450505050565b6001600160a01b0384166112875760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610523565b336112a781600087611298886116b5565b6112a1886116b5565b8761154c565b6000848152602081815260408083206001600160a01b0389168452909152812080548592906112d7908490612869565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461093e81600087878787611700565b6001600160a01b03841661135d5760405162461bcd60e51b8152600401610523906127da565b3361136d818787611298886116b5565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156113ae5760405162461bcd60e51b81526004016105239061281f565b6000858152602081815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906113eb908490612869565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610620828888888888611700565b6001600160a01b0383166114715760405162461bcd60e51b8152600401610523906128af565b336114a081856000611482876116b5565b61148b876116b5565b6040518060200160405280600081525061154c565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156114e15760405162461bcd60e51b8152600401610523906128f2565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b6107c58686868686866117bb565b6001600160a01b0384163b156107c55760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061159e9089908990889088908890600401612936565b6020604051808303816000875af19250505080156115d9575060408051601f3d908101601f191682019092526115d691810190612994565b60015b611685576115e56129b1565b806308c379a00361161e57506115f96129cd565b806116045750611620565b8060405162461bcd60e51b81526004016105239190611b95565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610523565b6001600160e01b0319811663bc197c8160e01b146106205760405162461bcd60e51b815260040161052390612a56565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106116ef576116ef612583565b602090810291909101015292915050565b6001600160a01b0384163b156107c55760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906117449089908990889088908890600401612a9e565b6020604051808303816000875af192505050801561177f575060408051601f3d908101601f1916820190925261177c91810190612994565b60015b61178b576115e56129b1565b6001600160e01b0319811663f23a6e6160e01b146106205760405162461bcd60e51b815260040161052390612a56565b6001600160a01b0385166118425760005b8351811015611840578281815181106117e7576117e7612583565b60200260200101516003600086848151811061180557611805612583565b60200260200101518152602001908152602001600020600082825461182a9190612869565b909155506118399050816125af565b90506117cc565b505b6001600160a01b0384166107c55760005b83518110156106205782818151811061186e5761186e612583565b60200260200101516003600086848151811061188c5761188c612583565b6020026020010151815260200190815260200160002060008282546118b19190612ad8565b909155506118c09050816125af565b9050611853565b8280546118d3906122d8565b90600052602060002090601f0160209004810192826118f5576000855561193b565b82601f1061190e57805160ff191683800117855561193b565b8280016001018555821561193b579182015b8281111561193b578251825591602001919060010190611920565b5061194792915061194b565b5090565b5b80821115611947576000815560010161194c565b6001600160a01b038116811461069e57600080fd5b6000806040838503121561198857600080fd5b823561199381611960565b946020939093013593505050565b6001600160e01b03198116811461069e57600080fd5b6000602082840312156119c957600080fd5b81356119d4816119a1565b9392505050565b6000806000606084860312156119f057600080fd5b833592506020840135611a0281611960565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60a081018181106001600160401b0382111715611a4857611a48611a13565b60405250565b601f8201601f191681016001600160401b0381118282101715611a7357611a73611a13565b6040525050565b60006001600160401b03821115611a9357611a93611a13565b50601f01601f191660200190565b600082601f830112611ab257600080fd5b8135611abd81611a7a565b604051611aca8282611a4e565b828152856020848701011115611adf57600080fd5b82602086016020830137600092810160200192909252509392505050565b600060208284031215611b0f57600080fd5b81356001600160401b03811115611b2557600080fd5b611b3184828501611aa1565b949350505050565b60005b83811015611b54578181015183820152602001611b3c565b83811115611b63576000848401525b50505050565b60008151808452611b81816020860160208601611b39565b601f01601f19169290920160200192915050565b6020815260006119d46020830184611b69565b600060808284031215611bba57600080fd5b50919050565b60008060a08385031215611bd357600080fd5b611bdd8484611ba8565b915060808301356001600160401b03811115611bf857600080fd5b611c0485828601611ba8565b9150509250929050565b600060208284031215611c2057600080fd5b5035919050565b801515811461069e57600080fd5b8035611c4081611c27565b919050565b600080600060608486031215611c5a57600080fd5b833592506020840135611a0281611c27565b60006001600160401b03821115611c8557611c85611a13565b5060051b60200190565b600082601f830112611ca057600080fd5b81356020611cad82611c6c565b604051611cba8282611a4e565b83815260059390931b8501820192828101915086841115611cda57600080fd5b8286015b84811015611cf55780358352918301918301611cde565b509695505050505050565b600080600080600060a08688031215611d1857600080fd5b8535611d2381611960565b94506020860135611d3381611960565b935060408601356001600160401b0380821115611d4f57600080fd5b611d5b89838a01611c8f565b94506060880135915080821115611d7157600080fd5b611d7d89838a01611c8f565b93506080880135915080821115611d9357600080fd5b50611da088828901611aa1565b9150509295509295909350565b803560038110611c4057600080fd5b6002811061069e57600080fd5b60008060008060808587031215611ddf57600080fd5b611de885611dad565b93506020850135611df881611dbc565b92506040850135611e0881611dbc565b91506060850135611e1881611dbc565b939692955090935050565b60018060a01b03851681528360208201528215156040820152608060608201526000611e526080830184611b69565b9695505050505050565b60008060408385031215611e6f57600080fd5b82356001600160401b0380821115611e8657600080fd5b818501915085601f830112611e9a57600080fd5b81356020611ea782611c6c565b604051611eb48282611a4e565b83815260059390931b8501820192828101915089841115611ed457600080fd5b948201945b83861015611efb578535611eec81611960565b82529482019490820190611ed9565b96505086013592505080821115611f1157600080fd5b50611c0485828601611c8f565b600081518084526020808501945080840160005b83811015611f4e57815187529582019590820190600101611f32565b509495945050505050565b6020815260006119d46020830184611f1e565b60008060008060808587031215611f8257600080fd5b84359350602085013592506040850135611f9b81611c27565b9396929550929360600135925050565b600080600060608486031215611fc057600080fd5b8335611fcb81611960565b925060208401356001600160401b0380821115611fe757600080fd5b611ff387838801611c8f565b9350604086013591508082111561200957600080fd5b5061201686828701611c8f565b9150509250925092565b60008060008060006080868803121561203857600080fd5b85356001600160401b038082111561204f57600080fd5b9087019060a0828a03121561206357600080fd5b909550602087013594506040870135908082111561208057600080fd5b61208c89838a01611aa1565b945060608801359150808211156120a257600080fd5b818801915088601f8301126120b657600080fd5b8135818111156120c557600080fd5b8960208260051b85010111156120da57600080fd5b9699959850939650602001949392505050565b6000806040838503121561210057600080fd5b823561210b81611960565b9150602083013561211b81611c27565b809150509250929050565b6000806040838503121561213957600080fd5b823561214481611960565b9150602083013561211b81611960565b600080600080600060a0868803121561216c57600080fd5b853561217781611960565b9450602086013561218781611960565b9350604086013592506060860135915060808601356001600160401b038111156121b057600080fd5b611da088828901611aa1565b6000806000606084860312156121d157600080fd5b83356121dc81611960565b95602085013595506040909401359392505050565b80356001600160601b0381168114611c4057600080fd5b6000806040838503121561221b57600080fd5b82356001600160401b038082111561223257600080fd5b9084019060a0828703121561224657600080fd5b60405161225281611a29565b82358152612262602084016121f1565b602082015260408301356040820152606083013561227f81611960565b606082015260808301358281111561229657600080fd5b6122a288828601611aa1565b60808301525093506122b991505060208401611c35565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b600181811c908216806122ec57607f821691505b602082108103611bba57634e487b7160e01b600052602260045260246000fd5b6003811061231c5761231c6122c2565b9052565b6002811061069e5761069e6122c2565b6000808335601e1984360301811261234757600080fd5b83016020810192503590506001600160401b0381111561236657600080fd5b80360383131561237557600080fd5b9250929050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526123bd602082016123b885611dad565b61230c565b600060208401356123cd81611dbc565b6123d681612320565b8060408401525060408401356123eb81611dbc565b6123f481612320565b80606084015250606084013561240981611dbc565b61241281612320565b608083015260c060a0830152823561242981611960565b6001600160a01b031660c0830152602083013560e0830152604083013561244f81611c27565b15156101008301526124646060840184612330565b608061012085015261247b6101408501828461237c565b979650505050505050565b85815260a0810161249a602083018761230c565b6124a385612320565b8460408301526124b284612320565b8360608301526124c183612320565b8260808301529695505050505050565b600080600080608085870312156124e757600080fd5b84516124f281611960565b60208601516040870151919550935061250a81611c27565b60608601519092506001600160401b0381111561252657600080fd5b8501601f8101871361253757600080fd5b805161254281611a7a565b60405161254f8282611a4e565b82815289602084860101111561256457600080fd5b612575836020830160208701611b39565b969995985093965050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125c1576125c1612599565b5060010190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b85815260806020820152843560808201526001600160601b03612636602087016121f1565b1660a0820152604085013560c08201526000606086013561265681611960565b6001600160a01b031660e08301526126716080870187612330565b60a06101008501526126886101208501828461237c565b6040850188905284810360608601528581529150506001600160fb1b038411156126b157600080fd5b8360051b8086602084013760009101602001908152979650505050505050565b6000602082840312156126e357600080fd5b5051919050565b6000806000606084860312156126ff57600080fd5b83519250602084015161271181611c27565b80925050604084015190509250925092565b83815260606020820152825160608201526001600160601b036020840151166080820152604083015160a082015260018060a01b0360608401511660c08201526000608084015160a060e084015261277f610100840182611b69565b9150508215156040830152949350505050565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6000821982111561287c5761287c612599565b500190565b6040815260006128946040830185611f1e565b82810360208401526128a68185611f1e565b95945050505050565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b6001600160a01b0386811682528516602082015260a06040820181905260009061296290830186611f1e565b82810360608401526129748186611f1e565b905082810360808401526129888185611b69565b98975050505050505050565b6000602082840312156129a657600080fd5b81516119d4816119a1565b600060033d11156129ca5760046000803e5060005160e01c5b90565b600060443d10156129db5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715612a0a57505050505090565b8285019150815181811115612a225750505050505090565b843d8701016020828501011115612a3c5750505050505090565b612a4b60208286010187611a4e565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061247b90830184611b69565b600082821015612aea57612aea612599565b50039056fea2646970667358221220f5ec316e9d8597d4323e2074700fc81c6103143103c45f7755c1f5016a4f36b264736f6c634300080d0033

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

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