ETH Price: $2,573.51 (-4.71%)

Contract

0x6019b13756bfdD09C1b3f6E2c33134f48D919188
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Request Seed163505032023-01-06 21:43:11763 days ago1673041391IN
0x6019b137...48D919188
0 ETH0.0021688819.09377095
Request Seed163504972023-01-06 21:41:59763 days ago1673041319IN
0x6019b137...48D919188
0 ETH0.0020881218.3828801
Request Seed163504892023-01-06 21:40:23763 days ago1673041223IN
0x6019b137...48D919188
0 ETH0.0023491520.68083764
Request Seed163418212023-01-05 16:36:11764 days ago1672936571IN
0x6019b137...48D919188
0 ETH0.0035480731.23549056
Request Seed163418062023-01-05 16:32:59764 days ago1672936379IN
0x6019b137...48D919188
0 ETH0.0025600922.53781798
Request Seed163417892023-01-05 16:29:35764 days ago1672936175IN
0x6019b137...48D919188
0 ETH0.0022389619.7107778
Request Seed163356402023-01-04 19:53:11765 days ago1672861991IN
0x6019b137...48D919188
0 ETH0.0018366416.16896673
Request Seed163283572023-01-03 19:30:23766 days ago1672774223IN
0x6019b137...48D919188
0 ETH0.0047693841.98733495
Request Seed163236562023-01-03 3:45:47766 days ago1672717547IN
0x6019b137...48D919188
0 ETH0.0022256219.59336511
Request Seed163236052023-01-03 3:35:35766 days ago1672716935IN
0x6019b137...48D919188
0 ETH0.0021447418.88126308
Request Seed163230462023-01-03 1:43:35766 days ago1672710215IN
0x6019b137...48D919188
0 ETH0.0016893314.87211977
Request Seed163042422022-12-31 10:47:11769 days ago1672483631IN
0x6019b137...48D919188
0 ETH0.0020719218.24023983
Request Seed163039062022-12-31 9:39:35769 days ago1672479575IN
0x6019b137...48D919188
0 ETH0.0015978214.06650853
Request Seed163038902022-12-31 9:36:23769 days ago1672479383IN
0x6019b137...48D919188
0 ETH0.0017379215.29985268
Request Seed163038812022-12-31 9:34:35769 days ago1672479275IN
0x6019b137...48D919188
0 ETH0.0017167615.11358415
Request Seed163038702022-12-31 9:32:23769 days ago1672479143IN
0x6019b137...48D919188
0 ETH0.0015858113.96073177
Request Seed163038542022-12-31 9:28:59769 days ago1672478939IN
0x6019b137...48D919188
0 ETH0.0016521814.54503935
Request Seed163038452022-12-31 9:27:11769 days ago1672478831IN
0x6019b137...48D919188
0 ETH0.001653814.55927322
Request Seed163038332022-12-31 9:24:47769 days ago1672478687IN
0x6019b137...48D919188
0 ETH0.0017056315.01560809
Request Seed163038232022-12-31 9:22:47769 days ago1672478567IN
0x6019b137...48D919188
0 ETH0.0016538314.5595237
Request Seed163038162022-12-31 9:21:23769 days ago1672478483IN
0x6019b137...48D919188
0 ETH0.0017503715.40946328
Request Seed163037962022-12-31 9:17:23769 days ago1672478243IN
0x6019b137...48D919188
0 ETH0.0017981915.83042598
Request Seed163037872022-12-31 9:15:35769 days ago1672478135IN
0x6019b137...48D919188
0 ETH0.0019400417.0791906
Request Seed163037562022-12-31 9:09:23769 days ago1672477763IN
0x6019b137...48D919188
0 ETH0.0016157614.22442897
Request Seed163037422022-12-31 9:06:35769 days ago1672477595IN
0x6019b137...48D919188
0 ETH0.0017331715.25800157
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AnomuraSeeder

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : AnomuraSeeder.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

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

