ETH Price: $3,166.84 (-7.37%)
Gas: 5 Gwei

Contract

0x850Ed40AabE4D06E4A8c00bA4480a469A92095C6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Burn181409402023-09-15 10:10:35314 days ago1694772635IN
0x850Ed40A...9A92095C6
0 ETH0.0014582810.26648864
Burn181379942023-09-15 0:13:23314 days ago1694736803IN
0x850Ed40A...9A92095C6
0 ETH0.0018933613.32955361
Burn181321172023-09-14 4:24:23315 days ago1694665463IN
0x850Ed40A...9A92095C6
0 ETH0.001246428.7742335
Burn181265662023-09-13 9:42:47316 days ago1694598167IN
0x850Ed40A...9A92095C6
0 ETH0.0036463425.66851681
Burn181027802023-09-10 1:44:23319 days ago1694310263IN
0x850Ed40A...9A92095C6
0 ETH0.001295748.98229896
Burn181027252023-09-10 1:33:23319 days ago1694309603IN
0x850Ed40A...9A92095C6
0 ETH0.001353239.3808481
Burn180957522023-09-09 2:06:35320 days ago1694225195IN
0x850Ed40A...9A92095C6
0 ETH0.0014221110.01100466
Burn180925562023-09-08 15:21:47321 days ago1694186507IN
0x850Ed40A...9A92095C6
0 ETH0.002309816.25992885
Burn180884222023-09-08 1:27:47321 days ago1694136467IN
0x850Ed40A...9A92095C6
0 ETH0.001622411.24679379
Burn180782092023-09-06 15:10:47323 days ago1694013047IN
0x850Ed40A...9A92095C6
0 ETH0.0074827840.67436355
Burn180720122023-09-05 18:18:47323 days ago1693937927IN
0x850Ed40A...9A92095C6
0 ETH0.0033632223.67547967
Burn180717392023-09-05 17:23:59324 days ago1693934639IN
0x850Ed40A...9A92095C6
0 ETH0.0043949630.94106723
Burn180643202023-09-04 16:30:35325 days ago1693845035IN
0x850Ed40A...9A92095C6
0 ETH0.0034235123.73235185
Burn180641982023-09-04 16:06:11325 days ago1693843571IN
0x850Ed40A...9A92095C6
0 ETH0.0048723229.74864098
Burn180329762023-08-31 7:11:11329 days ago1693465871IN
0x850Ed40A...9A92095C6
0 ETH0.0020619814.29404998
Burn180320312023-08-31 4:00:59329 days ago1693454459IN
0x850Ed40A...9A92095C6
0 ETH0.0026175618.42640747
Burn180057522023-08-27 11:38:11333 days ago1693136291IN
0x850Ed40A...9A92095C6
0 ETH0.0020863912.73971493
Burn179581602023-08-20 19:51:47339 days ago1692561107IN
0x850Ed40A...9A92095C6
0 ETH0.0022168315.36871873
Burn179421752023-08-18 14:09:23342 days ago1692367763IN
0x850Ed40A...9A92095C6
0 ETH0.0036820425.91985229
Burn179006742023-08-12 18:49:47347 days ago1691866187IN
0x850Ed40A...9A92095C6
0 ETH0.002100914.78936382
Burn179005442023-08-12 18:23:35347 days ago1691864615IN
0x850Ed40A...9A92095C6
0 ETH0.0018310312.88963436
Burn179004892023-08-12 18:12:35347 days ago1691863955IN
0x850Ed40A...9A92095C6
0 ETH0.0021423115.08091486
Burn178998832023-08-12 16:09:59348 days ago1691856599IN
0x850Ed40A...9A92095C6
0 ETH0.0042802630.1310085
Burn178993052023-08-12 14:14:11348 days ago1691849651IN
0x850Ed40A...9A92095C6
0 ETH0.0038177826.87541793
Burn178992462023-08-12 14:02:23348 days ago1691848943IN
0x850Ed40A...9A92095C6
0 ETH0.003775926.58282632
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:
TeslaCheck

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : TeslaCheck.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "./Token.sol";

struct PendingResult {
    address owner;
    uint16 random;
    bool received;
}

struct VrfConfig {
    address requestAddress;
    bytes32 keyHash;
    uint64 subId;
    uint16 confirmations;
    uint32 callbackGasLimit;
    uint32 numWords;
}

struct RequestStatus {
    uint16 processedCount;
    uint16 pendingToken;
    uint128 lastRequestAt;
}

