POL Price: $0.293857 (-8.16%)
Gas: 30 GWei
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...633647442024-10-22 20:39:32118 days ago1729629572IN
0x267Dc28A...F2869b287
0 POL0.0013898430.00000004
Set Approval For...597649392024-07-24 20:44:23208 days ago1721853863IN
0x267Dc28A...F2869b287
0 POL0.0014153230.55000002
Set Approval For...595087682024-07-18 11:52:10215 days ago1721303530IN
0x267Dc28A...F2869b287
0 POL0.0014723931.78189299
Set Approval For...590718712024-07-07 14:34:11226 days ago1720362851IN
0x267Dc28A...F2869b287
0 POL0.0013933430.07574534
Set Approval For...590403352024-07-06 19:40:07226 days ago1720294807IN
0x267Dc28A...F2869b287
0 POL0.0013898430.00000004
Set Approval For...585587202024-06-24 18:24:04238 days ago1719253444IN
0x267Dc28A...F2869b287
0 POL0.0035893577.47699612
Set Approval For...583153472024-06-18 15:28:56245 days ago1718724536IN
0x267Dc28A...F2869b287
0 POL0.0024655153.13615337
Set Approval For...577664132024-06-04 17:56:56258 days ago1717523816IN
0x267Dc28A...F2869b287
0 POL0.0044312295.64898841
Set Approval For...558805242024-04-16 6:45:06308 days ago1713249906IN
0x267Dc28A...F2869b287
0 POL0.00714909154.31471967
Set Approval For...558281272024-04-14 22:20:38309 days ago1713133238IN
0x267Dc28A...F2869b287
0 POL0.0067419145.29971834
Set Approval For...557939052024-04-14 1:01:30310 days ago1713056490IN
0x267Dc28A...F2869b287
0 POL0.00494038106.44632168
Set Approval For...556727472024-04-10 18:08:52313 days ago1712772532IN
0x267Dc28A...F2869b287
0 POL0.0045149397.45592248
Set Approval For...555659282024-04-07 22:56:34316 days ago1712530594IN
0x267Dc28A...F2869b287
0 POL0.0033302771.88476484
Set Approval For...555385782024-04-07 6:12:10317 days ago1712470330IN
0x267Dc28A...F2869b287
0 POL0.00864829186.33755832
Set Approval For...554943202024-04-06 2:23:26318 days ago1712370206IN
0x267Dc28A...F2869b287
0 POL0.00517617111.7289386
Set Approval For...554072802024-04-03 18:31:18320 days ago1712169078IN
0x267Dc28A...F2869b287
0 POL0.0094227203.39109882
Set Approval For...553212972024-04-01 11:30:09323 days ago1711971009IN
0x267Dc28A...F2869b287
0 POL0.00491544106.10100253
Set Approval For...551839322024-03-28 17:26:26326 days ago1711646786IN
0x267Dc28A...F2869b287
0 POL0.00497075107.29485543
Set Approval For...551314602024-03-27 8:22:05328 days ago1711527725IN
0x267Dc28A...F2869b287
0 POL0.00747085161.25995533
Set Approval For...550651772024-03-25 14:03:40330 days ago1711375420IN
0x267Dc28A...F2869b287
0 POL0.00813404175.57513519
Set Approval For...550001282024-03-23 20:01:56331 days ago1711224116IN
0x267Dc28A...F2869b287
0 POL0.002320650
Set Approval For...549109202024-03-21 10:27:18334 days ago1711016838IN
0x267Dc28A...F2869b287
0 POL0.0034284873.87075453
Set Approval For...548969022024-03-21 0:58:06334 days ago1710982686IN
0x267Dc28A...F2869b287
0 POL0.0040527387.47908844
Set Approval For...548496662024-03-19 18:33:17335 days ago1710873197IN
0x267Dc28A...F2869b287
0 POL0.0022101447.70646366
Set Approval For...547989842024-03-18 9:42:00337 days ago1710754920IN
0x267Dc28A...F2869b287
0 POL0.00964112208.10579887
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ArcadenMaterials

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 38 : ArcadenMaterials.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {ERC1155LazyMint} from "./ERC1155LazyMint.sol";
import "@thirdweb-dev/contracts/extension/PermissionsEnumerable.sol";
import "@thirdweb-dev/contracts/extension/SignatureMintERC1155.sol";
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
import "@thirdweb-dev/contracts/lib/CurrencyTransferLib.sol";

contract ArcadenMaterials is
    ERC1155LazyMint,
    ERC2771Context,
    PermissionsEnumerable,
    SignatureMintERC1155
{
    bytes32 private minterRole;
    bytes32 private metadataRole;

    event TokensClaimedBatch(
        address _claimer,
        address _receiver,
        uint256[] _tokenIds,
        uint256[] _quantities
    );

    event TokensBatchMintedWithSignatures(
        address indexed signer,
        address indexed mintedTo,
        uint256[] indexed tokenIdsMinted,
        MintRequest[] mintRequests
    );

    constructor(
        address _defaultAdmin,
        string memory _name,
        string memory _symbol,
        address _royaltyRecipient,
        uint128 _royaltyBps,
        address _trustedForwarder
    )
        ERC1155LazyMint(
            _defaultAdmin,
            _name,
            _symbol,
            _royaltyRecipient,
            _royaltyBps
        )
        ERC2771Context(_trustedForwarder)
    {
        bytes32 _minterRole = keccak256("MINTER_ROLE");
        bytes32 _metadataRole = keccak256("METADATA_ROLE");

        _setupOwner(_defaultAdmin);
        _setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
        _setupRole(_minterRole, _defaultAdmin);
        _setupRole(_metadataRole, _defaultAdmin);
        _setRoleAdmin(_metadataRole, _metadataRole);

        minterRole = _minterRole;
        metadataRole = _metadataRole;
    }

    /// @dev Allow only Minter Role to claim
    function verifyClaim(
        address _claimer,
        uint256 _tokenId,
        uint256 _quantity
    ) public view override {
        require(
            hasRole(minterRole, _claimer),
            "Restricted to Minter role holders"
        );
    }

    function claimBatch(
        address _receiver,
        uint256[] memory _tokenIds,
        uint256[] memory _quantities
    ) public payable nonReentrant onlyRole(minterRole) {
        for (uint256 i = 0; i < _tokenIds.length; i += 1) {
            require(_quantities[i] > 0, "No tokens to mint");
            require(_tokenIds[i] < nextTokenIdToMint(), "invalid id");
        }

        _mintBatch(_receiver, _tokenIds, _quantities, "");
        emit TokensClaimedBatch(
            _msgSender(),
            _receiver,
            _tokenIds,
            _quantities
        );
    }

    function mintWithSignature(
        MintRequest calldata _req,
        bytes calldata _signature
    ) external payable returns (address signer) {
        _mintWithSignature(_req, _signature);
    }

    function _mintWithSignature(
        MintRequest calldata _req,
        bytes calldata _signature
    ) internal returns (address signer) {
        require(_req.quantity > 0, "Minting zero tokens.");

        uint256 tokenIdToMint;
        uint256 nextIdToMint = nextTokenIdToMint();

        if (_req.tokenId == type(uint256).max) {
            tokenIdToMint = nextIdToMint;
            nextTokenIdToLazyMint += 1;
        } else {
            require(_req.tokenId < nextIdToMint, "invalid id");
            tokenIdToMint = _req.tokenId;
        }

        signer = _processRequest(_req, _signature);

        address receiver = _req.to;

        _collectPriceOnClaim(
            _req.primarySaleRecipient,
            _req.quantity,
            _req.currency,
            _req.pricePerToken
        );

        if (_req.royaltyRecipient != address(0)) {
            _setupRoyaltyInfoForToken(
                tokenIdToMint,
                _req.royaltyRecipient,
                _req.royaltyBps
            );
        }

        if (_req.tokenId == type(uint256).max) {
            _setTokenURI(tokenIdToMint, _req.uri);
        }

        _mint(receiver, tokenIdToMint, _req.quantity, "");

        emit TokensMintedWithSignature(signer, receiver, tokenIdToMint, _req);
    }

    function _canSignMintRequest(
        address _signer
    ) internal view override returns (bool) {
        return hasRole(minterRole, _signer);
    }

    function _collectPriceOnClaim(
        address _primarySaleRecipient,
        uint256 _quantityToClaim,
        address _currency,
        uint256 _pricePerToken
    ) internal virtual {
        if (_pricePerToken == 0) {
            return;
        }

        uint256 totalPrice = (_quantityToClaim * _pricePerToken) / 1 ether;
        require(totalPrice > 0, "quantity too low");

        if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
            require(msg.value == totalPrice, "Must send total price.");
        }

        address saleRecipient = _primarySaleRecipient;
        CurrencyTransferLib.transferCurrency(
            _currency,
            _msgSender(),
            saleRecipient,
            totalPrice
        );
    }

    function mintBatchWithSignatures(
        MintRequest[] calldata _reqs,
        bytes[] calldata _signatures
    ) external payable returns (address signer) {
        require(
            _reqs.length == _signatures.length,
            "requests and signatures mismatch"
        );

        uint256[] memory ids = new uint256[](_reqs.length);
        uint256[] memory amounts = new uint256[](_reqs.length);

        for (uint256 i = 0; i < _reqs.length; i++) {
            require(_reqs[i].quantity > 0, "Minting zero tokens.");

            uint256 tokenIdToMint;
            uint256 nextIdToMint = nextTokenIdToMint();

            if (_reqs[i].tokenId == type(uint256).max) {
                tokenIdToMint = nextIdToMint;
                nextTokenIdToLazyMint += 1;
            } else {
                require(_reqs[i].tokenId < nextIdToMint, "invalid ID");
                tokenIdToMint = _reqs[i].tokenId;
            }

            signer = _processRequest(_reqs[i], _signatures[i]);

            _collectPriceOnClaim(
                _reqs[i].primarySaleRecipient,
                _reqs[i].quantity,
                _reqs[i].currency,
                _reqs[i].pricePerToken
            );

            if (_reqs[i].royaltyRecipient != address(0)) {
                _setupRoyaltyInfoForToken(
                    tokenIdToMint,
                    _reqs[i].royaltyRecipient,
                    _reqs[i].royaltyBps
                );
            }

            if (_reqs[i].tokenId == type(uint256).max) {
                _setTokenURI(tokenIdToMint, _reqs[i].uri);
            }

            ids[i] = tokenIdToMint;
            amounts[i] = _reqs[i].quantity;
        }

        address receiver = _reqs[0].to;

        _mintBatch(receiver, ids, amounts, "");

        emit TokensBatchMintedWithSignatures(signer, receiver, ids, _reqs);
    }

/**
* @notice Updates the base URI for a batch of tokens. Can only be called if the batch has been revealed/is not encrypted.
*
* @param _index Index of the desired batch in batchIds array
* @param _uri   the new base URI for the batch.
*/
    function updateBatchBaseURI(
        uint256 _index,
        string calldata _uri
    ) external onlyRole(metadataRole) {
        uint256 batchId = getBatchIdAtIndex(_index);
        _setBaseURI(batchId, _uri);
    }

/**
* @notice Freezes the base URI for a batch of tokens.
*
* @param _index Index of the desired batch in batchIds array.
*/
    function freezeBatchBaseURI(
        uint256 _index
    ) external onlyRole(metadataRole) {
        uint256 batchId = getBatchIdAtIndex(_index);
        _freezeBaseURI(batchId);
    }

    function _msgSender()
        internal
        view
        override(ERC2771Context, ERC1155LazyMint)
        returns (address)
    {
        return ERC2771Context._msgSender();
    }

    function _msgData()
        internal
        view
        override(ERC2771Context)
        returns (bytes calldata)
    {
        return ERC2771Context._msgData();
    }
}

File 2 of 38 : ERC2771Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Context variant with ERC2771 support.
 *
 * WARNING: Avoid using this pattern in contracts that rely in a specific calldata length as they'll
 * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC2771
 * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected
 * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive`
 * function only accessible if `msg.data.length == 0`.
 *
 * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption.
 * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender}
 * recovery.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable _trustedForwarder;

    /**
     * @dev Initializes the contract with a trusted forwarder, which will be able to
     * invoke functions on this contract on behalf of other accounts.
     *
     * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}.
     */
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder_) {
        _trustedForwarder = trustedForwarder_;
    }

    /**
     * @dev Returns the address of the trusted forwarder.
     */
    function trustedForwarder() public view virtual returns (address) {
        return _trustedForwarder;
    }

    /**
     * @dev Indicates whether any particular address is the trusted forwarder.
     */
    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == trustedForwarder();
    }

    /**
     * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgSender() internal view virtual override returns (address) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));
        } else {
            return super._msgSender();
        }
    }

    /**
     * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgData() internal view virtual override returns (bytes calldata) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return msg.data[:calldataLength - contextSuffixLength];
        } else {
            return super._msgData();
        }
    }

    /**
     * @dev ERC-2771 specifies the context as being a single address (20 bytes).
     */
    function _contextSuffixLength() internal view virtual override returns (uint256) {
        return 20;
    }
}

File 3 of 38 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 4 of 38 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 5 of 38 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 6 of 38 : IERC1155.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
    @title ERC-1155 Multi Token Standard
    @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
    Note: The ERC-165 identifier for this interface is 0xd9b67a26.
 */
interface IERC1155 {
    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
        The `_operator` argument MUST be msg.sender.
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_id` argument MUST be the token type being transferred.
        The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
    */
    event TransferSingle(
        address indexed _operator,
        address indexed _from,
        address indexed _to,
        uint256 _id,
        uint256 _value
    );

    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
        The `_operator` argument MUST be msg.sender.
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_ids` argument MUST be the list of tokens being transferred.
        The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
    */
    event TransferBatch(
        address indexed _operator,
        address indexed _from,
        address indexed _to,
        uint256[] _ids,
        uint256[] _values
    );

    /**
        @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
    */
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /**
        @dev MUST emit when the URI is updated for a token ID.
        URIs are defined in RFC 3986.
        The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
    */
    event URI(string _value, uint256 indexed _id);

    /**
        @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
        MUST revert on any other error.
        MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
        After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
        @param _from    Source address
        @param _to      Target address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
    */
    function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;

    /**
        @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if length of `_ids` is not the same as length of `_values`.
        MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
        MUST revert on any other error.
        MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
        Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
        After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
        @param _from    Source address
        @param _to      Target address
        @param _ids     IDs of each token type (order and length must match _values array)
        @param _values  Transfer amounts per token type (order and length must match _ids array)
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
    */
    function safeBatchTransferFrom(
        address _from,
        address _to,
        uint256[] calldata _ids,
        uint256[] calldata _values,
        bytes calldata _data
    ) external;

    /**
        @notice Get the balance of an account's Tokens.
        @param _owner  The address of the token holder
        @param _id     ID of the Token
        @return        The _owner's balance of the Token type requested
     */
    function balanceOf(address _owner, uint256 _id) external view returns (uint256);

    /**
        @notice Get the balance of multiple account/token pairs
        @param _owners The addresses of the token holders
        @param _ids    ID of the Tokens
        @return        The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
     */
    function balanceOfBatch(
        address[] calldata _owners,
        uint256[] calldata _ids
    ) external view returns (uint256[] memory);

    /**
        @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
        @dev MUST emit the ApprovalForAll event on success.
        @param _operator  Address to add to the set of authorized operators
        @param _approved  True if the operator is approved, false to revoke approval
    */
    function setApprovalForAll(address _operator, bool _approved) external;

    /**
        @notice Queries the approval status of an operator for a given owner.
        @param _owner     The owner of the Tokens
        @param _operator  Address of authorized operator
        @return           True if the operator is approved, false if not
    */
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}

File 7 of 38 : IERC1155Metadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
    Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/
interface IERC1155Metadata {
    /**
        @notice A distinct Uniform Resource Identifier (URI) for a given token.
        @dev URIs are defined in RFC 3986.
        The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
        @return URI string
    */
    function uri(uint256 _id) external view returns (string memory);
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

File 9 of 38 : 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
 * [EIP](https://eips.ethereum.org/EIPS/eip-165).
 *
 * 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
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * 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 10 of 38 : IERC20.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
interface IERC20 {
    function totalSupply() external view returns (uint256);

    function balanceOf(address who) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    function transfer(address to, uint256 value) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    function transferFrom(address from, address to, uint256 value) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 11 of 38 : IERC2981.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

File 12 of 38 : BatchMintMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 *  @title   Batch-mint Metadata
 *  @notice  The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract
 *           using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single
 *           base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`.
 */

contract BatchMintMetadata {
    /// @dev Largest tokenId of each batch of tokens with the same baseURI + 1 {ex: batchId 100 at position 0 includes tokens 0-99}
    uint256[] private batchIds;

    /// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens.
    mapping(uint256 => string) private baseURI;

    /// @dev Mapping from id of a batch of tokens => to whether the base URI for the respective batch of tokens is frozen.
    mapping(uint256 => bool) public batchFrozen;

    /// @dev This event emits when the metadata of all tokens are frozen.
    /// While not currently supported by marketplaces, this event allows
    /// future indexing if desired.
    event MetadataFrozen();

    // @dev This event emits when the metadata of a range of tokens is updated.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFTs.
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

    /**
     *  @notice         Returns the count of batches of NFTs.
     *  @dev            Each batch of tokens has an in ID and an associated `baseURI`.
     *                  See {batchIds}.
     */
    function getBaseURICount() public view returns (uint256) {
        return batchIds.length;
    }

    /**
     *  @notice         Returns the ID for the batch of tokens at the given index.
     *  @dev            See {getBaseURICount}.
     *  @param _index   Index of the desired batch in batchIds array.
     */
    function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {
        if (_index >= getBaseURICount()) {
            revert("Invalid index");
        }
        return batchIds[_index];
    }

    /// @dev Returns the id for the batch of tokens the given tokenId belongs to.
    function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                index = i;
                batchId = indices[i];

                return (batchId, index);
            }
        }

        revert("Invalid tokenId");
    }

    /// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId.
    function _getBaseURI(uint256 _tokenId) internal view returns (string memory) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                return baseURI[indices[i]];
            }
        }
        revert("Invalid tokenId");
    }

    /// @dev returns the starting tokenId of a given batchId.
    function _getBatchStartId(uint256 _batchID) internal view returns (uint256) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i++) {
            if (_batchID == indices[i]) {
                if (i > 0) {
                    return indices[i - 1];
                }
                return 0;
            }
        }
        revert("Invalid batchId");
    }

    /// @dev Sets the base URI for the batch of tokens with the given batchId.
    function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {
        require(!batchFrozen[_batchId], "Batch frozen");
        baseURI[_batchId] = _baseURI;
        emit BatchMetadataUpdate(_getBatchStartId(_batchId), _batchId);
    }

    /// @dev Freezes the base URI for the batch of tokens with the given batchId.
    function _freezeBaseURI(uint256 _batchId) internal {
        string memory baseURIForBatch = baseURI[_batchId];
        require(bytes(baseURIForBatch).length > 0, "Invalid batch");
        batchFrozen[_batchId] = true;
        emit MetadataFrozen();
    }

    /// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids.
    function _batchMintMetadata(
        uint256 _startId,
        uint256 _amountToMint,
        string memory _baseURIForTokens
    ) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {
        batchId = _startId + _amountToMint;
        nextTokenIdToMint = batchId;

        batchIds.push(batchId);

        baseURI[batchId] = _baseURIForTokens;
    }
}