import {AccessControlEnumerable, IAccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import {LicenseVersion, CantBeEvil} from "./CantBeEvil.sol";
import {IAnomuraEquipment} from "./interfaces/IAnomuraEquipment.sol";
import {IEquipmentData} from "./EquipmentData.sol";
import {IAnomuraEquipment, EquipmentMetadata, EquipmentType, EquipmentRarity} from "./interfaces/IAnomuraEquipment.sol";
import {IAnomuraSeeder} from "./interfaces/IAnomuraSeeder.sol";

///@dev seeder for equipment contract. This is not upgradeable
contract AnomuraSeeder is
    IAnomuraSeeder,
    VRFConsumerBaseV2,
    AccessControlEnumerable,
    CantBeEvil,
    AutomationCompatibleInterface
{
    IEquipmentData public equipmentData;
    IAnomuraEquipment public equipmentContract;
    VRFCoordinatorV2Interface public coordinator;

    address private _automationRegistry;

    bytes32 public keyHash;
    bytes32 public constant SEEDER_ROLE = keccak256("SEEDER_ROLE");

    uint16 private constant REQUEST_CONFIRMATIONS = 3;
    uint32 private constant CALLBACK_GAS_LIMIT = 240000;
    uint32 private constant NUM_WORDS = 1;
    uint64 public subscriptionId;
    uint256 private constant BATCH_SIZE = 50;

    mapping(uint256 => uint256) private _requestIdToGeneration;

    // genId => seed
    mapping(uint256 => uint256) private genSeed;

    /// @notice emitted when a random number is returned from Vrf callback
    /// @param requestId the request identifier, initially returned by {requestRandomness}
    /// @param randomness random number generated by chainlink vrf
    event RequestSeedFulfilled(uint256 indexed requestId, uint256 randomness);

    constructor(
        address coordinator_,
        bytes32 keyHash_,
        uint64 subscriptionId_,
        address equipmentData_
    )
        VRFConsumerBaseV2(address(coordinator_))
        CantBeEvil(LicenseVersion.PUBLIC)
    {
        coordinator = VRFCoordinatorV2Interface(address(coordinator_));
        keyHash = keyHash_;
        subscriptionId = subscriptionId_;
        equipmentData = IEquipmentData(equipmentData_);

        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(SEEDER_ROLE, _msgSender());
    }

    function requestSeed(uint256 _generationId)
        external
        onlyRole(SEEDER_ROLE)
        returns (uint256 requestId)
    {
        require(
            address(equipmentContract) != address(0x0),
            "Equipment contract not set"
        );
        if (equipmentContract.totalSupply() == 0) {
            revert("No token minted yet.");
        }
        uint256 divider = equipmentContract.totalSupply() / BATCH_SIZE;

        if (_generationId < 1 || _generationId > divider + 1) {
            revert("Invalid Generation Id");
        }
        if (genSeed[_generationId] != 0) {
            revert("Seed already set!");
        }
        requestId = coordinator.requestRandomWords(
            keyHash,
            subscriptionId,
            REQUEST_CONFIRMATIONS,
            CALLBACK_GAS_LIMIT,
            NUM_WORDS
        );

        _requestIdToGeneration[requestId] = _generationId;
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords)
        internal
        override
    {
        uint256 _generationId = _requestIdToGeneration[requestId];

        genSeed[_generationId] = randomWords[0];
        emit RequestSeedFulfilled(_generationId, randomWords[0]);
    }

    /// @dev To set the metadata manually instead of Chainlink Nodes, provided there is a seed for the tokenId.
    function setMetadataForToken(uint256 _tokenId) external
    {
        require(
            address(equipmentContract) != address(0x0),
            "Equipment contract not set"
        );
         require(
            address(equipmentData) != address(0x0),
            "Equipment data not set"
        );
        require(equipmentContract.isTokenExists(_tokenId), "Token not exists");
        require(equipmentContract.isMetadataReveal(_tokenId) == false, "Metadata revealed");

        uint256 _generationId = getGenerationOfToken(_tokenId);
        uint256 _generationSeed = genSeed[_generationId];

        require(_generationSeed != 0, "Seed not set for gen");

        uint256 _seedForThisToken = uint256(
            keccak256(abi.encode(_generationSeed, _tokenId))
        );

        string memory equipmentName;
        EquipmentRarity rarity;
        EquipmentType typeOf = equipmentData.pluckType(_seedForThisToken);

        if (typeOf == EquipmentType.BODY) {
            (equipmentName, rarity) = equipmentData.pluckBody(
                _seedForThisToken
            );
        } else if (typeOf == EquipmentType.CLAWS) {
            (equipmentName, rarity) = equipmentData.pluckClaws(
                _seedForThisToken
            );
        } else if (typeOf == EquipmentType.LEGS) {
            (equipmentName, rarity) = equipmentData.pluckLegs(
                _seedForThisToken
            );
        } else if (typeOf == EquipmentType.SHELL) {
            (equipmentName, rarity) = equipmentData.pluckShell(
                _seedForThisToken
            );
        } else if (typeOf == EquipmentType.HABITAT) {
            (equipmentName, rarity) = equipmentData.pluckHabitat(
                _seedForThisToken
            );
        } else if (typeOf == EquipmentType.HEADPIECES) {
            (equipmentName, rarity) = equipmentData.pluckHeadpieces(
                _seedForThisToken
            );
        } else {
            revert InvalidValue();
        }

        EquipmentMetadata memory metaData = EquipmentMetadata({
            name: equipmentName,
            equipmentRarity: rarity,
            equipmentType: typeOf
        });

        bytes memory _dataToSet = abi.encode(_tokenId, metaData);
        equipmentContract.revealMetadataForToken(_dataToSet);
    }

    function getGenerationOfToken(uint256 _tokenId)
        public
        view
        returns (uint256)
    {
        if (!equipmentContract.isTokenExists(_tokenId)) {
            /* 
            As we want to allow the upkeep to keep running for token that existed within the range.
            We just return 0 and check that the 0 generation is an invalid generation 
             */
            return 0;
        }
        uint256 divider = _tokenId / BATCH_SIZE;
        return divider + 1;
    }

    /// @dev Check() to be called by Chainlink automation nodes
    /// @param checkerData the data can be decoded into lower and upper bound.
    /// 1. Read the token metadata
    /// 2. If metadata not set, then put into array to be processed
    /// 3. Processing the array of token, get its seed and calculate its equipment type, name, rarity
    /// 4. Hash the data for the perform function.
    function checkUpkeep(bytes calldata checkerData)
        external
        view
        override
        returns (bool canExec, bytes memory execPayload)
    {
        (uint256 lowerBound, uint256 upperBound) = abi.decode(
            checkerData,
            (uint256, uint256)
        );

        require(
            lowerBound > 0 &&
                upperBound <= equipmentContract.totalSupply() &&
                lowerBound <= upperBound,
            "Lower and Upper not correct"
        );
        require(
            address(equipmentContract) != address(0x0),
            "Equipment not set"
        );
        require(
            address(equipmentData) != address(0x0),
            "Equipment Data not set"
        );

        uint256 counter = 0;

        for (uint256 i = 0; i < upperBound - lowerBound + 1; i++) {
            uint256 tokenId = lowerBound + i;

            if (
                !equipmentContract.isTokenExists(tokenId) ||
                equipmentContract.isMetadataReveal(tokenId) == true
            ) {
                continue;
            }

            uint256 _generationId = getGenerationOfToken(tokenId);
            uint256 _seed = genSeed[_generationId];

            /* When generation Id is 0 or genSeed mapping is not set by Chainlink VRF, then _seed is 0 */
            if (_seed == 0) {
                continue;
            }

            counter++;
            if (counter == 10) {
                /* 
                1. Due to gas limit on chainlink vs gelato, we split this into chunks, allowing the nodes to execute multiple times
                2. Each chunk processing only 10 tokens, provided the range may have 100 tokens.
                3. The next chunk only process the tokens that do not have metadata set yet.
                 */
                break;
            }
        }

        if (counter == 0) {
            return (false, "Meta set for range");
        }

        canExec = false;

        /* to determine how many elements in an array need to update */
        uint256[] memory tokenIds = new uint256[](counter);
        EquipmentMetadata[] memory metaDataArray = new EquipmentMetadata[](
            counter
        );

        uint256 indexToAdd = 0;
        for (uint256 i = 0; i < upperBound - lowerBound + 1; i++) {
            uint256 tokenId = lowerBound + i;

            uint256 _generationId = getGenerationOfToken(tokenId);
            uint256 _generationSeed = genSeed[_generationId];

            if (
                equipmentContract.isTokenExists(tokenId) &&
                _generationSeed != 0 &&
                equipmentContract.isMetadataReveal(tokenId) == false
            ) {
                // do not access array index using tokenId as it is not be the correct index of the array
                canExec = true;
                tokenIds[indexToAdd] = tokenId;

                uint256 _seedForThisToken = uint256(
                    keccak256(abi.encode(_generationSeed, tokenId))
                );
                string memory equipmentName;
                EquipmentRarity rarity;
                EquipmentType typeOf = equipmentData.pluckType(
                    _seedForThisToken
                );

                if (typeOf == EquipmentType.BODY) {
                    (equipmentName, rarity) = equipmentData.pluckBody(
                        _seedForThisToken
                    );
                } else if (typeOf == EquipmentType.CLAWS) {
                    (equipmentName, rarity) = equipmentData.pluckClaws(
                        _seedForThisToken
                    );
                } else if (typeOf == EquipmentType.LEGS) {
                    (equipmentName, rarity) = equipmentData.pluckLegs(
                        _seedForThisToken
                    );
                } else if (typeOf == EquipmentType.SHELL) {
                    (equipmentName, rarity) = equipmentData.pluckShell(
                        _seedForThisToken
                    );
                } else if (typeOf == EquipmentType.HABITAT) {
                    (equipmentName, rarity) = equipmentData.pluckHabitat(
                        _seedForThisToken
                    );
                } else if (typeOf == EquipmentType.HEADPIECES) {
                    (equipmentName, rarity) = equipmentData.pluckHeadpieces(
                        _seedForThisToken
                    );
                } else {
                    return (false, "Invalid equipment type");
                }

                metaDataArray[indexToAdd] = EquipmentMetadata({
                    name: equipmentName,
                    equipmentRarity: rarity,
                    equipmentType: typeOf
                });

                indexToAdd++;
            }
            if (indexToAdd == 10) { /*index to add and counter must match, there should be 10 items to process each chunk */
                break;
            }
        }

        if (canExec == false) {
            return (false, "Nothing to set");
        }

        bytes memory performData = abi.encode(tokenIds, metaDataArray);
        return (canExec, performData);
    }

    /// @dev Function to be executed by Chainlink automation node, based on the data returned by checkUpkeep()
    /// @param performData the data returned by checkUpkeep
    /// Should only be called by automation registry.
    function performUpkeep(bytes calldata performData) external {
        require(
            _automationRegistry == msg.sender ||
                hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
            "Not approved to perform upkeep"
        );

        (
            uint256[] memory tokenIds,
            EquipmentMetadata[] memory metaDataArray
        ) = abi.decode(performData, (uint256[], EquipmentMetadata[]));

        if (tokenIds.length != metaDataArray.length) {
            revert("Invalid performData");
        }

        // cross check that the data provided by the Automation Nodes is not corrupted.
        for (uint256 index = 0; index < tokenIds.length; index++) {
            uint256 tokenId = tokenIds[index];

            uint256 _generationId = getGenerationOfToken(tokenId);
            uint256 _generationSeed = genSeed[_generationId];

            if (
                _generationSeed == 0 ||
                equipmentContract.isMetadataReveal(tokenId)== true
            ) {
                continue;
            }

            bytes memory _dataToSet = abi.encode(tokenId, metaDataArray[index]);
            equipmentContract.revealMetadataForToken(_dataToSet);
        }
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(CantBeEvil, AccessControlEnumerable)
        returns (bool)
    {
        return
            type(IAccessControlEnumerable).interfaceId == interfaceId ||
            CantBeEvil.supportsInterface(interfaceId) ||
            super.supportsInterface(interfaceId);
    }

    function setEquipmentContractAddress(address _equipmentContract)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        equipmentContract = IAnomuraEquipment(_equipmentContract);
    }

    /**
    @dev Manual set the address of the Anomura Equipment Data contract
    @param equipmentData_ Address of Equipment Data
    */
    function setEquipmentDataAddress(address equipmentData_)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        equipmentData = IEquipmentData(equipmentData_);
    }

    /**
    @dev Manual set the address of Chainlink automation registry
    @param automationRegistry_ new registry address
    */
    function setAutomationRegistry(address automationRegistry_)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _automationRegistry = automationRegistry_;
    }

    /**
    @dev Manual set the subscription of Chainlink automation registry. Used when we move to another chainlink subscription on mainnet
    @param subscriptionId_ new subscriptionId
    */
    function setSubscriptionId(uint64 subscriptionId_)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        subscriptionId = subscriptionId_;
    }

    /**
    @dev Manual set the keyash for Chainlink
    @param keyHash_ new keyHash
    */
    function setKeyHash(bytes32 keyHash_)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        keyHash = keyHash_;
    }
}

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

interface AutomationCompatibleInterface {
  /**
   * @notice method that is simulated by the keepers to see if any work actually
   * needs to be performed. This method does does not actually need to be
   * executable, and since it is only ever simulated it can consume lots of gas.
   * @dev To ensure that it is never called, you may want to add the
   * cannotExecute modifier from KeeperBase to your implementation of this
   * method.
   * @param checkData specified in the upkeep registration so it is always the
   * same for a registered upkeep. This can easily be broken down into specific
   * arguments using `abi.decode`, so multiple upkeeps can be registered on the
   * same contract and easily differentiated by the contract.
   * @return upkeepNeeded boolean to indicate whether the keeper should call
   * performUpkeep or not.
   * @return performData bytes that the keeper should call performUpkeep with, if
   * upkeep is needed. If you would like to encode data to decode later, try
   * `abi.encode`.
   */
  function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);

  /**
   * @notice method that is actually executed by the keepers, via the registry.
   * The data returned by the checkUpkeep simulation will be passed into
   * this method to actually be executed.
   * @dev The input to this method should not be trusted, and the caller of the
   * method should not even be restricted to any single registry. Anyone should
   * be able call it, and the input should be validated, there is no guarantee
   * that the data passed in is the performData returned from checkUpkeep. This
   * could happen due to malicious keepers, racing keepers, or simply a state
   * change while the performUpkeep transaction is waiting for confirmation.
   * Always validate the data passed in.
   * @param performData is the data which was passed back from the checkData
   * simulation. If it is encoded, it can easily be decoded into other types by
   * calling `abi.decode`. This data should not be trusted, and should be
   * validated against the contract's current state.
   */
  function performUpkeep(bytes calldata performData) external;
}

File 3 of 23 : 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 4 of 23 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ.
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBaseV2 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 requestId The Id initially returned by requestRandomness
   * @param randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

File 5 of 23 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

