Contract 0x8a3281f93a667c504f4fec432575a46d997b1e57

Contract Overview

Balance:
0 AVAX
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xa25947b505463c99e96ecdcd2e0532be56d56e244986333601d533ca610c80c50x60a06040174320672022-12-29 10:52:1488 days 15 hrs ago0x4082e997ec720a4894efec53b0d9aabfeea44cbe IN  Create: A8BallCueMinter0 AVAX0.10809772525
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xc72bb56aa958c28c58c900d09eae0a9564f18536263065190044ef257e760fba185191152023-02-01 2:10:5255 days 23 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xc30a71f2aa816a4b8b6be4ae8c0007a7ee92faf3e320752546b9269211caaa8e185189132023-02-01 2:01:4255 days 32 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xd8d593d7e81068dbaf645c221a24784303cf789a39abf018ec3546bd33739352185189092023-02-01 2:01:2955 days 33 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xafe26728d23f4647431a51a50e7aa755d99d37cb0cf0c1b13c49917e3439f343185189042023-02-01 2:01:1955 days 33 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x05efa45e447a48c734f0eed8697664d01cf015fb7c2ad9bdd9fbcd1b264b01e4185188902023-02-01 2:00:3955 days 34 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x073f3bcd171b1de9122a8a2c6477e6b7fa6f4019808108f660218892d588d7a1185188872023-02-01 2:00:3055 days 34 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x1bc5b27707c7baf8a263a67d4bf870e0f1413a53f2c64c3c5e28e60f86f5c070185188832023-02-01 2:00:1955 days 34 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x3aae4ec04c878715f661901941364b0df7a8d73115349cdc02f55e1ca317fc79185188682023-02-01 1:59:3655 days 35 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x6d755b04110a36b787b67e249fdb9afa5f4c9e184c5cbab3cfcdfd42cf6f15d7185188592023-02-01 1:59:1655 days 35 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xa08576093f5612cb230c814a2d8e50d59567d1352eb027407a89da098204f58d185188562023-02-01 1:59:1055 days 35 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xefed9632769714a863b61ed8a102377dcebec826fbc7513cef4ba817cf5e45a9185188182023-02-01 1:57:0755 days 37 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x66b0b309da17516872118f66f01e5b64cf0319c68a5c888d7be364fc46a5a277185188012023-02-01 1:56:2155 days 38 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x57b9d3ba0a3be816c2c4bf9b03f37b330bc298dd4d7580c40d01c3cc9f0b4d52185187982023-02-01 1:56:1555 days 38 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x8896fa9dcc4d93c86011fc6cf4635b0f99cf88e4f21d02063d8fb0a535ebb76d185187542023-02-01 1:53:5355 days 40 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x8460860c46be9338c097e1c881aef671bf69ac2bddc2721088dc22ae857a6861185187502023-02-01 1:53:3255 days 41 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xae95822847fc2db2bc9c9ed47dfb903181916c44fa16861bbcbb8fb34c1c697e185187462023-02-01 1:53:2355 days 41 mins ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x090e6030621b8ee65ccbda73ad4abd5287d2172b9161e41bd4911eb17762a34e185162612023-01-31 23:50:1555 days 2 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x8a28ab28093b54dd0a37a4bbc3239cee7fa56d239a5c5b33d0d628ba4ec512b2185162552023-01-31 23:49:5755 days 2 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x7865564d8a93d77723cf4572318a40691b954c03f93cf4667fdab54c67da6392185162512023-01-31 23:49:4955 days 2 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x016d8f177fc469ca85e3882387cabc4e2e9be959a2cd74956283313a1065d95f185115362023-01-31 20:01:5655 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xbb53df9e621bd8fd940b356ec8892aa2151b9ca1dcef7460c6aa7bca4f4d1769185115252023-01-31 20:01:3355 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x9a6b205be161b9d0d98ef01869e117626c958d7774e21e43c4eabd115c1f0d72185115212023-01-31 20:01:2355 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x89985a639269d50d1488b0db20f91535bcb8e29794fcf8a4b80705c7f2b8d317185111452023-01-31 19:43:0755 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0x6d1570986dbfbf2d9532aae21ff1ebf649cd0bba5da680f41eca7540730026c4185111352023-01-31 19:42:4455 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
0xb17d9b3ade9e3c723dae39de9e6bc590b7feb4e8ec2cf4031310a6976756f22d185111332023-01-31 19:42:3855 days 6 hrs ago 0x10c43c1947d08e6fe69caac1730f8863a4ddaa690x8a3281f93a667c504f4fec432575a46d997b1e570 AVAX
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
A8BallCueMinter

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 32 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;

  /*
   * @notice Check to see if there exists a request commitment consumers
   * for all consumers and keyhashes for a given sub.
   * @param subId - ID of the subscription
   * @return true if there exists at least one unfulfilled request for the subscription, false
   * otherwise.
   */
  function pendingRequestExists(uint64 subId) external view returns (bool);
}

File 2 of 32 : ChainlinkVRFConsumer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

import "./ChainlinkVRFConsumerBase.sol";
import "./IChainlinkVRFConsumer.sol";

abstract contract ChainlinkVRFConsumer is Initializable, IChainlinkVRFConsumer, ChainlinkVRFConsumerBase {
    using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    VRFCoordinatorV2Interface private _coordinator;

    bytes32 private _keyHash;
    uint64 private _subscriptionId;
    uint16 _confirmations;

    // requester address => request
    mapping (address => Request) private _requests;
    EnumerableSetUpgradeable.AddressSet private _requesters;

    // reverse lookup for _requests via request ID;
    EnumerableMapUpgradeable.UintToAddressMap private _idMap;

    function __ChainlinkVRFConsumer_init(
        address coordinator,
        bytes32 keyHash,
        uint64 subscriptionId,
        uint16 confirmations
    ) internal onlyInitializing {
        __ChainlinkVRFConsumerBase_init(coordinator);
        _coordinator = VRFCoordinatorV2Interface(coordinator);
        _subscriptionId = subscriptionId;
        _keyHash = keyHash;
        _confirmations = confirmations;
    }


    function _requestRandom(address requester, uint32 count, uint256[] memory links) internal {
        require(!_requesters.contains(requester), "ChainlinkVRFConsumer::Existing request");
        uint32 gasLimit = (count * 20_000) + 100_000;

        Request storage request = _requests[requester];
        request.id = _coordinator.requestRandomWords(_keyHash, _subscriptionId, _confirmations, gasLimit, count);
        request.links = links;
        _requesters.add(requester);
        _idMap.set(request.id, requester);
    }

    function _fulfillRandom(uint256 id, uint256[] memory words) internal override {
        address requester = _idMap.get(id);
        Request storage request = _requests[requester];
        request.words = words;
        _idMap.remove(id);
    }

    function requestOf(address requester) public view returns (Request memory) {
        require(_requesters.contains(requester), "ChainlinkVRFConsumer::No request");
        return _requests[requester];
    }

    function _consumeRequest(address requester) internal returns (uint256[] memory words, uint256[] memory links) {
        require(_requesters.contains(requester), "ChainlinkVRFConsumer::No request");
        Request storage request = _requests[requester];
        words = request.words;
        links = request.links;
        _requesters.remove(requester);
        delete _requests[requester];
    }

    function _totalPendingRequesters() internal view returns (uint256) {
        return _requesters.length();
    }

    function _allRequests() internal view returns (Request[] memory requests) {
        address[] memory requesters = _requesters.values();
        requests = new Request[](requesters.length);
        for (uint256 i = 0; i < requesters.length; i++) {
            requests[i] = _requests[requesters[i]];
        }
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ChainlinkVRFConsumerBase) returns (bool) {
        return interfaceId == type(IChainlinkVRFConsumer).interfaceId || super.supportsInterface(interfaceId);
    }

    uint256[43] private __gap;
}

File 3 of 32 : ChainlinkVRFConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./IChainlinkVRFConsumerBase.sol";

abstract contract ChainlinkVRFConsumerBase is Initializable, ERC165Upgradeable {
    address private _coordinator;

    modifier onlyCoordinator() {
        require(msg.sender == _coordinator, "ChainlinkVRFConsumerBase::Only coordinator can fulfill");
        _;
    }

    /**
    * @param coordinator address of ChainlinkVRFCoordinator contract
    */
    function __ChainlinkVRFConsumerBase_init(address coordinator) internal onlyInitializing {
        __ERC165_init();
        require(coordinator != address(0), "ChainlinkVRFConsumerBase::Coordinator zero address");
        _coordinator = coordinator;
    }

    /**
    * @notice _fulfillRandom handles the VRF response. Your contract must implement it.
    *
    * @dev ChainlinkVRFConsumerBase expects its subcontracts to have a method with this
    * @dev signature, and will call it once it has verified the proof
    * @dev associated with the randomness. (It is triggered via a call to
    * @dev rawFulfillRandomness, below.)
    *
    * @param id The Id initially returned by requestRandomness
    * @param words the VRF output expanded to the requested number of words
    */
    function _fulfillRandom(uint256 id, uint256[] memory words) internal virtual;

    // rawFulfillRandomWords is called by VRFCoordinator when it receives a valid VRF
    // proof. rawFulfillRandomWords then calls _fulfillRandom, after validating
    // the origin of the call
    function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external onlyCoordinator {
        _fulfillRandom(requestId, randomWords);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable) returns (bool) {
        return interfaceId == type(IChainlinkVRFConsumerBase).interfaceId || super.supportsInterface(interfaceId);
    }

    uint256[49] private __gap;
}