contract TeslaCheck is VRFConsumerBaseV2, Ownable {
    address public NftAddress;
    VrfConfig public vrf;
    uint256 public startingTokenCount = 1200;

    uint256 public burningStartsAt;
    uint256 public burningEndsAt;
    bool public paused = false;

    uint256 public minRequestInterval = 10 minutes; // 10 * 60; // 600 seconds, 10 minutes

    RequestStatus public requestStatus;
    uint256 public winningToken = 9999;

    mapping(uint256 => PendingResult) public pendingRequests;

    event EntrySubmitted(
        address indexed operator,
        uint256 indexed token,
        uint256 indexed randomRequestId
    );
    event EntryProcessed(
        uint256 indexed token,
        uint256 indexed random,
        uint256 indexed tokensRemaining
    );
    event Winner(address indexed winner, uint256 indexed tokenID);
    event ResubmitRandom(
        uint256 indexed requesetId,
        uint256 indexed tokenID,
        uint256 indexed randomValue
    );
    event ConfigUpdated(address indexed operator, uint256 indexed timestamp);
    event Paused(address indexed operator, bool indexed isPaused);

    modifier unpaused() {
        require(!paused, "paused");
        _;
    }

    constructor(address vrfCoordinator) VRFConsumerBaseV2(vrfCoordinator) {
        requestStatus.pendingToken = 9999;
    }

    function config(
        address tokenAddress,
        uint256 startTs,
        uint256 endTs,
        uint256 minInterval,
        uint256 startingCount,
        VrfConfig memory v
    ) public onlyOwner {
        NftAddress = tokenAddress;
        burningStartsAt = startTs;
        burningEndsAt = endTs;
        minRequestInterval = minInterval;
        startingTokenCount = startingCount;
        vrf = v;
        emit ConfigUpdated(msg.sender, block.timestamp);
    }

    function setPaused(bool p) public onlyOwner {
        paused = p;
        emit Paused(msg.sender, p);
    }

    function resubmitRandom(
        uint256 token,
        uint256 requestId,
        uint256[] memory randomWords
    ) public onlyOwner {
        require(
            token == uint256(requestStatus.pendingToken),
            "can not submit random result for non-pending token"
        );
        processRandom(token, randomWords[0]);
    }

    function burn(uint256 token) public unpaused {
        require(
            isOwnerOrApprovedForToken(msg.sender, token),
            "you're not authorized to burn this token"
        );
        require(
            requestStatus.lastRequestAt <
                uint128(block.timestamp) - uint128(minRequestInterval),
            "can not burn yet"
        );
        require(
            requestStatus.pendingToken == 9999,
            "missing result from previous request"
        );
        require(winningToken == 9999, "winner has already been declared");
        require(block.timestamp > burningStartsAt, "burning is not open");
        require(block.timestamp <= burningEndsAt, "burning is closed");
        require(
            pendingRequests[token].owner == address(0),
            "token already burned"
        );

        requestStatus.lastRequestAt = uint128(block.timestamp);
        Token(NftAddress).burn(token);
        uint256 requestID = requestRandom();
        requestStatus.pendingToken = uint16(token);
        pendingRequests[token] = PendingResult(msg.sender, 0, false);

        emit EntrySubmitted(msg.sender, token, requestID);
    }

    function isOwnerOrApprovedForToken(address operator, uint256 token)
        internal
        view
        returns (bool)
    {
        Token t = Token(NftAddress);
        address owner = t.ownerOf(token);

        if (owner == operator) {
            return true;
        }

        if (t.isApprovedForAll(owner, operator)) {
            return true;
        }

        if (t.getApproved(token) == operator) {
            return true;
        }

        return false;
    }

    function requestRandom() internal returns (uint256) {
        uint256 requestID = VRFCoordinatorV2Interface(vrf.requestAddress)
            .requestRandomWords(
                vrf.keyHash,
                vrf.subId,
                vrf.confirmations,
                vrf.callbackGasLimit,
                vrf.numWords
            );

        return requestID;
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords)
        internal
        virtual
        override
    {
        require(
            requestStatus.pendingToken != 9999,
            "unexpected random request"
        );
        processRandom(requestStatus.pendingToken, randomWords[0]);
    }

    function processRandom(uint256 token, uint256 random) internal {
        require(
            pendingRequests[token].owner != address(0) &&
                pendingRequests[token].received == false,
            "unexpected random response"
        );

        pendingRequests[token].received = true;

        emit EntryProcessed(
            token,
            random,
            startingTokenCount - uint256(requestStatus.processedCount)
        );

        if (isWinnable(random)) {
            if (winningToken == 9999) {
                winningToken = uint16(token);
                emit Winner(pendingRequests[token].owner, token);
            }
        }

        pendingRequests[token].random = uint16(
            random %
                (startingTokenCount - uint256(requestStatus.processedCount))
        );
        requestStatus.pendingToken = 9999;
        requestStatus.processedCount++;
    }

    function isWinnable(uint256 random) internal view returns (bool) {
        if (random % (startingTokenCount - requestStatus.processedCount) != 0) {
            return false;
        }

        return true;
    }

    function getWinningToken() public view returns (bool, uint256) {
        return (winningToken != 9999, uint256(winningToken));
    }

    function getTokenRequest(uint256 token)
        public
        view
        returns (bool, PendingResult memory)
    {
        return (
            pendingRequests[token].owner != address(0),
            pendingRequests[token]
        );
    }

    function canSubmitAt() public view returns (bool, uint64) {
        if (requestStatus.pendingToken != 9999) {
            return (false, 0);
        }

        bool canSubmit = block.timestamp >
            requestStatus.lastRequestAt + minRequestInterval;

        return (
            canSubmit,
            uint64(requestStatus.lastRequestAt + minRequestInterval)
        );
    }
}

interface IBurn {
    event EntrySubmitted(
        address indexed operator,
        uint256 indexed token,
        uint256 indexed randomRequestId
    );
    event EntryProcessed(
        uint256 indexed token,
        uint256 indexed random,
        uint256 indexed tokensRemaining
    );
    event Winner(address indexed winner, uint256 indexed tokenID);

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

    event RandomWordsRequested(
        bytes32 indexed keyHash,
        uint256 requestId,
        uint256 preSeed,
        uint64 indexed subId,
        uint16 minimumRequestConfirmations,
        uint32 callbackGasLimit,
        uint32 numWords,
        address indexed sender
    );

    function burn(uint256 token) external;

    function canSubmitAt() external view returns (bool, uint64);
}

File 2 of 11 : 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 3 of 11 : 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 4 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 11 : 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 6 of 11 : Token.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "operator-filter-registry/src/UpdatableOperatorFilterer.sol";
import {
	CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
	CANONICAL_CORI_SUBSCRIPTION
} from "operator-filter-registry/src/lib/Constants.sol";