File 13 of 38 : ContractMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/IContractMetadata.sol";

/**
 *  @title   Contract Metadata
 *  @notice  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
 *           for you contract.
 *           Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
 */

abstract contract ContractMetadata is IContractMetadata {
    /// @notice Returns the contract metadata URI.
    string public override contractURI;

    /**
     *  @notice         Lets a contract admin set the URI for contract-level metadata.
     *  @dev            Caller should be authorized to setup contractURI, e.g. contract admin.
     *                  See {_canSetContractURI}.
     *                  Emits {ContractURIUpdated Event}.
     *
     *  @param _uri     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     */
    function setContractURI(string memory _uri) external override {
        if (!_canSetContractURI()) {
            revert("Not authorized");
        }

        _setupContractURI(_uri);
    }

    /// @dev Lets a contract admin set the URI for contract-level metadata.
    function _setupContractURI(string memory _uri) internal {
        string memory prevURI = contractURI;
        contractURI = _uri;

        emit ContractURIUpdated(prevURI, _uri);
    }

    /// @dev Returns whether contract metadata can be set in the given execution context.
    function _canSetContractURI() internal view virtual returns (bool);
}

File 14 of 38 : LazyMint.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/ILazyMint.sol";
import "./BatchMintMetadata.sol";

/**
 *  The `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs
 *  at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually
 *  minting a non-zero balance of NFTs of those tokenIds.
 */

abstract contract LazyMint is ILazyMint, BatchMintMetadata {
    /// @notice The tokenId assigned to the next new NFT to be lazy minted.
    uint256 internal nextTokenIdToLazyMint;

    /**
     *  @notice                  Lets an authorized address lazy mint a given amount of NFTs.
     *
     *  @param _amount           The number of NFTs to lazy mint.
     *  @param _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each
     *                           of those NFTs is `${baseURIForTokens}/${tokenId}`.
     *  @param _data             Additional bytes data to be used at the discretion of the consumer of the contract.
     *  @return batchId          A unique integer identifier for the batch of NFTs lazy minted together.
     */
    function lazyMint(
        uint256 _amount,
        string calldata _baseURIForTokens,
        bytes calldata _data
    ) public virtual override returns (uint256 batchId) {
        if (!_canLazyMint()) {
            revert("Not authorized");
        }

        if (_amount == 0) {
            revert("0 amt");
        }

        uint256 startId = nextTokenIdToLazyMint;

        (nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens);

        emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);

        return batchId;
    }

    /// @dev Returns whether lazy minting can be performed in the given execution context.
    function _canLazyMint() internal view virtual returns (bool);
}

File 15 of 38 : Multicall.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "../lib/Address.sol";
import "./interface/IMulticall.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
contract Multicall is IMulticall {
    /**
     *  @notice Receives and executes a batch of function calls on this contract.
     *  @dev Receives and executes a batch of function calls on this contract.
     *
     *  @param data The bytes data that makes up the batch of function calls to execute.
     *  @return results The bytes data that makes up the result of the batch of function calls executed.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
        results = new bytes[](data.length);
        address sender = _msgSender();
        bool isForwarder = msg.sender != sender;
        for (uint256 i = 0; i < data.length; i++) {
            if (isForwarder) {
                results[i] = Address.functionDelegateCall(address(this), abi.encodePacked(data[i], sender));
            } else {
                results[i] = Address.functionDelegateCall(address(this), data[i]);
            }
        }
        return results;
    }

    /// @notice Returns the sender in the given execution context.
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

File 16 of 38 : Permissions.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/IPermissions.sol";
import "../lib/Strings.sol";

/**
 *  @title   Permissions
 *  @dev     This contracts provides extending-contracts with role-based access control mechanisms
 */
contract Permissions is IPermissions {
    /// @dev Map from keccak256 hash of a role => a map from address => whether address has role.
    mapping(bytes32 => mapping(address => bool)) private _hasRole;

    /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}.
    mapping(bytes32 => bytes32) private _getRoleAdmin;

    /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles.
    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /// @dev Modifier that checks if an account has the specified role; reverts otherwise.
    modifier onlyRole(bytes32 role) {
        _checkRole(role, msg.sender);
        _;
    }

    /**
     *  @notice         Checks whether an account has a particular role.
     *  @dev            Returns `true` if `account` has been granted `role`.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account for which the role is being checked.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _hasRole[role][account];
    }

    /**
     *  @notice         Checks whether an account has a particular role;
     *                  role restrictions can be swtiched on and off.
     *
     *  @dev            Returns `true` if `account` has been granted `role`.
     *                  Role restrictions can be swtiched on and off:
     *                      - If address(0) has ROLE, then the ROLE restrictions
     *                        don't apply.
     *                      - If address(0) does not have ROLE, then the ROLE
     *                        restrictions will apply.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account for which the role is being checked.
     */
    function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {
        if (!_hasRole[role][address(0)]) {
            return _hasRole[role][account];
        }

        return true;
    }

    /**
     *  @notice         Returns the admin role that controls the specified role.
     *  @dev            See {grantRole} and {revokeRole}.
     *                  To change a role's admin, use {_setRoleAdmin}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     */
    function getRoleAdmin(bytes32 role) external view override returns (bytes32) {
        return _getRoleAdmin[role];
    }

    /**
     *  @notice         Grants a role to an account, if not previously granted.
     *  @dev            Caller must have admin role for the `role`.
     *                  Emits {RoleGranted Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account to which the role is being granted.
     */
    function grantRole(bytes32 role, address account) public virtual override {
        _checkRole(_getRoleAdmin[role], msg.sender);
        if (_hasRole[role][account]) {
            revert("Can only grant to non holders");
        }
        _setupRole(role, account);
    }

    /**
     *  @notice         Revokes role from an account.
     *  @dev            Caller must have admin role for the `role`.
     *                  Emits {RoleRevoked Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account from which the role is being revoked.
     */
    function revokeRole(bytes32 role, address account) public virtual override {
        _checkRole(_getRoleAdmin[role], msg.sender);
        _revokeRole(role, account);
    }

    /**
     *  @notice         Revokes role from the account.
     *  @dev            Caller must have the `role`, with caller being the same as `account`.
     *                  Emits {RoleRevoked Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account from which the role is being revoked.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        if (msg.sender != account) {
            revert("Can only renounce for self");
        }
        _revokeRole(role, account);
    }

    /// @dev Sets `adminRole` as `role`'s admin role.
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = _getRoleAdmin[role];
        _getRoleAdmin[role] = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /// @dev Sets up `role` for `account`
    function _setupRole(bytes32 role, address account) internal virtual {
        _hasRole[role][account] = true;
        emit RoleGranted(role, account, msg.sender);
    }

    /// @dev Revokes `role` from `account`
    function _revokeRole(bytes32 role, address account) internal virtual {
        _checkRole(role, account);
        delete _hasRole[role][account];
        emit RoleRevoked(role, account, msg.sender);
    }

    /// @dev Checks `role` for `account`. Reverts with a message including the required role.
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!_hasRole[role][account]) {
            revert(
                string(
                    abi.encodePacked(
                        "Permissions: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /// @dev Checks `role` for `account`. Reverts with a message including the required role.
    function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {
        if (!hasRoleWithSwitch(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "Permissions: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }
}

File 17 of 38 : PermissionsEnumerable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/IPermissionsEnumerable.sol";
import "./Permissions.sol";

/**
 *  @title   PermissionsEnumerable
 *  @dev     This contracts provides extending-contracts with role-based access control mechanisms.
 *           Also provides interfaces to view all members with a given role, and total count of members.
 */
contract PermissionsEnumerable is IPermissionsEnumerable, Permissions {
    /**
     *  @notice A data structure to store data of members for a given role.
     *
     *  @param index    Current index in the list of accounts that have a role.
     *  @param members  map from index => address of account that has a role
     *  @param indexOf  map from address => index which the account has.
     */
    struct RoleMembers {
        uint256 index;
        mapping(uint256 => address) members;
        mapping(address => uint256) indexOf;
    }

    /// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}.
    mapping(bytes32 => RoleMembers) private roleMembers;

    /**
     *  @notice         Returns the role-member from a list of members for a role,
     *                  at a given index.
     *  @dev            Returns `member` who has `role`, at `index` of role-members list.
     *                  See struct {RoleMembers}, and mapping {roleMembers}
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param index    Index in list of current members for the role.
     *
     *  @return member  Address of account that has `role`
     */
    function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {
        uint256 currentIndex = roleMembers[role].index;
        uint256 check;

        for (uint256 i = 0; i < currentIndex; i += 1) {
            if (roleMembers[role].members[i] != address(0)) {
                if (check == index) {
                    member = roleMembers[role].members[i];
                    return member;
                }
                check += 1;
            } else if (hasRole(role, address(0)) && i == roleMembers[role].indexOf[address(0)]) {
                check += 1;
            }
        }
    }

    /**
     *  @notice         Returns total number of accounts that have a role.
     *  @dev            Returns `count` of accounts that have `role`.
     *                  See struct {RoleMembers}, and mapping {roleMembers}
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *
     *  @return count   Total number of accounts that have `role`
     */
    function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {
        uint256 currentIndex = roleMembers[role].index;

        for (uint256 i = 0; i < currentIndex; i += 1) {
            if (roleMembers[role].members[i] != address(0)) {
                count += 1;
            }
        }
        if (hasRole(role, address(0))) {
            count += 1;
        }
    }

    /// @dev Revokes `role` from `account`, and removes `account` from {roleMembers}
    ///      See {_removeMember}
    function _revokeRole(bytes32 role, address account) internal override {
        super._revokeRole(role, account);
        _removeMember(role, account);
    }

    /// @dev Grants `role` to `account`, and adds `account` to {roleMembers}
    ///      See {_addMember}
    function _setupRole(bytes32 role, address account) internal override {
        super._setupRole(role, account);
        _addMember(role, account);
    }

    /// @dev adds `account` to {roleMembers}, for `role`
    function _addMember(bytes32 role, address account) internal {
        uint256 idx = roleMembers[role].index;
        roleMembers[role].index += 1;

        roleMembers[role].members[idx] = account;
        roleMembers[role].indexOf[account] = idx;
    }

    /// @dev removes `account` from {roleMembers}, for `role`
    function _removeMember(bytes32 role, address account) internal {
        uint256 idx = roleMembers[role].indexOf[account];

        delete roleMembers[role].members[idx];
        delete roleMembers[role].indexOf[account];
    }
}

File 18 of 38 : Royalty.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/IRoyalty.sol";

/**
 *  @title   Royalty
 *  @notice  Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *           the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
 *           that uses information about royalty fees, if desired.
 *
 *  @dev     The `Royalty` contract is ERC2981 compliant.
 */

abstract contract Royalty is IRoyalty {
    /// @dev The (default) address that receives all royalty value.
    address private royaltyRecipient;

    /// @dev The (default) % of a sale to take as royalty (in basis points).
    uint16 private royaltyBps;

    /// @dev Token ID => royalty recipient and bps for token
    mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;

    /**
     *  @notice   View royalty info for a given token and sale price.
     *  @dev      Returns royalty amount and recipient for `tokenId` and `salePrice`.
     *  @param tokenId          The tokenID of the NFT for which to query royalty info.
     *  @param salePrice        Sale price of the token.
     *
     *  @return receiver        Address of royalty recipient account.
     *  @return royaltyAmount   Royalty amount calculated at current royaltyBps value.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view virtual override returns (address receiver, uint256 royaltyAmount) {
        (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);
        receiver = recipient;
        royaltyAmount = (salePrice * bps) / 10_000;
    }

    /**
     *  @notice          View royalty info for a given token.
     *  @dev             Returns royalty recipient and bps for `_tokenId`.
     *  @param _tokenId  The tokenID of the NFT for which to query royalty info.
     */
    function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) {
        RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];

        return
            royaltyForToken.recipient == address(0)
                ? (royaltyRecipient, uint16(royaltyBps))
                : (royaltyForToken.recipient, uint16(royaltyForToken.bps));
    }

    /**
     *  @notice Returns the defualt royalty recipient and BPS for this contract's NFTs.
     */
    function getDefaultRoyaltyInfo() external view override returns (address, uint16) {
        return (royaltyRecipient, uint16(royaltyBps));
    }

    /**
     *  @notice         Updates default royalty recipient and bps.
     *  @dev            Caller should be authorized to set royalty info.
     *                  See {_canSetRoyaltyInfo}.
     *                  Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}.
     *
     *  @param _royaltyRecipient   Address to be set as default royalty recipient.
     *  @param _royaltyBps         Updated royalty bps.
     */
    function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
        if (!_canSetRoyaltyInfo()) {
            revert("Not authorized");
        }

        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
    }

    /// @dev Lets a contract admin update the default royalty recipient and bps.
    function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal {
        if (_royaltyBps > 10_000) {
            revert("Exceeds max bps");
        }

        royaltyRecipient = _royaltyRecipient;
        royaltyBps = uint16(_royaltyBps);

        emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
    }

    /**
     *  @notice         Updates default royalty recipient and bps for a particular token.
     *  @dev            Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info.
     *                  See {_canSetRoyaltyInfo}.
     *                  Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}.
     *
     *  @param _recipient   Address to be set as royalty recipient for given token Id.
     *  @param _bps         Updated royalty bps for the token Id.
     */
    function setRoyaltyInfoForToken(uint256 _tokenId, address _recipient, uint256 _bps) external override {
        if (!_canSetRoyaltyInfo()) {
            revert("Not authorized");
        }

        _setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);
    }

    /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id.
    function _setupRoyaltyInfoForToken(uint256 _tokenId, address _recipient, uint256 _bps) internal {
        if (_bps > 10_000) {
            revert("Exceeds max bps");
        }

        royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });

        emit RoyaltyForToken(_tokenId, _recipient, _bps);
    }

    /// @dev Returns whether royalty info can be set in the given execution context.
    function _canSetRoyaltyInfo() internal view virtual returns (bool);
}

File 19 of 38 : SignatureMintERC1155.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./interface/ISignatureMintERC1155.sol";
import "../external-deps/openzeppelin/utils/cryptography/EIP712.sol";

abstract contract SignatureMintERC1155 is EIP712, ISignatureMintERC1155 {
    using ECDSA for bytes32;

    bytes32 internal constant TYPEHASH =
        keccak256(
            "MintRequest(address to,address royaltyRecipient,uint256 royaltyBps,address primarySaleRecipient,uint256 tokenId,string uri,uint256 quantity,uint256 pricePerToken,address currency,uint128 validityStartTimestamp,uint128 validityEndTimestamp,bytes32 uid)"
        );

    /// @dev Mapping from mint request UID => whether the mint request is processed.
    mapping(bytes32 => bool) private minted;

    constructor() EIP712("SignatureMintERC1155", "1") {}

    /// @dev Verifies that a mint request is signed by an account holding MINTER_ROLE (at the time of the function call).
    function verify(
        MintRequest calldata _req,
        bytes calldata _signature
    ) public view override returns (bool success, address signer) {
        signer = _recoverAddress(_req, _signature);
        success = !minted[_req.uid] && _canSignMintRequest(signer);
    }

    /// @dev Returns whether a given address is authorized to sign mint requests.
    function _canSignMintRequest(address _signer) internal view virtual returns (bool);

    /// @dev Verifies a mint request and marks the request as minted.
    function _processRequest(MintRequest calldata _req, bytes calldata _signature) internal returns (address signer) {
        bool success;
        (success, signer) = verify(_req, _signature);

        require(success, "Invalid request");
        require(
            _req.validityStartTimestamp <= block.timestamp && block.timestamp <= _req.validityEndTimestamp,
            "Request expired"
        );
        require(_req.to != address(0), "recipient undefined");
        require(_req.quantity > 0, "0 qty");

        minted[_req.uid] = true;
    }

    /// @dev Returns the address of the signer of the mint request.
    function _recoverAddress(MintRequest calldata _req, bytes calldata _signature) internal view returns (address) {
        return _hashTypedDataV4(keccak256(_encodeRequest(_req))).recover(_signature);
    }

    /// @dev Resolves 'stack too deep' error in `recoverAddress`.
    function _encodeRequest(MintRequest calldata _req) internal pure returns (bytes memory) {
        return
            bytes.concat(
                abi.encode(
                    TYPEHASH,
                    _req.to,
                    _req.royaltyRecipient,
                    _req.royaltyBps,
                    _req.primarySaleRecipient,
                    _req.tokenId,
                    keccak256(bytes(_req.uri))
                ),
                abi.encode(
                    _req.quantity,
                    _req.pricePerToken,
                    _req.currency,
                    _req.validityStartTimestamp,
                    _req.validityEndTimestamp,
                    _req.uid
                )
            );
    }
}

File 20 of 38 : IClaimableERC1155.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

interface IClaimableERC1155 {
    /// @dev Emitted when tokens are claimed
    event TokensClaimed(
        address indexed claimer,
        address indexed receiver,
        uint256 indexed tokenId,
        uint256 quantityClaimed
    );

    /**
     *  @notice          Lets an address claim multiple lazy minted NFTs at once to a recipient.
     *                   Contract creators should override this function to create custom logic for claiming,
     *                   for e.g. price collection, allowlist, max quantity, etc.
     *
     *  @dev             The logic in the `verifyClaim` function determines whether the caller is authorized to mint NFTs.
     *
     *  @param _receiver  The recipient of the tokens to mint.
     *  @param _tokenId   The tokenId of the lazy minted NFT to mint.
     *  @param _quantity  The number of tokens to mint.
     */
    function claim(address _receiver, uint256 _tokenId, uint256 _quantity) external payable;

    /**
     *  @notice          Override this function to add logic for claim verification, based on conditions
     *                   such as allowlist, price, max quantity etc.
     *
     *  @dev             Checks a request to claim NFTs against a custom condition.
     *
     *  @param _claimer   Caller of the claim function.
     *  @param _tokenId   The tokenId of the lazy minted NFT to mint.
     *  @param _quantity  The number of NFTs being claimed.
     */
    function verifyClaim(address _claimer, uint256 _tokenId, uint256 _quantity) external view;
}

