Sonic Blaze Testnet

Token

Pepedeck (Pepedeck)
ERC-721

Overview

Max Total Supply

0 Pepedeck

Holders

2

Market

Onchain Market Cap

-

Circulating Supply Market Cap

-
Balance
1 Pepedeck
0x4fb8b44149750e247a5cde33dbc0adc0ff38720a
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
PepemonCardDeck

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 27 : PepemonCardDeck.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
//pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./iface/IPepemonFactory.sol";
import "./iface/IPepemonCardOracle.sol";
import "./lib/AdminRole.sol";
import "./lib/Arrays.sol";
import "./lib/PepemonConfig.sol";
import "./lib/AdminRole.sol";
import "./lib/ChainLinkRngOracle.sol";

contract PepemonCardDeck is ERC721, ERC1155Holder, AdminRole, IConfigurable {
    using SafeMath for uint256;

    struct Deck {
        uint256 battleCardId;
        uint256 supportCardCount;
        mapping(uint256 => SupportCardType) supportCardTypes;
        uint256[] supportCardTypeList;
    }

    struct SupportCardType {
        uint256 supportCardId;
        uint256 count;
        uint256 pointer;
        bool isEntity;
    }

    struct SupportCardRequest {
        uint256 supportCardId;
        uint256 amount;
    }

    uint256 public MAX_SUPPORT_CARDS;
    uint256 public MIN_SUPPORT_CARDS;

    // cards allowed to be picked on when creating the Starter Deck
    uint256[] public allowedInitialDeckBattleCards;
    uint256[] allowedInitialDeckSupportCards;
    uint256 initialDeckSupportCardAmount;

    // set this to 0 to disable minting test cards.
    uint256 maxMintTestCardId;
    uint256 minMintTestCardId;

    uint256 nextDeckId;
    address public configAddress;
    address public factoryAddress;
    address public randNrGenContract;

    mapping(uint256 => Deck) public decks;
    mapping(address => uint256[]) public playerToDecks;

    constructor(address _configAddress) ERC721("Pepedeck", "Pepedeck") {
        nextDeckId = 1;
        MAX_SUPPORT_CARDS = 60;
        MIN_SUPPORT_CARDS = 40;

        minMintTestCardId = 1;
        configAddress = _configAddress;
    }

    /**
     * @dev Override supportInterface .
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC721, ERC1155Receiver) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    // MODIFIERS
    modifier sendersDeck(uint256 _deckId) {
        require(msg.sender == ownerOf(_deckId), "PepemonCardDeck: Not your deck");
        _;
    }

    // PUBLIC METHODS
    function setConfigAddress(address _configAddress) external onlyAdmin {
        configAddress = _configAddress;
    }

    function syncConfig() external override onlyAdmin {
        factoryAddress = PepemonConfig(configAddress).contractAddresses("PepemonFactory");
    }

    function setMaxSupportCards(uint256 _maxSupportCards) public onlyAdmin {
        MAX_SUPPORT_CARDS = _maxSupportCards;
    }

    function setMinSupportCards(uint256 _minSupportCards) public onlyAdmin {
        MIN_SUPPORT_CARDS = _minSupportCards;
    }

    function setRandNrGenContractAddress(address randOracleAddress) public onlyAdmin {
        randNrGenContract = randOracleAddress;
    }

    function setInitialDeckOptions(
        uint256[] calldata battleCardIds,
        uint256[] calldata supportCards,
        uint256 maxInitialSupportCards
    ) public onlyAdmin {
        require(Arrays.isSortedAscending(battleCardIds));
        require(maxInitialSupportCards <= MAX_SUPPORT_CARDS);

        initialDeckSupportCardAmount = maxInitialSupportCards;
        allowedInitialDeckBattleCards = battleCardIds;
        allowedInitialDeckSupportCards = supportCards;
    }

    // ALLOW TEST MINTING
    function setMintingCards(uint256 minCardId, uint256 maxCardId) public onlyAdmin {
        maxMintTestCardId = maxCardId;
        minMintTestCardId = minCardId;
    }

    /**
     * @dev right now there are 40 different cards that can be minted, but the maximum is configurable with maxMintTestCard.
     * setting maxMintTestCard to 0 disables this card minting.
     */
    function mintCards() public {
        require(maxMintTestCardId > 0, "Minting test cards is disabled");
        IPepemonFactory(factoryAddress).batchMint(minMintTestCardId, maxMintTestCardId, msg.sender);
    }

    function mintInitialDeck(uint256 battleCardId) public {
        require(Arrays.contains(allowedInitialDeckBattleCards, battleCardId), "Invalid battlecard");
        require(playerToDecks[msg.sender].length == 0, "Not your first deck");
        // battlecard + support cards
        uint amount = initialDeckSupportCardAmount + 1;
        uint256[] memory cards = new uint256[](amount);

        // First step: Mint cards

        uint256 allowedCardsCount = allowedInitialDeckSupportCards.length;
        uint256 randomNumber = randSeed();
        cards[0] = battleCardId;
        // begin from index 1 instead of 0 because battlecard was already added
        for (uint256 i = 1; i < amount; ++i) {
            randomNumber = uint256(keccak256(abi.encodePacked(i, randomNumber)));
            cards[i] = allowedInitialDeckSupportCards[randomNumber % allowedCardsCount];
        }
        // mint cards directly for this contract instead of msg.sender, so that we dont have to
        // transfer it back and forth
        IPepemonFactory(factoryAddress).batchMintList(cards, address(this));

        // Second step: Add cards into new the deck

        uint256 newDeckId = createDeckInternal();

        // no need to call addBattleCardToDeck since the new deck never had a battlecard before, plus
        // the battlecard is already owned by this contract
        decks[newDeckId].battleCardId = battleCardId;

        // begin from index 1 again because battlecard is in index 0
        for (uint256 i = 1; i < amount; ++i) {
            addSupportCardToDeckDirectly(newDeckId, cards[i], 1);
        }
    }

    function createDeck() public {
        createDeckInternal();
    }

    function addBattleCardToDeck(uint256 deckId, uint256 battleCardId) public sendersDeck(deckId) {
        require(
            IPepemonFactory(factoryAddress).balanceOf(msg.sender, battleCardId) >= 1,
            "PepemonCardDeck: Don't own battle card"
        );

        require(battleCardId != decks[deckId].battleCardId, "PepemonCardDeck: Card already in deck");

        uint256 oldBattleCardId = decks[deckId].battleCardId;
        decks[deckId].battleCardId = battleCardId;

        IPepemonFactory(factoryAddress).safeTransferFrom(msg.sender, address(this), battleCardId, 1, "");

        returnBattleCardFromDeck(oldBattleCardId);
    }

    function removeBattleCardFromDeck(uint256 _deckId) public sendersDeck(_deckId) {
        uint256 oldBattleCardId = decks[_deckId].battleCardId;

        decks[_deckId].battleCardId = 0;

        returnBattleCardFromDeck(oldBattleCardId);
    }

    function addSupportCardsToDeck(
        uint256 deckId,
        SupportCardRequest[] memory supportCards
    ) public sendersDeck(deckId) {
        for (uint256 i = 0; i < supportCards.length; i++) {
            addSupportCardToDeck(deckId, supportCards[i].supportCardId, supportCards[i].amount);
        }
    }

    function removeSupportCardsFromDeck(
        uint256 _deckId,
        SupportCardRequest[] memory _supportCards
    ) public sendersDeck(_deckId) {
        for (uint256 i = 0; i < _supportCards.length; i++) {
            removeSupportCardFromDeck(_deckId, _supportCards[i].supportCardId, _supportCards[i].amount);
        }
    }

    // INTERNALS
    function createDeckInternal() internal returns (uint256) {
        _safeMint(msg.sender, nextDeckId);
        playerToDecks[msg.sender].push(nextDeckId);
        uint256 playerDeck = nextDeckId;
        nextDeckId = nextDeckId.add(1);
        return playerDeck;
    }

    function addSupportCardToDeck(uint256 _deckId, uint256 _supportCardId, uint256 _amount) internal {
        require(MAX_SUPPORT_CARDS >= decks[_deckId].supportCardCount.add(_amount), "PepemonCardDeck: Deck overflow");
        require(
            IPepemonFactory(factoryAddress).balanceOf(msg.sender, _supportCardId) >= _amount,
            "PepemonCardDeck: You don't have enough of this card"
        );

        addSupportCardToDeckDirectly(_deckId, _supportCardId, _amount);

        IPepemonFactory(factoryAddress).safeTransferFrom(msg.sender, address(this), _supportCardId, _amount, "");
    }

    function addSupportCardToDeckDirectly(uint256 _deckId, uint256 _supportCardId, uint256 _amount) internal {
        if (!decks[_deckId].supportCardTypes[_supportCardId].isEntity) {
            decks[_deckId].supportCardTypes[_supportCardId] = SupportCardType({
                supportCardId: _supportCardId,
                count: _amount,
                pointer: decks[_deckId].supportCardTypeList.length,
                isEntity: true
            });

            // Prepend the ID to the list
            decks[_deckId].supportCardTypeList.push(_supportCardId);
        } else {
            SupportCardType storage supportCard = decks[_deckId].supportCardTypes[_supportCardId];
            supportCard.count = supportCard.count.add(_amount);
        }

        decks[_deckId].supportCardCount = decks[_deckId].supportCardCount.add(_amount);
    }

    function removeSupportCardFromDeck(uint256 _deckId, uint256 _supportCardId, uint256 _amount) internal {
        SupportCardType storage supportCardList = decks[_deckId].supportCardTypes[_supportCardId];
        supportCardList.count = supportCardList.count.sub(_amount);

        decks[_deckId].supportCardCount = decks[_deckId].supportCardCount.sub(_amount);

        if (supportCardList.count == 0) {
            uint256 lastItemIndex = decks[_deckId].supportCardTypeList.length - 1;

            // update the pointer of the item to be swapped
            uint256 lastSupportCardId = decks[_deckId].supportCardTypeList[lastItemIndex];
            decks[_deckId].supportCardTypes[lastSupportCardId].pointer = supportCardList.pointer;

            // swap the last item of the list with the one to be deleted
            decks[_deckId].supportCardTypeList[supportCardList.pointer] = decks[_deckId].supportCardTypeList[
                lastItemIndex
            ];
            decks[_deckId].supportCardTypeList.pop();

            delete decks[_deckId].supportCardTypes[_supportCardId];
        }

        IPepemonFactory(factoryAddress).safeTransferFrom(address(this), msg.sender, _supportCardId, _amount, "");
    }

    function returnBattleCardFromDeck(uint256 _battleCardId) internal {
        if (_battleCardId != 0) {
            IPepemonFactory(factoryAddress).safeTransferFrom(address(this), msg.sender, _battleCardId, 1, "");
        }
    }

    // VIEWS
    function getDeckCount(address player) public view returns (uint256) {
        return playerToDecks[player].length;
    }

    function getBattleCardInDeck(uint256 _deckId) public view returns (uint256) {
        return decks[_deckId].battleCardId;
    }

    function getCardTypesInDeck(uint256 _deckId) public view returns (uint256[] memory) {
        Deck storage deck = decks[_deckId];

        uint256[] memory supportCardTypes = new uint256[](deck.supportCardTypeList.length);

        for (uint256 i = 0; i < deck.supportCardTypeList.length; i++) {
            supportCardTypes[i] = deck.supportCardTypeList[i];
        }

        return supportCardTypes;
    }

    function getCountOfCardTypeInDeck(uint256 _deckId, uint256 _cardTypeId) public view returns (uint256) {
        return decks[_deckId].supportCardTypes[_cardTypeId].count;
    }

    function getSupportCardCountInDeck(uint256 deckId) public view returns (uint256) {
        return decks[deckId].supportCardCount;
    }

    /**
     * @dev Returns array of support cards for a deck
     * @param _deckId uint256 ID of the deck
     */
    function getAllSupportCardsInDeck(uint256 _deckId) public view returns (uint256[] memory) {
        Deck storage deck = decks[_deckId];
        uint256[] memory supportCards = new uint256[](deck.supportCardCount);
        uint256 idx = 0;
        for (uint256 i = 0; i < deck.supportCardTypeList.length; i++) {
            uint256 supportCardId = deck.supportCardTypeList[i];
            uint256 count = deck.supportCardTypes[supportCardId].count;
            for (uint256 j = 0; j < count; j++) {
                supportCards[idx++] = supportCardId;
            }
        }
        return supportCards;
    }

    /**
     * @dev Shuffles deck
     * @param _deckId uint256 ID of the deck
     */
    function shuffleDeck(uint256 _deckId, uint256 _seed) public view returns (uint256[] memory) {
        uint256[] memory totalSupportCards = getAllSupportCardsInDeck(_deckId);
        return Arrays.shuffle(totalSupportCards, _seed);
    }

    //Create a random seed
    function randSeed() private view returns (uint256) {
        //Get the chainlink random number
        uint chainlinkNumber = ChainLinkRngOracle(randNrGenContract).getRandomNumber();
        //Create a new pseudorandom number using the seed and block info as entropy
        //This makes sure the RNG returns a different number every time
        uint256 randomNumber = uint(keccak256(abi.encodePacked(block.number, block.timestamp, chainlinkNumber)));
        return randomNumber;
    }
}

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