interface TokenMetadataInterface {
    function tokenURI(uint256 token) external view returns (string memory);
}

interface IToken {
    function isApprovedForAll(address owner, address operator)
        external
        view
        returns (bool);

    function setApprovalForAll(address operator, bool approved) external;
}

contract Token is UpdatableOperatorFilterer, ERC721A, Ownable {
    string private _name;
    string private _symbol;
    string private _metadataRoot;
    string private _contractMetadataRoot;
    uint256 private _maxSupply;
    address public _mintContract;
    address public _burnContract;
    address public _metadataContract;

    event MetadataContractUpdated(address contractAddress);

    modifier onlyBurner() {
        require(
            msg.sender == _burnContract,
            "Only burning contract can burn tokens."
        );
        _;
    }

    modifier onlyMinter() {
        require(
            msg.sender == _mintContract,
            "Only mint contract can mint tokens."
        );
        _;
    }

    constructor(
        string memory name_,
        string memory symbol_,
        string memory metadataRoot_,
        string memory contractMetadataRoot_,
        uint256 maxSupply_
    ) UpdatableOperatorFilterer(
		CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
		CANONICAL_CORI_SUBSCRIPTION,
		true
	) ERC721A(name_, symbol_) {
        _name = name_;
        _symbol = symbol_;
        _metadataRoot = metadataRoot_;
        _contractMetadataRoot = contractMetadataRoot_;
        _maxSupply = maxSupply_;
    }

	function owner() public view override(UpdatableOperatorFilterer, Ownable) returns(address) {
		return Ownable.owner();
	}

    function updateTokenInfo(
        string memory name_,
        string memory symbol_,
        string memory metadataRoot_,
        string memory contractMetadataRoot_
    ) public onlyOwner {
        _name = name_;
        _symbol = symbol_;
        _metadataRoot = metadataRoot_;
        _contractMetadataRoot = contractMetadataRoot_;
    }

    function setMintContract(address addr) public onlyOwner {
        _mintContract = addr;
    }

    function mintContract() public view returns (address) {
        return _mintContract;
    }

    function setBurnContract(address addr) public onlyOwner {
        _burnContract = addr;
    }

    function burnContract() public view returns (address) {
        return _burnContract;
    }

    function name() public view override returns (string memory) {
        return _name;
    }

    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    function _baseURI() internal view override returns (string memory) {
        return _metadataRoot;
    }

    function tokenURI(uint256 token)
        public
        view
        override
        returns (string memory)
    {
        if (_metadataContract != address(0)) {
            return TokenMetadataInterface(_metadataContract).tokenURI(token);
        }

        return ERC721A.tokenURI(token);
    }

    function setMetadataContract(address c) public onlyOwner {
        _metadataContract = c;
        emit MetadataContractUpdated(c);
    }

    function contractURI() public view returns (string memory) {
        return _contractMetadataRoot;
    }

    function totalMinted() public view returns (uint256) {
        return _totalMinted();
    }

    function maxSupply() public view returns (uint256) {
        return _maxSupply;
    }

    function batchSafeTransferFrom(
        address[] calldata from,
        address[] calldata to,
        uint64[] calldata tokens
    ) public {
        require(
            from.length == to.length && to.length == tokens.length,
            "Array mismatch"
        );
        for (uint256 i = 0; i < from.length; i++) {
            safeTransferFrom(from[i], to[i], tokens[i]);
        }
    }

    function mint(address to, uint256 quantity) public onlyMinter {
        require(
            quantity + _totalMinted() <= _maxSupply,
            "Quantity exceeds max supply."
        );

        _safeMint(to, quantity);
    }

    function burn(uint256 token) public onlyBurner {
        _burn(token, true);
    }

	function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    function approve(address operator, uint256 tokenId) payable public override onlyAllowedOperatorApproval(operator) {
        super.approve(operator, tokenId);
    }

    function transferFrom(address from, address to, uint256 tokenId) payable public override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId) payable public override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
		payable
        public
        override
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId, data);
    }
}

File 7 of 11 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant _BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant _BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant _BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant _BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant _BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant _BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with {_mintERC2309}.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned.
    // See {_packedOwnershipOf} implementation for details.
    //
    // Bits Layout:
    // - [0..159]   `addr`
    // - [160..223] `startTimestamp`
    // - [224]      `burned`
    // - [225]      `nextInitialized`
    // - [232..255] `extraData`
    mapping(uint256 => uint256) private _packedOwnerships;

    // Mapping owner address to address data.
    //
    // Bits Layout:
    // - [0..63]    `balance`
    // - [64..127]  `numberMinted`
    // - [128..191] `numberBurned`
    // - [192..255] `aux`
    mapping(address => uint256) private _packedAddressData;

    // Mapping from token ID to approved address.
    mapping(uint256 => TokenApprovalRef) private _tokenApprovals;

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

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view virtual returns (uint256) {
        return _currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view virtual returns (uint256) {
        return _burnCounter;
    }

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal virtual {
        uint256 packed = _packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        _packedAddressData[owner] = packed;
    }

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

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

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

    /**
     * @dev Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around over time.
     */
    function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal virtual {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // If not burned.
                    if (packed & _BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an initialized ownership slot
                        // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                        // before an unintialized ownership slot
                        // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                        // Hence, `curr` will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed will be zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @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) public payable virtual override {
        address owner = ownerOf(tokenId);

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @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) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
     */
    function _isSenderApprovedOrOwner(
        address approvedAddress,
        address owner,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, _BITMASK_ADDRESS)
            // `msgSender == owner || msgSender == approvedAddress`.
            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * 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
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_packedAddressData[from]; // Updates: `balance -= 1`.
            ++_packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @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 memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token IDs
     * have been transferred. This includes minting.
     * And also called after one token has been burned.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, '');
    }

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            _burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
        uint256 packed = _packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        _packedOwnerships[index] = packed;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }
}