File 4 of 32 : IChainlinkVRFConsumer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IChainlinkVRFConsumerBase.sol";

interface IChainlinkVRFConsumer {

    struct Request {
        uint256 id;
        uint256[] links;
        uint256[] words;
    }

    function requestOf(address requester) external view returns (Request memory);
}

File 5 of 32 : IChainlinkVRFConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol";

interface IChainlinkVRFConsumerBase is IERC165Upgradeable {
    function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external;
}

File 6 of 32 : StandardAccessControl.sol
// SPDX-License-Identifier: MIT
// DirtyCajunRice Contracts (last updated v1.0.0) (utils/access/TokenMetadata.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

abstract contract StandardAccessControl is Initializable, AccessControlEnumerableUpgradeable {
    bytes32 private constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
    bytes32 private constant CONTRACT_ROLE = keccak256("CONTRACT_ROLE");
    bytes32 private constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 private constant PRIVATE_ROLE = keccak256("PRIVATE_ROLE");
    bytes32 private constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE");

    function __StandardAccessControl_init() internal onlyInitializing {
        __AccessControlEnumerable_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(ADMIN_ROLE, msg.sender);
        _grantRole(CONTRACT_ROLE, msg.sender);
        _grantRole(MINTER_ROLE, msg.sender);
        _grantRole(PRIVATE_ROLE, msg.sender);
        _grantRole(BRIDGE_ROLE, msg.sender);
    }

    modifier onlyDefaultAdmin() {
        _checkRole(DEFAULT_ADMIN_ROLE);
        _;
    }

    modifier onlyAdmin() {
        _checkRole(ADMIN_ROLE);
        _;
    }
    modifier onlyContract() {
        _checkRole(CONTRACT_ROLE);
        _;
    }
    modifier onlyMinter() {
        _checkRole(MINTER_ROLE);
        _;
    }
    modifier onlyPrivate() {
        _checkRole(PRIVATE_ROLE);
        _;
    }

    modifier onlyBridge() {
        _checkRole(BRIDGE_ROLE);
        _;
    }

    function _hasDefaultAdminRole(address _address) internal view returns(bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, _address);
    }

    function _hasAdminRole(address _address) internal view returns(bool) {
        return hasRole(ADMIN_ROLE, _address);
    }

    function _hasContractRole(address _address) internal view returns(bool) {
        return hasRole(CONTRACT_ROLE, _address);
    }

    function _hasMinterRole(address _address) internal view returns(bool) {
        return hasRole(MINTER_ROLE, _address);
    }

    function _hasPrivateRole(address _address) internal view returns(bool) {
        return hasRole(PRIVATE_ROLE, _address);
    }

    function _hasBridgeRole(address _address) internal view returns(bool) {
        return hasRole(BRIDGE_ROLE, _address);
    }

    function _checkRoles(bytes32[] calldata roles) internal view virtual {
        _checkRoles(roles, msg.sender);
    }

    function _checkRoles(bytes32[] calldata roles, address account) internal view virtual {
        for (uint256 i = 0; i < roles.length; i++) {
            if (hasRole(roles[i], account)) {
                return;
            }
        }
        revert(
            string(
                abi.encodePacked(
                    "AccessControl: account ",
                    StringsUpgradeable.toHexString(account),
                    " is missing role all roles"
                )
            )
        );
    }

    uint256[46] private __gap;
}

File 7 of 32 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

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

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

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 8 of 32 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.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:
 *
 * ```
 * 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}:
 *
 * ```
 * 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.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 9 of 32 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

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

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

File 10 of 32 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 11 of 32 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 12 of 32 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 13 of 32 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 14 of 32 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 15 of 32 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 16 of 32 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 18 of 32 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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 ERC721 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 ERC721
     * 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 caller.
     *
     * 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 19 of 32 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 20 of 32 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 21 of 32 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

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

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 25 of 32 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./EnumerableSetUpgradeable.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableMap.
 * ====
 */
library EnumerableMapUpgradeable {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSetUpgradeable.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        bytes32 value
    ) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.length();
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToUintMap storage map,
        uint256 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key)));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToUintMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key), errorMessage));
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToAddressMap storage map,
        uint256 key,
        address value
    ) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
    }

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        AddressToUintMap storage map,
        address key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(AddressToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        AddressToUintMap storage map,
        address key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        Bytes32ToUintMap storage map,
        bytes32 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, key, bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, key);
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
        return uint256(get(map._inner, key));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToUintMap storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, key, errorMessage));
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

File 29 of 32 : I8BallCue.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

import "../I8BallCommon.sol";

/**
* @title Arcadian 8Ball Cue Interface v1.0.0
* @author @DirtyCajunRice
*/
interface I8BallCue is IERC721Upgradeable, I8BallCommon {
    function mint(address to, uint256 tokenId, Cue calldata cue) external;
    function upgradeCue(address owner, uint256 tokenId, Cue calldata cue) external;
    function maxLevel(Rarity rarity) external pure returns (uint256);
    function addCollection(uint256 collectionId, string memory name) external;
    function addCollectionDesigns(uint256 collectionId, Design[] memory designs) external;

    function setImageBaseUri(string memory _imageBaseURI) external;
    function getCue(uint256 tokenId) external view returns (Cue memory);
}

File 30 of 32 : I8BallCommon.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

/**
* @title Arcadian 8Ball Common Interface v1.0.0
* @author @DirtyCajunRice
*/
interface I8BallCommon {
    enum Rarity { Common, Uncommon, Rare, Epic, Legendary }

    struct Design {
        Rarity rarity;
        uint256 id;
        uint256 remaining;
        string name;
    }

    struct Cue {
        Rarity rarity;
        uint256 collectionId;
        uint256 designId;
        uint256 power;
        uint256 accuracy;
        uint256 spin;
        uint256 time;
    }
}

File 31 of 32 : A8BallCueMinter.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.16;

import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@dirtycajunrice/contracts/utils/access/StandardAccessControl.sol";
import "@dirtycajunrice/contracts/third-party/chainlink/ChainlinkVRFConsumer.sol";

import "../Cue/I8BallCue.sol";
import "./I8BallCueMinter.sol";