interface LinkTokenInterface {

  function allowance(
    address owner,
    address spender
  )
    external
    view
    returns (
      uint256 remaining
    );

  function approve(
    address spender,
    uint256 value
  )
    external
    returns (
      bool success
    );

  function balanceOf(
    address owner
  )
    external
    view
    returns (
      uint256 balance
    );

  function decimals()
    external
    view
    returns (
      uint8 decimalPlaces
    );

  function decreaseApproval(
    address spender,
    uint256 addedValue
  )
    external
    returns (
      bool success
    );

  function increaseApproval(
    address spender,
    uint256 subtractedValue
  ) external;

  function name()
    external
    view
    returns (
      string memory tokenName
    );

  function symbol()
    external
    view
    returns (
      string memory tokenSymbol
    );

  function totalSupply()
    external
    view
    returns (
      uint256 totalTokensIssued
    );

  function transfer(
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

  function transferAndCall(
    address to,
    uint256 value,
    bytes calldata data
  )
    external
    returns (
      bool success
    );

  function transferFrom(
    address from,
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

}

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

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @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.
 * *****************************************************************************
 * @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     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) 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), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (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. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @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 ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @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.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {

  /**
   * @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 VRFConsumerBase 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 randomness the VRF output
   */
  function fulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    internal
    virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 constant private USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(
    bytes32 _keyHash,
    uint256 _fee
  )
    internal
    returns (
      bytes32 requestId
    )
  {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed  = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash] + 1;
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface immutable internal LINK;
  address immutable private vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(
    address _vrfCoordinator,
    address _link
  ) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    external
  {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

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

contract VRFRequestIDBase {

  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  )
    internal
    pure
    returns (
      uint256
    )
  {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(
    bytes32 _keyHash,
    uint256 _vRFInputSeed
  )
    internal
    pure
    returns (
      bytes32
    )
  {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

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

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 6 of 27 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 7 of 27 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}

File 8 of 27 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

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

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

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

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

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

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

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

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

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

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 10 of 27 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 27 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 12 of 27 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 13 of 27 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 17 of 27 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 20 of 27 : IConfigurable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IConfigurable {
    function syncConfig() external;
}

File 21 of 27 : IPepemonCardOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

/**
This contract acts as the oracle, it contains battling information for both the Pepemon Battle and Support cards
**/
interface IPepemonCardOracle {

    enum SupportCardType {
        OFFENSE,
        STRONG_OFFENSE,
        DEFENSE,
        STRONG_DEFENSE
    }

    enum EffectTo {
        ATTACK,
        STRONG_ATTACK,
        DEFENSE,
        STRONG_DEFENSE,
        SPEED,
        INTELLIGENCE
    }

    enum EffectFor {
        ME,
        ENEMY
    }

    enum BattleCardTypes{
        FIRE,
        GRASS,
        WATER,
        LIGHTNING,
        WIND,
        POISON,
        GHOST,
        FAIRY,
        EARTH,
        UNKNOWN,
        NONE
    }

    struct BattleCardStats {
        uint256 battleCardId;
        BattleCardTypes element;
        uint16 hp; // hitpoints
        uint16 spd; // speed
        uint16 inte; // intelligence
        uint16 def; // defense
        uint16 atk; // attack
        uint16 sAtk; // special attack
        uint16 sDef; // special defense
    }

    struct SupportCardStats {
        uint256 supportCardId;
        SupportCardType supportCardType;
        EffectOne effectOne;
        EffectMany effectMany;
        // If true, duplicate copies of the card in the same turn will have no extra effect.
        bool unstackable;
        // This property is for EffectMany now.
        // If true, assume the card is already in effect
        // then the same card drawn and used within a number of turns does not extend or reset duration of the effect.
        bool unresettable;
    }

    struct EffectOne {
        // If power is 0, it is equal to the total of all normal offense/defense cards in the current turn.
        
        //basePower = power if req not met
        int16 basePower;

        //triggeredPower = power if req met
        int16 triggeredPower;
        EffectTo effectTo;
        EffectFor effectFor;
        uint16 reqCode; //requirement code
    }

    struct EffectMany {
        int16 power;
        uint16 numTurns;
        EffectTo effectTo;
        EffectFor effectFor;
        uint16 reqCode; //requirement code
    }

    //Struct for keeping track of weakness / resistance
    struct elementWR{
        BattleCardTypes weakness;
        BattleCardTypes resistance;
    }

    // mappings
    function battleCardStats(uint256 x) view external returns (BattleCardStats memory);
    
    function supportCardStats(uint256 x) view external returns (SupportCardStats memory);
    
    function elementDecode(BattleCardTypes x) view external returns (string memory);
    
    function weakResist(BattleCardTypes x) view external returns (elementWR memory);

    // other functions
    function addBattleCard(BattleCardStats memory cardData) external;

    function updateBattleCard(BattleCardStats memory cardData) external;

    function getBattleCardById(uint256 _id) view external returns (BattleCardStats memory);

    function addSupportCard(SupportCardStats memory cardData) external;

    function updateSupportCard(SupportCardStats memory cardData) external;

    function getSupportCardById(uint256 _id) view  external returns (SupportCardStats memory);

    function getWeakResist(BattleCardTypes element) view  external returns (elementWR memory);

    function getSupportCardTypeById(uint256 _id) view external returns (SupportCardType);
}

File 22 of 27 : IPepemonFactory.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IPepemonFactory {
    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _id,
        uint256 _amount,
        bytes calldata _data
    ) external;

    function setApprovalForAll(
        address _operator,
        bool _approved
    ) external;

    function balanceOf(
        address _owner, 
        uint256 _id
    ) external view returns (uint256);

    function airdrop(
        uint256 _id,
        address[] memory _addresses
    ) external;

    function batchMint(
        uint start, 
        uint end, 
        address to) 
    external;

    function batchMintList(
        uint256[] calldata ids,
        address to) 
    external;

    function addMinter(
        address account
    ) external;
}

File 23 of 27 : AdminRole.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Roles.sol";

contract AdminRole {
  using Roles for Roles.Role;

  event AdminAdded(address indexed account);
  event AdminRemoved(address indexed account);

  Roles.Role private admins;

  constructor() {
    _addAdmin(msg.sender);
  }

  modifier onlyAdmin() {
    require(isAdmin(msg.sender));
    _;
  }

  function isAdmin(address account) public view returns (bool) {
    return admins.has(account);
  }

  function addAdmin(address account) public onlyAdmin {
    _addAdmin(account);
  }

  function renounceAdmin() public {
    _removeAdmin(msg.sender);
  }

  function _addAdmin(address account) internal {
    admins.add(account);
    emit AdminAdded(account);
  }

  function _removeAdmin(address account) internal {
    admins.remove(account);
    emit AdminRemoved(account);
  }
}

File 24 of 27 : Arrays.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library Arrays {
    //Shuffles an array of uints with random seed
    function shuffle(uint256[] memory _elements, uint256 _seed) internal pure returns (uint256[] memory) {
        for (uint256 i = 0; i < _elements.length; i++) {
            //Pick random index to swap current element with
            uint256 n = i + _seed % (_elements.length - i);

            //swap elements
            uint256 temp = _elements[n];
            _elements[n] = _elements[i];
            _elements[i] = temp;

            //Create new pseudorandom number using seed.
            _seed = uint(keccak256(abi.encodePacked(_seed)));
        }
        return _elements;
    }

    // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0a3f880753112b425160086c97623b1ab38bfec6/contracts/utils/Arrays.sol

    /**
     * @dev Searches an `array` sorted in ascending order and returns the first
     * index that contains a value greater or equal than `element`. If no such index
     * exists (i.e. all values in the array are strictly less than `element`), the array
     * length is returned. Time complexity O(log n).
     *
     * See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
     */
    function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeMemoryAccess(array, mid) < element) {
                // this cannot overflow because mid < high
                unchecked {
                    low = mid + 1;
                }
            } else {
                high = mid;
            }
        }

        return low;
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0a3f880753112b425160086c97623b1ab38bfec6/contracts/utils/math/Math.sol
    
    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }


    function isSortedAscending(uint256[] memory arr) internal pure returns (bool) {
        uint256 length = arr.length - 1;
        for (uint256 i = 0; i < length; i++) {
            uint256 current = unsafeMemoryAccess(arr, i);
            uint256 next = unsafeMemoryAccess(arr, i + 1);
            if (current > next) {
                return false;
            }
        }
        return true;
    }

    function contains(uint256[] memory arr, uint256 value) internal pure returns (bool) {
        uint256 index = lowerBoundMemory(arr, value);
        if (index == arr.length || unsafeMemoryAccess(arr, index) != value) {
            return false;
        }
        return true;
    }
}