File 21 of 38 : IContractMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 *  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
 *  for you contract.
 *
 *  Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
 */

interface IContractMetadata {
    /// @dev Returns the metadata URI of the contract.
    function contractURI() external view returns (string memory);

    /**
     *  @dev Sets contract URI for the storefront-level metadata of the contract.
     *       Only module admin can call this function.
     */
    function setContractURI(string calldata _uri) external;

    /// @dev Emitted when the contract URI is updated.
    event ContractURIUpdated(string prevURI, string newURI);
}

File 22 of 38 : ILazyMint.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 *  Thirdweb's `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs
 *  at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually
 *  minting a non-zero balance of NFTs of those tokenIds.
 */

interface ILazyMint {
    /// @dev Emitted when tokens are lazy minted.
    event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);

    /**
     *  @notice Lazy mints a given amount of NFTs.
     *
     *  @param amount           The number of NFTs to lazy mint.
     *
     *  @param baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each
     *                          of those NFTs is `${baseURIForTokens}/${tokenId}`.
     *
     *  @param extraData        Additional bytes data to be used at the discretion of the consumer of the contract.
     *
     *  @return batchId         A unique integer identifier for the batch of NFTs lazy minted together.
     */
    function lazyMint(
        uint256 amount,
        string calldata baseURIForTokens,
        bytes calldata extraData
    ) external returns (uint256 batchId);
}

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

/// @author thirdweb

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
interface IMulticall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}

File 24 of 38 : IOwnable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 *  Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *  who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
 *  information about who the contract's owner is.
 */

interface IOwnable {
    /// @dev Returns the owner of the contract.
    function owner() external view returns (address);

    /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.
    function setOwner(address _newOwner) external;

    /// @dev Emitted when a new Owner is set.
    event OwnerUpdated(address indexed prevOwner, address indexed newOwner);
}

File 25 of 38 : IPermissions.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IPermissions {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 26 of 38 : IPermissionsEnumerable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "./IPermissions.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IPermissionsEnumerable is IPermissions {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296)
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 27 of 38 : IRoyalty.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "../../eip/interface/IERC2981.sol";

/**
 *  Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *  the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
 *  that uses information about royalty fees, if desired.
 *
 *  The `Royalty` contract is ERC2981 compliant.
 */

interface IRoyalty is IERC2981 {
    struct RoyaltyInfo {
        address recipient;
        uint256 bps;
    }

    /// @dev Returns the royalty recipient and fee bps.
    function getDefaultRoyaltyInfo() external view returns (address, uint16);

    /// @dev Lets a module admin update the royalty bps and recipient.
    function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;

    /// @dev Lets a module admin set the royalty recipient for a particular token Id.
    function setRoyaltyInfoForToken(uint256 tokenId, address recipient, uint256 bps) external;

    /// @dev Returns the royalty recipient for a particular token Id.
    function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);

    /// @dev Emitted when royalty info is updated.
    event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps);

    /// @dev Emitted when royalty recipient for tokenId is set
    event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);
}

File 28 of 38 : ISignatureMintERC1155.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

/**
 *  The 'signature minting' mechanism used in thirdweb Token smart contracts is a way for a contract admin to authorize an external party's
 *  request to mint tokens on the admin's contract.
 *
 *  At a high level, this means you can authorize some external party to mint tokens on your contract, and specify what exactly will be
 *  minted by that external party.
 */
interface ISignatureMintERC1155 {
    /**
     *  @notice The body of a request to mint tokens.
     *
     *  @param to The receiver of the tokens to mint.
     *  @param royaltyRecipient The recipient of the minted token's secondary sales royalties. (Not applicable for ERC20 tokens)
     *  @param royaltyBps The percentage of the minted token's secondary sales to take as royalties. (Not applicable for ERC20 tokens)
     *  @param primarySaleRecipient The recipient of the minted token's primary sales proceeds.
     *  @param tokenId The tokenId of the token to mint. (Only applicable for ERC1155 tokens)
     *  @param uri The metadata URI of the token to mint. (Not applicable for ERC20 tokens)
     *  @param quantity The quantity of tokens to mint.
     *  @param pricePerToken The price to pay per quantity of tokens minted.
     *  @param currency The currency in which to pay the price per token minted.
     *  @param validityStartTimestamp The unix timestamp after which the payload is valid.
     *  @param validityEndTimestamp The unix timestamp at which the payload expires.
     *  @param uid A unique identifier for the payload.
     */
    struct MintRequest {
        address to;
        address royaltyRecipient;
        uint256 royaltyBps;
        address primarySaleRecipient;
        uint256 tokenId;
        string uri;
        uint256 quantity;
        uint256 pricePerToken;
        address currency;
        uint128 validityStartTimestamp;
        uint128 validityEndTimestamp;
        bytes32 uid;
    }

    /// @dev Emitted when tokens are minted.
    event TokensMintedWithSignature(
        address indexed signer,
        address indexed mintedTo,
        uint256 indexed tokenIdMinted,
        MintRequest mintRequest
    );

    /**
     *  @notice Verifies that a mint request is signed by an account holding
     *          MINTER_ROLE (at the time of the function call).
     *
     *  @param req The payload / mint request.
     *  @param signature The signature produced by an account signing the mint request.
     *
     *  returns (success, signer) Result of verification and the recovered address.
     */
    function verify(
        MintRequest calldata req,
        bytes calldata signature
    ) external view returns (bool success, address signer);

    /**
     *  @notice Mints tokens according to the provided mint request.
     *
     *  @param req The payload / mint request.
     *  @param signature The signature produced by an account signing the mint request.
     */
    function mintWithSignature(
        MintRequest calldata req,
        bytes calldata signature
    ) external payable returns (address signer);
}

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

pragma solidity ^0.8.0;

import "../../../../../eip/interface/IERC20.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";

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

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

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

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

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

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

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

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

File 30 of 38 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../../../../lib/Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 31 of 38 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 32 of 38 : IWETH.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 amount) external;

    function transfer(address to, uint256 value) external returns (bool);
}

File 33 of 38 : Address.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.1;

/// @author thirdweb, OpenZeppelin Contracts (v4.9.0)

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 34 of 38 : CurrencyTransferLib.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

// Helper interfaces
import { IWETH } from "../infra/interface/IWETH.sol";
import { SafeERC20, IERC20 } from "../external-deps/openzeppelin/token/ERC20/utils/SafeERC20.sol";

library CurrencyTransferLib {
    using SafeERC20 for IERC20;

    /// @dev The address interpreted as native token of the chain.
    address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    /// @dev Transfers a given amount of currency.
    function transferCurrency(address _currency, address _from, address _to, uint256 _amount) internal {
        if (_amount == 0) {
            return;
        }

        if (_currency == NATIVE_TOKEN) {
            safeTransferNativeToken(_to, _amount);
        } else {
            safeTransferERC20(_currency, _from, _to, _amount);
        }
    }

    /// @dev Transfers a given amount of currency. (With native token wrapping)
    function transferCurrencyWithWrapper(
        address _currency,
        address _from,
        address _to,
        uint256 _amount,
        address _nativeTokenWrapper
    ) internal {
        if (_amount == 0) {
            return;
        }

        if (_currency == NATIVE_TOKEN) {
            if (_from == address(this)) {
                // withdraw from weth then transfer withdrawn native token to recipient
                IWETH(_nativeTokenWrapper).withdraw(_amount);
                safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
            } else if (_to == address(this)) {
                // store native currency in weth
                require(_amount == msg.value, "msg.value != amount");
                IWETH(_nativeTokenWrapper).deposit{ value: _amount }();
            } else {
                safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
            }
        } else {
            safeTransferERC20(_currency, _from, _to, _amount);
        }
    }

    /// @dev Transfer `amount` of ERC20 token from `from` to `to`.
    function safeTransferERC20(address _currency, address _from, address _to, uint256 _amount) internal {
        if (_from == _to) {
            return;
        }

        if (_from == address(this)) {
            IERC20(_currency).safeTransfer(_to, _amount);
        } else {
            IERC20(_currency).safeTransferFrom(_from, _to, _amount);
        }
    }

    /// @dev Transfers `amount` of native token to `to`.
    function safeTransferNativeToken(address to, uint256 value) internal {
        // solhint-disable avoid-low-level-calls
        // slither-disable-next-line low-level-calls
        (bool success, ) = to.call{ value: value }("");
        require(success, "native token transfer failed");
    }

    /// @dev Transfers `amount` of native token to `to`. (With native token wrapping)
    function safeTransferNativeTokenWithWrapper(address to, uint256 value, address _nativeTokenWrapper) internal {
        // solhint-disable avoid-low-level-calls
        // slither-disable-next-line low-level-calls
        (bool success, ) = to.call{ value: value }("");
        if (!success) {
            IWETH(_nativeTokenWrapper).deposit{ value: value }();
            IERC20(_nativeTokenWrapper).safeTransfer(to, value);
        }
    }
}

