ETH Price: $2,668.57 (-2.75%)

Token

Blot (BLOT)
 

Overview

Max Total Supply

211 BLOT

Holders

111

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
25 BLOT
0xb6954f25c1c694093262528e330b31a78c750693
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Blot

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 29 : Blot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/*
Blot: on-chain psychodiagnostic ink blots {ERC721}
*/

import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721Royalty} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Base64} from "@openzeppelin/contracts/utils/Base64.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";

import "./libraries/Artwork.sol";
import "./interfaces/IBlot.sol";
import "./interfaces/IBlotERC20.sol";
import "./libraries/Util.sol";

/**
 @title Blot
*/

contract Blot is IBlot, ERC721, ERC721Royalty, AccessControl, ReentrancyGuard {

    using Address for address;
    using Strings for uint256;
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
    uint256 private constant ERC20_BONUS_LIMIT = 10000;
    uint256 private constant ERC20_BONUS_MIN = 1000;
    uint256 private constant ERC20_BONUS_MAX = 10000;
    uint256 private constant ERC20_BONUS_STEP_INTERVAL = 500;
    uint256 private constant ERC20_BONUS_STEP_DECREASE = 1000;
    uint256 private constant MINT_MAX = 25;
    uint256 public mintState;
    uint256[4] public rates;
    string private _contractMetadata;
    string private _externalDomain;
    address public ERC20Contract;
    address public treasury;
    Blots private _blots;

    constructor(
        address _admin,
        address _treasury,
        address _ERC20Contract,
        uint256[4] memory _rates,
        string memory _initialContractMetadata,
        string memory _initialExternalDomain
    ) ERC721("Blot", "BLOT") {
        _grantRole(DEFAULT_ADMIN_ROLE, _admin);
        _grantRole(MINTER_ROLE, _admin);
        _setDefaultRoyalty(_treasury, 500);
        _blots.idCounter = 1;
        _blots.currentEpoch = 1;
        _contractMetadata = _initialContractMetadata;
        _externalDomain = _initialExternalDomain;
        ERC20Contract = _ERC20Contract;
        treasury = _treasury;
        rates = _rates;
    }

    function contractURI() external view returns (string memory) {
        return string.concat('data:application/json;base64,', Base64.encode(bytes(_contractMetadata)));
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (_ownerOf(tokenId) == address(0)) revert TokenNotFound();
        return string.concat('data:application/json;base64,', Base64.encode(bytes(_getMetadata(tokenId))));
    }

    function totalSupply() public view returns (uint256) {
        return _blots.supplyCounter;
    }

    /* actions */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

    /// @notice Mint a Blot
    function mint(uint256 quantity) external payable nonReentrant {
        if (mintState != uint256(MintState.Active)) revert MintUnavailable();
        if (quantity < 1 || quantity > MINT_MAX) revert InvalidQuantity();
        if (msg.value < rates[uint256(RateType.Mint)] * quantity) revert InsufficientValue();

        resolveEpoch();
        _mintBlot(_msgSender(), quantity);
        uint256 bonus = _blots.idCounter <= ERC20_BONUS_LIMIT ? _getBonusValue(_blots.idCounter - quantity) : 0;

        if (ERC20Contract != address(0) && bonus > 0) {
            IBlotERC20 BlotERC20 = IBlotERC20(ERC20Contract);
            uint256 valueDecimals = quantity * bonus * 10 ** BlotERC20.decimals();

            if (
                BlotERC20.balanceOf(BlotERC20.treasury()) > valueDecimals
                && BlotERC20.hasRole(BlotERC20.TRANSFER_ROLE(), address(this))
            ) {
                BlotERC20.transferFromTreasury(_msgSender(), valueDecimals);
            }
        }
    }

    /// @notice Exchange ERC20 for a Blot
    function exchangeMint(uint256 quantity) external nonReentrant {
        if (mintState != uint256(MintState.Active)) revert MintUnavailable();
        if (quantity < 1 || quantity > MINT_MAX) revert InvalidQuantity();
        if (ERC20Contract == address(0)) revert MintUnavailable();
        IBlotERC20 BlotERC20 = IBlotERC20(ERC20Contract);
        uint256 rate = rates[uint256(RateType.ExchangeMint)];
        uint256 valueDecimals = quantity * rate * 10 ** BlotERC20.decimals();
        if (BlotERC20.balanceOf(_msgSender()) < valueDecimals) revert InsufficientValue();
        resolveEpoch();
        _mintBlot(_msgSender(), quantity);
        BlotERC20.utilityBurn(_msgSender(), valueDecimals);
    }

    /// @notice Exchange a Blot for ERC20
    function exchangeBurn(uint256 tokenId) external nonReentrant {
        if (!_isAuthorized(ownerOf(tokenId), _msgSender(), tokenId)) revert Unauthorized();
        if (ERC20Contract == address(0)) revert ExchangeUnavailable();
        _burn(tokenId);
        _blots.supplyCounter -= 1;
        emit Burned(tokenId);

        IBlotERC20 BlotERC20 = IBlotERC20(ERC20Contract);
        uint256 rate = rates[uint256(RateType.ExchangeBurn)];
        uint256 valueDecimals = rate * 10 ** BlotERC20.decimals();
        if (BlotERC20.balanceOf(BlotERC20.treasury()) < valueDecimals) revert ExchangeUnavailable();
        BlotERC20.transferFromTreasury(_msgSender(), valueDecimals);
    }

    /// @notice Burn a Blot and ERC20 for a Blot
    function recycle(uint256 tokenId) external nonReentrant {
        if (!_isAuthorized(ownerOf(tokenId), _msgSender(), tokenId)) revert Unauthorized();
        if (ERC20Contract == address(0)) revert RecycleUnavailable();
        _burn(tokenId);
        _blots.supplyCounter -= 1;
        emit Burned(tokenId);
        resolveEpoch();
        _mintBlot(_msgSender(), 1);
        emit Recycled(tokenId, _blots.idCounter);

        IBlotERC20 BlotERC20 = IBlotERC20(ERC20Contract);
        uint256 rate = rates[uint256(RateType.Recycle)];
        uint256 valueDecimals = rate * 10 ** BlotERC20.decimals();
        if (BlotERC20.balanceOf(_msgSender()) < valueDecimals) revert InsufficientValue();
        BlotERC20.utilityBurn(_msgSender(), valueDecimals);
    }

    function resolveEpoch() public {
        while (true) {
            Epoch storage currentEpoch = _blots.epochs[_blots.currentEpoch];

            if (!currentEpoch.isCommitted) {
                currentEpoch.revealBlock = uint64(block.number + 25);
                currentEpoch.isCommitted = true;
                return;
            }

            if (!currentEpoch.isRevealed) {
                if (block.number <= currentEpoch.revealBlock) {
                    return;
                }

                if (block.number > currentEpoch.revealBlock + 256) {
                    currentEpoch.revealBlock = uint64(block.number + 1);
                    return;
                }

                currentEpoch.randomness = uint128(uint256(keccak256(abi.encodePacked(blockhash(currentEpoch.revealBlock), block.prevrandao))) % (2 ** 128 - 1));
                currentEpoch.isRevealed = true;
                emit NewEpoch(_blots.currentEpoch, currentEpoch.revealBlock);
                _blots.currentEpoch++;
                _blots.epochs[_blots.currentEpoch].paletteCount = _blots.palettes.length;
            } else {
                return;
            }
        }
    }

    /* private */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

    function _getPalette(Blot memory blot) private view returns (Color memory background, Color memory foreground) {
        uint256 paletteCount = _blots.epochs[blot.epoch].paletteCount;
        if (paletteCount == 0) revert PalettesNotFound();
        uint256 index = uint256(keccak256(abi.encodePacked(blot.seed))) % paletteCount;
        Palette storage palette = _blots.palettes[index];
        return (palette.ink, palette.paper);
    }

    function _generateImage(uint256 tokenId) private view returns (string memory) {
        Blot memory blot = _getBlot(tokenId);

        if (blot.isRevealed) {
            (Color memory ink, Color memory paper) = _getPalette(blot);
            return Artwork.generate(blot.seed, paper.hexValue, ink.hexValue);
        }
        return Artwork.generateUnrevealed(blot.seed, tokenId);
    }

    function _getAttributes(uint256 tokenId) private view returns (string memory) {
        Blot memory blot = _getBlot(tokenId);

        if (!blot.isRevealed) {
            return string.concat('[{"trait_type":"Revealed","value":false}]');
        }

        (Color memory ink, Color memory paper) = _getPalette(blot);
        uint256 f = uint8(blot.seed % 2 + 1);

        return string.concat(
            '[{"trait_type":"Ink","value":"', ink.name, '"}',
            ',{"trait_type":"Paper","value":"', paper.name, '"},{"trait_type":"Fold","value":"',
            f == 2 ? 'Double' : 'Single', '"}]'
        );
    }

    function _getMetadata(uint256 tokenId) private view returns (string memory) {
        Blot memory blot = _getBlot(tokenId);
        (Color memory ink, Color memory paper) = _getPalette(blot);

        if (!blot.isRevealed) {
            return string.concat(
                '{"name":"BLOT #', tokenId.toString(),
                '","image":"data:image/svg+xml;base64,', _generateBase64Image(tokenId),
                '","epoch":', blot.epoch.toString(),
                ',"attributes":',_getAttributes(tokenId),
                '}'
            );
        }

        return string.concat(
            '{"name":"BLOT #', tokenId.toString(),
            '","description":"', ink.name, ' on ', paper.name,
            '","external_url":"', _externalDomain, '/blots/', tokenId.toString(),
            '","seed":"', blot.seed.toString(),
            '","image":"data:image/svg+xml;base64,', _generateBase64Image(tokenId),
            '","epoch":', blot.epoch.toString(),
            ',"attributes":',_getAttributes(tokenId),
            '}'
        );
    }

    function _getBlot(uint256 tokenId) private view returns (Blot memory blot) {
        Blot storage bs = _blots.all[tokenId];
        uint128 randomness = _blots.epochs[bs.epoch].randomness;
        blot.epoch = bs.epoch;
        blot.isRevealed = randomness > 0;

        if (blot.isRevealed) {
            blot.seed = bs.seed;
        }

        return blot;
    }

    function _generateBase64Image(uint256 tokenId) private view returns (string memory) {
        return Base64.encode(bytes(_generateImage(tokenId)));
    }

    function _generateSeed() private view returns (uint256) {
        bytes32 hashResult = keccak256(abi.encodePacked(block.timestamp, block.prevrandao, _msgSender(), _blots.idCounter));
        return uint256(hashResult);
    }

    function _getBonusValue(uint256 tokenId) private pure returns (uint256) {
        uint256 steps = tokenId / ERC20_BONUS_STEP_INTERVAL;
        uint256 calculatedBonus = ERC20_BONUS_MAX - (steps * ERC20_BONUS_STEP_DECREASE);
        return calculatedBonus > ERC20_BONUS_MIN ? calculatedBonus : ERC20_BONUS_MIN;
    }

    function _mintBlot(address receiver, uint256 quantity) private {
        for (uint256 i = 0; i < quantity; i++) {
            uint256 tokenId = _blots.idCounter;
            Blot storage bs = _blots.all[tokenId];
            bs.epoch = uint32(_blots.currentEpoch);
            bs.seed = _generateSeed();
            bs.mintTime = block.timestamp;
            _safeMint(receiver, tokenId);
            _blots.supplyCounter += 1;
            _blots.idCounter += 1;
            emit Minted(tokenId);
        }
    }

    /* onlyRole */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

    function addColors(string[] calldata names, bytes3[] calldata hexValues) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (names.length != hexValues.length) revert ArrayMismatch();

        for (uint256 i = 0; i < names.length; i++) {
            bytes3 hexValue = hexValues[i];
            if (_blots.colors[hexValue].hexValue != bytes3(0)) revert ColorDuplication();
            _blots.colors[hexValue] = Color(names[i], hexValue);
        }
    }

    function addPalettes(bytes3[] calldata paperColors, bytes3[] calldata inkColors) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (paperColors.length != inkColors.length) revert ArrayMismatch();

        for (uint256 i = 0; i < paperColors.length; i++) {
            bytes3 inkColor = inkColors[i];
            bytes3 paperColor = paperColors[i];
            Color memory ink = _blots.colors[inkColor];
            Color memory paper = _blots.colors[paperColor];
            if (ink.hexValue == bytes3(0) || paper.hexValue == bytes3(0)) revert ColorNotFound();
            _blots.palettes.push(Palette(ink, paper));
        }

        _blots.epochs[_blots.currentEpoch].paletteCount = _blots.palettes.length;
        resolveEpoch();
    }

    function airdrop(address[] calldata recipients, uint256 quantity) external nonReentrant onlyRole(MINTER_ROLE) {
        if (recipients.length == 0) revert InvalidRecipients();
        if (quantity < 1) revert InvalidQuantity();

        for (uint256 i = 0; i < recipients.length; i++) {
            address recipient = recipients[i];
            if (recipient == address(0)) revert InvalidAddress();
            _mintBlot(recipient, quantity);
        }

        resolveEpoch();
    }

    function burn(uint256 tokenId) external nonReentrant onlyRole(BURNER_ROLE) {
        _burn(tokenId);
        _blots.supplyCounter -= 1;
        emit Burned(tokenId);
    }

    function setMetadata(string calldata contractMetadata, string calldata domain) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _contractMetadata = contractMetadata;
        _externalDomain = domain;
    }

    function setERC20Contract(address contractAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
        ERC20Contract = contractAddress;
    }

    function setMintState(uint256 state) external onlyRole(DEFAULT_ADMIN_ROLE) {
        mintState = state;
    }

    function setRates(uint256[4] calldata rates_) external onlyRole(DEFAULT_ADMIN_ROLE) {
        rates = rates_;
    }

    function setRoyalty(address receiver, uint96 basisPoints) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _setDefaultRoyalty(receiver, basisPoints);
    }

    function setTreasury(address treasury_) external onlyRole(DEFAULT_ADMIN_ROLE) {
        treasury = treasury_;
    }

    function withdraw(uint256 value) external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) {
        if (address(this).balance < value) revert InsufficientValue();
        Address.sendValue(payable(treasury), value);
    }

    /* override */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Royalty, AccessControl) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

}

File 2 of 29 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../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 account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    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 returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @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 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 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 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 `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

File 3 of 29 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @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.
     */
    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. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    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 `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

File 4 of 29 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 5 of 29 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     *
     * NOTE: ERC-2981 allows setting the royalty to 100% of the price. In that case all the price would be sent to the
     * royalty receiver and 0 tokens to the seller. Contracts dealing with royalty should consider empty transfers.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

File 6 of 29 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;

