ETH Price: $4,011.12 (-0.47%)
Gas: 0.13 GWei

Token

ERC-20: Rubyscore_Scroll (Rubyscore_Scroll)

Overview

Max Total Supply

0 Rubyscore_Scroll

Holders

170,939

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
0xa16a858db9664b483d108e28e505f1c3edafe767
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
Rubyscore_Achievement

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

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

pragma solidity 0.8.19;

import {IRubyscore_Achievement} from "./interfaces/IRubyscore_Achievement.sol";
import {EIP712, ECDSA} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {ERC1155URIStorage} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";
import {AccessControl, Strings} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ERC1155, ERC1155Supply} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";

/**
 * @title Rubyscore_Achievement
 * @dev An ERC1155 token contract for minting and managing achievements with URI support.
 * @dev Rubyscore_Achievement can be minted by users with the MINTER_ROLE after proper authorization.
 * @dev Rubyscore_Achievement can have their URIs set by operators with the MINTER_ROLE.
 * @dev Rubyscore_Achievement can be safely transferred with restrictions on certain tokens.
 */
contract Rubyscore_Achievement is
    ERC1155,
    EIP712,
    AccessControl,
    ERC1155Supply,
    ERC1155URIStorage,
    ReentrancyGuard,
    IRubyscore_Achievement
{
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    string public constant NAME = "Rubyscore_Achievement";
    string public constant VERSION = "0.0.1";

    uint256 private price;

    string public name;
    string public symbol;

    mapping(uint256 => bool) private transferUnlock;
    mapping(address => uint256) private userNonce;

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view override(ERC1155, AccessControl, IRubyscore_Achievement) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function uri(
        uint256 tokenId
    ) public view override(ERC1155, ERC1155URIStorage, IRubyscore_Achievement) returns (string memory) {
        return super.uri(tokenId);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function getTransferStatus(uint256 tokenId) external view returns (bool) {
        return transferUnlock[tokenId];
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function getPrice() external view returns (uint256) {
        return price;
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function getUserNonce(address userAddress) external view returns (uint256) {
        return userNonce[userAddress];
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function tokenURI(uint256 tokenId) public view returns (string memory) {
        return uri(tokenId);
    }

    //TODO: use ERC1155("https://xproject.api/achivments/") like error URI and set new for ERC1155URIStorage

    /**
     * @notice Constructor for the Rubyscore_Achievement contract.
     * @dev Initializes the contract with roles and settings.
     * @param admin The address of the admin role, which has overall control.
     * @param operator The address of the operator role, responsible for unlock tokens and set base URI.
     * @param minter The address of the minter role, authorized to mint achievements and responsible for setting token URIs.
     * @param baseURI The base URI for token metadata.
     * @dev It sets the base URI for token metadata to the provided `baseURI`.
     * @dev It grants the DEFAULT_ADMIN_ROLE, OPERATOR_ROLE, and MINTER_ROLE to the specified addresses.
     * @dev It also initializes the contract with EIP712 support and ERC1155 functionality.
     */
    constructor(
        address admin,
        address operator,
        address minter,
        string memory baseURI,
        string memory _name,
        string memory _symbol
    ) ERC1155("ipfs://") EIP712(NAME, VERSION) {
        require(admin != address(0), "Zero address check");
        require(operator != address(0), "Zero address check");
        require(minter != address(0), "Zero address check");
        name = _name;
        symbol = _symbol;
        _grantRole(DEFAULT_ADMIN_ROLE, admin);
        _grantRole(OPERATOR_ROLE, msg.sender);
        _grantRole(OPERATOR_ROLE, operator);
        _grantRole(MINTER_ROLE, minter);
        _setBaseURI(baseURI);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function setTokenURI(uint256 tokenId, string memory newTokenURI) public onlyRole(MINTER_ROLE) {
        super._setURI(tokenId, newTokenURI);
        emit TokenURISet(tokenId, newTokenURI);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function setBatchTokenURI(
        uint256[] calldata tokenIds,
        string[] calldata newTokenURIs
    ) external onlyRole(MINTER_ROLE) {
        require(tokenIds.length == newTokenURIs.length, "Invalid params");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            setTokenURI(tokenIds[i], newTokenURIs[i]);
        }
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function setBaseURI(string memory newBaseURI) external onlyRole(OPERATOR_ROLE) {
        super._setBaseURI(newBaseURI);
        emit BaseURISet(newBaseURI);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function setPrice(uint256 newPrice) external onlyRole(OPERATOR_ROLE) {
        price = newPrice;
        emit PriceUpdated(newPrice);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function safeMint(MintParams memory mintParams, bytes calldata operatorSignature) external payable nonReentrant {
        require(mintParams.nftIds.length >= 1, "Invalid NFT ids");
        require(msg.value == price, "Wrong payment amount");
        bytes32 digest = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    keccak256("MintParams(address userAddress,uint256 userNonce,uint256[] nftIds)"),
                    msg.sender,
                    userNonce[msg.sender],
                    keccak256(abi.encodePacked(mintParams.nftIds))
                )
            )
        );
        _checkRole(MINTER_ROLE, ECDSA.recover(digest, operatorSignature));
        userNonce[mintParams.userAddress] += 1;
        if (mintParams.nftIds.length > 1) _mintBatch(mintParams.userAddress, mintParams.nftIds, "");
        else _mint(mintParams.userAddress, mintParams.nftIds[0], "");
        emit Minted(mintParams.userAddress, mintParams.userNonce, mintParams.nftIds);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function setTransferUnlock(uint256 tokenId, bool lock) external onlyRole(OPERATOR_ROLE) {
        transferUnlock[tokenId] = lock;
        emit TokenUnlockSet(tokenId, lock);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint256 amount = address(this).balance;
        require(amount > 0, "Zero amount to withdraw");
        (bool sent, ) = payable(msg.sender).call{value: amount}("");
        require(sent, "Failed to send Ether");
        emit Withdrawed(amount);
    }

    /**
     * @dev See {IRubyscore_Achievement}
     */
    function _mint(address to, uint256 id, bytes memory data) internal {
        require(balanceOf(to, id) == 0, "You already have this achievement");
        super._mint(to, id, 1, data);
    }

    /**
     * @notice Internal function to safely mint multiple NFTs in a batch for a specified recipient.
     * @param to The address of the recipient to mint the NFTs for.
     * @param ids An array of NFT IDs to mint.
     * @param data Additional data to include in the minting transaction.
     * @dev This function checks if the recipient already owns any of the specified NFTs to prevent duplicates.
     * @dev It is intended for batch minting operations where multiple NFTs can be minted at once.
     */
    function _mintBatch(address to, uint256[] memory ids, bytes memory data) internal {
        uint256[] memory amounts = new uint256[](ids.length);
        for (uint8 i = 0; i < ids.length; i++) {
            require(balanceOf(to, ids[i]) == 0, "You already have this achievement"); // TODO: custom error with problem token id
            amounts[i] = 1;
        }
        super._mintBatch(to, ids, amounts, data);
    }

    /**
     * @notice Internal function that is called before the transfer of tokens.
     * @param operator The address that initiates or approves the transfer.
     * @param from The address from which the tokens are being transferred.
     * @param to The address to which the tokens are being transferred.
     * @param ids An array of token IDs to be transferred.
     * @param amounts An array of token amounts corresponding to the IDs to be transferred.
     * @param data Additional data to include in the transfer.
     * @dev This function enforces transfer restrictions based on the 'transferUnlock' status of individual tokens.
     * @dev If a token has its transfer locked and the 'from' address is not zero (indicating a user-to-contract transfer),
     * it will revert to prevent unauthorized transfers.
     * @dev It then delegates the transfer logic to the parent contracts 'ERC1155' and 'ERC1155Supply'.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155, ERC1155Supply) {
        for (uint256 i = 0; i < ids.length; i++) {
            if (!transferUnlock[ids[i]] && from != address(0)) revert("This token only for you");
        }
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }
}

File 2 of 23 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @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.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

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

    /**
     * @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 revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 23 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @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 4 of 23 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @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 23 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

        return batchBalances;
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

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

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

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

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

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

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

        return array;
    }
}

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

pragma solidity ^0.8.0;

import "../ERC1155.sol";

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

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

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

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

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

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

File 8 of 23 : ERC1155URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)

pragma solidity ^0.8.0;

import "../../../utils/Strings.sol";
import "../ERC1155.sol";

/**
 * @dev ERC1155 token with storage based token URI management.
 * Inspired by the ERC721URIStorage extension
 *
 * _Available since v4.6._
 */
abstract contract ERC1155URIStorage is ERC1155 {
    using Strings for uint256;

    // Optional base URI
    string private _baseURI = "";

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the concatenation of the `_baseURI`
     * and the token-specific uri if the latter is set
     *
     * This enables the following behaviors:
     *
     * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
     *   of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
     *   is empty per default);
     *
     * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
     *   which in most cases will contain `ERC1155._uri`;
     *
     * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
     *   uri value set, then the result is empty.
     */
    function uri(uint256 tokenId) public view virtual override returns (string memory) {
        string memory tokenURI = _tokenURIs[tokenId];

        // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).
        return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
    }

    /**
     * @dev Sets `tokenURI` as the tokenURI of `tokenId`.
     */
    function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
        _tokenURIs[tokenId] = tokenURI;
        emit URI(uri(tokenId), tokenId);
    }

    /**
     * @dev Sets `baseURI` as the `_baseURI` for all tokens
     */
    function _setBaseURI(string memory baseURI) internal virtual {
        _baseURI = baseURI;
    }
}

File 9 of 23 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

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

File 10 of 23 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * 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 12 of 23 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * 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 13 of 23 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 14 of 23 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../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 15 of 23 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.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].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // 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 _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @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) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, 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);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 20 of 23 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 23 of 23 : IRubyscore_Achievement.sol
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.19;

import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

/**
 * @title IRubyscore_Achievement
 * @dev IRubyscore_Achievement is an interface for Rubyscore_Achievement contract
 */
interface IRubyscore_Achievement is IERC1155 {
    struct MintParams {
        address userAddress; // Address of the buyer.
        uint256 userNonce; // Nonce associated with the user's address for preventing replay attacks.
        uint256[] nftIds; // ids of NFTs to mint
    }

    /**
     * @notice Emitted when the base URI for token metadata is updated.
     * @param newBaseURI The new base URI that will be used to construct token metadata URIs.
     * @dev This event is triggered when the contract operator updates the base URI
     * for retrieving metadata associated with tokens. The 'newBaseURI' parameter represents
     * the updated base URI.
     */
    event BaseURISet(string indexed newBaseURI);

    /**
     * @notice Emitted when NFTs are minted for a user.
     * @param userAddress The address of the user receiving the NFTs.
     * @param userNonce The user's nonce used to prevent replay attacks.
     * @param nftIds An array of NFT IDs that were minted.
     * @dev This event is emitted when new NFTs are created and assigned to a user.
     * @dev It includes the user's address, nonce, and the IDs of the minted NFTs for transparency.
     */
    event Minted(address indexed userAddress, uint256 indexed userNonce, uint256[] nftIds);

    /**
     * @notice Emitted when the URI for a specific token is updated.
     * @param tokenId The ID of the token for which the URI is updated.
     * @param newTokenURI The new URI assigned to the token.
     * @dev This event is emitted when the URI for a token is modified, providing transparency
     * when metadata URIs are changed for specific tokens.
     */
    event TokenURISet(uint256 indexed tokenId, string indexed newTokenURI);

    /**
     * @notice Emitted when the transfer lock status for a token is updated.
     * @param tokenId The ID of the token for which the transfer lock status changes.
     * @param lock The new transfer lock status (true for locked, false for unlocked).
     * @dev This event is emitted when the transfer lock status of a specific token is modified.
     * @dev It provides transparency regarding whether a token can be transferred or not.
     */
    event TokenUnlockSet(uint256 indexed tokenId, bool indexed lock);

    /**
     * @notice Emitted when the price for a token mint is updated.
     * @param newPrice The new price for mint.
     * @dev This event is emitted when the price for mint a token is modified.
     */
    event PriceUpdated(uint256 newPrice);

    /**
     * @notice Get token name.
     * @return Token name.
     */
    function name() external view returns (string memory);

    /**
     * @notice Get token symbol.
     * @return Token symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @notice Get the URI of a token.
     * @param tokenId The ID of the token.
     * @return The URI of the token.
     */
    function uri(uint256 tokenId) external view returns (string memory);

    /**
     * @notice Get the transfer status of a token.
     * @param tokenId The ID of the token.
     * @return Whether the token's transfer is unlocked (true) or restricted (false).
     */
    function getTransferStatus(uint256 tokenId) external view returns (bool);

    /**
     * @notice Get the user's nonce associated with their address.
     * @param userAddress The address of the user.
     * @return The user's nonce.
     */
    function getUserNonce(address userAddress) external view returns (uint256);

    /**
     * @notice Get the token URI for a given tokenId.
     * @param tokenId The ID of the token.
     * @return The URI of the token.
     * @dev Diblicate for uri() method
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);

    /**
     * @notice Set the URI for a token.
     * @param tokenId The ID of the token.
     * @param newTokenURI The new URI to set for the token.
     * @dev Requires the MINTER_ROLE.
     */
    function setTokenURI(uint256 tokenId, string memory newTokenURI) external;

    /**
     * @notice Set the URIs for multiple tokens in a batch.
     * @param tokenIds An array of token IDs to set URIs for.
     * @param newTokenURIs An array of new URIs to set for the tokens.
     * @dev Requires the MINTER_ROLE.
     * @dev Requires that the tokenIds and newTokenURIs arrays have the same length.
     */
    function setBatchTokenURI(uint256[] calldata tokenIds, string[] calldata newTokenURIs) external;

    /**
     * @notice Set the base URI for all tokens.
     * @param newBaseURI The new base URI to set.
     * @dev Requires the OPERATOR_ROLE.
     */
    function setBaseURI(string memory newBaseURI) external;

    /**
     * @notice Safely mints NFTs for a user based on provided parameters and a valid minter signature.
     * @param mintParams The struct containing user address, user nonce, and NFT IDs to mint.
     * @param operatorSignature The ECDSA signature of the data, validating the operator's role.
     * @dev This function safely mints NFTs for a user while ensuring the validity of the operator's signature.
     * @dev It requires that the provided NFT IDs are valid and that the operator has the MINTER_ROLE.
     * @dev User nonces are used to prevent replay attacks.
     * @dev Multiple NFTs can be minted in a batch or a single NFT can be minted based on the number of NFT IDs provided.
     * @dev Emits the 'Minted' event to indicate the successful minting of NFTs.
     */
    function safeMint(MintParams memory mintParams, bytes calldata operatorSignature) external payable;

    event Withdrawed(uint256 amount);

    /**
     * @notice Sets the transfer lock status for a specific token ID.
     * @param tokenId The ID of the token to set the transfer lock status for.
     * @param lock The boolean value to determine whether transfers of this token are locked or unlocked.
     * @dev This function can only be called by an operator with the OPERATOR_ROLE.
     * @dev It allows operators to control the transferability of specific tokens.
     * @dev Emits the 'tokenUnlockSet' event to indicate the change in transfer lock status.
     */
    function setTransferUnlock(uint256 tokenId, bool lock) external;

    /**
     * @notice Check if a given interface is supported by this contract.
     * @param interfaceId The interface identifier to check for support.
     * @return Whether the contract supports the specified interface.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"newBaseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"userNonce","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceUpdated","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":"string","name":"newTokenURI","type":"string"}],"name":"TokenURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"lock","type":"bool"}],"name":"TokenUnlockSet","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawed","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getTransferStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"userNonce","type":"uint256"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"internalType":"struct IRubyscore_Achievement.MintParams","name":"mintParams","type":"tuple"},{"internalType":"bytes","name":"operatorSignature","type":"bytes"}],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"string[]","name":"newTokenURIs","type":"string[]"}],"name":"setBatchTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"newTokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"lock","type":"bool"}],"name":"setTransferUnlock","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":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

61018060405260006101609081526007906200001c908262000501565b503480156200002a57600080fd5b5060405162003fa938038062003fa98339810160408190526200004d91620006a1565b6040518060400160405280601581526020017f5275627973636f72655f416368696576656d656e74000000000000000000000081525060405180604001604052806005815260200164302e302e3160d81b81525060405180604001604052806007815260200166697066733a2f2f60c81b815250620000d2816200031c60201b60201c565b50620000e08260036200032e565b61012052620000f18160046200032e565b61014052815160208084019190912060e052815190820120610100524660a0526200017f60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c05260016009556001600160a01b038616620001de5760405162461bcd60e51b81526020600482015260126024820152715a65726f206164647265737320636865636b60701b60448201526064015b60405180910390fd5b6001600160a01b0385166200022b5760405162461bcd60e51b81526020600482015260126024820152715a65726f206164647265737320636865636b60701b6044820152606401620001d5565b6001600160a01b038416620002785760405162461bcd60e51b81526020600482015260126024820152715a65726f206164647265737320636865636b60701b6044820152606401620001d5565b600b62000286838262000501565b50600c62000295828262000501565b50620002a360008762000367565b620002be60008051602062003f898339815191523362000367565b620002d960008051602062003f898339815191528662000367565b620003057f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68562000367565b62000310836200040b565b505050505050620007c4565b60026200032a828262000501565b5050565b60006020835110156200034e57620003468362000419565b905062000361565b816200035b848262000501565b5060ff90505b92915050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166200032a5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003c73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60076200032a828262000501565b600080829050601f8151111562000447578260405163305a27a960e01b8152600401620001d591906200076a565b805162000454826200079f565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200048757607f821691505b602082108103620004a857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004fc57600081815260208120601f850160051c81016020861015620004d75750805b601f850160051c820191505b81811015620004f857828155600101620004e3565b5050505b505050565b81516001600160401b038111156200051d576200051d6200045c565b62000535816200052e845462000472565b84620004ae565b602080601f8311600181146200056d5760008415620005545750858301515b600019600386901b1c1916600185901b178555620004f8565b600085815260208120601f198616915b828110156200059e578886015182559484019460019091019084016200057d565b5085821015620005bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80516001600160a01b0381168114620005e557600080fd5b919050565b60005b8381101562000607578181015183820152602001620005ed565b50506000910152565b600082601f8301126200062257600080fd5b81516001600160401b03808211156200063f576200063f6200045c565b604051601f8301601f19908116603f011681019082821181831017156200066a576200066a6200045c565b816040528381528660208588010111156200068457600080fd5b62000697846020830160208901620005ea565b9695505050505050565b60008060008060008060c08789031215620006bb57600080fd5b620006c687620005cd565b9550620006d660208801620005cd565b9450620006e660408801620005cd565b60608801519094506001600160401b03808211156200070457600080fd5b620007128a838b0162000610565b945060808901519150808211156200072957600080fd5b620007378a838b0162000610565b935060a08901519150808211156200074e57600080fd5b506200075d89828a0162000610565b9150509295509295509295565b60208152600082518060208401526200078b816040850160208701620005ea565b601f01601f19169190910160400192915050565b80516020808301519190811015620004a85760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161376a6200081f6000396000610f1d01526000610ef201526000611e8901526000611e6101526000611dbc01526000611de601526000611e10015261376a6000f3fe6080604052600436106101f85760003560e01c806391d148541161010d578063ba772d8b116100a0578063d547741f1161006f578063d547741f14610615578063e985e9c514610635578063f242432a1461067e578063f5b541a61461069e578063ffa1ad74146106c057600080fd5b8063ba772d8b14610586578063bd85b039146105a6578063c87b56dd146105d3578063d5391393146105f357600080fd5b8063a217fddf116100dc578063a217fddf146104e0578063a22cb465146104f5578063a3f4df7e14610515578063b93c37701461055657600080fd5b806391d148541461047657806395d89b411461049657806398d5fdca146104ab5780639b3e5573146104c057600080fd5b806336568abe1161019057806355f804b31161015f57806355f804b3146103c55780636834e3a8146103e55780637c2ccc451461041b57806384b0196e1461042e57806391b7f5ed1461045657600080fd5b806336568abe146103345780633ccfd60b146103545780634e1273f4146103695780634f558e791461039657600080fd5b8063162094c4116101cc578063162094c4146102a2578063248a9ca3146102c45780632eb2c2d6146102f45780632f2ff15d1461031457600080fd5b8062fdd58e146101fd57806301ffc9a71461023057806306fdde03146102605780630e89341c14610282575b600080fd5b34801561020957600080fd5b5061021d61021836600461281e565b6106f1565b6040519081526020015b60405180910390f35b34801561023c57600080fd5b5061025061024b36600461285e565b61078a565b6040519015158152602001610227565b34801561026c57600080fd5b50610275610795565b60405161022791906128cb565b34801561028e57600080fd5b5061027561029d3660046128de565b610823565b3480156102ae57600080fd5b506102c26102bd3660046129d1565b61082e565b005b3480156102d057600080fd5b5061021d6102df3660046128de565b60009081526005602052604090206001015490565b34801561030057600080fd5b506102c261030f366004612aab565b610895565b34801561032057600080fd5b506102c261032f366004612b54565b6108e1565b34801561034057600080fd5b506102c261034f366004612b54565b61090b565b34801561036057600080fd5b506102c2610989565b34801561037557600080fd5b50610389610384366004612b80565b610aa9565b6040516102279190612c7b565b3480156103a257600080fd5b506102506103b13660046128de565b600090815260066020526040902054151590565b3480156103d157600080fd5b506102c26103e0366004612c8e565b610bd2565b3480156103f157600080fd5b5061021d610400366004612cca565b6001600160a01b03166000908152600e602052604090205490565b6102c2610429366004612d26565b610c35565b34801561043a57600080fd5b50610443610ee4565b6040516102279796959493929190612ddb565b34801561046257600080fd5b506102c26104713660046128de565b610f6d565b34801561048257600080fd5b50610250610491366004612b54565b610fc1565b3480156104a257600080fd5b50610275610fec565b3480156104b757600080fd5b50600a5461021d565b3480156104cc57600080fd5b506102c26104db366004612e5b565b610ff9565b3480156104ec57600080fd5b5061021d600081565b34801561050157600080fd5b506102c2610510366004612e7e565b61105e565b34801561052157600080fd5b5061027560405180604001604052806015815260200174149d589e5cd8dbdc9957d058da1a595d995b595b9d605a1b81525081565b34801561056257600080fd5b506102506105713660046128de565b6000908152600d602052604090205460ff1690565b34801561059257600080fd5b506102c26105a1366004612eec565b611069565b3480156105b257600080fd5b5061021d6105c13660046128de565b60009081526006602052604090205490565b3480156105df57600080fd5b506102756105ee3660046128de565b611160565b3480156105ff57600080fd5b5061021d60008051602061371583398151915281565b34801561062157600080fd5b506102c2610630366004612b54565b61116b565b34801561064157600080fd5b50610250610650366004612f57565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561068a57600080fd5b506102c2610699366004612f81565b611190565b3480156106aa57600080fd5b5061021d6000805160206136f583398151915281565b3480156106cc57600080fd5b5061027560405180604001604052806005815260200164302e302e3160d81b81525081565b60006001600160a01b0383166107615760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b6000610784826111d5565b600b80546107a290612fe5565b80601f01602080910402602001604051908101604052809291908181526020018280546107ce90612fe5565b801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b505050505081565b6060610784826111fa565b600080516020613715833981519152610846816112da565b61085083836112e7565b8160405161085e919061301f565b6040519081900381209084907fda84ca2183491f179a603e877b2cb058e42195041c2b9c53d746427e519a34df90600090a3505050565b6001600160a01b0385163314806108b157506108b18533610650565b6108cd5760405162461bcd60e51b81526004016107589061303b565b6108da8585858585611344565b5050505050565b6000828152600560205260409020600101546108fc816112da565b61090683836114e6565b505050565b6001600160a01b038116331461097b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610758565b610985828261156c565b5050565b6000610994816112da565b47806109e25760405162461bcd60e51b815260206004820152601760248201527f5a65726f20616d6f756e7420746f2077697468647261770000000000000000006044820152606401610758565b604051600090339083908381818185875af1925050503d8060008114610a24576040519150601f19603f3d011682016040523d82523d6000602084013e610a29565b606091505b5050905080610a715760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610758565b6040518281527f11e9d9f7a772129e26cb0560945658c96b41c42ac6712d233e20c894bfcd00fd9060200160405180910390a1505050565b60608151835114610b0e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610758565b600083516001600160401b03811115610b2957610b296128f7565b604051908082528060200260200182016040528015610b52578160200160208202803683370190505b50905060005b8451811015610bca57610b9d858281518110610b7657610b76613089565b6020026020010151858381518110610b9057610b90613089565b60200260200101516106f1565b828281518110610baf57610baf613089565b6020908102919091010152610bc3816130b5565b9050610b58565b509392505050565b6000805160206136f5833981519152610bea816112da565b610bf3826115d3565b81604051610c01919061301f565b604051908190038120907ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f690600090a25050565b610c3d6115df565b60018360400151511015610c855760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204e46542069647360881b6044820152606401610758565b600a543414610ccd5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81c185e5b595b9d08185b5bdd5b9d60621b6044820152606401610758565b6000610d927f66fe4d8b6c8e0542c70e2a244bf04681bb936b001f1be0f079a80e77158a847433600e6000336001600160a01b03166001600160a01b03168152602001908152602001600020548760400151604051602001610d2f91906130ce565b60405160208183030381529060405280519060200120604051602001610d7794939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120611638565b9050610deb600080516020613715833981519152610de68386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061166592505050565b611681565b83516001600160a01b03166000908152600e60205260408120805460019290610e15908490613104565b909155505060408401515160011015610e4f57610e4a84600001518560400151604051806020016040528060008152506116da565b610e8b565b610e8b84600001518560400151600081518110610e6e57610e6e613089565b6020026020010151604051806020016040528060008152506117ad565b836020015184600001516001600160a01b03167fff0a1dc048ef1a5e9e2845c6bb6cafd8b8531f3cb15368f4a708dec7d7bc789f8660400151604051610ed19190612c7b565b60405180910390a3506109066001600955565b600060608082808083610f187f000000000000000000000000000000000000000000000000000000000000000060036117e1565b610f437f000000000000000000000000000000000000000000000000000000000000000060046117e1565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6000805160206136f5833981519152610f85816112da565b600a8290556040518281527f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe09060200160405180910390a15050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600c80546107a290612fe5565b6000805160206136f5833981519152611011816112da565b6000838152600d6020526040808220805460ff19168515159081179091559051909185917f784afb92b74f2c9ccd3cb1b9697580a90fadab59d6640bbb915d1637bfbbf0089190a3505050565b61098533838361188c565b600080516020613715833981519152611081816112da565b8382146110c15760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b6044820152606401610758565b60005b84811015611158576111468686838181106110e1576110e1613089565b905060200201358585848181106110fa576110fa613089565b905060200281019061110c9190613117565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061082e92505050565b80611150816130b5565b9150506110c4565b505050505050565b606061078482610823565b600082815260056020526040902060010154611186816112da565b610906838361156c565b6001600160a01b0385163314806111ac57506111ac8533610650565b6111c85760405162461bcd60e51b81526004016107589061303b565b6108da858585858561196c565b60006001600160e01b03198216637965db0b60e01b1480610784575061078482611aa4565b60008181526008602052604081208054606092919061121890612fe5565b80601f016020809104026020016040519081016040528092919081815260200182805461124490612fe5565b80156112915780601f1061126657610100808354040283529160200191611291565b820191906000526020600020905b81548152906001019060200180831161127457829003601f168201915b5050505050905060008151116112af576112aa83611af4565b6112d3565b6007816040516020016112c392919061315d565b6040516020818303038152906040525b9392505050565b6112e48133611681565b50565b60008281526008602052604090206112ff828261322a565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61132b84610823565b60405161133891906128cb565b60405180910390a25050565b81518351146113655760405162461bcd60e51b8152600401610758906132e9565b6001600160a01b03841661138b5760405162461bcd60e51b815260040161075890613331565b3361139a818787878787611b88565b60005b84518110156114805760008582815181106113ba576113ba613089565b6020026020010151905060008583815181106113d8576113d8613089565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156114285760405162461bcd60e51b815260040161075890613376565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611465908490613104565b9250508190555050505080611479906130b5565b905061139d565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516114d09291906133c0565b60405180910390a4611158818787878787611c4b565b6114f08282610fc1565b6109855760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115283390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115768282610fc1565b156109855760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6007610985828261322a565b6002600954036116315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610758565b6002600955565b6000610784611645611daf565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006116748585611ee2565b91509150610bca81611f27565b61168b8282610fc1565b6109855761169881612071565b6116a3836020612083565b6040516020016116b49291906133ee565b60408051601f198184030181529082905262461bcd60e51b8252610758916004016128cb565b600082516001600160401b038111156116f5576116f56128f7565b60405190808252806020026020018201604052801561171e578160200160208202803683370190505b50905060005b83518160ff16101561179a5761174985858360ff1681518110610b9057610b90613089565b156117665760405162461bcd60e51b815260040161075890613463565b6001828260ff168151811061177d5761177d613089565b602090810291909101015280611792816134a4565b915050611724565b506117a78484838561221e565b50505050565b6117b783836106f1565b156117d45760405162461bcd60e51b815260040161075890613463565b6109068383600184612378565b606060ff83146117fb576117f483612458565b9050610784565b81805461180790612fe5565b80601f016020809104026020016040519081016040528092919081815260200182805461183390612fe5565b80156118805780601f1061185557610100808354040283529160200191611880565b820191906000526020600020905b81548152906001019060200180831161186357829003601f168201915b50505050509050610784565b816001600160a01b0316836001600160a01b0316036118ff5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610758565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166119925760405162461bcd60e51b815260040161075890613331565b33600061199e85612497565b905060006119ab85612497565b90506119bb838989858589611b88565b6000868152602081815260408083206001600160a01b038c168452909152902054858110156119fc5760405162461bcd60e51b815260040161075890613376565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290611a39908490613104565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611a99848a8a8a8a8a6124e2565b505050505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480611ad557506001600160e01b031982166303a24d0760e21b145b8061078457506301ffc9a760e01b6001600160e01b0319831614610784565b606060028054611b0390612fe5565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2f90612fe5565b8015611b7c5780601f10611b5157610100808354040283529160200191611b7c565b820191906000526020600020905b815481529060010190602001808311611b5f57829003601f168201915b50505050509050919050565b60005b8351811015611c3c57600d6000858381518110611baa57611baa613089565b60209081029190910181015182528101919091526040016000205460ff16158015611bdd57506001600160a01b03861615155b15611c2a5760405162461bcd60e51b815260206004820152601760248201527f5468697320746f6b656e206f6e6c7920666f7220796f750000000000000000006044820152606401610758565b80611c34816130b5565b915050611b8b565b5061115886868686868661259d565b6001600160a01b0384163b156111585760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611c8f90899089908890889088906004016134c3565b6020604051808303816000875af1925050508015611cca575060408051601f3d908101601f19168201909252611cc791810190613521565b60015b611d7657611cd661353e565b806308c379a003611d0f5750611cea613559565b80611cf55750611d11565b8060405162461bcd60e51b815260040161075891906128cb565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610758565b6001600160e01b0319811663bc197c8160e01b14611da65760405162461bcd60e51b8152600401610758906135e2565b50505050505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611e0857507f000000000000000000000000000000000000000000000000000000000000000046145b15611e3257507f000000000000000000000000000000000000000000000000000000000000000090565b611eda604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b90565b6000808251604103611f185760208301516040840151606085015160001a611f0c87828585612716565b94509450505050611f20565b506000905060025b9250929050565b6000816004811115611f3b57611f3b61362a565b03611f435750565b6001816004811115611f5757611f5761362a565b03611fa45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610758565b6002816004811115611fb857611fb861362a565b036120055760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610758565b60038160048111156120195761201961362a565b036112e45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610758565b60606107846001600160a01b03831660145b60606000612092836002613640565b61209d906002613104565b6001600160401b038111156120b4576120b46128f7565b6040519080825280601f01601f1916602001820160405280156120de576020820181803683370190505b509050600360fc1b816000815181106120f9576120f9613089565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061212857612128613089565b60200101906001600160f81b031916908160001a905350600061214c846002613640565b612157906001613104565b90505b60018111156121cf576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061218b5761218b613089565b1a60f81b8282815181106121a1576121a1613089565b60200101906001600160f81b031916908160001a90535060049490941c936121c881613657565b905061215a565b5083156112d35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610758565b6001600160a01b0384166122445760405162461bcd60e51b81526004016107589061366e565b81518351146122655760405162461bcd60e51b8152600401610758906132e9565b3361227581600087878787611b88565b60005b84518110156123105783818151811061229357612293613089565b60200260200101516000808784815181106122b0576122b0613089565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546122f89190613104565b90915550819050612308816130b5565b915050612278565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516123619291906133c0565b60405180910390a46108da81600087878787611c4b565b6001600160a01b03841661239e5760405162461bcd60e51b81526004016107589061366e565b3360006123aa85612497565b905060006123b785612497565b90506123c883600089858589611b88565b6000868152602081815260408083206001600160a01b038b168452909152812080548792906123f8908490613104565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611da6836000898989896124e2565b60606000612465836127da565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106124d1576124d1613089565b602090810291909101015292915050565b6001600160a01b0384163b156111585760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061252690899089908890889088906004016136af565b6020604051808303816000875af1925050508015612561575060408051601f3d908101601f1916820190925261255e91810190613521565b60015b61256d57611cd661353e565b6001600160e01b0319811663f23a6e6160e01b14611da65760405162461bcd60e51b8152600401610758906135e2565b6001600160a01b0385166126245760005b8351811015612622578281815181106125c9576125c9613089565b6020026020010151600660008684815181106125e7576125e7613089565b60200260200101518152602001908152602001600020600082825461260c9190613104565b9091555061261b9050816130b5565b90506125ae565b505b6001600160a01b0384166111585760005b8351811015611da657600084828151811061265257612652613089565b60200260200101519050600084838151811061267057612670613089565b60200260200101519050600060066000848152602001908152602001600020549050818110156126f35760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608401610758565b6000928352600660205260409092209103905561270f816130b5565b9050612635565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561274d57506000905060036127d1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156127a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166127ca576000600192509250506127d1565b9150600090505b94509492505050565b600060ff8216601f81111561078457604051632cd44ac360e21b815260040160405180910390fd5b80356001600160a01b038116811461281957600080fd5b919050565b6000806040838503121561283157600080fd5b61283a83612802565b946020939093013593505050565b6001600160e01b0319811681146112e457600080fd5b60006020828403121561287057600080fd5b81356112d381612848565b60005b8381101561289657818101518382015260200161287e565b50506000910152565b600081518084526128b781602086016020860161287b565b601f01601f19169290920160200192915050565b6020815260006112d3602083018461289f565b6000602082840312156128f057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b606081018181106001600160401b038211171561292c5761292c6128f7565b60405250565b601f8201601f191681016001600160401b0381118282101715612957576129576128f7565b6040525050565b600082601f83011261296f57600080fd5b81356001600160401b03811115612988576129886128f7565b60405161299f601f8301601f191660200182612932565b8181528460208386010111156129b457600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156129e457600080fd5b8235915060208301356001600160401b03811115612a0157600080fd5b612a0d8582860161295e565b9150509250929050565b60006001600160401b03821115612a3057612a306128f7565b5060051b60200190565b600082601f830112612a4b57600080fd5b81356020612a5882612a17565b604051612a658282612932565b83815260059390931b8501820192828101915086841115612a8557600080fd5b8286015b84811015612aa05780358352918301918301612a89565b509695505050505050565b600080600080600060a08688031215612ac357600080fd5b612acc86612802565b9450612ada60208701612802565b935060408601356001600160401b0380821115612af657600080fd5b612b0289838a01612a3a565b94506060880135915080821115612b1857600080fd5b612b2489838a01612a3a565b93506080880135915080821115612b3a57600080fd5b50612b478882890161295e565b9150509295509295909350565b60008060408385031215612b6757600080fd5b82359150612b7760208401612802565b90509250929050565b60008060408385031215612b9357600080fd5b82356001600160401b0380821115612baa57600080fd5b818501915085601f830112612bbe57600080fd5b81356020612bcb82612a17565b604051612bd88282612932565b83815260059390931b8501820192828101915089841115612bf857600080fd5b948201945b83861015612c1d57612c0e86612802565b82529482019490820190612bfd565b96505086013592505080821115612c3357600080fd5b50612a0d85828601612a3a565b600081518084526020808501945080840160005b83811015612c7057815187529582019590820190600101612c54565b509495945050505050565b6020815260006112d36020830184612c40565b600060208284031215612ca057600080fd5b81356001600160401b03811115612cb657600080fd5b612cc28482850161295e565b949350505050565b600060208284031215612cdc57600080fd5b6112d382612802565b60008083601f840112612cf757600080fd5b5081356001600160401b03811115612d0e57600080fd5b602083019150836020828501011115611f2057600080fd5b600080600060408486031215612d3b57600080fd5b83356001600160401b0380821115612d5257600080fd5b9085019060608288031215612d6657600080fd5b604051612d728161290d565b612d7b83612802565b815260208301356020820152604083013582811115612d9957600080fd5b612da589828601612a3a565b60408301525094506020860135915080821115612dc157600080fd5b50612dce86828701612ce5565b9497909650939450505050565b60ff60f81b8816815260e060208201526000612dfa60e083018961289f565b8281036040840152612e0c818961289f565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050612e3d8185612c40565b9a9950505050505050505050565b8035801515811461281957600080fd5b60008060408385031215612e6e57600080fd5b82359150612b7760208401612e4b565b60008060408385031215612e9157600080fd5b612e9a83612802565b9150612b7760208401612e4b565b60008083601f840112612eba57600080fd5b5081356001600160401b03811115612ed157600080fd5b6020830191508360208260051b8501011115611f2057600080fd5b60008060008060408587031215612f0257600080fd5b84356001600160401b0380821115612f1957600080fd5b612f2588838901612ea8565b90965094506020870135915080821115612f3e57600080fd5b50612f4b87828801612ea8565b95989497509550505050565b60008060408385031215612f6a57600080fd5b612f7383612802565b9150612b7760208401612802565b600080600080600060a08688031215612f9957600080fd5b612fa286612802565b9450612fb060208701612802565b9350604086013592506060860135915060808601356001600160401b03811115612fd957600080fd5b612b478882890161295e565b600181811c90821680612ff957607f821691505b60208210810361301957634e487b7160e01b600052602260045260246000fd5b50919050565b6000825161303181846020870161287b565b9190910192915050565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016130c7576130c761309f565b5060010190565b815160009082906020808601845b838110156130f8578151855293820193908201906001016130dc565b50929695505050505050565b808201808211156107845761078461309f565b6000808335601e1984360301811261312e57600080fd5b8301803591506001600160401b0382111561314857600080fd5b602001915036819003821315611f2057600080fd5b600080845461316b81612fe5565b600182811680156131835760018114613198576131c7565b60ff19841687528215158302870194506131c7565b8860005260208060002060005b858110156131be5781548a8201529084019082016131a5565b50505082870194505b5050505083516131db81836020880161287b565b01949350505050565b601f82111561090657600081815260208120601f850160051c8101602086101561320b5750805b601f850160051c820191505b8181101561115857828155600101613217565b81516001600160401b03811115613243576132436128f7565b613257816132518454612fe5565b846131e4565b602080601f83116001811461328c57600084156132745750858301515b600019600386901b1c1916600185901b178555611158565b600085815260208120601f198616915b828110156132bb5788860151825594840194600190910190840161329c565b50858210156132d95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006133d36040830185612c40565b82810360208401526133e58185612c40565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161342681601785016020880161287b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161345781602884016020880161287b565b01602801949350505050565b60208082526021908201527f596f7520616c72656164792068617665207468697320616368696576656d656e6040820152601d60fa1b606082015260800190565b600060ff821660ff81036134ba576134ba61309f565b60010192915050565b6001600160a01b0386811682528516602082015260a0604082018190526000906134ef90830186612c40565b82810360608401526135018186612c40565b90508281036080840152613515818561289f565b98975050505050505050565b60006020828403121561353357600080fd5b81516112d381612848565b600060033d1115611edf5760046000803e5060005160e01c90565b600060443d10156135675790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561359657505050505090565b82850191508151818111156135ae5750505050505090565b843d87010160208285010111156135c85750505050505090565b6135d760208286010187612932565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b80820281158282048414176107845761078461309f565b6000816136665761366661309f565b506000190190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906136e99083018461289f565b97965050505050505056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a2646970667358221220ec68dbbbdba273db2b01545b5e76e94bf83437445341aea81c9e91838dcf43f764736f6c6343000813003397667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9290000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361000000000000000000000000381c031baa5995d0cc52386508050ac947780815000000000000000000000000381c031baa5995d0cc52386508050ac94778081500000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000007697066733a2f2f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105275627973636f72655f5363726f6c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105275627973636f72655f5363726f6c6c00000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101f85760003560e01c806391d148541161010d578063ba772d8b116100a0578063d547741f1161006f578063d547741f14610615578063e985e9c514610635578063f242432a1461067e578063f5b541a61461069e578063ffa1ad74146106c057600080fd5b8063ba772d8b14610586578063bd85b039146105a6578063c87b56dd146105d3578063d5391393146105f357600080fd5b8063a217fddf116100dc578063a217fddf146104e0578063a22cb465146104f5578063a3f4df7e14610515578063b93c37701461055657600080fd5b806391d148541461047657806395d89b411461049657806398d5fdca146104ab5780639b3e5573146104c057600080fd5b806336568abe1161019057806355f804b31161015f57806355f804b3146103c55780636834e3a8146103e55780637c2ccc451461041b57806384b0196e1461042e57806391b7f5ed1461045657600080fd5b806336568abe146103345780633ccfd60b146103545780634e1273f4146103695780634f558e791461039657600080fd5b8063162094c4116101cc578063162094c4146102a2578063248a9ca3146102c45780632eb2c2d6146102f45780632f2ff15d1461031457600080fd5b8062fdd58e146101fd57806301ffc9a71461023057806306fdde03146102605780630e89341c14610282575b600080fd5b34801561020957600080fd5b5061021d61021836600461281e565b6106f1565b6040519081526020015b60405180910390f35b34801561023c57600080fd5b5061025061024b36600461285e565b61078a565b6040519015158152602001610227565b34801561026c57600080fd5b50610275610795565b60405161022791906128cb565b34801561028e57600080fd5b5061027561029d3660046128de565b610823565b3480156102ae57600080fd5b506102c26102bd3660046129d1565b61082e565b005b3480156102d057600080fd5b5061021d6102df3660046128de565b60009081526005602052604090206001015490565b34801561030057600080fd5b506102c261030f366004612aab565b610895565b34801561032057600080fd5b506102c261032f366004612b54565b6108e1565b34801561034057600080fd5b506102c261034f366004612b54565b61090b565b34801561036057600080fd5b506102c2610989565b34801561037557600080fd5b50610389610384366004612b80565b610aa9565b6040516102279190612c7b565b3480156103a257600080fd5b506102506103b13660046128de565b600090815260066020526040902054151590565b3480156103d157600080fd5b506102c26103e0366004612c8e565b610bd2565b3480156103f157600080fd5b5061021d610400366004612cca565b6001600160a01b03166000908152600e602052604090205490565b6102c2610429366004612d26565b610c35565b34801561043a57600080fd5b50610443610ee4565b6040516102279796959493929190612ddb565b34801561046257600080fd5b506102c26104713660046128de565b610f6d565b34801561048257600080fd5b50610250610491366004612b54565b610fc1565b3480156104a257600080fd5b50610275610fec565b3480156104b757600080fd5b50600a5461021d565b3480156104cc57600080fd5b506102c26104db366004612e5b565b610ff9565b3480156104ec57600080fd5b5061021d600081565b34801561050157600080fd5b506102c2610510366004612e7e565b61105e565b34801561052157600080fd5b5061027560405180604001604052806015815260200174149d589e5cd8dbdc9957d058da1a595d995b595b9d605a1b81525081565b34801561056257600080fd5b506102506105713660046128de565b6000908152600d602052604090205460ff1690565b34801561059257600080fd5b506102c26105a1366004612eec565b611069565b3480156105b257600080fd5b5061021d6105c13660046128de565b60009081526006602052604090205490565b3480156105df57600080fd5b506102756105ee3660046128de565b611160565b3480156105ff57600080fd5b5061021d60008051602061371583398151915281565b34801561062157600080fd5b506102c2610630366004612b54565b61116b565b34801561064157600080fd5b50610250610650366004612f57565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561068a57600080fd5b506102c2610699366004612f81565b611190565b3480156106aa57600080fd5b5061021d6000805160206136f583398151915281565b3480156106cc57600080fd5b5061027560405180604001604052806005815260200164302e302e3160d81b81525081565b60006001600160a01b0383166107615760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b6000610784826111d5565b600b80546107a290612fe5565b80601f01602080910402602001604051908101604052809291908181526020018280546107ce90612fe5565b801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b505050505081565b6060610784826111fa565b600080516020613715833981519152610846816112da565b61085083836112e7565b8160405161085e919061301f565b6040519081900381209084907fda84ca2183491f179a603e877b2cb058e42195041c2b9c53d746427e519a34df90600090a3505050565b6001600160a01b0385163314806108b157506108b18533610650565b6108cd5760405162461bcd60e51b81526004016107589061303b565b6108da8585858585611344565b5050505050565b6000828152600560205260409020600101546108fc816112da565b61090683836114e6565b505050565b6001600160a01b038116331461097b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610758565b610985828261156c565b5050565b6000610994816112da565b47806109e25760405162461bcd60e51b815260206004820152601760248201527f5a65726f20616d6f756e7420746f2077697468647261770000000000000000006044820152606401610758565b604051600090339083908381818185875af1925050503d8060008114610a24576040519150601f19603f3d011682016040523d82523d6000602084013e610a29565b606091505b5050905080610a715760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610758565b6040518281527f11e9d9f7a772129e26cb0560945658c96b41c42ac6712d233e20c894bfcd00fd9060200160405180910390a1505050565b60608151835114610b0e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610758565b600083516001600160401b03811115610b2957610b296128f7565b604051908082528060200260200182016040528015610b52578160200160208202803683370190505b50905060005b8451811015610bca57610b9d858281518110610b7657610b76613089565b6020026020010151858381518110610b9057610b90613089565b60200260200101516106f1565b828281518110610baf57610baf613089565b6020908102919091010152610bc3816130b5565b9050610b58565b509392505050565b6000805160206136f5833981519152610bea816112da565b610bf3826115d3565b81604051610c01919061301f565b604051908190038120907ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f690600090a25050565b610c3d6115df565b60018360400151511015610c855760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204e46542069647360881b6044820152606401610758565b600a543414610ccd5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81c185e5b595b9d08185b5bdd5b9d60621b6044820152606401610758565b6000610d927f66fe4d8b6c8e0542c70e2a244bf04681bb936b001f1be0f079a80e77158a847433600e6000336001600160a01b03166001600160a01b03168152602001908152602001600020548760400151604051602001610d2f91906130ce565b60405160208183030381529060405280519060200120604051602001610d7794939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120611638565b9050610deb600080516020613715833981519152610de68386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061166592505050565b611681565b83516001600160a01b03166000908152600e60205260408120805460019290610e15908490613104565b909155505060408401515160011015610e4f57610e4a84600001518560400151604051806020016040528060008152506116da565b610e8b565b610e8b84600001518560400151600081518110610e6e57610e6e613089565b6020026020010151604051806020016040528060008152506117ad565b836020015184600001516001600160a01b03167fff0a1dc048ef1a5e9e2845c6bb6cafd8b8531f3cb15368f4a708dec7d7bc789f8660400151604051610ed19190612c7b565b60405180910390a3506109066001600955565b600060608082808083610f187f5275627973636f72655f416368696576656d656e74000000000000000000001560036117e1565b610f437f302e302e3100000000000000000000000000000000000000000000000000000560046117e1565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6000805160206136f5833981519152610f85816112da565b600a8290556040518281527f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe09060200160405180910390a15050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600c80546107a290612fe5565b6000805160206136f5833981519152611011816112da565b6000838152600d6020526040808220805460ff19168515159081179091559051909185917f784afb92b74f2c9ccd3cb1b9697580a90fadab59d6640bbb915d1637bfbbf0089190a3505050565b61098533838361188c565b600080516020613715833981519152611081816112da565b8382146110c15760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b6044820152606401610758565b60005b84811015611158576111468686838181106110e1576110e1613089565b905060200201358585848181106110fa576110fa613089565b905060200281019061110c9190613117565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061082e92505050565b80611150816130b5565b9150506110c4565b505050505050565b606061078482610823565b600082815260056020526040902060010154611186816112da565b610906838361156c565b6001600160a01b0385163314806111ac57506111ac8533610650565b6111c85760405162461bcd60e51b81526004016107589061303b565b6108da858585858561196c565b60006001600160e01b03198216637965db0b60e01b1480610784575061078482611aa4565b60008181526008602052604081208054606092919061121890612fe5565b80601f016020809104026020016040519081016040528092919081815260200182805461124490612fe5565b80156112915780601f1061126657610100808354040283529160200191611291565b820191906000526020600020905b81548152906001019060200180831161127457829003601f168201915b5050505050905060008151116112af576112aa83611af4565b6112d3565b6007816040516020016112c392919061315d565b6040516020818303038152906040525b9392505050565b6112e48133611681565b50565b60008281526008602052604090206112ff828261322a565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61132b84610823565b60405161133891906128cb565b60405180910390a25050565b81518351146113655760405162461bcd60e51b8152600401610758906132e9565b6001600160a01b03841661138b5760405162461bcd60e51b815260040161075890613331565b3361139a818787878787611b88565b60005b84518110156114805760008582815181106113ba576113ba613089565b6020026020010151905060008583815181106113d8576113d8613089565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156114285760405162461bcd60e51b815260040161075890613376565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611465908490613104565b9250508190555050505080611479906130b5565b905061139d565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516114d09291906133c0565b60405180910390a4611158818787878787611c4b565b6114f08282610fc1565b6109855760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115283390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115768282610fc1565b156109855760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6007610985828261322a565b6002600954036116315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610758565b6002600955565b6000610784611645611daf565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060006116748585611ee2565b91509150610bca81611f27565b61168b8282610fc1565b6109855761169881612071565b6116a3836020612083565b6040516020016116b49291906133ee565b60408051601f198184030181529082905262461bcd60e51b8252610758916004016128cb565b600082516001600160401b038111156116f5576116f56128f7565b60405190808252806020026020018201604052801561171e578160200160208202803683370190505b50905060005b83518160ff16101561179a5761174985858360ff1681518110610b9057610b90613089565b156117665760405162461bcd60e51b815260040161075890613463565b6001828260ff168151811061177d5761177d613089565b602090810291909101015280611792816134a4565b915050611724565b506117a78484838561221e565b50505050565b6117b783836106f1565b156117d45760405162461bcd60e51b815260040161075890613463565b6109068383600184612378565b606060ff83146117fb576117f483612458565b9050610784565b81805461180790612fe5565b80601f016020809104026020016040519081016040528092919081815260200182805461183390612fe5565b80156118805780601f1061185557610100808354040283529160200191611880565b820191906000526020600020905b81548152906001019060200180831161186357829003601f168201915b50505050509050610784565b816001600160a01b0316836001600160a01b0316036118ff5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610758565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166119925760405162461bcd60e51b815260040161075890613331565b33600061199e85612497565b905060006119ab85612497565b90506119bb838989858589611b88565b6000868152602081815260408083206001600160a01b038c168452909152902054858110156119fc5760405162461bcd60e51b815260040161075890613376565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290611a39908490613104565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611a99848a8a8a8a8a6124e2565b505050505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480611ad557506001600160e01b031982166303a24d0760e21b145b8061078457506301ffc9a760e01b6001600160e01b0319831614610784565b606060028054611b0390612fe5565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2f90612fe5565b8015611b7c5780601f10611b5157610100808354040283529160200191611b7c565b820191906000526020600020905b815481529060010190602001808311611b5f57829003601f168201915b50505050509050919050565b60005b8351811015611c3c57600d6000858381518110611baa57611baa613089565b60209081029190910181015182528101919091526040016000205460ff16158015611bdd57506001600160a01b03861615155b15611c2a5760405162461bcd60e51b815260206004820152601760248201527f5468697320746f6b656e206f6e6c7920666f7220796f750000000000000000006044820152606401610758565b80611c34816130b5565b915050611b8b565b5061115886868686868661259d565b6001600160a01b0384163b156111585760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611c8f90899089908890889088906004016134c3565b6020604051808303816000875af1925050508015611cca575060408051601f3d908101601f19168201909252611cc791810190613521565b60015b611d7657611cd661353e565b806308c379a003611d0f5750611cea613559565b80611cf55750611d11565b8060405162461bcd60e51b815260040161075891906128cb565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610758565b6001600160e01b0319811663bc197c8160e01b14611da65760405162461bcd60e51b8152600401610758906135e2565b50505050505050565b6000306001600160a01b037f000000000000000000000000dc3d8318fbaec2de49281843f5bba22e7833814616148015611e0857507f000000000000000000000000000000000000000000000000000000000008275046145b15611e3257507f3652dc7f04f5384885b68577a366a50edd8113ccb7ab2dc101850260788e288f90565b611eda604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f2d2ade98d6bb8fe401ca155fda7789f3500abdfa8c04ae14de3ff34b1cd8bb25918101919091527fae209a0b48f21c054280f2455d32cf309387644879d9acbd8ffc19916381188560608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b90565b6000808251604103611f185760208301516040840151606085015160001a611f0c87828585612716565b94509450505050611f20565b506000905060025b9250929050565b6000816004811115611f3b57611f3b61362a565b03611f435750565b6001816004811115611f5757611f5761362a565b03611fa45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610758565b6002816004811115611fb857611fb861362a565b036120055760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610758565b60038160048111156120195761201961362a565b036112e45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610758565b60606107846001600160a01b03831660145b60606000612092836002613640565b61209d906002613104565b6001600160401b038111156120b4576120b46128f7565b6040519080825280601f01601f1916602001820160405280156120de576020820181803683370190505b509050600360fc1b816000815181106120f9576120f9613089565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061212857612128613089565b60200101906001600160f81b031916908160001a905350600061214c846002613640565b612157906001613104565b90505b60018111156121cf576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061218b5761218b613089565b1a60f81b8282815181106121a1576121a1613089565b60200101906001600160f81b031916908160001a90535060049490941c936121c881613657565b905061215a565b5083156112d35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610758565b6001600160a01b0384166122445760405162461bcd60e51b81526004016107589061366e565b81518351146122655760405162461bcd60e51b8152600401610758906132e9565b3361227581600087878787611b88565b60005b84518110156123105783818151811061229357612293613089565b60200260200101516000808784815181106122b0576122b0613089565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546122f89190613104565b90915550819050612308816130b5565b915050612278565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516123619291906133c0565b60405180910390a46108da81600087878787611c4b565b6001600160a01b03841661239e5760405162461bcd60e51b81526004016107589061366e565b3360006123aa85612497565b905060006123b785612497565b90506123c883600089858589611b88565b6000868152602081815260408083206001600160a01b038b168452909152812080548792906123f8908490613104565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611da6836000898989896124e2565b60606000612465836127da565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106124d1576124d1613089565b602090810291909101015292915050565b6001600160a01b0384163b156111585760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061252690899089908890889088906004016136af565b6020604051808303816000875af1925050508015612561575060408051601f3d908101601f1916820190925261255e91810190613521565b60015b61256d57611cd661353e565b6001600160e01b0319811663f23a6e6160e01b14611da65760405162461bcd60e51b8152600401610758906135e2565b6001600160a01b0385166126245760005b8351811015612622578281815181106125c9576125c9613089565b6020026020010151600660008684815181106125e7576125e7613089565b60200260200101518152602001908152602001600020600082825461260c9190613104565b9091555061261b9050816130b5565b90506125ae565b505b6001600160a01b0384166111585760005b8351811015611da657600084828151811061265257612652613089565b60200260200101519050600084838151811061267057612670613089565b60200260200101519050600060066000848152602001908152602001600020549050818110156126f35760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608401610758565b6000928352600660205260409092209103905561270f816130b5565b9050612635565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561274d57506000905060036127d1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156127a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166127ca576000600192509250506127d1565b9150600090505b94509492505050565b600060ff8216601f81111561078457604051632cd44ac360e21b815260040160405180910390fd5b80356001600160a01b038116811461281957600080fd5b919050565b6000806040838503121561283157600080fd5b61283a83612802565b946020939093013593505050565b6001600160e01b0319811681146112e457600080fd5b60006020828403121561287057600080fd5b81356112d381612848565b60005b8381101561289657818101518382015260200161287e565b50506000910152565b600081518084526128b781602086016020860161287b565b601f01601f19169290920160200192915050565b6020815260006112d3602083018461289f565b6000602082840312156128f057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b606081018181106001600160401b038211171561292c5761292c6128f7565b60405250565b601f8201601f191681016001600160401b0381118282101715612957576129576128f7565b6040525050565b600082601f83011261296f57600080fd5b81356001600160401b03811115612988576129886128f7565b60405161299f601f8301601f191660200182612932565b8181528460208386010111156129b457600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156129e457600080fd5b8235915060208301356001600160401b03811115612a0157600080fd5b612a0d8582860161295e565b9150509250929050565b60006001600160401b03821115612a3057612a306128f7565b5060051b60200190565b600082601f830112612a4b57600080fd5b81356020612a5882612a17565b604051612a658282612932565b83815260059390931b8501820192828101915086841115612a8557600080fd5b8286015b84811015612aa05780358352918301918301612a89565b509695505050505050565b600080600080600060a08688031215612ac357600080fd5b612acc86612802565b9450612ada60208701612802565b935060408601356001600160401b0380821115612af657600080fd5b612b0289838a01612a3a565b94506060880135915080821115612b1857600080fd5b612b2489838a01612a3a565b93506080880135915080821115612b3a57600080fd5b50612b478882890161295e565b9150509295509295909350565b60008060408385031215612b6757600080fd5b82359150612b7760208401612802565b90509250929050565b60008060408385031215612b9357600080fd5b82356001600160401b0380821115612baa57600080fd5b818501915085601f830112612bbe57600080fd5b81356020612bcb82612a17565b604051612bd88282612932565b83815260059390931b8501820192828101915089841115612bf857600080fd5b948201945b83861015612c1d57612c0e86612802565b82529482019490820190612bfd565b96505086013592505080821115612c3357600080fd5b50612a0d85828601612a3a565b600081518084526020808501945080840160005b83811015612c7057815187529582019590820190600101612c54565b509495945050505050565b6020815260006112d36020830184612c40565b600060208284031215612ca057600080fd5b81356001600160401b03811115612cb657600080fd5b612cc28482850161295e565b949350505050565b600060208284031215612cdc57600080fd5b6112d382612802565b60008083601f840112612cf757600080fd5b5081356001600160401b03811115612d0e57600080fd5b602083019150836020828501011115611f2057600080fd5b600080600060408486031215612d3b57600080fd5b83356001600160401b0380821115612d5257600080fd5b9085019060608288031215612d6657600080fd5b604051612d728161290d565b612d7b83612802565b815260208301356020820152604083013582811115612d9957600080fd5b612da589828601612a3a565b60408301525094506020860135915080821115612dc157600080fd5b50612dce86828701612ce5565b9497909650939450505050565b60ff60f81b8816815260e060208201526000612dfa60e083018961289f565b8281036040840152612e0c818961289f565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050612e3d8185612c40565b9a9950505050505050505050565b8035801515811461281957600080fd5b60008060408385031215612e6e57600080fd5b82359150612b7760208401612e4b565b60008060408385031215612e9157600080fd5b612e9a83612802565b9150612b7760208401612e4b565b60008083601f840112612eba57600080fd5b5081356001600160401b03811115612ed157600080fd5b6020830191508360208260051b8501011115611f2057600080fd5b60008060008060408587031215612f0257600080fd5b84356001600160401b0380821115612f1957600080fd5b612f2588838901612ea8565b90965094506020870135915080821115612f3e57600080fd5b50612f4b87828801612ea8565b95989497509550505050565b60008060408385031215612f6a57600080fd5b612f7383612802565b9150612b7760208401612802565b600080600080600060a08688031215612f9957600080fd5b612fa286612802565b9450612fb060208701612802565b9350604086013592506060860135915060808601356001600160401b03811115612fd957600080fd5b612b478882890161295e565b600181811c90821680612ff957607f821691505b60208210810361301957634e487b7160e01b600052602260045260246000fd5b50919050565b6000825161303181846020870161287b565b9190910192915050565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016130c7576130c761309f565b5060010190565b815160009082906020808601845b838110156130f8578151855293820193908201906001016130dc565b50929695505050505050565b808201808211156107845761078461309f565b6000808335601e1984360301811261312e57600080fd5b8301803591506001600160401b0382111561314857600080fd5b602001915036819003821315611f2057600080fd5b600080845461316b81612fe5565b600182811680156131835760018114613198576131c7565b60ff19841687528215158302870194506131c7565b8860005260208060002060005b858110156131be5781548a8201529084019082016131a5565b50505082870194505b5050505083516131db81836020880161287b565b01949350505050565b601f82111561090657600081815260208120601f850160051c8101602086101561320b5750805b601f850160051c820191505b8181101561115857828155600101613217565b81516001600160401b03811115613243576132436128f7565b613257816132518454612fe5565b846131e4565b602080601f83116001811461328c57600084156132745750858301515b600019600386901b1c1916600185901b178555611158565b600085815260208120601f198616915b828110156132bb5788860151825594840194600190910190840161329c565b50858210156132d95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006133d36040830185612c40565b82810360208401526133e58185612c40565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161342681601785016020880161287b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161345781602884016020880161287b565b01602801949350505050565b60208082526021908201527f596f7520616c72656164792068617665207468697320616368696576656d656e6040820152601d60fa1b606082015260800190565b600060ff821660ff81036134ba576134ba61309f565b60010192915050565b6001600160a01b0386811682528516602082015260a0604082018190526000906134ef90830186612c40565b82810360608401526135018186612c40565b90508281036080840152613515818561289f565b98975050505050505050565b60006020828403121561353357600080fd5b81516112d381612848565b600060033d1115611edf5760046000803e5060005160e01c90565b600060443d10156135675790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561359657505050505090565b82850191508151818111156135ae5750505050505090565b843d87010160208285010111156135c85750505050505090565b6135d760208286010187612932565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b80820281158282048414176107845761078461309f565b6000816136665761366661309f565b506000190190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906136e99083018461289f565b97965050505050505056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a2646970667358221220ec68dbbbdba273db2b01545b5e76e94bf83437445341aea81c9e91838dcf43f764736f6c63430008130033

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

0000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361000000000000000000000000381c031baa5995d0cc52386508050ac947780815000000000000000000000000381c031baa5995d0cc52386508050ac94778081500000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000007697066733a2f2f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105275627973636f72655f5363726f6c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105275627973636f72655f5363726f6c6c00000000000000000000000000000000

-----Decoded View---------------
Arg [0] : admin (address): 0x0d0D5Ff3cFeF8B7B2b1cAC6B6C27Fd0846c09361
Arg [1] : operator (address): 0x381c031bAA5995D0Cc52386508050Ac947780815
Arg [2] : minter (address): 0x381c031bAA5995D0Cc52386508050Ac947780815
Arg [3] : baseURI (string): ipfs://
Arg [4] : _name (string): Rubyscore_Scroll
Arg [5] : _symbol (string): Rubyscore_Scroll

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361
Arg [1] : 000000000000000000000000381c031baa5995d0cc52386508050ac947780815
Arg [2] : 000000000000000000000000381c031baa5995d0cc52386508050ac947780815
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [7] : 697066733a2f2f00000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [9] : 5275627973636f72655f5363726f6c6c00000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [11] : 5275627973636f72655f5363726f6c6c00000000000000000000000000000000


[ Download: CSV Export  ]
[ Download: CSV Export  ]

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