/**
* @title Arcadian 8Ball Cue Minter v2.0.0
* @author @DirtyCajunRice
*/
contract A8BallCueMinter is Initializable, I8BallCueMinter, PausableUpgradeable, UUPSUpgradeable,
ReentrancyGuardUpgradeable, StandardAccessControl, ChainlinkVRFConsumer {
    /*************
     * Libraries *
     *************/

    using CountersUpgradeable for CountersUpgradeable.Counter;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    /*************
     * Variables *
     *************/

    // Public

    // Treasury address
    address public treasury;
    // 8BallCue address
    address public cue;
    // skill point upgrade cost
    uint256 public upgradePrice;

    // Private
    uint256 private constant BASIS_POINTS = 10_000;

    // Complex

    // collectionIds
    EnumerableSetUpgradeable.UintSet private _collectionIds;
    // collectionId => Collection
    mapping (uint256 => Collection) private _collections;
    // tokenId counter for 8BallCue
    CountersUpgradeable.Counter private _counter;
    // wallet => credits | 1 credit is worth 1 cue.
    mapping (address => uint256) public credits;
    /*************
     * Construct *
     *************/
    event MandoHasWeightedDice(uint256 rand, uint256 sum, uint256 result, uint256 max, uint256[] designIds, uint256 designId);
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize() public initializer {
        __Pausable_init();
        __StandardAccessControl_init();
        __UUPSUpgradeable_init();
        __ReentrancyGuard_init();
        __ERC165_init();
        __ChainlinkVRFConsumer_init(
            // 0x2eD832Ba664535e5886b75D64C46EB9a228C2610, // coordinator (Fuji)
            0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634, // coordinator (Avalanche)
            // 0x354d2f95da55398f44b7cff77da56283d9c6c829a4bdf1bbcaf2ad6a4d081f61, // key hash (Fuji) (300 Gwei)
            0x83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d, // key hash (Avalanche) (200 Gwei)
            // 526, // subscription ID (Fuji)
            103, // subscription ID (Avalanche)
            1 // confirmations
        );

        upgradePrice = 1 ether / 2;
        // cue = 0xCd9Df581F855d07144F150B0C681824548008644; // Fuji
        cue = 0xEcC82f602a7982a9464844DEE6dBc751E3615BB4; // Avalanche

        _counter.increment();
    }

    /*************
     * Functions *
     *************/

    function buyRandomCue(uint256 collectionId) external payable whenNotPaused nonReentrant {
        _beforePurchase(collectionId);
        uint256[] memory links = new uint256[](3);
        links[0] = collectionId;
        links[1] = _nextTokenID();
        links[2] = _processPayment(collectionId);
        _requestRandom(msg.sender, 1, links);
        _beforePurchase(collectionId);
    }

    function mintRandomCue() external whenNotPaused nonReentrant {
        (uint256[] memory words, uint256[] memory links) = _consumeRequest(msg.sender);
        require(words.length > 0, "8BallCueMinter::Request is still pending");

        // roll for design & decrement total
        uint256 designId = _randDesignId(links[0], _collections[links[0]].designIds.values(), words[0]);
        _afterPurchase(links[0], designId, links[2], links[1]);
    }

    function mintSpecificCue(uint256 collectionId, uint256 designId) external payable whenNotPaused nonReentrant {
        _beforePurchase(collectionId);
        require(!_collections[collectionId].random, "8BallCueMinter::Invalid specific mint collection");
        require(_collections[collectionId].designIds.contains(designId), "8BallCueMinter::Invalid designId");
        // payment
        _afterPurchase(collectionId, designId, _processPayment(collectionId), _nextTokenID());
    }

    function upgradeCue(
        uint256 tokenId,
        uint256 power,
        uint256 accuracy,
        uint256 spin,
        uint256 time
    ) external payable whenNotPaused nonReentrant {
        I8BallCue _cue = I8BallCue(cue);
        Cue memory cue_ = _cue.getCue(tokenId);
        uint256 max = cue_.rarity == Rarity.Common ? 5 : 6 + uint256(cue_.rarity);
        uint256 cost = (power + accuracy + spin + time) * upgradePrice;

        require(msg.value >= cost, "8BallCueMinter::Insufficient payment");
        payable(treasury).transfer(cost);

        cue_.power += power;
        cue_.accuracy += accuracy;
        cue_.spin += spin;
        cue_.time += time;
        require(
            cue_.power <= max && cue_.accuracy <= max && cue_.spin <= max && cue_.time <= max,
            "8BallCueMinter::Invalid upgrade amounts"
        );
        _cue.upgradeCue(msg.sender, tokenId, cue_);

        emit CueUpgraded(msg.sender, tokenId, cue_.collectionId, cue_.rarity, cost);
    }

    function getMintPrice(uint256 collectionId) public view returns (uint256) {
        uint256 discount = 0;
        Collection storage collection = _collections[collectionId];
        if (collection.mintConfig.startTime + collection.allowlistConfig.duration > block.timestamp) {
            if (collection.allowlist.contains(msg.sender)) {
                discount = collection.mintConfig.price * collection.allowlistConfig.discount / BASIS_POINTS;
            }
        }
        return collection.mintConfig.price - discount;
    }

    function setTreasury(address _treasury) external onlyAdmin {
        require(_treasury != address(0) && _treasury != treasury, "8BallCueMinter::Invalid treasury address");
        treasury = _treasury;
    }

    function addCollection(
        uint256 collectionId,
        string calldata name,
        MintConfig calldata mintConfig,
        AllowlistConfig calldata allowlistConfig,
        bool random,
        bool exists
    ) external onlyAdmin {
        require(_collectionIds.add(collectionId), "8BallCueMinter::Existing collection ID");
        Collection storage collection = _collections[collectionId];
        collection.mintConfig = mintConfig;
        collection.allowlistConfig = allowlistConfig;
        collection.random = random;
        if (!exists) {
            I8BallCue(cue).addCollection(collectionId, name);
        }
    }

    function addCollectionDesigns(uint256 collectionId, Design[] calldata designs) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        Collection storage collection = _collections[collectionId];
        for (uint256 i = 0; i < designs.length; i++) {
            collection.designIds.add(designs[i].id);
            collection.designs[designs[i].id] =  DesignBase(designs[i].rarity, designs[i].remaining);
        }
        I8BallCue(cue).addCollectionDesigns(collectionId, designs);
    }

    function setCollectionRoyaltyConfig(uint256 collectionId, RoyaltyConfig calldata config) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(
            (config.basisPoints == 0 && config.treasury == address(0))
            || (config.basisPoints != 0 && config.treasury != address(0)),
            "8BallCueMinter::Invalid royalty config"
        );

        Collection storage collection = _collections[collectionId];
        collection.royaltyConfig = config;
    }

    function setCollectionMintConfig(uint256 collectionId, MintConfig calldata config) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(config.startTime > block.timestamp, "8BallCueMinter::Invalid mint startTime");
        require(config.price > 0, "8BallCueMinter::Invalid mint price");
        Collection storage collection = _collections[collectionId];
        collection.mintConfig = config;
    }

    function setCollectionAllowlistConfig(uint256 collectionId, AllowlistConfig calldata config) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(
            (config.discount == 0 && config.duration == 0) || (config.discount != 0 && config.duration != 0),
            "8BallCueMinter::Invalid royalty config"
        );
        require(config.discount < BASIS_POINTS, "8BallCueMinter::Invalid allowlist discount");

        Collection storage collection = _collections[collectionId];
        collection.allowlistConfig = config;
    }

    function addToCollectionAllowlist(uint256 collectionId, address[] calldata wallets) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(wallets.length > 0, "8BallCueMinter::Empty wallet list");
        Collection storage collection = _collections[collectionId];
        for (uint256 i = 0; i < wallets.length; i++) {
            collection.allowlist.add(wallets[i]);
        }
    }

    function removeFromCollectionAllowlist(uint256 collectionId, address[] calldata wallets) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(wallets.length > 0, "8BallCueMinter::Empty wallet list");
        Collection storage collection = _collections[collectionId];
        for (uint256 i = 0; i < wallets.length; i++) {
            collection.allowlist.remove(wallets[i]);
        }
    }

    function setCollectionRandom(uint256 collectionId, bool random) external onlyAdmin {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        Collection storage collection = _collections[collectionId];
        collection.random = random;
    }

    function addCredits(address wallet, uint256 _credits) external onlyAdmin {
        if (credits[wallet] + _credits > 100) {
            credits[wallet] = 100;
        } else {
            credits[wallet] += _credits;
        }
    }

    function removeCredits(address wallet, uint256 _credits) external onlyAdmin {
        if (credits[wallet] < _credits) {
            credits[wallet] = 0;
        } else {
            credits[wallet] -= _credits;
        }
    }

    function getCollectionIds() external view returns (uint256[] memory) {
        return _collectionIds.values();
    }

    function getCollectionRoyaltyConfig(uint256 collectionId) external view returns (RoyaltyConfig memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].royaltyConfig;
    }

    function getCollectionMintConfig(uint256 collectionId) external view returns (MintConfig memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].mintConfig;
    }

    function getCollectionAllowlistConfig(uint256 collectionId) external view returns (AllowlistConfig memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].allowlistConfig;
    }

    function getCollectionAllowlist(uint256 collectionId) external view returns (address[] memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].allowlist.values();
    }

    function getCollectionRandom(uint256 collectionId) external view returns (bool) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].random;
    }

    function getCollectionDesignIds(uint256 collectionId) external view returns (uint256[] memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].designIds.values();
    }

    function getCollectionDesign(uint256 collectionId, uint256 designId) external view returns (DesignBase memory) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        Collection storage collection = _collections[collectionId];
        require(collection.designIds.contains(designId), "8BallCueMinter::Non-existent or sold-out designId");
        return collection.designs[designId];
    }

    function isAllowlisted(uint256 collectionId, address wallet) external view returns (bool) {
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        return _collections[collectionId].allowlist.contains(wallet);
    }

    function _authorizeUpgrade(address newImplementation) internal override onlyAdmin {}

    function pause() external onlyAdmin {
        _pause();
    }

    function unpause() external onlyAdmin {
        _unpause();
    }

    function setCounter(uint256 value) external onlyAdmin {
        _counter._value = value;
    }

    function setCue(address _cue) external onlyAdmin {
        cue = _cue;
    }

    function _processPayment(uint256 collectionId) internal returns (uint256) {
        if (credits[msg.sender] > 0) {
            credits[msg.sender]--;
            return 0;
        }
        uint256 total = getMintPrice(collectionId);
        uint256 balance = total;
        require(msg.value >= total, "8BallCueMinter::Insufficient payment");
        RoyaltyConfig storage royalty = _collections[collectionId].royaltyConfig;
        if (royalty.treasury != address(0)) {
            uint256 shared = total * royalty.basisPoints / BASIS_POINTS;
            balance -= shared;
            (bool sent,) = treasury.call{value: shared}("");
            if (sent) {
                emit RoyaltyPaid(msg.sender, royalty.treasury, collectionId, shared);
            } else {
                emit RoyaltyShareFailed(msg.sender, royalty.treasury, collectionId, shared);
            }
        }

        payable(treasury).transfer(balance);
        return total;
    }

    function _randDesignId(
        uint256 collectionId, uint256[] memory designIds, uint256 rand
    ) internal returns (uint256) {
        // sum remaining across all design ids;
        uint256 sum = 0;
        for (uint256 i = 0; i < designIds.length; i++) {
            sum += _collections[collectionId].designs[designIds[i]].remaining;
        }
        // result evenly split across all remaining
        uint256 result = rand % sum;
        uint256 sum2 = 0;
        // Iterate remaining until sum is greater than result
        for (uint256 i = 0; i < designIds.length; i++) {
            uint256 max = sum2 + _collections[collectionId].designs[designIds[i]].remaining;
            if (result <= (max - 1)) {
                emit MandoHasWeightedDice(rand, sum, result, max, designIds, designIds[i]);
                return designIds[i];
            }
            sum2 = max;
        }

        revert("8BallCueMinter::Error calculating random designId");
    }

    function _nextTokenID() internal returns(uint256) {
        // save and increment the tokenId counter
        uint256 tokenId = _counter.current();
        _counter.increment();
        return tokenId;
    }

    function _beforePurchase(uint256 collectionId) internal view {
        // checks
        require(_collectionIds.contains(collectionId), "8BallCueMinter::Non-existent collectionId");
        require(
            block.timestamp >= _collections[collectionId].mintConfig.startTime || _hasAdminRole(msg.sender),
            "8BallCueMinter::Mint has not started"
        );
        require(_collections[collectionId].designIds.length() > 0, "8BallCueMinter::Sold out");
    }

    function _afterPurchase(uint256 collectionId, uint256 designId, uint256 payment, uint256 tokenId) internal {
        Collection storage collection = _collections[collectionId];
        DesignBase storage design = collection.designs[designId];
        design.remaining--;
        if (design.remaining == 0) {
            collection.designIds.remove(designId);
        }
        // mint cue;
        I8BallCue(cue).mint(msg.sender, tokenId, Cue(design.rarity, collectionId, designId, 1, 1, 1, 1));

        emit CuePurchased(msg.sender, tokenId, collectionId, design.rarity, payment);
    }


    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ChainlinkVRFConsumer, AccessControlEnumerableUpgradeable) returns (bool){
        return type(I8BallCueMinter).interfaceId == interfaceId || super.supportsInterface(interfaceId);
    }
}