import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) public view virtual returns (address receiver, uint256 amount) {
        RoyaltyInfo storage _royaltyInfo = _tokenRoyaltyInfo[tokenId];
        address royaltyReceiver = _royaltyInfo.receiver;
        uint96 royaltyFraction = _royaltyInfo.royaltyFraction;

        if (royaltyReceiver == address(0)) {
            royaltyReceiver = _defaultRoyaltyInfo.receiver;
            royaltyFraction = _defaultRoyaltyInfo.royaltyFraction;
        }

        uint256 royaltyAmount = (salePrice * royaltyFraction) / _feeDenominator();

        return (royaltyReceiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 7 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 8 of 29 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "./IERC721.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {ERC721Utils} from "./utils/ERC721Utils.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC-721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    mapping(uint256 tokenId => address) private _owners;

    mapping(address owner => uint256) private _balances;

    mapping(uint256 tokenId => address) private _tokenApprovals;

    mapping(address owner => mapping(address operator => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual returns (uint256) {
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
        _requireOwned(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual {
        _approve(to, tokenId, _msgSender());
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual returns (address) {
        _requireOwned(tokenId);

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC-721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        return _tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if:
     * - `spender` does not have approval from `owner` for `tokenId`.
     * - `spender` does not have approval to manage all of `owner`'s assets.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        unchecked {
            _balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                _balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                _balances[to] += 1;
            }
        }

        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        ERC721Utils.checkOnERC721Received(_msgSender(), address(0), to, tokenId, data);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC-721 standard to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        _tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }
}

File 9 of 29 : ERC721Royalty.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/extensions/ERC721Royalty.sol)

pragma solidity ^0.8.20;

import {ERC721} from "../ERC721.sol";
import {ERC2981} from "../../common/ERC2981.sol";

/**
 * @dev Extension of ERC-721 with the ERC-2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
 * information.
 *
 * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually
 * for specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 */
abstract contract ERC721Royalty is ERC2981, ERC721 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

File 10 of 29 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 11 of 29 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 29 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @title ERC-721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC-721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be
     * reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 13 of 29 : ERC721Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/utils/ERC721Utils.sol)

pragma solidity ^0.8.20;

import {IERC721Receiver} from "../IERC721Receiver.sol";
import {IERC721Errors} from "../../../interfaces/draft-IERC6093.sol";

/**
 * @dev Library that provide common ERC-721 utility functions.
 *
 * See https://eips.ethereum.org/EIPS/eip-721[ERC-721].
 *
 * _Available since v5.1._
 */
library ERC721Utils {
    /**
     * @dev Performs an acceptance check for the provided `operator` by calling {IERC721-onERC721Received}
     * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
     *
     * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
     * Otherwise, the recipient must implement {IERC721Receiver-onERC721Received} and return the acceptance magic value to accept
     * the transfer.
     */
    function checkOnERC721Received(
        address operator,
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(operator, from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    // Token rejected
                    revert IERC721Errors.ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-IERC721Receiver implementer
                    revert IERC721Errors.ERC721InvalidReceiver(to);
                } else {
                    assembly ("memory-safe") {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

File 14 of 29 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

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

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

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

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

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

File 15 of 29 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Base64.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     * See sections 4 and 5 of https://datatracker.ietf.org/doc/html/rfc4648
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    string internal constant _TABLE_URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        return _encode(data, _TABLE, true);
    }

    /**
     * @dev Converts a `bytes` to its Bytes64Url `string` representation.
     * Output is not padded with `=` as specified in https://www.rfc-editor.org/rfc/rfc4648[rfc4648].
     */
    function encodeURL(bytes memory data) internal pure returns (string memory) {
        return _encode(data, _TABLE_URL, false);
    }

    /**
     * @dev Internal table-agnostic conversion
     */
    function _encode(bytes memory data, string memory table, bool withPadding) private pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // If padding is enabled, the final length should be `bytes` data length divided by 3 rounded up and then
        // multiplied by 4 so that it leaves room for padding the last chunk
        // - `data.length + 2`  -> Prepare for division rounding up
        // - `/ 3`              -> Number of 3-bytes chunks (rounded up)
        // - `4 *`              -> 4 characters for each chunk
        // This is equivalent to: 4 * Math.ceil(data.length / 3)
        //
        // If padding is disabled, the final length should be `bytes` data length multiplied by 4/3 rounded up as
        // opposed to when padding is required to fill the last chunk.
        // - `4 * data.length`  -> 4 characters for each chunk
        // - ` + 2`             -> Prepare for division rounding up
        // - `/ 3`              -> Number of 3-bytes chunks (rounded up)
        // This is equivalent to: Math.ceil((4 * data.length) / 3)
        uint256 resultLength = withPadding ? 4 * ((data.length + 2) / 3) : (4 * data.length + 2) / 3;

        string memory result = new string(resultLength);

        assembly ("memory-safe") {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 0x20)
            let dataPtr := data
            let endPtr := add(data, mload(data))

            // In some cases, the last iteration will read bytes after the end of the data. We cache the value, and
            // set it to zero to make sure no dirty bytes are read in that section.
            let afterPtr := add(endPtr, 0x20)
            let afterCache := mload(afterPtr)
            mstore(afterPtr, 0x00)

            // Run over the input, 3 bytes at a time
            for {

            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 byte (24 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F to bitmask the least significant 6 bits.
                // Use this as an index into the lookup table, mload an entire word
                // so the desired character is in the least significant byte, and
                // mstore8 this least significant byte into the result and continue.

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // Reset the value that was cached
            mstore(afterPtr, afterCache)

            if withPadding {
                // When data `bytes` is not exactly 3 bytes long
                // it is padded with `=` characters at the end
                switch mod(mload(data), 3)
                case 1 {
                    mstore8(sub(resultPtr, 1), 0x3d)
                    mstore8(sub(resultPtr, 2), 0x3d)
                }
                case 2 {
                    mstore8(sub(resultPtr, 1), 0x3d)
                }
            }
        }

        return result;
    }
}

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

pragma solidity ^0.8.20;

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

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

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

File 17 of 29 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

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

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

File 18 of 29 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 19 of 29 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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 20 of 29 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an success flag (no overflow).
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
     *
     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
     * one branch when needed, making this function more expensive.
     */
    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            // branchless ternary works because:
            // b ^ (a ^ b) == a
            // b ^ 0 == b
            return b ^ ((a ^ b) * SafeCast.toUint(condition));
        }
    }

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

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return ternary(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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }

        // The following calculation ensures accurate ceiling division without overflow.
        // Since a is non-zero, (a - 1) / b will not overflow.
        // The largest possible result occurs when (a - 1) / b is type(uint256).max,
        // but the largest value we can obtain is type(uint256).max - 1, which happens
        // when a = type(uint256).max and b = 1.
        unchecked {
            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
        }
    }

    /**
     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     *
     * 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²⁵⁶ and mod 2²⁵⁶ - 1, then use
            // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2²⁵⁶ + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                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²⁵⁶. Also prevents denominator == 0.
            if (denominator <= prod1) {
                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_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.

            uint256 twos = denominator & (0 - denominator);
            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²⁵⁶ / 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²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.
            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⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
            inverse *= 2 - denominator * inverse; // inverse mod 2³²
            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶

            // 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²⁵⁶. Since the preconditions guarantee that the outcome is
            // less than 2²⁵⁶, 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;
        }
    }

    /**
     * @dev 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) {
        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
    }

    /**
     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
     *
     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
     *
     * If the input value is not inversible, 0 is returned.
     *
     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
     */
    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
        unchecked {
            if (n == 0) return 0;

            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
            // Used to compute integers x and y such that: ax + ny = gcd(a, n).
            // When the gcd is 1, then the inverse of a modulo n exists and it's x.
            // ax + ny = 1
            // ax = 1 + (-y)n
            // ax ≡ 1 (mod n) # x is the inverse of a modulo n

            // If the remainder is 0 the gcd is n right away.
            uint256 remainder = a % n;
            uint256 gcd = n;

            // Therefore the initial coefficients are:
            // ax + ny = gcd(a, n) = n
            // 0a + 1n = n
            int256 x = 0;
            int256 y = 1;

            while (remainder != 0) {
                uint256 quotient = gcd / remainder;

                (gcd, remainder) = (
                    // The old remainder is the next gcd to try.
                    remainder,
                    // Compute the next remainder.
                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
                    // where gcd is at most n (capped to type(uint256).max)
                    gcd - remainder * quotient
                );

                (x, y) = (
                    // Increment the coefficient of a.
                    y,
                    // Decrement the coefficient of n.
                    // Can overflow, but the result is casted to uint256 so that the
                    // next value of y is "wrapped around" to a value between 0 and n - 1.
                    x - y * int256(quotient)
                );
            }

            if (gcd != 1) return 0; // No inverse exists.
            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
        }
    }

    /**
     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
     *
     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.
     *
     * NOTE: this function does NOT check that `p` is a prime greater than `2`.
     */
    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
        unchecked {
            return Math.modExp(a, p - 2, p);
        }
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
     *
     * Requirements:
     * - modulus can't be zero
     * - underlying staticcall to precompile must succeed
     *
     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
     * sure the chain you're using it on supports the precompiled contract for modular exponentiation
     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly
     * interpreted as 0.
     */
    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
        (bool success, uint256 result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
     * to operate modulo 0 or if the underlying precompile reverted.
     *
     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
     * of a revert, but the result may be incorrectly interpreted as 0.
     */
    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
        if (m == 0) return (false, 0);
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            // | Offset    | Content    | Content (Hex)                                                      |
            // |-----------|------------|--------------------------------------------------------------------|
            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x60:0x7f | value of b | 0x<.............................................................b> |
            // | 0x80:0x9f | value of e | 0x<.............................................................e> |
            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |
            mstore(ptr, 0x20)
            mstore(add(ptr, 0x20), 0x20)
            mstore(add(ptr, 0x40), 0x20)
            mstore(add(ptr, 0x60), b)
            mstore(add(ptr, 0x80), e)
            mstore(add(ptr, 0xa0), m)

            // Given the result < m, it's guaranteed to fit in 32 bytes,
            // so we can use the memory scratch space located at offset 0.
            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
            result := mload(0x00)
        }
    }

    /**
     * @dev Variant of {modExp} that supports inputs of arbitrary length.
     */
    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
        (bool success, bytes memory result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.
     */
    function tryModExp(
        bytes memory b,
        bytes memory e,
        bytes memory m
    ) internal view returns (bool success, bytes memory result) {
        if (_zeroBytes(m)) return (false, new bytes(0));

        uint256 mLen = m.length;

        // Encode call args in result and move the free memory pointer
        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);

        assembly ("memory-safe") {
            let dataPtr := add(result, 0x20)
            // Write result on top of args to avoid allocating extra memory.
            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
            // Overwrite the length.
            // result.length > returndatasize() is guaranteed because returndatasize() == m.length
            mstore(result, mLen)
            // Set the memory pointer after the returned data.
            mstore(0x40, add(dataPtr, mLen))
        }
    }

    /**
     * @dev Returns whether the provided byte array is zero.
     */
    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
        for (uint256 i = 0; i < byteArray.length; ++i) {
            if (byteArray[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only
     * using integer operations.
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        unchecked {
            // Take care of easy edge cases when a == 0 or a == 1
            if (a <= 1) {
                return a;
            }

            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
            // the current value as `ε_n = | x_n - sqrt(a) |`.
            //
            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
            // bigger than any uint256.
            //
            // By noticing that
            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
            // to the msb function.
            uint256 aa = a;
            uint256 xn = 1;

            if (aa >= (1 << 128)) {
                aa >>= 128;
                xn <<= 64;
            }
            if (aa >= (1 << 64)) {
                aa >>= 64;
                xn <<= 32;
            }
            if (aa >= (1 << 32)) {
                aa >>= 32;
                xn <<= 16;
            }
            if (aa >= (1 << 16)) {
                aa >>= 16;
                xn <<= 8;
            }
            if (aa >= (1 << 8)) {
                aa >>= 8;
                xn <<= 4;
            }
            if (aa >= (1 << 4)) {
                aa >>= 4;
                xn <<= 2;
            }
            if (aa >= (1 << 2)) {
                xn <<= 1;
            }

            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
            //
            // We can refine our estimation by noticing that the middle of that interval minimizes the error.
            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
            // This is going to be our x_0 (and ε_0)
            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)

            // From here, Newton's method give us:
            // x_{n+1} = (x_n + a / x_n) / 2
            //
            // One should note that:
            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
            //              = ((x_n² + a) / (2 * x_n))² - a
            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
            //              = (x_n² - a)² / (2 * x_n)²
            //              = ((x_n² - a) / (2 * x_n))²
            //              ≥ 0
            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
            //
            // This gives us the proof of quadratic convergence of the sequence:
            // ε_{n+1} = | x_{n+1} - sqrt(a) |
            //         = | (x_n + a / x_n) / 2 - sqrt(a) |
            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
            //         = | (x_n - sqrt(a))² / (2 * x_n) |
            //         = | ε_n² / (2 * x_n) |
            //         = ε_n² / | (2 * x_n) |
            //
            // For the first iteration, we have a special case where x_0 is known:
            // ε_1 = ε_0² / | (2 * x_0) |
            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))
            //     ≤ 2**(e-3) / 3
            //     ≤ 2**(e-3-log2(3))
            //     ≤ 2**(e-4.5)
            //
            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
            // ε_{n+1} = ε_n² / | (2 * x_n) |
            //         ≤ (2**(e-k))² / (2 * 2**(e-1))
            //         ≤ 2**(2*e-2*k) / 2**e
            //         ≤ 2**(e-2*k)
            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above
            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5
            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9
            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18
            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36
            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72

            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
            // sqrt(a) or sqrt(a) + 1.
            return xn - SafeCast.toUint(xn > a / xn);
        }
    }

    /**
     * @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        uint256 exp;
        unchecked {
            exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);
            value >>= exp;
            result += exp;

            exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);
            value >>= exp;
            result += exp;

            exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);
            value >>= exp;
            result += exp;

            exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);
            value >>= exp;
            result += exp;

            exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);
            value >>= exp;
            result += exp;

            exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);
            value >>= exp;
            result += exp;

            exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);
            value >>= exp;
            result += exp;

            result += SafeCast.toUint(value > 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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;
        uint256 isGt;
        unchecked {
            isGt = SafeCast.toUint(value > (1 << 128) - 1);
            value >>= isGt * 128;
            result += isGt * 16;

            isGt = SafeCast.toUint(value > (1 << 64) - 1);
            value >>= isGt * 64;
            result += isGt * 8;

            isGt = SafeCast.toUint(value > (1 << 32) - 1);
            value >>= isGt * 32;
            result += isGt * 4;

            isGt = SafeCast.toUint(value > (1 << 16) - 1);
            value >>= isGt * 16;
            result += isGt * 2;

            result += SafeCast.toUint(value > (1 << 8) - 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 21 of 29 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }

    /**
     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
     */
    function toUint(bool b) internal pure returns (uint256 u) {
        assembly ("memory-safe") {
            u := iszero(iszero(b))
        }
    }
}

File 22 of 29 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

import {SafeCast} from "./SafeCast.sol";

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
     *
     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
     * one branch when needed, making this function more expensive.
     */
    function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {
        unchecked {
            // branchless ternary works because:
            // b ^ (a ^ b) == a
            // b ^ 0 == b
            return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));
        }
    }

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

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return ternary(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 {
            // Formula from the "Bit Twiddling Hacks" by Sean Eron Anderson.
            // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,
            // taking advantage of the most significant (or "sign" bit) in two's complement representation.
            // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,
            // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).
            int256 mask = n >> 255;

            // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.
            return uint256((n + mask) ^ mask);
        }
    }
}

File 23 of 29 : Panic.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)

pragma solidity ^0.8.20;

/**
 * @dev Helper library for emitting standardized panic codes.
 *
 * ```solidity
 * contract Example {
 *      using Panic for uint256;
 *
 *      // Use any of the declared internal constants
 *      function foo() { Panic.GENERIC.panic(); }
 *
 *      // Alternatively
 *      function foo() { Panic.panic(Panic.GENERIC); }
 * }
 * ```
 *
 * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
 *
 * _Available since v5.1._
 */
// slither-disable-next-line unused-state
library Panic {
    /// @dev generic / unspecified error
    uint256 internal constant GENERIC = 0x00;
    /// @dev used by the assert() builtin
    uint256 internal constant ASSERT = 0x01;
    /// @dev arithmetic underflow or overflow
    uint256 internal constant UNDER_OVERFLOW = 0x11;
    /// @dev division or modulo by zero
    uint256 internal constant DIVISION_BY_ZERO = 0x12;
    /// @dev enum conversion error
    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
    /// @dev invalid encoding in storage
    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
    /// @dev empty array pop
    uint256 internal constant EMPTY_ARRAY_POP = 0x31;
    /// @dev array out of bounds access
    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
    /// @dev resource error (too large allocation or too large array)
    uint256 internal constant RESOURCE_ERROR = 0x41;
    /// @dev calling invalid internal function
    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;

    /// @dev Reverts with a panic code. Recommended to use with
    /// the internal constants with predefined codes.
    function panic(uint256 code) internal pure {
        assembly ("memory-safe") {
            mstore(0x00, 0x4e487b71)
            mstore(0x20, code)
            revert(0x1c, 0x24)
        }
    }
}