File 8 of 11 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

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

    /**
     * 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();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

    /**
     * @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`,
     * 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 be 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,
        bytes calldata data
    ) external payable;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` 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 payable;

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

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

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

File 9 of 11 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    /**
     * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
     *         true if supplied registrant address is not registered.
     */
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);

    /**
     * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
     */
    function register(address registrant) external;

    /**
     * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
     */
    function registerAndSubscribe(address registrant, address subscription) external;

    /**
     * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
     *         address without subscribing.
     */
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;

    /**
     * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
     *         Note that this does not remove any filtered addresses or codeHashes.
     *         Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
     */
    function unregister(address addr) external;

    /**
     * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
     */
    function updateOperator(address registrant, address operator, bool filtered) external;

    /**
     * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
     */
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;

    /**
     * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
     */
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;

    /**
     * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
     */
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;

    /**
     * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
     *         subscription if present.
     *         Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
     *         subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
     *         used.
     */
    function subscribe(address registrant, address registrantToSubscribe) external;

    /**
     * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
     */
    function unsubscribe(address registrant, bool copyExistingEntries) external;

    /**
     * @notice Get the subscription address of a given registrant, if any.
     */
    function subscriptionOf(address addr) external returns (address registrant);

    /**
     * @notice Get the set of addresses subscribed to a given registrant.
     *         Note that order is not guaranteed as updates are made.
     */
    function subscribers(address registrant) external returns (address[] memory);

    /**
     * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
     *         Note that order is not guaranteed as updates are made.
     */
    function subscriberAt(address registrant, uint256 index) external returns (address);

    /**
     * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
     */
    function copyEntriesOf(address registrant, address registrantToCopy) external;

    /**
     * @notice Returns true if operator is filtered by a given address or its subscription.
     */
    function isOperatorFiltered(address registrant, address operator) external returns (bool);

    /**
     * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
     */
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);

    /**
     * @notice Returns true if a codeHash is filtered by a given address or its subscription.
     */
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);

    /**
     * @notice Returns a list of filtered operators for a given address or its subscription.
     */
    function filteredOperators(address addr) external returns (address[] memory);

    /**
     * @notice Returns the set of filtered codeHashes for a given address or its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);

    /**
     * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
     *         its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);

    /**
     * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
     *         its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);

    /**
     * @notice Returns true if an address has registered
     */
    function isRegistered(address addr) external returns (bool);

    /**
     * @dev Convenience method to compute the code hash of an arbitrary contract
     */
    function codeHashOf(address addr) external returns (bytes32);
}

File 10 of 11 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E;
address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

File 11 of 11 : UpdatableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

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

/**
 * @title  UpdatableOperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
 *         OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
 *         which will bypass registry checks.
 *         Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 */