File 32 of 32 : I8BallCueMinter.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

import "../I8BallCommon.sol";

/**
* @title Arcadian 8Ball Cue Minter Interface v1.0.0
* @author @DirtyCajunRice
*/
interface I8BallCueMinter is I8BallCommon {

    /***********
     * Structs *
     ***********/

    struct AllowlistConfig {
        uint256 duration;
        uint256 discount;
    }

    struct RoyaltyConfig {
        address treasury;
        uint256 basisPoints;
    }

    struct DesignBase {
        Rarity rarity;
        uint256 remaining;
    }

    struct MintConfig {
        uint256 startTime;
        uint256 price;
    }

    struct Collection {
        MintConfig mintConfig;
        AllowlistConfig allowlistConfig;
        EnumerableSetUpgradeable.AddressSet allowlist;
        RoyaltyConfig royaltyConfig;
        // designId => design;
        EnumerableSetUpgradeable.UintSet designIds;
        mapping(uint256 => DesignBase) designs;
        bool random;
    }

    /**********
     * Events *
     **********/

    event CuePurchased(address indexed from, uint256 tokenId, uint256 collectionId, Rarity rarity, uint256 price);
    event CueUpgraded(address indexed from, uint256 tokenId, uint256 collectionId, Rarity rarity, uint256 price);
    event RoyaltyPaid(address indexed from, address indexed to, uint256 collectionId, uint256 amount);
    event RoyaltyShareFailed(address indexed from, address indexed to, uint256 collectionId, uint256 amount);

    /*************
     * Variables *
     *************/

    // Treasury address
    function treasury() external view returns(address);
    // 8BallCue address
    function cue() external view returns(address);
    // credits
    function credits(address) external view returns(uint256);

    /*************
     * Functions *
     *************/

    function buyRandomCue(uint256 collectionId) external payable;
    function mintRandomCue() external;
    function mintSpecificCue(uint256 collectionId, uint256 designId) external payable;

    function addCollection(
        uint256 collectionId,
        string calldata name,
        MintConfig calldata mintConfig,
        AllowlistConfig calldata allowlistConfig,
        bool random,
        bool exists
    ) external;

    function addCollectionDesigns(uint256 collectionId, Design[] calldata designs) external;

    function setCollectionRoyaltyConfig(uint256 collectionId, RoyaltyConfig calldata config) external;
    function setCollectionMintConfig(uint256 collectionId, MintConfig calldata config) external;
    function setCollectionAllowlistConfig(uint256 collectionId, AllowlistConfig calldata config) external;
    function addToCollectionAllowlist(uint256 collectionId, address[] calldata wallets) external;
    function removeFromCollectionAllowlist(uint256 collectionId, address[] calldata wallets) external;
    function setCollectionRandom(uint256 collectionId, bool random) external;
    function getCollectionIds() external view returns (uint256[] memory);
    function getCollectionRoyaltyConfig(uint256 collectionId) external view returns (RoyaltyConfig memory);
    function getCollectionMintConfig(uint256 collectionId) external view returns (MintConfig memory);
    function getCollectionAllowlistConfig(uint256 collectionId) external view returns (AllowlistConfig memory);
    function getCollectionAllowlist(uint256 collectionId) external view returns (address[] memory);
    function isAllowlisted(uint256 collectionId, address wallet) external view returns (bool);
    function getCollectionDesignIds(uint256 collectionId) external view returns (uint256[] memory);
    function getCollectionDesign(uint256 collectionId, uint256 designId) external view returns (DesignBase memory);
    function addCredits(address wallet, uint256 _credits) external;
    function removeCredits(address wallet, uint256 _credits) external;
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectionId","type":"uint256"},{"indexed":false,"internalType":"enum I8BallCommon.Rarity","name":"rarity","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"CuePurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectionId","type":"uint256"},{"indexed":false,"internalType":"enum I8BallCommon.Rarity","name":"rarity","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"CueUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rand","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"result","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"max","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"designIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"designId","type":"uint256"}],"name":"MandoHasWeightedDice","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":false,"internalType":"uint256","name":"collectionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RoyaltyPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"collectionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RoyaltyShareFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct I8BallCueMinter.MintConfig","name":"mintConfig","type":"tuple"},{"components":[{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"internalType":"struct I8BallCueMinter.AllowlistConfig","name":"allowlistConfig","type":"tuple"},{"internalType":"bool","name":"random","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"name":"addCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"components":[{"internalType":"enum I8BallCommon.Rarity","name":"rarity","type":"uint8"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"remaining","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"internalType":"struct I8BallCommon.Design[]","name":"designs","type":"tuple[]"}],"name":"addCollectionDesigns","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"_credits","type":"uint256"}],"name":"addCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"address[]","name":"wallets","type":"address[]"}],"name":"addToCollectionAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"buyRandomCue","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"credits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cue","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionAllowlist","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionAllowlistConfig","outputs":[{"components":[{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"internalType":"struct I8BallCueMinter.AllowlistConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"designId","type":"uint256"}],"name":"getCollectionDesign","outputs":[{"components":[{"internalType":"enum I8BallCommon.Rarity","name":"rarity","type":"uint8"},{"internalType":"uint256","name":"remaining","type":"uint256"}],"internalType":"struct I8BallCueMinter.DesignBase","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionDesignIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollectionIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionMintConfig","outputs":[{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct I8BallCueMinter.MintConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionRandom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getCollectionRoyaltyConfig","outputs":[{"components":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"basisPoints","type":"uint256"}],"internalType":"struct I8BallCueMinter.RoyaltyConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"getMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"name":"isAllowlisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintRandomCue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"designId","type":"uint256"}],"name":"mintSpecificCue","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"_credits","type":"uint256"}],"name":"removeCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"address[]","name":"wallets","type":"address[]"}],"name":"removeFromCollectionAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"requester","type":"address"}],"name":"requestOf","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256[]","name":"links","type":"uint256[]"},{"internalType":"uint256[]","name":"words","type":"uint256[]"}],"internalType":"struct IChainlinkVRFConsumer.Request","name":"","type":"tuple"}],"stateMutability":"view","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":"collectionId","type":"uint256"},{"components":[{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"internalType":"struct I8BallCueMinter.AllowlistConfig","name":"config","type":"tuple"}],"name":"setCollectionAllowlistConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct I8BallCueMinter.MintConfig","name":"config","type":"tuple"}],"name":"setCollectionMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"bool","name":"random","type":"bool"}],"name":"setCollectionRandom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"components":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"basisPoints","type":"uint256"}],"internalType":"struct I8BallCueMinter.RoyaltyConfig","name":"config","type":"tuple"}],"name":"setCollectionRoyaltyConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setCounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_cue","type":"address"}],"name":"setCue","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":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"power","type":"uint256"},{"internalType":"uint256","name":"accuracy","type":"uint256"},{"internalType":"uint256","name":"spin","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"}],"name":"upgradeCue","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"upgradePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]