File 6 of 23 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * 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 7 of 23 : 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 8 of 23 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * 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 AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

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

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerable).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);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @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 12 of 23 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_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) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

    /**
     * @dev 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 16 of 23 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // 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 on 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 17 of 23 : CantBeEvil.sol
// SPDX-License-Identifier: MIT
// a16z Contracts v0.0.1 (CantBeEvil.sol)
pragma solidity 0.8.13;

import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./interfaces/ICantBeEvil.sol";

enum LicenseVersion {
    PUBLIC,
    EXCLUSIVE,
    COMMERCIAL,
    COMMERCIAL_NO_HATE,
    PERSONAL,
    PERSONAL_NO_HATE
}

contract CantBeEvil is ERC165, ICantBeEvil {
    using Strings for uint256;
    string internal constant _BASE_LICENSE_URI =
        "ar://zmc1WTspIhFyVY82bwfAIcIExLFH5lUcHHUN0wXg4W8/";
    LicenseVersion internal licenseVersion;

    constructor(LicenseVersion _licenseVersion) {
        licenseVersion = _licenseVersion;
    }

    function getLicenseURI() public view returns (string memory) {
        return
            string.concat(
                _BASE_LICENSE_URI,
                uint256(licenseVersion).toString()
            );
    }

    function getLicenseName() public view returns (string memory) {
        return _getLicenseVersionKeyByValue(licenseVersion);
    }

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

    function _getLicenseVersionKeyByValue(LicenseVersion _licenseVersion)
        internal
        pure
        returns (string memory)
    {
        require(uint8(_licenseVersion) <= 6);
        if (LicenseVersion.PUBLIC == _licenseVersion) return "PUBLIC";
        if (LicenseVersion.EXCLUSIVE == _licenseVersion) return "EXCLUSIVE";
        if (LicenseVersion.COMMERCIAL == _licenseVersion) return "COMMERCIAL";
        if (LicenseVersion.COMMERCIAL_NO_HATE == _licenseVersion)
            return "COMMERCIAL_NO_HATE";
        if (LicenseVersion.PERSONAL == _licenseVersion) return "PERSONAL";
        else return "PERSONAL_NO_HATE";
    }
}

File 18 of 23 : EquipmentData.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import {EquipmentRarity, EquipmentType} from "./interfaces/IAnomuraEquipment.sol";
import {LicenseVersion, CantBeEvil} from "./CantBeEvil.sol";

interface IEquipmentData {
    function pluckType(uint256) external view returns (EquipmentType);

    function pluckBody(uint256)
        external
        view
        returns (string memory, EquipmentRarity);

    function pluckClaws(uint256)
        external
        view
        returns (string memory, EquipmentRarity);

    function pluckLegs(uint256)
        external
        view
        returns (string memory, EquipmentRarity);

    function pluckShell(uint256)
        external
        view
        returns (string memory, EquipmentRarity);

    function pluckHeadpieces(uint256)
        external
        view
        returns (string memory, EquipmentRarity);

    function pluckHabitat(uint256)
        external
        view
        returns (string memory, EquipmentRarity);
}

contract EquipmentData is IEquipmentData, CantBeEvil {
  
    string[] public BODY_PARTS = [
        "Premier Body",
        "Unhinged Body",
        "Mesmerizing Body",
        "Rave Body",
        "Combustion Body",
        "Radiating Eye",
        "Charring Body",
        "Inferno Body",
        "Siberian Body",
        "Antarctic Body",
        "Glacial Body",
        "Amethyst Body",
        "Beast",
        "Panga Panga",
        "Ceylon Ebony",
        "Katalox",
        "Diamond",
        "Golden"
    ];
    string[] public CLAW_PARTS = [
        "Natural Claw",
        "Coral Claw",
        "Titian Claw",
        "Pliers",
        "Scissorhands",
        "Laser Gun",
        "Snow Claw",
        "Sky Claw",
        "Icicle Claw",
        "Pincers",
        "Hammer Logs",
        "Carnivora Claw"
    ];
    string[] public LEGS_PARTS = [
        "Argent Leg",
        "Sunlit Leg",
        "Auroral Leg",
        "Steel Leg",
        "Tungsten Leg",
        "Titanium Leg",
        "Crystal Leg",
        "Empyrean Leg",
        "Azure Leg",
        "Bamboo Leg",
        "Walmara Leg",
        "Pintobortri Leg"
    ];
    string[] public SHELL_PARTS = [
        "Auger Shell",
        "Seasnail Shell",
        "Miter Shell",
        "Alembic",
        "Chimney",
        "Starship",
        "Ice Cube",
        "Ice Shell",
        "Frosty",
        "Mora",
        "Carnivora",
        "Pure Runes",
        "Architect",
        "Bee Hive",
        "Coral",
        "Crystal",
        "Diamond",
        "Ethereum",
        "Golden Skull",
        "Japan Temple",
        "Planter",
        "Snail",
        "Tentacles",
        "Tesla Coil",
        "Cherry Blossom",
        "Maple Green",
        "Volcano",
        "Gates of Hell",
        "Holy Temple",
        "ZED Skull"
    ];
    string[] public HEADPIECES_PARTS = [
        "Morning Sun Starfish",
        "Granulated Starfish",
        "Royal Starfish",
        "Sapphire",
        "Emerald",
        "Kunzite",
        "Rhodonite",
        "Aventurine",
        "Peridot",
        "Moldavite",
        "Jasper",
        "Alexandrite",
        "Copper Fire",
        "Chemical Fire",
        "Carmine Fire",
        "Charon",
        "Deimos",
        "Ganymede",
        "Sol",
        "Sirius",
        "Lyra",
        "Aconite Skull",
        "Titan Arum Skull",
        "Nerium Oleander Skull"
    ];
    string[] public HABITAT_PARTS = [
        "Crystal Cave",
        "Crystal Cave Rainbow",
        "Emerald Forest",
        "Garden of Eden",
        "Golden Glade",
        "Beach",
        "Magical Deep Sea",
        "Natural Sea",
        "Bioluminescent Abyss",
        "Blazing Furnace",
        "Steam Apparatus",
        "Science Lab",
        "Starship Throne",
        "Happy Snowfield",
        "Midnight Mountain",
        "Cosmic Star",
        "Sunset Cliffs",
        "Space Nebula",
        "Plains of Vietnam",
        "ZED Run",
        "African Savannah"
    ];
    string[] public PREFIX_ATTRS = [
        "Briny",
        "Tempestuous",
        "Limpid",
        "Pacific",
        "Atlantic",
        "Abysmal",
        "Profound",
        "Misty",
        "Solar",
        "Empyrean",
        "Sideral",
        "Astral",
        "Ethereal",
        "Crystal",
        "Quantum",
        "Empiric",
        "Alchemic",
        "Crash Test",
        "Nuclear",
        "Syntethic",
        "Tempered",
        "Fossil",
        "Craggy",
        "Gemmed",
        "Verdant",
        "Lymphatic",
        "Gnarled",
        "Lithic"
    ];
    string[] public SUFFIX_ATTRS = [
        "of the Coast",
        "of Maelstrom",
        "of Depths",
        "of Eternity",
        "of Peace",
        "of Equilibrium",
        "of the Universe",
        "of the Galaxy",
        "of Absolute Zero",
        "of Constellations",
        "of the Moon",
        "of Lightspeed",
        "of Evidence",
        "of Relativity",
        "of Evolution",
        "of Consumption",
        "of Progress",
        "of Damascus",
        "of Gaia",
        "of The Wild",
        "of Overgrowth",
        "of Rebirth",
        "of World Roots",
        "of Stability"
    ];
    string[] public UNIQUE_ATTRS = [
        "The Leviathan",
        "Will of Oceanus",
        "Suijin's Touch",
        "Tiamat Kiss",
        "Poseidon Vow",
        "Long bao",
        "Uranus Wish",
        "Aim of Indra",
        "Cry of Yuki Onna",
        "Sirius",
        "Vega",
        "Altair",
        "Ephestos Skill",
        "Gift of Prometheus",
        "Pandora's",
        "Wit of Lu Dongbin",
        "Thoth's Trick",
        "Cyclopes Plan",
        "Root of Dimu",
        "Bhumi's Throne",
        "Rive of Daphne",
        "The Minotaur",
        "Call of Cernunnos",
        "Graze of Terra"
    ];
    string[] public BACKGROUND_PREFIX_ATTRS = [
        "Bountiful",
        "Isolated",
        "Mechanical",
        "Reborn"
    ];

    constructor() 
    CantBeEvil(LicenseVersion.PUBLIC)
    {}

    /* 
    1 / 25 = 4% headpieces => 96% rest, for 5 other parts
    0       -     191 = BODY
    192     -     383 = CLAWS
    384     -     575 = LEGS
    576     -     767 = SHELL
    768     -     959 = HABITAT
    960     -     999 - HEADPIECES
    */
    function pluckType(uint256 prob)
        external
        pure
        returns (EquipmentType typeOf)
    {
        uint256 rand = prob % 1000;

        if (rand < 192) typeOf = EquipmentType.BODY;
        else if (rand < 192 * 2) typeOf = EquipmentType.CLAWS;
        else if (rand < 192 * 3) typeOf = EquipmentType.LEGS;
        else if (rand < 192 * 4) typeOf = EquipmentType.SHELL;
        else if (rand < 192 * 5) typeOf = EquipmentType.HABITAT;
        else typeOf = EquipmentType.HEADPIECES;
    }

    function pluckBody(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluck(prob, EquipmentType.BODY);
    }

    function pluckClaws(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluck(prob, EquipmentType.CLAWS);
    }

    function pluckLegs(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluck(prob, EquipmentType.LEGS);
    }

    function pluckShell(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluck(prob, EquipmentType.SHELL);
    }

    function pluckHeadpieces(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluck(
            prob,
            EquipmentType.HEADPIECES
        );
    }

    function pluckHabitat(uint256 prob)
        external
        view
        returns (string memory equipmentName, EquipmentRarity equipmentRarity)
    {
        (equipmentName, equipmentRarity) = pluckBackground(prob);
    }

    function pluckBackground(uint256 _seed)
        internal
        view
        returns (string memory output, EquipmentRarity)
    {
        uint256 randomCount = 0;
        uint256 greatness = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        ) % 51;
        uint256 randNameSeed = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        );
        uint256 randPartSeed = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        );

        output = HABITAT_PARTS[randNameSeed % HABITAT_PARTS.length];

        if (greatness > 45) {
            output = string(
                abi.encodePacked(
                    BACKGROUND_PREFIX_ATTRS[
                        randPartSeed % BACKGROUND_PREFIX_ATTRS.length
                    ],
                    " ",
                    output
                )
            );
            return (output, EquipmentRarity.RARE);
        }
        return (output, EquipmentRarity.NORMAL); // does not have any special attributes
    }

    function pluck(uint256 _seed, EquipmentType typeOf)
        internal
        view
        returns (string memory output, EquipmentRarity)
    {
        uint256 randomCount = 0;
        uint256 greatness = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        ) % 94;
        uint256 randNameSeed = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        );
        uint256 randPartSeed = uint256(
            keccak256(abi.encode(_seed, randomCount++))
        );

        if (typeOf == EquipmentType.BODY) {
            output = BODY_PARTS[randNameSeed % BODY_PARTS.length];
        } else if (typeOf == EquipmentType.CLAWS) {
            output = CLAW_PARTS[randNameSeed % CLAW_PARTS.length];
        } else if (typeOf == EquipmentType.LEGS) {
            output = LEGS_PARTS[randNameSeed % LEGS_PARTS.length];
        } else if (typeOf == EquipmentType.SHELL) {
            output = SHELL_PARTS[randNameSeed % SHELL_PARTS.length];
        } else if (typeOf == EquipmentType.HEADPIECES) {
            output = HEADPIECES_PARTS[randNameSeed % HEADPIECES_PARTS.length];
        } else if (typeOf == EquipmentType.HABITAT) {
            output = HABITAT_PARTS[randNameSeed % HABITAT_PARTS.length];
        }

        if (greatness > 92) {
            output = string(
                abi.encodePacked(
                    UNIQUE_ATTRS[randPartSeed % UNIQUE_ATTRS.length],
                    " ",
                    output
                )
            );
            return (output, EquipmentRarity.LEGENDARY);
        }

        if (greatness > 83) {
            output = string(
                abi.encodePacked(
                    PREFIX_ATTRS[randPartSeed % PREFIX_ATTRS.length],
                    " ",
                    output,
                    " ",
                    SUFFIX_ATTRS[randPartSeed % SUFFIX_ATTRS.length]
                )
            );
            return (output, EquipmentRarity.RARE);
        }

        if (greatness > 74) {
            output = string(
                abi.encodePacked(
                    output,
                    " ",
                    SUFFIX_ATTRS[randPartSeed % SUFFIX_ATTRS.length]
                )
            );
            return (output, EquipmentRarity.MAGIC);
        }

        if (greatness > 65) {
            output = string(
                abi.encodePacked(
                    PREFIX_ATTRS[randPartSeed % PREFIX_ATTRS.length],
                    " ",
                    output
                )
            );
            return (output, EquipmentRarity.MAGIC);
        }
        return (output, EquipmentRarity.NORMAL); // does not have any special attributes
    }
}