File 24 of 29 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

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

    constructor() {
        _status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

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

File 25 of 29 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SafeCast} from "./math/SafeCast.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    using SafeCast for *;

    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev The string being parsed contains characters that are not in scope of the given base.
     */
    error StringsInvalidChar();

    /**
     * @dev The string being parsed is not a properly formatted address.
     */
    error StringsInvalidAddressFormat();

    /**
     * @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;
            assembly ("memory-safe") {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                assembly ("memory-safe") {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(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) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        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 Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal
     * representation, according to EIP-55.
     */
    function toChecksumHexString(address addr) internal pure returns (string memory) {
        bytes memory buffer = bytes(toHexString(addr));

        // hash the hex part of buffer (skip length + 2 bytes, length 40)
        uint256 hashValue;
        assembly ("memory-safe") {
            hashValue := shr(96, keccak256(add(buffer, 0x22), 40))
        }

        for (uint256 i = 41; i > 1; --i) {
            // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)
            if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {
                // case shift by xoring with 0x20
                buffer[i] ^= 0x20;
            }
            hashValue >>= 4;
        }
        return string(buffer);
    }

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

    /**
     * @dev Parse a decimal string and returns the value as a `uint256`.
     *
     * Requirements:
     * - The string must be formatted as `[0-9]*`
     * - The result must fit into an `uint256` type
     */
    function parseUint(string memory input) internal pure returns (uint256) {
        return parseUint(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseUint} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `[0-9]*`
     * - The result must fit into an `uint256` type
     */
    function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
        (bool success, uint256 value) = tryParseUint(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {
        return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid
     * character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseUint(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, uint256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseUintUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseUint} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseUintUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, uint256 value) {
        bytes memory buffer = bytes(input);

        uint256 result = 0;
        for (uint256 i = begin; i < end; ++i) {
            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
            if (chr > 9) return (false, 0);
            result *= 10;
            result += chr;
        }
        return (true, result);
    }

    /**
     * @dev Parse a decimal string and returns the value as a `int256`.
     *
     * Requirements:
     * - The string must be formatted as `[-+]?[0-9]*`
     * - The result must fit in an `int256` type.
     */
    function parseInt(string memory input) internal pure returns (int256) {
        return parseInt(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `[-+]?[0-9]*`
     * - The result must fit in an `int256` type.
     */
    function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {
        (bool success, int256 value) = tryParseInt(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if
     * the result does not fit in a `int256`.
     *
     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
     */
    function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {
        return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);
    }

    uint256 private constant ABS_MIN_INT256 = 2 ** 255;

    /**
     * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid
     * character or if the result does not fit in a `int256`.
     *
     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
     */
    function tryParseInt(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, int256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseIntUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseInt} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseIntUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, int256 value) {
        bytes memory buffer = bytes(input);

        // Check presence of a negative sign.
        bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        bool positiveSign = sign == bytes1("+");
        bool negativeSign = sign == bytes1("-");
        uint256 offset = (positiveSign || negativeSign).toUint();

        (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);

        if (absSuccess && absValue < ABS_MIN_INT256) {
            return (true, negativeSign ? -int256(absValue) : int256(absValue));
        } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {
            return (true, type(int256).min);
        } else return (false, 0);
    }

    /**
     * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as a `uint256`.
     *
     * Requirements:
     * - The string must be formatted as `(0x)?[0-9a-fA-F]*`
     * - The result must fit in an `uint256` type.
     */
    function parseHexUint(string memory input) internal pure returns (uint256) {
        return parseHexUint(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseHexUint} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`
     * - The result must fit in an `uint256` type.
     */
    function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
        (bool success, uint256 value) = tryParseHexUint(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {
        return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an
     * invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseHexUint(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, uint256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseHexUintUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseHexUint} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseHexUintUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, uint256 value) {
        bytes memory buffer = bytes(input);

        // skip 0x prefix if present
        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        uint256 offset = hasPrefix.toUint() * 2;

        uint256 result = 0;
        for (uint256 i = begin + offset; i < end; ++i) {
            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
            if (chr > 15) return (false, 0);
            result *= 16;
            unchecked {
                // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).
                // This guaratees that adding a value < 16 will not cause an overflow, hence the unchecked.
                result += chr;
            }
        }
        return (true, result);
    }

    /**
     * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as an `address`.
     *
     * Requirements:
     * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`
     */
    function parseAddress(string memory input) internal pure returns (address) {
        return parseAddress(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseAddress} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`
     */
    function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {
        (bool success, address value) = tryParseAddress(input, begin, end);
        if (!success) revert StringsInvalidAddressFormat();
        return value;
    }

    /**
     * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly
     * formatted address. See {parseAddress} requirements.
     */
    function tryParseAddress(string memory input) internal pure returns (bool success, address value) {
        return tryParseAddress(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly
     * formatted address. See {parseAddress} requirements.
     */
    function tryParseAddress(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, address value) {
        if (end > bytes(input).length || begin > end) return (false, address(0));

        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        uint256 expectedLength = 40 + hasPrefix.toUint() * 2;

        // check that input is the correct length
        if (end - begin == expectedLength) {
            // length guarantees that this does not overflow, and value is at most type(uint160).max
            (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);
            return (s, address(uint160(v)));
        } else {
            return (false, address(0));
        }
    }

    function _tryParseChr(bytes1 chr) private pure returns (uint8) {
        uint8 value = uint8(chr);

        // Try to parse `chr`:
        // - Case 1: [0-9]
        // - Case 2: [a-f]
        // - Case 3: [A-F]
        // - otherwise not supported
        unchecked {
            if (value > 47 && value < 58) value -= 48;
            else if (value > 96 && value < 103) value -= 87;
            else if (value > 64 && value < 71) value -= 55;
            else return type(uint8).max;
        }

        return value;
    }

    /**
     * @dev Reads a bytes32 from a bytes array without bounds checking.
     *
     * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the
     * assembly block as such would prevent some optimizations.
     */
    function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {
        // This is not memory safe in the general case, but all calls to this private function are within bounds.
        assembly ("memory-safe") {
            value := mload(add(buffer, add(0x20, offset)))
        }
    }
}

File 26 of 29 : IBlot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

interface IBlot {

    enum RateType { Mint, ExchangeMint, ExchangeBurn, Recycle }
    enum MintState { Inactive, Active, Complete }

    struct Epoch {
        bool isCommitted;
        bool isRevealed;
        uint64 revealBlock;
        uint128 randomness;
        uint256 paletteCount;
    }

    struct Blot {
        bool isRevealed;
        uint256 seed;
        uint256 epoch;
        uint256 mintTime;
    }

    struct Blots {
        mapping(uint256 => Blot) all;
        mapping(uint256 => Epoch) epochs;
        mapping(bytes3 => Color) colors;
        uint256 idCounter;
        uint256 supplyCounter;
        uint256 currentEpoch;
        Palette[] palettes;
    }

    struct Color {
        string name;
        bytes3 hexValue;
    }

    struct Palette {
        Color ink;
        Color paper;
    }

    event NewEpoch(
        uint256 indexed epoch,
        uint64 indexed revealBlock
    );

    event Minted(
        uint256 indexed tokenId
    );

    event Burned(
        uint256 indexed tokenId
    );

    event Recycled(
        uint256 indexed burnedTokenId,
        uint256 indexed mintedTokenId
    );

    error ArrayMismatch();
    error ColorNotFound();
    error ColorDuplication();
    error InsufficientValue();
    error InvalidAddress();
    error InvalidRecipients();
    error InvalidQuantity();
    error MintUnavailable();
    error PalettesNotFound();
    error RecycleUnavailable();
    error ExchangeUnavailable();
    error TokenNotFound();
    error Unauthorized();

}

File 27 of 29 : IBlotERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IBlotERC20 is IERC20 {
    function BURNER_ROLE() external view returns (bytes32);
    function TRANSFER_ROLE() external view returns (bytes32);
    function hasRole(bytes32 role, address account) external view returns (bool);
    function decimals() external view returns (uint8);
    function transferFromTreasury(address to, uint256 amount) external;
    function treasury() external view returns (address);
    function utilityBurn(address account, uint256 value) external;
}

File 28 of 29 : Artwork.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import "../interfaces/IBlot.sol";
import "../libraries/Util.sol";

library Artwork {

    using Strings for uint256;
    string private constant _SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1080 1080">';
    string private constant _defs = '<defs><filter id="b" height="150%"><feGaussianBlur mode="multiply" stdDeviation="13" result="b"/><feColorMatrix in="b" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 20 -10"/></filter><filter id="n" x="-20%" y="-20%" width="150%" height="150%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="linearRGB"><feTurbulence x="0" y="0" type="fractalNoise" baseFrequency="2.5" numOctaves="10" seed="1" stitchTiles="stitch" width="100%" height="100%" result="turbulence"/><feSpecularLighting surfaceScale="3" specularConstant="1" specularExponent="10" lighting-color="#fff" x="0" y="0" width="100%" height="100%" in="turbulence" result="specularLighting"><feDistantLight azimuth="3" elevation="191"/></feSpecularLighting></filter></defs>';

    function _generateInkDrop(uint256 x, uint256 y, uint256 r) private pure returns (string memory) {
        return string.concat('<circle cx="', x.toString(), '" cy="', y.toString(), '" r="', r.toString(), '"/>');
    }

    function _generateInk(uint256 seed) private pure returns (string memory b) {
        bool f = seed % 2 == 0;
        uint256 mx = Util.random(seed, 1, 189, f ? 243 : 216);
        uint256 my = Util.random(seed, 2, 189, f ? 243 : 216);
        uint256 count = f
            ? Util.random(seed, 3, 195, 215)
            : Util.random(seed, 3, 95, 115);
        uint256 w = 1080 - (mx * 2);
        uint256 h = 1080 - (my * 2);
        uint256 c = 1080 / 2;
        uint256 w2 = w / 2;

        for (uint256 i = 0; i < count;) {
            uint256 r = Util.random(seed, i, 12, 22);

            if (f) {
                uint256 cx = mx + w2;
                uint256 xo = Util.random(seed, i + 1, 0, w2);
                uint256 y = my + (Util.random(seed, i + 2, 0, h));
                uint256 xl = cx - xo;
                uint256 xr = cx + xo;
                b = string.concat(b,
                    _generateInkDrop(xl, y, r), // ←
                    _generateInkDrop(xr, y, r) // →
                );
            } else {
                uint256 c2 = c * 2;
                uint256 x = c + Util.random(seed, i + count, 0, w2);
                uint256 y = c + Util.random(seed, i + c2, 0, w2);
                b = string.concat(b,
                    _generateInkDrop(c2 - x, c2 - y, r), // ↖
                    _generateInkDrop(x, c2 - y, r), // ↗
                    _generateInkDrop(c2 - x, y, r), // ↙
                    _generateInkDrop(x, y, r) // ↘
                );
            }
            unchecked { ++i; }
        }
        return b;
    }

    function _generatePaper(bytes3 color) private pure returns (string memory) {
        string memory hexColor = Util.bytes3toHexStr(color);
        return string.concat(
            '<rect x="2%" y="2%" width="96%" height="96%" fill="#', hexColor, '" stroke="#', hexColor,
            '" stroke-width="3.5" stroke-dasharray="3.5" vector-effect="non-scaling-stroke"/>'
        );
    }

    function generateUnrevealed(uint256 seed, uint256 tokenId) internal pure returns (string memory) {
        string memory ink;
        uint256 count = Util.random(seed, tokenId, 15, 125);

        for (uint256 i = 0; i < count; i++) {
            uint256 r = Util.random(seed + i, tokenId, 1, 50);
            uint256 t = Util.random(seed + i, tokenId, 1000, 7500);
            ink = string.concat(
                ink,
                '<circle cx="', Util.random(seed + i, tokenId, 25, 75).toString(),
                '%" cy="', Util.random(seed + i, tokenId + i, 25, 75).toString(),
                '%" r="0"><animate attributeName="r" values="0;', r.toString(), ';', r.toString(),
                ';0" keyTimes="0;0.1;0.8;1" dur="10" begin="', t.toString(),
                'ms" repeatCount="indefinite"/></circle>'
            );
        }

        return string.concat(
            _SVG,
            _defs,
            _generatePaper(0xf7f6f3),
            '<g filter="url(#b)" fill="#', Util.bytes3toHexStr(0x0b0c0d), '">',
            ink, '</g></svg>'
        );
    }

    function generate(uint256 seed, bytes3 paperHex, bytes3 inkHex) internal pure returns (string memory) {
        return string.concat(
            _SVG,
            _defs,
            _generatePaper(paperHex),
            '<g filter="url(#b)" fill="#', Util.bytes3toHexStr(inkHex), '">',
            _generateInk(seed),
            '</g><rect filter="url(#n)" width="100%" height="100%" opacity="0.25"/></svg>'
        );
    }

}

File 29 of 29 : Util.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

library Util {

    function _uint8toHexChar(uint8 i) private pure returns (uint8) {
        return (i > 9) ? (i + 87) : /* a-f */ (i + 48); /* 0-9 */
    }

    function _uint24toHexStr(uint24 i) private pure returns (string memory) {
        bytes memory o = new bytes(6);
        for (uint256 j = 0; j < 6; j++) {
            o[5 - j] = bytes1(_uint8toHexChar(uint8(i & 0xf)));
            i >>= 4;
        }
        return string(o);
    }

    function bytes3toHexStr(bytes3 i) internal pure returns (string memory) {
        return _uint24toHexStr(uint24(i));
    }

    function random(uint256 seed, uint256 input, uint256 min, uint256 max) internal pure returns (uint256) {
        if (min >= max) revert();
        uint256 randomHash = uint256(keccak256(abi.encodePacked(seed, input)));
        return (randomHash % (max - min + 1)) + min;
    }

}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_ERC20Contract","type":"address"},{"internalType":"uint256[4]","name":"_rates","type":"uint256[4]"},{"internalType":"string","name":"_initialContractMetadata","type":"string"},{"internalType":"string","name":"_initialExternalDomain","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ArrayMismatch","type":"error"},{"inputs":[],"name":"ColorDuplication","type":"error"},{"inputs":[],"name":"ColorNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"ExchangeUnavailable","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientValue","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidQuantity","type":"error"},{"inputs":[],"name":"InvalidRecipients","type":"error"},{"inputs":[],"name":"MintUnavailable","type":"error"},{"inputs":[],"name":"PalettesNotFound","type":"error"},{"inputs":[],"name":"RecycleUnavailable","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"TokenNotFound","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"revealBlock","type":"uint64"}],"name":"NewEpoch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"burnedTokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"mintedTokenId","type":"uint256"}],"name":"Recycled","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":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ERC20Contract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"bytes3[]","name":"hexValues","type":"bytes3[]"}],"name":"addColors","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes3[]","name":"paperColors","type":"bytes3[]"},{"internalType":"bytes3[]","name":"inkColors","type":"bytes3[]"}],"name":"addPalettes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exchangeBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"exchangeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"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":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"recycle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolveEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","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":"address","name":"contractAddress","type":"address"}],"name":"setERC20Contract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"contractMetadata","type":"string"},{"internalType":"string","name":"domain","type":"string"}],"name":"setMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"state","type":"uint256"}],"name":"setMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[4]","name":"rates_","type":"uint256[4]"}],"name":"setRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"basisPoints","type":"uint96"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","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":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5060405161568f38038061568f83398101604081905261002f916103f7565b60405180604001604052806004815260200163109b1bdd60e21b81525060405180604001604052806004815260200163109313d560e21b81525081600290816100789190610566565b5060036100858282610566565b505060016009555061009860008761013d565b506100c37f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68761013d565b506100d0856101f46101ed565b60016016819055601855600f6100e68382610566565b5060106100f38282610566565b50601180546001600160a01b038087166001600160a01b0319928316179092556012805492881692909116919091179055610131600b846004610295565b50505050505050610624565b60008281526008602090815260408083206001600160a01b038516845290915281205460ff166101e35760008381526008602090815260408083206001600160a01b03861684529091529020805460ff1916600117905561019b3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016101e7565b5060005b92915050565b6127106001600160601b03821681101561023157604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044015b60405180910390fd5b6001600160a01b03831661025b57604051635b6cc80560e11b815260006004820152602401610228565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b82600481019282156102c3579160200282015b828111156102c35782518255916020019190600101906102a8565b506102cf9291506102d3565b5090565b5b808211156102cf57600081556001016102d4565b80516001600160a01b03811681146102ff57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b038111828210171561033c5761033c610304565b60405290565b604051601f8201601f191681016001600160401b038111828210171561036a5761036a610304565b604052919050565b600082601f83011261038357600080fd5b81516001600160401b0381111561039c5761039c610304565b6103af601f8201601f1916602001610342565b8181528460208386010111156103c457600080fd5b60005b828110156103e3576020818601810151838301820152016103c7565b506000918101602001919091529392505050565b600080600080600080610120878903121561041157600080fd5b61041a876102e8565b9550610428602088016102e8565b9450610436604088016102e8565b935087607f88011261044757600080fd5b61044f61031a565b8060e089018a81111561046157600080fd5b60608a015b8181101561047e578051845260209384019301610466565b505190945090506001600160401b0381111561049957600080fd5b6104a589828a01610372565b61010089015190935090506001600160401b038111156104c457600080fd5b6104d089828a01610372565b9150509295509295509295565b600181811c908216806104f157607f821691505b60208210810361051157634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561056157806000526020600020601f840160051c8101602085101561053e5750805b601f840160051c820191505b8181101561055e576000815560010161054a565b50505b505050565b81516001600160401b0381111561057f5761057f610304565b6105938161058d84546104dd565b84610517565b6020601f8211600181146105c757600083156105af5750848201515b600019600385901b1c1916600184901b17845561055e565b600084815260208120601f198516915b828110156105f757878501518255602094850194600190920191016105d7565b50848210156106155786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b61505c806106336000396000f3fe6080604052600436106102675760003560e01c80637996f57111610144578063c87b56dd116100b6578063dd1c35bc1161007a578063dd1c35bc1461077b578063dd418ae21461079b578063e8a3d485146107bb578063e985e9c5146107d0578063f0f44260146107f0578063f17a80541461081057600080fd5b8063c87b56dd146106c7578063c9bccfa0146106e7578063cac8d53814610707578063d539139314610727578063d547741f1461075b57600080fd5b8063a0712d6811610108578063a0712d6814610629578063a217fddf1461063c578063a22cb46514610651578063b88d4fde14610671578063c051e38a14610691578063c204642c146106a757600080fd5b80637996f571146105945780637cf1aa45146105b45780638f2fc60b146105d457806391d14854146105f457806395d89b411461061457600080fd5b80632e1a7d4d116101dd578063438534ad116101a1578063438534ad146104d457806351335b50146104f457806361d027b3146105145780636352211e146105345780636541333e1461055457806370a082311461057457600080fd5b80632e1a7d4d146104345780632f2ff15d1461045457806336568abe1461047457806342842e0e1461049457806342966c68146104b457600080fd5b806318160ddd1161022f57806318160ddd1461033d57806323b872dd1461035c578063248a9ca31461037c578063282c51f3146103ac578063291db8a5146103e05780632a55205a146103f557600080fd5b806301ffc9a71461026c57806306fdde03146102a1578063081812fc146102c3578063095ea7b3146102fb5780630bb862d11461031d575b600080fd5b34801561027857600080fd5b5061028c6102873660046138fb565b610830565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102b6610841565b6040516102989190613968565b3480156102cf57600080fd5b506102e36102de36600461397b565b6108d3565b6040516001600160a01b039091168152602001610298565b34801561030757600080fd5b5061031b6103163660046139a9565b6108fc565b005b34801561032957600080fd5b5061031b61033836600461397b565b61090b565b34801561034957600080fd5b506017545b604051908152602001610298565b34801561036857600080fd5b5061031b6103773660046139d5565b61091c565b34801561038857600080fd5b5061034e61039736600461397b565b60009081526008602052604090206001015490565b3480156103b857600080fd5b5061034e7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b3480156103ec57600080fd5b5061031b6109ac565b34801561040157600080fd5b50610415610410366004613a16565b610b97565b604080516001600160a01b039093168352602083019190915201610298565b34801561044057600080fd5b5061031b61044f36600461397b565b610c1e565b34801561046057600080fd5b5061031b61046f366004613a38565b610c73565b34801561048057600080fd5b5061031b61048f366004613a38565b610c98565b3480156104a057600080fd5b5061031b6104af3660046139d5565b610cd0565b3480156104c057600080fd5b5061031b6104cf36600461397b565b610ceb565b3480156104e057600080fd5b5061031b6104ef36600461397b565b610d77565b34801561050057600080fd5b5061031b61050f366004613aa9565b61102e565b34801561052057600080fd5b506012546102e3906001600160a01b031681565b34801561054057600080fd5b506102e361054f36600461397b565b61105c565b34801561056057600080fd5b5061031b61056f36600461397b565b611067565b34801561058057600080fd5b5061034e61058f366004613b18565b611242565b3480156105a057600080fd5b506011546102e3906001600160a01b031681565b3480156105c057600080fd5b5061031b6105cf366004613b79565b61128a565b3480156105e057600080fd5b5061031b6105ef366004613bdc565b6115e4565b34801561060057600080fd5b5061028c61060f366004613a38565b6115f9565b34801561062057600080fd5b506102b6611624565b61031b61063736600461397b565b611633565b34801561064857600080fd5b5061034e600081565b34801561065d57600080fd5b5061031b61066c366004613c24565b611990565b34801561067d57600080fd5b5061031b61068c366004613c68565b61199b565b34801561069d57600080fd5b5061034e600a5481565b3480156106b357600080fd5b5061031b6106c2366004613d4d565b6119b3565b3480156106d357600080fd5b506102b66106e236600461397b565b611aad565b3480156106f357600080fd5b5061031b610702366004613d98565b611b1c565b34801561071357600080fd5b5061031b610722366004613b18565b611b34565b34801561073357600080fd5b5061034e7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561076757600080fd5b5061031b610776366004613a38565b611b62565b34801561078757600080fd5b5061031b61079636600461397b565b611b87565b3480156107a757600080fd5b5061034e6107b636600461397b565b611d99565b3480156107c757600080fd5b506102b6611db0565b3480156107dc57600080fd5b5061028c6107eb366004613dc0565b611e69565b3480156107fc57600080fd5b5061031b61080b366004613b18565b611e97565b34801561081c57600080fd5b5061031b61082b366004613b79565b611ec5565b600061083b82612027565b92915050565b60606002805461085090613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461087c90613dee565b80156108c95780601f1061089e576101008083540402835291602001916108c9565b820191906000526020600020905b8154815290600101906020018083116108ac57829003601f168201915b5050505050905090565b60006108de8261204c565b506000828152600660205260409020546001600160a01b031661083b565b610907828233612085565b5050565b600061091681612092565b50600a55565b6001600160a01b03821661094b57604051633250574960e11b8152600060048201526024015b60405180910390fd5b600061095883833361209c565b9050836001600160a01b0316816001600160a01b0316146109a6576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610942565b50505050565b6018546000908152601460205260409020805460ff16610a02576109d1436019613e38565b815460ff196001600160401b039290921662010000029190911669ffffffffffffffff00ff19909116176001179055565b8054610100900460ff16610b8e5780546201000090046001600160401b03164311610a2a5750565b8054610a47906201000090046001600160401b0316610100613e4b565b6001600160401b0316431115610a8957610a62436001613e38565b81546001600160401b0391909116620100000269ffffffffffffffff000019909116179055565b805460408051620100009092046001600160401b031640602083015244908201526001600160801b03906060016040516020818303038152906040528051906020012060001c610ad99190613e80565b815461ff00196001600160801b0392909216600160501b029190911679ffffffffffffffffffffffffffffffff0000000000000000ff001990911617610100178082556018546040516001600160401b036201000090930492909216917f78611aecfda8d341359c248df527c95aef93d446c92bb928b2a81b7abcb1d8d990600090a360188054906000610b6c83613e94565b9091555050601954601854600090815260146020526040902060010155610b91565b50565b506109ac565b600082815260016020526040812080548291906001600160a01b03811690600160a01b90046001600160601b031681610beb5750506000546001600160a01b03811690600160a01b90046001600160601b03165b6000612710610c036001600160601b03841689613ead565b610c0d9190613ec4565b9295509193505050505b9250929050565b610c26612197565b6000610c3181612092565b81471015610c525760405163044044a560e21b815260040160405180910390fd5b601254610c68906001600160a01b0316836121c1565b50610b8e6001600955565b600082815260086020526040902060010154610c8e81612092565b6109a68383612251565b6001600160a01b0381163314610cc15760405163334bd91960e11b815260040160405180910390fd5b610ccb82826122e5565b505050565b610ccb8383836040518060200160405280600081525061199b565b610cf3612197565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610d1d81612092565b610d2682612352565b600160136004016000828254610d3c9190613ed8565b909155505060405182907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a250610b8e6001600955565b610d7f612197565b610d92610d8b8261105c565b338361238d565b610dae576040516282b42960e81b815260040160405180910390fd5b6011546001600160a01b0316610dd7576040516358af0a6960e11b815260040160405180910390fd5b610de081612352565b600160136004016000828254610df69190613ed8565b909155505060405181907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a26011546001600160a01b03166000600b6002015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea09190613f01565b610eab90600a61400b565b610eb59083613ead565b905080836001600160a01b03166370a08231856001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f29919061401a565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190614037565b1015610fb0576040516358af0a6960e11b815260040160405180910390fd5b6001600160a01b0383166348a490fb335b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561100957600080fd5b505af115801561101d573d6000803e3d6000fd5b50505050505050610b8e6001600955565b600061103981612092565b600f611046858783614097565b506010611054838583614097565b505050505050565b600061083b8261204c565b61106f612197565b6001600a54146110925760405163093898ab60e41b815260040160405180910390fd5b60018110806110a15750601981115b156110bf5760405163524f409b60e01b815260040160405180910390fd5b6011546001600160a01b03166110e85760405163093898ab60e41b815260040160405180910390fd5b6011546001600160a01b03166000600b6001015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111629190613f01565b61116d90600a61400b565b6111778386613ead565b6111819190613ead565b9050806001600160a01b0384166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156111d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fc9190614037565b101561121b5760405163044044a560e21b815260040160405180910390fd5b6112236109ac565b61122d33856123f3565b6001600160a01b03831663575f88fa33610fc1565b60006001600160a01b03821661126e576040516322718ad960e21b815260006004820152602401610942565b506001600160a01b031660009081526005602052604090205490565b600061129581612092565b8382146112b55760405163b7c1140d60e01b815260040160405180910390fd5b60005b848110156115bc5760008484838181106112d4576112d4613eeb565b90506020020160208101906112e99190614156565b905060008787848181106112ff576112ff613eeb565b90506020020160208101906113149190614156565b6001600160e81b031983166000908152601560205260408082208151808301909252805493945091929091908290829061134d90613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461137990613dee565b80156113c65780601f1061139b576101008083540402835291602001916113c6565b820191906000526020600020905b8154815290600101906020018083116113a957829003601f168201915b50505091835250506001919091015460e81b6001600160e81b031990811660209283015284166000908152601590915260408082208151808301909252805493945091929091908290829061141a90613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461144690613dee565b80156114935780601f1061146857610100808354040283529160200191611493565b820191906000526020600020905b81548152906001019060200180831161147657829003601f168201915b50505091835250506001919091015460e81b6001600160e81b0319908116602092830152908401519192501615806114d7575060208101516001600160e81b031916155b156114f55760405163afb911b960e01b815260040160405180910390fd5b6040805180820190915282815260208101829052601980546001810182556000919091528151805160049092027f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950191829081906115539082614180565b50602091820151600191909101805462ffffff191660e89290921c91909117905582015180516002830190819061158a9082614180565b50602091909101516001918201805462ffffff191660e89290921c9190911790559690960195506112b8945050505050565b506019546018546000908152601460205260409020600101556115dd6109ac565b5050505050565b60006115ef81612092565b610ccb83836124f2565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606003805461085090613dee565b61163b612197565b6001600a541461165e5760405163093898ab60e41b815260040160405180910390fd5b600181108061166d5750601981115b1561168b5760405163524f409b60e01b815260040160405180910390fd5b600b54611699908290613ead565b3410156116b95760405163044044a560e21b815260040160405180910390fd5b6116c16109ac565b6116cb33826123f3565b600061271060136003015411156116e35760006116fa565b6016546116fa906116f5908490613ed8565b612595565b6011549091506001600160a01b0316158015906117175750600081115b15610c68576011546040805163313ce56760e01b815290516001600160a01b0390921691600091839163313ce567916004808201926020929091908290030181865afa15801561176b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061178f9190613f01565b61179a90600a61400b565b6117a48486613ead565b6117ae9190613ead565b905080826001600160a01b03166370a08231846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611822919061401a565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611866573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188a9190614037565b1180156119695750816001600160a01b03166391d14854836001600160a01b031663206b60f96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119039190614037565b6040516001600160e01b031960e084901b1681526004810191909152306024820152604401602060405180830381865afa158015611945573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611969919061423e565b15611983576001600160a01b0382166348a490fb33610fc1565b505050610b8e6001600955565b6109073383836125d3565b6119a684848461091c565b6109a63385858585612672565b6119bb612197565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66119e581612092565b6000839003611a0757604051635d5eb16d60e11b815260040160405180910390fd5b6001821015611a295760405163524f409b60e01b815260040160405180910390fd5b60005b83811015611a99576000858583818110611a4857611a48613eeb565b9050602002016020810190611a5d9190613b18565b90506001600160a01b038116611a865760405163e6c4247b60e01b815260040160405180910390fd5b611a9081856123f3565b50600101611a2c565b50611aa26109ac565b50610ccb6001600955565b6000818152600460205260409020546060906001600160a01b0316611ae557604051630cbdb7b360e41b815260040160405180910390fd5b611af6611af183612794565b61286a565b604051602001611b069190614277565b6040516020818303038152906040529050919050565b6000611b2781612092565b610ccb600b836004613892565b6000611b3f81612092565b50601180546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260086020526040902060010154611b7d81612092565b6109a683836122e5565b611b8f612197565b611b9b610d8b8261105c565b611bb7576040516282b42960e81b815260040160405180910390fd5b6011546001600160a01b0316611be057604051632847faa160e21b815260040160405180910390fd5b611be981612352565b600160136004016000828254611bff9190613ed8565b909155505060405181907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a2611c376109ac565b611c423360016123f3565b60165460405182907fadb56f2e8c8dd63466fb638690ea115eeb4f568e6e732d67200d1646b15ece7590600090a36011546001600160a01b03166000600b6003015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cea9190613f01565b611cf590600a61400b565b611cff9083613ead565b9050806001600160a01b0384166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7a9190614037565b101561122d5760405163044044a560e21b815260040160405180910390fd5b600b8160048110611da957600080fd5b0154905081565b6060611e45600f8054611dc290613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054611dee90613dee565b8015611e3b5780601f10611e1057610100808354040283529160200191611e3b565b820191906000526020600020905b815481529060010190602001808311611e1e57829003601f168201915b505050505061286a565b604051602001611e559190614277565b604051602081830303815290604052905090565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6000611ea281612092565b50601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000611ed081612092565b838214611ef05760405163b7c1140d60e01b815260040160405180910390fd5b60005b84811015611054576000848483818110611f0f57611f0f613eeb565b9050602002016020810190611f249190614156565b6001600160e81b031980821660009081526015602052604090206001015491925060e89190911b1615611f6a57604051631755b4eb60e01b815260040160405180910390fd5b6040518060400160405280888885818110611f8757611f87613eeb565b9050602002810190611f9991906142bc565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506001600160e81b031984166020928301819052815260159091526040902081518190611ffb9082614180565b50602091909101516001918201805462ffffff191660e89290921c919091179055919091019050611ef3565b60006001600160e01b03198216637965db0b60e01b148061083b575061083b82612890565b6000818152600460205260408120546001600160a01b03168061083b57604051637e27328960e01b815260048101849052602401610942565b610ccb838383600161289b565b610b8e81336129a1565b6000828152600460205260408120546001600160a01b03908116908316156120c9576120c98184866129da565b6001600160a01b03811615612107576120e660008560008061289b565b6001600160a01b038116600090815260056020526040902080546000190190555b6001600160a01b03851615612136576001600160a01b0385166000908152600560205260409020805460010190555b60008481526004602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a490505b9392505050565b6002600954036121ba57604051633ee5aeb560e01b815260040160405180910390fd5b6002600955565b804710156121eb5760405163cf47918160e01b815247600482015260248101829052604401610942565b600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612239576040519150601f19603f3d011682016040523d82523d6000602084013e61223e565b606091505b5091509150816109a6576109a681612a3e565b600061225d83836115f9565b6122dd5760008381526008602090815260408083206001600160a01b03861684529091529020805460ff191660011790556122953390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161083b565b50600061083b565b60006122f183836115f9565b156122dd5760008381526008602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161083b565b6000612361600083600061209c565b90506001600160a01b03811661090757604051637e27328960e01b815260048101839052602401610942565b60006001600160a01b038316158015906123eb5750826001600160a01b0316846001600160a01b031614806123c757506123c78484611e69565b806123eb57506000828152600660205260409020546001600160a01b038481169116145b949350505050565b60005b81811015610ccb57601654600081815260136020526040902060185463ffffffff1660028201556124726016546040805142602080830191909152448284015233606090811b6bffffffffffffffffffffffff191690830152607480830194909452825180830390940184526094909101909152815191012090565b60018201554260038201556124878583612a67565b60016013600401600082825461249d9190613e38565b909155505060168054600191906000906124b8908490613e38565b909155505060405182907f176b02bb2d12439ff7a20b59f402cca16c76f50508b13ef3166a600eb719354a90600090a250506001016123f6565b6127106001600160601b03821681101561253157604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610942565b6001600160a01b03831661255b57604051635b6cc80560e11b815260006004820152602401610942565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b6000806125a46101f484613ec4565b905060006125b46103e883613ead565b6125c090612710613ed8565b90506103e88111612190576103e86123eb565b6001600160a01b03821661260557604051630b61174360e31b81526001600160a01b0383166004820152602401610942565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b156115dd57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906126b4908890889087908790600401614302565b6020604051808303816000875af19250505080156126ef575060408051601f3d908101601f191682019092526126ec91810190614335565b60015b612758573d80801561271d576040519150601f19603f3d011682016040523d82523d6000602084013e612722565b606091505b50805160000361275057604051633250574960e11b81526001600160a01b0385166004820152602401610942565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461105457604051633250574960e11b81526001600160a01b0385166004820152602401610942565b606060006127a183612a81565b90506000806127af83612b04565b8451919350915061280e576127c385612d55565b6127cc86612de7565b6127d98560400151612d55565b6127e288612df5565b6040516020016127f59493929190614389565b6040516020818303038152906040529350505050919050565b61281785612d55565b82518251601061282689612d55565b6128338860200151612d55565b61283c8b612de7565b6128498a60400151612d55565b6128528d612df5565b6040516020016127f5999897969594939291906144b7565b606061083b82604051806060016040528060408152602001614f8c604091396001612f1c565b600061083b8261309b565b80806128af57506001600160a01b03821615155b156129715760006128bf8461204c565b90506001600160a01b038316158015906128eb5750826001600160a01b0316816001600160a01b031614155b80156128fe57506128fc8184611e69565b155b156129275760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610942565b811561296f5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260066020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6129ab82826115f9565b6109075760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610942565b6129e583838361238d565b610ccb576001600160a01b038316612a1357604051637e27328960e01b815260048101829052602401610942565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610942565b805115612a4e5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b6109078282604051806020016040528060008152506130db565b612aae60405180608001604052806000151581526020016000815260200160008152602001600081525090565b600082815260136020908152604080832060028101548085526014909352928190205490840191909152600160501b90046001600160801b0316801580158452612afd57600182015460208401525b5050919050565b604080518082019091526060815260006020820152604080518082019091526060815260006020820152604080840151600090815260146020529081206001015490819003612b665760405163b585d86f60e01b815260040160405180910390fd5b6000818560200151604051602001612b8091815260200190565b6040516020818303038152906040528051906020012060001c612ba39190613e80565b9050600060136006018281548110612bbd57612bbd613eeb565b90600052602060002090600402019050806000018160020181604051806040016040529081600082018054612bf190613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054612c1d90613dee565b8015612c6a5780601f10612c3f57610100808354040283529160200191612c6a565b820191906000526020600020905b815481529060010190602001808311612c4d57829003601f168201915b50505091835250506001919091015460e81b6001600160e81b03191660209091015260408051808201909152825491935090829082908290612cab90613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054612cd790613dee565b8015612d245780601f10612cf957610100808354040283529160200191612d24565b820191906000526020600020905b815481529060010190602001808311612d0757829003601f168201915b50505091835250506001919091015460e81b6001600160e81b03191660209091015291989197509095505050505050565b60606000612d62836130f3565b60010190506000816001600160401b03811115612d8157612d81613c52565b6040519080825280601f01601f191660200182016040528015612dab576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612db557509392505050565b606061083b611af1836131cb565b60606000612e0283612a81565b8051909150612e6757604051602001612e50907f5b7b2274726169745f74797065223a2252657665616c6564222c2276616c7565815268223a66616c73657d5d60b81b602082015260290190565b604051602081830303815290604052915050919050565b600080612e7383612b04565b91509150600060028460200151612e8a9190613e80565b612e95906001613e38565b60ff1690508260000151826000015182600214612ed0576040518060400160405280600681526020016553696e676c6560d01b815250612ef0565b60405180604001604052806006815260200165446f75626c6560d01b8152505b604051602001612f0293929190614608565b604051602081830303815290604052945050505050919050565b60608351600003612f3c5750604080516020810190915260008152612190565b600082612f6d57600385516004612f539190613ead565b612f5e906002613e38565b612f689190613ec4565b612f92565b600385516002612f7d9190613e38565b612f879190613ec4565b612f92906004613ead565b90506000816001600160401b03811115612fae57612fae613c52565b6040519080825280601f01601f191660200182016040528015612fd8576020820181803683370190505b50905060018501602082018788518901602081018051600082525b8284101561304e576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f8116870151865350600185019450612ff3565b90525050851561308f5760038851066001811461307257600281146130855761308d565b603d6001830353603d600283035361308d565b603d60018303535b505b50909695505050505050565b60006001600160e01b031982166380ac58cd60e01b14806130cc57506001600160e01b03198216635b5e139f60e01b145b8061083b575061083b82613220565b6130e58383613255565b610ccb336000858585612672565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131325772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061315e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061317c57662386f26fc10000830492506010015b6305f5e1008310613194576305f5e100830492506008015b61271083106131a857612710830492506004015b606483106131ba576064830492506002015b600a831061083b5760010192915050565b606060006131d883612a81565b805190915015613212576000806131ee83612b04565b915091506132098360200151826020015184602001516132ba565b95945050505050565b612190816020015184613338565b60006001600160e01b0319821663152a902d60e11b148061083b57506301ffc9a760e01b6001600160e01b031983161461083b565b6001600160a01b03821661327f57604051633250574960e11b815260006004820152602401610942565b600061328d8383600061209c565b90506001600160a01b03811615610ccb576040516339e3563760e11b815260006004820152602401610942565b60606040518060800160405280605b8152602001614fcc605b91396040518061034001604052806103138152602001614c7961031391396132fa856134a1565b613303856134c3565b61330c886134d1565b6040516020016133209594939291906146f2565b60405160208183030381529060405290509392505050565b606080600061334b8585600f607d613743565b905060005b8181101561341f5760006133716133678389613e38565b8760016032613743565b9050600061338e613382848a613e38565b886103e8611d4c613743565b9050846133b06133ab6133a1868c613e38565b8a6019604b613743565b612d55565b6133d36133ab6133c0878d613e38565b6133ca888d613e38565b6019604b613743565b6133dc85612d55565b6133e586612d55565b6133ee86612d55565b604051602001613403969594939291906147fb565b60408051808303601f1901815291905294505050600101613350565b506040518060800160405280605b8152602001614fcc605b91396040518061034001604052806103138152602001614c79610313913961346462f7f6f360e81b6134a1565b613473620b0c0d60e81b6134c3565b8560405160200161348895949392919061496c565b6040516020818303038152906040529250505092915050565b606060006134ae836134c3565b90508081604051602001612e50929190614a27565b606061083b8260e81c6137ad565b606060006134e0600284613e80565b159050600061350484600160bd856134f95760d86134fc565b60f35b60ff16613743565b9050600061351c85600260bd866134f95760d86134fc565b905060008361353957613534866003605f6073613743565b613548565b61354886600360c360d7613743565b90506000613557846002613ead565b61356390610438613ed8565b90506000613572846002613ead565b61357e90610438613ed8565b905061021c6000613590600285613ec4565b905060005b858110156137355760006135ad8c83600c6016613743565b905089156136635760006135c1848b613e38565b905060006135dc8e6135d4866001613e38565b600088613743565b905060006135f78f6135ef876002613e38565b60008b613743565b613601908c613e38565b9050600061360f8385613ed8565b9050600061361d8486613e38565b90508f61362b83858961383b565b61363683868a61383b565b60405160200161364893929190614b1c565b6040516020818303038152906040529f50505050505061372c565b6000613670856002613ead565b905060006136828e6135d48b87613e38565b61368c9087613e38565b905060006136a68f61369e8588613e38565b600089613743565b6136b09088613e38565b90508d6136d06136c08486613ed8565b6136ca8487613ed8565b8761383b565b6136e4846136de8588613ed8565b8861383b565b6136f86136f18688613ed8565b858961383b565b61370386868a61383b565b604051602001613717959493929190614b5f565b6040516020818303038152906040529d505050505b50600101613595565b505050505050505050919050565b600081831061375157600080fd5b60408051602080820188905281830187905282518083038401815260609092019092528051910120836137848185613ed8565b61378f906001613e38565b6137999083613e80565b6137a39190613e38565b9695505050505050565b6040805160068082528183019092526060916000919060208201818036833701905050905060005b6006811015613834576137ea84600f1661386a565b60f81b826137f9836005613ed8565b8151811061380957613809613eeb565b60200101906001600160f81b031916908160001a90535060049390931c620fffff16926001016137d5565b5092915050565b606061384684612d55565b61384f84612d55565b61385884612d55565b60405160200161332093929190614bca565b600060098260ff161161388757613882826030614c5f565b61083b565b61083b826057614c5f565b82600481019282156138c0579160200282015b828111156138c05782358255916020019190600101906138a5565b506138cc9291506138d0565b5090565b5b808211156138cc57600081556001016138d1565b6001600160e01b031981168114610b8e57600080fd5b60006020828403121561390d57600080fd5b8135612190816138e5565b60005b8381101561393357818101518382015260200161391b565b50506000910152565b60008151808452613954816020860160208601613918565b601f01601f19169290920160200192915050565b602081526000612190602083018461393c565b60006020828403121561398d57600080fd5b5035919050565b6001600160a01b0381168114610b8e57600080fd5b600080604083850312156139bc57600080fd5b82356139c781613994565b946020939093013593505050565b6000806000606084860312156139ea57600080fd5b83356139f581613994565b92506020840135613a0581613994565b929592945050506040919091013590565b60008060408385031215613a2957600080fd5b50508035926020909101359150565b60008060408385031215613a4b57600080fd5b823591506020830135613a5d81613994565b809150509250929050565b60008083601f840112613a7a57600080fd5b5081356001600160401b03811115613a9157600080fd5b602083019150836020828501011115610c1757600080fd5b60008060008060408587031215613abf57600080fd5b84356001600160401b03811115613ad557600080fd5b613ae187828801613a68565b90955093505060208501356001600160401b03811115613b0057600080fd5b613b0c87828801613a68565b95989497509550505050565b600060208284031215613b2a57600080fd5b813561219081613994565b60008083601f840112613b4757600080fd5b5081356001600160401b03811115613b5e57600080fd5b6020830191508360208260051b8501011115610c1757600080fd5b60008060008060408587031215613b8f57600080fd5b84356001600160401b03811115613ba557600080fd5b613bb187828801613b35565b90955093505060208501356001600160401b03811115613bd057600080fd5b613b0c87828801613b35565b60008060408385031215613bef57600080fd5b8235613bfa81613994565b915060208301356001600160601b0381168114613a5d57600080fd5b8015158114610b8e57600080fd5b60008060408385031215613c3757600080fd5b8235613c4281613994565b91506020830135613a5d81613c16565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215613c7e57600080fd5b8435613c8981613994565b93506020850135613c9981613994565b92506040850135915060608501356001600160401b03811115613cbb57600080fd5b8501601f81018713613ccc57600080fd5b80356001600160401b03811115613ce557613ce5613c52565b604051601f8201601f19908116603f011681016001600160401b0381118282101715613d1357613d13613c52565b604052818152828201602001891015613d2b57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080600060408486031215613d6257600080fd5b83356001600160401b03811115613d7857600080fd5b613d8486828701613b35565b909790965060209590950135949350505050565b600060808284031215613daa57600080fd5b82608083011115613dba57600080fd5b50919050565b60008060408385031215613dd357600080fd5b8235613dde81613994565b91506020830135613a5d81613994565b600181811c90821680613e0257607f821691505b602082108103613dba57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561083b5761083b613e22565b6001600160401b03818116838216019081111561083b5761083b613e22565b634e487b7160e01b600052601260045260246000fd5b600082613e8f57613e8f613e6a565b500690565b600060018201613ea657613ea6613e22565b5060010190565b808202811582820484141761083b5761083b613e22565b600082613ed357613ed3613e6a565b500490565b8181038181111561083b5761083b613e22565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613f1357600080fd5b815160ff8116811461219057600080fd5b6001815b6001841115613f5f57808504811115613f4357613f43613e22565b6001841615613f5157908102905b60019390931c928002613f28565b935093915050565b600082613f765750600161083b565b81613f835750600061083b565b8160018114613f995760028114613fa357613fbf565b600191505061083b565b60ff841115613fb457613fb4613e22565b50506001821b61083b565b5060208310610133831016604e8410600b8410161715613fe2575081810a61083b565b613fef6000198484613f24565b806000190482111561400357614003613e22565b029392505050565b600061219060ff841683613f67565b60006020828403121561402c57600080fd5b815161219081613994565b60006020828403121561404957600080fd5b5051919050565b601f821115610ccb57806000526020600020601f840160051c810160208510156140775750805b601f840160051c820191505b818110156115dd5760008155600101614083565b6001600160401b038311156140ae576140ae613c52565b6140c2836140bc8354613dee565b83614050565b6000601f8411600181146140f657600085156140de5750838201355b600019600387901b1c1916600186901b1783556115dd565b600083815260209020601f19861690835b828110156141275786850135825560209485019460019092019101614107565b50868210156141445760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561416857600080fd5b81356001600160e81b03198116811461219057600080fd5b81516001600160401b0381111561419957614199613c52565b6141ad816141a78454613dee565b84614050565b6020601f8211600181146141e157600083156141c95750848201515b600019600385901b1c1916600184901b1784556115dd565b600084815260208120601f198516915b8281101561421157878501518255602094850194600190920191016141f1565b508482101561422f5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60006020828403121561425057600080fd5b815161219081613c16565b6000815161426d818560208601613918565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516142af81601d850160208701613918565b91909101601d0192915050565b6000808335601e198436030181126142d357600080fd5b8301803591506001600160401b038211156142ed57600080fd5b602001915036819003821315610c1757600080fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906137a39083018461393c565b60006020828403121561434757600080fd5b8151612190816138e5565b7f222c22696d616765223a22646174613a696d6167652f7376672b786d6c3b62618152641cd94d8d0b60da1b602082015260250190565b6e7b226e616d65223a22424c4f54202360881b815284516000906143b481600f850160208a01613918565b6143c2600f82850101614352565b905085516143d4818360208a01613918565b6911161132b837b1b4111d60b11b910190815284516143fa81600a840160208901613918565b6d161130ba3a3934b13aba32b9911d60911b600a92909101918201528351614429816018840160208801613918565b607d60f81b601892909101918201526019019695505050505050565b6000815461445281613dee565b600182168015614469576001811461447e576144ae565b60ff19831686528115158202860193506144ae565b84600052602060002060005b838110156144a65781548882015260019091019060200161448a565b505081860193505b50505092915050565b6e7b226e616d65223a22424c4f54202360881b815289516000906144e281600f850160208f01613918565b701116113232b9b1b934b83a34b7b7111d1160791b600f918401918201528a51614513816020808501908f01613918565b01600f81019061452c906020016301037b7160e51b9052565b614539601582018b61425b565b7111161132bc3a32b93730b62fbab936111d1160711b81529050614560601282018a614445565b662f626c6f74732f60c81b8152905061457c600782018961425b565b6911161139b2b2b2111d1160b11b815290506145ac6145a66145a1600a84018a61425b565b614352565b8761425b565b6911161132b837b1b4111d60b11b815290506145cb600a82018661425b565b6d161130ba3a3934b13aba32b9911d60911b815290506145ee600e82018561425b565b607d60f81b81526001019c9b505050505050505050505050565b7f5b7b2274726169745f74797065223a22496e6b222c2276616c7565223a22000081526000845161464081601e850160208901613918565b808301905061227d60f01b601e8201527f2c7b2274726169745f74797065223a225061706572222c2276616c7565223a2260208201528451614689816040840160208901613918565b601e818301019150507f227d2c7b2274726169745f74797065223a22466f6c64222c2276616c7565223a6022820152601160f91b604282015283516146d5816043840160208801613918565b62227d5d60e81b6043929091019182015260460195945050505050565b60008651614704818460208b01613918565b865190830190614718818360208b01613918565b865191019061472b818360208a01613918565b7f3c672066696c7465723d2275726c28236229222066696c6c3d222300000000009101908152845161476481601b840160208901613918565b61111f60f11b601b9290910191820152835161478781601d840160208801613918565b7f3c2f673e3c726563742066696c7465723d2275726c28236e2922207769647468601d92909101918201527f3d223130302522206865696768743d223130302522206f7061636974793d2230603d8201526b17191a91179f1e17b9bb339f60a11b605d820152606901979650505050505050565b6000875161480d818460208c01613918565b6b1e31b4b931b6329031bc1e9160a11b908301908152875161483681600c840160208c01613918565b6612911031bc9e9160c91b600c9290910191820152865161485e816013840160208b01613918565b600c818301019150507f252220723d2230223e3c616e696d617465206174747269627574654e616d653d60078201526d2272222076616c7565733d22303b60901b602782015285516148b7816035840160208a01613918565b0160078101906148cd90603501603b60f81b9052565b61495f6149266149206148e3602f85018961425b565b7f3b3022206b657954696d65733d22303b302e313b302e383b3122206475723d2281526a189811103132b3b4b71e9160a91b6020820152602b0190565b8661425b565b7f6d732220726570656174436f756e743d22696e646566696e697465222f3e3c2f81526631b4b931b6329f60c91b602082015260270190565b9998505050505050505050565b6000865161497e818460208b01613918565b865190830190614992818360208b01613918565b86519101906149a5818360208a01613918565b7f3c672066696c7465723d2275726c28236229222066696c6c3d22230000000000910190815284516149de81601b840160208901613918565b61111f60f11b601b92909101918201528351614a0181601d840160208801613918565b691e17b39f1e17b9bb339f60b11b601d9290910191820152602701979650505050505050565b7f3c7265637420783d2232252220793d223225222077696474683d2239362522208152736865696768743d22393625222066696c6c3d222360601b602082015260008351614a7c816034850160208801613918565b6a22207374726f6b653d222360a81b6034918401918201528351614aa781603f840160208801613918565b7f22207374726f6b652d77696474683d22332e3522207374726f6b652d64617368603f92909101918201527f61727261793d22332e352220766563746f722d6566666563743d226e6f6e2d73605f8201526f31b0b634b73396b9ba3937b5b291179f60811b607f820152608f01949350505050565b60008451614b2e818460208901613918565b845190830190614b42818360208901613918565b8451910190614b55818360208801613918565b0195945050505050565b60008651614b71818460208b01613918565b865190830190614b85818360208b01613918565b8651910190614b98818360208a01613918565b8551910190614bab818360208901613918565b8451910190614bbe818360208801613918565b01979650505050505050565b6b1e31b4b931b6329031bc1e9160a11b81528351600090614bf281600c850160208901613918565b65111031bc9e9160d11b600c918401918201528451614c18816012840160208901613918565b600c81830101915050641110391e9160d91b60068201528351614c4281600b840160208801613918565b6211179f60e91b600b9290910191820152600e0195945050505050565b60ff818116838216019081111561083b5761083b613e2256fe3c646566733e3c66696c7465722069643d226222206865696768743d2231353025223e3c6665476175737369616e426c7572206d6f64653d226d756c7469706c792220737464446576696174696f6e3d2231332220726573756c743d2262222f3e3c6665436f6c6f724d617472697820696e3d226222206d6f64653d226d6174726978222076616c7565733d223120302030203020302020302031203020302030202030203020312030203020203020302030203230202d3130222f3e3c2f66696c7465723e3c66696c7465722069643d226e2220783d222d3230252220793d222d323025222077696474683d223135302522206865696768743d2231353025222066696c746572556e6974733d226f626a656374426f756e64696e67426f7822207072696d6974697665556e6974733d227573657253706163654f6e5573652220636f6c6f722d696e746572706f6c6174696f6e2d66696c746572733d226c696e656172524742223e3c666554757262756c656e636520783d22302220793d22302220747970653d226672616374616c4e6f6973652220626173654672657175656e63793d22322e3522206e756d4f6374617665733d2231302220736565643d2231222073746974636854696c65733d22737469746368222077696474683d223130302522206865696768743d22313030252220726573756c743d2274757262756c656e6365222f3e3c666553706563756c61724c69676874696e6720737572666163655363616c653d2233222073706563756c6172436f6e7374616e743d2231222073706563756c61724578706f6e656e743d22313022206c69676874696e672d636f6c6f723d22236666662220783d22302220793d2230222077696474683d223130302522206865696768743d22313030252220696e3d2274757262756c656e63652220726573756c743d2273706563756c61724c69676874696e67223e3c666544697374616e744c6967687420617a696d7574683d22332220656c65766174696f6e3d22313931222f3e3c2f666553706563756c61724c69676874696e673e3c2f66696c7465723e3c2f646566733e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667222077696474683d223130302522206865696768743d2231303025222076696577426f783d2230203020313038302031303830223ea2646970667358221220a26f90cf88ac6b362ef209d068c8fc5a32b374d730be5f15751a4ae421cca65964736f6c634300081c003300000000000000000000000042fa81f01173c1a1ffee8f74e0d170cda1224f5e000000000000000000000000b6954f25c1c694093262528e330b31a78c75069300000000000000000000000019785cbc348100d4ce2810891f2256106a7d0a9e000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000138800000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000001887b226e616d65223a22424c4f54222c226465736372697074696f6e223a2270737963686f646961676e6f7374696320696e6b20626c6f7473222c22696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d696d6167652e706e67222c2262616e6e65725f696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d62616e6e65722e706e67222c2266656174757265645f696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d66656174757265642e706e67222c2265787465726e616c5f6c696e6b223a2268747470733a2f2f3078424c4f542e617274222c2273656c6c65725f6665655f62617369735f706f696e7473223a3530302c226665655f726563697069656e74223a22307842363935344632356331433639343039333236323532386533333062333161373863373530363933227d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001268747470733a2f2f3078424c4f542e6172740000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102675760003560e01c80637996f57111610144578063c87b56dd116100b6578063dd1c35bc1161007a578063dd1c35bc1461077b578063dd418ae21461079b578063e8a3d485146107bb578063e985e9c5146107d0578063f0f44260146107f0578063f17a80541461081057600080fd5b8063c87b56dd146106c7578063c9bccfa0146106e7578063cac8d53814610707578063d539139314610727578063d547741f1461075b57600080fd5b8063a0712d6811610108578063a0712d6814610629578063a217fddf1461063c578063a22cb46514610651578063b88d4fde14610671578063c051e38a14610691578063c204642c146106a757600080fd5b80637996f571146105945780637cf1aa45146105b45780638f2fc60b146105d457806391d14854146105f457806395d89b411461061457600080fd5b80632e1a7d4d116101dd578063438534ad116101a1578063438534ad146104d457806351335b50146104f457806361d027b3146105145780636352211e146105345780636541333e1461055457806370a082311461057457600080fd5b80632e1a7d4d146104345780632f2ff15d1461045457806336568abe1461047457806342842e0e1461049457806342966c68146104b457600080fd5b806318160ddd1161022f57806318160ddd1461033d57806323b872dd1461035c578063248a9ca31461037c578063282c51f3146103ac578063291db8a5146103e05780632a55205a146103f557600080fd5b806301ffc9a71461026c57806306fdde03146102a1578063081812fc146102c3578063095ea7b3146102fb5780630bb862d11461031d575b600080fd5b34801561027857600080fd5b5061028c6102873660046138fb565b610830565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102b6610841565b6040516102989190613968565b3480156102cf57600080fd5b506102e36102de36600461397b565b6108d3565b6040516001600160a01b039091168152602001610298565b34801561030757600080fd5b5061031b6103163660046139a9565b6108fc565b005b34801561032957600080fd5b5061031b61033836600461397b565b61090b565b34801561034957600080fd5b506017545b604051908152602001610298565b34801561036857600080fd5b5061031b6103773660046139d5565b61091c565b34801561038857600080fd5b5061034e61039736600461397b565b60009081526008602052604090206001015490565b3480156103b857600080fd5b5061034e7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b3480156103ec57600080fd5b5061031b6109ac565b34801561040157600080fd5b50610415610410366004613a16565b610b97565b604080516001600160a01b039093168352602083019190915201610298565b34801561044057600080fd5b5061031b61044f36600461397b565b610c1e565b34801561046057600080fd5b5061031b61046f366004613a38565b610c73565b34801561048057600080fd5b5061031b61048f366004613a38565b610c98565b3480156104a057600080fd5b5061031b6104af3660046139d5565b610cd0565b3480156104c057600080fd5b5061031b6104cf36600461397b565b610ceb565b3480156104e057600080fd5b5061031b6104ef36600461397b565b610d77565b34801561050057600080fd5b5061031b61050f366004613aa9565b61102e565b34801561052057600080fd5b506012546102e3906001600160a01b031681565b34801561054057600080fd5b506102e361054f36600461397b565b61105c565b34801561056057600080fd5b5061031b61056f36600461397b565b611067565b34801561058057600080fd5b5061034e61058f366004613b18565b611242565b3480156105a057600080fd5b506011546102e3906001600160a01b031681565b3480156105c057600080fd5b5061031b6105cf366004613b79565b61128a565b3480156105e057600080fd5b5061031b6105ef366004613bdc565b6115e4565b34801561060057600080fd5b5061028c61060f366004613a38565b6115f9565b34801561062057600080fd5b506102b6611624565b61031b61063736600461397b565b611633565b34801561064857600080fd5b5061034e600081565b34801561065d57600080fd5b5061031b61066c366004613c24565b611990565b34801561067d57600080fd5b5061031b61068c366004613c68565b61199b565b34801561069d57600080fd5b5061034e600a5481565b3480156106b357600080fd5b5061031b6106c2366004613d4d565b6119b3565b3480156106d357600080fd5b506102b66106e236600461397b565b611aad565b3480156106f357600080fd5b5061031b610702366004613d98565b611b1c565b34801561071357600080fd5b5061031b610722366004613b18565b611b34565b34801561073357600080fd5b5061034e7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561076757600080fd5b5061031b610776366004613a38565b611b62565b34801561078757600080fd5b5061031b61079636600461397b565b611b87565b3480156107a757600080fd5b5061034e6107b636600461397b565b611d99565b3480156107c757600080fd5b506102b6611db0565b3480156107dc57600080fd5b5061028c6107eb366004613dc0565b611e69565b3480156107fc57600080fd5b5061031b61080b366004613b18565b611e97565b34801561081c57600080fd5b5061031b61082b366004613b79565b611ec5565b600061083b82612027565b92915050565b60606002805461085090613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461087c90613dee565b80156108c95780601f1061089e576101008083540402835291602001916108c9565b820191906000526020600020905b8154815290600101906020018083116108ac57829003601f168201915b5050505050905090565b60006108de8261204c565b506000828152600660205260409020546001600160a01b031661083b565b610907828233612085565b5050565b600061091681612092565b50600a55565b6001600160a01b03821661094b57604051633250574960e11b8152600060048201526024015b60405180910390fd5b600061095883833361209c565b9050836001600160a01b0316816001600160a01b0316146109a6576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610942565b50505050565b6018546000908152601460205260409020805460ff16610a02576109d1436019613e38565b815460ff196001600160401b039290921662010000029190911669ffffffffffffffff00ff19909116176001179055565b8054610100900460ff16610b8e5780546201000090046001600160401b03164311610a2a5750565b8054610a47906201000090046001600160401b0316610100613e4b565b6001600160401b0316431115610a8957610a62436001613e38565b81546001600160401b0391909116620100000269ffffffffffffffff000019909116179055565b805460408051620100009092046001600160401b031640602083015244908201526001600160801b03906060016040516020818303038152906040528051906020012060001c610ad99190613e80565b815461ff00196001600160801b0392909216600160501b029190911679ffffffffffffffffffffffffffffffff0000000000000000ff001990911617610100178082556018546040516001600160401b036201000090930492909216917f78611aecfda8d341359c248df527c95aef93d446c92bb928b2a81b7abcb1d8d990600090a360188054906000610b6c83613e94565b9091555050601954601854600090815260146020526040902060010155610b91565b50565b506109ac565b600082815260016020526040812080548291906001600160a01b03811690600160a01b90046001600160601b031681610beb5750506000546001600160a01b03811690600160a01b90046001600160601b03165b6000612710610c036001600160601b03841689613ead565b610c0d9190613ec4565b9295509193505050505b9250929050565b610c26612197565b6000610c3181612092565b81471015610c525760405163044044a560e21b815260040160405180910390fd5b601254610c68906001600160a01b0316836121c1565b50610b8e6001600955565b600082815260086020526040902060010154610c8e81612092565b6109a68383612251565b6001600160a01b0381163314610cc15760405163334bd91960e11b815260040160405180910390fd5b610ccb82826122e5565b505050565b610ccb8383836040518060200160405280600081525061199b565b610cf3612197565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610d1d81612092565b610d2682612352565b600160136004016000828254610d3c9190613ed8565b909155505060405182907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a250610b8e6001600955565b610d7f612197565b610d92610d8b8261105c565b338361238d565b610dae576040516282b42960e81b815260040160405180910390fd5b6011546001600160a01b0316610dd7576040516358af0a6960e11b815260040160405180910390fd5b610de081612352565b600160136004016000828254610df69190613ed8565b909155505060405181907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a26011546001600160a01b03166000600b6002015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea09190613f01565b610eab90600a61400b565b610eb59083613ead565b905080836001600160a01b03166370a08231856001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f29919061401a565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190614037565b1015610fb0576040516358af0a6960e11b815260040160405180910390fd5b6001600160a01b0383166348a490fb335b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561100957600080fd5b505af115801561101d573d6000803e3d6000fd5b50505050505050610b8e6001600955565b600061103981612092565b600f611046858783614097565b506010611054838583614097565b505050505050565b600061083b8261204c565b61106f612197565b6001600a54146110925760405163093898ab60e41b815260040160405180910390fd5b60018110806110a15750601981115b156110bf5760405163524f409b60e01b815260040160405180910390fd5b6011546001600160a01b03166110e85760405163093898ab60e41b815260040160405180910390fd5b6011546001600160a01b03166000600b6001015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111629190613f01565b61116d90600a61400b565b6111778386613ead565b6111819190613ead565b9050806001600160a01b0384166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156111d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fc9190614037565b101561121b5760405163044044a560e21b815260040160405180910390fd5b6112236109ac565b61122d33856123f3565b6001600160a01b03831663575f88fa33610fc1565b60006001600160a01b03821661126e576040516322718ad960e21b815260006004820152602401610942565b506001600160a01b031660009081526005602052604090205490565b600061129581612092565b8382146112b55760405163b7c1140d60e01b815260040160405180910390fd5b60005b848110156115bc5760008484838181106112d4576112d4613eeb565b90506020020160208101906112e99190614156565b905060008787848181106112ff576112ff613eeb565b90506020020160208101906113149190614156565b6001600160e81b031983166000908152601560205260408082208151808301909252805493945091929091908290829061134d90613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461137990613dee565b80156113c65780601f1061139b576101008083540402835291602001916113c6565b820191906000526020600020905b8154815290600101906020018083116113a957829003601f168201915b50505091835250506001919091015460e81b6001600160e81b031990811660209283015284166000908152601590915260408082208151808301909252805493945091929091908290829061141a90613dee565b80601f016020809104026020016040519081016040528092919081815260200182805461144690613dee565b80156114935780601f1061146857610100808354040283529160200191611493565b820191906000526020600020905b81548152906001019060200180831161147657829003601f168201915b50505091835250506001919091015460e81b6001600160e81b0319908116602092830152908401519192501615806114d7575060208101516001600160e81b031916155b156114f55760405163afb911b960e01b815260040160405180910390fd5b6040805180820190915282815260208101829052601980546001810182556000919091528151805160049092027f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950191829081906115539082614180565b50602091820151600191909101805462ffffff191660e89290921c91909117905582015180516002830190819061158a9082614180565b50602091909101516001918201805462ffffff191660e89290921c9190911790559690960195506112b8945050505050565b506019546018546000908152601460205260409020600101556115dd6109ac565b5050505050565b60006115ef81612092565b610ccb83836124f2565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606003805461085090613dee565b61163b612197565b6001600a541461165e5760405163093898ab60e41b815260040160405180910390fd5b600181108061166d5750601981115b1561168b5760405163524f409b60e01b815260040160405180910390fd5b600b54611699908290613ead565b3410156116b95760405163044044a560e21b815260040160405180910390fd5b6116c16109ac565b6116cb33826123f3565b600061271060136003015411156116e35760006116fa565b6016546116fa906116f5908490613ed8565b612595565b6011549091506001600160a01b0316158015906117175750600081115b15610c68576011546040805163313ce56760e01b815290516001600160a01b0390921691600091839163313ce567916004808201926020929091908290030181865afa15801561176b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061178f9190613f01565b61179a90600a61400b565b6117a48486613ead565b6117ae9190613ead565b905080826001600160a01b03166370a08231846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611822919061401a565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611866573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188a9190614037565b1180156119695750816001600160a01b03166391d14854836001600160a01b031663206b60f96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119039190614037565b6040516001600160e01b031960e084901b1681526004810191909152306024820152604401602060405180830381865afa158015611945573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611969919061423e565b15611983576001600160a01b0382166348a490fb33610fc1565b505050610b8e6001600955565b6109073383836125d3565b6119a684848461091c565b6109a63385858585612672565b6119bb612197565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66119e581612092565b6000839003611a0757604051635d5eb16d60e11b815260040160405180910390fd5b6001821015611a295760405163524f409b60e01b815260040160405180910390fd5b60005b83811015611a99576000858583818110611a4857611a48613eeb565b9050602002016020810190611a5d9190613b18565b90506001600160a01b038116611a865760405163e6c4247b60e01b815260040160405180910390fd5b611a9081856123f3565b50600101611a2c565b50611aa26109ac565b50610ccb6001600955565b6000818152600460205260409020546060906001600160a01b0316611ae557604051630cbdb7b360e41b815260040160405180910390fd5b611af6611af183612794565b61286a565b604051602001611b069190614277565b6040516020818303038152906040529050919050565b6000611b2781612092565b610ccb600b836004613892565b6000611b3f81612092565b50601180546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260086020526040902060010154611b7d81612092565b6109a683836122e5565b611b8f612197565b611b9b610d8b8261105c565b611bb7576040516282b42960e81b815260040160405180910390fd5b6011546001600160a01b0316611be057604051632847faa160e21b815260040160405180910390fd5b611be981612352565b600160136004016000828254611bff9190613ed8565b909155505060405181907fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e90600090a2611c376109ac565b611c423360016123f3565b60165460405182907fadb56f2e8c8dd63466fb638690ea115eeb4f568e6e732d67200d1646b15ece7590600090a36011546001600160a01b03166000600b6003015490506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cea9190613f01565b611cf590600a61400b565b611cff9083613ead565b9050806001600160a01b0384166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7a9190614037565b101561122d5760405163044044a560e21b815260040160405180910390fd5b600b8160048110611da957600080fd5b0154905081565b6060611e45600f8054611dc290613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054611dee90613dee565b8015611e3b5780601f10611e1057610100808354040283529160200191611e3b565b820191906000526020600020905b815481529060010190602001808311611e1e57829003601f168201915b505050505061286a565b604051602001611e559190614277565b604051602081830303815290604052905090565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6000611ea281612092565b50601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000611ed081612092565b838214611ef05760405163b7c1140d60e01b815260040160405180910390fd5b60005b84811015611054576000848483818110611f0f57611f0f613eeb565b9050602002016020810190611f249190614156565b6001600160e81b031980821660009081526015602052604090206001015491925060e89190911b1615611f6a57604051631755b4eb60e01b815260040160405180910390fd5b6040518060400160405280888885818110611f8757611f87613eeb565b9050602002810190611f9991906142bc565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506001600160e81b031984166020928301819052815260159091526040902081518190611ffb9082614180565b50602091909101516001918201805462ffffff191660e89290921c919091179055919091019050611ef3565b60006001600160e01b03198216637965db0b60e01b148061083b575061083b82612890565b6000818152600460205260408120546001600160a01b03168061083b57604051637e27328960e01b815260048101849052602401610942565b610ccb838383600161289b565b610b8e81336129a1565b6000828152600460205260408120546001600160a01b03908116908316156120c9576120c98184866129da565b6001600160a01b03811615612107576120e660008560008061289b565b6001600160a01b038116600090815260056020526040902080546000190190555b6001600160a01b03851615612136576001600160a01b0385166000908152600560205260409020805460010190555b60008481526004602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a490505b9392505050565b6002600954036121ba57604051633ee5aeb560e01b815260040160405180910390fd5b6002600955565b804710156121eb5760405163cf47918160e01b815247600482015260248101829052604401610942565b600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612239576040519150601f19603f3d011682016040523d82523d6000602084013e61223e565b606091505b5091509150816109a6576109a681612a3e565b600061225d83836115f9565b6122dd5760008381526008602090815260408083206001600160a01b03861684529091529020805460ff191660011790556122953390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161083b565b50600061083b565b60006122f183836115f9565b156122dd5760008381526008602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161083b565b6000612361600083600061209c565b90506001600160a01b03811661090757604051637e27328960e01b815260048101839052602401610942565b60006001600160a01b038316158015906123eb5750826001600160a01b0316846001600160a01b031614806123c757506123c78484611e69565b806123eb57506000828152600660205260409020546001600160a01b038481169116145b949350505050565b60005b81811015610ccb57601654600081815260136020526040902060185463ffffffff1660028201556124726016546040805142602080830191909152448284015233606090811b6bffffffffffffffffffffffff191690830152607480830194909452825180830390940184526094909101909152815191012090565b60018201554260038201556124878583612a67565b60016013600401600082825461249d9190613e38565b909155505060168054600191906000906124b8908490613e38565b909155505060405182907f176b02bb2d12439ff7a20b59f402cca16c76f50508b13ef3166a600eb719354a90600090a250506001016123f6565b6127106001600160601b03821681101561253157604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610942565b6001600160a01b03831661255b57604051635b6cc80560e11b815260006004820152602401610942565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b6000806125a46101f484613ec4565b905060006125b46103e883613ead565b6125c090612710613ed8565b90506103e88111612190576103e86123eb565b6001600160a01b03821661260557604051630b61174360e31b81526001600160a01b0383166004820152602401610942565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b156115dd57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906126b4908890889087908790600401614302565b6020604051808303816000875af19250505080156126ef575060408051601f3d908101601f191682019092526126ec91810190614335565b60015b612758573d80801561271d576040519150601f19603f3d011682016040523d82523d6000602084013e612722565b606091505b50805160000361275057604051633250574960e11b81526001600160a01b0385166004820152602401610942565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461105457604051633250574960e11b81526001600160a01b0385166004820152602401610942565b606060006127a183612a81565b90506000806127af83612b04565b8451919350915061280e576127c385612d55565b6127cc86612de7565b6127d98560400151612d55565b6127e288612df5565b6040516020016127f59493929190614389565b6040516020818303038152906040529350505050919050565b61281785612d55565b82518251601061282689612d55565b6128338860200151612d55565b61283c8b612de7565b6128498a60400151612d55565b6128528d612df5565b6040516020016127f5999897969594939291906144b7565b606061083b82604051806060016040528060408152602001614f8c604091396001612f1c565b600061083b8261309b565b80806128af57506001600160a01b03821615155b156129715760006128bf8461204c565b90506001600160a01b038316158015906128eb5750826001600160a01b0316816001600160a01b031614155b80156128fe57506128fc8184611e69565b155b156129275760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610942565b811561296f5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260066020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6129ab82826115f9565b6109075760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610942565b6129e583838361238d565b610ccb576001600160a01b038316612a1357604051637e27328960e01b815260048101829052602401610942565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610942565b805115612a4e5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b6109078282604051806020016040528060008152506130db565b612aae60405180608001604052806000151581526020016000815260200160008152602001600081525090565b600082815260136020908152604080832060028101548085526014909352928190205490840191909152600160501b90046001600160801b0316801580158452612afd57600182015460208401525b5050919050565b604080518082019091526060815260006020820152604080518082019091526060815260006020820152604080840151600090815260146020529081206001015490819003612b665760405163b585d86f60e01b815260040160405180910390fd5b6000818560200151604051602001612b8091815260200190565b6040516020818303038152906040528051906020012060001c612ba39190613e80565b9050600060136006018281548110612bbd57612bbd613eeb565b90600052602060002090600402019050806000018160020181604051806040016040529081600082018054612bf190613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054612c1d90613dee565b8015612c6a5780601f10612c3f57610100808354040283529160200191612c6a565b820191906000526020600020905b815481529060010190602001808311612c4d57829003601f168201915b50505091835250506001919091015460e81b6001600160e81b03191660209091015260408051808201909152825491935090829082908290612cab90613dee565b80601f0160208091040260200160405190810160405280929190818152602001828054612cd790613dee565b8015612d245780601f10612cf957610100808354040283529160200191612d24565b820191906000526020600020905b815481529060010190602001808311612d0757829003601f168201915b50505091835250506001919091015460e81b6001600160e81b03191660209091015291989197509095505050505050565b60606000612d62836130f3565b60010190506000816001600160401b03811115612d8157612d81613c52565b6040519080825280601f01601f191660200182016040528015612dab576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612db557509392505050565b606061083b611af1836131cb565b60606000612e0283612a81565b8051909150612e6757604051602001612e50907f5b7b2274726169745f74797065223a2252657665616c6564222c2276616c7565815268223a66616c73657d5d60b81b602082015260290190565b604051602081830303815290604052915050919050565b600080612e7383612b04565b91509150600060028460200151612e8a9190613e80565b612e95906001613e38565b60ff1690508260000151826000015182600214612ed0576040518060400160405280600681526020016553696e676c6560d01b815250612ef0565b60405180604001604052806006815260200165446f75626c6560d01b8152505b604051602001612f0293929190614608565b604051602081830303815290604052945050505050919050565b60608351600003612f3c5750604080516020810190915260008152612190565b600082612f6d57600385516004612f539190613ead565b612f5e906002613e38565b612f689190613ec4565b612f92565b600385516002612f7d9190613e38565b612f879190613ec4565b612f92906004613ead565b90506000816001600160401b03811115612fae57612fae613c52565b6040519080825280601f01601f191660200182016040528015612fd8576020820181803683370190505b50905060018501602082018788518901602081018051600082525b8284101561304e576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f8116870151865350600185019450612ff3565b90525050851561308f5760038851066001811461307257600281146130855761308d565b603d6001830353603d600283035361308d565b603d60018303535b505b50909695505050505050565b60006001600160e01b031982166380ac58cd60e01b14806130cc57506001600160e01b03198216635b5e139f60e01b145b8061083b575061083b82613220565b6130e58383613255565b610ccb336000858585612672565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131325772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061315e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061317c57662386f26fc10000830492506010015b6305f5e1008310613194576305f5e100830492506008015b61271083106131a857612710830492506004015b606483106131ba576064830492506002015b600a831061083b5760010192915050565b606060006131d883612a81565b805190915015613212576000806131ee83612b04565b915091506132098360200151826020015184602001516132ba565b95945050505050565b612190816020015184613338565b60006001600160e01b0319821663152a902d60e11b148061083b57506301ffc9a760e01b6001600160e01b031983161461083b565b6001600160a01b03821661327f57604051633250574960e11b815260006004820152602401610942565b600061328d8383600061209c565b90506001600160a01b03811615610ccb576040516339e3563760e11b815260006004820152602401610942565b60606040518060800160405280605b8152602001614fcc605b91396040518061034001604052806103138152602001614c7961031391396132fa856134a1565b613303856134c3565b61330c886134d1565b6040516020016133209594939291906146f2565b60405160208183030381529060405290509392505050565b606080600061334b8585600f607d613743565b905060005b8181101561341f5760006133716133678389613e38565b8760016032613743565b9050600061338e613382848a613e38565b886103e8611d4c613743565b9050846133b06133ab6133a1868c613e38565b8a6019604b613743565b612d55565b6133d36133ab6133c0878d613e38565b6133ca888d613e38565b6019604b613743565b6133dc85612d55565b6133e586612d55565b6133ee86612d55565b604051602001613403969594939291906147fb565b60408051808303601f1901815291905294505050600101613350565b506040518060800160405280605b8152602001614fcc605b91396040518061034001604052806103138152602001614c79610313913961346462f7f6f360e81b6134a1565b613473620b0c0d60e81b6134c3565b8560405160200161348895949392919061496c565b6040516020818303038152906040529250505092915050565b606060006134ae836134c3565b90508081604051602001612e50929190614a27565b606061083b8260e81c6137ad565b606060006134e0600284613e80565b159050600061350484600160bd856134f95760d86134fc565b60f35b60ff16613743565b9050600061351c85600260bd866134f95760d86134fc565b905060008361353957613534866003605f6073613743565b613548565b61354886600360c360d7613743565b90506000613557846002613ead565b61356390610438613ed8565b90506000613572846002613ead565b61357e90610438613ed8565b905061021c6000613590600285613ec4565b905060005b858110156137355760006135ad8c83600c6016613743565b905089156136635760006135c1848b613e38565b905060006135dc8e6135d4866001613e38565b600088613743565b905060006135f78f6135ef876002613e38565b60008b613743565b613601908c613e38565b9050600061360f8385613ed8565b9050600061361d8486613e38565b90508f61362b83858961383b565b61363683868a61383b565b60405160200161364893929190614b1c565b6040516020818303038152906040529f50505050505061372c565b6000613670856002613ead565b905060006136828e6135d48b87613e38565b61368c9087613e38565b905060006136a68f61369e8588613e38565b600089613743565b6136b09088613e38565b90508d6136d06136c08486613ed8565b6136ca8487613ed8565b8761383b565b6136e4846136de8588613ed8565b8861383b565b6136f86136f18688613ed8565b858961383b565b61370386868a61383b565b604051602001613717959493929190614b5f565b6040516020818303038152906040529d505050505b50600101613595565b505050505050505050919050565b600081831061375157600080fd5b60408051602080820188905281830187905282518083038401815260609092019092528051910120836137848185613ed8565b61378f906001613e38565b6137999083613e80565b6137a39190613e38565b9695505050505050565b6040805160068082528183019092526060916000919060208201818036833701905050905060005b6006811015613834576137ea84600f1661386a565b60f81b826137f9836005613ed8565b8151811061380957613809613eeb565b60200101906001600160f81b031916908160001a90535060049390931c620fffff16926001016137d5565b5092915050565b606061384684612d55565b61384f84612d55565b61385884612d55565b60405160200161332093929190614bca565b600060098260ff161161388757613882826030614c5f565b61083b565b61083b826057614c5f565b82600481019282156138c0579160200282015b828111156138c05782358255916020019190600101906138a5565b506138cc9291506138d0565b5090565b5b808211156138cc57600081556001016138d1565b6001600160e01b031981168114610b8e57600080fd5b60006020828403121561390d57600080fd5b8135612190816138e5565b60005b8381101561393357818101518382015260200161391b565b50506000910152565b60008151808452613954816020860160208601613918565b601f01601f19169290920160200192915050565b602081526000612190602083018461393c565b60006020828403121561398d57600080fd5b5035919050565b6001600160a01b0381168114610b8e57600080fd5b600080604083850312156139bc57600080fd5b82356139c781613994565b946020939093013593505050565b6000806000606084860312156139ea57600080fd5b83356139f581613994565b92506020840135613a0581613994565b929592945050506040919091013590565b60008060408385031215613a2957600080fd5b50508035926020909101359150565b60008060408385031215613a4b57600080fd5b823591506020830135613a5d81613994565b809150509250929050565b60008083601f840112613a7a57600080fd5b5081356001600160401b03811115613a9157600080fd5b602083019150836020828501011115610c1757600080fd5b60008060008060408587031215613abf57600080fd5b84356001600160401b03811115613ad557600080fd5b613ae187828801613a68565b90955093505060208501356001600160401b03811115613b0057600080fd5b613b0c87828801613a68565b95989497509550505050565b600060208284031215613b2a57600080fd5b813561219081613994565b60008083601f840112613b4757600080fd5b5081356001600160401b03811115613b5e57600080fd5b6020830191508360208260051b8501011115610c1757600080fd5b60008060008060408587031215613b8f57600080fd5b84356001600160401b03811115613ba557600080fd5b613bb187828801613b35565b90955093505060208501356001600160401b03811115613bd057600080fd5b613b0c87828801613b35565b60008060408385031215613bef57600080fd5b8235613bfa81613994565b915060208301356001600160601b0381168114613a5d57600080fd5b8015158114610b8e57600080fd5b60008060408385031215613c3757600080fd5b8235613c4281613994565b91506020830135613a5d81613c16565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215613c7e57600080fd5b8435613c8981613994565b93506020850135613c9981613994565b92506040850135915060608501356001600160401b03811115613cbb57600080fd5b8501601f81018713613ccc57600080fd5b80356001600160401b03811115613ce557613ce5613c52565b604051601f8201601f19908116603f011681016001600160401b0381118282101715613d1357613d13613c52565b604052818152828201602001891015613d2b57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080600060408486031215613d6257600080fd5b83356001600160401b03811115613d7857600080fd5b613d8486828701613b35565b909790965060209590950135949350505050565b600060808284031215613daa57600080fd5b82608083011115613dba57600080fd5b50919050565b60008060408385031215613dd357600080fd5b8235613dde81613994565b91506020830135613a5d81613994565b600181811c90821680613e0257607f821691505b602082108103613dba57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561083b5761083b613e22565b6001600160401b03818116838216019081111561083b5761083b613e22565b634e487b7160e01b600052601260045260246000fd5b600082613e8f57613e8f613e6a565b500690565b600060018201613ea657613ea6613e22565b5060010190565b808202811582820484141761083b5761083b613e22565b600082613ed357613ed3613e6a565b500490565b8181038181111561083b5761083b613e22565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613f1357600080fd5b815160ff8116811461219057600080fd5b6001815b6001841115613f5f57808504811115613f4357613f43613e22565b6001841615613f5157908102905b60019390931c928002613f28565b935093915050565b600082613f765750600161083b565b81613f835750600061083b565b8160018114613f995760028114613fa357613fbf565b600191505061083b565b60ff841115613fb457613fb4613e22565b50506001821b61083b565b5060208310610133831016604e8410600b8410161715613fe2575081810a61083b565b613fef6000198484613f24565b806000190482111561400357614003613e22565b029392505050565b600061219060ff841683613f67565b60006020828403121561402c57600080fd5b815161219081613994565b60006020828403121561404957600080fd5b5051919050565b601f821115610ccb57806000526020600020601f840160051c810160208510156140775750805b601f840160051c820191505b818110156115dd5760008155600101614083565b6001600160401b038311156140ae576140ae613c52565b6140c2836140bc8354613dee565b83614050565b6000601f8411600181146140f657600085156140de5750838201355b600019600387901b1c1916600186901b1783556115dd565b600083815260209020601f19861690835b828110156141275786850135825560209485019460019092019101614107565b50868210156141445760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561416857600080fd5b81356001600160e81b03198116811461219057600080fd5b81516001600160401b0381111561419957614199613c52565b6141ad816141a78454613dee565b84614050565b6020601f8211600181146141e157600083156141c95750848201515b600019600385901b1c1916600184901b1784556115dd565b600084815260208120601f198516915b8281101561421157878501518255602094850194600190920191016141f1565b508482101561422f5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60006020828403121561425057600080fd5b815161219081613c16565b6000815161426d818560208601613918565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516142af81601d850160208701613918565b91909101601d0192915050565b6000808335601e198436030181126142d357600080fd5b8301803591506001600160401b038211156142ed57600080fd5b602001915036819003821315610c1757600080fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906137a39083018461393c565b60006020828403121561434757600080fd5b8151612190816138e5565b7f222c22696d616765223a22646174613a696d6167652f7376672b786d6c3b62618152641cd94d8d0b60da1b602082015260250190565b6e7b226e616d65223a22424c4f54202360881b815284516000906143b481600f850160208a01613918565b6143c2600f82850101614352565b905085516143d4818360208a01613918565b6911161132b837b1b4111d60b11b910190815284516143fa81600a840160208901613918565b6d161130ba3a3934b13aba32b9911d60911b600a92909101918201528351614429816018840160208801613918565b607d60f81b601892909101918201526019019695505050505050565b6000815461445281613dee565b600182168015614469576001811461447e576144ae565b60ff19831686528115158202860193506144ae565b84600052602060002060005b838110156144a65781548882015260019091019060200161448a565b505081860193505b50505092915050565b6e7b226e616d65223a22424c4f54202360881b815289516000906144e281600f850160208f01613918565b701116113232b9b1b934b83a34b7b7111d1160791b600f918401918201528a51614513816020808501908f01613918565b01600f81019061452c906020016301037b7160e51b9052565b614539601582018b61425b565b7111161132bc3a32b93730b62fbab936111d1160711b81529050614560601282018a614445565b662f626c6f74732f60c81b8152905061457c600782018961425b565b6911161139b2b2b2111d1160b11b815290506145ac6145a66145a1600a84018a61425b565b614352565b8761425b565b6911161132b837b1b4111d60b11b815290506145cb600a82018661425b565b6d161130ba3a3934b13aba32b9911d60911b815290506145ee600e82018561425b565b607d60f81b81526001019c9b505050505050505050505050565b7f5b7b2274726169745f74797065223a22496e6b222c2276616c7565223a22000081526000845161464081601e850160208901613918565b808301905061227d60f01b601e8201527f2c7b2274726169745f74797065223a225061706572222c2276616c7565223a2260208201528451614689816040840160208901613918565b601e818301019150507f227d2c7b2274726169745f74797065223a22466f6c64222c2276616c7565223a6022820152601160f91b604282015283516146d5816043840160208801613918565b62227d5d60e81b6043929091019182015260460195945050505050565b60008651614704818460208b01613918565b865190830190614718818360208b01613918565b865191019061472b818360208a01613918565b7f3c672066696c7465723d2275726c28236229222066696c6c3d222300000000009101908152845161476481601b840160208901613918565b61111f60f11b601b9290910191820152835161478781601d840160208801613918565b7f3c2f673e3c726563742066696c7465723d2275726c28236e2922207769647468601d92909101918201527f3d223130302522206865696768743d223130302522206f7061636974793d2230603d8201526b17191a91179f1e17b9bb339f60a11b605d820152606901979650505050505050565b6000875161480d818460208c01613918565b6b1e31b4b931b6329031bc1e9160a11b908301908152875161483681600c840160208c01613918565b6612911031bc9e9160c91b600c9290910191820152865161485e816013840160208b01613918565b600c818301019150507f252220723d2230223e3c616e696d617465206174747269627574654e616d653d60078201526d2272222076616c7565733d22303b60901b602782015285516148b7816035840160208a01613918565b0160078101906148cd90603501603b60f81b9052565b61495f6149266149206148e3602f85018961425b565b7f3b3022206b657954696d65733d22303b302e313b302e383b3122206475723d2281526a189811103132b3b4b71e9160a91b6020820152602b0190565b8661425b565b7f6d732220726570656174436f756e743d22696e646566696e697465222f3e3c2f81526631b4b931b6329f60c91b602082015260270190565b9998505050505050505050565b6000865161497e818460208b01613918565b865190830190614992818360208b01613918565b86519101906149a5818360208a01613918565b7f3c672066696c7465723d2275726c28236229222066696c6c3d22230000000000910190815284516149de81601b840160208901613918565b61111f60f11b601b92909101918201528351614a0181601d840160208801613918565b691e17b39f1e17b9bb339f60b11b601d9290910191820152602701979650505050505050565b7f3c7265637420783d2232252220793d223225222077696474683d2239362522208152736865696768743d22393625222066696c6c3d222360601b602082015260008351614a7c816034850160208801613918565b6a22207374726f6b653d222360a81b6034918401918201528351614aa781603f840160208801613918565b7f22207374726f6b652d77696474683d22332e3522207374726f6b652d64617368603f92909101918201527f61727261793d22332e352220766563746f722d6566666563743d226e6f6e2d73605f8201526f31b0b634b73396b9ba3937b5b291179f60811b607f820152608f01949350505050565b60008451614b2e818460208901613918565b845190830190614b42818360208901613918565b8451910190614b55818360208801613918565b0195945050505050565b60008651614b71818460208b01613918565b865190830190614b85818360208b01613918565b8651910190614b98818360208a01613918565b8551910190614bab818360208901613918565b8451910190614bbe818360208801613918565b01979650505050505050565b6b1e31b4b931b6329031bc1e9160a11b81528351600090614bf281600c850160208901613918565b65111031bc9e9160d11b600c918401918201528451614c18816012840160208901613918565b600c81830101915050641110391e9160d91b60068201528351614c4281600b840160208801613918565b6211179f60e91b600b9290910191820152600e0195945050505050565b60ff818116838216019081111561083b5761083b613e2256fe3c646566733e3c66696c7465722069643d226222206865696768743d2231353025223e3c6665476175737369616e426c7572206d6f64653d226d756c7469706c792220737464446576696174696f6e3d2231332220726573756c743d2262222f3e3c6665436f6c6f724d617472697820696e3d226222206d6f64653d226d6174726978222076616c7565733d223120302030203020302020302031203020302030202030203020312030203020203020302030203230202d3130222f3e3c2f66696c7465723e3c66696c7465722069643d226e2220783d222d3230252220793d222d323025222077696474683d223135302522206865696768743d2231353025222066696c746572556e6974733d226f626a656374426f756e64696e67426f7822207072696d6974697665556e6974733d227573657253706163654f6e5573652220636f6c6f722d696e746572706f6c6174696f6e2d66696c746572733d226c696e656172524742223e3c666554757262756c656e636520783d22302220793d22302220747970653d226672616374616c4e6f6973652220626173654672657175656e63793d22322e3522206e756d4f6374617665733d2231302220736565643d2231222073746974636854696c65733d22737469746368222077696474683d223130302522206865696768743d22313030252220726573756c743d2274757262756c656e6365222f3e3c666553706563756c61724c69676874696e6720737572666163655363616c653d2233222073706563756c6172436f6e7374616e743d2231222073706563756c61724578706f6e656e743d22313022206c69676874696e672d636f6c6f723d22236666662220783d22302220793d2230222077696474683d223130302522206865696768743d22313030252220696e3d2274757262756c656e63652220726573756c743d2273706563756c61724c69676874696e67223e3c666544697374616e744c6967687420617a696d7574683d22332220656c65766174696f6e3d22313931222f3e3c2f666553706563756c61724c69676874696e673e3c2f66696c7465723e3c2f646566733e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667222077696474683d223130302522206865696768743d2231303025222076696577426f783d2230203020313038302031303830223ea2646970667358221220a26f90cf88ac6b362ef209d068c8fc5a32b374d730be5f15751a4ae421cca65964736f6c634300081c0033

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

00000000000000000000000042fa81f01173c1a1ffee8f74e0d170cda1224f5e000000000000000000000000b6954f25c1c694093262528e330b31a78c75069300000000000000000000000019785cbc348100d4ce2810891f2256106a7d0a9e000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000138800000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000001887b226e616d65223a22424c4f54222c226465736372697074696f6e223a2270737963686f646961676e6f7374696320696e6b20626c6f7473222c22696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d696d6167652e706e67222c2262616e6e65725f696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d62616e6e65722e706e67222c2266656174757265645f696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d616765732f6d657461646174612d66656174757265642e706e67222c2265787465726e616c5f6c696e6b223a2268747470733a2f2f3078424c4f542e617274222c2273656c6c65725f6665655f62617369735f706f696e7473223a3530302c226665655f726563697069656e74223a22307842363935344632356331433639343039333236323532386533333062333161373863373530363933227d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001268747470733a2f2f3078424c4f542e6172740000000000000000000000000000

-----Decoded View---------------
Arg [0] : _admin (address): 0x42fA81F01173c1a1ffeE8F74E0d170Cda1224F5E
Arg [1] : _treasury (address): 0xB6954F25c1C694093262528e330b31a78c750693
Arg [2] : _ERC20Contract (address): 0x19785CBC348100D4CE2810891f2256106a7d0a9e
Arg [3] : _rates (uint256[4]): 10000000000000000,10000,5000,1000
Arg [4] : _initialContractMetadata (string): {"name":"BLOT","description":"psychodiagnostic ink blots","image":"https://0xBLOT.art/assets/images/metadata-image.png","banner_image":"https://0xBLOT.art/assets/images/metadata-banner.png","featured_image":"https://0xBLOT.art/assets/images/metadata-featured.png","external_link":"https://0xBLOT.art","seller_fee_basis_points":500,"fee_recipient":"0xB6954F25c1C694093262528e330b31a78c750693"}
Arg [5] : _initialExternalDomain (string): https://0xBLOT.art

-----Encoded View---------------
25 Constructor Arguments found :
Arg [0] : 00000000000000000000000042fa81f01173c1a1ffee8f74e0d170cda1224f5e
Arg [1] : 000000000000000000000000b6954f25c1c694093262528e330b31a78c750693
Arg [2] : 00000000000000000000000019785cbc348100d4ce2810891f2256106a7d0a9e
Arg [3] : 000000000000000000000000000000000000000000000000002386f26fc10000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [5] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [6] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [8] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000188
Arg [10] : 7b226e616d65223a22424c4f54222c226465736372697074696f6e223a227073
Arg [11] : 7963686f646961676e6f7374696320696e6b20626c6f7473222c22696d616765
Arg [12] : 223a2268747470733a2f2f3078424c4f542e6172742f6173736574732f696d61
Arg [13] : 6765732f6d657461646174612d696d6167652e706e67222c2262616e6e65725f
Arg [14] : 696d616765223a2268747470733a2f2f3078424c4f542e6172742f6173736574
Arg [15] : 732f696d616765732f6d657461646174612d62616e6e65722e706e67222c2266
Arg [16] : 656174757265645f696d616765223a2268747470733a2f2f3078424c4f542e61
Arg [17] : 72742f6173736574732f696d616765732f6d657461646174612d666561747572
Arg [18] : 65642e706e67222c2265787465726e616c5f6c696e6b223a2268747470733a2f
Arg [19] : 2f3078424c4f542e617274222c2273656c6c65725f6665655f62617369735f70
Arg [20] : 6f696e7473223a3530302c226665655f726563697069656e74223a2230784236
Arg [21] : 3935344632356331433639343039333236323532386533333062333161373863
Arg [22] : 373530363933227d000000000000000000000000000000000000000000000000
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [24] : 68747470733a2f2f3078424c4f542e6172740000000000000000000000000000


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

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