File 25 of 27 : ChainLinkRngOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "./AdminRole.sol";

abstract contract ChainLinkRngOracle is VRFConsumerBase, AdminRole {
    bytes32 immutable keyHash;
    bytes32 public lastRequestId;
    uint256 internal fee;

    address constant maticLink = 0xb0897686c545045aFc77CF20eC7A532E3120E0F1;
    address constant maticVrfCoordinator = 0x3d2341ADb2D31f1c5530cDC622016af293177AE0;
    bytes32 constant maticKeyHash = 0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da;

    address constant mumbaiLink = 0x326C977E6efc84E512bB9C30f76E30c160eD06FB;
    address constant mumbaiVrfCoordinator = 0x8C7382F9D8f56b33781fE506E897a4F1e2d17255;
    bytes32 constant mumbaiKeyHash = 0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4;

    address constant fantomTestnetLink = 0xfaFedb041c0DD4fA2Dc0d87a6B0979Ee6FA7af5F;
    address constant fantomTestnetVrfCoordinator = 0xbd13f08b8352A3635218ab9418E340c60d6Eb418;
    bytes32 constant fantomTestnetKeyHash = 0x121a143066e0f2f08b620784af77cccb35c6242460b4a8ee251b4b416abaebd4;

    address constant fantomLink = 0x6F43FF82CCA38001B6699a8AC47A2d0E66939407;
    address constant fantomVrfCoordinator = 0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634;
    bytes32 constant fantomKeyHash = 0x5881eea62f9876043df723cf89f0c2bb6f950da25e9dfe66995c24f919c8f8ab;



    mapping(bytes32 => uint256) internal results;

    constructor() VRFConsumerBase(fantomTestnetVrfCoordinator, fantomTestnetLink) {
        keyHash = fantomTestnetKeyHash;
        fee = 1 ether / 1000;
    }

    //Get a new random number (paying link for it)
    //Only callable by admin
    function getNewRandomNumber() public onlyAdmin returns (bytes32 requestId) {
        require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet");
        lastRequestId = requestRandomness(keyHash, fee);
        return lastRequestId;
    }

    /**
     * Callback function used by VRF Coordinator
     */
    function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
        results[requestId] = randomness;
    }

    function fetchNumberByRequestId(bytes32 _requestId) public view returns (uint256) {
        return results[_requestId];
    }

    //Get most recent random number and use that as randomness source    
    function getRandomNumber() public view returns (uint256){
        return fetchNumberByRequestId(lastRequestId);        
    }
}

File 26 of 27 : PepemonConfig.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./AdminRole.sol";
import "../iface/IConfigurable.sol";

/**
 * @notice This contract stores the addresses of all and any other contracts used by Pepemon
 * @dev This contract must be added as an Admin on contracts before "syncContractConfig" can be called.
 */
contract PepemonConfig is AdminRole {
    struct ContractDisplayData {
        address contractAddress;
        string contractName;
    }

    string[] private contactsNames;
    mapping(string => address) public contractAddresses;

    /**
     * @dev Actual implementation for both setContractAddress and batchSetContractAddress, making a call to
     * a common 'internal' function uses less gas than calling a 'public' one
     */
    function setContractAddressInternal(string calldata contractName, address contractAddress, bool callSync) internal {
        require(contractAddress != address(0));

        // If its the first time adding the contract, store its name in the array
        if (contractAddresses[contractName] == address(0)) {
            contactsNames.push(contractName);
        }
        contractAddresses[contractName] = contractAddress;
        if (callSync) {
            IConfigurable(contractAddress).syncConfig();
        }
    }

    /**
     * @notice Adds or updates contracts addresses associated by contract names
     * @param contractName Name of the contract that will be stored
     * @param contractAddress Address of the contract that will be stored
     * @param callSync When true, the function "syncConfig" of the contract being stored will be invoked
     */
    function setContractAddress(
        string calldata contractName,
        address contractAddress,
        bool callSync
    ) external onlyAdmin {
        setContractAddressInternal(contractName, contractAddress, callSync);
    }

    /**
     * @notice Batch version of `setContractAddress`
     * @param contractNameList Names of the contracts that will be stored
     * @param contractAddressesList Addresses of the contracts that will be stored
     * @param callSyncList When true, the function "syncConfig" of the contracts being stored will be invoked
     */
    function batchSetContractAddress(
        string[] calldata contractNameList,
        address[] calldata contractAddressesList,
        bool[] calldata callSyncList
    ) external onlyAdmin {
        uint256 len = contractNameList.length;
        require(len == contractAddressesList.length && len == callSyncList.length, "Mismatching batch length");
        for (uint256 i = 0; i < len; ++i) {
            setContractAddressInternal(contractNameList[i], contractAddressesList[i], callSyncList[i]);
        }
    }

    /**
     * @dev Tries to call "syncConfig" from the address of the contract in `contractName`, this might fail if
     * the target contract does not have this contract (PepemonConfig) added as an Admin, or if `contractName` is not
     * associated with any contract
     */
    function syncContractConfig(string calldata contractName) external onlyAdmin {
        require(contractAddresses[contractName] != address(0));
        IConfigurable(contractAddresses[contractName]).syncConfig();
    }

    /**
     * @dev Batch version of syncContractConfig
     */
    function batchSyncContractConfig(string[] calldata contractNames) external onlyAdmin {
        uint256 len = contractNames.length;
        for (uint256 i = 0; i < len; ++i) {
            require(contractAddresses[contractNames[i]] != address(0));
            IConfigurable(contractAddresses[contractNames[i]]).syncConfig();
        }
    }

    /**
     * @dev Displays contracts names and addresses.
     */
    function getContracts() external view returns (ContractDisplayData[] memory data) {
        uint256 len = contactsNames.length;

        data = new ContractDisplayData[](len);

        for (uint256 i = 0; i < len; ++i) {
            string memory contractName = contactsNames[i];
            data[i].contractName = contractName;
            data[i].contractAddress = contractAddresses[contractName];
        }
        return data;
    }
}

File 27 of 27 : Roles.sol
// SPDX-License-Identifier: MIT


pragma solidity ^0.8.0;

/**
 * @title Roles
 * @dev Library for managing addresses assigned to a Role.
 */