File 19 of 23 : IAnomuraEquipment.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import {IERC721AUpgradeable} from "./IERC721AUpgradeable.sol";

interface IAnomuraEquipment is IERC721AUpgradeable { 
    function isTokenExists(uint256 _tokenId) external view returns(bool); 
    function isMetadataReveal(uint256 _tokenId) external view returns(bool);
    function revealMetadataForToken(bytes calldata performData) external; 
}

// This will likely change in the future, this should not be used to store state, or can only use inside a mapping
struct EquipmentMetadata {
    string name;
    EquipmentType equipmentType;
    EquipmentRarity equipmentRarity;
}

/// @notice equipment information
enum EquipmentType {
    BODY,
    CLAWS,
    LEGS,
    SHELL,
    HEADPIECES,
    HABITAT
}

/// @notice rarity information
enum EquipmentRarity {
    NORMAL,
    MAGIC,
    RARE,
    LEGENDARY 
}

File 20 of 23 : IAnomuraErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IAnomuraErrors {
    error InvalidRecipient();
    error InvalidTokenIds();
    error InvalidOwner();
    error InvalidItemType();
    error InvalidString();
    error InvalidLength();
    error InvalidValue();
    error InvalidEquipmentAddress();
    error InvalidCollectionType();
    error IsPaused();
}

File 21 of 23 : IAnomuraSeeder.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "./IAnomuraEquipment.sol";
import {IAnomuraErrors} from "./IAnomuraErrors.sol";

interface IAnomuraSeeder is IAnomuraErrors
{
    function requestSeed(uint256 _tokenId) external returns(uint256);
}

File 22 of 23 : ICantBeEvil.sol
// SPDX-License-Identifier: MIT
// a16z Contracts v0.0.1 (ICantBeEvil.sol)
pragma solidity 0.8.13;

interface ICantBeEvil {
    function getLicenseURI() external view returns (string memory);
    function getLicenseName() external view returns (string memory);
}

File 23 of 23 : IERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

/**
 * @dev Interface of an ERC721A compliant contract.
 */