File 35 of 38 : Strings.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

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

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

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

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

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

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte,
    /// and the alphabets are capitalized conditionally according to
    /// https://eips.ethereum.org/EIPS/eip-55
    function toHexStringChecksummed(address value) internal pure returns (string memory str) {
        str = toHexString(value);
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`
            let o := add(str, 0x22)
            let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
            let t := shl(240, 136) // `0b10001000 << 240`
            for {
                let i := 0
            } 1 {

            } {
                mstore(add(i, i), mul(t, byte(i, hashed)))
                i := add(i, 1)
                if eq(i, 20) {
                    break
                }
            }
            mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
            o := add(o, 0x20)
            mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    function toHexString(address value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            str := mload(0x40)

            // Allocate the memory.
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x28 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.
            mstore(0x40, add(str, 0x80))

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            str := add(str, 2)
            mstore(str, 40)

            let o := add(str, 0x20)
            mstore(add(o, 40), 0)

            value := shl(96, value)

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for {
                let i := 0
            } 1 {

            } {
                let p := add(o, add(i, i))
                let temp := byte(i, value)
                mstore8(add(p, 1), mload(and(temp, 15)))
                mstore8(p, mload(shr(4, temp)))
                i := add(i, 1)
                if eq(i, 20) {
                    break
                }
            }
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexString(bytes memory raw) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(raw);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(raw)
            str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.
            mstore(str, add(length, length)) // Store the length of the output.

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let o := add(str, 0x20)
            let end := add(raw, length)

            for {

            } iszero(eq(raw, end)) {

            } {
                raw := add(raw, 1)
                mstore8(add(o, 1), mload(and(mload(raw), 15)))
                mstore8(o, mload(and(shr(4, mload(raw)), 15)))
                o := add(o, 2)
            }
            mstore(o, 0) // Zeroize the slot after the string.
            mstore(0x40, add(o, 0x20)) // Allocate the memory.
        }
    }
}

File 36 of 38 : ERC1155LazyMint.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {ERC1155} from "./eip/ERC1155.sol";
import "@thirdweb-dev/contracts/extension/ContractMetadata.sol";
import "@thirdweb-dev/contracts/extension/Multicall.sol";
import {Ownable} from "./extension/Ownable.sol";
import "@thirdweb-dev/contracts/extension/Royalty.sol";
import "@thirdweb-dev/contracts/extension/BatchMintMetadata.sol";
import "@thirdweb-dev/contracts/extension/LazyMint.sol";
import "@thirdweb-dev/contracts/extension/interface/IClaimableERC1155.sol";

import "@thirdweb-dev/contracts/lib/Strings.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract ERC1155LazyMint is
    ERC1155,
    ContractMetadata,
    Ownable,
    Royalty,
    Multicall,
    BatchMintMetadata,
    LazyMint,
    IClaimableERC1155,
    ReentrancyGuard
{
    using Strings for uint256;

    /*//////////////////////////////////////////////////////////////
                        Mappings
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice Returns the total supply of NFTs of a given tokenId
     *  @dev Mapping from tokenId => total circulating supply of NFTs of that tokenId.
     */
    mapping(uint256 => uint256) public totalSupply;

    /*//////////////////////////////////////////////////////////////
                            Constructor
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice Initializes the contract during construction.
     *
     * @param _defaultAdmin     The default admin of the contract.
     * @param _name             The name of the contract.
     * @param _symbol           The symbol of the contract.
     * @param _royaltyRecipient The address to receive royalties.
     * @param _royaltyBps       The royalty basis points to be charged. Max = 10000 (10000 = 100%, 1000 = 10%)
     */
    constructor(
        address _defaultAdmin,
        string memory _name,
        string memory _symbol,
        address _royaltyRecipient,
        uint128 _royaltyBps
    ) ERC1155(_name, _symbol) {
        _setupOwner(_defaultAdmin);
        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
    }

    /*//////////////////////////////////////////////////////////////
                    Overriden metadata logic
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice Returns the metadata URI for the given tokenId.
     *
     * @param _tokenId The tokenId of the NFT.
     * @return The metadata URI for the given tokenId.
     */
    function uri(
        uint256 _tokenId
    ) public view virtual override returns (string memory) {
        string memory batchUri = _getBaseURI(_tokenId);
        return string(abi.encodePacked(batchUri, _tokenId.toString()));
    }

    /*//////////////////////////////////////////////////////////////
                            CLAIM LOGIC
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice          Lets an address claim multiple lazy minted NFTs at once to a recipient.
     *                   This function prevents any reentrant calls, and is not allowed to be overridden.
     *
     *                   Contract creators should override `verifyClaim` and `transferTokensOnClaim`
     *                   functions to create custom logic for verification and claiming,
     *                   for e.g. price collection, allowlist, max quantity, etc.
     *
     *  @dev             The logic in `verifyClaim` determines whether the caller is authorized to mint NFTs.
     *                   The logic in `transferTokensOnClaim` does actual minting of tokens,
     *                   can also be used to apply other state changes.
     *
     *  @param _receiver  The recipient of the tokens to mint.
     *  @param _tokenId   The tokenId of the lazy minted NFT to mint.
     *  @param _quantity  The number of tokens to mint.
     */
    function claim(
        address _receiver,
        uint256 _tokenId,
        uint256 _quantity
    ) public payable virtual nonReentrant {
        require(_tokenId < nextTokenIdToMint(), "invalid id");
        verifyClaim(_msgSender(), _tokenId, _quantity); // Add your claim verification logic by overriding this function.

        _transferTokensOnClaim(_receiver, _tokenId, _quantity); // Mints tokens. Apply any state updates by overriding this function.
        emit TokensClaimed(_msgSender(), _receiver, _tokenId, _quantity);
    }

    /**
     *  @notice          Override this function to add logic for claim verification, based on conditions
     *                   such as allowlist, price, max quantity etc.
     *
     *  @dev             Checks a request to claim NFTs against a custom condition.
     *
     *  @param _claimer   Caller of the claim function.
     *  @param _tokenId   The tokenId of the lazy minted NFT to mint.
     *  @param _quantity  The number of NFTs being claimed.
     */
    function verifyClaim(
        address _claimer,
        uint256 _tokenId,
        uint256 _quantity
    ) public view virtual {}

    /**
     *  @notice         Lets an owner or approved operator burn NFTs of the given tokenId.
     *
     *  @param _owner   The owner of the NFT to burn.
     *  @param _tokenId The tokenId of the NFT to burn.
     *  @param _amount  The amount of the NFT to burn.
     */
    function burn(
        address _owner,
        uint256 _tokenId,
        uint256 _amount
    ) external virtual {
        address caller = _msgSender();

        require(
            caller == _owner || isApprovedForAll[_owner][caller],
            "Unapproved caller"
        );
        require(
            balanceOf[_owner][_tokenId] >= _amount,
            "Not enough tokens owned"
        );

        _burn(_owner, _tokenId, _amount);
    }

    /**
     *  @notice         Lets an owner or approved operator burn NFTs of the given tokenIds.
     *
     *  @param _owner    The owner of the NFTs to burn.
     *  @param _tokenIds The tokenIds of the NFTs to burn.
     *  @param _amounts  The amounts of the NFTs to burn.
     */
    function burnBatch(
        address _owner,
        uint256[] memory _tokenIds,
        uint256[] memory _amounts
    ) external virtual {
        address caller = _msgSender();

        require(
            caller == _owner || isApprovedForAll[_owner][caller],
            "Unapproved caller"
        );
        require(_tokenIds.length == _amounts.length, "Length mismatch");

        for (uint256 i = 0; i < _tokenIds.length; i += 1) {
            require(
                balanceOf[_owner][_tokenIds[i]] >= _amounts[i],
                "Not enough tokens owned"
            );
        }

        _burnBatch(_owner, _tokenIds, _amounts);
    }

    /*//////////////////////////////////////////////////////////////
                            ERC165 Logic
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev See ERC165: https://eips.ethereum.org/EIPS/eip-165
     * @inheritdoc IERC165
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC1155, IERC165) returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
            interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI
            interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
    }

    /*//////////////////////////////////////////////////////////////
                            View functions
    //////////////////////////////////////////////////////////////*/

    /// @notice The tokenId assigned to the next new NFT to be lazy minted.
    function nextTokenIdToMint() public view virtual returns (uint256) {
        return nextTokenIdToLazyMint;
    }

    /*//////////////////////////////////////////////////////////////
                        Internal functions
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice          Mints tokens to receiver on claim.
     *                   Any state changes related to `claim` must be applied
     *                   here by overriding this function.
     *
     *  @dev             Override this function to add logic for state updation.
     *                   When overriding, apply any state changes before `_mint`.
     *
     *  @param _receiver The receiver of the tokens to mint.
     *  @param _tokenId  The tokenId of the lazy minted NFT to mint.
     *  @param _quantity The number of tokens to mint.
     */
    function _transferTokensOnClaim(
        address _receiver,
        uint256 _tokenId,
        uint256 _quantity
    ) internal virtual {
        _mint(_receiver, _tokenId, _quantity, "");
    }

    /// @dev Returns whether lazy minting can be done in the given execution context.
    function _canLazyMint() internal view virtual override returns (bool) {
        return _msgSender() == owner();
    }

    /// @dev Returns whether contract metadata can be set in the given execution context.
    function _canSetContractURI()
        internal
        view
        virtual
        override
        returns (bool)
    {
        return _msgSender() == owner();
    }

    /// @dev Returns whether owner can be set in the given execution context.
    function _canSetOwner() internal view virtual override returns (bool) {
        return _msgSender() == owner();
    }

    /// @dev Returns whether royalty info can be set in the given execution context.
    function _canSetRoyaltyInfo()
        internal
        view
        virtual
        override
        returns (bool)
    {
        return _msgSender() == owner();
    }

    /**
     * @dev Runs before every token transfer / mint / burn.
     *
     * @param operator The address performing the token transfer.
     * @param from     The address from which the token is being transferred.
     * @param to       The address to which the token is being transferred.
     * @param ids      The tokenIds of the tokens being transferred.
     * @param amounts  The amounts of the tokens being transferred.
     * @param data     Any additional data being passed in the token transfer.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

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

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

    function _msgSender()
        internal
        view
        virtual
        override(ERC1155, Multicall, Ownable)
        returns (address)
    {
        return super._msgSender();
    }
}

File 37 of 38 : ERC1155.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/eip/interface/IERC1155.sol";
import "@thirdweb-dev/contracts/eip/interface/IERC1155Metadata.sol";
import "@thirdweb-dev/contracts/eip/interface/IERC1155Receiver.sol";

contract ERC1155 is IERC1155, IERC1155Metadata {
    /*//////////////////////////////////////////////////////////////
                        State variables
    //////////////////////////////////////////////////////////////*/

    string public name;
    string public symbol;

    /*//////////////////////////////////////////////////////////////
                            Mappings
    //////////////////////////////////////////////////////////////*/

    mapping(address => mapping(uint256 => uint256)) public balanceOf;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    mapping(uint256 => string) internal _uri;

    /*//////////////////////////////////////////////////////////////
                            Constructor
    //////////////////////////////////////////////////////////////*/

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /*//////////////////////////////////////////////////////////////
                            View functions
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
            interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI
    }

    function uri(
        uint256 tokenId
    ) public view virtual override returns (string memory) {
        return _uri[tokenId];
    }

    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    ) public view virtual override returns (uint256[] memory) {
        require(accounts.length == ids.length, "LENGTH_MISMATCH");

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

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

        return batchBalances;
    }

    /*//////////////////////////////////////////////////////////////
                            ERC1155 logic
    //////////////////////////////////////////////////////////////*/

    function setApprovalForAll(
        address operator,
        bool approved
    ) public virtual override {
        address owner = _msgSender();
        require(owner != operator, "APPROVING_SELF");
        isApprovedForAll[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll[from][_msgSender()],
            "!OWNER_OR_APPROVED"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll[from][_msgSender()],
            "!OWNER_OR_APPROVED"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /*//////////////////////////////////////////////////////////////
                            Internal logic
    //////////////////////////////////////////////////////////////*/

    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "TO_ZERO_ADDR");

        address operator = _msgSender();

        _beforeTokenTransfer(
            operator,
            from,
            to,
            _asSingletonArray(id),
            _asSingletonArray(amount),
            data
        );

        uint256 fromBalance = balanceOf[from][id];
        require(fromBalance >= amount, "INSUFFICIENT_BAL");
        unchecked {
            balanceOf[from][id] = fromBalance - amount;
        }
        balanceOf[to][id] += amount;

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

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

    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "LENGTH_MISMATCH");
        require(to != address(0), "TO_ZERO_ADDR");

        address operator = _msgSender();

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

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

            uint256 fromBalance = balanceOf[from][id];
            require(fromBalance >= amount, "INSUFFICIENT_BAL");
            unchecked {
                balanceOf[from][id] = fromBalance - amount;
            }
            balanceOf[to][id] += amount;
        }

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

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

    function _setTokenURI(
        uint256 tokenId,
        string memory newuri
    ) internal virtual {
        _uri[tokenId] = newuri;
    }

    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "TO_ZERO_ADDR");

        address operator = _msgSender();

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

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

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

    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "TO_ZERO_ADDR");
        require(ids.length == amounts.length, "LENGTH_MISMATCH");

        address operator = _msgSender();

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

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

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

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

    function _burn(address from, uint256 id, uint256 amount) internal virtual {
        require(from != address(0), "FROM_ZERO_ADDR");

        address operator = _msgSender();

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

        uint256 fromBalance = balanceOf[from][id];
        require(fromBalance >= amount, "INSUFFICIENT_BAL");
        unchecked {
            balanceOf[from][id] = fromBalance - amount;
        }

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

    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "FROM_ZERO_ADDR");
        require(ids.length == amounts.length, "LENGTH_MISMATCH");

        address operator = _msgSender();

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

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

            uint256 fromBalance = balanceOf[from][id];
            require(fromBalance >= amount, "INSUFFICIENT_BAL");
            unchecked {
                balanceOf[from][id] = fromBalance - amount;
            }
        }

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

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try
                IERC1155Receiver(to).onERC1155Received(
                    operator,
                    from,
                    id,
                    amount,
                    data
                )
            returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("TOKENS_REJECTED");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("!ERC1155RECEIVER");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try
                IERC1155Receiver(to).onERC1155BatchReceived(
                    operator,
                    from,
                    ids,
                    amounts,
                    data
                )
            returns (bytes4 response) {
                if (
                    response != IERC1155Receiver.onERC1155BatchReceived.selector
                ) {
                    revert("TOKENS_REJECTED");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("!ERC1155RECEIVER");
            }
        }
    }

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

        return array;
    }

    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

File 38 of 38 : Ownable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @author thirdweb

import "@thirdweb-dev/contracts/extension/interface/IOwnable.sol";

/**
 *  @title   Ownable
 *  @notice  Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *           who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
 *           information about who the contract's owner is.
 */

abstract contract Ownable is IOwnable {
    /// @dev Owner of the contract (purpose: OpenSea compatibility)
    address private _owner;

    /// @dev Reverts if caller is not the owner.
    modifier onlyOwner() {
        if (_msgSender() != _owner) {
            revert("Not authorized");
        }
        _;
    }

    /**
     *  @notice Returns the owner of the contract.
     */
    function owner() public view override returns (address) {
        return _owner;
    }

    /**
     *  @notice Lets an authorized wallet set a new owner for the contract.
     *  @param _newOwner The address to set as the new owner of the contract.
     */
    function setOwner(address _newOwner) external override {
        if (!_canSetOwner()) {
            revert("Not authorized");
        }
        _setupOwner(_newOwner);
    }

    /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.
    function _setupOwner(address _newOwner) internal {
        address _prevOwner = _owner;
        _owner = _newOwner;

        emit OwnerUpdated(_prevOwner, _newOwner);
    }

    /// @dev Returns whether owner can be set in the given execution context.
    function _canSetOwner() internal view virtual returns (bool);

    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint128","name":"_royaltyBps","type":"uint128"},{"internalType":"address","name":"_trustedForwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"bool","name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"prevURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRoyaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRoyaltyBps","type":"uint256"}],"name":"DefaultRoyalty","type":"event"},{"anonymous":false,"inputs":[],"name":"MetadataFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"royaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyBps","type":"uint256"}],"name":"RoyaltyForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"address","name":"mintedTo","type":"address"},{"indexed":true,"internalType":"uint256[]","name":"tokenIdsMinted","type":"uint256[]"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"indexed":false,"internalType":"struct ISignatureMintERC1155.MintRequest[]","name":"mintRequests","type":"tuple[]"}],"name":"TokensBatchMintedWithSignatures","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantityClaimed","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_claimer","type":"address"},{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_quantities","type":"uint256[]"}],"name":"TokensClaimedBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"baseURI","type":"string"},{"indexed":false,"internalType":"bytes","name":"encryptedBaseURI","type":"bytes"}],"name":"TokensLazyMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"address","name":"mintedTo","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenIdMinted","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"indexed":false,"internalType":"struct ISignatureMintERC1155.MintRequest","name":"mintRequest","type":"tuple"}],"name":"TokensMintedWithSignature","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"batchFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_quantities","type":"uint256[]"}],"name":"claimBatch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"freezeBatchBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBaseURICount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getBatchIdAtIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRoyaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"member","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRoyaltyInfoForToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRoleWithSwitch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_baseURIForTokens","type":"string"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"lazyMint","outputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC1155.MintRequest[]","name":"_reqs","type":"tuple[]"},{"internalType":"bytes[]","name":"_signatures","type":"bytes[]"}],"name":"mintBatchWithSignatures","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC1155.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintWithSignature","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint256","name":"_royaltyBps","type":"uint256"}],"name":"setDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setRoyaltyInfoForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"}],"name":"updateBatchBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint256","name":"royaltyBps","type":"uint256"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ISignatureMintERC1155.MintRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_claimer","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"verifyClaim","outputs":[],"stateMutability":"view","type":"function"}]

6101606040523480156200001257600080fd5b506040516200633d3803806200633d833981016040819052620000359162000530565b6040518060400160405280601481526020017f5369676e61747572654d696e7445524331313535000000000000000000000000815250604051806040016040528060018152602001603160f81b815250828888888888838381600090816200009e919062000681565b506001620000ad828262000681565b50506001600d5550620000c08562000223565b620000d5826001600160801b03831662000275565b5050506001600160a01b03909216608052505081516020808401919091208251918301919091206101008290526101208190524660c0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200017d8184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b60a0523060e05261014052507f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a692507f6bd6b5318a46e5fff572d5e4258a20774aab40cc35ac7680654b9081fcc82f809150620001dc90508862000223565b620001e960008962000320565b620001f5828962000320565b62000201818962000320565b6200020d81806200033c565b6013919091556014555062000775945050505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b612710811115620002be5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b604482015260640160405180910390fd5b600780546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b6200032c828262000384565b620003388282620003df565b5050565b600082815260106020526040808220805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000828152601160205260408120805491600191906200040083856200074d565b9091555050600092835260116020908152604080852083865260018101835281862080546001600160a01b039096166001600160a01b03199096168617905593855260029093019052912055565b80516001600160a01b03811681146200046657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200049357600080fd5b81516001600160401b0380821115620004b057620004b06200046b565b604051601f8301601f19908116603f01168101908282118183101715620004db57620004db6200046b565b81604052838152602092508683858801011115620004f857600080fd5b600091505b838210156200051c5785820183015181830184015290820190620004fd565b600093810190920192909252949350505050565b60008060008060008060c087890312156200054a57600080fd5b62000555876200044e565b60208801519096506001600160401b03808211156200057357600080fd5b620005818a838b0162000481565b965060408901519150808211156200059857600080fd5b50620005a789828a0162000481565b945050620005b8606088016200044e565b60808801519093506001600160801b0381168114620005d657600080fd5b9150620005e660a088016200044e565b90509295509295509295565b600181811c908216806200060757607f821691505b6020821081036200062857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200067c57600081815260208120601f850160051c81016020861015620006575750805b601f850160051c820191505b81811015620006785782815560010162000663565b5050505b505050565b81516001600160401b038111156200069d576200069d6200046b565b620006b581620006ae8454620005f2565b846200062e565b602080601f831160018114620006ed5760008415620006d45750858301515b600019600386901b1c1916600185901b17855562000678565b600085815260208120601f198616915b828110156200071e57888601518255948401946001909101908401620006fd565b50858210156200073d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200076f57634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a05160c05160e051610100516101205161014051615b5f620007de6000396000614384015260006143d3015260006143ae01526000614307015260006143310152600061435b01526000818161052b015281816105bf015261364f0152615b5f6000f3fe6080604052600436106102875760003560e01c80639010d07c1161015a578063b17cd86f116100c1578063de903ddd1161007a578063de903ddd14610899578063e59e53c2146108b9578063e8a3d485146108cc578063e985e9c5146108e1578063f242432a1461091c578063f5298aca1461093c57600080fd5b8063b17cd86f146107a2578063b24f2d39146107e1578063bd85b0391461080c578063ca15c87314610839578063d37c353b14610859578063d547741f1461087957600080fd5b80639e2e2a96116101135780639e2e2a96146106ed578063a07ced9e14610700578063a217fddf14610720578063a22cb46514610735578063a32fa5b314610755578063ac9650d81461077557600080fd5b80639010d07c1461064557806391d1485414610665578063938e3d7b1461068557806395d89b41146106a557806398a6e993146106ba5780639bcf7a15146106cd57600080fd5b806336568abe116101fe578063600dd5ea116101b7578063600dd5ea1461055b57806363b45e2d1461057b5780636b20c454146105905780637da0a877146105b057806383040532146105f75780638da5cb5b1461062757600080fd5b806336568abe1461044a5780633b1475a71461046a5780634bbb1abf1461047f5780634cc157df1461049f5780634e1273f4146104e1578063572b6c051461050e57600080fd5b80632419f51b116102505780632419f51b1461036b578063248a9ca31461038b5780632a55205a146103b85780632bc43fd9146103f75780632eb2c2d61461040a5780632f2ff15d1461042a57600080fd5b8062fdd58e1461028c57806301ffc9a7146102d757806306fdde03146103075780630e89341c1461032957806313af403514610349575b600080fd5b34801561029857600080fd5b506102c46102a73660046148c8565b600260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102e357600080fd5b506102f76102f2366004614908565b61095c565b60405190151581526020016102ce565b34801561031357600080fd5b5061031c6109c9565b6040516102ce9190614975565b34801561033557600080fd5b5061031c610344366004614988565b610a57565b34801561035557600080fd5b506103696103643660046149a1565b610a98565b005b34801561037757600080fd5b506102c4610386366004614988565b610ad1565b34801561039757600080fd5b506102c46103a6366004614988565b60009081526010602052604090205490565b3480156103c457600080fd5b506103d86103d33660046149bc565b610b3f565b604080516001600160a01b0390931683526020830191909152016102ce565b6103696104053660046149de565b610b7c565b34801561041657600080fd5b50610369610425366004614b64565b610c26565b34801561043657600080fd5b50610369610445366004614c0d565b610cdc565b34801561045657600080fd5b50610369610465366004614c0d565b610d76565b34801561047657600080fd5b50600c546102c4565b34801561048b57600080fd5b5061036961049a3660046149de565b610dd8565b3480156104ab57600080fd5b506104bf6104ba366004614988565b610e3a565b604080516001600160a01b03909316835261ffff9091166020830152016102ce565b3480156104ed57600080fd5b506105016104fc366004614c39565b610ea5565b6040516102ce9190614d3e565b34801561051a57600080fd5b506102f76105293660046149a1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b34801561056757600080fd5b506103696105763660046148c8565b610fb9565b34801561058757600080fd5b506009546102c4565b34801561059c57600080fd5b506103696105ab366004614d51565b610fe7565b3480156105bc57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016102ce565b34801561060357600080fd5b506102f7610612366004614988565b600b6020526000908152604090205460ff1681565b34801561063357600080fd5b506006546001600160a01b03166105df565b34801561065157600080fd5b506105df6106603660046149bc565b61119d565b34801561067157600080fd5b506102f7610680366004614c0d565b61128b565b34801561069157600080fd5b506103696106a0366004614dc4565b6112b6565b3480156106b157600080fd5b5061031c6112e3565b6105df6106c8366004614e4d565b6112f0565b3480156106d957600080fd5b506103696106e8366004614ebe565b6112fd565b6105df6106fb366004614f37565b61132c565b34801561070c57600080fd5b5061036961071b366004614988565b61190b565b34801561072c57600080fd5b506102c4600081565b34801561074157600080fd5b50610369610750366004614fb0565b61192e565b34801561076157600080fd5b506102f7610770366004614c0d565b6119fa565b34801561078157600080fd5b50610795610790366004614fe7565b611a50565b6040516102ce9190615028565b3480156107ae57600080fd5b506107c26107bd366004614e4d565b611bcd565b6040805192151583526001600160a01b039091166020830152016102ce565b3480156107ed57600080fd5b506007546001600160a01b03811690600160a01b900461ffff166104bf565b34801561081857600080fd5b506102c4610827366004614988565b600e6020526000908152604090205481565b34801561084557600080fd5b506102c4610854366004614988565b611c11565b34801561086557600080fd5b506102c461087436600461508a565b611c9a565b34801561088557600080fd5b50610369610894366004614c0d565b611da7565b3480156108a557600080fd5b506103696108b4366004615103565b611dc0565b6103696108c7366004614d51565b611e1a565b3480156108d857600080fd5b5061031c611f4f565b3480156108ed57600080fd5b506102f76108fc366004615141565b600360209081526000928352604080842090915290825290205460ff1681565b34801561092857600080fd5b5061036961093736600461516b565b611f5c565b34801561094857600080fd5b506103696109573660046149de565b61200b565b60006301ffc9a760e01b6001600160e01b03198316148061098d5750636cdb3d1360e11b6001600160e01b03198316145b806109a857506303a24d0760e21b6001600160e01b03198316145b806109c357506001600160e01b0319821663152a902d60e11b145b92915050565b600080546109d6906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054610a02906151cf565b8015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b820191906000526020600020905b815481529060010190602001808311610a3257829003601f168201915b505050505081565b60606000610a6483612114565b905080610a70846122b0565b604051602001610a81929190615203565b604051602081830303815290604052915050919050565b610aa06123b8565b610ac55760405162461bcd60e51b8152600401610abc90615232565b60405180910390fd5b610ace816123ec565b50565b6000610adc60095490565b8210610b1a5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610abc565b60098281548110610b2d57610b2d61525a565b90600052602060002001549050919050565b600080600080610b4e86610e3a565b90945084925061ffff169050612710610b678287615286565b610b7191906152b3565b925050509250929050565b610b8461243e565b600c548210610ba55760405162461bcd60e51b8152600401610abc906152c7565b610bb7610bb0612468565b8383610dd8565b610bc2838383612477565b81836001600160a01b0316610bd5612468565b6001600160a01b03167fff097c7d8b1957a4ff09ef1361b5fb54dcede3941ba836d0beb9d10bec725de684604051610c0f91815260200190565b60405180910390a4610c216001600d55565b505050565b610c2e612468565b6001600160a01b0316856001600160a01b03161480610c8757506001600160a01b038516600090815260036020526040812090610c69612468565b6001600160a01b0316815260208101919091526040016000205460ff165b610cc85760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b6044820152606401610abc565b610cd58585858585612492565b5050505050565b600082815260106020526040902054610cf59033612658565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610d685760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610abc565b610d7282826126d8565b5050565b336001600160a01b03821614610dce5760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610abc565b610d7282826126ec565b610de46013548461128b565b610c215760405162461bcd60e51b815260206004820152602160248201527f5265737472696374656420746f204d696e74657220726f6c6520686f6c6465726044820152607360f81b6064820152608401610abc565b6000818152600860209081526040808320815180830190925280546001600160a01b031680835260019091015492820192909252829115610e815780516020820151610e9b565b6007546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b60608151835114610ec85760405162461bcd60e51b8152600401610abc906152eb565b600083516001600160401b03811115610ee357610ee3614a11565b604051908082528060200260200182016040528015610f0c578160200160208202803683370190505b50905060005b8451811015610fb15760026000868381518110610f3157610f3161525a565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000858381518110610f6d57610f6d61525a565b6020026020010151815260200190815260200160002054828281518110610f9657610f9661525a565b6020908102919091010152610faa81615314565b9050610f12565b509392505050565b610fc16123b8565b610fdd5760405162461bcd60e51b8152600401610abc90615232565b610d728282612743565b6000610ff1612468565b9050836001600160a01b0316816001600160a01b0316148061103857506001600160a01b0380851660009081526003602090815260408083209385168352929052205460ff165b6110785760405162461bcd60e51b81526020600482015260116024820152702ab730b8383937bb32b21031b0b63632b960791b6044820152606401610abc565b81518351146110bb5760405162461bcd60e51b815260206004820152600f60248201526e098cadccee8d040dad2e6dac2e8c6d608b1b6044820152606401610abc565b60005b835181101561118b578281815181106110d9576110d961525a565b602002602001015160026000876001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061111a5761111a61525a565b602002602001015181526020019081526020016000205410156111795760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081d1bdad95b9cc81bdddb9959604a1b6044820152606401610abc565b61118460018261532d565b90506110be565b506111978484846127e9565b50505050565b60008281526011602052604081205481805b828110156112825760008681526011602090815260408083208484526001019091529020546001600160a01b03161561122b578482036112195760008681526011602090815260408083209383526001909301905220546001600160a01b031692506109c3915050565b61122460018361532d565b9150611270565b61123686600061128b565b801561125d5750600086815260116020908152604080832083805260020190915290205481145b156112705761126d60018361532d565b91505b61127b60018261532d565b90506111af565b50505092915050565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6112be6123b8565b6112da5760405162461bcd60e51b8152600401610abc90615232565b610ace816129a5565b600180546109d6906151cf565b6000610fb1848484612a81565b6113056123b8565b6113215760405162461bcd60e51b8152600401610abc90615232565b610c21838383612c57565b600083821461137d5760405162461bcd60e51b815260206004820181905260248201527f726571756573747320616e64207369676e617475726573206d69736d617463686044820152606401610abc565b6000846001600160401b0381111561139757611397614a11565b6040519080825280602002602001820160405280156113c0578160200160208202803683370190505b5090506000856001600160401b038111156113dd576113dd614a11565b604051908082528060200260200182016040528015611406578160200160208202803683370190505b50905060005b8681101561184a5760008888838181106114285761142861525a565b905060200281019061143a9190615340565b60c00135116114825760405162461bcd60e51b815260206004820152601460248201527326b4b73a34b733903d32b937903a37b5b2b7399760611b6044820152606401610abc565b60008061148e600c5490565b90506000198a8a858181106114a5576114a561525a565b90506020028101906114b79190615340565b60800135036114e1578091506001600c60008282546114d6919061532d565b9091555061156f9050565b808a8a858181106114f4576114f461525a565b90506020028101906115069190615340565b60800135106115445760405162461bcd60e51b815260206004820152600a6024820152691a5b9d985b1a5908125160b21b6044820152606401610abc565b8989848181106115565761155661525a565b90506020028101906115689190615340565b6080013591505b6115bf8a8a858181106115845761158461525a565b90506020028101906115969190615340565b8989868181106115a8576115a861525a565b90506020028101906115ba9190615361565b612d18565b95506116858a8a858181106115d6576115d661525a565b90506020028101906115e89190615340565b6115f99060808101906060016149a1565b8b8b8681811061160b5761160b61525a565b905060200281019061161d9190615340565b60c001358c8c878181106116335761163361525a565b90506020028101906116459190615340565b61165890610120810190610100016149a1565b8d8d8881811061166a5761166a61525a565b905060200281019061167c9190615340565b60e00135612eaa565b60008a8a858181106116995761169961525a565b90506020028101906116ab9190615340565b6116bc9060408101906020016149a1565b6001600160a01b03161461173057611730828b8b868181106116e0576116e061525a565b90506020028101906116f29190615340565b6117039060408101906020016149a1565b8c8c878181106117155761171561525a565b90506020028101906117279190615340565b60400135612c57565b6000198a8a858181106117455761174561525a565b90506020028101906117579190615340565b60800135036117d0576117d0828b8b868181106117765761177661525a565b90506020028101906117889190615340565b6117969060a0810190615361565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f9592505050565b818584815181106117e3576117e361525a565b6020026020010181815250508989848181106118015761180161525a565b90506020028101906118139190615340565b60c001358484815181106118295761182961525a565b6020026020010181815250505050808061184290615314565b91505061140c565b506000878760008181106118605761186061525a565b90506020028101906118729190615340565b6118809060208101906149a1565b905061189d81848460405180602001604052806000815250612fad565b826040516118ab91906153a7565b6040518091039020816001600160a01b0316856001600160a01b03167ffaace84ffcf1d6dd686f27b470caf69afeaf08bda7aad1414e29f6957a852d8b8b8b6040516118f8929190615565565b60405180910390a4505050949350505050565b6014546119188133612658565b600061192383610ad1565b9050610c2181613113565b6000611938612468565b9050826001600160a01b0316816001600160a01b03160361198c5760405162461bcd60e51b815260206004820152600e60248201526d20a8282927ab24a723afa9a2a62360911b6044820152606401610abc565b6001600160a01b03818116600081815260036020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b6000828152600f6020908152604080832083805290915281205460ff16611a4757506000828152600f602090815260408083206001600160a01b038516845290915290205460ff166109c3565b50600192915050565b6060816001600160401b03811115611a6a57611a6a614a11565b604051908082528060200260200182016040528015611a9d57816020015b6060815260200190600190039081611a885790505b5090506000611aaa612468565b9050336001600160a01b038216141560005b84811015611282578115611b3b57611b1930878784818110611ae057611ae061525a565b9050602002810190611af29190615361565b86604051602001611b05939291906155d8565b604051602081830303815290604052613230565b848281518110611b2b57611b2b61525a565b6020026020010181905250611bbb565b611b9d30878784818110611b5157611b5161525a565b9050602002810190611b639190615361565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061323092505050565b848281518110611baf57611baf61525a565b60200260200101819052505b80611bc581615314565b915050611abc565b600080611bdb85858561325c565b61016086013560009081526012602052604090205490915060ff16158015611c075750611c07816132b8565b9150935093915050565b600081815260116020526040812054815b81811015611c755760008481526011602090815260408083208484526001019091529020546001600160a01b031615611c6357611c6060018461532d565b92505b611c6e60018261532d565b9050611c22565b50611c8183600061128b565b15611c9457611c9160018361532d565b91505b50919050565b6000611ca46123b8565b611cc05760405162461bcd60e51b8152600401610abc90615232565b85600003611cf85760405162461bcd60e51b81526020600482015260056024820152640c08185b5d60da1b6044820152606401610abc565b6000600c549050611d40818888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132c692505050565b600c919091559150807f2a0365091ef1a40953c670dce28177e37520648a6fdc91506bffac0ab045570d6001611d768a8461532d565b611d8091906155fe565b88888888604051611d95959493929190615611565b60405180910390a25095945050505050565b600082815260106020526040902054610dce9033612658565b601454611dcd8133612658565b6000611dd885610ad1565b9050610cd58185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061332a92505050565b611e2261243e565b601354611e2f8133612658565b60005b8351811015611ee4576000838281518110611e4f57611e4f61525a565b602002602001015111611e985760405162461bcd60e51b8152602060048201526011602482015270139bc81d1bdad95b9cc81d1bc81b5a5b9d607a1b6044820152606401610abc565b600c54848281518110611ead57611ead61525a565b602002602001015110611ed25760405162461bcd60e51b8152600401610abc906152c7565b611edd60018261532d565b9050611e32565b50611f0084848460405180602001604052806000815250612fad565b7f0e66b3940fce94ce97df6ed446d7f2beac30503b04b4ce437e0859e2910dd3ee611f29612468565b858585604051611f3c949392919061564a565b60405180910390a150610c216001600d55565b600580546109d6906151cf565b611f64612468565b6001600160a01b0316856001600160a01b03161480611fbd57506001600160a01b038516600090815260036020526040812090611f9f612468565b6001600160a01b0316815260208101919091526040016000205460ff165b611ffe5760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b6044820152606401610abc565b610cd585858585856133cf565b6000612015612468565b9050836001600160a01b0316816001600160a01b0316148061205c57506001600160a01b0380851660009081526003602090815260408083209385168352929052205460ff165b61209c5760405162461bcd60e51b81526020600482015260116024820152702ab730b8383937bb32b21031b0b63632b960791b6044820152606401610abc565b6001600160a01b03841660009081526002602090815260408083208684529091529020548211156121095760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081d1bdad95b9cc81bdddb9959604a1b6044820152606401610abc565b611197848484613518565b6060600061212160095490565b90506000600980548060200260200160405190810160405280929190818152602001828054801561217157602002820191906000526020600020905b81548152602001906001019080831161215d575b5050505050905060005b82811015612275578181815181106121955761219561525a565b602002602001015185101561226357600a60008383815181106121ba576121ba61525a565b6020026020010151815260200190815260200160002080546121db906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054612207906151cf565b80156122545780601f1061222957610100808354040283529160200191612254565b820191906000526020600020905b81548152906001019060200180831161223757829003601f168201915b50505050509350505050919050565b61226e60018261532d565b905061217b565b5060405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1bdad95b9259608a1b6044820152606401610abc565b6060816000036122d75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561230157806122eb81615314565b91506122fa9050600a836152b3565b91506122db565b6000816001600160401b0381111561231b5761231b614a11565b6040519080825280601f01601f191660200182016040528015612345576020820181803683370190505b5090505b84156123b05761235a6001836155fe565b9150612367600a86615693565b61237290603061532d565b60f81b8183815181106123875761238761525a565b60200101906001600160f81b031916908160001a9053506123a9600a866152b3565b9450612349565b949350505050565b60006123cc6006546001600160a01b031690565b6001600160a01b03166123dd612468565b6001600160a01b031614905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6002600d540361246157604051633ee5aeb560e01b815260040160405180910390fd5b6002600d55565b6000612472613648565b905090565b610c21838383604051806020016040528060008152506136bd565b81518351146124b35760405162461bcd60e51b8152600401610abc906152eb565b6001600160a01b0384166124d95760405162461bcd60e51b8152600401610abc906156a7565b60006124e3612468565b90506124f3818787878787613792565b60005b84518110156125ea5760008582815181106125135761251361525a565b6020026020010151905060008583815181106125315761253161525a565b6020908102919091018101516001600160a01b038b1660009081526002835260408082208683529093529190912054909150818110156125835760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b03808b16600090815260026020818152604080842088855282528084208787039055938d168352908152828220868352905290812080548492906125cf90849061532d565b92505081905550505050806125e390615314565b90506124f6565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161263a9291906156f7565b60405180910390a461265081878787878761389e565b505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff16610d7257612696816001600160a01b031660146139f1565b6126a18360206139f1565b6040516020016126b2929190615725565b60408051601f198184030181529082905262461bcd60e51b8252610abc91600401614975565b6126e28282613b8c565b610d728282613be7565b6126f68282613c54565b60008281526011602090815260408083206001600160a01b03851680855260028201808552838620805487526001909301855292852080546001600160a01b031916905584529152555050565b6127108111156127875760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610abc565b600780546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b6001600160a01b0383166128305760405162461bcd60e51b815260206004820152600e60248201526d232927a6afad22a927afa0a2222960911b6044820152606401610abc565b80518251146128515760405162461bcd60e51b8152600401610abc906152eb565b600061285b612468565b905061287b81856000868660405180602001604052806000815250613792565b60005b835181101561294657600084828151811061289b5761289b61525a565b6020026020010151905060008483815181106128b9576128b961525a565b6020908102919091018101516001600160a01b038916600090815260028352604080822086835290935291909120549091508181101561290b5760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b038816600090815260026020908152604080832095835294905292909220910390558061293e81615314565b91505061287e565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516129979291906156f7565b60405180910390a450505050565b6000600580546129b4906151cf565b80601f01602080910402602001604051908101604052809291908181526020018280546129e0906151cf565b8015612a2d5780601f10612a0257610100808354040283529160200191612a2d565b820191906000526020600020905b815481529060010190602001808311612a1057829003601f168201915b505050505090508160059081612a4391906157d8565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612a75929190615897565b60405180910390a15050565b6000808460c0013511612acd5760405162461bcd60e51b815260206004820152601460248201527326b4b73a34b733903d32b937903a37b5b2b7399760611b6044820152606401610abc565b600080612ad9600c5490565b9050600019866080013503612b09578091506001600c6000828254612afe919061532d565b90915550612b349050565b80866080013510612b2c5760405162461bcd60e51b8152600401610abc906152c7565b856080013591505b612b3f868686612d18565b92506000612b5060208801886149a1565b9050612b86612b656080890160608a016149a1565b60c0890135612b7c6101208b016101008c016149a1565b8a60e00135612eaa565b6000612b986040890160208a016149a1565b6001600160a01b031614612bc457612bc483612bba60408a0160208b016149a1565b8960400135612c57565b600019876080013503612be257612be28361179660a08a018a615361565b612c0181848960c00135604051806020016040528060008152506136bd565b82816001600160a01b0316856001600160a01b03167f0b35afaf155daeef41cc46df86f058df2855c57d30ab134647a6b587e7cc8c398a604051612c4591906158bc565b60405180910390a45050509392505050565b612710811115612c9b5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610abc565b6040805180820182526001600160a01b038481168083526020808401868152600089815260088352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d91016119ed565b600080612d26858585611bcd565b9250905080612d695760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b6044820152606401610abc565b42612d7c610140870161012088016158cf565b6001600160801b031611158015612dad5750612da0610160860161014087016158cf565b6001600160801b03164211155b612deb5760405162461bcd60e51b815260206004820152600f60248201526e14995c5d595cdd08195e1c1a5c9959608a1b6044820152606401610abc565b6000612dfa60208701876149a1565b6001600160a01b031603612e465760405162461bcd60e51b81526020600482015260136024820152721c9958da5c1a595b9d081d5b9919599a5b9959606a1b6044820152606401610abc565b60008560c0013511612e825760405162461bcd60e51b8152602060048201526005602482015264302071747960d81b6044820152606401610abc565b50610160909301356000908152601260205260409020805460ff191660011790555090919050565b8015611197576000670de0b6b3a7640000612ec58386615286565b612ecf91906152b3565b905060008111612f145760405162461bcd60e51b815260206004820152601060248201526f7175616e7469747920746f6f206c6f7760801b6044820152606401610abc565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601612f8157803414612f815760405162461bcd60e51b815260206004820152601660248201527526bab9ba1039b2b732103a37ba30b610383934b1b29760511b6044820152606401610abc565b8461265084612f8e612468565b8385613cb6565b6000828152600460205260409020610c2182826157d8565b6001600160a01b038416612fd35760405162461bcd60e51b8152600401610abc906156a7565b8151835114612ff45760405162461bcd60e51b8152600401610abc906152eb565b6000612ffe612468565b905061300f81600087878787613792565b60005b84518110156130ab5783818151811061302d5761302d61525a565b602002602001015160026000886001600160a01b03166001600160a01b03168152602001908152602001600020600087848151811061306e5761306e61525a565b602002602001015181526020019081526020016000206000828254613093919061532d565b909155508190506130a381615314565b915050613012565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516130fc9291906156f7565b60405180910390a4610cd58160008787878761389e565b6000818152600a60205260408120805461312c906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054613158906151cf565b80156131a55780601f1061317a576101008083540402835291602001916131a5565b820191906000526020600020905b81548152906001019060200180831161318857829003601f168201915b5050505050905060008151116131ed5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840c4c2e8c6d609b1b6044820152606401610abc565b6000828152600b6020526040808220805460ff19166001179055517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d71649190a15050565b60606132558383604051806060016040528060278152602001615b0360279139613cfc565b9392505050565b60006123b083838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132b292506132a69150889050613d74565b80519060200120613f00565b90613f2d565b60006109c36013548361128b565b6000806132d3848661532d565b60098054600181019091557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018190556000818152600a6020526040902090925082915061332184826157d8565b50935093915050565b6000828152600b602052604090205460ff16156133785760405162461bcd60e51b815260206004820152600c60248201526b2130ba31b410333937bd32b760a11b6044820152606401610abc565b6000828152600a6020526040902061339082826157d8565b507f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6133bb83613f49565b604080519182526020820185905201612a75565b6001600160a01b0384166133f55760405162461bcd60e51b8152600401610abc906156a7565b60006133ff612468565b905061341f81878761341088614063565b61341988614063565b87613792565b6001600160a01b0386166000908152600260209081526040808320878452909152902054838110156134635760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b0380881660009081526002602081815260408084208a855282528084208987039055938a168352908152828220888352905290812080548692906134af90849061532d565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461350f8288888888886140ae565b50505050505050565b6001600160a01b03831661355f5760405162461bcd60e51b815260206004820152600e60248201526d232927a6afad22a927afa0a2222960911b6044820152606401610abc565b6000613569612468565b90506135998185600061357b87614063565b61358487614063565b60405180602001604052806000815250613792565b6001600160a01b0384166000908152600260209081526040808320868452909152902054828110156135dd5760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b03858116600081815260026020908152604080832089845282528083208887039055805189815291820188905291938616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b60003660147f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331480156136855750808210155b156136b55760003661369783856155fe565b6136a29282906158ea565b6136ab91615914565b60601c9250505090565b339250505090565b6001600160a01b0384166136e35760405162461bcd60e51b8152600401610abc906156a7565b60006136ed612468565b90506136ff8160008761341088614063565b6001600160a01b03851660009081526002602090815260408083208784529091528120805485929061373290849061532d565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610cd5816000878787876140ae565b6001600160a01b0385166138195760005b8351811015613817578281815181106137be576137be61525a565b6020026020010151600e60008684815181106137dc576137dc61525a565b602002602001015181526020019081526020016000206000828254613801919061532d565b90915550613810905081615314565b90506137a3565b505b6001600160a01b0384166126505760005b835181101561350f578281815181106138455761384561525a565b6020026020010151600e60008684815181106138635761386361525a565b60200260200101518152602001908152602001600020600082825461388891906155fe565b90915550613897905081615314565b905061382a565b6001600160a01b0384163b156126505760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906138e29089908990889088908890600401615949565b6020604051808303816000875af192505050801561391d575060408051601f3d908101601f1916820190925261391a9181019061599b565b60015b61399f576139296159b8565b806308c379a003613962575061393d6159d3565b806139485750613964565b8060405162461bcd60e51b8152600401610abc9190614975565b505b60405162461bcd60e51b815260206004820152601060248201526f10a2a92198989a9aa922a1a2a4ab22a960811b6044820152606401610abc565b6001600160e01b0319811663bc197c8160e01b1461350f5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b6044820152606401610abc565b60606000613a00836002615286565b613a0b90600261532d565b6001600160401b03811115613a2257613a22614a11565b6040519080825280601f01601f191660200182016040528015613a4c576020820181803683370190505b509050600360fc1b81600081518110613a6757613a6761525a565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613a9657613a9661525a565b60200101906001600160f81b031916908160001a9053506000613aba846002615286565b613ac590600161532d565b90505b6001811115613b3d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613af957613af961525a565b1a60f81b828281518110613b0f57613b0f61525a565b60200101906001600160f81b031916908160001a90535060049490941c93613b3681615a5c565b9050613ac8565b5083156132555760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610abc565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600082815260116020526040812080549160019190613c06838561532d565b9091555050600092835260116020908152604080852083865260018101835281862080546001600160a01b039096166001600160a01b03199096168617905593855260029093019052912055565b613c5e8282612658565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80156111975773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601613cf057613ceb828261418b565b611197565b6111978484848461422e565b6060600080856001600160a01b031685604051613d199190615a73565b600060405180830381855af49150503d8060008114613d54576040519150601f19603f3d011682016040523d82523d6000602084013e613d59565b606091505b5091509150613d6a86838387614281565b9695505050505050565b60607fc7a95ef88f83fa833ccfce325157b7111633b181b6a27181b86415d8d501134d613da460208401846149a1565b613db460408501602086016149a1565b6040850135613dc960808701606088016149a1565b6080870135613ddb60a0890189615361565b604051613de9929190615a85565b6040805191829003822060208301989098526001600160a01b03968716908201529385166060850152608084019290925290921660a082015260c081019190915260e08101919091526101000160408051601f1981840301815291905260c083013560e0840135613e62610120860161010087016149a1565b613e74610140870161012088016158cf565b613e86610160880161014089016158cf565b6040805160208101969096528501939093526001600160a01b0390911660608401526001600160801b0390811660808401521660a082015261016084013560c082015260e00160408051601f1981840301815290829052613eea9291602001615203565b6040516020818303038152906040529050919050565b60006109c3613f0d6142fa565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000613f3c8585614424565b91509150610fb181614469565b600080613f5560095490565b905060006009805480602002602001604051908101604052809291908181526020018280548015613fa557602002820191906000526020600020905b815481526020019060010190808311613f91575b5050505050905060005b8281101561402857818181518110613fc957613fc961525a565b6020026020010151850361401657801561400b5781613fe96001836155fe565b81518110613ff957613ff961525a565b60200260200101519350505050919050565b506000949350505050565b8061402081615314565b915050613faf565b5060405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a590818985d18da1259608a1b6044820152606401610abc565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061409d5761409d61525a565b602090810291909101015292915050565b6001600160a01b0384163b156126505760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906140f29089908990889088908890600401615a95565b6020604051808303816000875af192505050801561412d575060408051601f3d908101601f1916820190925261412a9181019061599b565b60015b614139576139296159b8565b6001600160e01b0319811663f23a6e6160e01b1461350f5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b6044820152606401610abc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146141d8576040519150601f19603f3d011682016040523d82523d6000602084013e6141dd565b606091505b5050905080610c215760405162461bcd60e51b815260206004820152601c60248201527f6e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610abc565b816001600160a01b0316836001600160a01b0316031561119757306001600160a01b0384160361426c57613ceb6001600160a01b03851683836145b3565b6111976001600160a01b038516848484614616565b606083156142f05782516000036142e9576001600160a01b0385163b6142e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610abc565b50816123b0565b6123b0838361464e565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561435357507f000000000000000000000000000000000000000000000000000000000000000046145b1561437d57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b90565b600080825160410361445a5760208301516040840151606085015160001a61444e8782858561465e565b94509450505050614462565b506000905060025b9250929050565b600081600481111561447d5761447d615acf565b036144855750565b600181600481111561449957614499615acf565b036144e65760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610abc565b60028160048111156144fa576144fa615acf565b036145475760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610abc565b600381600481111561455b5761455b615acf565b03610ace5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610abc565b6040516001600160a01b038316602482015260448101829052610c2190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614722565b6040516001600160a01b03808516602483015283166044820152606481018290526111979085906323b872dd60e01b906084016145df565b8151156139485781518083602001fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146955750600090506003614719565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156146e9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661471257600060019250925050614719565b9150600090505b94509492505050565b60006147376001600160a01b038416836147b4565b805190915015610c2157808060200190518101906147559190615ae5565b610c215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610abc565b60606132558383600084600080856001600160a01b031684866040516147da9190615a73565b60006040518083038185875af1925050503d8060008114614817576040519150601f19603f3d011682016040523d82523d6000602084013e61481c565b606091505b5091509150613d6a86838360608261483c5761483782614883565b613255565b815115801561485357506001600160a01b0384163b155b1561487c57604051639996b31560e01b81526001600160a01b0385166004820152602401610abc565b5080613255565b8051156148935780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b03811681146148c357600080fd5b919050565b600080604083850312156148db57600080fd5b6148e4836148ac565b946020939093013593505050565b6001600160e01b031981168114610ace57600080fd5b60006020828403121561491a57600080fd5b8135613255816148f2565b60005b83811015614940578181015183820152602001614928565b50506000910152565b60008151808452614961816020860160208601614925565b601f01601f19169290920160200192915050565b6020815260006132556020830184614949565b60006020828403121561499a57600080fd5b5035919050565b6000602082840312156149b357600080fd5b613255826148ac565b600080604083850312156149cf57600080fd5b50508035926020909101359150565b6000806000606084860312156149f357600080fd5b6149fc846148ac565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715614a4c57614a4c614a11565b6040525050565b60006001600160401b03821115614a6c57614a6c614a11565b5060051b60200190565b600082601f830112614a8757600080fd5b81356020614a9482614a53565b604051614aa18282614a27565b83815260059390931b8501820192828101915086841115614ac157600080fd5b8286015b84811015614adc5780358352918301918301614ac5565b509695505050505050565b60006001600160401b03831115614b0057614b00614a11565b604051614b17601f8501601f191660200182614a27565b809150838152848484011115614b2c57600080fd5b83836020830137600060208583010152509392505050565b600082601f830112614b5557600080fd5b61325583833560208501614ae7565b600080600080600060a08688031215614b7c57600080fd5b614b85866148ac565b9450614b93602087016148ac565b935060408601356001600160401b0380821115614baf57600080fd5b614bbb89838a01614a76565b94506060880135915080821115614bd157600080fd5b614bdd89838a01614a76565b93506080880135915080821115614bf357600080fd5b50614c0088828901614b44565b9150509295509295909350565b60008060408385031215614c2057600080fd5b82359150614c30602084016148ac565b90509250929050565b60008060408385031215614c4c57600080fd5b82356001600160401b0380821115614c6357600080fd5b818501915085601f830112614c7757600080fd5b81356020614c8482614a53565b604051614c918282614a27565b83815260059390931b8501820192828101915089841115614cb157600080fd5b948201945b83861015614cd657614cc7866148ac565b82529482019490820190614cb6565b96505086013592505080821115614cec57600080fd5b50614cf985828601614a76565b9150509250929050565b600081518084526020808501945080840160005b83811015614d3357815187529582019590820190600101614d17565b509495945050505050565b6020815260006132556020830184614d03565b600080600060608486031215614d6657600080fd5b614d6f846148ac565b925060208401356001600160401b0380821115614d8b57600080fd5b614d9787838801614a76565b93506040860135915080821115614dad57600080fd5b50614dba86828701614a76565b9150509250925092565b600060208284031215614dd657600080fd5b81356001600160401b03811115614dec57600080fd5b8201601f81018413614dfd57600080fd5b6123b084823560208401614ae7565b60008083601f840112614e1e57600080fd5b5081356001600160401b03811115614e3557600080fd5b60208301915083602082850101111561446257600080fd5b600080600060408486031215614e6257600080fd5b83356001600160401b0380821115614e7957600080fd5b908501906101808288031215614e8e57600080fd5b90935060208501359080821115614ea457600080fd5b50614eb186828701614e0c565b9497909650939450505050565b600080600060608486031215614ed357600080fd5b83359250614ee3602085016148ac565b9150604084013590509250925092565b60008083601f840112614f0557600080fd5b5081356001600160401b03811115614f1c57600080fd5b6020830191508360208260051b850101111561446257600080fd5b60008060008060408587031215614f4d57600080fd5b84356001600160401b0380821115614f6457600080fd5b614f7088838901614ef3565b90965094506020870135915080821115614f8957600080fd5b50614f9687828801614ef3565b95989497509550505050565b8015158114610ace57600080fd5b60008060408385031215614fc357600080fd5b614fcc836148ac565b91506020830135614fdc81614fa2565b809150509250929050565b60008060208385031215614ffa57600080fd5b82356001600160401b0381111561501057600080fd5b61501c85828601614ef3565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561507d57603f1988860301845261506b858351614949565b9450928501929085019060010161504f565b5092979650505050505050565b6000806000806000606086880312156150a257600080fd5b8535945060208601356001600160401b03808211156150c057600080fd5b6150cc89838a01614e0c565b909650945060408801359150808211156150e557600080fd5b506150f288828901614e0c565b969995985093965092949392505050565b60008060006040848603121561511857600080fd5b8335925060208401356001600160401b0381111561513557600080fd5b614eb186828701614e0c565b6000806040838503121561515457600080fd5b61515d836148ac565b9150614c30602084016148ac565b600080600080600060a0868803121561518357600080fd5b61518c866148ac565b945061519a602087016148ac565b9350604086013592506060860135915060808601356001600160401b038111156151c357600080fd5b614c0088828901614b44565b600181811c908216806151e357607f821691505b602082108103611c9457634e487b7160e01b600052602260045260246000fd5b60008351615215818460208801614925565b835190830190615229818360208801614925565b01949350505050565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109c3576109c3615270565b634e487b7160e01b600052601260045260246000fd5b6000826152c2576152c261529d565b500490565b6020808252600a90820152691a5b9d985b1a59081a5960b21b604082015260600190565b6020808252600f908201526e0988a9c8ea890be9a92a69a82a8869608b1b604082015260600190565b60006001820161532657615326615270565b5060010190565b808201808211156109c3576109c3615270565b6000823561017e1983360301811261535757600080fd5b9190910192915050565b6000808335601e1984360301811261537857600080fd5b8301803591506001600160401b0382111561539257600080fd5b60200191503681900382131561446257600080fd5b815160009082906020808601845b838110156153d1578151855293820193908201906001016153b5565b50929695505050505050565b6000808335601e198436030181126153f457600080fd5b83016020810192503590506001600160401b0381111561541357600080fd5b80360382131561446257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b80356001600160801b03811681146148c357600080fd5b600061018061548184615474856148ac565b6001600160a01b03169052565b61548d602084016148ac565b6001600160a01b03166020850152604083810135908501526154b1606084016148ac565b6001600160a01b03166060850152608083810135908501526154d660a08401846153dd565b8260a08701526154e98387018284615422565b9250505060c083013560c085015260e083013560e085015261010061550f8185016148ac565b6001600160a01b03169085015261012061552a84820161544b565b6001600160801b03169085015261014061554584820161544b565b6001600160801b0316908501526101609283013592909301919091525090565b60208082528181018390526000906040600585901b840181019084018684805b888110156155ca57878503603f190184528235368b900361017e190181126155ab578283fd5b6155b7868c8301615462565b9550509285019291850191600101615585565b509298975050505050505050565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b818103818111156109c3576109c3615270565b85815260606020820152600061562b606083018688615422565b828103604084015261563e818587615422565b98975050505050505050565b6001600160a01b0385811682528416602082015260806040820181905260009061567690830185614d03565b82810360608401526156888185614d03565b979650505050505050565b6000826156a2576156a261529d565b500690565b6020808252600c908201526b2a27afad22a927afa0a2222960a11b604082015260600190565b60208082526010908201526f125394d551919250d251539517d0905360821b604082015260600190565b60408152600061570a6040830185614d03565b828103602084015261571c8185614d03565b95945050505050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351615755816015850160208801614925565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351615786816026840160208801614925565b01602601949350505050565b601f821115610c2157600081815260208120601f850160051c810160208610156157b95750805b601f850160051c820191505b81811015612650578281556001016157c5565b81516001600160401b038111156157f1576157f1614a11565b615805816157ff84546151cf565b84615792565b602080601f83116001811461583a57600084156158225750858301515b600019600386901b1c1916600185901b178555612650565b600085815260208120601f198616915b828110156158695788860151825594840194600190910190840161584a565b50858210156158875787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006158aa6040830185614949565b828103602084015261571c8185614949565b6020815260006132556020830184615462565b6000602082840312156158e157600080fd5b6132558261544b565b600080858511156158fa57600080fd5b8386111561590757600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff1981358181169160148510156159415780818660140360031b1b83161692505b505092915050565b6001600160a01b0386811682528516602082015260a06040820181905260009061597590830186614d03565b82810360608401526159878186614d03565b9050828103608084015261563e8185614949565b6000602082840312156159ad57600080fd5b8151613255816148f2565b600060033d11156144215760046000803e5060005160e01c90565b600060443d10156159e15790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715615a1057505050505090565b8285019150815181811115615a285750505050505090565b843d8701016020828501011115615a425750505050505090565b615a5160208286010187614a27565b509095945050505050565b600081615a6b57615a6b615270565b506000190190565b60008251615357818460208701614925565b8183823760009101908152919050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061568890830184614949565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615af757600080fd5b815161325581614fa256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220184fbf6be280a81b8418e19bc58b505aba0165d5c05ce3935993dbeeb25f07ff64736f6c63430008140033000000000000000000000000cef8dc1e247d4383d07104413a7e126a145dd11600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aa744bb224ebbfc4ee535ae12cf592b77ba06b30000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e81600000000000000000000000000000000000000000000000000000000000000114172636164656e204d6174657269616c730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005244152434d000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102875760003560e01c80639010d07c1161015a578063b17cd86f116100c1578063de903ddd1161007a578063de903ddd14610899578063e59e53c2146108b9578063e8a3d485146108cc578063e985e9c5146108e1578063f242432a1461091c578063f5298aca1461093c57600080fd5b8063b17cd86f146107a2578063b24f2d39146107e1578063bd85b0391461080c578063ca15c87314610839578063d37c353b14610859578063d547741f1461087957600080fd5b80639e2e2a96116101135780639e2e2a96146106ed578063a07ced9e14610700578063a217fddf14610720578063a22cb46514610735578063a32fa5b314610755578063ac9650d81461077557600080fd5b80639010d07c1461064557806391d1485414610665578063938e3d7b1461068557806395d89b41146106a557806398a6e993146106ba5780639bcf7a15146106cd57600080fd5b806336568abe116101fe578063600dd5ea116101b7578063600dd5ea1461055b57806363b45e2d1461057b5780636b20c454146105905780637da0a877146105b057806383040532146105f75780638da5cb5b1461062757600080fd5b806336568abe1461044a5780633b1475a71461046a5780634bbb1abf1461047f5780634cc157df1461049f5780634e1273f4146104e1578063572b6c051461050e57600080fd5b80632419f51b116102505780632419f51b1461036b578063248a9ca31461038b5780632a55205a146103b85780632bc43fd9146103f75780632eb2c2d61461040a5780632f2ff15d1461042a57600080fd5b8062fdd58e1461028c57806301ffc9a7146102d757806306fdde03146103075780630e89341c1461032957806313af403514610349575b600080fd5b34801561029857600080fd5b506102c46102a73660046148c8565b600260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102e357600080fd5b506102f76102f2366004614908565b61095c565b60405190151581526020016102ce565b34801561031357600080fd5b5061031c6109c9565b6040516102ce9190614975565b34801561033557600080fd5b5061031c610344366004614988565b610a57565b34801561035557600080fd5b506103696103643660046149a1565b610a98565b005b34801561037757600080fd5b506102c4610386366004614988565b610ad1565b34801561039757600080fd5b506102c46103a6366004614988565b60009081526010602052604090205490565b3480156103c457600080fd5b506103d86103d33660046149bc565b610b3f565b604080516001600160a01b0390931683526020830191909152016102ce565b6103696104053660046149de565b610b7c565b34801561041657600080fd5b50610369610425366004614b64565b610c26565b34801561043657600080fd5b50610369610445366004614c0d565b610cdc565b34801561045657600080fd5b50610369610465366004614c0d565b610d76565b34801561047657600080fd5b50600c546102c4565b34801561048b57600080fd5b5061036961049a3660046149de565b610dd8565b3480156104ab57600080fd5b506104bf6104ba366004614988565b610e3a565b604080516001600160a01b03909316835261ffff9091166020830152016102ce565b3480156104ed57600080fd5b506105016104fc366004614c39565b610ea5565b6040516102ce9190614d3e565b34801561051a57600080fd5b506102f76105293660046149a1565b7f000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e8166001600160a01b0390811691161490565b34801561056757600080fd5b506103696105763660046148c8565b610fb9565b34801561058757600080fd5b506009546102c4565b34801561059c57600080fd5b506103696105ab366004614d51565b610fe7565b3480156105bc57600080fd5b507f000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e8165b6040516001600160a01b0390911681526020016102ce565b34801561060357600080fd5b506102f7610612366004614988565b600b6020526000908152604090205460ff1681565b34801561063357600080fd5b506006546001600160a01b03166105df565b34801561065157600080fd5b506105df6106603660046149bc565b61119d565b34801561067157600080fd5b506102f7610680366004614c0d565b61128b565b34801561069157600080fd5b506103696106a0366004614dc4565b6112b6565b3480156106b157600080fd5b5061031c6112e3565b6105df6106c8366004614e4d565b6112f0565b3480156106d957600080fd5b506103696106e8366004614ebe565b6112fd565b6105df6106fb366004614f37565b61132c565b34801561070c57600080fd5b5061036961071b366004614988565b61190b565b34801561072c57600080fd5b506102c4600081565b34801561074157600080fd5b50610369610750366004614fb0565b61192e565b34801561076157600080fd5b506102f7610770366004614c0d565b6119fa565b34801561078157600080fd5b50610795610790366004614fe7565b611a50565b6040516102ce9190615028565b3480156107ae57600080fd5b506107c26107bd366004614e4d565b611bcd565b6040805192151583526001600160a01b039091166020830152016102ce565b3480156107ed57600080fd5b506007546001600160a01b03811690600160a01b900461ffff166104bf565b34801561081857600080fd5b506102c4610827366004614988565b600e6020526000908152604090205481565b34801561084557600080fd5b506102c4610854366004614988565b611c11565b34801561086557600080fd5b506102c461087436600461508a565b611c9a565b34801561088557600080fd5b50610369610894366004614c0d565b611da7565b3480156108a557600080fd5b506103696108b4366004615103565b611dc0565b6103696108c7366004614d51565b611e1a565b3480156108d857600080fd5b5061031c611f4f565b3480156108ed57600080fd5b506102f76108fc366004615141565b600360209081526000928352604080842090915290825290205460ff1681565b34801561092857600080fd5b5061036961093736600461516b565b611f5c565b34801561094857600080fd5b506103696109573660046149de565b61200b565b60006301ffc9a760e01b6001600160e01b03198316148061098d5750636cdb3d1360e11b6001600160e01b03198316145b806109a857506303a24d0760e21b6001600160e01b03198316145b806109c357506001600160e01b0319821663152a902d60e11b145b92915050565b600080546109d6906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054610a02906151cf565b8015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b820191906000526020600020905b815481529060010190602001808311610a3257829003601f168201915b505050505081565b60606000610a6483612114565b905080610a70846122b0565b604051602001610a81929190615203565b604051602081830303815290604052915050919050565b610aa06123b8565b610ac55760405162461bcd60e51b8152600401610abc90615232565b60405180910390fd5b610ace816123ec565b50565b6000610adc60095490565b8210610b1a5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610abc565b60098281548110610b2d57610b2d61525a565b90600052602060002001549050919050565b600080600080610b4e86610e3a565b90945084925061ffff169050612710610b678287615286565b610b7191906152b3565b925050509250929050565b610b8461243e565b600c548210610ba55760405162461bcd60e51b8152600401610abc906152c7565b610bb7610bb0612468565b8383610dd8565b610bc2838383612477565b81836001600160a01b0316610bd5612468565b6001600160a01b03167fff097c7d8b1957a4ff09ef1361b5fb54dcede3941ba836d0beb9d10bec725de684604051610c0f91815260200190565b60405180910390a4610c216001600d55565b505050565b610c2e612468565b6001600160a01b0316856001600160a01b03161480610c8757506001600160a01b038516600090815260036020526040812090610c69612468565b6001600160a01b0316815260208101919091526040016000205460ff165b610cc85760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b6044820152606401610abc565b610cd58585858585612492565b5050505050565b600082815260106020526040902054610cf59033612658565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610d685760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610abc565b610d7282826126d8565b5050565b336001600160a01b03821614610dce5760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610abc565b610d7282826126ec565b610de46013548461128b565b610c215760405162461bcd60e51b815260206004820152602160248201527f5265737472696374656420746f204d696e74657220726f6c6520686f6c6465726044820152607360f81b6064820152608401610abc565b6000818152600860209081526040808320815180830190925280546001600160a01b031680835260019091015492820192909252829115610e815780516020820151610e9b565b6007546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b60608151835114610ec85760405162461bcd60e51b8152600401610abc906152eb565b600083516001600160401b03811115610ee357610ee3614a11565b604051908082528060200260200182016040528015610f0c578160200160208202803683370190505b50905060005b8451811015610fb15760026000868381518110610f3157610f3161525a565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000858381518110610f6d57610f6d61525a565b6020026020010151815260200190815260200160002054828281518110610f9657610f9661525a565b6020908102919091010152610faa81615314565b9050610f12565b509392505050565b610fc16123b8565b610fdd5760405162461bcd60e51b8152600401610abc90615232565b610d728282612743565b6000610ff1612468565b9050836001600160a01b0316816001600160a01b0316148061103857506001600160a01b0380851660009081526003602090815260408083209385168352929052205460ff165b6110785760405162461bcd60e51b81526020600482015260116024820152702ab730b8383937bb32b21031b0b63632b960791b6044820152606401610abc565b81518351146110bb5760405162461bcd60e51b815260206004820152600f60248201526e098cadccee8d040dad2e6dac2e8c6d608b1b6044820152606401610abc565b60005b835181101561118b578281815181106110d9576110d961525a565b602002602001015160026000876001600160a01b03166001600160a01b03168152602001908152602001600020600086848151811061111a5761111a61525a565b602002602001015181526020019081526020016000205410156111795760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081d1bdad95b9cc81bdddb9959604a1b6044820152606401610abc565b61118460018261532d565b90506110be565b506111978484846127e9565b50505050565b60008281526011602052604081205481805b828110156112825760008681526011602090815260408083208484526001019091529020546001600160a01b03161561122b578482036112195760008681526011602090815260408083209383526001909301905220546001600160a01b031692506109c3915050565b61122460018361532d565b9150611270565b61123686600061128b565b801561125d5750600086815260116020908152604080832083805260020190915290205481145b156112705761126d60018361532d565b91505b61127b60018261532d565b90506111af565b50505092915050565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6112be6123b8565b6112da5760405162461bcd60e51b8152600401610abc90615232565b610ace816129a5565b600180546109d6906151cf565b6000610fb1848484612a81565b6113056123b8565b6113215760405162461bcd60e51b8152600401610abc90615232565b610c21838383612c57565b600083821461137d5760405162461bcd60e51b815260206004820181905260248201527f726571756573747320616e64207369676e617475726573206d69736d617463686044820152606401610abc565b6000846001600160401b0381111561139757611397614a11565b6040519080825280602002602001820160405280156113c0578160200160208202803683370190505b5090506000856001600160401b038111156113dd576113dd614a11565b604051908082528060200260200182016040528015611406578160200160208202803683370190505b50905060005b8681101561184a5760008888838181106114285761142861525a565b905060200281019061143a9190615340565b60c00135116114825760405162461bcd60e51b815260206004820152601460248201527326b4b73a34b733903d32b937903a37b5b2b7399760611b6044820152606401610abc565b60008061148e600c5490565b90506000198a8a858181106114a5576114a561525a565b90506020028101906114b79190615340565b60800135036114e1578091506001600c60008282546114d6919061532d565b9091555061156f9050565b808a8a858181106114f4576114f461525a565b90506020028101906115069190615340565b60800135106115445760405162461bcd60e51b815260206004820152600a6024820152691a5b9d985b1a5908125160b21b6044820152606401610abc565b8989848181106115565761155661525a565b90506020028101906115689190615340565b6080013591505b6115bf8a8a858181106115845761158461525a565b90506020028101906115969190615340565b8989868181106115a8576115a861525a565b90506020028101906115ba9190615361565b612d18565b95506116858a8a858181106115d6576115d661525a565b90506020028101906115e89190615340565b6115f99060808101906060016149a1565b8b8b8681811061160b5761160b61525a565b905060200281019061161d9190615340565b60c001358c8c878181106116335761163361525a565b90506020028101906116459190615340565b61165890610120810190610100016149a1565b8d8d8881811061166a5761166a61525a565b905060200281019061167c9190615340565b60e00135612eaa565b60008a8a858181106116995761169961525a565b90506020028101906116ab9190615340565b6116bc9060408101906020016149a1565b6001600160a01b03161461173057611730828b8b868181106116e0576116e061525a565b90506020028101906116f29190615340565b6117039060408101906020016149a1565b8c8c878181106117155761171561525a565b90506020028101906117279190615340565b60400135612c57565b6000198a8a858181106117455761174561525a565b90506020028101906117579190615340565b60800135036117d0576117d0828b8b868181106117765761177661525a565b90506020028101906117889190615340565b6117969060a0810190615361565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f9592505050565b818584815181106117e3576117e361525a565b6020026020010181815250508989848181106118015761180161525a565b90506020028101906118139190615340565b60c001358484815181106118295761182961525a565b6020026020010181815250505050808061184290615314565b91505061140c565b506000878760008181106118605761186061525a565b90506020028101906118729190615340565b6118809060208101906149a1565b905061189d81848460405180602001604052806000815250612fad565b826040516118ab91906153a7565b6040518091039020816001600160a01b0316856001600160a01b03167ffaace84ffcf1d6dd686f27b470caf69afeaf08bda7aad1414e29f6957a852d8b8b8b6040516118f8929190615565565b60405180910390a4505050949350505050565b6014546119188133612658565b600061192383610ad1565b9050610c2181613113565b6000611938612468565b9050826001600160a01b0316816001600160a01b03160361198c5760405162461bcd60e51b815260206004820152600e60248201526d20a8282927ab24a723afa9a2a62360911b6044820152606401610abc565b6001600160a01b03818116600081815260036020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b6000828152600f6020908152604080832083805290915281205460ff16611a4757506000828152600f602090815260408083206001600160a01b038516845290915290205460ff166109c3565b50600192915050565b6060816001600160401b03811115611a6a57611a6a614a11565b604051908082528060200260200182016040528015611a9d57816020015b6060815260200190600190039081611a885790505b5090506000611aaa612468565b9050336001600160a01b038216141560005b84811015611282578115611b3b57611b1930878784818110611ae057611ae061525a565b9050602002810190611af29190615361565b86604051602001611b05939291906155d8565b604051602081830303815290604052613230565b848281518110611b2b57611b2b61525a565b6020026020010181905250611bbb565b611b9d30878784818110611b5157611b5161525a565b9050602002810190611b639190615361565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061323092505050565b848281518110611baf57611baf61525a565b60200260200101819052505b80611bc581615314565b915050611abc565b600080611bdb85858561325c565b61016086013560009081526012602052604090205490915060ff16158015611c075750611c07816132b8565b9150935093915050565b600081815260116020526040812054815b81811015611c755760008481526011602090815260408083208484526001019091529020546001600160a01b031615611c6357611c6060018461532d565b92505b611c6e60018261532d565b9050611c22565b50611c8183600061128b565b15611c9457611c9160018361532d565b91505b50919050565b6000611ca46123b8565b611cc05760405162461bcd60e51b8152600401610abc90615232565b85600003611cf85760405162461bcd60e51b81526020600482015260056024820152640c08185b5d60da1b6044820152606401610abc565b6000600c549050611d40818888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132c692505050565b600c919091559150807f2a0365091ef1a40953c670dce28177e37520648a6fdc91506bffac0ab045570d6001611d768a8461532d565b611d8091906155fe565b88888888604051611d95959493929190615611565b60405180910390a25095945050505050565b600082815260106020526040902054610dce9033612658565b601454611dcd8133612658565b6000611dd885610ad1565b9050610cd58185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061332a92505050565b611e2261243e565b601354611e2f8133612658565b60005b8351811015611ee4576000838281518110611e4f57611e4f61525a565b602002602001015111611e985760405162461bcd60e51b8152602060048201526011602482015270139bc81d1bdad95b9cc81d1bc81b5a5b9d607a1b6044820152606401610abc565b600c54848281518110611ead57611ead61525a565b602002602001015110611ed25760405162461bcd60e51b8152600401610abc906152c7565b611edd60018261532d565b9050611e32565b50611f0084848460405180602001604052806000815250612fad565b7f0e66b3940fce94ce97df6ed446d7f2beac30503b04b4ce437e0859e2910dd3ee611f29612468565b858585604051611f3c949392919061564a565b60405180910390a150610c216001600d55565b600580546109d6906151cf565b611f64612468565b6001600160a01b0316856001600160a01b03161480611fbd57506001600160a01b038516600090815260036020526040812090611f9f612468565b6001600160a01b0316815260208101919091526040016000205460ff165b611ffe5760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b6044820152606401610abc565b610cd585858585856133cf565b6000612015612468565b9050836001600160a01b0316816001600160a01b0316148061205c57506001600160a01b0380851660009081526003602090815260408083209385168352929052205460ff165b61209c5760405162461bcd60e51b81526020600482015260116024820152702ab730b8383937bb32b21031b0b63632b960791b6044820152606401610abc565b6001600160a01b03841660009081526002602090815260408083208684529091529020548211156121095760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081d1bdad95b9cc81bdddb9959604a1b6044820152606401610abc565b611197848484613518565b6060600061212160095490565b90506000600980548060200260200160405190810160405280929190818152602001828054801561217157602002820191906000526020600020905b81548152602001906001019080831161215d575b5050505050905060005b82811015612275578181815181106121955761219561525a565b602002602001015185101561226357600a60008383815181106121ba576121ba61525a565b6020026020010151815260200190815260200160002080546121db906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054612207906151cf565b80156122545780601f1061222957610100808354040283529160200191612254565b820191906000526020600020905b81548152906001019060200180831161223757829003601f168201915b50505050509350505050919050565b61226e60018261532d565b905061217b565b5060405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1bdad95b9259608a1b6044820152606401610abc565b6060816000036122d75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561230157806122eb81615314565b91506122fa9050600a836152b3565b91506122db565b6000816001600160401b0381111561231b5761231b614a11565b6040519080825280601f01601f191660200182016040528015612345576020820181803683370190505b5090505b84156123b05761235a6001836155fe565b9150612367600a86615693565b61237290603061532d565b60f81b8183815181106123875761238761525a565b60200101906001600160f81b031916908160001a9053506123a9600a866152b3565b9450612349565b949350505050565b60006123cc6006546001600160a01b031690565b6001600160a01b03166123dd612468565b6001600160a01b031614905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6002600d540361246157604051633ee5aeb560e01b815260040160405180910390fd5b6002600d55565b6000612472613648565b905090565b610c21838383604051806020016040528060008152506136bd565b81518351146124b35760405162461bcd60e51b8152600401610abc906152eb565b6001600160a01b0384166124d95760405162461bcd60e51b8152600401610abc906156a7565b60006124e3612468565b90506124f3818787878787613792565b60005b84518110156125ea5760008582815181106125135761251361525a565b6020026020010151905060008583815181106125315761253161525a565b6020908102919091018101516001600160a01b038b1660009081526002835260408082208683529093529190912054909150818110156125835760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b03808b16600090815260026020818152604080842088855282528084208787039055938d168352908152828220868352905290812080548492906125cf90849061532d565b92505081905550505050806125e390615314565b90506124f6565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161263a9291906156f7565b60405180910390a461265081878787878761389e565b505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff16610d7257612696816001600160a01b031660146139f1565b6126a18360206139f1565b6040516020016126b2929190615725565b60408051601f198184030181529082905262461bcd60e51b8252610abc91600401614975565b6126e28282613b8c565b610d728282613be7565b6126f68282613c54565b60008281526011602090815260408083206001600160a01b03851680855260028201808552838620805487526001909301855292852080546001600160a01b031916905584529152555050565b6127108111156127875760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610abc565b600780546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b6001600160a01b0383166128305760405162461bcd60e51b815260206004820152600e60248201526d232927a6afad22a927afa0a2222960911b6044820152606401610abc565b80518251146128515760405162461bcd60e51b8152600401610abc906152eb565b600061285b612468565b905061287b81856000868660405180602001604052806000815250613792565b60005b835181101561294657600084828151811061289b5761289b61525a565b6020026020010151905060008483815181106128b9576128b961525a565b6020908102919091018101516001600160a01b038916600090815260028352604080822086835290935291909120549091508181101561290b5760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b038816600090815260026020908152604080832095835294905292909220910390558061293e81615314565b91505061287e565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516129979291906156f7565b60405180910390a450505050565b6000600580546129b4906151cf565b80601f01602080910402602001604051908101604052809291908181526020018280546129e0906151cf565b8015612a2d5780601f10612a0257610100808354040283529160200191612a2d565b820191906000526020600020905b815481529060010190602001808311612a1057829003601f168201915b505050505090508160059081612a4391906157d8565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612a75929190615897565b60405180910390a15050565b6000808460c0013511612acd5760405162461bcd60e51b815260206004820152601460248201527326b4b73a34b733903d32b937903a37b5b2b7399760611b6044820152606401610abc565b600080612ad9600c5490565b9050600019866080013503612b09578091506001600c6000828254612afe919061532d565b90915550612b349050565b80866080013510612b2c5760405162461bcd60e51b8152600401610abc906152c7565b856080013591505b612b3f868686612d18565b92506000612b5060208801886149a1565b9050612b86612b656080890160608a016149a1565b60c0890135612b7c6101208b016101008c016149a1565b8a60e00135612eaa565b6000612b986040890160208a016149a1565b6001600160a01b031614612bc457612bc483612bba60408a0160208b016149a1565b8960400135612c57565b600019876080013503612be257612be28361179660a08a018a615361565b612c0181848960c00135604051806020016040528060008152506136bd565b82816001600160a01b0316856001600160a01b03167f0b35afaf155daeef41cc46df86f058df2855c57d30ab134647a6b587e7cc8c398a604051612c4591906158bc565b60405180910390a45050509392505050565b612710811115612c9b5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610abc565b6040805180820182526001600160a01b038481168083526020808401868152600089815260088352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d91016119ed565b600080612d26858585611bcd565b9250905080612d695760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b6044820152606401610abc565b42612d7c610140870161012088016158cf565b6001600160801b031611158015612dad5750612da0610160860161014087016158cf565b6001600160801b03164211155b612deb5760405162461bcd60e51b815260206004820152600f60248201526e14995c5d595cdd08195e1c1a5c9959608a1b6044820152606401610abc565b6000612dfa60208701876149a1565b6001600160a01b031603612e465760405162461bcd60e51b81526020600482015260136024820152721c9958da5c1a595b9d081d5b9919599a5b9959606a1b6044820152606401610abc565b60008560c0013511612e825760405162461bcd60e51b8152602060048201526005602482015264302071747960d81b6044820152606401610abc565b50610160909301356000908152601260205260409020805460ff191660011790555090919050565b8015611197576000670de0b6b3a7640000612ec58386615286565b612ecf91906152b3565b905060008111612f145760405162461bcd60e51b815260206004820152601060248201526f7175616e7469747920746f6f206c6f7760801b6044820152606401610abc565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03841601612f8157803414612f815760405162461bcd60e51b815260206004820152601660248201527526bab9ba1039b2b732103a37ba30b610383934b1b29760511b6044820152606401610abc565b8461265084612f8e612468565b8385613cb6565b6000828152600460205260409020610c2182826157d8565b6001600160a01b038416612fd35760405162461bcd60e51b8152600401610abc906156a7565b8151835114612ff45760405162461bcd60e51b8152600401610abc906152eb565b6000612ffe612468565b905061300f81600087878787613792565b60005b84518110156130ab5783818151811061302d5761302d61525a565b602002602001015160026000886001600160a01b03166001600160a01b03168152602001908152602001600020600087848151811061306e5761306e61525a565b602002602001015181526020019081526020016000206000828254613093919061532d565b909155508190506130a381615314565b915050613012565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516130fc9291906156f7565b60405180910390a4610cd58160008787878761389e565b6000818152600a60205260408120805461312c906151cf565b80601f0160208091040260200160405190810160405280929190818152602001828054613158906151cf565b80156131a55780601f1061317a576101008083540402835291602001916131a5565b820191906000526020600020905b81548152906001019060200180831161318857829003601f168201915b5050505050905060008151116131ed5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840c4c2e8c6d609b1b6044820152606401610abc565b6000828152600b6020526040808220805460ff19166001179055517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d71649190a15050565b60606132558383604051806060016040528060278152602001615b0360279139613cfc565b9392505050565b60006123b083838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132b292506132a69150889050613d74565b80519060200120613f00565b90613f2d565b60006109c36013548361128b565b6000806132d3848661532d565b60098054600181019091557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018190556000818152600a6020526040902090925082915061332184826157d8565b50935093915050565b6000828152600b602052604090205460ff16156133785760405162461bcd60e51b815260206004820152600c60248201526b2130ba31b410333937bd32b760a11b6044820152606401610abc565b6000828152600a6020526040902061339082826157d8565b507f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6133bb83613f49565b604080519182526020820185905201612a75565b6001600160a01b0384166133f55760405162461bcd60e51b8152600401610abc906156a7565b60006133ff612468565b905061341f81878761341088614063565b61341988614063565b87613792565b6001600160a01b0386166000908152600260209081526040808320878452909152902054838110156134635760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b0380881660009081526002602081815260408084208a855282528084208987039055938a168352908152828220888352905290812080548692906134af90849061532d565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461350f8288888888886140ae565b50505050505050565b6001600160a01b03831661355f5760405162461bcd60e51b815260206004820152600e60248201526d232927a6afad22a927afa0a2222960911b6044820152606401610abc565b6000613569612468565b90506135998185600061357b87614063565b61358487614063565b60405180602001604052806000815250613792565b6001600160a01b0384166000908152600260209081526040808320868452909152902054828110156135dd5760405162461bcd60e51b8152600401610abc906156cd565b6001600160a01b03858116600081815260026020908152604080832089845282528083208887039055805189815291820188905291938616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b60003660147f000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e8166001600160a01b0316331480156136855750808210155b156136b55760003661369783856155fe565b6136a29282906158ea565b6136ab91615914565b60601c9250505090565b339250505090565b6001600160a01b0384166136e35760405162461bcd60e51b8152600401610abc906156a7565b60006136ed612468565b90506136ff8160008761341088614063565b6001600160a01b03851660009081526002602090815260408083208784529091528120805485929061373290849061532d565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610cd5816000878787876140ae565b6001600160a01b0385166138195760005b8351811015613817578281815181106137be576137be61525a565b6020026020010151600e60008684815181106137dc576137dc61525a565b602002602001015181526020019081526020016000206000828254613801919061532d565b90915550613810905081615314565b90506137a3565b505b6001600160a01b0384166126505760005b835181101561350f578281815181106138455761384561525a565b6020026020010151600e60008684815181106138635761386361525a565b60200260200101518152602001908152602001600020600082825461388891906155fe565b90915550613897905081615314565b905061382a565b6001600160a01b0384163b156126505760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906138e29089908990889088908890600401615949565b6020604051808303816000875af192505050801561391d575060408051601f3d908101601f1916820190925261391a9181019061599b565b60015b61399f576139296159b8565b806308c379a003613962575061393d6159d3565b806139485750613964565b8060405162461bcd60e51b8152600401610abc9190614975565b505b60405162461bcd60e51b815260206004820152601060248201526f10a2a92198989a9aa922a1a2a4ab22a960811b6044820152606401610abc565b6001600160e01b0319811663bc197c8160e01b1461350f5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b6044820152606401610abc565b60606000613a00836002615286565b613a0b90600261532d565b6001600160401b03811115613a2257613a22614a11565b6040519080825280601f01601f191660200182016040528015613a4c576020820181803683370190505b509050600360fc1b81600081518110613a6757613a6761525a565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613a9657613a9661525a565b60200101906001600160f81b031916908160001a9053506000613aba846002615286565b613ac590600161532d565b90505b6001811115613b3d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613af957613af961525a565b1a60f81b828281518110613b0f57613b0f61525a565b60200101906001600160f81b031916908160001a90535060049490941c93613b3681615a5c565b9050613ac8565b5083156132555760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610abc565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600082815260116020526040812080549160019190613c06838561532d565b9091555050600092835260116020908152604080852083865260018101835281862080546001600160a01b039096166001600160a01b03199096168617905593855260029093019052912055565b613c5e8282612658565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80156111975773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03851601613cf057613ceb828261418b565b611197565b6111978484848461422e565b6060600080856001600160a01b031685604051613d199190615a73565b600060405180830381855af49150503d8060008114613d54576040519150601f19603f3d011682016040523d82523d6000602084013e613d59565b606091505b5091509150613d6a86838387614281565b9695505050505050565b60607fc7a95ef88f83fa833ccfce325157b7111633b181b6a27181b86415d8d501134d613da460208401846149a1565b613db460408501602086016149a1565b6040850135613dc960808701606088016149a1565b6080870135613ddb60a0890189615361565b604051613de9929190615a85565b6040805191829003822060208301989098526001600160a01b03968716908201529385166060850152608084019290925290921660a082015260c081019190915260e08101919091526101000160408051601f1981840301815291905260c083013560e0840135613e62610120860161010087016149a1565b613e74610140870161012088016158cf565b613e86610160880161014089016158cf565b6040805160208101969096528501939093526001600160a01b0390911660608401526001600160801b0390811660808401521660a082015261016084013560c082015260e00160408051601f1981840301815290829052613eea9291602001615203565b6040516020818303038152906040529050919050565b60006109c3613f0d6142fa565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000613f3c8585614424565b91509150610fb181614469565b600080613f5560095490565b905060006009805480602002602001604051908101604052809291908181526020018280548015613fa557602002820191906000526020600020905b815481526020019060010190808311613f91575b5050505050905060005b8281101561402857818181518110613fc957613fc961525a565b6020026020010151850361401657801561400b5781613fe96001836155fe565b81518110613ff957613ff961525a565b60200260200101519350505050919050565b506000949350505050565b8061402081615314565b915050613faf565b5060405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a590818985d18da1259608a1b6044820152606401610abc565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061409d5761409d61525a565b602090810291909101015292915050565b6001600160a01b0384163b156126505760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906140f29089908990889088908890600401615a95565b6020604051808303816000875af192505050801561412d575060408051601f3d908101601f1916820190925261412a9181019061599b565b60015b614139576139296159b8565b6001600160e01b0319811663f23a6e6160e01b1461350f5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b6044820152606401610abc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146141d8576040519150601f19603f3d011682016040523d82523d6000602084013e6141dd565b606091505b5050905080610c215760405162461bcd60e51b815260206004820152601c60248201527f6e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610abc565b816001600160a01b0316836001600160a01b0316031561119757306001600160a01b0384160361426c57613ceb6001600160a01b03851683836145b3565b6111976001600160a01b038516848484614616565b606083156142f05782516000036142e9576001600160a01b0385163b6142e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610abc565b50816123b0565b6123b0838361464e565b6000306001600160a01b037f000000000000000000000000267dc28a655da12cb7c025f2b520e01f2869b2871614801561435357507f000000000000000000000000000000000000000000000000000000000000008946145b1561437d57507f27fffbff224d76031217c58f296432e7ecdde11fe463eb7dcaf44a34ed97bb5190565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f1c33fc4d4feded0b0344d8c75c27b29e89383a7294488b58231c9d41690c3293828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b90565b600080825160410361445a5760208301516040840151606085015160001a61444e8782858561465e565b94509450505050614462565b506000905060025b9250929050565b600081600481111561447d5761447d615acf565b036144855750565b600181600481111561449957614499615acf565b036144e65760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610abc565b60028160048111156144fa576144fa615acf565b036145475760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610abc565b600381600481111561455b5761455b615acf565b03610ace5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610abc565b6040516001600160a01b038316602482015260448101829052610c2190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614722565b6040516001600160a01b03808516602483015283166044820152606481018290526111979085906323b872dd60e01b906084016145df565b8151156139485781518083602001fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146955750600090506003614719565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156146e9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661471257600060019250925050614719565b9150600090505b94509492505050565b60006147376001600160a01b038416836147b4565b805190915015610c2157808060200190518101906147559190615ae5565b610c215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610abc565b60606132558383600084600080856001600160a01b031684866040516147da9190615a73565b60006040518083038185875af1925050503d8060008114614817576040519150601f19603f3d011682016040523d82523d6000602084013e61481c565b606091505b5091509150613d6a86838360608261483c5761483782614883565b613255565b815115801561485357506001600160a01b0384163b155b1561487c57604051639996b31560e01b81526001600160a01b0385166004820152602401610abc565b5080613255565b8051156148935780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b03811681146148c357600080fd5b919050565b600080604083850312156148db57600080fd5b6148e4836148ac565b946020939093013593505050565b6001600160e01b031981168114610ace57600080fd5b60006020828403121561491a57600080fd5b8135613255816148f2565b60005b83811015614940578181015183820152602001614928565b50506000910152565b60008151808452614961816020860160208601614925565b601f01601f19169290920160200192915050565b6020815260006132556020830184614949565b60006020828403121561499a57600080fd5b5035919050565b6000602082840312156149b357600080fd5b613255826148ac565b600080604083850312156149cf57600080fd5b50508035926020909101359150565b6000806000606084860312156149f357600080fd5b6149fc846148ac565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715614a4c57614a4c614a11565b6040525050565b60006001600160401b03821115614a6c57614a6c614a11565b5060051b60200190565b600082601f830112614a8757600080fd5b81356020614a9482614a53565b604051614aa18282614a27565b83815260059390931b8501820192828101915086841115614ac157600080fd5b8286015b84811015614adc5780358352918301918301614ac5565b509695505050505050565b60006001600160401b03831115614b0057614b00614a11565b604051614b17601f8501601f191660200182614a27565b809150838152848484011115614b2c57600080fd5b83836020830137600060208583010152509392505050565b600082601f830112614b5557600080fd5b61325583833560208501614ae7565b600080600080600060a08688031215614b7c57600080fd5b614b85866148ac565b9450614b93602087016148ac565b935060408601356001600160401b0380821115614baf57600080fd5b614bbb89838a01614a76565b94506060880135915080821115614bd157600080fd5b614bdd89838a01614a76565b93506080880135915080821115614bf357600080fd5b50614c0088828901614b44565b9150509295509295909350565b60008060408385031215614c2057600080fd5b82359150614c30602084016148ac565b90509250929050565b60008060408385031215614c4c57600080fd5b82356001600160401b0380821115614c6357600080fd5b818501915085601f830112614c7757600080fd5b81356020614c8482614a53565b604051614c918282614a27565b83815260059390931b8501820192828101915089841115614cb157600080fd5b948201945b83861015614cd657614cc7866148ac565b82529482019490820190614cb6565b96505086013592505080821115614cec57600080fd5b50614cf985828601614a76565b9150509250929050565b600081518084526020808501945080840160005b83811015614d3357815187529582019590820190600101614d17565b509495945050505050565b6020815260006132556020830184614d03565b600080600060608486031215614d6657600080fd5b614d6f846148ac565b925060208401356001600160401b0380821115614d8b57600080fd5b614d9787838801614a76565b93506040860135915080821115614dad57600080fd5b50614dba86828701614a76565b9150509250925092565b600060208284031215614dd657600080fd5b81356001600160401b03811115614dec57600080fd5b8201601f81018413614dfd57600080fd5b6123b084823560208401614ae7565b60008083601f840112614e1e57600080fd5b5081356001600160401b03811115614e3557600080fd5b60208301915083602082850101111561446257600080fd5b600080600060408486031215614e6257600080fd5b83356001600160401b0380821115614e7957600080fd5b908501906101808288031215614e8e57600080fd5b90935060208501359080821115614ea457600080fd5b50614eb186828701614e0c565b9497909650939450505050565b600080600060608486031215614ed357600080fd5b83359250614ee3602085016148ac565b9150604084013590509250925092565b60008083601f840112614f0557600080fd5b5081356001600160401b03811115614f1c57600080fd5b6020830191508360208260051b850101111561446257600080fd5b60008060008060408587031215614f4d57600080fd5b84356001600160401b0380821115614f6457600080fd5b614f7088838901614ef3565b90965094506020870135915080821115614f8957600080fd5b50614f9687828801614ef3565b95989497509550505050565b8015158114610ace57600080fd5b60008060408385031215614fc357600080fd5b614fcc836148ac565b91506020830135614fdc81614fa2565b809150509250929050565b60008060208385031215614ffa57600080fd5b82356001600160401b0381111561501057600080fd5b61501c85828601614ef3565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561507d57603f1988860301845261506b858351614949565b9450928501929085019060010161504f565b5092979650505050505050565b6000806000806000606086880312156150a257600080fd5b8535945060208601356001600160401b03808211156150c057600080fd5b6150cc89838a01614e0c565b909650945060408801359150808211156150e557600080fd5b506150f288828901614e0c565b969995985093965092949392505050565b60008060006040848603121561511857600080fd5b8335925060208401356001600160401b0381111561513557600080fd5b614eb186828701614e0c565b6000806040838503121561515457600080fd5b61515d836148ac565b9150614c30602084016148ac565b600080600080600060a0868803121561518357600080fd5b61518c866148ac565b945061519a602087016148ac565b9350604086013592506060860135915060808601356001600160401b038111156151c357600080fd5b614c0088828901614b44565b600181811c908216806151e357607f821691505b602082108103611c9457634e487b7160e01b600052602260045260246000fd5b60008351615215818460208801614925565b835190830190615229818360208801614925565b01949350505050565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109c3576109c3615270565b634e487b7160e01b600052601260045260246000fd5b6000826152c2576152c261529d565b500490565b6020808252600a90820152691a5b9d985b1a59081a5960b21b604082015260600190565b6020808252600f908201526e0988a9c8ea890be9a92a69a82a8869608b1b604082015260600190565b60006001820161532657615326615270565b5060010190565b808201808211156109c3576109c3615270565b6000823561017e1983360301811261535757600080fd5b9190910192915050565b6000808335601e1984360301811261537857600080fd5b8301803591506001600160401b0382111561539257600080fd5b60200191503681900382131561446257600080fd5b815160009082906020808601845b838110156153d1578151855293820193908201906001016153b5565b50929695505050505050565b6000808335601e198436030181126153f457600080fd5b83016020810192503590506001600160401b0381111561541357600080fd5b80360382131561446257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b80356001600160801b03811681146148c357600080fd5b600061018061548184615474856148ac565b6001600160a01b03169052565b61548d602084016148ac565b6001600160a01b03166020850152604083810135908501526154b1606084016148ac565b6001600160a01b03166060850152608083810135908501526154d660a08401846153dd565b8260a08701526154e98387018284615422565b9250505060c083013560c085015260e083013560e085015261010061550f8185016148ac565b6001600160a01b03169085015261012061552a84820161544b565b6001600160801b03169085015261014061554584820161544b565b6001600160801b0316908501526101609283013592909301919091525090565b60208082528181018390526000906040600585901b840181019084018684805b888110156155ca57878503603f190184528235368b900361017e190181126155ab578283fd5b6155b7868c8301615462565b9550509285019291850191600101615585565b509298975050505050505050565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b818103818111156109c3576109c3615270565b85815260606020820152600061562b606083018688615422565b828103604084015261563e818587615422565b98975050505050505050565b6001600160a01b0385811682528416602082015260806040820181905260009061567690830185614d03565b82810360608401526156888185614d03565b979650505050505050565b6000826156a2576156a261529d565b500690565b6020808252600c908201526b2a27afad22a927afa0a2222960a11b604082015260600190565b60208082526010908201526f125394d551919250d251539517d0905360821b604082015260600190565b60408152600061570a6040830185614d03565b828103602084015261571c8185614d03565b95945050505050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351615755816015850160208801614925565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351615786816026840160208801614925565b01602601949350505050565b601f821115610c2157600081815260208120601f850160051c810160208610156157b95750805b601f850160051c820191505b81811015612650578281556001016157c5565b81516001600160401b038111156157f1576157f1614a11565b615805816157ff84546151cf565b84615792565b602080601f83116001811461583a57600084156158225750858301515b600019600386901b1c1916600185901b178555612650565b600085815260208120601f198616915b828110156158695788860151825594840194600190910190840161584a565b50858210156158875787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006158aa6040830185614949565b828103602084015261571c8185614949565b6020815260006132556020830184615462565b6000602082840312156158e157600080fd5b6132558261544b565b600080858511156158fa57600080fd5b8386111561590757600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff1981358181169160148510156159415780818660140360031b1b83161692505b505092915050565b6001600160a01b0386811682528516602082015260a06040820181905260009061597590830186614d03565b82810360608401526159878186614d03565b9050828103608084015261563e8185614949565b6000602082840312156159ad57600080fd5b8151613255816148f2565b600060033d11156144215760046000803e5060005160e01c90565b600060443d10156159e15790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715615a1057505050505090565b8285019150815181811115615a285750505050505090565b843d8701016020828501011115615a425750505050505090565b615a5160208286010187614a27565b509095945050505050565b600081615a6b57615a6b615270565b506000190190565b60008251615357818460208701614925565b8183823760009101908152919050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061568890830184614949565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615af757600080fd5b815161325581614fa256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220184fbf6be280a81b8418e19bc58b505aba0165d5c05ce3935993dbeeb25f07ff64736f6c63430008140033

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

000000000000000000000000cef8dc1e247d4383d07104413a7e126a145dd11600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aa744bb224ebbfc4ee535ae12cf592b77ba06b30000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e81600000000000000000000000000000000000000000000000000000000000000114172636164656e204d6174657269616c730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005244152434d000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _defaultAdmin (address): 0xcEf8DC1E247D4383D07104413A7e126a145dD116
Arg [1] : _name (string): Arcaden Materials
Arg [2] : _symbol (string): $ARCM
Arg [3] : _royaltyRecipient (address): 0xaA744BB224ebbfc4Ee535ae12cF592b77bA06B30
Arg [4] : _royaltyBps (uint128): 10
Arg [5] : _trustedForwarder (address): 0xc65d82ECE367EF06bf2AB791B3f3CF037Dc0e816

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000cef8dc1e247d4383d07104413a7e126a145dd116
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 000000000000000000000000aa744bb224ebbfc4ee535ae12cf592b77ba06b30
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [5] : 000000000000000000000000c65d82ece367ef06bf2ab791b3f3cf037dc0e816
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [7] : 4172636164656e204d6174657269616c73000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 244152434d000000000000000000000000000000000000000000000000000000


Block Transaction 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
[ 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.