library Roles {
  struct Role {
    mapping (address => bool) bearer;
  }

  /**
   * @dev give an account access to this role
   */
  function add(Role storage role, address account) internal {
    require(account != address(0));
    require(!has(role, account));

    role.bearer[account] = true;
  }

  /**
   * @dev remove an account's access to this role
   */
  function remove(Role storage role, address account) internal {
    require(account != address(0));
    require(has(role, account));

    role.bearer[account] = false;
  }

  /**
   * @dev check if an account has this role
   * @return bool
   */
  function has(Role storage role, address account)
    internal
    view
    returns (bool)
  {
    require(account != address(0));
    return role.bearer[account];
  }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_configAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"AdminAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"AdminRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPORT_CARDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_SUPPORT_CARDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deckId","type":"uint256"},{"internalType":"uint256","name":"battleCardId","type":"uint256"}],"name":"addBattleCardToDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deckId","type":"uint256"},{"components":[{"internalType":"uint256","name":"supportCardId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct PepemonCardDeck.SupportCardRequest[]","name":"supportCards","type":"tuple[]"}],"name":"addSupportCardsToDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowedInitialDeckBattleCards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"configAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"decks","outputs":[{"internalType":"uint256","name":"battleCardId","type":"uint256"},{"internalType":"uint256","name":"supportCardCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"}],"name":"getAllSupportCardsInDeck","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"}],"name":"getBattleCardInDeck","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"}],"name":"getCardTypesInDeck","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"},{"internalType":"uint256","name":"_cardTypeId","type":"uint256"}],"name":"getCountOfCardTypeInDeck","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getDeckCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"deckId","type":"uint256"}],"name":"getSupportCardCountInDeck","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"battleCardId","type":"uint256"}],"name":"mintInitialDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"playerToDecks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randNrGenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"}],"name":"removeBattleCardFromDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"},{"components":[{"internalType":"uint256","name":"supportCardId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct PepemonCardDeck.SupportCardRequest[]","name":"_supportCards","type":"tuple[]"}],"name":"removeSupportCardsFromDeck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_configAddress","type":"address"}],"name":"setConfigAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"battleCardIds","type":"uint256[]"},{"internalType":"uint256[]","name":"supportCards","type":"uint256[]"},{"internalType":"uint256","name":"maxInitialSupportCards","type":"uint256"}],"name":"setInitialDeckOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSupportCards","type":"uint256"}],"name":"setMaxSupportCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minSupportCards","type":"uint256"}],"name":"setMinSupportCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minCardId","type":"uint256"},{"internalType":"uint256","name":"maxCardId","type":"uint256"}],"name":"setMintingCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"randOracleAddress","type":"address"}],"name":"setRandNrGenContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deckId","type":"uint256"},{"internalType":"uint256","name":"_seed","type":"uint256"}],"name":"shuffleDeck","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"syncConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200364a3803806200364a833981016040819052620000349162000259565b604080518082018252600880825267506570656465636b60c01b6020808401828152855180870190965292855284015281519192916200007791600091620001b3565b5080516200008d906001906020840190620001b3565b505050620000a133620000db60201b60201c565b6001600e819055603c6007556028600855600d55600f80546001600160a01b0319166001600160a01b0392909216919091179055620002c8565b620000f68160066200012d60201b620016791790919060201c565b6040516001600160a01b038216907f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33990600090a250565b6001600160a01b0381166200014157600080fd5b6200014d82826200017d565b156200015857600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b60006001600160a01b0382166200019357600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b828054620001c1906200028b565b90600052602060002090601f016020900481019282620001e5576000855562000230565b82601f106200020057805160ff191683800117855562000230565b8280016001018555821562000230579182015b828111156200023057825182559160200191906001019062000213565b506200023e92915062000242565b5090565b5b808211156200023e576000815560010162000243565b6000602082840312156200026c57600080fd5b81516001600160a01b03811681146200028457600080fd5b9392505050565b600181811c90821680620002a057607f821691505b60208210811415620002c257634e487b7160e01b600052602260045260246000fd5b50919050565b61337280620002d86000396000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c80638bad0c0a11610167578063bc197c81116100ce578063e5afabf011610087578063e5afabf01461065c578063e6624c321461066f578063e985e9c514610677578063ef0c4ecf146106b3578063f23a6e61146106c6578063f4025c15146106e557600080fd5b8063bc197c81146105c5578063c87b56dd146105fd578063d1e2c2cf14610610578063d6c3187114610623578063d8ee45b914610636578063dc10b8bd1461064957600080fd5b8063a4c6f63e11610120578063a4c6f63e14610546578063aabd8ff014610566578063b133ac5214610579578063b226ef761461058c578063b7c09e141461059f578063b88d4fde146105b257600080fd5b80638bad0c0a146104b157806395d89b41146104b9578063966dae0e146104c15780639895d749146104d4578063a090195d146104f7578063a22cb4651461053357600080fd5b80633f6b7f971161020b57806370104298116101c4578063701042981461044a578063704802751461045d57806370a08231146104705780637b8ef82714610483578063839fcd521461049657806383a12de91461049e57600080fd5b80633f6b7f97146103c357806342842e0e146103d65780634f3d4f9a146103e95780636352211e1461041b57806365aab7341461042e5780636e4c16521461043757600080fd5b806318ee73961161025d57806318ee73961461033757806323b872dd1461036e57806324d7806c146103815780632c1e3c39146103945780632ed38bfc146103a757806330ecf94e146103ba57600080fd5b806301ffc9a71461029a57806306fdde03146102c2578063081812fc146102d7578063095ea7b31461030257806317afd56814610317575b600080fd5b6102ad6102a8366004612d87565b6106ed565b60405190151581526020015b60405180910390f35b6102ca6106fe565b6040516102b99190613021565b6102ea6102e5366004612dc1565b610790565b6040516001600160a01b0390911681526020016102b9565b610315610310366004612ce8565b6107b7565b005b61032a610325366004612dc1565b6108d2565b6040516102b99190612fe4565b610360610345366004612a81565b6001600160a01b031660009081526013602052604090205490565b6040519081526020016102b9565b61031561037c366004612ba1565b610992565b6102ad61038f366004612a81565b6109c3565b6103156103a2366004612a81565b6109d0565b6103156103b5366004612eb7565b610a04565b61036060085481565b6103606103d1366004612ce8565b610c15565b6103156103e4366004612ba1565b610c46565b6103606103f7366004612eb7565b60009182526012602090815260408084209284526002909201905290206001015490565b6102ea610429366004612dc1565b610c61565b61036060075481565b61032a610445366004612dc1565b610cc1565b610315610458366004612dc1565b610dca565b61031561046b366004612a81565b610e20565b61036061047e366004612a81565b610e3e565b61032a610491366004612eb7565b610ec4565b610315610ee5565b6103156104ac366004612a81565b610fb3565b610315610fe7565b6102ca610ff2565b6010546102ea906001600160a01b031681565b6103606104e2366004612dc1565b60009081526012602052604090206001015490565b61051e610505366004612dc1565b6012602052600090815260409020805460019091015482565b604080519283526020830191909152016102b9565b610315610541366004612cb5565b611001565b610360610554366004612dc1565b60009081526012602052604090205490565b610315610574366004612dc1565b611010565b610315610587366004612eb7565b611027565b61031561059a366004612df3565b611041565b6103606105ad366004612dc1565b6110de565b6103156105c0366004612be2565b6110ff565b6105e46105d3366004612af4565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016102b9565b6102ca61060b366004612dc1565b611131565b6011546102ea906001600160a01b031681565b600f546102ea906001600160a01b031681565b610315610644366004612d14565b6111a5565b610315610657366004612dc1565b611231565b61031561066a366004612dc1565b611248565b610315611516565b6102ad610685366004612abb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103156106c1366004612df3565b61151e565b6105e46106d4366004612c4d565b63f23a6e6160e01b95945050505050565b6103156115bb565b60006106f8826116c5565b92915050565b60606000805461070d90613239565b80601f016020809104026020016040519081016040528092919081815260200182805461073990613239565b80156107865780601f1061075b57610100808354040283529160200191610786565b820191906000526020600020905b81548152906001019060200180831161076957829003601f168201915b5050505050905090565b600061079b826116ea565b506000908152600460205260409020546001600160a01b031690565b60006107c282610c61565b9050806001600160a01b0316836001600160a01b031614156108355760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061085157506108518133610685565b6108c35760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161082c565b6108cd8383611749565b505050565b60008181526012602052604081206003810154606092906001600160401b03811115610900576109006132fb565b604051908082528060200260200182016040528015610929578160200160208202803683370190505b50905060005b600383015481101561098a57826003018181548110610950576109506132e5565b906000526020600020015482828151811061096d5761096d6132e5565b60209081029190910101528061098281613274565b91505061092f565b509392505050565b61099c33826117b7565b6109b85760405162461bcd60e51b815260040161082c90613034565b6108cd838383611835565b60006106f8600683611999565b6109d9336109c3565b6109e257600080fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b81610a0e81610c61565b6001600160a01b0316336001600160a01b031614610a3e5760405162461bcd60e51b815260040161082c90613118565b601054604051627eeac760e11b8152336004820152602481018490526001916001600160a01b03169062fdd58e9060440160206040518083038186803b158015610a8757600080fd5b505afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190612dda565b1015610b1c5760405162461bcd60e51b815260206004820152602660248201527f506570656d6f6e436172644465636b3a20446f6e2774206f776e20626174746c604482015265194818d85c9960d21b606482015260840161082c565b600083815260126020526040902054821415610b885760405162461bcd60e51b815260206004820152602560248201527f506570656d6f6e436172644465636b3a204361726420616c726561647920696e604482015264206465636b60d81b606482015260840161082c565b600083815260126020526040908190208054908490556010549151637921219560e11b815290916001600160a01b03169063f242432a90610bd490339030908890600190600401612fac565b600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b50505050610c0f816119ce565b50505050565b60136020528160005260406000208181548110610c3157600080fd5b90600052602060002001600091509150505481565b6108cd838383604051806020016040528060008152506110ff565b6000818152600260205260408120546001600160a01b0316806106f85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161082c565b60008181526012602052604081206001810154606092906001600160401b03811115610cef57610cef6132fb565b604051908082528060200260200182016040528015610d18578160200160208202803683370190505b5090506000805b6003840154811015610dc0576000846003018281548110610d4257610d426132e5565b6000918252602080832090910154808352600288019091526040822060010154909250905b81811015610daa57828686610d7b81613274565b975081518110610d8d57610d8d6132e5565b602090810291909101015280610da281613274565b915050610d67565b5050508080610db890613274565b915050610d1f565b5090949350505050565b80610dd481610c61565b6001600160a01b0316336001600160a01b031614610e045760405162461bcd60e51b815260040161082c90613118565b600082815260126020526040812080549190556108cd816119ce565b610e29336109c3565b610e3257600080fd5b610e3b81611a40565b50565b60006001600160a01b038216610ea85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161082c565b506001600160a01b031660009081526003602052604090205490565b60606000610ed184610cc1565b9050610edd8184611a82565b949350505050565b610eee336109c3565b610ef757600080fd5b600f54604051637733e61560e11b815260206004820152600e60248201526d506570656d6f6e466163746f727960901b60448201526001600160a01b039091169063ee67cc2a9060640160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612a9e565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610fbc336109c3565b610fc557600080fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b610ff033611b75565b565b60606001805461070d90613239565b61100c338383611bb7565b5050565b611019336109c3565b61102257600080fd5b600855565b611030336109c3565b61103957600080fd5b600c55600d55565b8161104b81610c61565b6001600160a01b0316336001600160a01b03161461107b5760405162461bcd60e51b815260040161082c90613118565b60005b8251811015610c0f576110cc8484838151811061109d5761109d6132e5565b6020026020010151600001518584815181106110bb576110bb6132e5565b602002602001015160200151611c86565b806110d681613274565b91505061107e565b600981815481106110ee57600080fd5b600091825260209091200154905081565b61110933836117b7565b6111255760405162461bcd60e51b815260040161082c90613034565b610c0f84848484611e4c565b606061113c826116ea565b600061115360408051602081019091526000815290565b90506000815111611173576040518060200160405280600081525061119e565b8061117d84611e7f565b60405160200161118e929190612f40565b6040516020818303038152906040525b9392505050565b6111ae336109c3565b6111b757600080fd5b6111f3858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611f1392505050565b6111fc57600080fd5b60075481111561120b57600080fd5b600b81905561121c600986866128f5565b50611229600a84846128f5565b505050505050565b61123a336109c3565b61124357600080fd5b600755565b6112a2600980548060200260200160405190810160405280929190818152602001828054801561129757602002820191906000526020600020905b815481526020019060010190808311611283575b505050505082611f8e565b6112e35760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818985d1d1b1958d85c9960721b604482015260640161082c565b33600090815260136020526040902054156113365760405162461bcd60e51b81526020600482015260136024820152724e6f7420796f7572206669727374206465636b60681b604482015260640161082c565b6000600b54600161134791906131ca565b90506000816001600160401b03811115611363576113636132fb565b60405190808252806020026020018201604052801561138c578160200160208202803683370190505b50600a54909150600061139d611fc3565b905084836000815181106113b3576113b36132e5565b602090810291909101015260015b8481101561144b57604080516020810183905290810183905260600160408051601f1981840301815291905280516020909101209150600a611403848461328f565b81548110611413576114136132e5565b9060005260206000200154848281518110611430576114306132e5565b602090810291909101015261144481613274565b90506113c1565b50601054604051633007a53d60e11b81526001600160a01b039091169063600f4a7a9061147e9086903090600401612ff7565b600060405180830381600087803b15801561149857600080fd5b505af11580156114ac573d6000803e3d6000fd5b5050505060006114ba612085565b6000818152601260205260409020879055905060015b8581101561150d576114fd828683815181106114ee576114ee6132e5565b602002602001015160016120d4565b61150681613274565b90506114d0565b50505050505050565b610e3b612085565b8161152881610c61565b6001600160a01b0316336001600160a01b0316146115585760405162461bcd60e51b815260040161082c90613118565b60005b8251811015610c0f576115a98484838151811061157a5761157a6132e5565b602002602001015160000151858481518110611598576115986132e5565b6020026020010151602001516121e8565b806115b381613274565b91505061155b565b6000600c541161160d5760405162461bcd60e51b815260206004820152601e60248201527f4d696e74696e6720746573742063617264732069732064697361626c65640000604482015260640161082c565b601054600d54600c54604051633ef009ef60e01b8152600481019290925260248201523360448201526001600160a01b0390911690633ef009ef90606401600060405180830381600087803b15801561166557600080fd5b505af1158015610c0f573d6000803e3d6000fd5b6001600160a01b03811661168c57600080fd5b6116968282611999565b156116a057600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b60006001600160e01b03198216630271189760e51b14806106f857506106f88261241a565b6000818152600260205260409020546001600160a01b0316610e3b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161082c565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061177e82610c61565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806117c383610c61565b9050806001600160a01b0316846001600160a01b0316148061180a57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610edd5750836001600160a01b031661182384610790565b6001600160a01b031614949350505050565b826001600160a01b031661184882610c61565b6001600160a01b03161461186e5760405162461bcd60e51b815260040161082c906130d3565b6001600160a01b0382166118d05760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161082c565b826001600160a01b03166118e382610c61565b6001600160a01b0316146119095760405162461bcd60e51b815260040161082c906130d3565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b0382166119ae57600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b8015610e3b57601054604051637921219560e11b81526001600160a01b039091169063f242432a90611a0b90309033908690600190600401612fac565b600060405180830381600087803b158015611a2557600080fd5b505af1158015611a39573d6000803e3d6000fd5b5050505050565b611a4b600682611679565b6040516001600160a01b038216907f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33990600090a250565b606060005b8351811015611b6d576000818551611a9f91906131f6565b611aa9908561328f565b611ab390836131ca565b90506000858281518110611ac957611ac96132e5565b60200260200101519050858381518110611ae557611ae56132e5565b6020026020010151868381518110611aff57611aff6132e5565b60200260200101818152505080868481518110611b1e57611b1e6132e5565b60200260200101818152505084604051602001611b3d91815260200190565b6040516020818303038152906040528051906020012060001c945050508080611b6590613274565b915050611a87565b509192915050565b611b8060068261246a565b6040516001600160a01b038216907fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f90600090a250565b816001600160a01b0316836001600160a01b03161415611c195760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161082c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600083815260126020526040902060010154611ca290826124b2565b6007541015611cf35760405162461bcd60e51b815260206004820152601e60248201527f506570656d6f6e436172644465636b3a204465636b206f766572666c6f770000604482015260640161082c565b601054604051627eeac760e11b81523360048201526024810184905282916001600160a01b03169062fdd58e9060440160206040518083038186803b158015611d3b57600080fd5b505afa158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d739190612dda565b1015611ddd5760405162461bcd60e51b815260206004820152603360248201527f506570656d6f6e436172644465636b3a20596f7520646f6e2774206861766520604482015272195b9bdd59da081bd9881d1a1a5cc818d85c99606a1b606482015260840161082c565b611de88383836120d4565b601054604051637921219560e11b81526001600160a01b039091169063f242432a90611e1e903390309087908790600401612fac565b600060405180830381600087803b158015611e3857600080fd5b505af115801561150d573d6000803e3d6000fd5b611e57848484611835565b611e63848484846124be565b610c0f5760405162461bcd60e51b815260040161082c90613081565b60606000611e8c836125cb565b60010190506000816001600160401b03811115611eab57611eab6132fb565b6040519080825280601f01601f191660200182016040528015611ed5576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611f0e5761098a565b611edf565b60008060018351611f2491906131f6565b905060005b81811015611f84576020808202850101516000611f5986611f4b8560016131ca565b602090810291909101015190565b905080821115611f6f5750600095945050505050565b50508080611f7c90613274565b915050611f29565b5060019392505050565b600080611f9b84846126a3565b90508351811480611fb457506020808202850101518314155b15611f845760009150506106f8565b600080601160009054906101000a90046001600160a01b03166001600160a01b031663dbdff2c16040518163ffffffff1660e01b815260040160206040518083038186803b15801561201457600080fd5b505afa158015612028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c9190612dda565b60408051436020808301919091524282840152606080830194909452825180830390940184526080909101909152815191012092915050565b600061209333600e546126f6565b3360009081526013602090815260408220600e8054825460018181018555938652939094209092019290925554906120cc9082906124b2565b600e55919050565b600083815260126020908152604080832085845260020190915290206003015460ff16612180576040805160808101825283815260208082018481526000878152601280845285822060038082018054888a01908152600160608a018181528d885260029586018a529a872099518a559651898801555192880192909255965195909601805460ff191695151595909517909455928252835490810184559282529020018290556121b2565b6000838152601260209081526040808320858452600201909152902060018101546121ab90836124b2565b6001909101555b6000838152601260205260409020600101546121ce90826124b2565b600093845260126020526040909320600101929092555050565b6000838152601260209081526040808320858452600201909152902060018101546122139083612710565b600180830191909155600085815260126020526040902001546122369083612710565b60008581526012602052604090206001908101919091558101546123ac57600084815260126020526040812060030154612272906001906131f6565b6000868152601260205260408120600301805492935090918390811061229a5761229a6132e5565b60009182526020808320909101546002808701548a855260128085526040808720858852808501875290872090930191909155938a9052929091526003909101805491925090839081106122f0576122f06132e5565b906000526020600020015460126000888152602001908152602001600020600301846002015481548110612326576123266132e5565b906000526020600020018190555060126000878152602001908152602001600020600301805480612359576123596132cf565b600082815260208082208301600019908101839055909201909255878252601281526040808320888452600290810190925282208281556001810183905590810191909155600301805460ff1916905550505b601054604051637921219560e11b81526001600160a01b039091169063f242432a906123e2903090339088908890600401612fac565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050505050505050565b60006001600160e01b031982166380ac58cd60e01b148061244b57506001600160e01b03198216635b5e139f60e01b145b806106f857506301ffc9a760e01b6001600160e01b03198316146106f8565b6001600160a01b03811661247d57600080fd5b6124878282611999565b61249057600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b600061119e82846131ca565b60006001600160a01b0384163b156125c057604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612502903390899088908890600401612f6f565b602060405180830381600087803b15801561251c57600080fd5b505af192505050801561254c575060408051601f3d908101601f1916820190925261254991810190612da4565b60015b6125a6573d80801561257a576040519150601f19603f3d011682016040523d82523d6000602084013e61257f565b606091505b50805161259e5760405162461bcd60e51b815260040161082c90613081565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610edd565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061260a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612636576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061265457662386f26fc10000830492506010015b6305f5e100831061266c576305f5e100830492506008015b612710831061268057612710830492506004015b60648310612692576064830492506002015b600a83106106f85760010192915050565b81516000908190806126ba576000925050506106f8565b8082101561098a5760006126ce838361271c565b6020808202880101519091508511156126ec578060010192506126f0565b8091505b506126ba565b61100c828260405180602001604052806000815250612737565b600061119e82846131f6565b600061272b60028484186131e2565b61119e908484166131ca565b612741838361276a565b61274e60008484846124be565b6108cd5760405162461bcd60e51b815260040161082c90613081565b6001600160a01b0382166127c05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161082c565b6000818152600260205260409020546001600160a01b0316156128255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082c565b6000818152600260205260409020546001600160a01b03161561288a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082c565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054828255906000526020600020908101928215612930579160200282015b82811115612930578235825591602001919060010190612915565b5061293c929150612940565b5090565b5b8082111561293c5760008155600101612941565b60008083601f84011261296757600080fd5b5081356001600160401b0381111561297e57600080fd5b6020830191508360208260051b850101111561299957600080fd5b9250929050565b600082601f8301126129b157600080fd5b813560206129c66129c1836131a7565b613177565b80838252828201915082860187848660051b89010111156129e657600080fd5b60005b85811015612a05578135845292840192908401906001016129e9565b5090979650505050505050565b600082601f830112612a2357600080fd5b81356001600160401b03811115612a3c57612a3c6132fb565b612a4f601f8201601f1916602001613177565b818152846020838601011115612a6457600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215612a9357600080fd5b813561119e81613311565b600060208284031215612ab057600080fd5b815161119e81613311565b60008060408385031215612ace57600080fd5b8235612ad981613311565b91506020830135612ae981613311565b809150509250929050565b600080600080600060a08688031215612b0c57600080fd5b8535612b1781613311565b94506020860135612b2781613311565b935060408601356001600160401b0380821115612b4357600080fd5b612b4f89838a016129a0565b94506060880135915080821115612b6557600080fd5b612b7189838a016129a0565b93506080880135915080821115612b8757600080fd5b50612b9488828901612a12565b9150509295509295909350565b600080600060608486031215612bb657600080fd5b8335612bc181613311565b92506020840135612bd181613311565b929592945050506040919091013590565b60008060008060808587031215612bf857600080fd5b8435612c0381613311565b93506020850135612c1381613311565b92506040850135915060608501356001600160401b03811115612c3557600080fd5b612c4187828801612a12565b91505092959194509250565b600080600080600060a08688031215612c6557600080fd5b8535612c7081613311565b94506020860135612c8081613311565b9350604086013592506060860135915060808601356001600160401b03811115612ca957600080fd5b612b9488828901612a12565b60008060408385031215612cc857600080fd5b8235612cd381613311565b915060208301358015158114612ae957600080fd5b60008060408385031215612cfb57600080fd5b8235612d0681613311565b946020939093013593505050565b600080600080600060608688031215612d2c57600080fd5b85356001600160401b0380821115612d4357600080fd5b612d4f89838a01612955565b90975095506020880135915080821115612d6857600080fd5b50612d7588828901612955565b96999598509660400135949350505050565b600060208284031215612d9957600080fd5b813561119e81613326565b600060208284031215612db657600080fd5b815161119e81613326565b600060208284031215612dd357600080fd5b5035919050565b600060208284031215612dec57600080fd5b5051919050565b6000806040808486031215612e0757600080fd5b833592506020808501356001600160401b03811115612e2557600080fd5b8501601f81018713612e3657600080fd5b8035612e446129c1826131a7565b8082825284820191508484018a868560061b8701011115612e6457600080fd5b60009450845b84811015612ea65787828d031215612e80578586fd5b612e8861314f565b82358152878301358882015284529286019290870190600101612e6a565b50979a909950975050505050505050565b60008060408385031215612eca57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b83811015612f0957815187529582019590820190600101612eed565b509495945050505050565b60008151808452612f2c81602086016020860161320d565b601f01601f19169290920160200192915050565b60008351612f5281846020880161320d565b835190830190612f6681836020880161320d565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fa290830184612f14565b9695505050505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b60208152600061119e6020830184612ed9565b60408152600061300a6040830185612ed9565b905060018060a01b03831660208301529392505050565b60208152600061119e6020830184612f14565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252601e908201527f506570656d6f6e436172644465636b3a204e6f7420796f7572206465636b0000604082015260600190565b604080519081016001600160401b0381118282101715613171576131716132fb565b60405290565b604051601f8201601f191681016001600160401b038111828210171561319f5761319f6132fb565b604052919050565b60006001600160401b038211156131c0576131c06132fb565b5060051b60200190565b600082198211156131dd576131dd6132a3565b500190565b6000826131f1576131f16132b9565b500490565b600082821015613208576132086132a3565b500390565b60005b83811015613228578181015183820152602001613210565b83811115610c0f5750506000910152565b600181811c9082168061324d57607f821691505b6020821081141561326e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613288576132886132a3565b5060010190565b60008261329e5761329e6132b9565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e3b57600080fd5b6001600160e01b031981168114610e3b57600080fdfea2646970667358221220402d3174a46db4e1feadcc9274ab5b4e6e8aff78aeec4fb7f862017a1b555d9c64736f6c634300080600330000000000000000000000009460dfaad34bc55ee564a6851c58dfc390d7d4ac

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102955760003560e01c80638bad0c0a11610167578063bc197c81116100ce578063e5afabf011610087578063e5afabf01461065c578063e6624c321461066f578063e985e9c514610677578063ef0c4ecf146106b3578063f23a6e61146106c6578063f4025c15146106e557600080fd5b8063bc197c81146105c5578063c87b56dd146105fd578063d1e2c2cf14610610578063d6c3187114610623578063d8ee45b914610636578063dc10b8bd1461064957600080fd5b8063a4c6f63e11610120578063a4c6f63e14610546578063aabd8ff014610566578063b133ac5214610579578063b226ef761461058c578063b7c09e141461059f578063b88d4fde146105b257600080fd5b80638bad0c0a146104b157806395d89b41146104b9578063966dae0e146104c15780639895d749146104d4578063a090195d146104f7578063a22cb4651461053357600080fd5b80633f6b7f971161020b57806370104298116101c4578063701042981461044a578063704802751461045d57806370a08231146104705780637b8ef82714610483578063839fcd521461049657806383a12de91461049e57600080fd5b80633f6b7f97146103c357806342842e0e146103d65780634f3d4f9a146103e95780636352211e1461041b57806365aab7341461042e5780636e4c16521461043757600080fd5b806318ee73961161025d57806318ee73961461033757806323b872dd1461036e57806324d7806c146103815780632c1e3c39146103945780632ed38bfc146103a757806330ecf94e146103ba57600080fd5b806301ffc9a71461029a57806306fdde03146102c2578063081812fc146102d7578063095ea7b31461030257806317afd56814610317575b600080fd5b6102ad6102a8366004612d87565b6106ed565b60405190151581526020015b60405180910390f35b6102ca6106fe565b6040516102b99190613021565b6102ea6102e5366004612dc1565b610790565b6040516001600160a01b0390911681526020016102b9565b610315610310366004612ce8565b6107b7565b005b61032a610325366004612dc1565b6108d2565b6040516102b99190612fe4565b610360610345366004612a81565b6001600160a01b031660009081526013602052604090205490565b6040519081526020016102b9565b61031561037c366004612ba1565b610992565b6102ad61038f366004612a81565b6109c3565b6103156103a2366004612a81565b6109d0565b6103156103b5366004612eb7565b610a04565b61036060085481565b6103606103d1366004612ce8565b610c15565b6103156103e4366004612ba1565b610c46565b6103606103f7366004612eb7565b60009182526012602090815260408084209284526002909201905290206001015490565b6102ea610429366004612dc1565b610c61565b61036060075481565b61032a610445366004612dc1565b610cc1565b610315610458366004612dc1565b610dca565b61031561046b366004612a81565b610e20565b61036061047e366004612a81565b610e3e565b61032a610491366004612eb7565b610ec4565b610315610ee5565b6103156104ac366004612a81565b610fb3565b610315610fe7565b6102ca610ff2565b6010546102ea906001600160a01b031681565b6103606104e2366004612dc1565b60009081526012602052604090206001015490565b61051e610505366004612dc1565b6012602052600090815260409020805460019091015482565b604080519283526020830191909152016102b9565b610315610541366004612cb5565b611001565b610360610554366004612dc1565b60009081526012602052604090205490565b610315610574366004612dc1565b611010565b610315610587366004612eb7565b611027565b61031561059a366004612df3565b611041565b6103606105ad366004612dc1565b6110de565b6103156105c0366004612be2565b6110ff565b6105e46105d3366004612af4565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016102b9565b6102ca61060b366004612dc1565b611131565b6011546102ea906001600160a01b031681565b600f546102ea906001600160a01b031681565b610315610644366004612d14565b6111a5565b610315610657366004612dc1565b611231565b61031561066a366004612dc1565b611248565b610315611516565b6102ad610685366004612abb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103156106c1366004612df3565b61151e565b6105e46106d4366004612c4d565b63f23a6e6160e01b95945050505050565b6103156115bb565b60006106f8826116c5565b92915050565b60606000805461070d90613239565b80601f016020809104026020016040519081016040528092919081815260200182805461073990613239565b80156107865780601f1061075b57610100808354040283529160200191610786565b820191906000526020600020905b81548152906001019060200180831161076957829003601f168201915b5050505050905090565b600061079b826116ea565b506000908152600460205260409020546001600160a01b031690565b60006107c282610c61565b9050806001600160a01b0316836001600160a01b031614156108355760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061085157506108518133610685565b6108c35760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161082c565b6108cd8383611749565b505050565b60008181526012602052604081206003810154606092906001600160401b03811115610900576109006132fb565b604051908082528060200260200182016040528015610929578160200160208202803683370190505b50905060005b600383015481101561098a57826003018181548110610950576109506132e5565b906000526020600020015482828151811061096d5761096d6132e5565b60209081029190910101528061098281613274565b91505061092f565b509392505050565b61099c33826117b7565b6109b85760405162461bcd60e51b815260040161082c90613034565b6108cd838383611835565b60006106f8600683611999565b6109d9336109c3565b6109e257600080fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b81610a0e81610c61565b6001600160a01b0316336001600160a01b031614610a3e5760405162461bcd60e51b815260040161082c90613118565b601054604051627eeac760e11b8152336004820152602481018490526001916001600160a01b03169062fdd58e9060440160206040518083038186803b158015610a8757600080fd5b505afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190612dda565b1015610b1c5760405162461bcd60e51b815260206004820152602660248201527f506570656d6f6e436172644465636b3a20446f6e2774206f776e20626174746c604482015265194818d85c9960d21b606482015260840161082c565b600083815260126020526040902054821415610b885760405162461bcd60e51b815260206004820152602560248201527f506570656d6f6e436172644465636b3a204361726420616c726561647920696e604482015264206465636b60d81b606482015260840161082c565b600083815260126020526040908190208054908490556010549151637921219560e11b815290916001600160a01b03169063f242432a90610bd490339030908890600190600401612fac565b600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b50505050610c0f816119ce565b50505050565b60136020528160005260406000208181548110610c3157600080fd5b90600052602060002001600091509150505481565b6108cd838383604051806020016040528060008152506110ff565b6000818152600260205260408120546001600160a01b0316806106f85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161082c565b60008181526012602052604081206001810154606092906001600160401b03811115610cef57610cef6132fb565b604051908082528060200260200182016040528015610d18578160200160208202803683370190505b5090506000805b6003840154811015610dc0576000846003018281548110610d4257610d426132e5565b6000918252602080832090910154808352600288019091526040822060010154909250905b81811015610daa57828686610d7b81613274565b975081518110610d8d57610d8d6132e5565b602090810291909101015280610da281613274565b915050610d67565b5050508080610db890613274565b915050610d1f565b5090949350505050565b80610dd481610c61565b6001600160a01b0316336001600160a01b031614610e045760405162461bcd60e51b815260040161082c90613118565b600082815260126020526040812080549190556108cd816119ce565b610e29336109c3565b610e3257600080fd5b610e3b81611a40565b50565b60006001600160a01b038216610ea85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161082c565b506001600160a01b031660009081526003602052604090205490565b60606000610ed184610cc1565b9050610edd8184611a82565b949350505050565b610eee336109c3565b610ef757600080fd5b600f54604051637733e61560e11b815260206004820152600e60248201526d506570656d6f6e466163746f727960901b60448201526001600160a01b039091169063ee67cc2a9060640160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612a9e565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610fbc336109c3565b610fc557600080fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b610ff033611b75565b565b60606001805461070d90613239565b61100c338383611bb7565b5050565b611019336109c3565b61102257600080fd5b600855565b611030336109c3565b61103957600080fd5b600c55600d55565b8161104b81610c61565b6001600160a01b0316336001600160a01b03161461107b5760405162461bcd60e51b815260040161082c90613118565b60005b8251811015610c0f576110cc8484838151811061109d5761109d6132e5565b6020026020010151600001518584815181106110bb576110bb6132e5565b602002602001015160200151611c86565b806110d681613274565b91505061107e565b600981815481106110ee57600080fd5b600091825260209091200154905081565b61110933836117b7565b6111255760405162461bcd60e51b815260040161082c90613034565b610c0f84848484611e4c565b606061113c826116ea565b600061115360408051602081019091526000815290565b90506000815111611173576040518060200160405280600081525061119e565b8061117d84611e7f565b60405160200161118e929190612f40565b6040516020818303038152906040525b9392505050565b6111ae336109c3565b6111b757600080fd5b6111f3858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611f1392505050565b6111fc57600080fd5b60075481111561120b57600080fd5b600b81905561121c600986866128f5565b50611229600a84846128f5565b505050505050565b61123a336109c3565b61124357600080fd5b600755565b6112a2600980548060200260200160405190810160405280929190818152602001828054801561129757602002820191906000526020600020905b815481526020019060010190808311611283575b505050505082611f8e565b6112e35760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818985d1d1b1958d85c9960721b604482015260640161082c565b33600090815260136020526040902054156113365760405162461bcd60e51b81526020600482015260136024820152724e6f7420796f7572206669727374206465636b60681b604482015260640161082c565b6000600b54600161134791906131ca565b90506000816001600160401b03811115611363576113636132fb565b60405190808252806020026020018201604052801561138c578160200160208202803683370190505b50600a54909150600061139d611fc3565b905084836000815181106113b3576113b36132e5565b602090810291909101015260015b8481101561144b57604080516020810183905290810183905260600160408051601f1981840301815291905280516020909101209150600a611403848461328f565b81548110611413576114136132e5565b9060005260206000200154848281518110611430576114306132e5565b602090810291909101015261144481613274565b90506113c1565b50601054604051633007a53d60e11b81526001600160a01b039091169063600f4a7a9061147e9086903090600401612ff7565b600060405180830381600087803b15801561149857600080fd5b505af11580156114ac573d6000803e3d6000fd5b5050505060006114ba612085565b6000818152601260205260409020879055905060015b8581101561150d576114fd828683815181106114ee576114ee6132e5565b602002602001015160016120d4565b61150681613274565b90506114d0565b50505050505050565b610e3b612085565b8161152881610c61565b6001600160a01b0316336001600160a01b0316146115585760405162461bcd60e51b815260040161082c90613118565b60005b8251811015610c0f576115a98484838151811061157a5761157a6132e5565b602002602001015160000151858481518110611598576115986132e5565b6020026020010151602001516121e8565b806115b381613274565b91505061155b565b6000600c541161160d5760405162461bcd60e51b815260206004820152601e60248201527f4d696e74696e6720746573742063617264732069732064697361626c65640000604482015260640161082c565b601054600d54600c54604051633ef009ef60e01b8152600481019290925260248201523360448201526001600160a01b0390911690633ef009ef90606401600060405180830381600087803b15801561166557600080fd5b505af1158015610c0f573d6000803e3d6000fd5b6001600160a01b03811661168c57600080fd5b6116968282611999565b156116a057600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b60006001600160e01b03198216630271189760e51b14806106f857506106f88261241a565b6000818152600260205260409020546001600160a01b0316610e3b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161082c565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061177e82610c61565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806117c383610c61565b9050806001600160a01b0316846001600160a01b0316148061180a57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610edd5750836001600160a01b031661182384610790565b6001600160a01b031614949350505050565b826001600160a01b031661184882610c61565b6001600160a01b03161461186e5760405162461bcd60e51b815260040161082c906130d3565b6001600160a01b0382166118d05760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161082c565b826001600160a01b03166118e382610c61565b6001600160a01b0316146119095760405162461bcd60e51b815260040161082c906130d3565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b0382166119ae57600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b8015610e3b57601054604051637921219560e11b81526001600160a01b039091169063f242432a90611a0b90309033908690600190600401612fac565b600060405180830381600087803b158015611a2557600080fd5b505af1158015611a39573d6000803e3d6000fd5b5050505050565b611a4b600682611679565b6040516001600160a01b038216907f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33990600090a250565b606060005b8351811015611b6d576000818551611a9f91906131f6565b611aa9908561328f565b611ab390836131ca565b90506000858281518110611ac957611ac96132e5565b60200260200101519050858381518110611ae557611ae56132e5565b6020026020010151868381518110611aff57611aff6132e5565b60200260200101818152505080868481518110611b1e57611b1e6132e5565b60200260200101818152505084604051602001611b3d91815260200190565b6040516020818303038152906040528051906020012060001c945050508080611b6590613274565b915050611a87565b509192915050565b611b8060068261246a565b6040516001600160a01b038216907fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f90600090a250565b816001600160a01b0316836001600160a01b03161415611c195760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161082c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600083815260126020526040902060010154611ca290826124b2565b6007541015611cf35760405162461bcd60e51b815260206004820152601e60248201527f506570656d6f6e436172644465636b3a204465636b206f766572666c6f770000604482015260640161082c565b601054604051627eeac760e11b81523360048201526024810184905282916001600160a01b03169062fdd58e9060440160206040518083038186803b158015611d3b57600080fd5b505afa158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d739190612dda565b1015611ddd5760405162461bcd60e51b815260206004820152603360248201527f506570656d6f6e436172644465636b3a20596f7520646f6e2774206861766520604482015272195b9bdd59da081bd9881d1a1a5cc818d85c99606a1b606482015260840161082c565b611de88383836120d4565b601054604051637921219560e11b81526001600160a01b039091169063f242432a90611e1e903390309087908790600401612fac565b600060405180830381600087803b158015611e3857600080fd5b505af115801561150d573d6000803e3d6000fd5b611e57848484611835565b611e63848484846124be565b610c0f5760405162461bcd60e51b815260040161082c90613081565b60606000611e8c836125cb565b60010190506000816001600160401b03811115611eab57611eab6132fb565b6040519080825280601f01601f191660200182016040528015611ed5576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611f0e5761098a565b611edf565b60008060018351611f2491906131f6565b905060005b81811015611f84576020808202850101516000611f5986611f4b8560016131ca565b602090810291909101015190565b905080821115611f6f5750600095945050505050565b50508080611f7c90613274565b915050611f29565b5060019392505050565b600080611f9b84846126a3565b90508351811480611fb457506020808202850101518314155b15611f845760009150506106f8565b600080601160009054906101000a90046001600160a01b03166001600160a01b031663dbdff2c16040518163ffffffff1660e01b815260040160206040518083038186803b15801561201457600080fd5b505afa158015612028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c9190612dda565b60408051436020808301919091524282840152606080830194909452825180830390940184526080909101909152815191012092915050565b600061209333600e546126f6565b3360009081526013602090815260408220600e8054825460018181018555938652939094209092019290925554906120cc9082906124b2565b600e55919050565b600083815260126020908152604080832085845260020190915290206003015460ff16612180576040805160808101825283815260208082018481526000878152601280845285822060038082018054888a01908152600160608a018181528d885260029586018a529a872099518a559651898801555192880192909255965195909601805460ff191695151595909517909455928252835490810184559282529020018290556121b2565b6000838152601260209081526040808320858452600201909152902060018101546121ab90836124b2565b6001909101555b6000838152601260205260409020600101546121ce90826124b2565b600093845260126020526040909320600101929092555050565b6000838152601260209081526040808320858452600201909152902060018101546122139083612710565b600180830191909155600085815260126020526040902001546122369083612710565b60008581526012602052604090206001908101919091558101546123ac57600084815260126020526040812060030154612272906001906131f6565b6000868152601260205260408120600301805492935090918390811061229a5761229a6132e5565b60009182526020808320909101546002808701548a855260128085526040808720858852808501875290872090930191909155938a9052929091526003909101805491925090839081106122f0576122f06132e5565b906000526020600020015460126000888152602001908152602001600020600301846002015481548110612326576123266132e5565b906000526020600020018190555060126000878152602001908152602001600020600301805480612359576123596132cf565b600082815260208082208301600019908101839055909201909255878252601281526040808320888452600290810190925282208281556001810183905590810191909155600301805460ff1916905550505b601054604051637921219560e11b81526001600160a01b039091169063f242432a906123e2903090339088908890600401612fac565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050505050505050565b60006001600160e01b031982166380ac58cd60e01b148061244b57506001600160e01b03198216635b5e139f60e01b145b806106f857506301ffc9a760e01b6001600160e01b03198316146106f8565b6001600160a01b03811661247d57600080fd5b6124878282611999565b61249057600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b600061119e82846131ca565b60006001600160a01b0384163b156125c057604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612502903390899088908890600401612f6f565b602060405180830381600087803b15801561251c57600080fd5b505af192505050801561254c575060408051601f3d908101601f1916820190925261254991810190612da4565b60015b6125a6573d80801561257a576040519150601f19603f3d011682016040523d82523d6000602084013e61257f565b606091505b50805161259e5760405162461bcd60e51b815260040161082c90613081565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610edd565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061260a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612636576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061265457662386f26fc10000830492506010015b6305f5e100831061266c576305f5e100830492506008015b612710831061268057612710830492506004015b60648310612692576064830492506002015b600a83106106f85760010192915050565b81516000908190806126ba576000925050506106f8565b8082101561098a5760006126ce838361271c565b6020808202880101519091508511156126ec578060010192506126f0565b8091505b506126ba565b61100c828260405180602001604052806000815250612737565b600061119e82846131f6565b600061272b60028484186131e2565b61119e908484166131ca565b612741838361276a565b61274e60008484846124be565b6108cd5760405162461bcd60e51b815260040161082c90613081565b6001600160a01b0382166127c05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161082c565b6000818152600260205260409020546001600160a01b0316156128255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082c565b6000818152600260205260409020546001600160a01b03161561288a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082c565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054828255906000526020600020908101928215612930579160200282015b82811115612930578235825591602001919060010190612915565b5061293c929150612940565b5090565b5b8082111561293c5760008155600101612941565b60008083601f84011261296757600080fd5b5081356001600160401b0381111561297e57600080fd5b6020830191508360208260051b850101111561299957600080fd5b9250929050565b600082601f8301126129b157600080fd5b813560206129c66129c1836131a7565b613177565b80838252828201915082860187848660051b89010111156129e657600080fd5b60005b85811015612a05578135845292840192908401906001016129e9565b5090979650505050505050565b600082601f830112612a2357600080fd5b81356001600160401b03811115612a3c57612a3c6132fb565b612a4f601f8201601f1916602001613177565b818152846020838601011115612a6457600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215612a9357600080fd5b813561119e81613311565b600060208284031215612ab057600080fd5b815161119e81613311565b60008060408385031215612ace57600080fd5b8235612ad981613311565b91506020830135612ae981613311565b809150509250929050565b600080600080600060a08688031215612b0c57600080fd5b8535612b1781613311565b94506020860135612b2781613311565b935060408601356001600160401b0380821115612b4357600080fd5b612b4f89838a016129a0565b94506060880135915080821115612b6557600080fd5b612b7189838a016129a0565b93506080880135915080821115612b8757600080fd5b50612b9488828901612a12565b9150509295509295909350565b600080600060608486031215612bb657600080fd5b8335612bc181613311565b92506020840135612bd181613311565b929592945050506040919091013590565b60008060008060808587031215612bf857600080fd5b8435612c0381613311565b93506020850135612c1381613311565b92506040850135915060608501356001600160401b03811115612c3557600080fd5b612c4187828801612a12565b91505092959194509250565b600080600080600060a08688031215612c6557600080fd5b8535612c7081613311565b94506020860135612c8081613311565b9350604086013592506060860135915060808601356001600160401b03811115612ca957600080fd5b612b9488828901612a12565b60008060408385031215612cc857600080fd5b8235612cd381613311565b915060208301358015158114612ae957600080fd5b60008060408385031215612cfb57600080fd5b8235612d0681613311565b946020939093013593505050565b600080600080600060608688031215612d2c57600080fd5b85356001600160401b0380821115612d4357600080fd5b612d4f89838a01612955565b90975095506020880135915080821115612d6857600080fd5b50612d7588828901612955565b96999598509660400135949350505050565b600060208284031215612d9957600080fd5b813561119e81613326565b600060208284031215612db657600080fd5b815161119e81613326565b600060208284031215612dd357600080fd5b5035919050565b600060208284031215612dec57600080fd5b5051919050565b6000806040808486031215612e0757600080fd5b833592506020808501356001600160401b03811115612e2557600080fd5b8501601f81018713612e3657600080fd5b8035612e446129c1826131a7565b8082825284820191508484018a868560061b8701011115612e6457600080fd5b60009450845b84811015612ea65787828d031215612e80578586fd5b612e8861314f565b82358152878301358882015284529286019290870190600101612e6a565b50979a909950975050505050505050565b60008060408385031215612eca57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b83811015612f0957815187529582019590820190600101612eed565b509495945050505050565b60008151808452612f2c81602086016020860161320d565b601f01601f19169290920160200192915050565b60008351612f5281846020880161320d565b835190830190612f6681836020880161320d565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fa290830184612f14565b9695505050505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b60208152600061119e6020830184612ed9565b60408152600061300a6040830185612ed9565b905060018060a01b03831660208301529392505050565b60208152600061119e6020830184612f14565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252601e908201527f506570656d6f6e436172644465636b3a204e6f7420796f7572206465636b0000604082015260600190565b604080519081016001600160401b0381118282101715613171576131716132fb565b60405290565b604051601f8201601f191681016001600160401b038111828210171561319f5761319f6132fb565b604052919050565b60006001600160401b038211156131c0576131c06132fb565b5060051b60200190565b600082198211156131dd576131dd6132a3565b500190565b6000826131f1576131f16132b9565b500490565b600082821015613208576132086132a3565b500390565b60005b83811015613228578181015183820152602001613210565b83811115610c0f5750506000910152565b600181811c9082168061324d57607f821691505b6020821081141561326e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613288576132886132a3565b5060010190565b60008261329e5761329e6132b9565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e3b57600080fd5b6001600160e01b031981168114610e3b57600080fdfea2646970667358221220402d3174a46db4e1feadcc9274ab5b4e6e8aff78aeec4fb7f862017a1b555d9c64736f6c63430008060033

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

0000000000000000000000009460dfaad34bc55ee564a6851c58dfc390d7d4ac

-----Decoded View---------------
Arg [0] : _configAddress (address): 0x9460DfaAD34Bc55ee564A6851c58DFC390D7d4ac

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009460dfaad34bc55ee564a6851c58dfc390d7d4ac


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

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