interface IERC721AUpgradeable is IERC721Upgradeable, IERC721MetadataUpgradeable {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * The caller cannot approve to the current owner.
     */
    error ApprovalToCurrentOwner();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    // Compiler will pack this into a single 256bit word.
    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     * 
     * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
     */
    function totalSupply() external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"coordinator_","type":"address"},{"internalType":"bytes32","name":"keyHash_","type":"bytes32"},{"internalType":"uint64","name":"subscriptionId_","type":"uint64"},{"internalType":"address","name":"equipmentData_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidCollectionType","type":"error"},{"inputs":[],"name":"InvalidEquipmentAddress","type":"error"},{"inputs":[],"name":"InvalidItemType","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidString","type":"error"},{"inputs":[],"name":"InvalidTokenIds","type":"error"},{"inputs":[],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"RequestSeedFulfilled","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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEEDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"checkerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coordinator","outputs":[{"internalType":"contract VRFCoordinatorV2Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"equipmentContract","outputs":[{"internalType":"contract IAnomuraEquipment","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"equipmentData","outputs":[{"internalType":"contract IEquipmentData","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getGenerationOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLicenseName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLicenseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"keyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","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":"uint256","name":"_generationId","type":"uint256"}],"name":"requestSeed","outputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"automationRegistry_","type":"address"}],"name":"setAutomationRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_equipmentContract","type":"address"}],"name":"setEquipmentContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"equipmentData_","type":"address"}],"name":"setEquipmentDataAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"keyHash_","type":"bytes32"}],"name":"setKeyHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"setMetadataForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"subscriptionId_","type":"uint64"}],"name":"setSubscriptionId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b50604051620031a8380380620031a8833981016040819052620000349162000259565b6001600160a01b03848116608081905260028054600480546001600160a01b0319169093179092556006869055600780546001600160401b0387166001600160401b0319909116179055918316610100026001600160a81b0319909116179055620000a1600033620000d7565b620000cd7f240afcd1926e36e0297a1eb63ba484f52ddbef788e7f4e9b38b0dcc66de129e133620000d7565b50505050620002bb565b620000e38282620000e7565b5050565b620000fe82826200012a60201b62001d461760201c565b60008281526001602090815260409091206200012591839062001dca620001ca821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e3576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620001e1836001600160a01b038416620001ea565b90505b92915050565b60008181526001830160205260408120546200023357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001e4565b506000620001e4565b80516001600160a01b03811681146200025457600080fd5b919050565b600080600080608085870312156200027057600080fd5b6200027b856200023c565b6020860151604087015191955093506001600160401b0381168114620002a057600080fd5b9150620002b0606086016200023c565b905092959194509250565b608051612eca620002de6000396000818161049001526104d20152612eca6000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80636e04ff0d116100f9578063a341793b11610097578063ca15c87311610071578063ca15c873146103fa578063d547741f1461040d578063ea7b4f7714610420578063ff613e6a1461043357600080fd5b8063a341793b146103ca578063a9df851a146103df578063c7db2893146103f257600080fd5b80639010d07c116100d35780639010d07c1461038957806391d148541461039c57806398544710146103af578063a217fddf146103c257600080fd5b80636e04ff0d146103425780636efc00ee14610363578063870c1d521461037657600080fd5b8063353d240c116101665780635ff2d2aa116101405780635ff2d2aa146102ec57806361728f39146102ff57806364a91487146103085780636c5c8c271461032f57600080fd5b8063353d240c146102b357806336568abe146102c65780634585e33b146102d957600080fd5b8063119f0ef8116101a2578063119f0ef8146102475780631fe543e31461025a578063248a9ca31461026f5780632f2ff15d146102a057600080fd5b806301ffc9a7146101c957806309c1ba2e146101f15780630a0090971461021c575b600080fd5b6101dc6101d73660046125dc565b61044b565b60405190151581526020015b60405180910390f35b600754610204906001600160401b031681565b6040516001600160401b0390911681526020016101e8565b60045461022f906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b60035461022f906001600160a01b031681565b61026d610268366004612702565b610485565b005b61029261027d366004612748565b60009081526020819052604090206001015490565b6040519081526020016101e8565b61026d6102ae366004612778565b610512565b61026d6102c13660046127a4565b61053c565b61026d6102d4366004612778565b610570565b61026d6102e73660046127bf565b6105ea565b61026d6102fa3660046127a4565b61083a565b61029260065481565b6102927f240afcd1926e36e0297a1eb63ba484f52ddbef788e7f4e9b38b0dcc66de129e181565b61026d61033d366004612748565b610868565b6103556103503660046127bf565b610e87565b6040516101e892919061288c565b61026d6103713660046127a4565b611821565b610292610384366004612748565b61184f565b61022f6103973660046128a7565b6118ea565b6101dc6103aa366004612778565b611902565b61026d6103bd366004612748565b61192b565b610292600081565b6103d261193c565b6040516101e891906128c9565b6102926103ed366004612748565b611953565b6103d2611c7b565b610292610408366004612748565b611cdb565b61026d61041b366004612778565b611cf2565b61026d61042e3660046128dc565b611d17565b60025461022f9061010090046001600160a01b031681565b6000635a05180f60e01b6001600160e01b031983161480610470575061047082611ddf565b8061047f575061047f82611ddf565b92915050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105045760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61050e8282611e04565b5050565b60008281526020819052604090206001015461052d81611e9d565b6105378383611eaa565b505050565b600061054781611e9d565b50600280546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03811633146105e05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104fb565b61050e8282611ecc565b6005546001600160a01b03163314806106095750610609600033611902565b6106555760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420617070726f76656420746f20706572666f726d2075706b656570000060448201526064016104fb565b6000806106648385018561295c565b9150915080518251146106af5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420706572666f726d4461746160681b60448201526064016104fb565b60005b82518110156108335760008382815181106106cf576106cf612abe565b6020026020010151905060006106e48261184f565b6000818152600960205260409020549091508015806107715750600354604051634b632efb60e11b8152600481018590526001600160a01b03909116906396c65df690602401602060405180830381865afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b9190612ad4565b15156001145b1561077e57505050610821565b60008386868151811061079357610793612abe565b60200260200101516040516020016107ac929190612b63565b60408051601f198184030181529082905260035462c9fe1960e31b83529092506001600160a01b03169063064ff0c8906107ea9084906004016128c9565b600060405180830381600087803b15801561080457600080fd5b505af1158015610818573d6000803e3d6000fd5b50505050505050505b8061082b81612b92565b9150506106b2565b5050505050565b600061084581611e9d565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03166108c05760405162461bcd60e51b815260206004820152601a60248201527f45717569706d656e7420636f6e7472616374206e6f742073657400000000000060448201526064016104fb565b60025461010090046001600160a01b03166109165760405162461bcd60e51b8152602060048201526016602482015275115c5d5a5c1b595b9d0819185d18481b9bdd081cd95d60521b60448201526064016104fb565b6003546040516307dc05c160e21b8152600481018390526001600160a01b0390911690631f70170490602401602060405180830381865afa15801561095f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109839190612ad4565b6109c25760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b60448201526064016104fb565b600354604051634b632efb60e11b8152600481018390526001600160a01b03909116906396c65df690602401602060405180830381865afa158015610a0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2f9190612ad4565b15610a705760405162461bcd60e51b815260206004820152601160248201527013595d1859185d18481c995d99585b1959607a1b60448201526064016104fb565b6000610a7b8261184f565b600081815260096020526040812054919250819003610ad35760405162461bcd60e51b815260206004820152601460248201527329b2b2b2103737ba1039b2ba103337b91033b2b760611b60448201526064016104fb565b604080516020810183905290810184905260009060600160408051808303601f190181529082905280516020909101206002546329cc09d560e21b83526004830182905290925060609160009182916101009091046001600160a01b03169063a730275490602401602060405180830381865afa158015610b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7c9190612bab565b90506000816005811115610b9257610b92612af6565b03610c1757600254604051635bc7ed7560e11b8152600481018690526101009091046001600160a01b03169063b78fdaea906024015b600060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c0d9190810190612bc8565b9093509150610db6565b6001816005811115610c2b57610c2b612af6565b03610c655760025460405163f530dec360e01b8152600481018690526101009091046001600160a01b03169063f530dec390602401610bc8565b6002816005811115610c7957610c79612af6565b03610cb357600254604051633fbe12b760e01b8152600481018690526101009091046001600160a01b031690633fbe12b790602401610bc8565b6003816005811115610cc757610cc7612af6565b03610d01576002546040516307a59f5f60e31b8152600481018690526101009091046001600160a01b031690633d2cfaf890602401610bc8565b6005816005811115610d1557610d15612af6565b03610d4f57600254604051630e26064f60e31b8152600481018690526101009091046001600160a01b031690637130327890602401610bc8565b6004816005811115610d6357610d63612af6565b03610d9d57600254604051636825675760e11b8152600481018690526101009091046001600160a01b03169063d04aceae90602401610bc8565b604051632a9ffab760e21b815260040160405180910390fd5b60006040518060600160405280858152602001836005811115610ddb57610ddb612af6565b8152602001846003811115610df257610df2612af6565b815250905060008882604051602001610e0c929190612b63565b60408051601f198184030181529082905260035462c9fe1960e31b83529092506001600160a01b03169063064ff0c890610e4a9084906004016128c9565b600060405180830381600087803b158015610e6457600080fd5b505af1158015610e78573d6000803e3d6000fd5b50505050505050505050505050565b600060608180610e99858701876128a7565b91509150600082118015610f235750600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f9190612c55565b8111155b8015610f2f5750808211155b610f7b5760405162461bcd60e51b815260206004820152601b60248201527f4c6f77657220616e64205570706572206e6f7420636f7272656374000000000060448201526064016104fb565b6003546001600160a01b0316610fc75760405162461bcd60e51b8152602060048201526011602482015270115c5d5a5c1b595b9d081b9bdd081cd95d607a1b60448201526064016104fb565b60025461010090046001600160a01b031661101d5760405162461bcd60e51b8152602060048201526016602482015275115c5d5a5c1b595b9d0811185d18481b9bdd081cd95d60521b60448201526064016104fb565b6000805b61102b8484612c6e565b611036906001612c85565b81101561119b5760006110498286612c85565b6003546040516307dc05c160e21b8152600481018390529192506001600160a01b031690631f70170490602401602060405180830381865afa158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b79190612ad4565b15806111315750600354604051634b632efb60e11b8152600481018390526001600160a01b03909116906396c65df690602401602060405180830381865afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190612ad4565b15156001145b1561113c5750611189565b60006111478261184f565b60008181526009602052604081205491925081900361116857505050611189565b8461117281612b92565b95505084600a036111855750505061119b565b5050505b8061119381612b92565b915050611021565b50806000036111dd576000604051806040016040528060128152602001714d6574612073657420666f722072616e676560701b8152509450945050505061181a565b600094506000816001600160401b038111156111fb576111fb612606565b604051908082528060200260200182016040528015611224578160200160208202803683370190505b5090506000826001600160401b0381111561124157611241612606565b60405190808252806020026020018201604052801561129657816020015b61128360408051606080820190925290815260208101600081526020016000905290565b81526020019060019003908161125f5790505b5090506000805b6112a78787612c6e565b6112b2906001612c85565b8110156117a85760006112c58289612c85565b905060006112d28261184f565b600081815260096020526040908190205460035491516307dc05c160e21b815260048101869052929350916001600160a01b0390911690631f70170490602401602060405180830381865afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190612ad4565b801561135e57508015155b80156113d45750600354604051634b632efb60e11b8152600481018590526001600160a01b03909116906396c65df690602401602060405180830381865afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d29190612ad4565b155b156117825760019b50828786815181106113f0576113f0612abe565b6020026020010181815250506000818460405160200161141a929190918252602082015260400190565b60408051808303601f190181529082905280516020909101206002546329cc09d560e21b83526004830182905290925060609160009182916101009091046001600160a01b03169063a730275490602401602060405180830381865afa158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190612bab565b905060008160058111156114c2576114c2612af6565b0361154757600254604051635bc7ed7560e11b8152600481018690526101009091046001600160a01b03169063b78fdaea906024015b600060405180830381865afa158015611515573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261153d9190810190612bc8565b9093509150611715565b600181600581111561155b5761155b612af6565b036115955760025460405163f530dec360e01b8152600481018690526101009091046001600160a01b03169063f530dec3906024016114f8565b60028160058111156115a9576115a9612af6565b036115e357600254604051633fbe12b760e01b8152600481018690526101009091046001600160a01b031690633fbe12b7906024016114f8565b60038160058111156115f7576115f7612af6565b03611631576002546040516307a59f5f60e31b8152600481018690526101009091046001600160a01b031690633d2cfaf8906024016114f8565b600581600581111561164557611645612af6565b0361167f57600254604051630e26064f60e31b8152600481018690526101009091046001600160a01b0316906371303278906024016114f8565b600481600581111561169357611693612af6565b036116cd57600254604051636825675760e11b8152600481018690526101009091046001600160a01b03169063d04aceae906024016114f8565b600060405180604001604052806016815260200175496e76616c69642065717569706d656e74207479706560501b8152509f509f50505050505050505050505050505061181a565b604051806060016040528084815260200182600581111561173857611738612af6565b815260200183600381111561174f5761174f612af6565b8152508a8a8151811061176457611764612abe565b6020026020010181905250888061177a90612b92565b995050505050505b84600a03611792575050506117a8565b50505080806117a090612b92565b91505061129d565b508715156000036117eb5760006040518060400160405280600e81526020016d139bdd1a1a5b99c81d1bc81cd95d60921b8152509750975050505050505061181a565b60008383604051602001611800929190612c9d565b60408051601f198184030181529190529750505050505050505b9250929050565b600061182c81611e9d565b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b6003546040516307dc05c160e21b8152600481018390526000916001600160a01b031690631f70170490602401602060405180830381865afa158015611899573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bd9190612ad4565b6118c957506000919050565b60006118d6603284612d4b565b90506118e3816001612c85565b9392505050565b60008281526001602052604081206118e39083611eee565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600061193681611e9d565b50600655565b60025460609061194e9060ff16611efa565b905090565b60007f240afcd1926e36e0297a1eb63ba484f52ddbef788e7f4e9b38b0dcc66de129e161197f81611e9d565b6003546001600160a01b03166119d75760405162461bcd60e51b815260206004820152601a60248201527f45717569706d656e7420636f6e7472616374206e6f742073657400000000000060448201526064016104fb565b600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4e9190612c55565b600003611a945760405162461bcd60e51b81526020600482015260146024820152732737903a37b5b2b71036b4b73a32b2103cb2ba1760611b60448201526064016104fb565b60006032600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611aeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0f9190612c55565b611b199190612d4b565b90506001841080611b335750611b30816001612c85565b84115b15611b785760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a590811d95b995c985d1a5bdb881259605a1b60448201526064016104fb565b60008481526009602052604090205415611bc85760405162461bcd60e51b81526020600482015260116024820152705365656420616c7265616479207365742160781b60448201526064016104fb565b600480546006546007546040516305d3b1d360e41b8152938401919091526001600160401b03166024830152600360448301526203a9806064830152600160848301526001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611c3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c619190612c55565b600081815260086020526040902094909455509192915050565b6060604051806060016040528060318152602001612e6460319139600254611cb69060ff166005811115611cb157611cb1612af6565b61208b565b604051602001611cc7929190612d5f565b604051602081830303815290604052905090565b600081815260016020526040812061047f90612193565b600082815260208190526040902060010154611d0d81611e9d565b6105378383611ecc565b6000611d2281611e9d565b506007805467ffffffffffffffff19166001600160401b0392909216919091179055565b611d508282611902565b61050e576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611d863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006118e3836001600160a01b03841661219d565b60006001600160e01b03198216630c934a3560e31b148061047f575061047f826121ec565b600082815260086020526040812054825190918391611e2557611e25612abe565b60200260200101516009600083815260200190815260200160002081905550807f272caaccb8c1b6534b8bfd35069b1e29a297a23883a46ac4e3fd91bdf685e4ca83600081518110611e7957611e79612abe565b6020026020010151604051611e9091815260200190565b60405180910390a2505050565b611ea78133612211565b50565b611eb48282611d46565b60008281526001602052604090206105379082611dca565b611ed68282612275565b600082815260016020526040902061053790826122da565b60006118e383836122ef565b60606006826005811115611f1057611f10612af6565b60ff161115611f1e57600080fd5b816005811115611f3057611f30612af6565b600003611f595750506040805180820190915260068152655055424c494360d01b602082015290565b816005811115611f6b57611f6b612af6565b600103611f975750506040805180820190915260098152684558434c555349564560b81b602082015290565b816005811115611fa957611fa9612af6565b600203611fd657505060408051808201909152600a81526910d3d353515490d2505360b21b602082015290565b816005811115611fe857611fe8612af6565b60030361201d575050604080518082019091526012815271434f4d4d45524349414c5f4e4f5f4841544560701b602082015290565b81600581111561202f5761202f612af6565b60040361205a57505060408051808201909152600881526714115494d3d3905360c21b602082015290565b505060408051808201909152601081526f504552534f4e414c5f4e4f5f4841544560801b602082015290565b919050565b6060816000036120b25750506040805180820190915260018152600360fc1b602082015290565b8160005b81156120dc57806120c681612b92565b91506120d59050600a83612d4b565b91506120b6565b6000816001600160401b038111156120f6576120f6612606565b6040519080825280601f01601f191660200182016040528015612120576020820181803683370190505b5090505b841561218b57612135600183612c6e565b9150612142600a86612d8e565b61214d906030612c85565b60f81b81838151811061216257612162612abe565b60200101906001600160f81b031916908160001a905350612184600a86612d4b565b9450612124565b949350505050565b600061047f825490565b60008181526001830160205260408120546121e45750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561047f565b50600061047f565b60006001600160e01b03198216635a05180f60e01b148061047f575061047f82612319565b61221b8282611902565b61050e57612233816001600160a01b0316601461234e565b61223e83602061234e565b60405160200161224f929190612da2565b60408051601f198184030181529082905262461bcd60e51b82526104fb916004016128c9565b61227f8282611902565b1561050e576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006118e3836001600160a01b0384166124e9565b600082600001828154811061230657612306612abe565b9060005260206000200154905092915050565b60006001600160e01b03198216637965db0b60e01b148061047f57506301ffc9a760e01b6001600160e01b031983161461047f565b6060600061235d836002612e17565b612368906002612c85565b6001600160401b0381111561237f5761237f612606565b6040519080825280601f01601f1916602001820160405280156123a9576020820181803683370190505b509050600360fc1b816000815181106123c4576123c4612abe565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106123f3576123f3612abe565b60200101906001600160f81b031916908160001a9053506000612417846002612e17565b612422906001612c85565b90505b600181111561249a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061245657612456612abe565b1a60f81b82828151811061246c5761246c612abe565b60200101906001600160f81b031916908160001a90535060049490941c9361249381612e36565b9050612425565b5083156118e35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104fb565b600081815260018301602052604081205480156125d257600061250d600183612c6e565b855490915060009061252190600190612c6e565b905081811461258657600086600001828154811061254157612541612abe565b906000526020600020015490508087600001848154811061256457612564612abe565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061259757612597612e4d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061047f565b600091505061047f565b6000602082840312156125ee57600080fd5b81356001600160e01b0319811681146118e357600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171561263e5761263e612606565b60405290565b604051601f8201601f191681016001600160401b038111828210171561266c5761266c612606565b604052919050565b60006001600160401b0382111561268d5761268d612606565b5060051b60200190565b600082601f8301126126a857600080fd5b813560206126bd6126b883612674565b612644565b82815260059290921b840181019181810190868411156126dc57600080fd5b8286015b848110156126f757803583529183019183016126e0565b509695505050505050565b6000806040838503121561271557600080fd5b8235915060208301356001600160401b0381111561273257600080fd5b61273e85828601612697565b9150509250929050565b60006020828403121561275a57600080fd5b5035919050565b80356001600160a01b038116811461208657600080fd5b6000806040838503121561278b57600080fd5b8235915061279b60208401612761565b90509250929050565b6000602082840312156127b657600080fd5b6118e382612761565b600080602083850312156127d257600080fd5b82356001600160401b03808211156127e957600080fd5b818501915085601f8301126127fd57600080fd5b81358181111561280c57600080fd5b86602082850101111561281e57600080fd5b60209290920196919550909350505050565b60005b8381101561284b578181015183820152602001612833565b8381111561285a576000848401525b50505050565b60008151808452612878816020860160208601612830565b601f01601f19169290920160200192915050565b821515815260406020820152600061218b6040830184612860565b600080604083850312156128ba57600080fd5b50508035926020909101359150565b6020815260006118e36020830184612860565b6000602082840312156128ee57600080fd5b81356001600160401b03811681146118e357600080fd5b60006001600160401b0382111561291e5761291e612606565b50601f01601f191660200190565b60068110611ea757600080fd5b80356120868161292c565b60048110611ea757600080fd5b803561208681612944565b6000806040838503121561296f57600080fd5b82356001600160401b038082111561298657600080fd5b61299286838701612697565b93506020915081850135818111156129a957600080fd5b8501601f810187136129ba57600080fd5b80356129c86126b882612674565b81815260059190911b820184019084810190898311156129e757600080fd5b8584015b83811015612aad57803586811115612a0257600080fd5b85016060818d03601f19011215612a1857600080fd5b612a2061261c565b8882013588811115612a3157600080fd5b8201603f81018e13612a4257600080fd5b89810135612a526126b882612905565b8181528f6040838501011115612a6757600080fd5b81604084018d83013760008c8383010152808452505050612a8a60408301612939565b89820152612a9a60608301612951565b60408201528452509186019186016129eb565b508096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612ae657600080fd5b815180151581146118e357600080fd5b634e487b7160e01b600052602160045260246000fd5b6000815160608452612b216060850182612860565b9050602083015160068110612b3857612b38612af6565b6020850152604083015160048110612b5257612b52612af6565b806040860152508091505092915050565b82815260406020820152600061218b6040830184612b0c565b634e487b7160e01b600052601160045260246000fd5b600060018201612ba457612ba4612b7c565b5060010190565b600060208284031215612bbd57600080fd5b81516118e38161292c565b60008060408385031215612bdb57600080fd5b82516001600160401b03811115612bf157600080fd5b8301601f81018513612c0257600080fd5b8051612c106126b882612905565b818152866020838501011115612c2557600080fd5b612c36826020830160208601612830565b8094505050506020830151612c4a81612944565b809150509250929050565b600060208284031215612c6757600080fd5b5051919050565b600082821015612c8057612c80612b7c565b500390565b60008219821115612c9857612c98612b7c565b500190565b604080825283519082018190526000906020906060840190828701845b82811015612cd657815184529284019290840190600101612cba565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015612d2657601f19868403018552612d14838351612b0c565b94870194925090860190600101612cf8565b50909998505050505050505050565b634e487b7160e01b600052601260045260246000fd5b600082612d5a57612d5a612d35565b500490565b60008351612d71818460208801612830565b835190830190612d85818360208801612830565b01949350505050565b600082612d9d57612d9d612d35565b500690565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612dda816017850160208801612830565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612e0b816028840160208801612830565b01602801949350505050565b6000816000190483118215151615612e3157612e31612b7c565b500290565b600081612e4557612e45612b7c565b506000190190565b634e487b7160e01b600052603160045260246000fdfe61723a2f2f7a6d63315754737049684679565938326277664149634945784c4648356c55634848554e307758673457382fa2646970667358221220027c8200e43c98c8628b86abee19d3af7315e3cecf000363af0df5a5d348442e64736f6c634300080d0033000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699098af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef0000000000000000000000000000000000000000000000000000000000000264000000000000000000000000b180b78c98eeca254b6a3a9bf5541a95c3ee9323

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80636e04ff0d116100f9578063a341793b11610097578063ca15c87311610071578063ca15c873146103fa578063d547741f1461040d578063ea7b4f7714610420578063ff613e6a1461043357600080fd5b8063a341793b146103ca578063a9df851a146103df578063c7db2893146103f257600080fd5b80639010d07c116100d35780639010d07c1461038957806391d148541461039c57806398544710146103af578063a217fddf146103c257600080fd5b80636e04ff0d146103425780636efc00ee14610363578063870c1d521461037657600080fd5b8063353d240c116101665780635ff2d2aa116101405780635ff2d2aa146102ec57806361728f39146102ff57806364a91487146103085780636c5c8c271461032f57600080fd5b8063353d240c146102b357806336568abe146102c65780634585e33b146102d957600080fd5b8063119f0ef8116101a2578063119f0ef8146102475780631fe543e31461025a578063248a9ca31461026f5780632f2ff15d146102a057600080fd5b806301ffc9a7146101c957806309c1ba2e146101f15780630a0090971461021c575b600080fd5b6101dc6101d73660046125dc565b61044b565b60405190151581526020015b60405180910390f35b600754610204906001600160401b031681565b6040516001600160401b0390911681526020016101e8565b60045461022f906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b60035461022f906001600160a01b031681565b61026d610268366004612702565b610485565b005b61029261027d366004612748565b60009081526020819052604090206001015490565b6040519081526020016101e8565b61026d6102ae366004612778565b610512565b61026d6102c13660046127a4565b61053c565b61026d6102d4366004612778565b610570565b61026d6102e73660046127bf565b6105ea565b61026d6102fa3660046127a4565b61083a565b61029260065481565b6102927f240afcd1926e36e0297a1eb63ba484f52ddbef788e7f4e9b38b0dcc66de129e181565b61026d61033d366004612748565b610868565b6103556103503660046127bf565b610e87565b6040516101e892919061288c565b61026d6103713660046127a4565b611821565b610292610384366004612748565b61184f565b61022f6103973660046128a7565b6118ea565b6101dc6103aa366004612778565b611902565b61026d6103bd366004612748565b61192b565b610292600081565b6103d261193c565b6040516101e891906128c9565b6102926103ed366004612748565b611953565b6103d2611c7b565b610292610408366004612748565b611cdb565b61026d61041b366004612778565b611cf2565b61026d61042e3660046128dc565b611d17565b60025461022f9061010090046001600160a01b031681565b6000635a05180f60e01b6001600160e01b031983161480610470575061047082611ddf565b8061047f575061047f82611ddf565b92915050565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916146105045760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044015b60405180910390fd5b61050e8282611e04565b5050565b60008281526020819052604090206001015461052d81611e9d565b6105378383611eaa565b505050565b600061054781611e9d565b50600280546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03811633146105e05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104fb565b61050e8282611ecc565b6005546001600160a01b03163314806106095750610609600033611902565b6106555760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420617070726f76656420746f20706572666f726d2075706b656570000060448201526064016104fb565b6000806106648385018561295c565b9150915080518251146106af5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420706572666f726d4461746160681b60448201526064016104fb565b60005b82518110156108335760008382815181106106cf576106cf612abe565b6020026020010151905060006106e48261184f565b6000818152600960205260409020549091508015806107715750600354604051634b632efb60e11b8152600481018590526001600160a01b03909116906396c65df690602401602060405180830381865afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b9190612ad4565b15156001145b1561077e57505050610821565b60008386868151811061079357610793612abe565b60200260200101516040516020016107ac929190612b63565b60408051601f198184030181529082905260035462c9fe1960e31b83529092506001600160a01b03169063064ff0c8906107ea9084906004016128c9565b600060405180830381600087803b15801561080457600080fd5b505af1158015610818573d6000803e3d6000fd5b50505050505050505b8061082b81612b92565b9150506106b2565b5050505050565b600061084581611e9d565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03166108c05760405162461bcd60e51b815260206004820152601a60248201527f45717569706d656e7420636f6e7472616374206e6f742073657400000000000060448201526064016104fb565b60025461010090046001600160a01b03166109165760405162461bcd60e51b8152602060048201526016602482015275115c5d5a5c1b595b9d0819185d18481b9bdd081cd95d60521b60448201526064016104fb565b6003546040516307dc05c160e21b8152600481018390526001600160a01b0390911690631f70170490602401602060405180830381865afa15801561095f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109839190612ad4565b6109c25760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b60448201526064016104fb565b600354604051634b632efb60e11b8152600481018390526001600160a01b03909116906396c65df690602401602060405180830381865afa158015610a0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2f9190612ad4565b15610a705760405162461bcd60e51b815260206004820152601160248201527013595d1859185d18481c995d99585b1959607a1b60448201526064016104fb565b6000610a7b8261184f565b600081815260096020526040812054919250819003610ad35760405162461bcd60e51b815260206004820152601460248201527329b2b2b2103737ba1039b2ba103337b91033b2b760611b60448201526064016104fb565b604080516020810183905290810184905260009060600160408051808303601f190181529082905280516020909101206002546329cc09d560e21b83526004830182905290925060609160009182916101009091046001600160a01b03169063a730275490602401602060405180830381865afa158015610b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7c9190612bab565b90506000816005811115610b9257610b92612af6565b03610c1757600254604051635bc7ed7560e11b8152600481018690526101009091046001600160a01b03169063b78fdaea906024015b600060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c0d9190810190612bc8565b9093509150610db6565b6001816005811115610c2b57610c2b612af6565b03610c655760025460405163f530dec360e01b8152600481018690526101009091046001600160a01b03169063f530dec390602401610bc8565b6002816005811115610c7957610c79612af6565b03610cb357600254604051633fbe12b760e01b8152600481018690526101009091046001600160a01b031690633fbe12b790602401610bc8565b6003816005811115610cc757610cc7612af6565b03610d01576002546040516307a59f5f60e31b8152600481018690526101009091046001600160a01b031690633d2cfaf890602401610bc8565b6005816005811115610d1557610d15612af6565b03610d4f57600254604051630e26064f60e31b8152600481018690526101009091046001600160a01b031690637130327890602401610bc8565b6004816005811115610d6357610d63612af6565b03610d9d57600254604051636825675760e11b8152600481018690526101009091046001600160a01b03169063d04aceae90602401610bc8565b604051632a9ffab760e21b815260040160405180910390fd5b60006040518060600160405280858152602001836005811115610ddb57610ddb612af6565b8152602001846003811115610df257610df2612af6565b815250905060008882604051602001610e0c929190612b63565b60408051601f198184030181529082905260035462c9fe1960e31b83529092506001600160a01b03169063064ff0c890610e4a9084906004016128c9565b600060405180830381600087803b158015610e6457600080fd5b505af1158015610e78573d6000803e3d6000fd5b50505050505050505050505050565b600060608180610e99858701876128a7565b91509150600082118015610f235750600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f9190612c55565b8111155b8015610f2f5750808211155b610f7b5760405162461bcd60e51b815260206004820152601b60248201527f4c6f77657220616e64205570706572206e6f7420636f7272656374000000000060448201526064016104fb565b6003546001600160a01b0316610fc75760405162461bcd60e51b8152602060048201526011602482015270115c5d5a5c1b595b9d081b9bdd081cd95d607a1b60448201526064016104fb565b60025461010090046001600160a01b031661101d5760405162461bcd60e51b8152602060048201526016602482015275115c5d5a5c1b595b9d0811185d18481b9bdd081cd95d60521b60448201526064016104fb565b6000805b61102b8484612c6e565b611036906001612c85565b81101561119b5760006110498286612c85565b6003546040516307dc05c160e21b8152600481018390529192506001600160a01b031690631f70170490602401602060405180830381865afa158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b79190612ad4565b15806111315750600354604051634b632efb60e11b8152600481018390526001600160a01b03909116906396c65df690602401602060405180830381865afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190612ad4565b15156001145b1561113c5750611189565b60006111478261184f565b60008181526009602052604081205491925081900361116857505050611189565b8461117281612b92565b95505084600a036111855750505061119b565b5050505b8061119381612b92565b915050611021565b50806000036111dd576000604051806040016040528060128152602001714d6574612073657420666f722072616e676560701b8152509450945050505061181a565b600094506000816001600160401b038111156111fb576111fb612606565b604051908082528060200260200182016040528015611224578160200160208202803683370190505b5090506000826001600160401b0381111561124157611241612606565b60405190808252806020026020018201604052801561129657816020015b61128360408051606080820190925290815260208101600081526020016000905290565b81526020019060019003908161125f5790505b5090506000805b6112a78787612c6e565b6112b2906001612c85565b8110156117a85760006112c58289612c85565b905060006112d28261184f565b600081815260096020526040908190205460035491516307dc05c160e21b815260048101869052929350916001600160a01b0390911690631f70170490602401602060405180830381865afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190612ad4565b801561135e57508015155b80156113d45750600354604051634b632efb60e11b8152600481018590526001600160a01b03909116906396c65df690602401602060405180830381865afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d29190612ad4565b155b156117825760019b50828786815181106113f0576113f0612abe565b6020026020010181815250506000818460405160200161141a929190918252602082015260400190565b60408051808303601f190181529082905280516020909101206002546329cc09d560e21b83526004830182905290925060609160009182916101009091046001600160a01b03169063a730275490602401602060405180830381865afa158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190612bab565b905060008160058111156114c2576114c2612af6565b0361154757600254604051635bc7ed7560e11b8152600481018690526101009091046001600160a01b03169063b78fdaea906024015b600060405180830381865afa158015611515573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261153d9190810190612bc8565b9093509150611715565b600181600581111561155b5761155b612af6565b036115955760025460405163f530dec360e01b8152600481018690526101009091046001600160a01b03169063f530dec3906024016114f8565b60028160058111156115a9576115a9612af6565b036115e357600254604051633fbe12b760e01b8152600481018690526101009091046001600160a01b031690633fbe12b7906024016114f8565b60038160058111156115f7576115f7612af6565b03611631576002546040516307a59f5f60e31b8152600481018690526101009091046001600160a01b031690633d2cfaf8906024016114f8565b600581600581111561164557611645612af6565b0361167f57600254604051630e26064f60e31b8152600481018690526101009091046001600160a01b0316906371303278906024016114f8565b600481600581111561169357611693612af6565b036116cd57600254604051636825675760e11b8152600481018690526101009091046001600160a01b03169063d04aceae906024016114f8565b600060405180604001604052806016815260200175496e76616c69642065717569706d656e74207479706560501b8152509f509f50505050505050505050505050505061181a565b604051806060016040528084815260200182600581111561173857611738612af6565b815260200183600381111561174f5761174f612af6565b8152508a8a8151811061176457611764612abe565b6020026020010181905250888061177a90612b92565b995050505050505b84600a03611792575050506117a8565b50505080806117a090612b92565b91505061129d565b508715156000036117eb5760006040518060400160405280600e81526020016d139bdd1a1a5b99c81d1bc81cd95d60921b8152509750975050505050505061181a565b60008383604051602001611800929190612c9d565b60408051601f198184030181529190529750505050505050505b9250929050565b600061182c81611e9d565b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b6003546040516307dc05c160e21b8152600481018390526000916001600160a01b031690631f70170490602401602060405180830381865afa158015611899573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bd9190612ad4565b6118c957506000919050565b60006118d6603284612d4b565b90506118e3816001612c85565b9392505050565b60008281526001602052604081206118e39083611eee565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600061193681611e9d565b50600655565b60025460609061194e9060ff16611efa565b905090565b60007f240afcd1926e36e0297a1eb63ba484f52ddbef788e7f4e9b38b0dcc66de129e161197f81611e9d565b6003546001600160a01b03166119d75760405162461bcd60e51b815260206004820152601a60248201527f45717569706d656e7420636f6e7472616374206e6f742073657400000000000060448201526064016104fb565b600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4e9190612c55565b600003611a945760405162461bcd60e51b81526020600482015260146024820152732737903a37b5b2b71036b4b73a32b2103cb2ba1760611b60448201526064016104fb565b60006032600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611aeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0f9190612c55565b611b199190612d4b565b90506001841080611b335750611b30816001612c85565b84115b15611b785760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a590811d95b995c985d1a5bdb881259605a1b60448201526064016104fb565b60008481526009602052604090205415611bc85760405162461bcd60e51b81526020600482015260116024820152705365656420616c7265616479207365742160781b60448201526064016104fb565b600480546006546007546040516305d3b1d360e41b8152938401919091526001600160401b03166024830152600360448301526203a9806064830152600160848301526001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611c3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c619190612c55565b600081815260086020526040902094909455509192915050565b6060604051806060016040528060318152602001612e6460319139600254611cb69060ff166005811115611cb157611cb1612af6565b61208b565b604051602001611cc7929190612d5f565b604051602081830303815290604052905090565b600081815260016020526040812061047f90612193565b600082815260208190526040902060010154611d0d81611e9d565b6105378383611ecc565b6000611d2281611e9d565b506007805467ffffffffffffffff19166001600160401b0392909216919091179055565b611d508282611902565b61050e576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611d863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006118e3836001600160a01b03841661219d565b60006001600160e01b03198216630c934a3560e31b148061047f575061047f826121ec565b600082815260086020526040812054825190918391611e2557611e25612abe565b60200260200101516009600083815260200190815260200160002081905550807f272caaccb8c1b6534b8bfd35069b1e29a297a23883a46ac4e3fd91bdf685e4ca83600081518110611e7957611e79612abe565b6020026020010151604051611e9091815260200190565b60405180910390a2505050565b611ea78133612211565b50565b611eb48282611d46565b60008281526001602052604090206105379082611dca565b611ed68282612275565b600082815260016020526040902061053790826122da565b60006118e383836122ef565b60606006826005811115611f1057611f10612af6565b60ff161115611f1e57600080fd5b816005811115611f3057611f30612af6565b600003611f595750506040805180820190915260068152655055424c494360d01b602082015290565b816005811115611f6b57611f6b612af6565b600103611f975750506040805180820190915260098152684558434c555349564560b81b602082015290565b816005811115611fa957611fa9612af6565b600203611fd657505060408051808201909152600a81526910d3d353515490d2505360b21b602082015290565b816005811115611fe857611fe8612af6565b60030361201d575050604080518082019091526012815271434f4d4d45524349414c5f4e4f5f4841544560701b602082015290565b81600581111561202f5761202f612af6565b60040361205a57505060408051808201909152600881526714115494d3d3905360c21b602082015290565b505060408051808201909152601081526f504552534f4e414c5f4e4f5f4841544560801b602082015290565b919050565b6060816000036120b25750506040805180820190915260018152600360fc1b602082015290565b8160005b81156120dc57806120c681612b92565b91506120d59050600a83612d4b565b91506120b6565b6000816001600160401b038111156120f6576120f6612606565b6040519080825280601f01601f191660200182016040528015612120576020820181803683370190505b5090505b841561218b57612135600183612c6e565b9150612142600a86612d8e565b61214d906030612c85565b60f81b81838151811061216257612162612abe565b60200101906001600160f81b031916908160001a905350612184600a86612d4b565b9450612124565b949350505050565b600061047f825490565b60008181526001830160205260408120546121e45750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561047f565b50600061047f565b60006001600160e01b03198216635a05180f60e01b148061047f575061047f82612319565b61221b8282611902565b61050e57612233816001600160a01b0316601461234e565b61223e83602061234e565b60405160200161224f929190612da2565b60408051601f198184030181529082905262461bcd60e51b82526104fb916004016128c9565b61227f8282611902565b1561050e576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006118e3836001600160a01b0384166124e9565b600082600001828154811061230657612306612abe565b9060005260206000200154905092915050565b60006001600160e01b03198216637965db0b60e01b148061047f57506301ffc9a760e01b6001600160e01b031983161461047f565b6060600061235d836002612e17565b612368906002612c85565b6001600160401b0381111561237f5761237f612606565b6040519080825280601f01601f1916602001820160405280156123a9576020820181803683370190505b509050600360fc1b816000815181106123c4576123c4612abe565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106123f3576123f3612abe565b60200101906001600160f81b031916908160001a9053506000612417846002612e17565b612422906001612c85565b90505b600181111561249a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061245657612456612abe565b1a60f81b82828151811061246c5761246c612abe565b60200101906001600160f81b031916908160001a90535060049490941c9361249381612e36565b9050612425565b5083156118e35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104fb565b600081815260018301602052604081205480156125d257600061250d600183612c6e565b855490915060009061252190600190612c6e565b905081811461258657600086600001828154811061254157612541612abe565b906000526020600020015490508087600001848154811061256457612564612abe565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061259757612597612e4d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061047f565b600091505061047f565b6000602082840312156125ee57600080fd5b81356001600160e01b0319811681146118e357600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171561263e5761263e612606565b60405290565b604051601f8201601f191681016001600160401b038111828210171561266c5761266c612606565b604052919050565b60006001600160401b0382111561268d5761268d612606565b5060051b60200190565b600082601f8301126126a857600080fd5b813560206126bd6126b883612674565b612644565b82815260059290921b840181019181810190868411156126dc57600080fd5b8286015b848110156126f757803583529183019183016126e0565b509695505050505050565b6000806040838503121561271557600080fd5b8235915060208301356001600160401b0381111561273257600080fd5b61273e85828601612697565b9150509250929050565b60006020828403121561275a57600080fd5b5035919050565b80356001600160a01b038116811461208657600080fd5b6000806040838503121561278b57600080fd5b8235915061279b60208401612761565b90509250929050565b6000602082840312156127b657600080fd5b6118e382612761565b600080602083850312156127d257600080fd5b82356001600160401b03808211156127e957600080fd5b818501915085601f8301126127fd57600080fd5b81358181111561280c57600080fd5b86602082850101111561281e57600080fd5b60209290920196919550909350505050565b60005b8381101561284b578181015183820152602001612833565b8381111561285a576000848401525b50505050565b60008151808452612878816020860160208601612830565b601f01601f19169290920160200192915050565b821515815260406020820152600061218b6040830184612860565b600080604083850312156128ba57600080fd5b50508035926020909101359150565b6020815260006118e36020830184612860565b6000602082840312156128ee57600080fd5b81356001600160401b03811681146118e357600080fd5b60006001600160401b0382111561291e5761291e612606565b50601f01601f191660200190565b60068110611ea757600080fd5b80356120868161292c565b60048110611ea757600080fd5b803561208681612944565b6000806040838503121561296f57600080fd5b82356001600160401b038082111561298657600080fd5b61299286838701612697565b93506020915081850135818111156129a957600080fd5b8501601f810187136129ba57600080fd5b80356129c86126b882612674565b81815260059190911b820184019084810190898311156129e757600080fd5b8584015b83811015612aad57803586811115612a0257600080fd5b85016060818d03601f19011215612a1857600080fd5b612a2061261c565b8882013588811115612a3157600080fd5b8201603f81018e13612a4257600080fd5b89810135612a526126b882612905565b8181528f6040838501011115612a6757600080fd5b81604084018d83013760008c8383010152808452505050612a8a60408301612939565b89820152612a9a60608301612951565b60408201528452509186019186016129eb565b508096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612ae657600080fd5b815180151581146118e357600080fd5b634e487b7160e01b600052602160045260246000fd5b6000815160608452612b216060850182612860565b9050602083015160068110612b3857612b38612af6565b6020850152604083015160048110612b5257612b52612af6565b806040860152508091505092915050565b82815260406020820152600061218b6040830184612b0c565b634e487b7160e01b600052601160045260246000fd5b600060018201612ba457612ba4612b7c565b5060010190565b600060208284031215612bbd57600080fd5b81516118e38161292c565b60008060408385031215612bdb57600080fd5b82516001600160401b03811115612bf157600080fd5b8301601f81018513612c0257600080fd5b8051612c106126b882612905565b818152866020838501011115612c2557600080fd5b612c36826020830160208601612830565b8094505050506020830151612c4a81612944565b809150509250929050565b600060208284031215612c6757600080fd5b5051919050565b600082821015612c8057612c80612b7c565b500390565b60008219821115612c9857612c98612b7c565b500190565b604080825283519082018190526000906020906060840190828701845b82811015612cd657815184529284019290840190600101612cba565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015612d2657601f19868403018552612d14838351612b0c565b94870194925090860190600101612cf8565b50909998505050505050505050565b634e487b7160e01b600052601260045260246000fd5b600082612d5a57612d5a612d35565b500490565b60008351612d71818460208801612830565b835190830190612d85818360208801612830565b01949350505050565b600082612d9d57612d9d612d35565b500690565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612dda816017850160208801612830565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612e0b816028840160208801612830565b01602801949350505050565b6000816000190483118215151615612e3157612e31612b7c565b500290565b600081612e4557612e45612b7c565b506000190190565b634e487b7160e01b600052603160045260246000fdfe61723a2f2f7a6d63315754737049684679565938326277664149634945784c4648356c55634848554e307758673457382fa2646970667358221220027c8200e43c98c8628b86abee19d3af7315e3cecf000363af0df5a5d348442e64736f6c634300080d0033

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

000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699098af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef0000000000000000000000000000000000000000000000000000000000000264000000000000000000000000b180b78c98eeca254b6a3a9bf5541a95c3ee9323

-----Decoded View---------------
Arg [0] : coordinator_ (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909
Arg [1] : keyHash_ (bytes32): 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Arg [2] : subscriptionId_ (uint64): 612
Arg [3] : equipmentData_ (address): 0xb180B78c98EecA254B6A3A9bF5541A95C3eE9323

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Arg [1] : 8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000264
Arg [3] : 000000000000000000000000b180b78c98eeca254b6a3a9bf5541a95c3ee9323


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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