abstract contract UpdatableOperatorFilterer {
    /// @dev Emitted when an operator is not allowed.
    error OperatorNotAllowed(address operator);
    /// @dev Emitted when someone other than the owner is trying to call an only owner function.
    error OnlyOwner();

    event OperatorFilterRegistryAddressUpdated(address newRegistry);

    IOperatorFilterRegistry public operatorFilterRegistry;

    /// @dev The constructor that is called when the contract is being deployed.
    constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
        IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
        operatorFilterRegistry = registry;
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(registry).code.length > 0) {
            if (subscribe) {
                registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    registry.register(address(this));
                }
            }
        }
    }

    /**
     * @dev A helper function to check if the operator is allowed.
     */
    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    /**
     * @dev A helper function to check if the operator approval is allowed.
     */
    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be bypassed. OnlyOwner.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
        emit OperatorFilterRegistryAddressUpdated(newRegistry);
    }

    /**
     * @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract.
     */
    function owner() public view virtual returns (address);

    /**
     * @dev A helper function to check if the operator is allowed.
     */
    function _checkFilterOperator(address operator) internal view virtual {
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(registry) != address(0) && address(registry).code.length > 0) {
            // under normal circumstances, this function will revert rather than return false, but inheriting contracts
            // may specify their own OperatorFilterRegistry implementations, which may behave differently
            if (!registry.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"vrfCoordinator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"random","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensRemaining","type":"uint256"}],"name":"EntryProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"randomRequestId","type":"uint256"}],"name":"EntrySubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requesetId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"randomValue","type":"uint256"}],"name":"ResubmitRandom","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"winner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"Winner","type":"event"},{"inputs":[],"name":"NftAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burningEndsAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burningStartsAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canSubmitAt","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"startTs","type":"uint256"},{"internalType":"uint256","name":"endTs","type":"uint256"},{"internalType":"uint256","name":"minInterval","type":"uint256"},{"internalType":"uint256","name":"startingCount","type":"uint256"},{"components":[{"internalType":"address","name":"requestAddress","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint64","name":"subId","type":"uint64"},{"internalType":"uint16","name":"confirmations","type":"uint16"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"},{"internalType":"uint32","name":"numWords","type":"uint32"}],"internalType":"struct VrfConfig","name":"v","type":"tuple"}],"name":"config","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"getTokenRequest","outputs":[{"internalType":"bool","name":"","type":"bool"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint16","name":"random","type":"uint16"},{"internalType":"bool","name":"received","type":"bool"}],"internalType":"struct PendingResult","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWinningToken","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRequestInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingRequests","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint16","name":"random","type":"uint16"},{"internalType":"bool","name":"received","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestStatus","outputs":[{"internalType":"uint16","name":"processedCount","type":"uint16"},{"internalType":"uint16","name":"pendingToken","type":"uint16"},{"internalType":"uint128","name":"lastRequestAt","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"resubmitRandom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"p","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startingTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vrf","outputs":[{"internalType":"address","name":"requestAddress","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint64","name":"subId","type":"uint64"},{"internalType":"uint16","name":"confirmations","type":"uint16"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"},{"internalType":"uint32","name":"numWords","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winningToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a06040526104b06005556008805460ff1916905561025860095561270f600b5534801561002c57600080fd5b5060405161172b38038061172b83398101604081905261004b916100ca565b6001600160a01b0381166080526100613361007a565b50600a805463ffff0000191663270f00001790556100fa565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100dc57600080fd5b81516001600160a01b03811681146100f357600080fd5b9392505050565b60805161160f61011c600039600081816104fb015261053d015261160f6000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806366844205116100b8578063be9cd2831161007c578063be9cd283146103fd578063c36dfdb314610425578063cb7ba7061461047b578063e283a32514610484578063f2fde38b1461048d578063f3d73cf5146104a057600080fd5b806366844205146102fc578063715018a6146103ab5780638da5cb5b146103b3578063a4226390146103c4578063b600ab1a146103ea57600080fd5b8063361bc1b5116100ff578063361bc1b5146102415780633c652a9a1461025857806342966c68146102c35780635024076e146102d65780635c975abb146102df57600080fd5b80630c9490431461013c57806316c38b3c146101db5780631fe543e3146101f057806327fac763146102035780632dff37d31461022e575b600080fd5b600254600354600454610186926001600160a01b0316919067ffffffffffffffff81169061ffff600160401b8204169063ffffffff600160501b8204811691600160701b90041686565b604080516001600160a01b039097168752602087019590955267ffffffffffffffff9093169385019390935261ffff16606084015263ffffffff91821660808401521660a082015260c0015b60405180910390f35b6101ee6101e93660046111e2565b6104a9565b005b6101ee6101fe3660046112e0565b6104f0565b600154610216906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b6101ee61023c366004611327565b61057d565b61024a600b5481565b6040519081526020016101d2565b610299610266366004611377565b600c602052600090815260409020546001600160a01b03811690600160a01b810461ffff1690600160b01b900460ff1683565b604080516001600160a01b03909416845261ffff90921660208401521515908201526060016101d2565b6101ee6102d1366004611377565b610624565b61024a60095481565b6008546102ec9060ff1681565b60405190151581526020016101d2565b61037261030a366004611377565b604080516060808201835260008083526020808401829052928401819052938452600c82529282902054825193840183526001600160a01b038116808552600160a01b820461ffff1692850192909252600160b01b900460ff16151591830191909152151591565b60408051921515835281516001600160a01b031660208085019190915282015161ffff16838201520151151560608201526080016101d2565b6101ee610a24565b6000546001600160a01b0316610216565b6103d3600b5461270f81141591565b6040805192151583526020830191909152016101d2565b6101ee6103f83660046113d0565b610a38565b610405610b3f565b60408051921515835267ffffffffffffffff9091166020830152016101d2565b600a546104519061ffff808216916201000081049091169064010000000090046001600160801b031683565b6040805161ffff94851681529390921660208401526001600160801b0316908201526060016101d2565b61024a60055481565b61024a60065481565b6101ee61049b3660046114ad565b610bb8565b61024a60075481565b6104b1610c31565b6008805460ff191682151590811790915560405133907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d90600090a350565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461056f5760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6105798282610c8b565b5050565b610585610c31565b600a5462010000900461ffff1683146105fb5760405162461bcd60e51b815260206004820152603260248201527f63616e206e6f74207375626d69742072616e646f6d20726573756c7420666f72604482015271103737b716b832b73234b733903a37b5b2b760711b6064820152608401610566565b61061f8382600081518110610612576106126114ca565b6020026020010151610d0d565b505050565b60085460ff16156106605760405162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b6044820152606401610566565b61066a3382610ee0565b6106c75760405162461bcd60e51b815260206004820152602860248201527f796f75277265206e6f7420617574686f72697a656420746f206275726e20746860448201526734b9903a37b5b2b760c11b6064820152608401610566565b6009546106d490426114f6565b600a546001600160801b039182166401000000009091049091161061072e5760405162461bcd60e51b815260206004820152601060248201526f18d85b881b9bdd08189d5c9b881e595d60821b6044820152606401610566565b600a5462010000900461ffff1661270f146107975760405162461bcd60e51b8152602060048201526024808201527f6d697373696e6720726573756c742066726f6d2070726576696f7573207265716044820152631d595cdd60e21b6064820152608401610566565b600b5461270f146107ea5760405162461bcd60e51b815260206004820181905260248201527f77696e6e65722068617320616c7265616479206265656e206465636c617265646044820152606401610566565b60065442116108315760405162461bcd60e51b8152602060048201526013602482015272313ab93734b7339034b9903737ba1037b832b760691b6044820152606401610566565b6007544211156108775760405162461bcd60e51b8152602060048201526011602482015270189d5c9b9a5b99c81a5cc818db1bdcd959607a1b6044820152606401610566565b6000818152600c60205260409020546001600160a01b0316156108d35760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88185b1c9958591e48189d5c9b995960621b6044820152606401610566565b600a805473ffffffffffffffffffffffffffffffff000000001916640100000000426001600160801b031602179055600154604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561094857600080fd5b505af115801561095c573d6000803e3d6000fd5b50505050600061096a61108e565b600a805461ffff808616620100000263ffff000019909216919091179091556040805160608101825233808252600060208084018281528486018381528a8452600c90925285832094518554915192511515600160b01b0260ff60b01b1993909816600160a01b026001600160b01b03199092166001600160a01b0391909116171716949094179091559051929350839285927f5bd82bc19878554c415d5ffda66a673ff0cf506a57f64c3e9c428e76d474900291a45050565b610a2c610c31565b610a36600061114c565b565b610a40610c31565b600180546001600160a01b038089166001600160a01b03199283161790925560068790556007869055600985905560058490558251600280549190931691161790556020810151600355604080820151600480546060850151608086015160a087015163ffffffff908116600160701b0263ffffffff60701b1991909216600160501b021667ffffffffffffffff60501b1961ffff909316600160401b0269ffffffffffffffffffff1990941667ffffffffffffffff9096169590951792909217169290921791909117905551429033907faf8839d80c9b3bbf95c97465eb8c8348db4098f5c15af186c3b425b11299811790600090a3505050505050565b600a54600090819062010000900461ffff1661270f14610b625750600091829150565b600954600a54600091610b859164010000000090046001600160801b031661151d565b600954600a54429290921192508291610baf919064010000000090046001600160801b031661151d565b92509250509091565b610bc0610c31565b6001600160a01b038116610c255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610566565b610c2e8161114c565b50565b6000546001600160a01b03163314610a365760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610566565b600a5462010000900461ffff1661270f03610ce85760405162461bcd60e51b815260206004820152601960248201527f756e65787065637465642072616e646f6d2072657175657374000000000000006044820152606401610566565b600a5481516105799162010000900461ffff16908390600090610612576106126114ca565b6000828152600c60205260409020546001600160a01b031615801590610d4957506000828152600c6020526040902054600160b01b900460ff16155b610d955760405162461bcd60e51b815260206004820152601a60248201527f756e65787065637465642072616e646f6d20726573706f6e73650000000000006044820152606401610566565b6000828152600c60205260409020805460ff60b01b1916600160b01b179055600a54600554610dc89161ffff1690611530565b604051829084907f2caaf608f3c23654af1ceb4057e08c3b0551e3219a539d8c55fbedaa7fcdbed290600090a4610dfe8161119c565b15610e5a57600b5461270f03610e5a5761ffff8216600b556000828152600c602052604080822054905184926001600160a01b03909216917f9c2270628a9b29d30ae96b6c4c14ed646ee134febdce38a5b77f2bde9cea2e2091a35b600a54600554610e6e9161ffff1690611530565b610e789082611543565b6000838152600c60205260408120805461ffff60a01b1916600160a01b61ffff94851602179055600a805463ffff000019811663270f00001782559092169190610ec183611565565b91906101000a81548161ffff021916908361ffff160217905550505050565b6001546040516331a9108f60e11b8152600481018390526000916001600160a01b03169082908290636352211e90602401602060405180830381865afa158015610f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f529190611586565b9050846001600160a01b0316816001600160a01b031603610f7857600192505050611088565b60405163e985e9c560e01b81526001600160a01b038281166004830152868116602483015283169063e985e9c590604401602060405180830381865afa158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea91906115a3565b15610ffa57600192505050611088565b60405163020604bf60e21b8152600481018590526001600160a01b03808716919084169063081812fc90602401602060405180830381865afa158015611044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110689190611586565b6001600160a01b03160361108157600192505050611088565b6000925050505b92915050565b600254600354600480546040516305d3b1d360e41b81529182019290925267ffffffffffffffff8216602482015261ffff600160401b830416604482015263ffffffff600160501b830481166064830152600160701b909204909116608482015260009182916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108891906115c0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600a546005546000916111b59161ffff90911690611530565b6111bf9083611543565b156111cc57506000919050565b506001919050565b8015158114610c2e57600080fd5b6000602082840312156111f457600080fd5b81356111ff816111d4565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff8111828210171561123f5761123f611206565b60405290565b600082601f83011261125657600080fd5b8135602067ffffffffffffffff8083111561127357611273611206565b8260051b604051601f19603f8301168101818110848211171561129857611298611206565b6040529384528581018301938381019250878511156112b657600080fd5b83870191505b848210156112d5578135835291830191908301906112bc565b979650505050505050565b600080604083850312156112f357600080fd5b82359150602083013567ffffffffffffffff81111561131157600080fd5b61131d85828601611245565b9150509250929050565b60008060006060848603121561133c57600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561136157600080fd5b61136d86828701611245565b9150509250925092565b60006020828403121561138957600080fd5b5035919050565b6001600160a01b0381168114610c2e57600080fd5b803561ffff811681146113b757600080fd5b919050565b803563ffffffff811681146113b757600080fd5b6000806000806000808688036101608112156113eb57600080fd5b87356113f681611390565b96506020880135955060408801359450606088013593506080880135925060c0609f198201121561142657600080fd5b5061142f61121c565b60a088013561143d81611390565b815260c0880135602082015260e088013567ffffffffffffffff8116811461146457600080fd5b604082015261147661010089016113a5565b606082015261148861012089016113bc565b608082015261149a61014089016113bc565b60a0820152809150509295509295509295565b6000602082840312156114bf57600080fd5b81356111ff81611390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160801b03828116828216039080821115611516576115166114e0565b5092915050565b80820180821115611088576110886114e0565b81810381811115611088576110886114e0565b60008261156057634e487b7160e01b600052601260045260246000fd5b500690565b600061ffff80831681810361157c5761157c6114e0565b6001019392505050565b60006020828403121561159857600080fd5b81516111ff81611390565b6000602082840312156115b557600080fd5b81516111ff816111d4565b6000602082840312156115d257600080fd5b505191905056fea26469706673582212206dd86449eb6121df45e55e3a6652ce95e51333a16a7e0a9d46fe286d00a371fd64736f6c63430008110033000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101375760003560e01c806366844205116100b8578063be9cd2831161007c578063be9cd283146103fd578063c36dfdb314610425578063cb7ba7061461047b578063e283a32514610484578063f2fde38b1461048d578063f3d73cf5146104a057600080fd5b806366844205146102fc578063715018a6146103ab5780638da5cb5b146103b3578063a4226390146103c4578063b600ab1a146103ea57600080fd5b8063361bc1b5116100ff578063361bc1b5146102415780633c652a9a1461025857806342966c68146102c35780635024076e146102d65780635c975abb146102df57600080fd5b80630c9490431461013c57806316c38b3c146101db5780631fe543e3146101f057806327fac763146102035780632dff37d31461022e575b600080fd5b600254600354600454610186926001600160a01b0316919067ffffffffffffffff81169061ffff600160401b8204169063ffffffff600160501b8204811691600160701b90041686565b604080516001600160a01b039097168752602087019590955267ffffffffffffffff9093169385019390935261ffff16606084015263ffffffff91821660808401521660a082015260c0015b60405180910390f35b6101ee6101e93660046111e2565b6104a9565b005b6101ee6101fe3660046112e0565b6104f0565b600154610216906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b6101ee61023c366004611327565b61057d565b61024a600b5481565b6040519081526020016101d2565b610299610266366004611377565b600c602052600090815260409020546001600160a01b03811690600160a01b810461ffff1690600160b01b900460ff1683565b604080516001600160a01b03909416845261ffff90921660208401521515908201526060016101d2565b6101ee6102d1366004611377565b610624565b61024a60095481565b6008546102ec9060ff1681565b60405190151581526020016101d2565b61037261030a366004611377565b604080516060808201835260008083526020808401829052928401819052938452600c82529282902054825193840183526001600160a01b038116808552600160a01b820461ffff1692850192909252600160b01b900460ff16151591830191909152151591565b60408051921515835281516001600160a01b031660208085019190915282015161ffff16838201520151151560608201526080016101d2565b6101ee610a24565b6000546001600160a01b0316610216565b6103d3600b5461270f81141591565b6040805192151583526020830191909152016101d2565b6101ee6103f83660046113d0565b610a38565b610405610b3f565b60408051921515835267ffffffffffffffff9091166020830152016101d2565b600a546104519061ffff808216916201000081049091169064010000000090046001600160801b031683565b6040805161ffff94851681529390921660208401526001600160801b0316908201526060016101d2565b61024a60055481565b61024a60065481565b6101ee61049b3660046114ad565b610bb8565b61024a60075481565b6104b1610c31565b6008805460ff191682151590811790915560405133907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d90600090a350565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909161461056f5760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044015b60405180910390fd5b6105798282610c8b565b5050565b610585610c31565b600a5462010000900461ffff1683146105fb5760405162461bcd60e51b815260206004820152603260248201527f63616e206e6f74207375626d69742072616e646f6d20726573756c7420666f72604482015271103737b716b832b73234b733903a37b5b2b760711b6064820152608401610566565b61061f8382600081518110610612576106126114ca565b6020026020010151610d0d565b505050565b60085460ff16156106605760405162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b6044820152606401610566565b61066a3382610ee0565b6106c75760405162461bcd60e51b815260206004820152602860248201527f796f75277265206e6f7420617574686f72697a656420746f206275726e20746860448201526734b9903a37b5b2b760c11b6064820152608401610566565b6009546106d490426114f6565b600a546001600160801b039182166401000000009091049091161061072e5760405162461bcd60e51b815260206004820152601060248201526f18d85b881b9bdd08189d5c9b881e595d60821b6044820152606401610566565b600a5462010000900461ffff1661270f146107975760405162461bcd60e51b8152602060048201526024808201527f6d697373696e6720726573756c742066726f6d2070726576696f7573207265716044820152631d595cdd60e21b6064820152608401610566565b600b5461270f146107ea5760405162461bcd60e51b815260206004820181905260248201527f77696e6e65722068617320616c7265616479206265656e206465636c617265646044820152606401610566565b60065442116108315760405162461bcd60e51b8152602060048201526013602482015272313ab93734b7339034b9903737ba1037b832b760691b6044820152606401610566565b6007544211156108775760405162461bcd60e51b8152602060048201526011602482015270189d5c9b9a5b99c81a5cc818db1bdcd959607a1b6044820152606401610566565b6000818152600c60205260409020546001600160a01b0316156108d35760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88185b1c9958591e48189d5c9b995960621b6044820152606401610566565b600a805473ffffffffffffffffffffffffffffffff000000001916640100000000426001600160801b031602179055600154604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561094857600080fd5b505af115801561095c573d6000803e3d6000fd5b50505050600061096a61108e565b600a805461ffff808616620100000263ffff000019909216919091179091556040805160608101825233808252600060208084018281528486018381528a8452600c90925285832094518554915192511515600160b01b0260ff60b01b1993909816600160a01b026001600160b01b03199092166001600160a01b0391909116171716949094179091559051929350839285927f5bd82bc19878554c415d5ffda66a673ff0cf506a57f64c3e9c428e76d474900291a45050565b610a2c610c31565b610a36600061114c565b565b610a40610c31565b600180546001600160a01b038089166001600160a01b03199283161790925560068790556007869055600985905560058490558251600280549190931691161790556020810151600355604080820151600480546060850151608086015160a087015163ffffffff908116600160701b0263ffffffff60701b1991909216600160501b021667ffffffffffffffff60501b1961ffff909316600160401b0269ffffffffffffffffffff1990941667ffffffffffffffff9096169590951792909217169290921791909117905551429033907faf8839d80c9b3bbf95c97465eb8c8348db4098f5c15af186c3b425b11299811790600090a3505050505050565b600a54600090819062010000900461ffff1661270f14610b625750600091829150565b600954600a54600091610b859164010000000090046001600160801b031661151d565b600954600a54429290921192508291610baf919064010000000090046001600160801b031661151d565b92509250509091565b610bc0610c31565b6001600160a01b038116610c255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610566565b610c2e8161114c565b50565b6000546001600160a01b03163314610a365760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610566565b600a5462010000900461ffff1661270f03610ce85760405162461bcd60e51b815260206004820152601960248201527f756e65787065637465642072616e646f6d2072657175657374000000000000006044820152606401610566565b600a5481516105799162010000900461ffff16908390600090610612576106126114ca565b6000828152600c60205260409020546001600160a01b031615801590610d4957506000828152600c6020526040902054600160b01b900460ff16155b610d955760405162461bcd60e51b815260206004820152601a60248201527f756e65787065637465642072616e646f6d20726573706f6e73650000000000006044820152606401610566565b6000828152600c60205260409020805460ff60b01b1916600160b01b179055600a54600554610dc89161ffff1690611530565b604051829084907f2caaf608f3c23654af1ceb4057e08c3b0551e3219a539d8c55fbedaa7fcdbed290600090a4610dfe8161119c565b15610e5a57600b5461270f03610e5a5761ffff8216600b556000828152600c602052604080822054905184926001600160a01b03909216917f9c2270628a9b29d30ae96b6c4c14ed646ee134febdce38a5b77f2bde9cea2e2091a35b600a54600554610e6e9161ffff1690611530565b610e789082611543565b6000838152600c60205260408120805461ffff60a01b1916600160a01b61ffff94851602179055600a805463ffff000019811663270f00001782559092169190610ec183611565565b91906101000a81548161ffff021916908361ffff160217905550505050565b6001546040516331a9108f60e11b8152600481018390526000916001600160a01b03169082908290636352211e90602401602060405180830381865afa158015610f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f529190611586565b9050846001600160a01b0316816001600160a01b031603610f7857600192505050611088565b60405163e985e9c560e01b81526001600160a01b038281166004830152868116602483015283169063e985e9c590604401602060405180830381865afa158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea91906115a3565b15610ffa57600192505050611088565b60405163020604bf60e21b8152600481018590526001600160a01b03808716919084169063081812fc90602401602060405180830381865afa158015611044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110689190611586565b6001600160a01b03160361108157600192505050611088565b6000925050505b92915050565b600254600354600480546040516305d3b1d360e41b81529182019290925267ffffffffffffffff8216602482015261ffff600160401b830416604482015263ffffffff600160501b830481166064830152600160701b909204909116608482015260009182916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108891906115c0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600a546005546000916111b59161ffff90911690611530565b6111bf9083611543565b156111cc57506000919050565b506001919050565b8015158114610c2e57600080fd5b6000602082840312156111f457600080fd5b81356111ff816111d4565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff8111828210171561123f5761123f611206565b60405290565b600082601f83011261125657600080fd5b8135602067ffffffffffffffff8083111561127357611273611206565b8260051b604051601f19603f8301168101818110848211171561129857611298611206565b6040529384528581018301938381019250878511156112b657600080fd5b83870191505b848210156112d5578135835291830191908301906112bc565b979650505050505050565b600080604083850312156112f357600080fd5b82359150602083013567ffffffffffffffff81111561131157600080fd5b61131d85828601611245565b9150509250929050565b60008060006060848603121561133c57600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561136157600080fd5b61136d86828701611245565b9150509250925092565b60006020828403121561138957600080fd5b5035919050565b6001600160a01b0381168114610c2e57600080fd5b803561ffff811681146113b757600080fd5b919050565b803563ffffffff811681146113b757600080fd5b6000806000806000808688036101608112156113eb57600080fd5b87356113f681611390565b96506020880135955060408801359450606088013593506080880135925060c0609f198201121561142657600080fd5b5061142f61121c565b60a088013561143d81611390565b815260c0880135602082015260e088013567ffffffffffffffff8116811461146457600080fd5b604082015261147661010089016113a5565b606082015261148861012089016113bc565b608082015261149a61014089016113bc565b60a0820152809150509295509295509295565b6000602082840312156114bf57600080fd5b81356111ff81611390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160801b03828116828216039080821115611516576115166114e0565b5092915050565b80820180821115611088576110886114e0565b81810381811115611088576110886114e0565b60008261156057634e487b7160e01b600052601260045260246000fd5b500690565b600061ffff80831681810361157c5761157c6114e0565b6001019392505050565b60006020828403121561159857600080fd5b81516111ff81611390565b6000602082840312156115b557600080fd5b81516111ff816111d4565b6000602082840312156115d257600080fd5b505191905056fea26469706673582212206dd86449eb6121df45e55e3a6652ce95e51333a16a7e0a9d46fe286d00a371fd64736f6c63430008110033

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

000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909

-----Decoded View---------------
Arg [0] : vrfCoordinator (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909


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.