60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051614cc96200012060003960008181610c4d01528181610c8d01528181610eeb01528181610f2b0152610fba0152614cc96000f3fe6080604052600436106102ae5760003560e01c80636f4cf76e11610175578063be541213116100dc578063e0072ada11610095578063fa0523ce1161006f578063fa0523ce14610883578063fa490592146108a3578063fd2de539146108b6578063fe5ff468146108d657600080fd5b8063e0072ada1461083b578063f031bc111461084e578063f0f442601461086357600080fd5b8063be5412131461076e578063bec780e01461078e578063ca15c873146107ae578063cba9e373146107ce578063cfc3b6e6146107ee578063d547741f1461081b57600080fd5b80638bb5d9c31161012e5780638bb5d9c3146106b75780639010d07c146106d757806391d14854146106f757806395947c9d14610717578063a217fddf14610744578063aff3a7851461075957600080fd5b80636f4cf76e1461060057806377c9e8d01461062057806379e2e31c146106405780638129fc1c1461066d5780638456cb5914610682578063871ff4051461069757600080fd5b806337f83afd116102195780635679a559116101d25780635679a5591461053a57806356a73ab21461055a5780635c975abb1461057a57806361d027b31461059257806364bf5344146105b3578063670216dd146105e057600080fd5b806337f83afd146104aa5780633f4ba83a146104bd57806341540b2c146104d25780634f1ef286146104f257806352d1902d14610505578063559e775b1461051a57600080fd5b8063287ad39f1161026b578063287ad39f146103da578063298dd1bb146103f15780632f2ff15d1461042a57806336568abe1461044a5780633659cfe61461046a578063368da1681461048a57600080fd5b806301ffc9a7146102b35780630bca773c146102e857806312615d261461030a5780631430bc51146103375780631fe543e31461037b578063248a9ca31461039b575b600080fd5b3480156102bf57600080fd5b506102d36102ce366004613ef7565b610904565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b50610308610303366004613f39565b61092f565b005b34801561031657600080fd5b5061032a610325366004613f66565b610a5e565b6040516102df9190613fba565b34801561034357600080fd5b50610357610352366004613f66565b610aa3565b6040805182516001600160a01b0316815260209283015192810192909252016102df565b34801561038757600080fd5b50610308610396366004614014565b610b16565b3480156103a757600080fd5b506103cc6103b6366004613f66565b600090815261012d602052604090206001015490565b6040519081526020016102df565b3480156103e657600080fd5b506103cc6102275481565b3480156103fd57600080fd5b5061022654610412906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b34801561043657600080fd5b506103086104453660046140db565b610b9e565b34801561045657600080fd5b506103086104653660046140db565b610bc9565b34801561047657600080fd5b5061030861048536600461410b565b610c43565b34801561049657600080fd5b506103086104a5366004614128565b610d22565b6103086104b8366004613f66565b610da8565b3480156104c957600080fd5b50610308610e73565b3480156104de57600080fd5b506102d36104ed3660046140db565b610e94565b610308610500366004614154565b610ee1565b34801561051157600080fd5b506103cc610fad565b34801561052657600080fd5b506103cc610535366004613f66565b611060565b34801561054657600080fd5b50610308610555366004614248565b6110d9565b34801561056657600080fd5b506103086105753660046142a4565b611195565b34801561058657600080fd5b5060335460ff166102d3565b34801561059e57600080fd5b5061022554610412906001600160a01b031681565b3480156105bf57600080fd5b506105d36105ce366004614366565b6112c8565b6040516102df91906143c0565b3480156105ec57600080fd5b506103086105fb366004614248565b6113e0565b34801561060c57600080fd5b506102d361061b366004613f66565b61149c565b34801561062c57600080fd5b5061030861063b366004613f39565b6114e0565b34801561064c57600080fd5b5061066061065b36600461410b565b6115f8565b6040516102df91906143e1565b34801561067957600080fd5b50610308611753565b34801561068e57600080fd5b50610308611908565b3480156106a357600080fd5b506103086106b2366004614128565b611927565b3480156106c357600080fd5b506103086106d2366004613f66565b6119b4565b3480156106e357600080fd5b506104126106f2366004614366565b6119d1565b34801561070357600080fd5b506102d36107123660046140db565b6119ea565b34801561072357600080fd5b50610737610732366004613f66565b611a16565b6040516102df9190614424565b34801561075057600080fd5b506103cc600081565b34801561076557600080fd5b5061032a611a80565b34801561077a57600080fd5b5061030861078936600461410b565b611a92565b34801561079a57600080fd5b506103086107a9366004613f39565b611acc565b3480156107ba57600080fd5b506103cc6107c9366004613f66565b611b9b565b3480156107da57600080fd5b506103086107e936600461443b565b611bb3565b3480156107fa57600080fd5b5061080e610809366004613f66565b611c16565b6040516102df919061445e565b34801561082757600080fd5b506103086108363660046140db565b611c5b565b6103086108493660046144ab565b611c81565b34801561085a57600080fd5b50610308611f7a565b34801561086f57600080fd5b5061030861087e36600461410b565b6120de565b34801561088f57600080fd5b5061073761089e366004613f66565b61219c565b6103086108b1366004614366565b612203565b3480156108c257600080fd5b506103086108d1366004614248565b612325565b3480156108e257600080fd5b506103cc6108f136600461410b565b61022c6020526000908152604090205481565b6000632165eccb60e21b6001600160e01b031983161480610929575061092982612514565b92915050565b610946600080516020614c74833981519152612539565b61095261022883612543565b6109775760405162461bcd60e51b815260040161096e906144e6565b60405180910390fd5b428135116109d65760405162461bcd60e51b815260206004820152602660248201527f3842616c6c4375654d696e7465723a3a496e76616c6964206d696e7420737461604482015265727454696d6560d01b606482015260840161096e565b6000816020013511610a355760405162461bcd60e51b815260206004820152602260248201527f3842616c6c4375654d696e7465723a3a496e76616c6964206d696e7420707269604482015261636560f01b606482015260840161096e565b600082815261022a602090815260409091208235815590820135600182015581815b5050505050565b6060610a6c61022883612543565b610a885760405162461bcd60e51b815260040161096e906144e6565b600082815261022a602052604090206109299060080161255b565b6040805180820190915260008082526020820152610ac361022883612543565b610adf5760405162461bcd60e51b815260040161096e906144e6565b50600090815261022a6020908152604091829020825180840190935260068101546001600160a01b03168352600701549082015290565b6101bf546001600160a01b03163314610b905760405162461bcd60e51b815260206004820152603660248201527f436861696e6c696e6b565246436f6e73756d6572426173653a3a4f6e6c7920636044820152751bdbdc991a5b985d1bdc8818d85b88199d5b199a5b1b60521b606482015260840161096e565b610b9a8282612568565b5050565b600082815261012d6020526040902060010154610bba81612539565b610bc483836125b7565b505050565b6001600160a01b0381163314610c395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161096e565b610b9a82826125da565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610c8b5760405162461bcd60e51b815260040161096e9061452f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610cd4600080516020614c2d833981519152546001600160a01b031690565b6001600160a01b031614610cfa5760405162461bcd60e51b815260040161096e9061457b565b610d03816125fd565b60408051600080825260208201909252610d1f91839190612614565b50565b610d39600080516020614c74833981519152612539565b6001600160a01b038216600090815261022c6020526040902054811115610d7657506001600160a01b0316600090815261022c6020526040812055565b6001600160a01b038216600090815261022c602052604081208054839290610d9f9084906145dd565b90915550505050565b610db061277f565b610db86127c5565b610dc18161281e565b60408051600380825260808201909252600091602082016060803683370190505090508181600081518110610df857610df86145f0565b602002602001018181525050610e0c612928565b81600181518110610e1f57610e1f6145f0565b602002602001018181525050610e348261294b565b81600281518110610e4757610e476145f0565b602002602001018181525050610e5f33600183612b47565b610e688261281e565b50610d1f600160c955565b610e8a600080516020614c74833981519152612539565b610e92612cd3565b565b6000610ea261022884612543565b610ebe5760405162461bcd60e51b815260040161096e906144e6565b600083815261022a60205260409020610eda9060040183612d25565b9392505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610f295760405162461bcd60e51b815260040161096e9061452f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610f72600080516020614c2d833981519152546001600160a01b031690565b6001600160a01b031614610f985760405162461bcd60e51b815260040161096e9061457b565b610fa1826125fd565b610b9a82826001612614565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461104d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161096e565b50600080516020614c2d83398151915290565b600081815261022a602052604081206002810154815483929142916110859190614606565b11156110c1576110986004820133612d25565b156110c15760038101546001820154612710916110b491614619565b6110be919061464e565b91505b60018101546110d19083906145dd565b949350505050565b6110f0600080516020614c74833981519152612539565b6110fc61022884612543565b6111185760405162461bcd60e51b815260040161096e906144e6565b806111355760405162461bcd60e51b815260040161096e90614662565b600083815261022a60205260408120905b82811015610a5757611182848483818110611163576111636145f0565b9050602002016020810190611178919061410b565b6004840190612d47565b508061118d816146a3565b915050611146565b6111ac600080516020614c74833981519152612539565b6111b861022888612d5c565b6112135760405162461bcd60e51b815260206004820152602660248201527f3842616c6c4375654d696e7465723a3a4578697374696e6720636f6c6c6563746044820152651a5bdb88125160d21b606482015260840161096e565b600087815261022a602090815260409091208535815585820135600182015584356002820155908401356003820155600b8101805460ff1916841515179055816112be576102265460405162a4bcfb60e11b81526001600160a01b039091169063014979f69061128b908b908b908b906004016146e5565b600060405180830381600087803b1580156112a557600080fd5b505af11580156112b9573d6000803e3d6000fd5b505050505b5050505050505050565b60408051808201909152600080825260208201526112e861022884612543565b6113045760405162461bcd60e51b815260040161096e906144e6565b600083815261022a602052604090206113206008820184612543565b6113865760405162461bcd60e51b815260206004820152603160248201527f3842616c6c4375654d696e7465723a3a4e6f6e2d6578697374656e74206f72206044820152701cdbdb190b5bdd5d0819195cda59db9259607a1b606482015260840161096e565b6000838152600a820160205260409081902081518083019092528054829060ff1660048111156113b8576113b8614388565b60048111156113c9576113c9614388565b815260200160018201548152505091505092915050565b6113f7600080516020614c74833981519152612539565b61140361022884612543565b61141f5760405162461bcd60e51b815260040161096e906144e6565b8061143c5760405162461bcd60e51b815260040161096e90614662565b600083815261022a60205260408120905b82811015610a575761148984848381811061146a5761146a6145f0565b905060200201602081019061147f919061410b565b6004840190612d68565b5080611494816146a3565b91505061144d565b60006114aa61022883612543565b6114c65760405162461bcd60e51b815260040161096e906144e6565b50600090815261022a60205260409020600b015460ff1690565b6114f7600080516020614c74833981519152612539565b61150361022883612543565b61151f5760405162461bcd60e51b815260040161096e906144e6565b602081013515801561153057508035155b8061154957506020810135158015906115495750803515155b6115655760405162461bcd60e51b815260040161096e906146ff565b6127108160200135106115cd5760405162461bcd60e51b815260206004820152602a60248201527f3842616c6c4375654d696e7465723a3a496e76616c696420616c6c6f776c69736044820152691d08191a5cd8dbdd5b9d60b21b606482015260840161096e565b600082815261022a602052604090208160028201610a57828281358155602082013560018201555050565b61161c60405180606001604052806000815260200160608152602001606081525090565b6116286101f583612d25565b6116745760405162461bcd60e51b815260206004820181905260248201527f436861696e6c696e6b565246436f6e73756d65723a3a4e6f2072657175657374604482015260640161096e565b6001600160a01b03821660009081526101f46020908152604091829020825160608101845281548152600182018054855181860281018601909652808652919492938581019392908301828280156116eb57602002820191906000526020600020905b8154815260200190600101908083116116d7575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561174357602002820191906000526020600020905b81548152602001906001019080831161172f575b5050505050815250509050919050565b600054610100900460ff16158080156117735750600054600160ff909116105b8061178d5750303b15801561178d575060005460ff166001145b6117f05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161096e565b6000805460ff191660011790558015611813576000805461ff0019166101001790555b61181b612d7d565b611823612dac565b61182b612ea6565b611833612ecd565b61183b612ea6565b61187d73d5d517abe5cf79b7e95ec98db0f0277788aff6347f83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d60676001612efc565b6706f05b59d3b200006102275561022680546001600160a01b03191673ecc82f602a7982a9464844dee6dbc751e3615bb41790556118c061022b80546001019055565b8015610d1f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b61191f600080516020614c74833981519152612539565b610e92612f88565b61193e600080516020614c74833981519152612539565b6001600160a01b038216600090815261022c6020526040902054606490611966908390614606565b111561198b57506001600160a01b0316600090815261022c6020526040902060649055565b6001600160a01b038216600090815261022c602052604081208054839290610d9f908490614606565b6119cb600080516020614c74833981519152612539565b61022b55565b600082815261015f60205260408120610eda9083612fc5565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6040805180820190915260008082526020820152611a3661022883612543565b611a525760405162461bcd60e51b815260040161096e906144e6565b50600090815261022a6020908152604091829020825180840190935260028101548352600301549082015290565b6060611a8d61022861255b565b905090565b611aa9600080516020614c74833981519152612539565b61022680546001600160a01b0319166001600160a01b0392909216919091179055565b611ae3600080516020614c74833981519152612539565b611aef61022883612543565b611b0b5760405162461bcd60e51b815260040161096e906144e6565b6020810135158015611b3257506000611b27602083018361410b565b6001600160a01b0316145b80611b615750602081013515801590611b6157506000611b55602083018361410b565b6001600160a01b031614155b611b7d5760405162461bcd60e51b815260040161096e906146ff565b600082815261022a602052604090208160068201610a578282614745565b600081815261015f6020526040812061092990612fd1565b611bca600080516020614c74833981519152612539565b611bd661022883612543565b611bf25760405162461bcd60e51b815260040161096e906144e6565b600091825261022a6020526040909120600b01805460ff1916911515919091179055565b6060611c2461022883612543565b611c405760405162461bcd60e51b815260040161096e906144e6565b600082815261022a602052604090206109299060040161255b565b600082815261012d6020526040902060010154611c7781612539565b610bc483836125da565b611c8961277f565b611c916127c5565b610226546040516334985b9960e01b8152600481018790526001600160a01b039091169060009082906334985b999060240160e060405180830381865afa158015611ce0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d049190614788565b905060008082516004811115611d1c57611d1c614388565b14611d445781516004811115611d3457611d34614388565b611d3f906006614606565b611d47565b60055b90506000610227548587898b611d5d9190614606565b611d679190614606565b611d719190614606565b611d7b9190614619565b905080341015611d9d5760405162461bcd60e51b815260040161096e90614815565b610225546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611dd8573d6000803e3d6000fd5b508783606001818151611deb9190614606565b905250608083018051889190611e02908390614606565b90525060a083018051879190611e19908390614606565b90525060c083018051869190611e30908390614606565b90525060608301518210801590611e4b575081836080015111155b8015611e5b5750818360a0015111155b8015611e6b5750818360c0015111155b611ec75760405162461bcd60e51b815260206004820152602760248201527f3842616c6c4375654d696e7465723a3a496e76616c6964207570677261646520604482015266616d6f756e747360c81b606482015260840161096e565b604051637ec0722d60e11b81526001600160a01b0385169063fd80e45a90611ef79033908d908890600401614859565b600060405180830381600087803b158015611f1157600080fd5b505af1158015611f25573d6000803e3d6000fd5b505050602084015184516040513393507f5cfa1078ee34a46e31f28532801a74fda1a0cd45b83f4c78c7fbb24abec85e4192611f64928e9287906148c7565b60405180910390a250505050610a57600160c955565b611f8261277f565b611f8a6127c5565b600080611f9633612fdb565b915091506000825111611ffc5760405162461bcd60e51b815260206004820152602860248201527f3842616c6c4375654d696e7465723a3a52657175657374206973207374696c6c6044820152672070656e64696e6760c01b606482015260840161096e565b600061207582600081518110612014576120146145f0565b602002602001015161205561022a600086600081518110612037576120376145f0565b6020026020010151815260200190815260200160002060080161255b565b85600081518110612068576120686145f0565b602002602001015161314f565b90506120d18260008151811061208d5761208d6145f0565b602002602001015182846002815181106120a9576120a96145f0565b6020026020010151856001815181106120c4576120c46145f0565b6020026020010151613339565b505050610e92600160c955565b6120f5600080516020614c74833981519152612539565b6001600160a01b0381161580159061211c5750610225546001600160a01b03828116911614155b6121795760405162461bcd60e51b815260206004820152602860248201527f3842616c6c4375654d696e7465723a3a496e76616c6964207472656173757279604482015267206164647265737360c01b606482015260840161096e565b61022580546001600160a01b0319166001600160a01b0392909216919091179055565b60408051808201909152600080825260208201526121bc61022883612543565b6121d85760405162461bcd60e51b815260040161096e906144e6565b50600090815261022a6020908152604091829020825180840190935280548352600101549082015290565b61220b61277f565b6122136127c5565b61221c8261281e565b600082815261022a60205260409020600b015460ff16156122985760405162461bcd60e51b815260206004820152603060248201527f3842616c6c4375654d696e7465723a3a496e76616c696420737065636966696360448201526f1036b4b73a1031b7b63632b1ba34b7b760811b606482015260840161096e565b600082815261022a602052604090206122b49060080182612543565b6123005760405162461bcd60e51b815260206004820181905260248201527f3842616c6c4375654d696e7465723a3a496e76616c69642064657369676e4964604482015260640161096e565b61231b828261230e8561294b565b612316612928565b613339565b610b9a600160c955565b61233c600080516020614c74833981519152612539565b61234861022884612543565b6123645760405162461bcd60e51b815260040161096e906144e6565b600083815261022a60205260408120905b828110156124b0576123b2848483818110612392576123926145f0565b90506020028101906123a491906148f1565b600884019060200135612d5c565b5060405180604001604052808585848181106123d0576123d06145f0565b90506020028101906123e291906148f1565b6123f0906020810190614911565b600481111561240157612401614388565b8152602001858584818110612418576124186145f0565b905060200281019061242a91906148f1565b604001359052600a83016000868685818110612448576124486145f0565b905060200281019061245a91906148f1565b602090810135825281019190915260400160002081518154829060ff1916600183600481111561248c5761248c614388565b021790555060209190910151600190910155806124a8816146a3565b915050612375565b506102265460405163fd2de53960e01b81526001600160a01b039091169063fd2de539906124e69087908790879060040161492e565b600060405180830381600087803b15801561250057600080fd5b505af11580156112be573d6000803e3d6000fd5b60006001600160e01b03198216631e78b8c760e21b1480610929575061092982613490565b610d1f81336134b5565b60008181526001830160205260408120541515610eda565b60606000610eda8361350e565b60006125766101f78461356a565b6001600160a01b03811660009081526101f4602090815260409091208451929350916125aa91600284019190860190613e7d565b50610a576101f785613576565b6125c18282613582565b600082815261015f60205260409020610bc49082612d68565b6125e48282613609565b600082815261015f60205260409020610bc49082612d47565b610d1f600080516020614c74833981519152612539565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561264757610bc483613671565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156126a1575060408051601f3d908101601f1916820190925261269e91810190614a22565b60015b6127045760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161096e565b600080516020614c2d83398151915281146127735760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161096e565b50610bc483838361370d565b60335460ff1615610e925760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161096e565b600260c954036128175760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161096e565b600260c955565b61282a61022882612543565b6128465760405162461bcd60e51b815260040161096e906144e6565b600081815261022a602052604090205442101580612868575061286833613738565b6128c05760405162461bcd60e51b8152602060048201526024808201527f3842616c6c4375654d696e7465723a3a4d696e7420686173206e6f74207374616044820152631c9d195960e21b606482015260840161096e565b600081815261022a602052604081206128db90600801612fd1565b11610d1f5760405162461bcd60e51b815260206004820152601860248201527f3842616c6c4375654d696e7465723a3a536f6c64206f75740000000000000000604482015260640161096e565b60008061293561022b5490565b905061294661022b80546001019055565b919050565b33600090815261022c60205260408120541561298a5733600090815261022c6020526040812080549161297d83614a3b565b9091555060009392505050565b600061299583611060565b905080348111156129b85760405162461bcd60e51b815260040161096e90614815565b600084815261022a6020526040902060060180546001600160a01b031615612b025760006127108260010154856129ef9190614619565b6129f9919061464e565b9050612a0581846145dd565b610225546040519194506000916001600160a01b039091169083908381818185875af1925050503d8060008114612a58576040519150601f19603f3d011682016040523d82523d6000602084013e612a5d565b606091505b505090508015612ab557825460408051898152602081018590526001600160a01b039092169133917f98ffdf4f5be5af8de356ea9db372549d2182650280d5234acb94a9955e788c56910160405180910390a3612aff565b825460408051898152602081018590526001600160a01b039092169133917f820d26b4d2455e90e3d3f84dc019d6873705f91d9ec310888cc6357f0914988d910160405180910390a35b50505b610225546040516001600160a01b039091169083156108fc029084906000818181858888f19350505050158015612b3d573d6000803e3d6000fd5b5091949350505050565b612b536101f584612d25565b15612baf5760405162461bcd60e51b815260206004820152602660248201527f436861696e6c696e6b565246436f6e73756d65723a3a4578697374696e672072604482015265195c5d595cdd60d21b606482015260840161096e565b6000612bbd83614e20614a52565b612bca90620186a0614a7e565b6001600160a01b0385811660009081526101f46020526040908190206101f1546101f2546101f35493516305d3b1d360e41b8152600481019190915267ffffffffffffffff84166024820152600160401b90930461ffff16604484015263ffffffff8086166064850152881660848401529394509290911690635d3b1d309060a4016020604051808303816000875af1158015612c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c8f9190614a22565b81558251612ca69060018301906020860190613e7d565b50612cb36101f586612d68565b508054612cc4906101f79087613752565b505050505050565b600160c955565b612cdb613768565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b03811660009081526001830160205260408120541515610eda565b6000610eda836001600160a01b0384166137b1565b6000610eda83836138ab565b6000610eda836001600160a01b0384166138ab565b600054610100900460ff16612da45760405162461bcd60e51b815260040161096e90614a9b565b610e926138fa565b600054610100900460ff16612dd35760405162461bcd60e51b815260040161096e90614a9b565b612ddb612ea6565b612de66000336125b7565b612dfe600080516020614c74833981519152336125b7565b612e287f364d3d7565c7a8300c96fd53e065d19b65848d7b23b3191adcd55621c744223c336125b7565b612e527f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336125b7565b612e7c7ff18b77e1ef402111bacb54bd5e03494cbdba92fbd1bd3bbcc1ce77e69b42ea6c336125b7565b610e927f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f336125b7565b600054610100900460ff16610e925760405162461bcd60e51b815260040161096e90614a9b565b600054610100900460ff16612ef45760405162461bcd60e51b815260040161096e90614a9b565b610e9261392d565b600054610100900460ff16612f235760405162461bcd60e51b815260040161096e90614a9b565b612f2c84613954565b6101f180546001600160a01b039095166001600160a01b0319909516949094179093556101f380546101f29390935561ffff909316600160401b0269ffffffffffffffffffff1990921667ffffffffffffffff90911617179055565b612f9061277f565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d083390565b6000610eda8383613a17565b6000610929825490565b606080612fea6101f584612d25565b6130365760405162461bcd60e51b815260206004820181905260248201527f436861696e6c696e6b565246436f6e73756d65723a3a4e6f2072657175657374604482015260640161096e565b6001600160a01b03831660009081526101f4602090815260409182902060028101805484518185028101850190955280855291939290919083018282801561309d57602002820191906000526020600020905b815481526020019060010190808311613089575b50505050509250806001018054806020026020016040519081016040528092919081815260200182805480156130f257602002820191906000526020600020905b8154815260200190600101908083116130de575b5050505050915061310e846101f5612d4790919063ffffffff16565b506001600160a01b03841660009081526101f460205260408120818155906131396001830182613ec8565b613147600283016000613ec8565b505050915091565b600080805b84518110156131c15761022a6000878152602001908152602001600020600a016000868381518110613188576131886145f0565b6020026020010151815260200190815260200160002060010154826131ad9190614606565b9150806131b9816146a3565b915050613154565b5060006131ce8285614ae6565b90506000805b86518110156132d657600061022a60008a8152602001908152602001600020600a01600089848151811061320a5761320a6145f0565b60200260200101518152602001908152602001600020600101548361322f9190614606565b905061323c6001826145dd565b84116132c2577f30df3c3d54e931c55cce4efd14aa05a324344df80b8bc9f50a548c04e62bd6bd878686848c8d888151811061327a5761327a6145f0565b602002602001015160405161329496959493929190614afa565b60405180910390a18782815181106132ae576132ae6145f0565b602002602001015195505050505050610eda565b9150806132ce816146a3565b9150506131d4565b5060405162461bcd60e51b815260206004820152603160248201527f3842616c6c4375654d696e7465723a3a4572726f722063616c63756c6174696e60448201527019c81c985b991bdb4819195cda59db9259607a1b606482015260840161096e565b600084815261022a60209081526040808320868452600a81019092528220600181018054929391929161336b83614a3b565b9190505550806001015460000361338b576133896008830186613a41565b505b610226546040805160e0810190915282546001600160a01b03909216916301e65df1913391879190819060ff1660048111156133c9576133c9614388565b81526020018b81526020018a815260200160018152602001600181526020016001815260200160018152506040518463ffffffff1660e01b815260040161341293929190614859565b600060405180830381600087803b15801561342c57600080fd5b505af1158015613440573d6000803e3d6000fd5b505082546040513393507f20a1a53afff5899d6a197cadef7db93281256627d98124e9756d69cef4c83f0592506134809187918b9160ff16908a906148c7565b60405180910390a2505050505050565b60006001600160e01b03198216631fe543e360e01b1480610929575061092982613a4d565b6134bf82826119ea565b610b9a576134cc81613a72565b6134d7836020613a84565b6040516020016134e8929190614b5c565b60408051601f198184030181529082905262461bcd60e51b825261096e91600401614bd1565b60608160000180548060200260200160405190810160405280929190818152602001828054801561355e57602002820191906000526020600020905b81548152602001906001019080831161354a575b50505050509050919050565b6000610eda8383613c20565b6000610eda8383613c90565b61358c82826119ea565b610b9a57600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556135c53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61361382826119ea565b15610b9a57600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0381163b6136de5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161096e565b600080516020614c2d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61371683613cad565b6000825111806137235750805b15610bc4576137328383613ced565b50505050565b6000610929600080516020614c74833981519152836119ea565b60006110d184846001600160a01b038516613de1565b60335460ff16610e925760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161096e565b6000818152600183016020526040812054801561389a5760006137d56001836145dd565b85549091506000906137e9906001906145dd565b905081811461384e576000866000018281548110613809576138096145f0565b906000526020600020015490508087600001848154811061382c5761382c6145f0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061385f5761385f614c04565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610929565b6000915050610929565b5092915050565b60008181526001830160205260408120546138f257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610929565b506000610929565b600054610100900460ff166139215760405162461bcd60e51b815260040161096e90614a9b565b6033805460ff19169055565b600054610100900460ff16612ccc5760405162461bcd60e51b815260040161096e90614a9b565b600054610100900460ff1661397b5760405162461bcd60e51b815260040161096e90614a9b565b613983612ea6565b6001600160a01b0381166139f45760405162461bcd60e51b815260206004820152603260248201527f436861696e6c696e6b565246436f6e73756d6572426173653a3a436f6f7264696044820152716e61746f72207a65726f206164647265737360701b606482015260840161096e565b6101bf80546001600160a01b0319166001600160a01b0392909216919091179055565b6000826000018281548110613a2e57613a2e6145f0565b9060005260206000200154905092915050565b6000610eda83836137b1565b60006001600160e01b03198216635a05180f60e01b1480610929575061092982613dfe565b60606109296001600160a01b03831660145b60606000613a93836002614619565b613a9e906002614606565b67ffffffffffffffff811115613ab657613ab6613fcd565b6040519080825280601f01601f191660200182016040528015613ae0576020820181803683370190505b509050600360fc1b81600081518110613afb57613afb6145f0565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613b2a57613b2a6145f0565b60200101906001600160f81b031916908160001a9053506000613b4e846002614619565b613b59906001614606565b90505b6001811115613bd1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b8d57613b8d6145f0565b1a60f81b828281518110613ba357613ba36145f0565b60200101906001600160f81b031916908160001a90535060049490941c93613bca81614a3b565b9050613b5c565b508315610eda5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161096e565b600081815260028301602052604081205480151580613c445750613c448484613e33565b610eda5760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b65790000604482015260640161096e565b60008181526002830160205260408120819055610eda8383613a41565b613cb681613671565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613d555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161096e565b600080846001600160a01b031684604051613d709190614c1a565b600060405180830381855af49150503d8060008114613dab576040519150601f19603f3d011682016040523d82523d6000602084013e613db0565b606091505b5091509150613dd88282604051806060016040528060278152602001614c4d60279139613e3f565b95945050505050565b600082815260028401602052604081208290556110d18484612d5c565b60006001600160e01b03198216637965db0b60e01b148061092957506301ffc9a760e01b6001600160e01b0319831614610929565b6000610eda8383612543565b60608315613e4e575081610eda565b610eda8383815115613e635781518083602001fd5b8060405162461bcd60e51b815260040161096e9190614bd1565b828054828255906000526020600020908101928215613eb8579160200282015b82811115613eb8578251825591602001919060010190613e9d565b50613ec4929150613ee2565b5090565b5080546000825590600052602060002090810190610d1f91905b5b80821115613ec45760008155600101613ee3565b600060208284031215613f0957600080fd5b81356001600160e01b031981168114610eda57600080fd5b600060408284031215613f3357600080fd5b50919050565b60008060608385031215613f4c57600080fd5b82359150613f5d8460208501613f21565b90509250929050565b600060208284031215613f7857600080fd5b5035919050565b600081518084526020808501945080840160005b83811015613faf57815187529582019590820190600101613f93565b509495945050505050565b602081526000610eda6020830184613f7f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561400c5761400c613fcd565b604052919050565b6000806040838503121561402757600080fd5b8235915060208084013567ffffffffffffffff8082111561404757600080fd5b818601915086601f83011261405b57600080fd5b81358181111561406d5761406d613fcd565b8060051b915061407e848301613fe3565b818152918301840191848101908984111561409857600080fd5b938501935b838510156140b65784358252938501939085019061409d565b8096505050505050509250929050565b6001600160a01b0381168114610d1f57600080fd5b600080604083850312156140ee57600080fd5b823591506020830135614100816140c6565b809150509250929050565b60006020828403121561411d57600080fd5b8135610eda816140c6565b6000806040838503121561413b57600080fd5b8235614146816140c6565b946020939093013593505050565b6000806040838503121561416757600080fd5b8235614172816140c6565b915060208381013567ffffffffffffffff8082111561419057600080fd5b818601915086601f8301126141a457600080fd5b8135818111156141b6576141b6613fcd565b6141c8601f8201601f19168501613fe3565b915080825287848285010111156141de57600080fd5b80848401858401376000848284010152508093505050509250929050565b60008083601f84011261420e57600080fd5b50813567ffffffffffffffff81111561422657600080fd5b6020830191508360208260051b850101111561424157600080fd5b9250929050565b60008060006040848603121561425d57600080fd5b83359250602084013567ffffffffffffffff81111561427b57600080fd5b614287868287016141fc565b9497909650939450505050565b8035801515811461294657600080fd5b6000806000806000806000610100888a0312156142c057600080fd5b87359650602088013567ffffffffffffffff808211156142df57600080fd5b818a0191508a601f8301126142f357600080fd5b81358181111561430257600080fd5b8b602082850101111561431457600080fd5b60208301985080975050505061432d8960408a01613f21565b935061433c8960808a01613f21565b925061434a60c08901614294565b915061435860e08901614294565b905092959891949750929550565b6000806040838503121561437957600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600581106143bc57634e487b7160e01b600052602160045260246000fd5b9052565b60006040820190506143d382845161439e565b602092830151919092015290565b602081528151602082015260006020830151606060408401526144076080840182613f7f565b90506040840151601f19848303016060850152613dd88282613f7f565b815181526020808301519082015260408101610929565b6000806040838503121561444e57600080fd5b82359150613f5d60208401614294565b6020808252825182820181905260009190848201906040850190845b8181101561449f5783516001600160a01b03168352928401929184019160010161447a565b50909695505050505050565b600080600080600060a086880312156144c357600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60208082526029908201527f3842616c6c4375654d696e7465723a3a4e6f6e2d6578697374656e7420636f6c6040820152681b1958dd1a5bdb925960ba1b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610929576109296145c7565b634e487b7160e01b600052603260045260246000fd5b80820180821115610929576109296145c7565b6000816000190483118215151615614633576146336145c7565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261465d5761465d614638565b500490565b60208082526021908201527f3842616c6c4375654d696e7465723a3a456d7074792077616c6c6574206c69736040820152601d60fa1b606082015260800190565b6000600182016146b5576146b56145c7565b5060010190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000613dd86040830184866146bc565b60208082526026908201527f3842616c6c4375654d696e7465723a3a496e76616c696420726f79616c747920604082015265636f6e66696760d01b606082015260800190565b8135614750816140c6565b81546001600160a01b0319166001600160a01b03919091161781556020919091013560019190910155565b60058110610d1f57600080fd5b600060e0828403121561479a57600080fd5b60405160e0810181811067ffffffffffffffff821117156147bd576147bd613fcd565b60405282516147cb8161477b565b808252506020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b60208082526024908201527f3842616c6c4375654d696e7465723a3a496e73756666696369656e74207061796040820152631b595b9d60e21b606082015260800190565b6001600160a01b038416815260208101839052815161012082019061488290604084019061439e565b6020830151606083015260408301516080830152606083015160a0830152608083015160c083015260a083015160e083015260c0830151610100830152949350505050565b84815260208101849052608081016148e2604083018561439e565b82606083015295945050505050565b60008235607e1983360301811261490757600080fd5b9190910192915050565b60006020828403121561492357600080fd5b8135610eda8161477b565b600060408083018684526020828186015281868352606092508286019050828760051b8701018860005b89811015614a1257888303605f190184528135368c9003607e1901811261497e57600080fd5b8b016080813561498d8161477b565b614997868261439e565b508682013587860152888201358986015287820135601e198336030181126149be57600080fd5b90910186810191903567ffffffffffffffff8111156149dc57600080fd5b8036038313156149eb57600080fd5b81898701526149fd82870182856146bc565b96880196955050509185019150600101614958565b50909a9950505050505050505050565b600060208284031215614a3457600080fd5b5051919050565b600081614a4a57614a4a6145c7565b506000190190565b600063ffffffff80831681851681830481118215151615614a7557614a756145c7565b02949350505050565b63ffffffff8181168382160190808211156138a4576138a46145c7565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082614af557614af5614638565b500690565b86815285602082015284604082015283606082015260c060808201526000614b2560c0830185613f7f565b90508260a0830152979650505050505050565b60005b83811015614b53578181015183820152602001614b3b565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614b94816017850160208801614b38565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614bc5816028840160208801614b38565b01602801949350505050565b6020815260008251806020840152614bf0816040850160208701614b38565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603160045260246000fd5b60008251614907818460208701614b3856fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220275b8e88db3e04114c5f54535d9c9957b9ca99eba397e837b266c497cc80655464736f6c63430008100033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading