ETH Price: $3,495.23 (+0.98%)
Gas: 9 Gwei

Contract

0xfcf68515aa6540DcD77F136DCB4f4CcD9967769a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Mint198499992024-05-11 23:13:3566 days ago1715469215IN
0xfcf68515...D9967769a
0 ETH0.030582073.97485477
Mint198487092024-05-11 18:54:3566 days ago1715453675IN
0xfcf68515...D9967769a
0 ETH0.004988843.90619874
Mint198484302024-05-11 17:58:4766 days ago1715450327IN
0xfcf68515...D9967769a
0 ETH0.004556683.56641072
Mint198467362024-05-11 12:17:5966 days ago1715429879IN
0xfcf68515...D9967769a
0 ETH0.024489875.04631225
Mint198395192024-05-10 12:05:1167 days ago1715342711IN
0xfcf68515...D9967769a
0 ETH0.002190653.51190068
Mint198388072024-05-10 9:41:4767 days ago1715334107IN
0xfcf68515...D9967769a
0 ETH0.005533123.56687842
Mint198387262024-05-10 9:25:1167 days ago1715333111IN
0xfcf68515...D9967769a
0 ETH0.004218183.41033398
Mint198386982024-05-10 9:19:3567 days ago1715332775IN
0xfcf68515...D9967769a
0 ETH0.002317153.51945356
Mint198386452024-05-10 9:08:5967 days ago1715332139IN
0xfcf68515...D9967769a
0 ETH0.003317083.39704806
Mint198385812024-05-10 8:56:1167 days ago1715331371IN
0xfcf68515...D9967769a
0 ETH0.002760383.50797698
Mint198385512024-05-10 8:50:1167 days ago1715331011IN
0xfcf68515...D9967769a
0 ETH0.002601293.51210503
Mint198377042024-05-10 5:59:4767 days ago1715320787IN
0xfcf68515...D9967769a
0 ETH0.001586473.35575753
Mint198371812024-05-10 4:14:2368 days ago1715314463IN
0xfcf68515...D9967769a
0 ETH0.00161163.35441287
Mint198371752024-05-10 4:13:1168 days ago1715314391IN
0xfcf68515...D9967769a
0 ETH0.003505953.43143814
Mint198371402024-05-10 4:06:1168 days ago1715313971IN
0xfcf68515...D9967769a
0 ETH0.006511893.46803264
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.00443583.28409075
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.002857033.2855021
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.002639093.24611104
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.00608323.23972897
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.002285153.23975493
Mint198371362024-05-10 4:05:2368 days ago1715313923IN
0xfcf68515...D9967769a
0 ETH0.002313613.28010571
Mint198346772024-05-09 19:48:4768 days ago1715284127IN
0xfcf68515...D9967769a
0 ETH0.002041353.60340717
Mint198346612024-05-09 19:45:3568 days ago1715283935IN
0xfcf68515...D9967769a
0 ETH0.005799543.61880088
Mint198346612024-05-09 19:45:3568 days ago1715283935IN
0xfcf68515...D9967769a
0 ETH0.004999963.57923506
Mint198345572024-05-09 19:24:2368 days ago1715282663IN
0xfcf68515...D9967769a
0 ETH0.004330413.65181722
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
198499992024-05-11 23:13:3566 days ago1715469215
0xfcf68515...D9967769a
 Contract Creation0 ETH
198499992024-05-11 23:13:3566 days ago1715469215
0xfcf68515...D9967769a
 Contract Creation0 ETH
198487092024-05-11 18:54:3566 days ago1715453675
0xfcf68515...D9967769a
 Contract Creation0 ETH
198484302024-05-11 17:58:4766 days ago1715450327
0xfcf68515...D9967769a
 Contract Creation0 ETH
198467362024-05-11 12:17:5966 days ago1715429879
0xfcf68515...D9967769a
 Contract Creation0 ETH
198395192024-05-10 12:05:1167 days ago1715342711
0xfcf68515...D9967769a
 Contract Creation0 ETH
198388072024-05-10 9:41:4767 days ago1715334107
0xfcf68515...D9967769a
 Contract Creation0 ETH
198387262024-05-10 9:25:1167 days ago1715333111
0xfcf68515...D9967769a
 Contract Creation0 ETH
198386982024-05-10 9:19:3567 days ago1715332775
0xfcf68515...D9967769a
 Contract Creation0 ETH
198386452024-05-10 9:08:5967 days ago1715332139
0xfcf68515...D9967769a
 Contract Creation0 ETH
198385812024-05-10 8:56:1167 days ago1715331371
0xfcf68515...D9967769a
 Contract Creation0 ETH
198385512024-05-10 8:50:1167 days ago1715331011
0xfcf68515...D9967769a
 Contract Creation0 ETH
198377042024-05-10 5:59:4767 days ago1715320787
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371812024-05-10 4:14:2368 days ago1715314463
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371752024-05-10 4:13:1168 days ago1715314391
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371402024-05-10 4:06:1168 days ago1715313971
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198371362024-05-10 4:05:2368 days ago1715313923
0xfcf68515...D9967769a
 Contract Creation0 ETH
198346772024-05-09 19:48:4768 days ago1715284127
0xfcf68515...D9967769a
 Contract Creation0 ETH
198346612024-05-09 19:45:3568 days ago1715283935
0xfcf68515...D9967769a
 Contract Creation0 ETH
198346612024-05-09 19:45:3568 days ago1715283935
0xfcf68515...D9967769a
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Efficax

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 1000 runs

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

pragma solidity ^0.8.16;

import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

import "./libraries/Base64.sol";
import "./libraries/SSTORE2.sol";
import "./libraries/InflateLib.sol";

contract Efficax is AdminControl, ICreatorExtensionTokenURI{
    struct Token {
        string metadata;
        string mimeType;
        address[] chunks;
        bool deflated;
        uint totalLength;
    }

    struct Options {
        string metadata;
        string mimeType;
        uint quantity;
        bool deflated;
        uint totalLength;
    }

    /**
     * @notice The mapping that contains the token data for a given creator contract & token id.
     */
    mapping(address => mapping(uint256 => Token)) public tokenData;

    /**
     * @notice A modifier for checking that the sender of the transaction has admin permissions on the Creator Contract they are trying to do something with
     * 
     * Shamelessly borrowed from the Manifold claim page extension.
     * 
     * @param creatorContractAddress The Manifold Creator Contract in question
     */
    modifier creatorAdminRequired(address creatorContractAddress) {
        AdminControl creatorCoreContract = AdminControl(creatorContractAddress);
        require(creatorCoreContract.isAdmin(msg.sender), 'Wallet is not an administrator for contract');
        _;
    }
    /**
        @notice Mints a token with `metadata` of type `mimeType` and image `image`
        @param creatorContractAddress The Manifold contract to mint to
        @param options minting details: quantity, metadata, mimeType
          - quantity The number of editions to mint
          - metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"`
          - mimeType The mime type for `image`
          - deflate Whether or not the data is compressed
        @param image The image data, split into bytes of max len 24576 (EVM contract limit)
    */
    function mint1155(
        address creatorContractAddress,
        Options calldata options,
        bytes[] calldata image
    ) external creatorAdminRequired(creatorContractAddress) {
        address[] memory dest = new address[](1);
        uint256[] memory quantities = new uint256[](1);
        string[] memory uris = new string[](1);

        dest[0] = msg.sender;
        quantities[0] = options.quantity;

        uint256[] memory tokenIds = IERC1155CreatorCore(creatorContractAddress).mintExtensionNew(dest, quantities, uris);
        uint256 tokenId = tokenIds[0];

        tokenData[creatorContractAddress][tokenId].metadata = options.metadata;
        tokenData[creatorContractAddress][tokenId].mimeType = options.mimeType;
        tokenData[creatorContractAddress][tokenId].deflated = options.deflated;
        tokenData[creatorContractAddress][tokenId].totalLength = options.totalLength;

        // loop through the image array, appending a new byte array
        // to the chunks. This is because the contract storage limit
        // is 24576 but we actually get much further than that before
        // running out of gas in the block.
        for (uint8 i = 0; i < image.length; i++) {
            tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i]));
        }
    }
    
    /**
        @notice Mints a token with `metadata` of type `mimeType` and image `image`
        @param creatorContractAddress The Manifold contract to mint to
        @param image The image data, split into bytes of max len 24576 (EVM contract limit)
        @param options minting details: quantity, metadata, mimeType
          - quantity The number of editions to mint
          - metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"`
          - mimeType The mime type for `image`
          - deflate Whether or not the data is compressed
    */
    function mint(
        address creatorContractAddress,
        Options calldata options,
        bytes[] calldata image
    ) external creatorAdminRequired(creatorContractAddress) {
        uint256 tokenId = IERC721CreatorCore(creatorContractAddress).mintExtension(msg.sender);

        tokenData[creatorContractAddress][tokenId].metadata = options.metadata;
        tokenData[creatorContractAddress][tokenId].mimeType = options.mimeType;
        tokenData[creatorContractAddress][tokenId].deflated = options.deflated;
        tokenData[creatorContractAddress][tokenId].totalLength = options.totalLength;

        // loop through the image array, appending a new byte array
        // to the chunks. This is because the contract storage limit
        // is 24576 but we actually get much further than that before
        // running out of gas in the block.
        for (uint8 i = 0; i < image.length; i++) {
            tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i]));
        }
    }

    /**
        @notice Updates a token with `metadata` of type `mimeType` and image `image`.
        @param creatorContractAddress The Manifold contract to mint to
        @param tokenId the token to update the data for
        @param image The image data, split into bytes of max len 24576 (EVM contract limit)
        @param options minting details: quantity, metadata, mimeType
          - quantity The number of editions to mint
          - metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"`
          - mimeType The mime type for `image`
          - deflate Whether or not the data is compressed
    */
    function updateToken(
        address creatorContractAddress,
        uint256 tokenId,
        bytes[] calldata image,
        Options calldata options
    ) external creatorAdminRequired(creatorContractAddress) {
        if (bytes(options.metadata).length > 0) {
            tokenData[creatorContractAddress][tokenId].metadata = options.metadata;
        }

        if (bytes(options.mimeType).length > 0) {
            tokenData[creatorContractAddress][tokenId].mimeType = options.mimeType;
        }

        tokenData[creatorContractAddress][tokenId].deflated = options.deflated;

        if (image.length > 0) {
            delete tokenData[creatorContractAddress][tokenId].chunks;
            for (uint8 i = 0; i < image.length; i++) {
                tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i]));
            }
        }
    }

    /**
        @notice Appends chunks of binary data to the chunks for a given token. If your image won't fit in a single "mint" transaction, you can use this to add data to it.
        @param creatorContractAddress The Manifold contract to mint to
        @param tokenId The token to add data to
        @param chunks The chunks of data to add, max length for each individual chunk is 24576 bytes (EVM contract limit)
    */
    function appendChunks(
        address creatorContractAddress,
        uint256 tokenId,
        bytes[] calldata chunks
    ) external creatorAdminRequired(creatorContractAddress) {
        for (uint8 i = 0; i < chunks.length; i++) {
            tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(chunks[i]));
        }
    }

    /**
     * @dev packs token data by converting it to base64 and attaching the mime type
     * 
     * @param creatorContractAddress the contract address containing the token
     * @param tokenId the token id to pack
     */
    function pack(address creatorContractAddress, uint256 tokenId) public view returns (string memory) {
        string memory image = string(
            abi.encodePacked(
                "data:",
                tokenData[creatorContractAddress][tokenId].mimeType,
                ";base64,"
            )
        );

        bytes memory data;

        for (uint8 i = 0; i < tokenData[creatorContractAddress][tokenId].chunks.length; i++) {
            data = abi.encodePacked(
                data,
                SSTORE2.read(tokenData[creatorContractAddress][tokenId].chunks[i])
            );
        }

        if (tokenData[creatorContractAddress][tokenId].deflated) {
            (, data) = InflateLib.puff(data, tokenData[creatorContractAddress][tokenId].totalLength);
        }

        image = string(
            abi.encodePacked(
                image,
                Base64.encode(data)
            )
        );

        return image;
    }

    function inflate(bytes memory data, uint length) external pure returns (string memory) {
        (, bytes memory ourData) = InflateLib.puff(data, length);
        return string(
            abi.encodePacked(
                ourData
            )
        );
    }

    function tokenURI(address creatorContractAddress, uint256 tokenId) external view override returns (string memory) {
        require(tokenData[creatorContractAddress][tokenId].chunks.length != 0, "Token metadata doesn't exist here");

        return string(
            abi.encodePacked(
                'data:application/json;utf8,{',
                tokenData[creatorContractAddress][tokenId].metadata,
                ', "image": "',
                pack(creatorContractAddress, tokenId),
                '"}'
            )
        );

    }

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

File 2 of 23 : CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

import "../extensions/ICreatorExtensionTokenURI.sol";
import "../extensions/ICreatorExtensionRoyalties.sol";

import "./ICreatorCore.sol";

/**
 * @dev Core creator implementation
 */
abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
    using Strings for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;
    using AddressUpgradeable for address;

    uint256 internal _tokenCount = 0;

    // Base approve transfers address location
    address internal _approveTransferBase;

    // Track registered extensions data
    EnumerableSet.AddressSet internal _extensions;
    EnumerableSet.AddressSet internal _blacklistedExtensions;

    // The baseURI for a given extension
    mapping (address => string) private _extensionBaseURI;
    mapping (address => bool) private _extensionBaseURIIdentical;

    // The prefix for any tokens with a uri configured
    mapping (address => string) private _extensionURIPrefix;

    // Mapping for individual token URIs
    mapping (uint256 => string) internal _tokenURIs;

    // Royalty configurations
    struct RoyaltyConfig {
        address payable receiver;
        uint16 bps;
    }
    mapping (address => RoyaltyConfig[]) internal _extensionRoyalty;
    mapping (uint256 => RoyaltyConfig[]) internal _tokenRoyalty;

    bytes4 private constant _CREATOR_CORE_V1 = 0x28f10a21;

    /**
     * External interface identifiers for royalties
     */

    /**
     *  @dev CreatorCore
     *
     *  bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
     *
     *  => 0xbb3bafd6 = 0xbb3bafd6
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;

    /**
     *  @dev Rarible: RoyaltiesV1
     *
     *  bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
     *  bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
     *
     *  => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;

    /**
     *  @dev Foundation
     *
     *  bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
     *
     *  => 0xd5a06d4c = 0xd5a06d4c
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;

    /**
     *  @dev EIP-2981
     *
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     *
     * => 0x2a55205a = 0x2a55205a
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(ICreatorCore).interfaceId || interfaceId == _CREATOR_CORE_V1 || super.supportsInterface(interfaceId)
            || interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE || interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE
            || interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;
    }

    /**
     * @dev Only allows registered extensions to call the specified function
     */
    function requireExtension() internal view {
        require(_extensions.contains(msg.sender), "Must be registered extension");
    }

    /**
     * @dev Only allows non-blacklisted extensions
     */
    function requireNonBlacklist(address extension) internal view {
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
    }   

    /**
     * @dev See {ICreatorCore-getExtensions}.
     */
    function getExtensions() external view override returns (address[] memory extensions) {
        extensions = new address[](_extensions.length());
        for (uint i; i < _extensions.length();) {
            extensions[i] = _extensions.at(i);
            unchecked { ++i; }
        }
        return extensions;
    }

    /**
     * @dev Register an extension
     */
    function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal virtual {
        require(extension != address(this) && extension.isContract(), "Invalid");
        emit ExtensionRegistered(extension, msg.sender);
        _extensionBaseURI[extension] = baseURI;
        _extensionBaseURIIdentical[extension] = baseURIIdentical;
        _extensions.add(extension);
        _setApproveTransferExtension(extension, true);
    }

    /**
     * @dev See {ICreatorCore-setApproveTransferExtension}.
     */
    function setApproveTransferExtension(bool enabled) external override {
        requireExtension();
        _setApproveTransferExtension(msg.sender, enabled);
    }

    /**
     * @dev Set whether or not tokens minted by the extension defers transfer approvals to the extension
     */
    function _setApproveTransferExtension(address extension, bool enabled) internal virtual;

    /**
     * @dev Unregister an extension
     */
    function _unregisterExtension(address extension) internal {
        emit ExtensionUnregistered(extension, msg.sender);
        _extensions.remove(extension);
    }

    /**
     * @dev Blacklist an extension
     */
    function _blacklistExtension(address extension) internal {
       require(extension != address(0) && extension != address(this), "Cannot blacklist yourself");
       if (_extensions.contains(extension)) {
           emit ExtensionUnregistered(extension, msg.sender);
           _extensions.remove(extension);
       }
       if (!_blacklistedExtensions.contains(extension)) {
           emit ExtensionBlacklisted(extension, msg.sender);
           _blacklistedExtensions.add(extension);
       }
    }

    /**
     * @dev Set base token uri for an extension
     */
    function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {
        _extensionBaseURI[msg.sender] = uri;
        _extensionBaseURIIdentical[msg.sender] = identical;
    }

    /**
     * @dev Set token uri prefix for an extension
     */
    function _setTokenURIPrefixExtension(string calldata prefix) internal {
        _extensionURIPrefix[msg.sender] = prefix;
    }

    /**
     * @dev Set token uri for a token of an extension
     */
    function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {
        require(_tokenExtension(tokenId) == msg.sender, "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Set base token uri for tokens with no extension
     */
    function _setBaseTokenURI(string calldata uri) internal {
        _extensionBaseURI[address(0)] = uri;
    }

    /**
     * @dev Set token uri prefix for tokens with no extension
     */
    function _setTokenURIPrefix(string calldata prefix) internal {
        _extensionURIPrefix[address(0)] = prefix;
    }


    /**
     * @dev Set token uri for a token with no extension
     */
    function _setTokenURI(uint256 tokenId, string calldata uri) internal {
        require(tokenId > 0 && tokenId <= _tokenCount && _tokenExtension(tokenId) == address(0), "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Retrieve a token's URI
     */
    function _tokenURI(uint256 tokenId) internal view returns (string memory) {
        require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");

        address extension = _tokenExtension(tokenId);
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            if (bytes(_extensionURIPrefix[extension]).length != 0) {
                return string(abi.encodePacked(_extensionURIPrefix[extension], _tokenURIs[tokenId]));
            }
            return _tokenURIs[tokenId];
        }

        if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {
            return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);
        }

        if (!_extensionBaseURIIdentical[extension]) {
            return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));
        } else {
            return _extensionBaseURI[extension];
        }
    }

    /**
     * Helper to get royalties for a token
     */
    function _getRoyalties(uint256 tokenId) view internal returns (address payable[] memory receivers, uint256[] memory bps) {

        // Get token level royalties
        RoyaltyConfig[] memory royalties = _tokenRoyalty[tokenId];
        if (royalties.length == 0) {
            // Get extension specific royalties
            address extension = _tokenExtension(tokenId);
            if (extension != address(0)) {
                if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionRoyalties).interfaceId)) {
                    (receivers, bps) = ICreatorExtensionRoyalties(extension).getRoyalties(address(this), tokenId);
                    // Extension override exists, just return that
                    if (receivers.length > 0) return (receivers, bps);
                }
                royalties = _extensionRoyalty[extension];
            }
        }
        if (royalties.length == 0) {
            // Get the default royalty
            royalties = _extensionRoyalty[address(0)];
        }
        
        if (royalties.length > 0) {
            receivers = new address payable[](royalties.length);
            bps = new uint256[](royalties.length);
            for (uint i; i < royalties.length;) {
                receivers[i] = royalties[i].receiver;
                bps[i] = royalties[i].bps;
                unchecked { ++i; }
            }
        }
    }

    /**
     * Helper to get royalty receivers for a token
     */
    function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] memory recievers) {
        (recievers, ) = _getRoyalties(tokenId);
    }

    /**
     * Helper to get royalty basis points for a token
     */
    function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] memory bps) {
        (, bps) = _getRoyalties(tokenId);
    }

    function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){
        (address payable[] memory receivers, uint256[] memory bps) = _getRoyalties(tokenId);
        require(receivers.length <= 1, "More than 1 royalty receiver");
        
        if (receivers.length == 0) {
            return (address(this), 0);
        }
        return (receivers[0], bps[0]*value/10000);
    }

    /**
     * Set royalties for a token
     */
    function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
       _checkRoyalties(receivers, basisPoints);
        delete _tokenRoyalty[tokenId];
        _setRoyalties(receivers, basisPoints, _tokenRoyalty[tokenId]);
        emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
    }

    /**
     * Set royalties for all tokens of an extension
     */
    function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
        _checkRoyalties(receivers, basisPoints);
        delete _extensionRoyalty[extension];
        _setRoyalties(receivers, basisPoints, _extensionRoyalty[extension]);
        if (extension == address(0)) {
            emit DefaultRoyaltiesUpdated(receivers, basisPoints);
        } else {
            emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
        }
    }

    /**
     * Helper function to check that royalties provided are valid
     */
    function _checkRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) private pure {
        require(receivers.length == basisPoints.length, "Invalid input");
        uint256 totalBasisPoints;
        for (uint i; i < basisPoints.length;) {
            totalBasisPoints += basisPoints[i];
            unchecked { ++i; }
        }
        require(totalBasisPoints < 10000, "Invalid total royalties");
    }

    /**
     * Helper function to set royalties
     */
    function _setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints, RoyaltyConfig[] storage royalties) private {
        for (uint i; i < basisPoints.length;) {
            royalties.push(
                RoyaltyConfig(
                    {
                        receiver: receivers[i],
                        bps: uint16(basisPoints[i])
                    }
                )
            );
            unchecked { ++i; }
        }
    }

    /**
     * @dev Set the base contract's approve transfer contract location
     */
    function _setApproveTransferBase(address extension) internal {
        _approveTransferBase = extension;
        emit ApproveTransferUpdated(extension);
    }

    /**
     * @dev See {ICreatorCore-getApproveTransfer}.
     */
    function getApproveTransfer() external view override returns (address) {
        return _approveTransferBase;
    }

    /**
     * @dev Get the extension for the given token
     */
    function _tokenExtension(uint256 tokenId) internal virtual view returns(address);
}

File 3 of 23 : ICreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Core creator interface
 */
interface ICreatorCore is IERC165 {

    event ExtensionRegistered(address indexed extension, address indexed sender);
    event ExtensionUnregistered(address indexed extension, address indexed sender);
    event ExtensionBlacklisted(address indexed extension, address indexed sender);
    event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);
    event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);
    event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);
    event ApproveTransferUpdated(address extension);
    event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);
    event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);

    /**
     * @dev gets address of all extensions
     */
    function getExtensions() external view returns (address[] memory);

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * Returns True if removed, False if already removed.
     */
    function unregisterExtension(address extension) external;

    /**
     * @dev blacklist an extension.  Can only be called by contract owner or admin.
     * This function will destroy all ability to reference the metadata of any tokens created
     * by the specified extension. It will also unregister the extension if needed.
     * Returns True if removed, False if already removed.
     */
    function blacklistExtension(address extension) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     */
    function setBaseTokenURIExtension(string calldata uri) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURIExtension(string calldata uri, bool identical) external;

    /**
     * @dev set the common prefix of an extension.  Can only be called by extension.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefixExtension(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token extension.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of a token extension for multiple tokens.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;

    /**
     * @dev set the baseTokenURI for tokens with no extension.  Can only be called by owner/admin.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURI(string calldata uri) external;

    /**
     * @dev set the common prefix for tokens with no extension.  Can only be called by owner/admin.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefix(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of multiple tokens with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;

    /**
     * @dev set a permissions contract for an extension.  Used to control minting.
     */
    function setMintPermissions(address extension, address permissions) external;

    /**
     * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval
     * from the extension before transferring
     */
    function setApproveTransferExtension(bool enabled) external;

    /**
     * @dev get the extension of a given token
     */
    function tokenExtension(uint256 tokenId) external view returns (address);

    /**
     * @dev Set default royalties
     */
    function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of a token
     */
    function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of an extension
     */
    function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Get royalites of a token.  Returns list of receivers and basisPoints
     */
    function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    
    // Royalty support for various other standards
    function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
    function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
    function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);

    /**
     * @dev Set the default approve transfer contract location.
     */
    function setApproveTransfer(address extension) external; 

    /**
     * @dev Get the default approve transfer contract location.
     */
    function getApproveTransfer() external view returns (address);
}

File 4 of 23 : IERC1155CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./CreatorCore.sol";

/**
 * @dev Core ERC1155 creator interface
 */
interface IERC1155CreatorCore is ICreatorCore {

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintBaseNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token with no extension. Can only be called by an admin.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintBaseExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev mint a token from an extension. Can only be called by a registered extension.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintExtensionNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token from extension. Can only be called by a registered extension.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev burn tokens. Can only be called by token owner or approved address.
     * On burn, calls back to the registered extension's onBurn method
     */
    function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev Total amount of tokens in with a given tokenId.
     */
    function totalSupply(uint256 tokenId) external view returns (uint256);
}

File 5 of 23 : IERC721CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./ICreatorCore.sol";

/**
 * @dev Core ERC721 creator interface
 */
interface IERC721CreatorCore is ICreatorCore {

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBase(address to) external returns (uint256);

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBase(address to, string calldata uri) external returns (uint256);

    /**
     * @dev batch mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);

    /**
     * @dev batch mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBaseBatch(address to, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtension(address to) external returns (uint256);

    /**
     * @dev mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtension(address to, string calldata uri) external returns (uint256);

    /**
     * @dev mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtension(address to, uint80 data) external returns (uint256);

    /**
     * @dev batch mint a token. Can only be called by a registered extension.
     * Returns tokenIds minted
     */
    function mintExtensionBatch(address to, uint16 count) external returns (uint256[] memory);

    /**
     * @dev batch mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtensionBatch(address to, uint80[] calldata data) external returns (uint256[] memory);

    /**
     * @dev burn a token. Can only be called by token owner or approved address.
     * On burn, calls back to the registered extension's onBurn method
     */
    function burn(uint256 tokenId) external;

    /**
     * @dev get token data
     */
    function tokenData(uint256 tokenId) external view returns (uint80);

}

File 6 of 23 : ICreatorExtensionRoyalties.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Implement this if you want your extension to have overloadable royalties
 */
interface ICreatorExtensionRoyalties is IERC165 {

    /**
     * Get the royalties for a given creator/tokenId
     */
    function getRoyalties(address creator, uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
}

File 7 of 23 : ICreatorExtensionTokenURI.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Implement this if you want your extension to have overloadable URI's
 */
interface ICreatorExtensionTokenURI is IERC165 {

    /**
     * Get the uri for a given creator/tokenId
     */
    function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}

File 8 of 23 : AdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAdminControl.sol";

abstract contract AdminControl is Ownable, IAdminControl, ERC165 {
    using EnumerableSet for EnumerableSet.AddressSet;

    // Track registered admins
    EnumerableSet.AddressSet private _admins;

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

    /**
     * @dev Only allows approved admins to call the specified function
     */
    modifier adminRequired() {
        require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
        _;
    }   

    /**
     * @dev See {IAdminControl-getAdmins}.
     */
    function getAdmins() external view override returns (address[] memory admins) {
        admins = new address[](_admins.length());
        for (uint i = 0; i < _admins.length(); i++) {
            admins[i] = _admins.at(i);
        }
        return admins;
    }

    /**
     * @dev See {IAdminControl-approveAdmin}.
     */
    function approveAdmin(address admin) external override onlyOwner {
        if (!_admins.contains(admin)) {
            emit AdminApproved(admin, msg.sender);
            _admins.add(admin);
        }
    }

    /**
     * @dev See {IAdminControl-revokeAdmin}.
     */
    function revokeAdmin(address admin) external override onlyOwner {
        if (_admins.contains(admin)) {
            emit AdminRevoked(admin, msg.sender);
            _admins.remove(admin);
        }
    }

    /**
     * @dev See {IAdminControl-isAdmin}.
     */
    function isAdmin(address admin) public override view returns (bool) {
        return (owner() == admin || _admins.contains(admin));
    }

}

File 9 of 23 : IAdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Interface for admin control
 */
interface IAdminControl is IERC165 {

    event AdminApproved(address indexed account, address indexed sender);
    event AdminRevoked(address indexed account, address indexed sender);

    /**
     * @dev gets address of all admins
     */
    function getAdmins() external view returns (address[] memory);

    /**
     * @dev add an admin.  Can only be called by contract owner.
     */
    function approveAdmin(address admin) external;

    /**
     * @dev remove an admin.  Can only be called by contract owner.
     */
    function revokeAdmin(address admin) external;

    /**
     * @dev checks whether or not given address is an admin
     * Returns True if they are
     */
    function isAdmin(address admin) external view returns (bool);

}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

File 11 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 12 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 15 of 23 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface.
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     *
     * Some precompiled contracts will falsely indicate support for a given interface, so caution
     * should be exercised when using this function.
     *
     * Interface identification is specified in ERC-165.
     */
    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 19 of 23 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 20 of 23 : Base64.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
    bytes internal constant TABLE =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// @notice Encodes some bytes to the base64 representation
    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
                )
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

File 21 of 23 : Bytecode.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


library Bytecode {
  error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end);

  /**
    @notice Generate a creation code that results on a contract with `_code` as bytecode
    @param _code The returning value of the resulting `creationCode`
    @return creationCode (constructor) for new contract
  */
  function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) {
    /*
      0x00    0x63         0x63XXXXXX  PUSH4 _code.length  size
      0x01    0x80         0x80        DUP1                size size
      0x02    0x60         0x600e      PUSH1 14            14 size size
      0x03    0x60         0x6000      PUSH1 00            0 14 size size
      0x04    0x39         0x39        CODECOPY            size
      0x05    0x60         0x6000      PUSH1 00            0 size
      0x06    0xf3         0xf3        RETURN
      <CODE>
    */

    return abi.encodePacked(
      hex"63",
      uint32(_code.length),
      hex"80_60_0E_60_00_39_60_00_F3",
      _code
    );
  }

  /**
    @notice Returns the size of the code on a given address
    @param _addr Address that may or may not contain code
    @return size of the code on the given `_addr`
  */
  function codeSize(address _addr) internal view returns (uint256 size) {
    assembly { size := extcodesize(_addr) }
  }

  /**
    @notice Returns the code of a given address
    @dev It will fail if `_end < _start`
    @param _addr Address that may or may not contain code
    @param _start number of bytes of code to skip on read
    @param _end index before which to end extraction
    @return oCode read from `_addr` deployed bytecode

    Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd
  */
  function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) {
    uint256 csize = codeSize(_addr);
    if (csize == 0) return bytes("");

    if (_start > csize) return bytes("");
    if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); 

    unchecked {
      uint256 reqSize = _end - _start;
      uint256 maxSize = csize - _start;

      uint256 size = maxSize < reqSize ? maxSize : reqSize;

      assembly {
        // allocate output byte array - this could also be done without assembly
        // by using o_code = new bytes(size)
        oCode := mload(0x40)
        // new "memory end" including padding
        mstore(0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f))))
        // store length in memory
        mstore(oCode, size)
        // actually retrieve the code, this needs assembly
        extcodecopy(_addr, add(oCode, 0x20), _start, size)
      }
    }
  }
}

File 22 of 23 : InflateLib.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0 <0.9.0;

/// @notice Based on https://github.com/madler/zlib/blob/master/contrib/puff
library InflateLib {
    // Maximum bits in a code
    uint256 constant MAXBITS = 15;
    // Maximum number of literal/length codes
    uint256 constant MAXLCODES = 286;
    // Maximum number of distance codes
    uint256 constant MAXDCODES = 30;
    // Maximum codes lengths to read
    uint256 constant MAXCODES = (MAXLCODES + MAXDCODES);
    // Number of fixed literal/length codes
    uint256 constant FIXLCODES = 288;

    // Error codes
    enum ErrorCode {
        ERR_NONE, // 0 successful inflate
        ERR_NOT_TERMINATED, // 1 available inflate data did not terminate
        ERR_OUTPUT_EXHAUSTED, // 2 output space exhausted before completing inflate
        ERR_INVALID_BLOCK_TYPE, // 3 invalid block type (type == 3)
        ERR_STORED_LENGTH_NO_MATCH, // 4 stored block length did not match one's complement
        ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES, // 5 dynamic block code description: too many length or distance codes
        ERR_CODE_LENGTHS_CODES_INCOMPLETE, // 6 dynamic block code description: code lengths codes incomplete
        ERR_REPEAT_NO_FIRST_LENGTH, // 7 dynamic block code description: repeat lengths with no first length
        ERR_REPEAT_MORE, // 8 dynamic block code description: repeat more than specified lengths
        ERR_INVALID_LITERAL_LENGTH_CODE_LENGTHS, // 9 dynamic block code description: invalid literal/length code lengths
        ERR_INVALID_DISTANCE_CODE_LENGTHS, // 10 dynamic block code description: invalid distance code lengths
        ERR_MISSING_END_OF_BLOCK, // 11 dynamic block code description: missing end-of-block code
        ERR_INVALID_LENGTH_OR_DISTANCE_CODE, // 12 invalid literal/length or distance code in fixed or dynamic block
        ERR_DISTANCE_TOO_FAR, // 13 distance is too far back in fixed or dynamic block
        ERR_CONSTRUCT // 14 internal: error in construct()
    }

    // Input and output state
    struct State {
        //////////////////
        // Output state //
        //////////////////
        // Output buffer
        bytes output;
        // Bytes written to out so far
        uint256 outcnt;
        /////////////////
        // Input state //
        /////////////////
        // Input buffer
        bytes input;
        // Bytes read so far
        uint256 incnt;
        ////////////////
        // Temp state //
        ////////////////
        // Bit buffer
        uint256 bitbuf;
        // Number of bits in bit buffer
        uint256 bitcnt;
        //////////////////////////
        // Static Huffman codes //
        //////////////////////////
        Huffman lencode;
        Huffman distcode;
    }

    // Huffman code decoding tables
    struct Huffman {
        uint256[] counts;
        uint256[] symbols;
    }

    function bits(State memory s, uint256 need)
        private
        pure
        returns (ErrorCode, uint256)
    {
        // Bit accumulator (can use up to 20 bits)
        uint256 val;

        // Load at least need bits into val
        val = s.bitbuf;
        while (s.bitcnt < need) {
            if (s.incnt == s.input.length) {
                // Out of input
                return (ErrorCode.ERR_NOT_TERMINATED, 0);
            }

            // Load eight bits
            val |= uint256(uint8(s.input[s.incnt++])) << s.bitcnt;
            s.bitcnt += 8;
        }

        // Drop need bits and update buffer, always zero to seven bits left
        s.bitbuf = val >> need;
        s.bitcnt -= need;

        // Return need bits, zeroing the bits above that
        uint256 ret = (val & ((1 << need) - 1));
        return (ErrorCode.ERR_NONE, ret);
    }

    function _stored(State memory s) private pure returns (ErrorCode) {
        // Length of stored block
        uint256 len;

        // Discard leftover bits from current byte (assumes s.bitcnt < 8)
        s.bitbuf = 0;
        s.bitcnt = 0;

        // Get length and check against its one's complement
        if (s.incnt + 4 > s.input.length) {
            // Not enough input
            return ErrorCode.ERR_NOT_TERMINATED;
        }
        len = uint256(uint8(s.input[s.incnt++]));
        len |= uint256(uint8(s.input[s.incnt++])) << 8;

        if (
            uint8(s.input[s.incnt++]) != (~len & 0xFF) ||
            uint8(s.input[s.incnt++]) != ((~len >> 8) & 0xFF)
        ) {
            // Didn't match complement!
            return ErrorCode.ERR_STORED_LENGTH_NO_MATCH;
        }

        // Copy len bytes from in to out
        if (s.incnt + len > s.input.length) {
            // Not enough input
            return ErrorCode.ERR_NOT_TERMINATED;
        }
        if (s.outcnt + len > s.output.length) {
            // Not enough output space
            return ErrorCode.ERR_OUTPUT_EXHAUSTED;
        }
        while (len != 0) {
            // Note: Solidity reverts on underflow, so we decrement here
            len -= 1;
            s.output[s.outcnt++] = s.input[s.incnt++];
        }

        // Done with a valid stored block
        return ErrorCode.ERR_NONE;
    }

    function _decode(State memory s, Huffman memory h)
        private
        pure
        returns (ErrorCode, uint256)
    {
        // Current number of bits in code
        uint256 len;
        // Len bits being decoded
        uint256 code = 0;
        // First code of length len
        uint256 first = 0;
        // Number of codes of length len
        uint256 count;
        // Index of first code of length len in symbol table
        uint256 index = 0;
        // Error code
        ErrorCode err;

        for (len = 1; len <= MAXBITS; len++) {
            // Get next bit
            uint256 tempCode;
            (err, tempCode) = bits(s, 1);
            if (err != ErrorCode.ERR_NONE) {
                return (err, 0);
            }
            code |= tempCode;
            count = h.counts[len];

            // If length len, return symbol
            if (code < first + count) {
                return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
            }
            // Else update for next length
            index += count;
            first += count;
            first <<= 1;
            code <<= 1;
        }

        // Ran out of codes
        return (ErrorCode.ERR_INVALID_LENGTH_OR_DISTANCE_CODE, 0);
    }

    function _construct(
        Huffman memory h,
        uint256[] memory lengths,
        uint256 n,
        uint256 start
    ) private pure returns (ErrorCode) {
        // Current symbol when stepping through lengths[]
        uint256 symbol;
        // Current length when stepping through h.counts[]
        uint256 len;
        // Number of possible codes left of current length
        uint256 left;
        // Offsets in symbol table for each length
        uint256[MAXBITS + 1] memory offs;

        // Count number of codes of each length
        for (len = 0; len <= MAXBITS; len++) {
            h.counts[len] = 0;
        }
        for (symbol = 0; symbol < n; symbol++) {
            // Assumes lengths are within bounds
            h.counts[lengths[start + symbol]]++;
        }
        // No codes!
        if (h.counts[0] == n) {
            // Complete, but decode() will fail
            return (ErrorCode.ERR_NONE);
        }

        // Check for an over-subscribed or incomplete set of lengths

        // One possible code of zero length
        left = 1;

        for (len = 1; len <= MAXBITS; len++) {
            // One more bit, double codes left
            left <<= 1;
            if (left < h.counts[len]) {
                // Over-subscribed--return error
                return ErrorCode.ERR_CONSTRUCT;
            }
            // Deduct count from possible codes

            left -= h.counts[len];
        }

        // Generate offsets into symbol table for each length for sorting
        offs[1] = 0;
        for (len = 1; len < MAXBITS; len++) {
            offs[len + 1] = offs[len] + h.counts[len];
        }

        // Put symbols in table sorted by length, by symbol order within each length
        for (symbol = 0; symbol < n; symbol++) {
            if (lengths[start + symbol] != 0) {
                h.symbols[offs[lengths[start + symbol]]++] = symbol;
            }
        }

        // Left > 0 means incomplete
        return left > 0 ? ErrorCode.ERR_CONSTRUCT : ErrorCode.ERR_NONE;
    }

    function _codes(
        State memory s,
        Huffman memory lencode,
        Huffman memory distcode
    ) private pure returns (ErrorCode) {
        // Decoded symbol
        uint256 symbol;
        // Length for copy
        uint256 len;
        // Distance for copy
        uint256 dist;
        // TODO Solidity doesn't support constant arrays, but these are fixed at compile-time
        // Size base for length codes 257..285
        uint16[29] memory lens =
            [
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10,
                11,
                13,
                15,
                17,
                19,
                23,
                27,
                31,
                35,
                43,
                51,
                59,
                67,
                83,
                99,
                115,
                131,
                163,
                195,
                227,
                258
            ];
        // Extra bits for length codes 257..285
        uint8[29] memory lext =
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                1,
                1,
                1,
                1,
                2,
                2,
                2,
                2,
                3,
                3,
                3,
                3,
                4,
                4,
                4,
                4,
                5,
                5,
                5,
                5,
                0
            ];
        // Offset base for distance codes 0..29
        uint16[30] memory dists =
            [
                1,
                2,
                3,
                4,
                5,
                7,
                9,
                13,
                17,
                25,
                33,
                49,
                65,
                97,
                129,
                193,
                257,
                385,
                513,
                769,
                1025,
                1537,
                2049,
                3073,
                4097,
                6145,
                8193,
                12289,
                16385,
                24577
            ];
        // Extra bits for distance codes 0..29
        uint8[30] memory dext =
            [
                0,
                0,
                0,
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                6,
                6,
                7,
                7,
                8,
                8,
                9,
                9,
                10,
                10,
                11,
                11,
                12,
                12,
                13,
                13
            ];
        // Error code
        ErrorCode err;

        // Decode literals and length/distance pairs
        while (symbol != 256) {
            (err, symbol) = _decode(s, lencode);
            if (err != ErrorCode.ERR_NONE) {
                // Invalid symbol
                return err;
            }

            if (symbol < 256) {
                // Literal: symbol is the byte
                // Write out the literal
                if (s.outcnt == s.output.length) {
                    return ErrorCode.ERR_OUTPUT_EXHAUSTED;
                }
                s.output[s.outcnt] = bytes1(uint8(symbol));
                s.outcnt++;
            } else if (symbol > 256) {
                uint256 tempBits;
                // Length
                // Get and compute length
                symbol -= 257;
                if (symbol >= 29) {
                    // Invalid fixed code
                    return ErrorCode.ERR_INVALID_LENGTH_OR_DISTANCE_CODE;
                }

                (err, tempBits) = bits(s, lext[symbol]);
                if (err != ErrorCode.ERR_NONE) {
                    return err;
                }
                len = lens[symbol] + tempBits;

                // Get and check distance
                (err, symbol) = _decode(s, distcode);
                if (err != ErrorCode.ERR_NONE) {
                    // Invalid symbol
                    return err;
                }
                (err, tempBits) = bits(s, dext[symbol]);
                if (err != ErrorCode.ERR_NONE) {
                    return err;
                }
                dist = dists[symbol] + tempBits;
                if (dist > s.outcnt) {
                    // Distance too far back
                    return ErrorCode.ERR_DISTANCE_TOO_FAR;
                }

                // Copy length bytes from distance bytes back
                if (s.outcnt + len > s.output.length) {
                    return ErrorCode.ERR_OUTPUT_EXHAUSTED;
                }
                while (len != 0) {
                    // Note: Solidity reverts on underflow, so we decrement here
                    len -= 1;
                    s.output[s.outcnt] = s.output[s.outcnt - dist];
                    s.outcnt++;
                }
            } else {
                s.outcnt += len;
            }
        }

        // Done with a valid fixed or dynamic block
        return ErrorCode.ERR_NONE;
    }

    function _build_fixed(State memory s) private pure returns (ErrorCode) {
        // Build fixed Huffman tables
        // TODO this is all a compile-time constant
        uint256 symbol;
        uint256[] memory lengths = new uint256[](FIXLCODES);

        // Literal/length table
        for (symbol = 0; symbol < 144; symbol++) {
            lengths[symbol] = 8;
        }
        for (; symbol < 256; symbol++) {
            lengths[symbol] = 9;
        }
        for (; symbol < 280; symbol++) {
            lengths[symbol] = 7;
        }
        for (; symbol < FIXLCODES; symbol++) {
            lengths[symbol] = 8;
        }

        _construct(s.lencode, lengths, FIXLCODES, 0);

        // Distance table
        for (symbol = 0; symbol < MAXDCODES; symbol++) {
            lengths[symbol] = 5;
        }

        _construct(s.distcode, lengths, MAXDCODES, 0);

        return ErrorCode.ERR_NONE;
    }

    function _fixed(State memory s) private pure returns (ErrorCode) {
        // Decode data until end-of-block code
        return _codes(s, s.lencode, s.distcode);
    }

    function _build_dynamic_lengths(State memory s)
        private
        pure
        returns (ErrorCode, uint256[] memory)
    {
        uint256 ncode;
        // Index of lengths[]
        uint256 index;
        // Descriptor code lengths
        uint256[] memory lengths = new uint256[](MAXCODES);
        // Error code
        ErrorCode err;
        // Permutation of code length codes
        uint8[19] memory order =
            [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];

        (err, ncode) = bits(s, 4);
        if (err != ErrorCode.ERR_NONE) {
            return (err, lengths);
        }
        ncode += 4;

        // Read code length code lengths (really), missing lengths are zero
        for (index = 0; index < ncode; index++) {
            (err, lengths[order[index]]) = bits(s, 3);
            if (err != ErrorCode.ERR_NONE) {
                return (err, lengths);
            }
        }
        for (; index < 19; index++) {
            lengths[order[index]] = 0;
        }

        return (ErrorCode.ERR_NONE, lengths);
    }

    function _build_dynamic(State memory s)
        private
        pure
        returns (
            ErrorCode,
            Huffman memory,
            Huffman memory
        )
    {
        // Number of lengths in descriptor
        uint256 nlen;
        uint256 ndist;
        // Index of lengths[]
        uint256 index;
        // Error code
        ErrorCode err;
        // Descriptor code lengths
        uint256[] memory lengths = new uint256[](MAXCODES);
        // Length and distance codes
        Huffman memory lencode =
            Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXLCODES));
        Huffman memory distcode =
            Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXDCODES));
        uint256 tempBits;

        // Get number of lengths in each table, check lengths
        (err, nlen) = bits(s, 5);
        if (err != ErrorCode.ERR_NONE) {
            return (err, lencode, distcode);
        }
        nlen += 257;
        (err, ndist) = bits(s, 5);
        if (err != ErrorCode.ERR_NONE) {
            return (err, lencode, distcode);
        }
        ndist += 1;

        if (nlen > MAXLCODES || ndist > MAXDCODES) {
            // Bad counts
            return (
                ErrorCode.ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES,
                lencode,
                distcode
            );
        }

        (err, lengths) = _build_dynamic_lengths(s);
        if (err != ErrorCode.ERR_NONE) {
            return (err, lencode, distcode);
        }

        // Build huffman table for code lengths codes (use lencode temporarily)
        err = _construct(lencode, lengths, 19, 0);
        if (err != ErrorCode.ERR_NONE) {
            // Require complete code set here
            return (
                ErrorCode.ERR_CODE_LENGTHS_CODES_INCOMPLETE,
                lencode,
                distcode
            );
        }

        // Read length/literal and distance code length tables
        index = 0;
        while (index < nlen + ndist) {
            // Decoded value
            uint256 symbol;
            // Last length to repeat
            uint256 len;

            (err, symbol) = _decode(s, lencode);
            if (err != ErrorCode.ERR_NONE) {
                // Invalid symbol
                return (err, lencode, distcode);
            }

            if (symbol < 16) {
                // Length in 0..15
                lengths[index++] = symbol;
            } else {
                // Repeat instruction
                // Assume repeating zeros
                len = 0;
                if (symbol == 16) {
                    // Repeat last length 3..6 times
                    if (index == 0) {
                        // No last length!
                        return (
                            ErrorCode.ERR_REPEAT_NO_FIRST_LENGTH,
                            lencode,
                            distcode
                        );
                    }
                    // Last length
                    len = lengths[index - 1];
                    (err, tempBits) = bits(s, 2);
                    if (err != ErrorCode.ERR_NONE) {
                        return (err, lencode, distcode);
                    }
                    symbol = 3 + tempBits;
                } else if (symbol == 17) {
                    // Repeat zero 3..10 times
                    (err, tempBits) = bits(s, 3);
                    if (err != ErrorCode.ERR_NONE) {
                        return (err, lencode, distcode);
                    }
                    symbol = 3 + tempBits;
                } else {
                    // == 18, repeat zero 11..138 times
                    (err, tempBits) = bits(s, 7);
                    if (err != ErrorCode.ERR_NONE) {
                        return (err, lencode, distcode);
                    }
                    symbol = 11 + tempBits;
                }

                if (index + symbol > nlen + ndist) {
                    // Too many lengths!
                    return (ErrorCode.ERR_REPEAT_MORE, lencode, distcode);
                }
                while (symbol != 0) {
                    // Note: Solidity reverts on underflow, so we decrement here
                    symbol -= 1;

                    // Repeat last or zero symbol times
                    lengths[index++] = len;
                }
            }
        }

        // Check for end-of-block code -- there better be one!
        if (lengths[256] == 0) {
            return (ErrorCode.ERR_MISSING_END_OF_BLOCK, lencode, distcode);
        }

        // Build huffman table for literal/length codes
        err = _construct(lencode, lengths, nlen, 0);
        if (
            err != ErrorCode.ERR_NONE &&
            (err == ErrorCode.ERR_NOT_TERMINATED ||
                err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
                nlen != lencode.counts[0] + lencode.counts[1])
        ) {
            // Incomplete code ok only for single length 1 code
            return (
                ErrorCode.ERR_INVALID_LITERAL_LENGTH_CODE_LENGTHS,
                lencode,
                distcode
            );
        }

        // Build huffman table for distance codes
        err = _construct(distcode, lengths, ndist, nlen);
        if (
            err != ErrorCode.ERR_NONE &&
            (err == ErrorCode.ERR_NOT_TERMINATED ||
                err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
                ndist != distcode.counts[0] + distcode.counts[1])
        ) {
            // Incomplete code ok only for single length 1 code
            return (
                ErrorCode.ERR_INVALID_DISTANCE_CODE_LENGTHS,
                lencode,
                distcode
            );
        }

        return (ErrorCode.ERR_NONE, lencode, distcode);
    }

    function _dynamic(State memory s) private pure returns (ErrorCode) {
        // Length and distance codes
        Huffman memory lencode;
        Huffman memory distcode;
        // Error code
        ErrorCode err;

        (err, lencode, distcode) = _build_dynamic(s);
        if (err != ErrorCode.ERR_NONE) {
            return err;
        }

        // Decode data until end-of-block code
        return _codes(s, lencode, distcode);
    }

    function puff(bytes memory source, uint256 destlen)
        internal
        pure
        returns (ErrorCode, bytes memory)
    {
        // Input/output state
        State memory s =
            State(
                new bytes(destlen),
                0,
                source,
                0,
                0,
                0,
                Huffman(new uint256[](MAXBITS + 1), new uint256[](FIXLCODES)),
                Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXDCODES))
            );
        // Temp: last bit
        uint256 last;
        // Temp: block type bit
        uint256 t;
        // Error code
        ErrorCode err;

        // Build fixed Huffman tables
        err = _build_fixed(s);
        if (err != ErrorCode.ERR_NONE) {
            return (err, s.output);
        }

        // Process blocks until last block or error
        while (last == 0) {
            // One if last block
            (err, last) = bits(s, 1);
            if (err != ErrorCode.ERR_NONE) {
                return (err, s.output);
            }

            // Block type 0..3
            (err, t) = bits(s, 2);
            if (err != ErrorCode.ERR_NONE) {
                return (err, s.output);
            }

            err = (
                t == 0
                    ? _stored(s)
                    : (
                        t == 1
                            ? _fixed(s)
                            : (
                                t == 2
                                    ? _dynamic(s)
                                    : ErrorCode.ERR_INVALID_BLOCK_TYPE
                            )
                    )
            );
            // type == 3, invalid

            if (err != ErrorCode.ERR_NONE) {
                // Return with error
                break;
            }
        }

        return (err, s.output);
    }
}

File 23 of 23 : SSTORE2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./Bytecode.sol";

/**
  @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost.
  @author Agustin Aguilar <[email protected]>

  Readme: https://github.com/0xsequence/sstore2#readme
*/
library SSTORE2 {
  error WriteError();

  /**
    @notice Stores `_data` and returns `pointer` as key for later retrieval
    @dev The pointer is a contract address with `_data` as code
    @param _data to be written
    @return pointer Pointer to the written `_data`
  */
  function write(bytes memory _data) internal returns (address pointer) {
    // Append 00 to _data so contract can't be called
    // Build init code
    bytes memory code = Bytecode.creationCodeFor(
      abi.encodePacked(
        hex'00',
        _data
      )
    );

    // Deploy contract using create
    assembly { pointer := create(0, add(code, 32), mload(code)) }

    // Address MUST be non-zero
    if (pointer == address(0)) revert WriteError();
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @return data read from `_pointer` contract
  */
  function read(address _pointer) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, 1, type(uint256).max);
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @param _start number of bytes to skip
    @return data read from `_pointer` contract
  */
  function read(address _pointer, uint256 _start) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max);
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @param _start number of bytes to skip
    @param _end index before which to end extraction
    @return data read from `_pointer` contract
  */
  function read(address _pointer, uint256 _start, uint256 _end) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, _start + 1, _end + 1);
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"InvalidCodeAtRange","type":"error"},{"inputs":[],"name":"WriteError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes[]","name":"chunks","type":"bytes[]"}],"name":"appendChunks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"inflate","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"components":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bool","name":"deflated","type":"bool"},{"internalType":"uint256","name":"totalLength","type":"uint256"}],"internalType":"struct Efficax.Options","name":"options","type":"tuple"},{"internalType":"bytes[]","name":"image","type":"bytes[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"components":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bool","name":"deflated","type":"bool"},{"internalType":"uint256","name":"totalLength","type":"uint256"}],"internalType":"struct Efficax.Options","name":"options","type":"tuple"},{"internalType":"bytes[]","name":"image","type":"bytes[]"}],"name":"mint1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"pack","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","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":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"},{"internalType":"bool","name":"deflated","type":"bool"},{"internalType":"uint256","name":"totalLength","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes[]","name":"image","type":"bytes[]"},{"components":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bool","name":"deflated","type":"bool"},{"internalType":"uint256","name":"totalLength","type":"uint256"}],"internalType":"struct Efficax.Options","name":"options","type":"tuple"}],"name":"updateToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506200001d3362000023565b62000073565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6141a880620000836000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80636d73e669116100975780638da5cb5b116100665780638da5cb5b14610214578063b3bd50b31461022f578063e9dc637514610242578063f2fde38b1461025557600080fd5b80636d73e669146101d3578063715018a6146101e65780637b00b0e0146101ee5780637b631b691461020157600080fd5b806324d7806c116100d357806324d7806c146101785780632d3456701461018b57806331ae450b1461019e5780633d093a9f146101b357600080fd5b806301ffc9a7146101055780630b2be0011461012d5780631d2d0c0d1461014257806324ba432814610155575b600080fd5b61011861011336600461369f565b610268565b60405190151581526020015b60405180910390f35b61014061013b36600461373c565b6102bb565b005b61014061015036600461373c565b6105c6565b6101686101633660046137b3565b61097e565b604051610124949392919061382d565b610118610186366004613866565b610ac5565b610140610199366004613866565b610afe565b6101a6610b5c565b60405161012491906138c5565b6101c66101c13660046137b3565b610c0b565b60405161012491906138d8565b6101406101e1366004613866565b610db2565b610140610e0a565b6101406101fc3660046138eb565b610e1e565b6101c661020f366004613980565b610f83565b6000546040516001600160a01b039091168152602001610124565b61014061023d366004613a1a565b610fbd565b6101c66102503660046137b3565b61123c565b610140610263366004613866565b61132e565b60006001600160e01b031982167fe9dc63750000000000000000000000000000000000000000000000000000000014806102a657506102a6826113bb565b806102b557506102b5826113bb565b92915050565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103279190613aac565b61038c5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b03881690632928ca58906024016020604051808303816000875af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104129190613ac9565b905061041e8680613ae2565b6001600160a01b038916600090815260036020908152604080832086845290915290209161044d919083613bac565b5061045b6020870187613ae2565b6001600160a01b038916600090815260036020908152604080832086845290915290206001019161048d919083613bac565b5061049e6080870160608801613c6d565b6001600160a01b03881660009081526003602081815260408084208685529091528220908101805460ff19169315159390931790925560808801356004909201919091555b60ff81168511156105bc576001600160a01b03881660009081526003602090815260408083208584529091529020600201610578878760ff851681811061052c5761052c613c8a565b905060200281019061053e9190613ae2565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061142292505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055806105b481613cb6565b9150506104e3565b5050505050505050565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190613aac565b6106925760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816106ef579050509050338360008151811061071a5761071a613c8a565b60200260200101906001600160a01b031690816001600160a01b03168152505087604001358260008151811061075257610752613c8a565b60209081029190910101526040517f8c6e84720000000000000000000000000000000000000000000000000000000081526000906001600160a01b038b1690638c6e8472906107a990879087908790600401613cd5565b6000604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107f09190810190613d80565b905060008160008151811061080757610807613c8a565b6020908102919091010151905061081e8a80613ae2565b6001600160a01b038d16600090815260036020908152604080832086845290915290209161084d919083613bac565b5061085b60208b018b613ae2565b6001600160a01b038d16600090815260036020908152604080832086845290915290206001019161088d919083613bac565b5061089e60808b0160608c01613c6d565b6001600160a01b038c1660009081526003602081815260408084208685529091528220908101805460ff19169315159390931790925560808c01356004909201919091555b60ff8116891115610970576001600160a01b038c166000908152600360209081526040808320858452909152902060020161092c8b8b60ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061096881613cb6565b9150506108e3565b505050505050505050505050565b60036020908152600092835260408084209091529082529020805481906109a490613b29565b80601f01602080910402602001604051908101604052809291908181526020018280546109d090613b29565b8015610a1d5780601f106109f257610100808354040283529160200191610a1d565b820191906000526020600020905b815481529060010190602001808311610a0057829003601f168201915b505050505090806001018054610a3290613b29565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5e90613b29565b8015610aab5780601f10610a8057610100808354040283529160200191610aab565b820191906000526020600020905b815481529060010190602001808311610a8e57829003601f168201915b505050506003830154600490930154919260ff1691905084565b6000816001600160a01b0316610ae36000546001600160a01b031690565b6001600160a01b031614806102b557506102b56001836114a0565b610b066114c5565b610b116001826114a0565b15610b595760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610b5760018261151f565b505b50565b6060610b686001611534565b67ffffffffffffffff811115610b8057610b80613939565b604051908082528060200260200182016040528015610ba9578160200160208202803683370190505b50905060005b610bb96001611534565b811015610c0757610bcb60018261153e565b828281518110610bdd57610bdd613c8a565b6001600160a01b039092166020928302919091019091015280610bff81613e26565b915050610baf565b5090565b6001600160a01b03821660009081526003602090815260408083208484528252808320905160609392610c42926001019101613eb2565b6040516020818303038152906040529050606060005b6001600160a01b038616600090815260036020908152604080832088845290915290206002015460ff82161015610d19576001600160a01b0386166000908152600360209081526040808320888452909152902060020180548391610ce49160ff8516908110610cca57610cca613c8a565b6000918252602090912001546001600160a01b031661154a565b604051602001610cf5929190613f11565b60405160208183030381529060405291508080610d1190613cb6565b915050610c58565b506001600160a01b0385166000908152600360208181526040808420888552909152909120015460ff1615610d7e576001600160a01b0385166000908152600360209081526040808320878452909152902060040154610d7a90829061155a565b9150505b81610d8882611808565b604051602001610d99929190613f11565b60408051808303601f1901815291905295945050505050565b610dba6114c5565b610dc56001826114a0565b610b595760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a3610b576001826119a9565b610e126114c5565b610e1c60006119be565b565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610e66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8a9190613aac565b610eea5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60005b60ff8116841115610f7a576001600160a01b03871660009081526003602090815260408083208984529091529020600201610f36868660ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610f7281613cb6565b915050610eed565b50505050505050565b60606000610f91848461155a565b91505080604051602001610fa59190613f40565b60405160208183030381529060405291505092915050565b604051630935e01b60e21b8152336004820152859081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611005573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110299190613aac565b6110895760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60006110958480613ae2565b905011156110d8576110a78380613ae2565b6001600160a01b03891660009081526003602090815260408083208b84529091529020916110d6919083613bac565b505b60006110e76020850185613ae2565b90501115611130576110fc6020840184613ae2565b6001600160a01b03891660009081526003602090815260408083208b845290915290206001019161112e919083613bac565b505b6111406080840160608501613c6d565b6001600160a01b03881660009081526003602081815260408084208b855290915290912001805460ff19169115159190911790558315610f7a576001600160a01b038716600090815260036020908152604080832089845290915281206111ac9160029091019061364d565b60005b60ff81168511156105bc576001600160a01b03881660009081526003602090815260408083208a845290915290206002016111f8878760ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061123481613cb6565b9150506111af565b6001600160a01b0382166000908152600360209081526040808320848452909152812060020154606091036112d95760405162461bcd60e51b815260206004820152602160248201527f546f6b656e206d6574616461746120646f65736e27742065786973742068657260448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610383565b6001600160a01b038316600090815260036020908152604080832085845290915290206113068484610c0b565b604051602001611317929190613f5c565b604051602081830303815290604052905092915050565b6113366114c5565b6001600160a01b0381166113b25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610383565b610b59816119be565b60006001600160e01b031982167f553e757e0000000000000000000000000000000000000000000000000000000014806102b557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146102b5565b60008061144d836040516020016114399190613ffa565b604051602081830303815290604052611a0e565b90508051602082016000f091506001600160a01b03821661149a576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b03163314610e1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610383565b60006114be836001600160a01b038416611a3a565b60006102b5825490565b60006114be8383611b2d565b60606102b5826001600019611b57565b6000606060006040518061010001604052808567ffffffffffffffff81111561158557611585613939565b6040519080825280601f01601f1916602001820160405280156115af576020820181803683370190505b508152602001600081526020018681526020016000815260200160008152602001600081526020016040518060400160405280600f60016115f09190614020565b67ffffffffffffffff81111561160857611608613939565b604051908082528060200260200182016040528015611631578160200160208202803683370190505b5081526040805161012080825261242082019092526020928301929091908201612400803683370190505081525081526020016040518060400160405280600f600161167d9190614020565b67ffffffffffffffff81111561169557611695613939565b6040519080825280602002602001820160405280156116be578160200160208202803683370190505b50815260408051601e8082526103e0820190925260209283019290919082016103c080368337505050905290529050600080806116fa84611c25565b9050600081600e81111561171057611710614033565b14611725579251929450919250611801915050565b826000036117f657611738846001611daf565b93509050600081600e81111561175057611750614033565b14611765579251929450919250611801915050565b611770846002611daf565b92509050600081600e81111561178857611788614033565b1461179d579251929450919250611801915050565b81156117d157816001146117c857816002146117ba5760036117da565b6117c384611e7f565b6117da565b6117c384611ef9565b6117da84611f0e565b9050600081600e8111156117f0576117f0614033565b14611725575b925192945091925050505b9250929050565b8051606090600081900361182c575050604080516020810190915260008152919050565b6000600361183b836002614020565b6118459190614049565b61185090600461406b565b9050600061185f826020614020565b67ffffffffffffffff81111561187757611877613939565b6040519080825280601f01601f1916602001820160405280156118a1576020820181803683370190505b5090506000604051806060016040528060408152602001614133604091399050600181016020830160005b8681101561192d576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016118cc565b50600386066001811461194757600281146119735761199b565b7f3d3d00000000000000000000000000000000000000000000000000000000000060011983015261199b565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b60006114be836001600160a01b03841661211e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060815182604051602001611a2492919061408a565b6040516020818303038152906040529050919050565b60008181526001830160205260408120548015611b23576000611a5e600183614109565b8554909150600090611a7290600190614109565b9050818114611ad7576000866000018281548110611a9257611a92613c8a565b9060005260206000200154905080876000018481548110611ab557611ab5613c8a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611ae857611ae861411c565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506102b5565b60009150506102b5565b6000826000018281548110611b4457611b44613c8a565b9060005260206000200154905092915050565b6060833b6000819003611b7a5750506040805160208101909152600081526114be565b80841115611b985750506040805160208101909152600081526114be565b83831015611be3576040517f2c4a89fa000000000000000000000000000000000000000000000000000000008152600481018290526024810185905260448101849052606401610383565b8383038482036000828210611bf85782611bfa565b815b60408051603f8301601f19168101909152818152955090508087602087018a3c505050509392505050565b604080516101208082526124208201909252600091829182916020820161240080368337019050509050600091505b6090821015611c8e576008818381518110611c7157611c71613c8a565b602090810291909101015281611c8681613e26565b925050611c54565b610100821015611cc9576009818381518110611cac57611cac613c8a565b602090810291909101015281611cc181613e26565b925050611c8e565b610118821015611d04576007818381518110611ce757611ce7613c8a565b602090810291909101015281611cfc81613e26565b925050611cc9565b610120821015611d3f576008818381518110611d2257611d22613c8a565b602090810291909101015281611d3781613e26565b925050611d04565b611d528460c0015182610120600061216d565b50600091505b601e821015611d92576005818381518110611d7557611d75613c8a565b602090810291909101015281611d8a81613e26565b925050611d58565b611da48460e0015182601e600061216d565b506000949350505050565b608082015160009081905b838560a001511015611e4257846040015151856060015103611de457600160009250925050611801565b60a0850151604086015160608701805190611dfe82613e26565b905281518110611e1057611e10613c8a565b602001015160f81c60f81b60f81c60ff16901b8117905060088560a001818151611e3a9190614020565b905250611dba565b80841c608086015260a085018051859190611e5e908390614109565b9052506000611e70600180871b614109565b60009792169550909350505050565b6000611e9e604051806040016040528060608152602001606081525090565b60408051808201909152606080825260208201526000611ebd85612437565b90945092509050600081600e811115611ed857611ed8614033565b14611ee557949350505050565b611ef0858484612af1565b95945050505050565b60006102b5828360c001518460e00151612af1565b60006080820181905260a082018190526040820151516060830151829190611f37906004614020565b1115611f465750600192915050565b604083015160608401805190611f5b82613e26565b905281518110611f6d57611f6d613c8a565b0160200151604084015160608501805160f89390931c935060089290611f9282613e26565b905281518110611fa457611fa4613c8a565b602001015160f81c60f81b60f81c60ff16901b81179050801960ff168360400151846060018051809190611fd790613e26565b905281518110611fe957611fe9613c8a565b016020015160f81c1415806120345750604083015160608401805160ff841960081c16929161201782613e26565b90528151811061202957612029613c8a565b016020015160f81c14155b156120425750600492915050565b8260400151518184606001516120589190614020565b11156120675750600192915050565b825151602084015161207a908390614020565b11156120895750600292915050565b80156121155761209a600182614109565b905082604001518360600180518091906120b390613e26565b9052815181106120c5576120c5613c8a565b602001015160f81c60f81b83600001518460200180518091906120e790613e26565b9052815181106120f9576120f9613c8a565b60200101906001600160f81b031916908160001a905350612089565b50600092915050565b6000818152600183016020526040812054612165575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556102b5565b5060006102b5565b60008060008061217b61366b565b600092505b600f83116121bd576000896000015184815181106121a0576121a0613c8a565b6020908102919091010152826121b581613e26565b935050612180565b600093505b86841015612229578851886121d78689614020565b815181106121e7576121e7613c8a565b6020026020010151815181106121ff576121ff613c8a565b60200260200101805180919061221490613e26565b9052508361222181613e26565b9450506121c2565b86896000015160008151811061224157612241613c8a565b60200260200101510361225b57600094505050505061242f565b60019150600192505b600f83116122de578851805160019390931b928490811061228757612287613c8a565b60200260200101518210156122a357600e94505050505061242f565b88518051849081106122b7576122b7613c8a565b6020026020010151826122ca9190614109565b9150826122d681613e26565b935050612264565b60006020820152600192505b600f83101561236357885180518490811061230757612307613c8a565b602002602001015181846010811061232157612321613c8a565b60200201516123309190614020565b8161233c856001614020565b6010811061234c5761234c613c8a565b60200201528261235b81613e26565b9350506122ea565b600093505b86841015612416578761237b8588614020565b8151811061238b5761238b613c8a565b60200260200101516000146124045760208901518490828a6123ad848b614020565b815181106123bd576123bd613c8a565b6020026020010151601081106123d5576123d5613c8a565b602002018051906123e582613e26565b9052815181106123f7576123f7613c8a565b6020026020010181815250505b8361240e81613e26565b945050612368565b60008211612425576000612428565b600e5b9450505050505b949350505050565b6000612456604051806040016040528060608152602001606081525090565b604080518082019091526060808252602082015260008080808061247d601e61011e614020565b67ffffffffffffffff81111561249557612495613939565b6040519080825280602002602001820160405280156124be578160200160208202803683370190505b50905060006040518060400160405280600f60016124dc9190614020565b67ffffffffffffffff8111156124f4576124f4613939565b60405190808252806020026020018201604052801561251d578160200160208202803683370190505b5081526040805161011e8082526123e0820190925260209283019290919082016123c08036833701905050815250905060006040518060400160405280600f60016125689190614020565b67ffffffffffffffff81111561258057612580613939565b6040519080825280602002602001820160405280156125a9578160200160208202803683370190505b50815260408051601e8082526103e0820190925260209283019290919082016103c0803683375050509052905060006125e38c6005611daf565b98509450600085600e8111156125fb576125fb614033565b1461261357509298509650909450612aea9350505050565b61261f61010189614020565b975061262c8c6005611daf565b97509450600085600e81111561264457612644614033565b1461265c57509298509650909450612aea9350505050565b612667600188614020565b965061011e8811806126795750601e87115b156126935750600599509097509550612aea945050505050565b61269c8c61331b565b9095509350600085600e8111156126b5576126b5614033565b146126cd57509298509650909450612aea9350505050565b6126db83856013600061216d565b9450600085600e8111156126f1576126f1614033565b1461270b5750600699509097509550612aea945050505050565b600095505b61271a8789614020565b8610156129155760008061272e8e8661353e565b9097509150600087600e81111561274757612747614033565b146127615750949a509198509650612aea95505050505050565b60108210156127995781868961277681613e26565b9a508151811061278857612788613c8a565b60200260200101818152505061290e565b600090508160100361283b57876000036127c5575060079b50929950909750612aea9650505050505050565b856127d160018a614109565b815181106127e1576127e1613c8a565b602002602001015190506127f68e6002611daf565b9097509250600087600e81111561280f5761280f614033565b146128295750949a509198509650612aea95505050505050565b612834836003614020565b915061289a565b8160110361284e576127f68e6003611daf565b6128598e6007611daf565b9097509250600087600e81111561287257612872614033565b1461288c5750949a509198509650612aea95505050505050565b61289783600b614020565b91505b6128a4898b614020565b6128ae838a614020565b11156128cc575060089b50929950909750612aea9650505050505050565b811561290e576128dd600183614109565b91508086896128eb81613e26565b9a50815181106128fd576128fd613c8a565b6020026020010181815250506128cc565b5050612710565b836101008151811061292957612929613c8a565b602002602001015160000361294d5750600b99509097509550612aea945050505050565b61295a83858a600061216d565b9450600085600e81111561297057612970614033565b141580156129fa5750600185600e81111561298d5761298d614033565b14806129aa5750600285600e8111156129a8576129a8614033565b145b806129fa57508251805160019081106129c5576129c5613c8a565b602002602001015183600001516000815181106129e4576129e4613c8a565b60200260200101516129f69190614020565b8814155b15612a145750600999509097509550612aea945050505050565b612a208285898b61216d565b9450600085600e811115612a3657612a36614033565b14158015612ac05750600185600e811115612a5357612a53614033565b1480612a705750600285600e811115612a6e57612a6e614033565b145b80612ac05750815180516001908110612a8b57612a8b613c8a565b60200260200101518260000151600081518110612aaa57612aaa613c8a565b6020026020010151612abc9190614020565b8714155b15612ada5750600a99509097509550612aea945050505050565b5060009950909750955050505050505b9193909250565b6000806000806000604051806103a00160405280600361ffff168152602001600461ffff168152602001600561ffff168152602001600661ffff168152602001600761ffff168152602001600861ffff168152602001600961ffff168152602001600a61ffff168152602001600b61ffff168152602001600d61ffff168152602001600f61ffff168152602001601161ffff168152602001601361ffff168152602001601761ffff168152602001601b61ffff168152602001601f61ffff168152602001602361ffff168152602001602b61ffff168152602001603361ffff168152602001603b61ffff168152602001604361ffff168152602001605361ffff168152602001606361ffff168152602001607361ffff168152602001608361ffff16815260200160a361ffff16815260200160c361ffff16815260200160e361ffff16815260200161010261ffff1681525090506000604051806103a00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600260ff168152602001600260ff168152602001600260ff168152602001600260ff168152602001600360ff168152602001600360ff168152602001600360ff168152602001600360ff168152602001600460ff168152602001600460ff168152602001600460ff168152602001600460ff168152602001600560ff168152602001600560ff168152602001600560ff168152602001600560ff168152602001600060ff1681525090506000604051806103c00160405280600161ffff168152602001600261ffff168152602001600361ffff168152602001600461ffff168152602001600561ffff168152602001600761ffff168152602001600961ffff168152602001600d61ffff168152602001601161ffff168152602001601961ffff168152602001602161ffff168152602001603161ffff168152602001604161ffff168152602001606161ffff168152602001608161ffff16815260200160c161ffff16815260200161010161ffff16815260200161018161ffff16815260200161020161ffff16815260200161030161ffff16815260200161040161ffff16815260200161060161ffff16815260200161080161ffff168152602001610c0161ffff16815260200161100161ffff16815260200161180161ffff16815260200161200161ffff16815260200161300161ffff16815260200161400161ffff16815260200161600161ffff1681525090506000604051806103c00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600160ff168152602001600160ff168152602001600260ff168152602001600260ff168152602001600360ff168152602001600360ff168152602001600460ff168152602001600460ff168152602001600560ff168152602001600560ff168152602001600660ff168152602001600660ff168152602001600760ff168152602001600760ff168152602001600860ff168152602001600860ff168152602001600960ff168152602001600960ff168152602001600a60ff168152602001600a60ff168152602001600b60ff168152602001600b60ff168152602001600c60ff168152602001600c60ff168152602001600d60ff168152602001600d60ff16815250905060005b87610100146133095761302b8c8c61353e565b98509050600081600e81111561304357613043614033565b146130575797506114be9650505050505050565b6101008810156130cc578b515160208d01510361307f576002985050505050505050506114be565b8760f81b8c600001518d602001518151811061309d5761309d613c8a565b60200101906001600160f81b031916908160001a90535060208c018051906130c482613e26565b905250613018565b6101008811156132f75760006130e46101018a614109565b9850601d891061310057600c99505050505050505050506114be565b6131238d868b601d811061311657613116613c8a565b602002015160ff16611daf565b9092509050600082600e81111561313c5761313c614033565b14613151575097506114be9650505050505050565b80868a601d811061316457613164613c8a565b602002015161ffff166131779190614020565b97506131838d8c61353e565b99509150600082600e81111561319b5761319b614033565b146131b0575097506114be9650505050505050565b6131c68d848b601e811061311657613116613c8a565b9092509050600082600e8111156131df576131df614033565b146131f4575097506114be9650505050505050565b80848a601e811061320757613207613c8a565b602002015161ffff1661321a9190614020565b96508c6020015187111561323a57600d99505050505050505050506114be565b8c515160208e015161324d908a90614020565b111561326557600299505050505050505050506114be565b87156132f157613276600189614109565b97508c60000151878e6020015161328d9190614109565b8151811061329d5761329d613c8a565b602001015160f81c60f81b8d600001518e60200151815181106132c2576132c2613c8a565b60200101906001600160f81b031916908160001a90535060208d018051906132e982613e26565b905250613265565b50613018565b868c6020018181516130c49190614020565b5060009b9a5050505050505050505050565b6000606081808061332f601e61011e614020565b67ffffffffffffffff81111561334757613347613939565b604051908082528060200260200182016040528015613370578160200160208202803683370190505b506040805161026081018252601081526011602082015260129181019190915260006060820181905260086080830152600760a0830152600960c0830152600660e0830152600a6101008301526005610120830152600b61014083015260046101608301819052600c61018084015260036101a0840152600d6101c084015260026101e0840152600e6102008401526001610220840152600f6102408401529293509161341e908990611daf565b95509150600082600e81111561343657613436614033565b146134475750969095509350505050565b613452600486614020565b9450600093505b848410156134db5761346c886003611daf565b8483876013811061347f5761347f613c8a565b602002015160ff168151811061349757613497613c8a565b60209081029190910101529150600082600e8111156134b8576134b8614033565b146134c95750969095509350505050565b836134d381613e26565b945050613459565b601384101561352e576000838286601381106134f9576134f9613c8a565b602002015160ff168151811061351157613511613c8a565b60209081029190910101528361352681613e26565b9450506134db565b5060009791965090945050505050565b600080600181808080805b600f861161363a57600061355e8b6001611daf565b9092509050600082600e81111561357757613577614033565b1461358e5750965060009550611801945050505050565b8951805196821796889081106135a6576135a6613c8a565b6020026020010151935083856135bc9190614020565b8610156136075760208a01516000906135d58789614109565b6135df9086614020565b815181106135ef576135ef613c8a565b60200260200101519850985050505050505050611801565b6136118484614020565b925061361d8486614020565b600196871b961b945086905061363281613e26565b965050613549565b50600c9960009950975050505050505050565b5080546000825590600052602060002090810190610b59919061368a565b6040518061020001604052806010906020820280368337509192915050565b5b80821115610c07576000815560010161368b565b6000602082840312156136b157600080fd5b81356001600160e01b0319811681146114be57600080fd5b80356001600160a01b03811681146136e057600080fd5b919050565b600060a0828403121561149a57600080fd5b60008083601f84011261370957600080fd5b50813567ffffffffffffffff81111561372157600080fd5b6020830191508360208260051b850101111561180157600080fd5b6000806000806060858703121561375257600080fd5b61375b856136c9565b9350602085013567ffffffffffffffff8082111561377857600080fd5b613784888389016136e5565b9450604087013591508082111561379a57600080fd5b506137a7878288016136f7565b95989497509550505050565b600080604083850312156137c657600080fd5b6137cf836136c9565b946020939093013593505050565b60005b838110156137f85781810151838201526020016137e0565b50506000910152565b600081518084526138198160208601602086016137dd565b601f01601f19169290920160200192915050565b6080815260006138406080830187613801565b82810360208401526138528187613801565b941515604084015250506060015292915050565b60006020828403121561387857600080fd5b6114be826136c9565b600081518084526020808501945080840160005b838110156138ba5781516001600160a01b031687529582019590820190600101613895565b509495945050505050565b6020815260006114be6020830184613881565b6020815260006114be6020830184613801565b6000806000806060858703121561390157600080fd5b61390a856136c9565b935060208501359250604085013567ffffffffffffffff81111561392d57600080fd5b6137a7878288016136f7565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561397857613978613939565b604052919050565b6000806040838503121561399357600080fd5b823567ffffffffffffffff808211156139ab57600080fd5b818501915085601f8301126139bf57600080fd5b81356020828211156139d3576139d3613939565b6139e5601f8301601f1916820161394f565b925081835287818386010111156139fb57600080fd5b8181850182850137600091830181019190915290969401359450505050565b600080600080600060808688031215613a3257600080fd5b613a3b866136c9565b945060208601359350604086013567ffffffffffffffff80821115613a5f57600080fd5b613a6b89838a016136f7565b90955093506060880135915080821115613a8457600080fd5b50613a91888289016136e5565b9150509295509295909350565b8015158114610b5957600080fd5b600060208284031215613abe57600080fd5b81516114be81613a9e565b600060208284031215613adb57600080fd5b5051919050565b6000808335601e19843603018112613af957600080fd5b83018035915067ffffffffffffffff821115613b1457600080fd5b60200191503681900382131561180157600080fd5b600181811c90821680613b3d57607f821691505b60208210810361149a57634e487b7160e01b600052602260045260246000fd5b601f821115613ba757600081815260208120601f850160051c81016020861015613b845750805b601f850160051c820191505b81811015613ba357828155600101613b90565b5050505b505050565b67ffffffffffffffff831115613bc457613bc4613939565b613bd883613bd28354613b29565b83613b5d565b6000601f841160018114613c0c5760008515613bf45750838201355b600019600387901b1c1916600186901b178355613c66565b600083815260209020601f19861690835b82811015613c3d5786850135825560209485019460019092019101613c1d565b5086821015613c5a5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060208284031215613c7f57600080fd5b81356114be81613a9e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103613ccc57613ccc613ca0565b60010192915050565b606081526000613ce86060830186613881565b82810360208481019190915285518083528682019282019060005b81811015613d1f57845183529383019391830191600101613d03565b5050848103604086015285518082528282019350600581901b8201830183880160005b83811015613d7057601f19858403018752613d5e838351613801565b96860196925090850190600101613d42565b50909a9950505050505050505050565b60006020808385031215613d9357600080fd5b825167ffffffffffffffff80821115613dab57600080fd5b818501915085601f830112613dbf57600080fd5b815181811115613dd157613dd1613939565b8060051b9150613de284830161394f565b8181529183018401918481019088841115613dfc57600080fd5b938501935b83851015613e1a57845182529385019390850190613e01565b98975050505050505050565b600060018201613e3857613e38613ca0565b5060010190565b60008154613e4c81613b29565b60018281168015613e645760018114613e7957613ea8565b60ff1984168752821515830287019450613ea8565b8560005260208060002060005b85811015613e9f5781548a820152908401908201613e86565b50505082870194505b5050505092915050565b7f646174613a00000000000000000000000000000000000000000000000000000081526000613ee46005830184613e3f565b7f3b6261736536342c00000000000000000000000000000000000000000000000081526008019392505050565b60008351613f238184602088016137dd565b835190830190613f378183602088016137dd565b01949350505050565b60008251613f528184602087016137dd565b9190910192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b0000000081526000613f8e601c830185613e3f565b7f2c2022696d616765223a2022000000000000000000000000000000000000000081528351613fc481600c8401602088016137dd565b7f227d000000000000000000000000000000000000000000000000000000000000600c9290910191820152600e01949350505050565b60008152600082516140138160018501602087016137dd565b9190910160010192915050565b808201808211156102b5576102b5613ca0565b634e487b7160e01b600052602160045260246000fd5b60008261406657634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561408557614085613ca0565b500290565b7f630000000000000000000000000000000000000000000000000000000000000081526001600160e01b03198360e01b1660018201527f80600e6000396000f300000000000000000000000000000000000000000000006005820152600082516140fb81600e8501602087016137dd565b91909101600e019392505050565b818103818111156102b5576102b5613ca0565b634e487b7160e01b600052603160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220f0e8bc8251880897ae5c8378ed2d56b91595136ade3f3a4d4f67ffc1a79a549464736f6c63430008100033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101005760003560e01c80636d73e669116100975780638da5cb5b116100665780638da5cb5b14610214578063b3bd50b31461022f578063e9dc637514610242578063f2fde38b1461025557600080fd5b80636d73e669146101d3578063715018a6146101e65780637b00b0e0146101ee5780637b631b691461020157600080fd5b806324d7806c116100d357806324d7806c146101785780632d3456701461018b57806331ae450b1461019e5780633d093a9f146101b357600080fd5b806301ffc9a7146101055780630b2be0011461012d5780631d2d0c0d1461014257806324ba432814610155575b600080fd5b61011861011336600461369f565b610268565b60405190151581526020015b60405180910390f35b61014061013b36600461373c565b6102bb565b005b61014061015036600461373c565b6105c6565b6101686101633660046137b3565b61097e565b604051610124949392919061382d565b610118610186366004613866565b610ac5565b610140610199366004613866565b610afe565b6101a6610b5c565b60405161012491906138c5565b6101c66101c13660046137b3565b610c0b565b60405161012491906138d8565b6101406101e1366004613866565b610db2565b610140610e0a565b6101406101fc3660046138eb565b610e1e565b6101c661020f366004613980565b610f83565b6000546040516001600160a01b039091168152602001610124565b61014061023d366004613a1a565b610fbd565b6101c66102503660046137b3565b61123c565b610140610263366004613866565b61132e565b60006001600160e01b031982167fe9dc63750000000000000000000000000000000000000000000000000000000014806102a657506102a6826113bb565b806102b557506102b5826113bb565b92915050565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103279190613aac565b61038c5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b03881690632928ca58906024016020604051808303816000875af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104129190613ac9565b905061041e8680613ae2565b6001600160a01b038916600090815260036020908152604080832086845290915290209161044d919083613bac565b5061045b6020870187613ae2565b6001600160a01b038916600090815260036020908152604080832086845290915290206001019161048d919083613bac565b5061049e6080870160608801613c6d565b6001600160a01b03881660009081526003602081815260408084208685529091528220908101805460ff19169315159390931790925560808801356004909201919091555b60ff81168511156105bc576001600160a01b03881660009081526003602090815260408083208584529091529020600201610578878760ff851681811061052c5761052c613c8a565b905060200281019061053e9190613ae2565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061142292505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055806105b481613cb6565b9150506104e3565b5050505050505050565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190613aac565b6106925760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816106ef579050509050338360008151811061071a5761071a613c8a565b60200260200101906001600160a01b031690816001600160a01b03168152505087604001358260008151811061075257610752613c8a565b60209081029190910101526040517f8c6e84720000000000000000000000000000000000000000000000000000000081526000906001600160a01b038b1690638c6e8472906107a990879087908790600401613cd5565b6000604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107f09190810190613d80565b905060008160008151811061080757610807613c8a565b6020908102919091010151905061081e8a80613ae2565b6001600160a01b038d16600090815260036020908152604080832086845290915290209161084d919083613bac565b5061085b60208b018b613ae2565b6001600160a01b038d16600090815260036020908152604080832086845290915290206001019161088d919083613bac565b5061089e60808b0160608c01613c6d565b6001600160a01b038c1660009081526003602081815260408084208685529091528220908101805460ff19169315159390931790925560808c01356004909201919091555b60ff8116891115610970576001600160a01b038c166000908152600360209081526040808320858452909152902060020161092c8b8b60ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061096881613cb6565b9150506108e3565b505050505050505050505050565b60036020908152600092835260408084209091529082529020805481906109a490613b29565b80601f01602080910402602001604051908101604052809291908181526020018280546109d090613b29565b8015610a1d5780601f106109f257610100808354040283529160200191610a1d565b820191906000526020600020905b815481529060010190602001808311610a0057829003601f168201915b505050505090806001018054610a3290613b29565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5e90613b29565b8015610aab5780601f10610a8057610100808354040283529160200191610aab565b820191906000526020600020905b815481529060010190602001808311610a8e57829003601f168201915b505050506003830154600490930154919260ff1691905084565b6000816001600160a01b0316610ae36000546001600160a01b031690565b6001600160a01b031614806102b557506102b56001836114a0565b610b066114c5565b610b116001826114a0565b15610b595760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610b5760018261151f565b505b50565b6060610b686001611534565b67ffffffffffffffff811115610b8057610b80613939565b604051908082528060200260200182016040528015610ba9578160200160208202803683370190505b50905060005b610bb96001611534565b811015610c0757610bcb60018261153e565b828281518110610bdd57610bdd613c8a565b6001600160a01b039092166020928302919091019091015280610bff81613e26565b915050610baf565b5090565b6001600160a01b03821660009081526003602090815260408083208484528252808320905160609392610c42926001019101613eb2565b6040516020818303038152906040529050606060005b6001600160a01b038616600090815260036020908152604080832088845290915290206002015460ff82161015610d19576001600160a01b0386166000908152600360209081526040808320888452909152902060020180548391610ce49160ff8516908110610cca57610cca613c8a565b6000918252602090912001546001600160a01b031661154a565b604051602001610cf5929190613f11565b60405160208183030381529060405291508080610d1190613cb6565b915050610c58565b506001600160a01b0385166000908152600360208181526040808420888552909152909120015460ff1615610d7e576001600160a01b0385166000908152600360209081526040808320878452909152902060040154610d7a90829061155a565b9150505b81610d8882611808565b604051602001610d99929190613f11565b60408051808303601f1901815291905295945050505050565b610dba6114c5565b610dc56001826114a0565b610b595760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a3610b576001826119a9565b610e126114c5565b610e1c60006119be565b565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610e66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8a9190613aac565b610eea5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60005b60ff8116841115610f7a576001600160a01b03871660009081526003602090815260408083208984529091529020600201610f36868660ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610f7281613cb6565b915050610eed565b50505050505050565b60606000610f91848461155a565b91505080604051602001610fa59190613f40565b60405160208183030381529060405291505092915050565b604051630935e01b60e21b8152336004820152859081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611005573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110299190613aac565b6110895760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610383565b60006110958480613ae2565b905011156110d8576110a78380613ae2565b6001600160a01b03891660009081526003602090815260408083208b84529091529020916110d6919083613bac565b505b60006110e76020850185613ae2565b90501115611130576110fc6020840184613ae2565b6001600160a01b03891660009081526003602090815260408083208b845290915290206001019161112e919083613bac565b505b6111406080840160608501613c6d565b6001600160a01b03881660009081526003602081815260408084208b855290915290912001805460ff19169115159190911790558315610f7a576001600160a01b038716600090815260036020908152604080832089845290915281206111ac9160029091019061364d565b60005b60ff81168511156105bc576001600160a01b03881660009081526003602090815260408083208a845290915290206002016111f8878760ff851681811061052c5761052c613c8a565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061123481613cb6565b9150506111af565b6001600160a01b0382166000908152600360209081526040808320848452909152812060020154606091036112d95760405162461bcd60e51b815260206004820152602160248201527f546f6b656e206d6574616461746120646f65736e27742065786973742068657260448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610383565b6001600160a01b038316600090815260036020908152604080832085845290915290206113068484610c0b565b604051602001611317929190613f5c565b604051602081830303815290604052905092915050565b6113366114c5565b6001600160a01b0381166113b25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610383565b610b59816119be565b60006001600160e01b031982167f553e757e0000000000000000000000000000000000000000000000000000000014806102b557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146102b5565b60008061144d836040516020016114399190613ffa565b604051602081830303815290604052611a0e565b90508051602082016000f091506001600160a01b03821661149a576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b03163314610e1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610383565b60006114be836001600160a01b038416611a3a565b60006102b5825490565b60006114be8383611b2d565b60606102b5826001600019611b57565b6000606060006040518061010001604052808567ffffffffffffffff81111561158557611585613939565b6040519080825280601f01601f1916602001820160405280156115af576020820181803683370190505b508152602001600081526020018681526020016000815260200160008152602001600081526020016040518060400160405280600f60016115f09190614020565b67ffffffffffffffff81111561160857611608613939565b604051908082528060200260200182016040528015611631578160200160208202803683370190505b5081526040805161012080825261242082019092526020928301929091908201612400803683370190505081525081526020016040518060400160405280600f600161167d9190614020565b67ffffffffffffffff81111561169557611695613939565b6040519080825280602002602001820160405280156116be578160200160208202803683370190505b50815260408051601e8082526103e0820190925260209283019290919082016103c080368337505050905290529050600080806116fa84611c25565b9050600081600e81111561171057611710614033565b14611725579251929450919250611801915050565b826000036117f657611738846001611daf565b93509050600081600e81111561175057611750614033565b14611765579251929450919250611801915050565b611770846002611daf565b92509050600081600e81111561178857611788614033565b1461179d579251929450919250611801915050565b81156117d157816001146117c857816002146117ba5760036117da565b6117c384611e7f565b6117da565b6117c384611ef9565b6117da84611f0e565b9050600081600e8111156117f0576117f0614033565b14611725575b925192945091925050505b9250929050565b8051606090600081900361182c575050604080516020810190915260008152919050565b6000600361183b836002614020565b6118459190614049565b61185090600461406b565b9050600061185f826020614020565b67ffffffffffffffff81111561187757611877613939565b6040519080825280601f01601f1916602001820160405280156118a1576020820181803683370190505b5090506000604051806060016040528060408152602001614133604091399050600181016020830160005b8681101561192d576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016118cc565b50600386066001811461194757600281146119735761199b565b7f3d3d00000000000000000000000000000000000000000000000000000000000060011983015261199b565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b60006114be836001600160a01b03841661211e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060815182604051602001611a2492919061408a565b6040516020818303038152906040529050919050565b60008181526001830160205260408120548015611b23576000611a5e600183614109565b8554909150600090611a7290600190614109565b9050818114611ad7576000866000018281548110611a9257611a92613c8a565b9060005260206000200154905080876000018481548110611ab557611ab5613c8a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611ae857611ae861411c565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506102b5565b60009150506102b5565b6000826000018281548110611b4457611b44613c8a565b9060005260206000200154905092915050565b6060833b6000819003611b7a5750506040805160208101909152600081526114be565b80841115611b985750506040805160208101909152600081526114be565b83831015611be3576040517f2c4a89fa000000000000000000000000000000000000000000000000000000008152600481018290526024810185905260448101849052606401610383565b8383038482036000828210611bf85782611bfa565b815b60408051603f8301601f19168101909152818152955090508087602087018a3c505050509392505050565b604080516101208082526124208201909252600091829182916020820161240080368337019050509050600091505b6090821015611c8e576008818381518110611c7157611c71613c8a565b602090810291909101015281611c8681613e26565b925050611c54565b610100821015611cc9576009818381518110611cac57611cac613c8a565b602090810291909101015281611cc181613e26565b925050611c8e565b610118821015611d04576007818381518110611ce757611ce7613c8a565b602090810291909101015281611cfc81613e26565b925050611cc9565b610120821015611d3f576008818381518110611d2257611d22613c8a565b602090810291909101015281611d3781613e26565b925050611d04565b611d528460c0015182610120600061216d565b50600091505b601e821015611d92576005818381518110611d7557611d75613c8a565b602090810291909101015281611d8a81613e26565b925050611d58565b611da48460e0015182601e600061216d565b506000949350505050565b608082015160009081905b838560a001511015611e4257846040015151856060015103611de457600160009250925050611801565b60a0850151604086015160608701805190611dfe82613e26565b905281518110611e1057611e10613c8a565b602001015160f81c60f81b60f81c60ff16901b8117905060088560a001818151611e3a9190614020565b905250611dba565b80841c608086015260a085018051859190611e5e908390614109565b9052506000611e70600180871b614109565b60009792169550909350505050565b6000611e9e604051806040016040528060608152602001606081525090565b60408051808201909152606080825260208201526000611ebd85612437565b90945092509050600081600e811115611ed857611ed8614033565b14611ee557949350505050565b611ef0858484612af1565b95945050505050565b60006102b5828360c001518460e00151612af1565b60006080820181905260a082018190526040820151516060830151829190611f37906004614020565b1115611f465750600192915050565b604083015160608401805190611f5b82613e26565b905281518110611f6d57611f6d613c8a565b0160200151604084015160608501805160f89390931c935060089290611f9282613e26565b905281518110611fa457611fa4613c8a565b602001015160f81c60f81b60f81c60ff16901b81179050801960ff168360400151846060018051809190611fd790613e26565b905281518110611fe957611fe9613c8a565b016020015160f81c1415806120345750604083015160608401805160ff841960081c16929161201782613e26565b90528151811061202957612029613c8a565b016020015160f81c14155b156120425750600492915050565b8260400151518184606001516120589190614020565b11156120675750600192915050565b825151602084015161207a908390614020565b11156120895750600292915050565b80156121155761209a600182614109565b905082604001518360600180518091906120b390613e26565b9052815181106120c5576120c5613c8a565b602001015160f81c60f81b83600001518460200180518091906120e790613e26565b9052815181106120f9576120f9613c8a565b60200101906001600160f81b031916908160001a905350612089565b50600092915050565b6000818152600183016020526040812054612165575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556102b5565b5060006102b5565b60008060008061217b61366b565b600092505b600f83116121bd576000896000015184815181106121a0576121a0613c8a565b6020908102919091010152826121b581613e26565b935050612180565b600093505b86841015612229578851886121d78689614020565b815181106121e7576121e7613c8a565b6020026020010151815181106121ff576121ff613c8a565b60200260200101805180919061221490613e26565b9052508361222181613e26565b9450506121c2565b86896000015160008151811061224157612241613c8a565b60200260200101510361225b57600094505050505061242f565b60019150600192505b600f83116122de578851805160019390931b928490811061228757612287613c8a565b60200260200101518210156122a357600e94505050505061242f565b88518051849081106122b7576122b7613c8a565b6020026020010151826122ca9190614109565b9150826122d681613e26565b935050612264565b60006020820152600192505b600f83101561236357885180518490811061230757612307613c8a565b602002602001015181846010811061232157612321613c8a565b60200201516123309190614020565b8161233c856001614020565b6010811061234c5761234c613c8a565b60200201528261235b81613e26565b9350506122ea565b600093505b86841015612416578761237b8588614020565b8151811061238b5761238b613c8a565b60200260200101516000146124045760208901518490828a6123ad848b614020565b815181106123bd576123bd613c8a565b6020026020010151601081106123d5576123d5613c8a565b602002018051906123e582613e26565b9052815181106123f7576123f7613c8a565b6020026020010181815250505b8361240e81613e26565b945050612368565b60008211612425576000612428565b600e5b9450505050505b949350505050565b6000612456604051806040016040528060608152602001606081525090565b604080518082019091526060808252602082015260008080808061247d601e61011e614020565b67ffffffffffffffff81111561249557612495613939565b6040519080825280602002602001820160405280156124be578160200160208202803683370190505b50905060006040518060400160405280600f60016124dc9190614020565b67ffffffffffffffff8111156124f4576124f4613939565b60405190808252806020026020018201604052801561251d578160200160208202803683370190505b5081526040805161011e8082526123e0820190925260209283019290919082016123c08036833701905050815250905060006040518060400160405280600f60016125689190614020565b67ffffffffffffffff81111561258057612580613939565b6040519080825280602002602001820160405280156125a9578160200160208202803683370190505b50815260408051601e8082526103e0820190925260209283019290919082016103c0803683375050509052905060006125e38c6005611daf565b98509450600085600e8111156125fb576125fb614033565b1461261357509298509650909450612aea9350505050565b61261f61010189614020565b975061262c8c6005611daf565b97509450600085600e81111561264457612644614033565b1461265c57509298509650909450612aea9350505050565b612667600188614020565b965061011e8811806126795750601e87115b156126935750600599509097509550612aea945050505050565b61269c8c61331b565b9095509350600085600e8111156126b5576126b5614033565b146126cd57509298509650909450612aea9350505050565b6126db83856013600061216d565b9450600085600e8111156126f1576126f1614033565b1461270b5750600699509097509550612aea945050505050565b600095505b61271a8789614020565b8610156129155760008061272e8e8661353e565b9097509150600087600e81111561274757612747614033565b146127615750949a509198509650612aea95505050505050565b60108210156127995781868961277681613e26565b9a508151811061278857612788613c8a565b60200260200101818152505061290e565b600090508160100361283b57876000036127c5575060079b50929950909750612aea9650505050505050565b856127d160018a614109565b815181106127e1576127e1613c8a565b602002602001015190506127f68e6002611daf565b9097509250600087600e81111561280f5761280f614033565b146128295750949a509198509650612aea95505050505050565b612834836003614020565b915061289a565b8160110361284e576127f68e6003611daf565b6128598e6007611daf565b9097509250600087600e81111561287257612872614033565b1461288c5750949a509198509650612aea95505050505050565b61289783600b614020565b91505b6128a4898b614020565b6128ae838a614020565b11156128cc575060089b50929950909750612aea9650505050505050565b811561290e576128dd600183614109565b91508086896128eb81613e26565b9a50815181106128fd576128fd613c8a565b6020026020010181815250506128cc565b5050612710565b836101008151811061292957612929613c8a565b602002602001015160000361294d5750600b99509097509550612aea945050505050565b61295a83858a600061216d565b9450600085600e81111561297057612970614033565b141580156129fa5750600185600e81111561298d5761298d614033565b14806129aa5750600285600e8111156129a8576129a8614033565b145b806129fa57508251805160019081106129c5576129c5613c8a565b602002602001015183600001516000815181106129e4576129e4613c8a565b60200260200101516129f69190614020565b8814155b15612a145750600999509097509550612aea945050505050565b612a208285898b61216d565b9450600085600e811115612a3657612a36614033565b14158015612ac05750600185600e811115612a5357612a53614033565b1480612a705750600285600e811115612a6e57612a6e614033565b145b80612ac05750815180516001908110612a8b57612a8b613c8a565b60200260200101518260000151600081518110612aaa57612aaa613c8a565b6020026020010151612abc9190614020565b8714155b15612ada5750600a99509097509550612aea945050505050565b5060009950909750955050505050505b9193909250565b6000806000806000604051806103a00160405280600361ffff168152602001600461ffff168152602001600561ffff168152602001600661ffff168152602001600761ffff168152602001600861ffff168152602001600961ffff168152602001600a61ffff168152602001600b61ffff168152602001600d61ffff168152602001600f61ffff168152602001601161ffff168152602001601361ffff168152602001601761ffff168152602001601b61ffff168152602001601f61ffff168152602001602361ffff168152602001602b61ffff168152602001603361ffff168152602001603b61ffff168152602001604361ffff168152602001605361ffff168152602001606361ffff168152602001607361ffff168152602001608361ffff16815260200160a361ffff16815260200160c361ffff16815260200160e361ffff16815260200161010261ffff1681525090506000604051806103a00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600260ff168152602001600260ff168152602001600260ff168152602001600260ff168152602001600360ff168152602001600360ff168152602001600360ff168152602001600360ff168152602001600460ff168152602001600460ff168152602001600460ff168152602001600460ff168152602001600560ff168152602001600560ff168152602001600560ff168152602001600560ff168152602001600060ff1681525090506000604051806103c00160405280600161ffff168152602001600261ffff168152602001600361ffff168152602001600461ffff168152602001600561ffff168152602001600761ffff168152602001600961ffff168152602001600d61ffff168152602001601161ffff168152602001601961ffff168152602001602161ffff168152602001603161ffff168152602001604161ffff168152602001606161ffff168152602001608161ffff16815260200160c161ffff16815260200161010161ffff16815260200161018161ffff16815260200161020161ffff16815260200161030161ffff16815260200161040161ffff16815260200161060161ffff16815260200161080161ffff168152602001610c0161ffff16815260200161100161ffff16815260200161180161ffff16815260200161200161ffff16815260200161300161ffff16815260200161400161ffff16815260200161600161ffff1681525090506000604051806103c00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600160ff168152602001600160ff168152602001600260ff168152602001600260ff168152602001600360ff168152602001600360ff168152602001600460ff168152602001600460ff168152602001600560ff168152602001600560ff168152602001600660ff168152602001600660ff168152602001600760ff168152602001600760ff168152602001600860ff168152602001600860ff168152602001600960ff168152602001600960ff168152602001600a60ff168152602001600a60ff168152602001600b60ff168152602001600b60ff168152602001600c60ff168152602001600c60ff168152602001600d60ff168152602001600d60ff16815250905060005b87610100146133095761302b8c8c61353e565b98509050600081600e81111561304357613043614033565b146130575797506114be9650505050505050565b6101008810156130cc578b515160208d01510361307f576002985050505050505050506114be565b8760f81b8c600001518d602001518151811061309d5761309d613c8a565b60200101906001600160f81b031916908160001a90535060208c018051906130c482613e26565b905250613018565b6101008811156132f75760006130e46101018a614109565b9850601d891061310057600c99505050505050505050506114be565b6131238d868b601d811061311657613116613c8a565b602002015160ff16611daf565b9092509050600082600e81111561313c5761313c614033565b14613151575097506114be9650505050505050565b80868a601d811061316457613164613c8a565b602002015161ffff166131779190614020565b97506131838d8c61353e565b99509150600082600e81111561319b5761319b614033565b146131b0575097506114be9650505050505050565b6131c68d848b601e811061311657613116613c8a565b9092509050600082600e8111156131df576131df614033565b146131f4575097506114be9650505050505050565b80848a601e811061320757613207613c8a565b602002015161ffff1661321a9190614020565b96508c6020015187111561323a57600d99505050505050505050506114be565b8c515160208e015161324d908a90614020565b111561326557600299505050505050505050506114be565b87156132f157613276600189614109565b97508c60000151878e6020015161328d9190614109565b8151811061329d5761329d613c8a565b602001015160f81c60f81b8d600001518e60200151815181106132c2576132c2613c8a565b60200101906001600160f81b031916908160001a90535060208d018051906132e982613e26565b905250613265565b50613018565b868c6020018181516130c49190614020565b5060009b9a5050505050505050505050565b6000606081808061332f601e61011e614020565b67ffffffffffffffff81111561334757613347613939565b604051908082528060200260200182016040528015613370578160200160208202803683370190505b506040805161026081018252601081526011602082015260129181019190915260006060820181905260086080830152600760a0830152600960c0830152600660e0830152600a6101008301526005610120830152600b61014083015260046101608301819052600c61018084015260036101a0840152600d6101c084015260026101e0840152600e6102008401526001610220840152600f6102408401529293509161341e908990611daf565b95509150600082600e81111561343657613436614033565b146134475750969095509350505050565b613452600486614020565b9450600093505b848410156134db5761346c886003611daf565b8483876013811061347f5761347f613c8a565b602002015160ff168151811061349757613497613c8a565b60209081029190910101529150600082600e8111156134b8576134b8614033565b146134c95750969095509350505050565b836134d381613e26565b945050613459565b601384101561352e576000838286601381106134f9576134f9613c8a565b602002015160ff168151811061351157613511613c8a565b60209081029190910101528361352681613e26565b9450506134db565b5060009791965090945050505050565b600080600181808080805b600f861161363a57600061355e8b6001611daf565b9092509050600082600e81111561357757613577614033565b1461358e5750965060009550611801945050505050565b8951805196821796889081106135a6576135a6613c8a565b6020026020010151935083856135bc9190614020565b8610156136075760208a01516000906135d58789614109565b6135df9086614020565b815181106135ef576135ef613c8a565b60200260200101519850985050505050505050611801565b6136118484614020565b925061361d8486614020565b600196871b961b945086905061363281613e26565b965050613549565b50600c9960009950975050505050505050565b5080546000825590600052602060002090810190610b59919061368a565b6040518061020001604052806010906020820280368337509192915050565b5b80821115610c07576000815560010161368b565b6000602082840312156136b157600080fd5b81356001600160e01b0319811681146114be57600080fd5b80356001600160a01b03811681146136e057600080fd5b919050565b600060a0828403121561149a57600080fd5b60008083601f84011261370957600080fd5b50813567ffffffffffffffff81111561372157600080fd5b6020830191508360208260051b850101111561180157600080fd5b6000806000806060858703121561375257600080fd5b61375b856136c9565b9350602085013567ffffffffffffffff8082111561377857600080fd5b613784888389016136e5565b9450604087013591508082111561379a57600080fd5b506137a7878288016136f7565b95989497509550505050565b600080604083850312156137c657600080fd5b6137cf836136c9565b946020939093013593505050565b60005b838110156137f85781810151838201526020016137e0565b50506000910152565b600081518084526138198160208601602086016137dd565b601f01601f19169290920160200192915050565b6080815260006138406080830187613801565b82810360208401526138528187613801565b941515604084015250506060015292915050565b60006020828403121561387857600080fd5b6114be826136c9565b600081518084526020808501945080840160005b838110156138ba5781516001600160a01b031687529582019590820190600101613895565b509495945050505050565b6020815260006114be6020830184613881565b6020815260006114be6020830184613801565b6000806000806060858703121561390157600080fd5b61390a856136c9565b935060208501359250604085013567ffffffffffffffff81111561392d57600080fd5b6137a7878288016136f7565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561397857613978613939565b604052919050565b6000806040838503121561399357600080fd5b823567ffffffffffffffff808211156139ab57600080fd5b818501915085601f8301126139bf57600080fd5b81356020828211156139d3576139d3613939565b6139e5601f8301601f1916820161394f565b925081835287818386010111156139fb57600080fd5b8181850182850137600091830181019190915290969401359450505050565b600080600080600060808688031215613a3257600080fd5b613a3b866136c9565b945060208601359350604086013567ffffffffffffffff80821115613a5f57600080fd5b613a6b89838a016136f7565b90955093506060880135915080821115613a8457600080fd5b50613a91888289016136e5565b9150509295509295909350565b8015158114610b5957600080fd5b600060208284031215613abe57600080fd5b81516114be81613a9e565b600060208284031215613adb57600080fd5b5051919050565b6000808335601e19843603018112613af957600080fd5b83018035915067ffffffffffffffff821115613b1457600080fd5b60200191503681900382131561180157600080fd5b600181811c90821680613b3d57607f821691505b60208210810361149a57634e487b7160e01b600052602260045260246000fd5b601f821115613ba757600081815260208120601f850160051c81016020861015613b845750805b601f850160051c820191505b81811015613ba357828155600101613b90565b5050505b505050565b67ffffffffffffffff831115613bc457613bc4613939565b613bd883613bd28354613b29565b83613b5d565b6000601f841160018114613c0c5760008515613bf45750838201355b600019600387901b1c1916600186901b178355613c66565b600083815260209020601f19861690835b82811015613c3d5786850135825560209485019460019092019101613c1d565b5086821015613c5a5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060208284031215613c7f57600080fd5b81356114be81613a9e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103613ccc57613ccc613ca0565b60010192915050565b606081526000613ce86060830186613881565b82810360208481019190915285518083528682019282019060005b81811015613d1f57845183529383019391830191600101613d03565b5050848103604086015285518082528282019350600581901b8201830183880160005b83811015613d7057601f19858403018752613d5e838351613801565b96860196925090850190600101613d42565b50909a9950505050505050505050565b60006020808385031215613d9357600080fd5b825167ffffffffffffffff80821115613dab57600080fd5b818501915085601f830112613dbf57600080fd5b815181811115613dd157613dd1613939565b8060051b9150613de284830161394f565b8181529183018401918481019088841115613dfc57600080fd5b938501935b83851015613e1a57845182529385019390850190613e01565b98975050505050505050565b600060018201613e3857613e38613ca0565b5060010190565b60008154613e4c81613b29565b60018281168015613e645760018114613e7957613ea8565b60ff1984168752821515830287019450613ea8565b8560005260208060002060005b85811015613e9f5781548a820152908401908201613e86565b50505082870194505b5050505092915050565b7f646174613a00000000000000000000000000000000000000000000000000000081526000613ee46005830184613e3f565b7f3b6261736536342c00000000000000000000000000000000000000000000000081526008019392505050565b60008351613f238184602088016137dd565b835190830190613f378183602088016137dd565b01949350505050565b60008251613f528184602087016137dd565b9190910192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b0000000081526000613f8e601c830185613e3f565b7f2c2022696d616765223a2022000000000000000000000000000000000000000081528351613fc481600c8401602088016137dd565b7f227d000000000000000000000000000000000000000000000000000000000000600c9290910191820152600e01949350505050565b60008152600082516140138160018501602087016137dd565b9190910160010192915050565b808201808211156102b5576102b5613ca0565b634e487b7160e01b600052602160045260246000fd5b60008261406657634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561408557614085613ca0565b500290565b7f630000000000000000000000000000000000000000000000000000000000000081526001600160e01b03198360e01b1660018201527f80600e6000396000f300000000000000000000000000000000000000000000006005820152600082516140fb81600e8501602087016137dd565b91909101600e019392505050565b818103818111156102b5576102b5613ca0565b634e487b7160e01b600052603160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220f0e8bc8251880897ae5c8378ed2d56b91595136ade3f3a4d4f67ffc1a79a549464736f6c63430008100033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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