ETH Price: $3,392.68 (-1.42%)

Token

Ape Harbour Yachts (AHY)
 

Overview

Max Total Supply

7,777 AHY

Holders

2,447

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
joeb1.eth
Balance
1 AHY
0x648174333697082875c3187c6c2571d562b422c5
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

The first verified metaverse yacht collection in history. This is the genesis yacht collection of Ape Harbour. The yachts have their name on-chain, the current owner can change it.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
ApeHarbourYachts

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion, MIT license
File 1 of 19 : ApeHarbourYachts.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// import "hardhat/console.sol";

import "@openzeppelin/contracts/access/Ownable.sol";
// import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

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

import "./base64.sol";
import "./ApeHarbourDinghies.sol";

contract ApeHarbourYachts is ERC721Enumerable, VRFConsumerBase, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    uint256 constant MAX_MINTABLE = 20;
    uint256 constant public PRICE = 70000000000000000; // 0.07 ETH
    uint256 constant MAX_SUPPLY = 7777;
    uint256 constant MAX_RANGE = 100;
    uint256 constant MAX_SPEED = 99;

    uint8 constant BITMASK = 255;

    uint256 immutable startMinting;

    string constant preRevealImageUrl = "ipfs://QmWt3pBeGmTEg5RU5j82XoEjGuaD767LfBFJ5g86iccCX7";

    string public revealedCollectionBaseURL;
    bool public frozen;

    IERC721 private bayc;
    IERC721 private bakc;
    ApeHarbourDinghies private ahd;

    uint8[][13] private cutoffs;
    string[][13] private traitValues;

    enum Keys { backgrounds, hulls_background, masts, sails, anchors, balloons, backprops, bananaboats, centerprops, carpets, chains, flags, cargos, range, speed }

    string[] private traits = [ "Background", "Hull", "Mast", "Sail", "Anchor", "Equipment", "Equipment", "Sideboat", "Equipment", "Equipment", "Equipment", "Flag", "Equipment", "Range", "Speed" ];

    mapping(uint256 => string) private names;

    // Random number generation
    uint256 public randomSeed;
    bytes32 internal keyHash;
    uint256 internal chainLinkFee;
    bytes32 public requestId;

    event Mint(address indexed _to, uint256 _amount);
    event NameChange(uint256 indexed _tokenId, string _name);
    event Reveal(uint256 randomness);
    event SetCollectionHash(string ipfsHash);


    modifier onlyApeOwner() {
        require(
            bayc.balanceOf(msg.sender) > 0,
            "ApeOwner: Caller is not an ape owner"
        );

        _;
    }

    modifier onlyDogOwner() {
        require(
            bakc.balanceOf(msg.sender) > 0,
            "DogOwner: Caller is not a dog owner"
        );

        _;
    }

    constructor(
        address _baycAddress,
        address _bakcAddress,
        address _ahdAddress,
        address _linkAddress,
        address _vrfCoordinatorAddress,
        bytes32 _keyHash,
        uint256 _chainLinkFee,
        uint256 _startMinting
    )
        ERC721("Ape Harbour Yachts", "AHY")
        VRFConsumerBase(_vrfCoordinatorAddress, _linkAddress)
    {
        keyHash = _keyHash;
        chainLinkFee = _chainLinkFee;
        bayc = IERC721(_baycAddress);
        bakc = IERC721(_bakcAddress);
        ahd = ApeHarbourDinghies(_ahdAddress);

        startMinting = _startMinting;

        cutoffs[uint256(Keys.backgrounds)] = [30,81,132,170,221,254];
        cutoffs[uint256(Keys.hulls_background)] = [58,98,136,184,219,239,249,251];
        cutoffs[uint256(Keys.masts)] = [25,204,255];
        cutoffs[uint256(Keys.sails)] = [25,63,80,95,115,153,165,180,195,207,219,226,236,243,248];
        cutoffs[uint256(Keys.anchors)] = [51,76,114,139,215,253];
        cutoffs[uint256(Keys.balloons)] = [51,89,140,178,203,254];
        cutoffs[uint256(Keys.backprops)] = [25,53,70,108,125,150,167,190,215,232,249];
        cutoffs[uint256(Keys.bananaboats)] = [204,221,254];
        cutoffs[uint256(Keys.centerprops)] = [25,48,71,88,100,117,132,144,154,166,189,206,223,235,247];
        cutoffs[uint256(Keys.carpets)] = [230,255];
        cutoffs[uint256(Keys.chains)] = [38,140,216,254];
        cutoffs[uint256(Keys.flags)] = [25,55,85,100,125,140,155,172,189,212,235,250];
        cutoffs[uint256(Keys.cargos)] = [40,55,80,103,126,143,155,180,203,220,243,250];

        traitValues[uint256(Keys.backgrounds)] = ['Apelantic', 'Banana Bay', 'Everglades Ape Park', 'Ape Harbour', 'Ape Island', 'Apebiza'];
        traitValues[uint256(Keys.hulls_background)] = ['Classic', 'Pink', 'Mahogany', 'Royal', 'Ocean Green', 'Robot', 'Gold', 'Diamond'];
        traitValues[uint256(Keys.masts)] = ['null', 'Wood', 'Bone'];
        traitValues[uint256(Keys.sails)] = ['null', 'Pennant Chain', 'Pink', 'Classic', 'Banana Pirates', 'Bulb Chain', 'Denim', 'White Stripes', 'Cheetah', 'USA', 'Fireflys', 'Trippy', 'Prison', 'Pizza', 'Gold'];
        traitValues[uint256(Keys.anchors)] = ['null', 'Royal Gold', 'Pirate', 'Gold', 'Classic', 'Steel'];
        traitValues[uint256(Keys.balloons)] = ['null', 'Banana Balloons', 'Colorful Balloons', 'Yellow Balloons', 'Pink Balloons', 'Ape Balloon'];
        traitValues[uint256(Keys.backprops)] = ['null', 'Tiki Lamp', 'Water Slide', 'Jumping Board', 'Palm', 'Banana Tree', 'Curved Palm', 'Fish', 'Fishing Set', 'Lamp', 'Disco Ball'];
        traitValues[uint256(Keys.bananaboats)] = ['null', 'Banana Boat', 'Flamingo'];
        traitValues[uint256(Keys.centerprops)] = ['null', 'DJ Booth', 'Bar', 'Hammock', 'Old Couch', 'Fishbowl Lounge', 'Deewan Couch', 'Jacuzy', 'Bathtub', 'BBQ', 'Deckchair', 'Drums', 'Wine Lounge', 'Pizza Oven', 'Radio'];
        traitValues[uint256(Keys.carpets)] = ['null', 'Carpet'];
        traitValues[uint256(Keys.chains)] = ['null', 'Pennant Chain', 'Bulb Chain', 'Fireflys'];
        traitValues[uint256(Keys.flags)] = ['null', 'Apes', 'Fomo', 'Lofi', 'Hodl', 'One Banana', 'Three Bananas', 'Doggo Red', 'Doggo Orange', 'Banana Pirates', 'Aped', 'Two Bananas'];
        traitValues[uint256(Keys.cargos)] = ['null', 'Moneky Paw', 'Coconuts', 'Beer', 'Boxes of Oranges', 'Box of Oranges', 'Golden Banana', 'Whiskey Bottles', 'Banana Boxes', 'Banana Box', 'Coffee', 'Diamond Banana'];
    }

    function mint(address _ape, uint8 _amount)
        public
        payable
        returns (uint256)
    {
        require(block.timestamp >= startMinting, 'Minting has not started');
        require(_amount <= MAX_MINTABLE, "You can only mint up to 20 tokens at once");
        require(msg.value >= PRICE * _amount, "Insufficient funds");
        require(
            _amount + totalSupply() <= MAX_SUPPLY,
            "Request exeeds maximum supply"
        );

        if (block.timestamp < startMinting + 6 hours) {
            require(bayc.balanceOf(msg.sender) > 0, "No ape, no yacht");
        }


        bool ownsDog = bakc.balanceOf(msg.sender) > 0;
        bool ownsApe = bayc.balanceOf(msg.sender) > 0;

        for (uint8 i = 0; i < _amount; i++) {
            _tokenIds.increment();

            uint256 newTokenId = _tokenIds.current();
            _safeMint(_ape, newTokenId);
        }

        if (ownsApe && ownsDog && block.timestamp < startMinting  + 12 hours) {
            ahd.mint(_ape);
        }

        emit Mint(_ape, _amount);

        return _tokenIds.current();
    }

    function setName(uint256 _tokenId, string memory _name)
        public
        returns (string memory)
    {
        require(ownerOf(_tokenId) == msg.sender, "Only boat owner can name it");

        names[_tokenId] = _name;

        emit NameChange(_tokenId, _name);

        return _name;
    }

    function getName(uint256 _tokenId) public view returns (string memory) {
        return names[_tokenId];
    }

    function withdraw() public onlyOwner {
        uint256 balance = address(this).balance;
        address payable receiver = payable(msg.sender);
        receiver.transfer(balance);
    }

    function decodeTokenId(uint256 randomValue, uint256 _tokenId)
        public
        view
        returns (uint256[] memory)
    {
        require(randomValue != 0, "Tokens have not been revealed yet");

        uint256 tokenCode = uint256(
            keccak256(abi.encode(randomValue, _tokenId))
        );

        uint8[15] memory shifts = [ 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112 ];
        uint256[] memory tokenPart = new uint256[](shifts.length);

        for (uint256 i = 0; i < shifts.length; i++) {
            tokenPart[i] = (tokenCode >> shifts[i]) & BITMASK;
        }

        // only use cutoffs for string attributes, that's why the loop is until lenght -2
        for (uint256 i = 0; i < tokenPart.length - 2; i++) {
            uint256 currentIdx = 0;
            for (uint256 j = 0; j < cutoffs[i].length; j++) {
                if (tokenPart[i] < cutoffs[i][j]) {
                    currentIdx = j;
                    break;
                }
            }
            tokenPart[i] = currentIdx;
        }

        bool noMast = (tokenPart[uint256(Keys.masts)] == 0);

        // special treatment for no mast boats:
        if (noMast) {
            tokenPart[uint256(Keys.sails)] = 0;
            tokenPart[uint256(Keys.chains)] = 0;
            tokenPart[uint256(Keys.flags)] = 0;
        }

        tokenPart[uint256(Keys.range)] =
            (tokenPart[uint256(Keys.range)] % MAX_RANGE) +
            1;
        tokenPart[uint256(Keys.speed)] =
            (tokenPart[uint256(Keys.speed)] % MAX_SPEED) +
            1;

        return tokenPart;
    }

    function reveal() public onlyOwner {
        require(
            LINK.balanceOf(address(this)) >= chainLinkFee,
            "Not enough LINK - fill contract with faucet"
        );
        require(randomSeed == 0, 'randomSeed has already been set');
        requestId = requestRandomness(keyHash, chainLinkFee);

    }

    function fulfillRandomness(bytes32 _requestId, uint256 _randomness)
        internal
        override
    {
        require(requestId == _requestId, "Wrong request Id");
        require(randomSeed == 0, 'randomSeed has already been set');
        randomSeed = _randomness;

        emit Reveal(_randomness);
    }

    function getAttributeBytes(uint256 key, uint256 value)
        private
        view
        returns (bytes memory, bool attributePresent)
    {
        if (
            keccak256(abi.encodePacked(traitValues[key][value])) ==
            keccak256(abi.encodePacked("null"))
        ) {
            return ("", false);
        }
        return (
            abi.encodePacked(
                '{"trait_type": "',
                traits[key],
                '", "value": "',
                traitValues[key][value],
                '"}'
            ),
            true
        );
    }

    function getNumericAttributeBytes(uint256 _key, uint256 _value)
        private
        view
        returns (bytes memory)
    {
        return (
            abi.encodePacked(
                '{"trait_type": "',
                traits[_key],
                '", "value": ',
                Strings.toString(_value),
                "}"
            )
        );
    }

    function getAttributes(uint256[] memory tokenPart)
        private
        view
        returns (string memory) {

        bytes memory attributes = '"attributes": [';
        bytes memory singleAtt;
        bool attPresent;

        (singleAtt, attPresent) = getAttributeBytes(0, tokenPart[0]);

        attributes = abi.encodePacked(attributes, singleAtt);

        // loop through string attributes only
        for (uint256 i = 1; i < traits.length - 2; i++) {
            (singleAtt, attPresent) = getAttributeBytes(i, tokenPart[i]);
            if (attPresent) {
                attributes = abi.encodePacked(attributes, ", ", singleAtt);
            }
        }

        // add range and speed
        attributes = abi.encodePacked(
            attributes,
            ", ",
            getNumericAttributeBytes(
                uint256(Keys.speed),
                tokenPart[uint256(Keys.speed)]
            ),
            ", ",
            getNumericAttributeBytes(
                uint256(Keys.range),
                tokenPart[uint256(Keys.range)]
            ),
            "]"
        );

        return string(attributes);
    }

    function setRevealedCollectionBaseURL(string memory _ipfsHash) onlyOwner public {
        require(!frozen, 'Metadata has been frozen');
        revealedCollectionBaseURL = string(abi.encodePacked('ipfs://', _ipfsHash, '/'));
        emit SetCollectionHash(_ipfsHash);
    }

    function freezeMetadata() onlyOwner public {
        frozen = true;
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        string memory tokenName = names[_tokenId];
        if (keccak256(abi.encodePacked(tokenName)) == keccak256(abi.encodePacked(''))) {
            tokenName = string(abi.encodePacked('Yacht ', Strings.toString(_tokenId)));
        }

        bytes memory content = abi.encodePacked('{"name":"', tokenName, '"');

        if (keccak256(abi.encodePacked(revealedCollectionBaseURL))  == keccak256(abi.encodePacked(''))) {
            content = abi.encodePacked(content, 
                ', ',
                '"description": "An unrevealed Ape Harbour Yacht"',
                ', ',
                '"image": "', preRevealImageUrl, '"',
                '}');
        } else {
            uint256[] memory tokenParts = decodeTokenId(randomSeed, _tokenId);
            content = abi.encodePacked(content, 
                ', ', 
                getAttributes(tokenParts),
                ', ',
                '"image": "', revealedCollectionBaseURL, Strings.toString(_tokenId), '.png"',
                '}');
        }

        string memory result = string(
            abi.encodePacked(
                "data:application/json;base64,",
                Base64.encode(content)
            )
        );

        return result;
    }
}

File 2 of 19 : 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 3 of 19 : 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 4 of 19 : 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 5 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 6 of 19 : ERC721.sol
// SPDX-License-Identifier: MIT

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: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 overriden 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 owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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: transfer caller is not owner nor 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: transfer caller is not owner nor 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 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 _owners[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) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, 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);

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

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

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @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(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 7 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

File 8 of 19 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 9 of 19 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 10 of 19 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 11 of 19 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

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 12 of 19 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 13 of 19 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 14 of 19 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 15 of 19 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

File 16 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT

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 17 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT

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 18 of 19 : ApeHarbourDinghies.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// import "hardhat/console.sol";

import "@openzeppelin/contracts/access/Ownable.sol";
// import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

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

import "./base64.sol";

contract ApeHarbourDinghies is ERC721Enumerable, VRFConsumerBase, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    IERC721 private bayc;
    IERC721 private bakc;

    address private minter;

    // Random number generation
    uint256 public randomSeed;
    bytes32 internal keyHash;
    uint256 internal chainLinkFee;

    bytes32 public requestId;

    string constant preRevealImageUrl = 'ipfs://QmNNmPE3FEk5xZ79zTKQC6ekm1vVX25gQivfQguVwRGMbu';
    string public revealedCollectionBaseURL;
    bool public frozen;

    uint8 constant BITMASK = 255;

    uint8[][2] private cutoffs;
    string[][2] private traitValues;

    enum Keys { backgrounds, surfboard }

    string[] private traits = [ "Background", "Surfboard" ];


    event Reveal(uint256 randomness);
    event Mint(address indexed owner);


    modifier onlyApeOwner() {
        require(
            bayc.balanceOf(msg.sender) > 0,
            "ApeOwner: Caller is not an ape owner"
        );

        _;
    }

    modifier onlyDogOwner() {
        require(
            bakc.balanceOf(msg.sender) > 0,
            "DogOwner: Caller is not a dog owner"
        );

        _;
    }

    modifier onlyMinter() {
        require(msg.sender == minter, 'Minting only allowed from AHY');

        _;
    }

    constructor(
        address _baycAddress,
        address _bakcAddress,
        address _linkAddress,
        address _vrfCoordinatorAddress,
        bytes32 _keyHash,
        uint256 _chainLinkFee
    ) ERC721("Ape Harbour Dinghies", "AHD") 
    VRFConsumerBase(_vrfCoordinatorAddress, _linkAddress) {
        bayc = IERC721(_baycAddress);
        bakc = IERC721(_bakcAddress);
        keyHash = _keyHash;
        chainLinkFee = _chainLinkFee;

        traitValues[uint256(Keys.backgrounds)] = ['Apelantic', 'Banana Bay', 'Everglades Ape Park', 'Ape Island', 'Apebiza'];
        traitValues[uint256(Keys.surfboard)] = ['Black', 'Prison', 'Trippy', 'Cheetah', 'Ocean Green', 'Wooden', 'Diamond', 'Mahogany', 'Classic', 'Pink', 'Gold', 'Pizza', 'White Stripes', 'Radioactive', 'USA', 'Polkadots', 'Plastic', 'Banana Pirates', 'Watermelons', 'Rainbow', 'Fomo Blue', 'Pink HOLD', 'Red Apes', 'Lofi Pink', 'Lofi Blue', 'VHS', 'Static'];

        cutoffs[uint256(Keys.backgrounds)] = [30,111,154,197,253];
        cutoffs[uint256(Keys.surfboard)] = [12,19,24,29,41,48,50,57,69,81,83,95,107,114,126,133,138,150,162,174,186,193,205,212,224,231,238];
    }

    function setMinter(address _minter) public onlyOwner {
        minter = _minter;
    }

    function mint(address _to) external onlyMinter returns (uint256) {

        _tokenIds.increment();
        uint256 newTokenId = _tokenIds.current();
        _safeMint(_to, newTokenId);

        emit Mint(_to);

        return _tokenIds.current();
    }

        function reveal() public onlyOwner {
        require(
            LINK.balanceOf(address(this)) >= chainLinkFee,
            "Not enough LINK - fill contract with faucet"
        );
        require(randomSeed == 0, 'Randomness has already been set');
        requestId = requestRandomness(keyHash, chainLinkFee);
    }

    
    function fulfillRandomness(bytes32 _requestId, uint256 _randomness)
        internal
        override
    {
        require(requestId == _requestId);
        randomSeed = _randomness;

        emit Reveal(_randomness);
    }

        function decodeTokenId(uint256 randomValue, uint256 _tokenId)
        public
        view
        returns (uint256[] memory)
    {
        require(randomValue != 0, "Tokens have not been revealed yet");

        uint256 tokenCode = uint256(
            keccak256(abi.encode(randomValue, _tokenId))
        );

        uint8[2] memory shifts = [ 0, 8 ];
        uint256[] memory tokenPart = new uint256[](shifts.length);

        for (uint256 i = 0; i < shifts.length; i++) {
            tokenPart[i] = (tokenCode >> shifts[i]) & BITMASK;
        }

        for (uint256 i = 0; i < tokenPart.length; i++) {
            uint256 currentIdx = 0;
            for (uint256 j = 0; j < cutoffs[i].length; j++) {
                if (tokenPart[i] < cutoffs[i][j]) {
                    currentIdx = j;
                    break;
                }
            }
            tokenPart[i] = currentIdx;
        }

        return tokenPart;
    }

       function getAttributeBytes(uint256 key, uint256 value)
        private
        view
        returns (bytes memory, bool attributePresent)
    {
        if (
            keccak256(abi.encodePacked(traitValues[key][value])) ==
            keccak256(abi.encodePacked("null"))
        ) {
            return ("", false);
        }
        return (
            abi.encodePacked(
                '{"trait_type": "',
                traits[key],
                '", "value": "',
                traitValues[key][value],
                '"}'
            ),
            true
        );
    }

    function getAttributes(uint256[] memory tokenPart)
        private
        view
        returns (string memory) {

        bytes memory attributes = '"attributes": [';
        bytes memory singleAtt;
        bool attPresent;

        (singleAtt, attPresent) = getAttributeBytes(0, tokenPart[0]);

        attributes = abi.encodePacked(attributes, singleAtt);

        for (uint256 i = 1; i < traits.length; i++) {
            (singleAtt, attPresent) = getAttributeBytes(i, tokenPart[i]);
            if (attPresent) {
                attributes = abi.encodePacked(attributes, ", ", singleAtt);
            }
        }

        return string(attributes);
    }

    function setRevealedCollectionBaseURL(string memory _ipfsHash) onlyOwner public {
        require(!frozen, 'Metadata has been frozen');
        revealedCollectionBaseURL = string(abi.encodePacked('ipfs://', _ipfsHash, '/'));
    }

    function freezeMetadata() onlyOwner public {
        frozen = true;
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        bytes memory tokenName = abi.encodePacked('Board ', Strings.toString(_tokenId));

        bytes memory content = abi.encodePacked('{"name":"', tokenName, '"');

        if (keccak256(abi.encodePacked(revealedCollectionBaseURL))  == keccak256(abi.encodePacked(''))) {
            content = abi.encodePacked(content, 
                ', ',
                '"description": "An unrevealed Ape Harbour Surfboard"',
                ', ',
                '"image": "', preRevealImageUrl, '"',
                '}');
        } else {
            uint256[] memory tokenParts = decodeTokenId(randomSeed, _tokenId);

            content = abi.encodePacked(content, 
                ', ', 
                getAttributes(tokenParts),
                '], ',
                '"image": "', revealedCollectionBaseURL, Strings.toString(_tokenId), '.png"',
                '}');
        }

        string memory result = string(
            abi.encodePacked(
                "data:application/json;base64,",
                Base64.encode(content)
            )
        );

        return result;
    }

}

File 19 of 19 : base64.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides a function for encoding some bytes in base64
library Base64 {
    string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

    function encode(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';
        
        // load the table into memory
        string memory table = TABLE;

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)
            
            // prepare the lookup table
            let tablePtr := add(table, 1)
            
            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))
            
            // result ptr, jump over length
            let resultPtr := add(result, 32)
            
            // run over the input, 3 bytes at a time
            for {} lt(dataPtr, endPtr) {}
            {
               dataPtr := add(dataPtr, 3)
               
               // read 3 bytes
               let input := mload(dataPtr)
               
               // write 4 characters
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(        input,  0x3F)))))
               resultPtr := add(resultPtr, 1)
            }
            
            // padding with '='
            switch mod(mload(data), 3)
            case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
            case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
        }
        
        return result;
    }
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_baycAddress","type":"address"},{"internalType":"address","name":"_bakcAddress","type":"address"},{"internalType":"address","name":"_ahdAddress","type":"address"},{"internalType":"address","name":"_linkAddress","type":"address"},{"internalType":"address","name":"_vrfCoordinatorAddress","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint256","name":"_chainLinkFee","type":"uint256"},{"internalType":"uint256","name":"_startMinting","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"_name","type":"string"}],"name":"NameChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"Reveal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"SetCollectionHash","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":"PRICE","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":[{"internalType":"uint256","name":"randomValue","type":"uint256"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"decodeTokenId","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"_tokenId","type":"uint256"}],"name":"getName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ape","type":"address"},{"internalType":"uint8","name":"_amount","type":"uint8"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealedCollectionBaseURL","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":"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":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_ipfsHash","type":"string"}],"name":"setRevealedCollectionBaseURL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

600a6102c090815269109858dad9dc9bdd5b9960b21b6102e05260e0908152600461030081815263121d5b1b60e21b61032052610100526103408181526313585cdd60e21b61036052610120526103808181526314d85a5b60e21b6103a0526101405260066103c09081526520b731b437b960d11b6103e05261016052600961040081815268115c5d5a5c1b595b9d60ba1b610420819052610180919091526104408281526104608290526101a05260086104809081526714da5919589bd85d60c21b6104a0526101c0526104c08281526104e08290526101e052610500828152610520829052610200526105408281526105608290526102205261058092835263466c616760e01b6105a052610240929092526105c09081526105e0919091526102605260056106008181526452616e676560d81b61062052610280526106806040526106409081526414dc19595960da1b610660526102a0526200016a90602b90600f62001689565b503480156200017857600080fd5b50604051620056c7380380620056c78339810160408190526200019b9162001af5565b604080518082018252601281527141706520486172626f75722059616368747360701b60208083019182528351808501909452600384526241485960e81b90840152815187938993929091620001f491600091620016ed565b5080516200020a906001906020840190620016ed565b5050506001600160601b0319606092831b811660a052911b1660805262000238620002323390565b62001637565b602e839055602f829055600e80546001600160a01b038a811661010002610100600160a81b031990921691909117909155600f80548983166001600160a01b031991821617909155601080549289169290911691909117905560c0818152604080519182018152601e82526051602083015260849082015260aa606082015260dd608082015260fe60a0820152620002d590601190600662001778565b506040805161010081018252603a81526062602082015260889181019190915260b8606082015260db608082015260ef60a082015260f960c082015260fb60e08201526200032890601290600862001778565b50604080516060810182526019815260cc602082015260ff918101919091526200035790601390600362001778565b50604080516101e08101825260198152603f6020820152605091810191909152605f606082015260736080820152609960a082015260a560c082015260b460e082015260c361010082015260cf61012082015260db61014082015260e261016082015260ec61018082015260f36101a082015260f86101c0820152620003e290601490600f62001778565b506040805160c08101825260338152604c6020820152607291810191909152608b606082015260d7608082015260fd60a08201526200042690601590600662001778565b506040805160c0810182526033815260596020820152608c9181019190915260b2606082015260cb608082015260fe60a08201526200046a90601690600662001778565b5060408051610160810182526019815260356020820152604691810191909152606c6060820152607d6080820152609660a082015260a760c082015260be60e082015260d761010082015260e861012082015260f9610140820152620004d590601790600b62001778565b506040805160608101825260cc815260dd602082015260fe918101919091526200050490601890600362001778565b50604080516101e0810182526019808252603060208301526047928201929092526058606082015260646080820152607560a0820152608460c0820152609060e0820152609a61010082015260a661012082015260bd61014082015260ce61016082015260df61018082015260eb6101a082015260f76101c08201526200058e9190600f62001778565b506040805180820190915260e6815260ff6020820152620005b490601a90600262001778565b506040805160808101825260268152608c602082015260d89181019190915260fe6060820152620005ea90601b90600462001778565b506040805161018081018252601981526037602082015260559181019190915260646060820152607d6080820152608c60a0820152609b60c082015260ac60e082015260bd61010082015260d461012082015260eb61014082015260fa6101608201526200065d90601c90600c62001778565b506040805161018081018252602881526037602082015260509181019190915260676060820152607e6080820152608f60a0820152609b60c082015260b460e082015260cb61010082015260dc61012082015260f361014082015260fa610160820152620006d090601d90600c62001778565b506040805161010081018252600960c08201908152684170656c616e74696360b81b60e0830152815281518083018352600a8082526942616e616e612042617960b01b6020808401919091528084019290925283518085018552601381527f45766572676c6164657320417065205061726b00000000000000000000000000818401528385015283518085018552600b81526a20b832902430b93137bab960a91b8184015260608401528351808501855290815269105c1948125cdb185b9960b21b8183015260808301528251808401909352600783526641706562697a6160c81b9083015260a0810191909152620007ce90601e90600662001820565b5060408051610140810182526007610100820181815266436c617373696360c81b61012084015282528251808401845260048082526350696e6b60e01b602080840191909152808501929092528451808601865260088152674d61686f67616e7960c01b818401528486015284518086018652600580825264149bde585b60da1b82850152606086019190915285518087018752600b81526a27b1b2b0b71023b932b2b760a91b8185015260808601528551808701875290815264149bd89bdd60da1b8184015260a0850152845180860186529081526311dbdb1960e21b8183015260c0840152835180850190945290835266111a585b5bdb9960ca1b9083015260e0810191909152601e6001620008eb92910190600862001872565b506040805160a081018252600460608201818152631b9d5b1b60e21b60808401528252825180840184528181526315dbdbd960e21b602080830191909152808401919091528351808501855291825263426f6e6560e01b82820152928201526200095891906003620018c4565b50604080516102208101825260046101e08201818152631b9d5b1b60e21b610200840152825282518084018452600d8082526c2832b73730b73a1021b430b4b760991b60208084019190915280850192909252845180860186528381526350696e6b60e01b818401528486015284518086018652600780825266436c617373696360c81b82850152606086019190915285518087018752600e81526d42616e616e61205069726174657360901b81850152608086015285518087018752600a815269213ab6311021b430b4b760b11b8185015260a08601528551808701875260058082526444656e696d60d81b8286015260c0870191909152865180880188529283526c5768697465205374726970657360981b8385015260e08601929092528551808701875290815266086d0cacae8c2d60cb1b8184015261010085015284518086018652600381526255534160e81b8184015261012085015284518086018652600881526746697265666c797360c01b818401526101408501528451808601865260068082526554726970707960d01b828501526101608601919091528551808701875290815265283934b9b7b760d11b81840152610180850152845180860186529081526450697a7a6160d81b818301526101a084015283518085019094529083526311dbdb1960e21b908301526101c081019190915262000b6290602190600f62001689565b506040805161010081018252600460c08201818152631b9d5b1b60e21b60e0840152825282518084018452600a815269149bde585b0811dbdb1960b21b6020808301919091528084019190915283518085018552600681526550697261746560d01b8183015283850152835180850185528281526311dbdb1960e21b818301526060840152835180850185526007815266436c617373696360c81b8183015260808401528351808501909452600584526414dd19595b60da1b9084015260a082019290925290601e9062000c3b92910190600662001820565b506040805161010081018252600460c08201908152631b9d5b1b60e21b60e0830152815281518083018352600f8082526e42616e616e612042616c6c6f6f6e7360881b60208084019190915280840192909252835180850185526011815270436f6c6f7266756c2042616c6c6f6f6e7360781b8184015283850152835180850185529081526e59656c6c6f772042616c6c6f6f6e7360881b81830152606083015282518084018452600d81526c50696e6b2042616c6c6f6f6e7360981b8183015260808301528251808401909352600b83526a20b832902130b63637b7b760a91b9083015260a081019190915262000d3890602390600662001820565b50604080516101a08101825260046101608201818152631b9d5b1b60e21b6101808401528252825180840184526009815268054696b69204c616d760bc1b6020808301919091528084019190915283518085018552600b8082526a576174657220536c69646560a81b828401528486019190915284518086018652600d81526c129d5b5c1a5b99c8109bd85c99609a1b818401526060850152845180860186528381526350616c6d60e01b818401526080850152845180860186528181526a42616e616e61205472656560a81b8184015260a0850152845180860186528181526a4375727665642050616c6d60a81b8184015260c0850152845180860186528381526308cd2e6d60e31b8184015260e0850152845180860186528181526a119a5cda1a5b99c814d95d60aa1b81840152610100850152845180860186529283526304c616d760e41b838301526101208401929092528351808501909452600a845269111a5cd8dbc810985b1b60b21b9084015261014082019290925262000ec3916024919062001916565b506040805160a081018252600460608201908152631b9d5b1b60e21b6080830152815281518083018352600b81526a10985b985b9848109bd85d60aa1b60208083019190915280830191909152825180840184526008815267466c616d696e676f60c01b918101919091529181019190915262000f45906025906003620018c4565b50604080516102208101825260046101e08201908152631b9d5b1b60e21b610200830152815281518083018352600880825267088944084dedee8d60c31b60208084019190915280840192909252835180850185526003808252622130b960e91b82850152848601919091528451808601865260078082526648616d6d6f636b60c81b8286015260608601919091528551808701875260098082526809ed8c84086deeac6d60bb1b82870152608087019190915286518088018852600f81526e46697368626f776c204c6f756e676560881b8187015260a087015286518088018852600c81526b088cacaeec2dc4086deeac6d60a31b8187015260c08701528651808801885260068152654a6163757a7960d01b8187015260e087015286518088018852918252662130ba343a3ab160c91b82860152610100860191909152855180870187529182526242425160e81b8285015261012085019190915284518086018652908152682232b1b5b1b430b4b960b91b81840152610140840152835180850185526005808252644472756d7360d81b8285015261016085019190915284518086018652600b81526a57696e65204c6f756e676560a81b8185015261018085015284518086018652600a8152692834bd3d309027bb32b760b11b818501526101a08501528451808601909552845264526164696f60d81b918401919091526101c082019290925290601e906200116392910190600f62001689565b50604080516080810182526004818301908152631b9d5b1b60e21b606083015281528151808301909252600682526510d85c9c195d60d21b602080840191909152810191909152620011ba90602790600262001968565b506040518060800160405280604051806040016040528060048152602001631b9d5b1b60e21b81525081526020016040518060400160405280600d81526020016c2832b73730b73a1021b430b4b760991b81525081526020016040518060400160405280600a815260200169213ab6311021b430b4b760b11b81525081526020016040518060400160405280600881526020016746697265666c797360c01b815250815250601e600a600e8111156200128357634e487b7160e01b600052602160045260246000fd5b600d8110620012a257634e487b7160e01b600052603260045260246000fd5b620012b2929101906004620019ba565b50604080516101c08101825260046101808201818152631b9d5b1b60e21b6101a0840152825282518084018452818152634170657360e01b602080830191909152808401919091528351808501855282815263466f6d6f60e01b818301528385015283518085018552828152634c6f666960e01b8183015260608401528351808501855282815263121bd91b60e21b81830152608084015283518085018552600a8152694f6e652042616e616e6160b01b8183015260a084015283518085018552600d81526c54687265652042616e616e617360981b8183015260c0840152835180850185526009815268111bd9d9dbc814995960ba1b8183015260e084015283518085018552600c8082526b446f67676f204f72616e676560a01b8284015261010085019190915284518086018652600e81526d42616e616e61205069726174657360901b818401526101208501528451808601865292835263105c195960e21b838301526101408401929092528351808501909452600b84526a54776f2042616e616e617360a81b9084015261016082019290925262001458916029919062001a0c565b50604080516101c08101825260046101808201818152631b9d5b1b60e21b6101a0840152825282518084018452600a808252694d6f6e656b792050617760b01b60208084019190915280850192909252845180860186526008815267436f636f6e75747360c01b818401528486015284518086018652928352632132b2b960e11b83830152606084019290925283518085018552601081526f426f786573206f66204f72616e67657360801b81830152608084015283518085018552600e8082526d426f78206f66204f72616e67657360901b8284015260a085019190915284518086018652600d81526c476f6c64656e2042616e616e6160981b8184015260c085015284518086018652600f81526e576869736b657920426f74746c657360881b8184015260e085015284518086018652600c8082526b42616e616e6120426f78657360a01b828501526101008601919091528551808701875293845269084c2dcc2dcc24084def60b31b84840152610120850193909352845180860186526006815265436f6666656560d01b81840152610140850152845180860190955284526d4469616d6f6e642042616e616e6160901b908401526101608201929092526200162891602a919062001a0c565b50505050505050505062001bbe565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db5782518051620016ca918491602090910190620016ed565b5091602001919060010190620016aa565b50620016e992915062001a5e565b5090565b828054620016fb9062001b81565b90600052602060002090601f0160209004810192826200171f57600085556200176a565b82601f106200173a57805160ff19168380011785556200176a565b828001600101855582156200176a579182015b828111156200176a5782518255916020019190600101906200174d565b50620016e992915062001a7f565b82805482825590600052602060002090601f016020900481019282156200176a5791602002820160005b83821115620017e257835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302620017a2565b8015620018115782816101000a81549060ff0219169055600101602081600001049283019260010302620017e2565b5050620016e992915062001a7f565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db578251805162001861918491602090910190620016ed565b509160200191906001019062001841565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db5782518051620018b3918491602090910190620016ed565b509160200191906001019062001893565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db578251805162001905918491602090910190620016ed565b5091602001919060010190620018e5565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db578251805162001957918491602090910190620016ed565b509160200191906001019062001937565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db5782518051620019a9918491602090910190620016ed565b509160200191906001019062001989565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db5782518051620019fb918491602090910190620016ed565b5091602001919060010190620019db565b828054828255906000526020600020908101928215620016db579160200282015b82811115620016db578251805162001a4d918491602090910190620016ed565b509160200191906001019062001a2d565b80821115620016e957600062001a75828262001a96565b5060010162001a5e565b5b80821115620016e9576000815560010162001a80565b50805462001aa49062001b81565b6000825580601f1062001ab5575050565b601f01602090049060005260206000209081019062001ad5919062001a7f565b50565b80516001600160a01b038116811462001af057600080fd5b919050565b600080600080600080600080610100898b03121562001b12578384fd5b62001b1d8962001ad8565b975062001b2d60208a0162001ad8565b965062001b3d60408a0162001ad8565b955062001b4d60608a0162001ad8565b945062001b5d60808a0162001ad8565b935060a0890151925060c0890151915060e089015190509295985092959890939650565b600181811c9082168062001b9657607f821691505b6020821081141562001bb857634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c051613ab762001c1060003960008181610f7b0152818161110d01526113770152600081816115f601526121d301526000818161178a01526121a40152613ab76000f3fe60806040526004361061017d5760003560e01c80626d6cae1461018257806301ffc9a7146101ab578063054f7d9c146101db57806306fdde03146101f5578063081812fc14610217578063095ea7b3146102445780630b747d911461026657806318160ddd1461027c578063202aeca71461029157806323b872dd146102b15780632f745c59146102d1578063342f01a7146102f15780633ccfd60b1461031e57806342842e0e146103335780634f6ccce7146103535780636352211e14610373578063691562a0146103935780636b8ff574146103a657806370a08231146103c6578063715018a6146103e65780638d859f3e146103fb5780638da5cb5b1461041657806394985ddd1461042b57806395d89b411461044b578063a22cb46514610460578063a475b5dd14610480578063b88d4fde14610495578063c87b56dd146104b5578063d111515d146104d5578063dfb43c4c146104ea578063e985e9c5146104ff578063f2fde38b1461051f578063fe55932a1461053f575b600080fd5b34801561018e57600080fd5b5061019860305481565b6040519081526020015b60405180910390f35b3480156101b757600080fd5b506101cb6101c6366004613109565b61055f565b60405190151581526020016101a2565b3480156101e757600080fd5b50600e546101cb9060ff1681565b34801561020157600080fd5b5061020a61058a565b6040516101a2919061374c565b34801561022357600080fd5b50610237610232366004613173565b61061c565b6040516101a29190613690565b34801561025057600080fd5b5061026461025f366004613073565b6106a9565b005b34801561027257600080fd5b50610198602d5481565b34801561028857600080fd5b50600854610198565b34801561029d57600080fd5b506102646102ac366004613141565b6107ba565b3480156102bd57600080fd5b506102646102cc366004612f8a565b6108a7565b3480156102dd57600080fd5b506101986102ec366004613073565b6108d8565b3480156102fd57600080fd5b5061031161030c3660046130e8565b61096e565b6040516101a29190613708565b34801561032a57600080fd5b50610264610de4565b34801561033f57600080fd5b5061026461034e366004612f8a565b610e44565b34801561035f57600080fd5b5061019861036e366004613173565b610e5f565b34801561037f57600080fd5b5061023761038e366004613173565b610f00565b6101986103a136600461309c565b610f77565b3480156103b257600080fd5b5061020a6103c1366004613173565b611478565b3480156103d257600080fd5b506101986103e1366004612f3e565b61151a565b3480156103f257600080fd5b506102646115a1565b34801561040757600080fd5b5061019866f8b0a10e47000081565b34801561042257600080fd5b506102376115dc565b34801561043757600080fd5b506102646104463660046130e8565b6115eb565b34801561045757600080fd5b5061020a611671565b34801561046c57600080fd5b5061026461047b36600461303d565b611680565b34801561048c57600080fd5b50610264611741565b3480156104a157600080fd5b506102646104b0366004612fc5565b6118a4565b3480156104c157600080fd5b5061020a6104d0366004613173565b6118dc565b3480156104e157600080fd5b50610264611afe565b3480156104f657600080fd5b5061020a611b3c565b34801561050b57600080fd5b506101cb61051a366004612f58565b611bca565b34801561052b57600080fd5b5061026461053a366004612f3e565b611bf8565b34801561054b57600080fd5b5061020a61055a3660046131a3565b611c98565b60006001600160e01b0319821663780e9d6360e01b1480610584575061058482611d56565b92915050565b606060008054610599906138fc565b80601f01602080910402602001604051908101604052809291908181526020018280546105c5906138fc565b80156106125780601f106105e757610100808354040283529160200191610612565b820191906000526020600020905b8154815290600101906020018083116105f557829003601f168201915b5050505050905090565b600061062782611da6565b61068d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106b482610f00565b9050806001600160a01b0316836001600160a01b031614156107225760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610684565b336001600160a01b038216148061073e575061073e8133611bca565b6107ab5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610684565b6107b58383611dc3565b505050565b336107c36115dc565b6001600160a01b0316146107e95760405162461bcd60e51b8152600401610684906137e8565b600e5460ff16156108375760405162461bcd60e51b815260206004820152601860248201527726b2ba30b230ba30903430b9903132b2b710333937bd32b760411b6044820152606401610684565b8060405160200161084891906135e3565b604051602081830303815290604052600d908051906020019061086c929190612dee565b507f5ab834b5070c988c9727e56c4cf724085b72e716ad1dca78a193d7559e07d18c8160405161089c919061374c565b60405180910390a150565b6108b13382611e31565b6108cd5760405162461bcd60e51b81526004016106849061381d565b6107b5838383611efb565b60006108e38361151a565b82106109455760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610684565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6060826109c75760405162461bcd60e51b815260206004820152602160248201527f546f6b656e732068617665206e6f74206265656e2072657665616c65642079656044820152601d60fa1b6064820152608401610684565b604080516020810185905290810183905260009060600160408051808303601f1901815282825280516020918201206101e084018352600080855260088386015260108585015260186060808701919091526080860193909352602860a0860152603060c0860152603860e0860152610100850184905260486101208601526050610140860152605861016086015261018085019290925260686101a085015260706101c08501528251600f8082526102008201909452909450909181602001602082028036833701905050905060005b600f811015610b0c5760ff8382600f8110610ac357634e487b7160e01b600052603260045260246000fd5b602002015160ff1685901c16828281518110610aef57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610b0481613937565b915050610a98565b5060005b60028251610b1e91906138b9565b811015610c3f576000805b601183600d8110610b4a57634e487b7160e01b600052603260045260246000fd5b0154811015610bff57601183600d8110610b7457634e487b7160e01b600052603260045260246000fd5b018181548110610b9457634e487b7160e01b600052603260045260246000fd5b90600052602060002090602091828204019190069054906101000a900460ff1660ff16848481518110610bd757634e487b7160e01b600052603260045260246000fd5b60200260200101511015610bed57809150610bff565b80610bf781613937565b915050610b29565b5080838381518110610c2157634e487b7160e01b600052603260045260246000fd5b60209081029190910101525080610c3781613937565b915050610b10565b50600081600281518110610c6357634e487b7160e01b600052603260045260246000fd5b602002602001015160001490508015610d0257600082600381518110610c9957634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600082600a81518110610cc757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600082600b81518110610cf557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b606482600d81518110610d2557634e487b7160e01b600052603260045260246000fd5b6020026020010151610d379190613972565b610d4290600161386e565b82600d81518110610d6357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152606382600e81518110610d9157634e487b7160e01b600052603260045260246000fd5b6020026020010151610da39190613972565b610dae90600161386e565b82600e81518110610dcf57634e487b7160e01b600052603260045260246000fd5b60209081029190910101525095945050505050565b33610ded6115dc565b6001600160a01b031614610e135760405162461bcd60e51b8152600401610684906137e8565b60405147903390819083156108fc029084906000818181858888f193505050501580156107b5573d6000803e3d6000fd5b6107b5838383604051806020016040528060008152506118a4565b6000610e6a60085490565b8210610ecd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610684565b60088281548110610eee57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806105845760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610684565b60007f0000000000000000000000000000000000000000000000000000000000000000421015610fe35760405162461bcd60e51b8152602060048201526017602482015276135a5b9d1a5b99c81a185cc81b9bdd081cdd185c9d1959604a1b6044820152606401610684565b60148260ff1611156110495760405162461bcd60e51b815260206004820152602960248201527f596f752063616e206f6e6c79206d696e7420757020746f20323020746f6b656e60448201526873206174206f6e636560b81b6064820152608401610684565b61105d60ff831666f8b0a10e47000061389a565b3410156110a15760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610684565b611e616110ad60085490565b6110ba9060ff851661386e565b11156111085760405162461bcd60e51b815260206004820152601d60248201527f5265717565737420657865656473206d6178696d756d20737570706c790000006044820152606401610684565b6111347f000000000000000000000000000000000000000000000000000000000000000061546061386e565b42101561120157600e546040516370a0823160e01b815260009161010090046001600160a01b0316906370a0823190611171903390600401613690565b60206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c1919061318b565b116112015760405162461bcd60e51b815260206004820152601060248201526f139bc8185c194b081b9bc81e5858da1d60821b6044820152606401610684565b600f546040516370a0823160e01b815260009182916001600160a01b03909116906370a0823190611236903390600401613690565b60206040518083038186803b15801561124e57600080fd5b505afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611286919061318b565b600e546040516370a0823160e01b8152929091119250600091829161010090046001600160a01b0316906370a08231906112c4903390600401613690565b60206040518083038186803b1580156112dc57600080fd5b505afa1580156112f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611314919061318b565b11905060005b8460ff168160ff16101561136057611336600c80546001019055565b6000611341600c5490565b905061134d8782612094565b508061135881613952565b91505061131a565b5080801561136b5750815b80156113a1575061139e7f000000000000000000000000000000000000000000000000000000000000000061a8c061386e565b42105b1561142a576010546040516335313c2160e11b81526001600160a01b0390911690636a627842906113d6908890600401613690565b602060405180830381600087803b1580156113f057600080fd5b505af1158015611404573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611428919061318b565b505b60405160ff851681526001600160a01b038616907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859060200160405180910390a2600c545b95945050505050565b6000818152602c60205260409020805460609190611495906138fc565b80601f01602080910402602001604051908101604052809291908181526020018280546114c1906138fc565b801561150e5780601f106114e35761010080835404028352916020019161150e565b820191906000526020600020905b8154815290600101906020018083116114f157829003601f168201915b50505050509050919050565b60006001600160a01b0382166115855760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610684565b506001600160a01b031660009081526003602052604090205490565b336115aa6115dc565b6001600160a01b0316146115d05760405162461bcd60e51b8152600401610684906137e8565b6115da60006120ae565b565b600b546001600160a01b031690565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116635760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610684565b61166d8282612100565b5050565b606060018054610599906138fc565b6001600160a01b0382163314156116d55760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610684565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3361174a6115dc565b6001600160a01b0316146117705760405162461bcd60e51b8152600401610684906137e8565b602f546040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906117bf903090600401613690565b60206040518083038186803b1580156117d757600080fd5b505afa1580156117eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180f919061318b565b10156118715760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610684565b602d54156118915760405162461bcd60e51b81526004016106849061375f565b61189f602e54602f546121a0565b603055565b6118ae3383611e31565b6118ca5760405162461bcd60e51b81526004016106849061381d565b6118d68484848461232b565b50505050565b6000818152602c60205260408120805460609291906118fa906138fc565b80601f0160208091040260200160405190810160405280929190818152602001828054611926906138fc565b80156119735780601f1061194857610100808354040283529160200191611973565b820191906000526020600020905b81548152906001019060200180831161195657829003601f168201915b50506040805160008152602081018083528151902095965061199b94508693500190506134c1565b6040516020818303038152906040528051906020012014156119e2576119c08361235e565b6040516020016119d09190613662565b60405160208183030381529060405290505b6000816040516020016119f591906135a6565b60408051601f1981840301815260008352602083018083528351902090935091611a2291600d91016134dd565b604051602081830303815290604052805190602001201415611a7f5780604051806060016040528060358152602001613a2d60359139604051602001611a69929190613412565b6040516020818303038152906040529050611aca565b6000611a8d602d548661096e565b905081611a9982612477565b600d611aa48861235e565b604051602001611ab79493929190613380565b6040516020818303038152906040529150505b6000611ad5826125da565b604051602001611ae5919061361d565b60408051601f1981840301815291905295945050505050565b33611b076115dc565b6001600160a01b031614611b2d5760405162461bcd60e51b8152600401610684906137e8565b600e805460ff19166001179055565b600d8054611b49906138fc565b80601f0160208091040260200160405190810160405280929190818152602001828054611b75906138fc565b8015611bc25780601f10611b9757610100808354040283529160200191611bc2565b820191906000526020600020905b815481529060010190602001808311611ba557829003601f168201915b505050505081565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b33611c016115dc565b6001600160a01b031614611c275760405162461bcd60e51b8152600401610684906137e8565b6001600160a01b038116611c8c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610684565b611c95816120ae565b50565b606033611ca484610f00565b6001600160a01b031614611cf85760405162461bcd60e51b815260206004820152601b60248201527a13db9b1e48189bd85d081bdddb995c8818d85b881b985b59481a5d602a1b6044820152606401610684565b6000838152602c602090815260409091208351611d1792850190612dee565b50827f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b83604051611d48919061374c565b60405180910390a250919050565b60006001600160e01b031982166380ac58cd60e01b1480611d8757506001600160e01b03198216635b5e139f60e01b145b8061058457506301ffc9a760e01b6001600160e01b0319831614610584565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611df882610f00565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e3c82611da6565b611e9d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610684565b6000611ea883610f00565b9050806001600160a01b0316846001600160a01b03161480611ee35750836001600160a01b0316611ed88461061c565b6001600160a01b0316145b80611ef35750611ef38185611bca565b949350505050565b826001600160a01b0316611f0e82610f00565b6001600160a01b031614611f765760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610684565b6001600160a01b038216611fd85760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610684565b611fe383838361274f565b611fee600082611dc3565b6001600160a01b03831660009081526003602052604081208054600192906120179084906138b9565b90915550506001600160a01b038216600090815260036020526040812080546001929061204590849061386e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020613a6283398151915291a4505050565b61166d828260405180602001604052806000815250612807565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b81603054146121445760405162461bcd60e51b815260206004820152601060248201526f15dc9bdb99c81c995c5d595cdd08125960821b6044820152606401610684565b602d54156121645760405162461bcd60e51b81526004016106849061375f565b602d8190556040518181527f1747b48b6ade85d7dc97c0f523e0e780795930a468c01b18a51546791fdd3ac09060200160405180910390a15050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001612210929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161223d939291906136e1565b602060405180830381600087803b15801561225757600080fd5b505af115801561226b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228f91906130cc565b506000838152600a6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526122eb90600161386e565b6000858152600a6020526040902055611ef38482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b612336848484611efb565b6123428484848461283a565b6118d65760405162461bcd60e51b815260040161068490613796565b6060816123825750506040805180820190915260018152600360fc1b602082015290565b8160005b81156123ac578061239681613937565b91506123a59050600a83613886565b9150612386565b6000816001600160401b038111156123d457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156123fe576020820181803683370190505b5090505b8415611ef3576124136001836138b9565b9150612420600a86613972565b61242b90603061386e565b60f81b81838151811061244e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612470600a86613886565b9450612402565b606060006040518060400160405280600f81526020016e2261747472696275746573223a205b60881b8152509050606060006124dc6000866000815181106124cf57634e487b7160e01b600052603260045260246000fd5b6020026020010151612944565b60405191935091506124f490849084906020016132ab565b60408051601f19818403018152919052925060015b602b54612518906002906138b9565b81101561258557612543818783815181106124cf57634e487b7160e01b600052603260045260246000fd5b909350915081156125735783836040516020016125619291906132da565b60405160208183030381529060405293505b8061257d81613937565b915050612509565b50826125bb600e87600e5b815181106125ae57634e487b7160e01b600052603260045260246000fd5b6020026020010151612aaa565b6125c8600d88600d612590565b604051602001611ae593929190613317565b60608151600014156125fa57505060408051602081019091526000815290565b60006040518060600160405280604081526020016139ed6040913990506000600384516002612629919061386e565b6126339190613886565b61263e90600461389a565b9050600061264d82602061386e565b6001600160401b0381111561267257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561269c576020820181803683370190505b509050818152600183018586518101602084015b8183101561270a5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016126b0565b600389510660018114612724576002811461273557612741565b613d3d60f01b600119830152612741565b603d60f81b6000198301525b509398975050505050505050565b6001600160a01b0383166127aa576127a581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6127cd565b816001600160a01b0316836001600160a01b0316146127cd576127cd8382612b08565b6001600160a01b0382166127e4576107b581612ba5565b826001600160a01b0316826001600160a01b0316146107b5576107b58282612c7e565b6128118383612cc2565b61281e600084848461283a565b6107b55760405162461bcd60e51b815260040161068490613796565b60006001600160a01b0384163b1561293c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061287e9033908990889088906004016136a4565b602060405180830381600087803b15801561289857600080fd5b505af19250505080156128c8575060408051601f3d908101601f191682019092526128c591810190613125565b60015b612922573d8080156128f6576040519150601f19603f3d011682016040523d82523d6000602084013e6128fb565b606091505b50805161291a5760405162461bcd60e51b815260040161068490613796565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ef3565b506001611ef3565b6060600060405160200161296290631b9d5b1b60e21b815260040190565b60405160208183030381529060405280519060200120601e85600d811061299957634e487b7160e01b600052603260045260246000fd5b0184815481106129b957634e487b7160e01b600052603260045260246000fd5b906000526020600020016040516020016129d391906134dd565b604051602081830303815290604052805190602001201415612a0657505060408051602081019091526000808252612aa3565b602b8481548110612a2757634e487b7160e01b600052603260045260246000fd5b90600052602060002001601e85600d8110612a5257634e487b7160e01b600052603260045260246000fd5b018481548110612a7257634e487b7160e01b600052603260045260246000fd5b90600052602060002001604051602001612a8d9291906134e9565b6040516020818303038152906040526001915091505b9250929050565b6060602b8381548110612acd57634e487b7160e01b600052603260045260246000fd5b90600052602060002001612ae08361235e565b604051602001612af1929190613542565b604051602081830303815290604052905092915050565b60006001612b158461151a565b612b1f91906138b9565b600083815260076020526040902054909150808214612b72576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612bb7906001906138b9565b60008381526009602052604081205460088054939450909284908110612bed57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612c1c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612c6257634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612c898361151a565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216612d185760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610684565b612d2181611da6565b15612d6d5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610684565b612d796000838361274f565b6001600160a01b0382166000908152600360205260408120805460019290612da290849061386e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020613a62833981519152908290a45050565b828054612dfa906138fc565b90600052602060002090601f016020900481019282612e1c5760008555612e62565b82601f10612e3557805160ff1916838001178555612e62565b82800160010185558215612e62579182015b82811115612e62578251825591602001919060010190612e47565b50612e6e929150612e72565b5090565b5b80821115612e6e5760008155600101612e73565b60006001600160401b0380841115612ea157612ea16139b2565b604051601f8501601f19908116603f01168101908282118183101715612ec957612ec96139b2565b81604052809350858152868686011115612ee257600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114612f1357600080fd5b919050565b600082601f830112612f28578081fd5b612f3783833560208501612e87565b9392505050565b600060208284031215612f4f578081fd5b612f3782612efc565b60008060408385031215612f6a578081fd5b612f7383612efc565b9150612f8160208401612efc565b90509250929050565b600080600060608486031215612f9e578081fd5b612fa784612efc565b9250612fb560208501612efc565b9150604084013590509250925092565b60008060008060808587031215612fda578081fd5b612fe385612efc565b9350612ff160208601612efc565b92506040850135915060608501356001600160401b03811115613012578182fd5b8501601f81018713613022578182fd5b61303187823560208401612e87565b91505092959194509250565b6000806040838503121561304f578182fd5b61305883612efc565b91506020830135613068816139c8565b809150509250929050565b60008060408385031215613085578182fd5b61308e83612efc565b946020939093013593505050565b600080604083850312156130ae578182fd5b6130b783612efc565b9150602083013560ff81168114613068578182fd5b6000602082840312156130dd578081fd5b8151612f37816139c8565b600080604083850312156130fa578182fd5b50508035926020909101359150565b60006020828403121561311a578081fd5b8135612f37816139d6565b600060208284031215613136578081fd5b8151612f37816139d6565b600060208284031215613152578081fd5b81356001600160401b03811115613167578182fd5b611ef384828501612f18565b600060208284031215613184578081fd5b5035919050565b60006020828403121561319c578081fd5b5051919050565b600080604083850312156131b5578182fd5b8235915060208301356001600160401b038111156131d1578182fd5b6131dd85828601612f18565b9150509250929050565b600081518084526131ff8160208601602086016138d0565b601f01601f19169290920160200192915050565b8054600090600181811c908083168061322d57607f831692505b602080841082141561324d57634e487b7160e01b86526022600452602486fd5b81801561326157600181146132725761329f565b60ff1986168952848901965061329f565b60008881526020902060005b868110156132975781548b82015290850190830161327e565b505084890196505b50505050505092915050565b600083516132bd8184602088016138d0565b8351908301906132d18183602088016138d0565b01949350505050565b600083516132ec8184602088016138d0565b61016160f51b908301908152835161330b8160028401602088016138d0565b01600201949350505050565b600084516133298184602089016138d0565b808301905061016160f51b808252855161334a816002850160208a016138d0565b600292019182015283516133658160048401602088016138d0565b605d60f81b6004929091019182015260050195945050505050565b60008551613392818460208a016138d0565b808301905061016160f51b80825286516133b3816002850160208b016138d0565b6002920191820152691134b6b0b3b2911d101160b11b60048201526133db600e820186613213565b905083516133ed8183602088016138d0565b64173837339160d91b9101908152607d60f81b60058201526006019695505050505050565b600083516134248184602088016138d0565b61016160f51b9083018181527f226465736372697074696f6e223a2022416e20756e72657665616c656420417060028201526f32902430b93137bab9102cb0b1b43a1160811b60228201526032810191909152691134b6b0b3b2911d101160b11b6034820152835161349d81603e8401602088016138d0565b601160f91b603e9290910191820152607d60f81b603f820152604001949350505050565b600082516134d38184602087016138d0565b9190910192915050565b6000612f378284613213565b6f3d913a3930b4ba2fba3cb832911d101160811b8152600061350e6010830185613213565b6c111610113b30b63ab2911d101160991b815261352e600d820185613213565b61227d60f01b815260020195945050505050565b6f3d913a3930b4ba2fba3cb832911d101160811b815260006135676010830185613213565b6b0111610113b30b63ab2911d160a51b8152835161358c81600c8401602088016138d0565b607d60f81b600c9290910191820152600d01949350505050565b683d913730b6b2911d1160b91b815281516000906135cb8160098501602087016138d0565b601160f91b6009939091019283015250600a01919050565b66697066733a2f2f60c81b8152600082516136058160078501602087016138d0565b602f60f81b6007939091019283015250600801919050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161365581601d8501602087016138d0565b91909101601d0192915050565b6502cb0b1b43a160d51b8152600082516136838160068501602087016138d0565b9190910160060192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906136d7908301846131e7565b9695505050505050565b60018060a01b038416815282602082015260606040820152600061146f60608301846131e7565b6020808252825182820181905260009190848201906040850190845b8181101561374057835183529284019291840191600101613724565b50909695505050505050565b602081526000612f3760208301846131e7565b6020808252601f908201527f72616e646f6d536565642068617320616c7265616479206265656e2073657400604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561388157613881613986565b500190565b6000826138955761389561399c565b500490565b60008160001904831182151516156138b4576138b4613986565b500290565b6000828210156138cb576138cb613986565b500390565b60005b838110156138eb5781810151838201526020016138d3565b838111156118d65750506000910152565b600181811c9082168061391057607f821691505b6020821081141561393157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561394b5761394b613986565b5060010190565b600060ff821660ff81141561396957613969613986565b60010192915050565b6000826139815761398161399c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611c9557600080fd5b6001600160e01b031981168114611c9557600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f697066733a2f2f516d577433704265476d544567355255356a3832586f456a477561443736374c6642464a35673836696363435837ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207568886212533111f6cbb761151fde5684345de56dbeee74b8635ed561cbd3ee64736f6c63430008040033000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf95623000000000000000000000000d4b61ef46ad352ea6b8846180c4fdd59f36056a1000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000060fd8a80

Deployed Bytecode

0x60806040526004361061017d5760003560e01c80626d6cae1461018257806301ffc9a7146101ab578063054f7d9c146101db57806306fdde03146101f5578063081812fc14610217578063095ea7b3146102445780630b747d911461026657806318160ddd1461027c578063202aeca71461029157806323b872dd146102b15780632f745c59146102d1578063342f01a7146102f15780633ccfd60b1461031e57806342842e0e146103335780634f6ccce7146103535780636352211e14610373578063691562a0146103935780636b8ff574146103a657806370a08231146103c6578063715018a6146103e65780638d859f3e146103fb5780638da5cb5b1461041657806394985ddd1461042b57806395d89b411461044b578063a22cb46514610460578063a475b5dd14610480578063b88d4fde14610495578063c87b56dd146104b5578063d111515d146104d5578063dfb43c4c146104ea578063e985e9c5146104ff578063f2fde38b1461051f578063fe55932a1461053f575b600080fd5b34801561018e57600080fd5b5061019860305481565b6040519081526020015b60405180910390f35b3480156101b757600080fd5b506101cb6101c6366004613109565b61055f565b60405190151581526020016101a2565b3480156101e757600080fd5b50600e546101cb9060ff1681565b34801561020157600080fd5b5061020a61058a565b6040516101a2919061374c565b34801561022357600080fd5b50610237610232366004613173565b61061c565b6040516101a29190613690565b34801561025057600080fd5b5061026461025f366004613073565b6106a9565b005b34801561027257600080fd5b50610198602d5481565b34801561028857600080fd5b50600854610198565b34801561029d57600080fd5b506102646102ac366004613141565b6107ba565b3480156102bd57600080fd5b506102646102cc366004612f8a565b6108a7565b3480156102dd57600080fd5b506101986102ec366004613073565b6108d8565b3480156102fd57600080fd5b5061031161030c3660046130e8565b61096e565b6040516101a29190613708565b34801561032a57600080fd5b50610264610de4565b34801561033f57600080fd5b5061026461034e366004612f8a565b610e44565b34801561035f57600080fd5b5061019861036e366004613173565b610e5f565b34801561037f57600080fd5b5061023761038e366004613173565b610f00565b6101986103a136600461309c565b610f77565b3480156103b257600080fd5b5061020a6103c1366004613173565b611478565b3480156103d257600080fd5b506101986103e1366004612f3e565b61151a565b3480156103f257600080fd5b506102646115a1565b34801561040757600080fd5b5061019866f8b0a10e47000081565b34801561042257600080fd5b506102376115dc565b34801561043757600080fd5b506102646104463660046130e8565b6115eb565b34801561045757600080fd5b5061020a611671565b34801561046c57600080fd5b5061026461047b36600461303d565b611680565b34801561048c57600080fd5b50610264611741565b3480156104a157600080fd5b506102646104b0366004612fc5565b6118a4565b3480156104c157600080fd5b5061020a6104d0366004613173565b6118dc565b3480156104e157600080fd5b50610264611afe565b3480156104f657600080fd5b5061020a611b3c565b34801561050b57600080fd5b506101cb61051a366004612f58565b611bca565b34801561052b57600080fd5b5061026461053a366004612f3e565b611bf8565b34801561054b57600080fd5b5061020a61055a3660046131a3565b611c98565b60006001600160e01b0319821663780e9d6360e01b1480610584575061058482611d56565b92915050565b606060008054610599906138fc565b80601f01602080910402602001604051908101604052809291908181526020018280546105c5906138fc565b80156106125780601f106105e757610100808354040283529160200191610612565b820191906000526020600020905b8154815290600101906020018083116105f557829003601f168201915b5050505050905090565b600061062782611da6565b61068d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106b482610f00565b9050806001600160a01b0316836001600160a01b031614156107225760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610684565b336001600160a01b038216148061073e575061073e8133611bca565b6107ab5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610684565b6107b58383611dc3565b505050565b336107c36115dc565b6001600160a01b0316146107e95760405162461bcd60e51b8152600401610684906137e8565b600e5460ff16156108375760405162461bcd60e51b815260206004820152601860248201527726b2ba30b230ba30903430b9903132b2b710333937bd32b760411b6044820152606401610684565b8060405160200161084891906135e3565b604051602081830303815290604052600d908051906020019061086c929190612dee565b507f5ab834b5070c988c9727e56c4cf724085b72e716ad1dca78a193d7559e07d18c8160405161089c919061374c565b60405180910390a150565b6108b13382611e31565b6108cd5760405162461bcd60e51b81526004016106849061381d565b6107b5838383611efb565b60006108e38361151a565b82106109455760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610684565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6060826109c75760405162461bcd60e51b815260206004820152602160248201527f546f6b656e732068617665206e6f74206265656e2072657665616c65642079656044820152601d60fa1b6064820152608401610684565b604080516020810185905290810183905260009060600160408051808303601f1901815282825280516020918201206101e084018352600080855260088386015260108585015260186060808701919091526080860193909352602860a0860152603060c0860152603860e0860152610100850184905260486101208601526050610140860152605861016086015261018085019290925260686101a085015260706101c08501528251600f8082526102008201909452909450909181602001602082028036833701905050905060005b600f811015610b0c5760ff8382600f8110610ac357634e487b7160e01b600052603260045260246000fd5b602002015160ff1685901c16828281518110610aef57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610b0481613937565b915050610a98565b5060005b60028251610b1e91906138b9565b811015610c3f576000805b601183600d8110610b4a57634e487b7160e01b600052603260045260246000fd5b0154811015610bff57601183600d8110610b7457634e487b7160e01b600052603260045260246000fd5b018181548110610b9457634e487b7160e01b600052603260045260246000fd5b90600052602060002090602091828204019190069054906101000a900460ff1660ff16848481518110610bd757634e487b7160e01b600052603260045260246000fd5b60200260200101511015610bed57809150610bff565b80610bf781613937565b915050610b29565b5080838381518110610c2157634e487b7160e01b600052603260045260246000fd5b60209081029190910101525080610c3781613937565b915050610b10565b50600081600281518110610c6357634e487b7160e01b600052603260045260246000fd5b602002602001015160001490508015610d0257600082600381518110610c9957634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600082600a81518110610cc757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600082600b81518110610cf557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b606482600d81518110610d2557634e487b7160e01b600052603260045260246000fd5b6020026020010151610d379190613972565b610d4290600161386e565b82600d81518110610d6357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152606382600e81518110610d9157634e487b7160e01b600052603260045260246000fd5b6020026020010151610da39190613972565b610dae90600161386e565b82600e81518110610dcf57634e487b7160e01b600052603260045260246000fd5b60209081029190910101525095945050505050565b33610ded6115dc565b6001600160a01b031614610e135760405162461bcd60e51b8152600401610684906137e8565b60405147903390819083156108fc029084906000818181858888f193505050501580156107b5573d6000803e3d6000fd5b6107b5838383604051806020016040528060008152506118a4565b6000610e6a60085490565b8210610ecd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610684565b60088281548110610eee57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806105845760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610684565b60007f0000000000000000000000000000000000000000000000000000000060fd8a80421015610fe35760405162461bcd60e51b8152602060048201526017602482015276135a5b9d1a5b99c81a185cc81b9bdd081cdd185c9d1959604a1b6044820152606401610684565b60148260ff1611156110495760405162461bcd60e51b815260206004820152602960248201527f596f752063616e206f6e6c79206d696e7420757020746f20323020746f6b656e60448201526873206174206f6e636560b81b6064820152608401610684565b61105d60ff831666f8b0a10e47000061389a565b3410156110a15760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610684565b611e616110ad60085490565b6110ba9060ff851661386e565b11156111085760405162461bcd60e51b815260206004820152601d60248201527f5265717565737420657865656473206d6178696d756d20737570706c790000006044820152606401610684565b6111347f0000000000000000000000000000000000000000000000000000000060fd8a8061546061386e565b42101561120157600e546040516370a0823160e01b815260009161010090046001600160a01b0316906370a0823190611171903390600401613690565b60206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c1919061318b565b116112015760405162461bcd60e51b815260206004820152601060248201526f139bc8185c194b081b9bc81e5858da1d60821b6044820152606401610684565b600f546040516370a0823160e01b815260009182916001600160a01b03909116906370a0823190611236903390600401613690565b60206040518083038186803b15801561124e57600080fd5b505afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611286919061318b565b600e546040516370a0823160e01b8152929091119250600091829161010090046001600160a01b0316906370a08231906112c4903390600401613690565b60206040518083038186803b1580156112dc57600080fd5b505afa1580156112f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611314919061318b565b11905060005b8460ff168160ff16101561136057611336600c80546001019055565b6000611341600c5490565b905061134d8782612094565b508061135881613952565b91505061131a565b5080801561136b5750815b80156113a1575061139e7f0000000000000000000000000000000000000000000000000000000060fd8a8061a8c061386e565b42105b1561142a576010546040516335313c2160e11b81526001600160a01b0390911690636a627842906113d6908890600401613690565b602060405180830381600087803b1580156113f057600080fd5b505af1158015611404573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611428919061318b565b505b60405160ff851681526001600160a01b038616907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859060200160405180910390a2600c545b95945050505050565b6000818152602c60205260409020805460609190611495906138fc565b80601f01602080910402602001604051908101604052809291908181526020018280546114c1906138fc565b801561150e5780601f106114e35761010080835404028352916020019161150e565b820191906000526020600020905b8154815290600101906020018083116114f157829003601f168201915b50505050509050919050565b60006001600160a01b0382166115855760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610684565b506001600160a01b031660009081526003602052604090205490565b336115aa6115dc565b6001600160a01b0316146115d05760405162461bcd60e51b8152600401610684906137e8565b6115da60006120ae565b565b600b546001600160a01b031690565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146116635760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610684565b61166d8282612100565b5050565b606060018054610599906138fc565b6001600160a01b0382163314156116d55760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610684565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3361174a6115dc565b6001600160a01b0316146117705760405162461bcd60e51b8152600401610684906137e8565b602f546040516370a0823160e01b81526001600160a01b037f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca16906370a08231906117bf903090600401613690565b60206040518083038186803b1580156117d757600080fd5b505afa1580156117eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180f919061318b565b10156118715760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610684565b602d54156118915760405162461bcd60e51b81526004016106849061375f565b61189f602e54602f546121a0565b603055565b6118ae3383611e31565b6118ca5760405162461bcd60e51b81526004016106849061381d565b6118d68484848461232b565b50505050565b6000818152602c60205260408120805460609291906118fa906138fc565b80601f0160208091040260200160405190810160405280929190818152602001828054611926906138fc565b80156119735780601f1061194857610100808354040283529160200191611973565b820191906000526020600020905b81548152906001019060200180831161195657829003601f168201915b50506040805160008152602081018083528151902095965061199b94508693500190506134c1565b6040516020818303038152906040528051906020012014156119e2576119c08361235e565b6040516020016119d09190613662565b60405160208183030381529060405290505b6000816040516020016119f591906135a6565b60408051601f1981840301815260008352602083018083528351902090935091611a2291600d91016134dd565b604051602081830303815290604052805190602001201415611a7f5780604051806060016040528060358152602001613a2d60359139604051602001611a69929190613412565b6040516020818303038152906040529050611aca565b6000611a8d602d548661096e565b905081611a9982612477565b600d611aa48861235e565b604051602001611ab79493929190613380565b6040516020818303038152906040529150505b6000611ad5826125da565b604051602001611ae5919061361d565b60408051601f1981840301815291905295945050505050565b33611b076115dc565b6001600160a01b031614611b2d5760405162461bcd60e51b8152600401610684906137e8565b600e805460ff19166001179055565b600d8054611b49906138fc565b80601f0160208091040260200160405190810160405280929190818152602001828054611b75906138fc565b8015611bc25780601f10611b9757610100808354040283529160200191611bc2565b820191906000526020600020905b815481529060010190602001808311611ba557829003601f168201915b505050505081565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b33611c016115dc565b6001600160a01b031614611c275760405162461bcd60e51b8152600401610684906137e8565b6001600160a01b038116611c8c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610684565b611c95816120ae565b50565b606033611ca484610f00565b6001600160a01b031614611cf85760405162461bcd60e51b815260206004820152601b60248201527a13db9b1e48189bd85d081bdddb995c8818d85b881b985b59481a5d602a1b6044820152606401610684565b6000838152602c602090815260409091208351611d1792850190612dee565b50827f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b83604051611d48919061374c565b60405180910390a250919050565b60006001600160e01b031982166380ac58cd60e01b1480611d8757506001600160e01b03198216635b5e139f60e01b145b8061058457506301ffc9a760e01b6001600160e01b0319831614610584565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611df882610f00565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e3c82611da6565b611e9d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610684565b6000611ea883610f00565b9050806001600160a01b0316846001600160a01b03161480611ee35750836001600160a01b0316611ed88461061c565b6001600160a01b0316145b80611ef35750611ef38185611bca565b949350505050565b826001600160a01b0316611f0e82610f00565b6001600160a01b031614611f765760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610684565b6001600160a01b038216611fd85760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610684565b611fe383838361274f565b611fee600082611dc3565b6001600160a01b03831660009081526003602052604081208054600192906120179084906138b9565b90915550506001600160a01b038216600090815260036020526040812080546001929061204590849061386e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020613a6283398151915291a4505050565b61166d828260405180602001604052806000815250612807565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b81603054146121445760405162461bcd60e51b815260206004820152601060248201526f15dc9bdb99c81c995c5d595cdd08125960821b6044820152606401610684565b602d54156121645760405162461bcd60e51b81526004016106849061375f565b602d8190556040518181527f1747b48b6ade85d7dc97c0f523e0e780795930a468c01b18a51546791fdd3ac09060200160405180910390a15050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612210929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161223d939291906136e1565b602060405180830381600087803b15801561225757600080fd5b505af115801561226b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228f91906130cc565b506000838152600a6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526122eb90600161386e565b6000858152600a6020526040902055611ef38482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b612336848484611efb565b6123428484848461283a565b6118d65760405162461bcd60e51b815260040161068490613796565b6060816123825750506040805180820190915260018152600360fc1b602082015290565b8160005b81156123ac578061239681613937565b91506123a59050600a83613886565b9150612386565b6000816001600160401b038111156123d457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156123fe576020820181803683370190505b5090505b8415611ef3576124136001836138b9565b9150612420600a86613972565b61242b90603061386e565b60f81b81838151811061244e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612470600a86613886565b9450612402565b606060006040518060400160405280600f81526020016e2261747472696275746573223a205b60881b8152509050606060006124dc6000866000815181106124cf57634e487b7160e01b600052603260045260246000fd5b6020026020010151612944565b60405191935091506124f490849084906020016132ab565b60408051601f19818403018152919052925060015b602b54612518906002906138b9565b81101561258557612543818783815181106124cf57634e487b7160e01b600052603260045260246000fd5b909350915081156125735783836040516020016125619291906132da565b60405160208183030381529060405293505b8061257d81613937565b915050612509565b50826125bb600e87600e5b815181106125ae57634e487b7160e01b600052603260045260246000fd5b6020026020010151612aaa565b6125c8600d88600d612590565b604051602001611ae593929190613317565b60608151600014156125fa57505060408051602081019091526000815290565b60006040518060600160405280604081526020016139ed6040913990506000600384516002612629919061386e565b6126339190613886565b61263e90600461389a565b9050600061264d82602061386e565b6001600160401b0381111561267257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561269c576020820181803683370190505b509050818152600183018586518101602084015b8183101561270a5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016126b0565b600389510660018114612724576002811461273557612741565b613d3d60f01b600119830152612741565b603d60f81b6000198301525b509398975050505050505050565b6001600160a01b0383166127aa576127a581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6127cd565b816001600160a01b0316836001600160a01b0316146127cd576127cd8382612b08565b6001600160a01b0382166127e4576107b581612ba5565b826001600160a01b0316826001600160a01b0316146107b5576107b58282612c7e565b6128118383612cc2565b61281e600084848461283a565b6107b55760405162461bcd60e51b815260040161068490613796565b60006001600160a01b0384163b1561293c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061287e9033908990889088906004016136a4565b602060405180830381600087803b15801561289857600080fd5b505af19250505080156128c8575060408051601f3d908101601f191682019092526128c591810190613125565b60015b612922573d8080156128f6576040519150601f19603f3d011682016040523d82523d6000602084013e6128fb565b606091505b50805161291a5760405162461bcd60e51b815260040161068490613796565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ef3565b506001611ef3565b6060600060405160200161296290631b9d5b1b60e21b815260040190565b60405160208183030381529060405280519060200120601e85600d811061299957634e487b7160e01b600052603260045260246000fd5b0184815481106129b957634e487b7160e01b600052603260045260246000fd5b906000526020600020016040516020016129d391906134dd565b604051602081830303815290604052805190602001201415612a0657505060408051602081019091526000808252612aa3565b602b8481548110612a2757634e487b7160e01b600052603260045260246000fd5b90600052602060002001601e85600d8110612a5257634e487b7160e01b600052603260045260246000fd5b018481548110612a7257634e487b7160e01b600052603260045260246000fd5b90600052602060002001604051602001612a8d9291906134e9565b6040516020818303038152906040526001915091505b9250929050565b6060602b8381548110612acd57634e487b7160e01b600052603260045260246000fd5b90600052602060002001612ae08361235e565b604051602001612af1929190613542565b604051602081830303815290604052905092915050565b60006001612b158461151a565b612b1f91906138b9565b600083815260076020526040902054909150808214612b72576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612bb7906001906138b9565b60008381526009602052604081205460088054939450909284908110612bed57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612c1c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612c6257634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612c898361151a565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216612d185760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610684565b612d2181611da6565b15612d6d5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610684565b612d796000838361274f565b6001600160a01b0382166000908152600360205260408120805460019290612da290849061386e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020613a62833981519152908290a45050565b828054612dfa906138fc565b90600052602060002090601f016020900481019282612e1c5760008555612e62565b82601f10612e3557805160ff1916838001178555612e62565b82800160010185558215612e62579182015b82811115612e62578251825591602001919060010190612e47565b50612e6e929150612e72565b5090565b5b80821115612e6e5760008155600101612e73565b60006001600160401b0380841115612ea157612ea16139b2565b604051601f8501601f19908116603f01168101908282118183101715612ec957612ec96139b2565b81604052809350858152868686011115612ee257600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114612f1357600080fd5b919050565b600082601f830112612f28578081fd5b612f3783833560208501612e87565b9392505050565b600060208284031215612f4f578081fd5b612f3782612efc565b60008060408385031215612f6a578081fd5b612f7383612efc565b9150612f8160208401612efc565b90509250929050565b600080600060608486031215612f9e578081fd5b612fa784612efc565b9250612fb560208501612efc565b9150604084013590509250925092565b60008060008060808587031215612fda578081fd5b612fe385612efc565b9350612ff160208601612efc565b92506040850135915060608501356001600160401b03811115613012578182fd5b8501601f81018713613022578182fd5b61303187823560208401612e87565b91505092959194509250565b6000806040838503121561304f578182fd5b61305883612efc565b91506020830135613068816139c8565b809150509250929050565b60008060408385031215613085578182fd5b61308e83612efc565b946020939093013593505050565b600080604083850312156130ae578182fd5b6130b783612efc565b9150602083013560ff81168114613068578182fd5b6000602082840312156130dd578081fd5b8151612f37816139c8565b600080604083850312156130fa578182fd5b50508035926020909101359150565b60006020828403121561311a578081fd5b8135612f37816139d6565b600060208284031215613136578081fd5b8151612f37816139d6565b600060208284031215613152578081fd5b81356001600160401b03811115613167578182fd5b611ef384828501612f18565b600060208284031215613184578081fd5b5035919050565b60006020828403121561319c578081fd5b5051919050565b600080604083850312156131b5578182fd5b8235915060208301356001600160401b038111156131d1578182fd5b6131dd85828601612f18565b9150509250929050565b600081518084526131ff8160208601602086016138d0565b601f01601f19169290920160200192915050565b8054600090600181811c908083168061322d57607f831692505b602080841082141561324d57634e487b7160e01b86526022600452602486fd5b81801561326157600181146132725761329f565b60ff1986168952848901965061329f565b60008881526020902060005b868110156132975781548b82015290850190830161327e565b505084890196505b50505050505092915050565b600083516132bd8184602088016138d0565b8351908301906132d18183602088016138d0565b01949350505050565b600083516132ec8184602088016138d0565b61016160f51b908301908152835161330b8160028401602088016138d0565b01600201949350505050565b600084516133298184602089016138d0565b808301905061016160f51b808252855161334a816002850160208a016138d0565b600292019182015283516133658160048401602088016138d0565b605d60f81b6004929091019182015260050195945050505050565b60008551613392818460208a016138d0565b808301905061016160f51b80825286516133b3816002850160208b016138d0565b6002920191820152691134b6b0b3b2911d101160b11b60048201526133db600e820186613213565b905083516133ed8183602088016138d0565b64173837339160d91b9101908152607d60f81b60058201526006019695505050505050565b600083516134248184602088016138d0565b61016160f51b9083018181527f226465736372697074696f6e223a2022416e20756e72657665616c656420417060028201526f32902430b93137bab9102cb0b1b43a1160811b60228201526032810191909152691134b6b0b3b2911d101160b11b6034820152835161349d81603e8401602088016138d0565b601160f91b603e9290910191820152607d60f81b603f820152604001949350505050565b600082516134d38184602087016138d0565b9190910192915050565b6000612f378284613213565b6f3d913a3930b4ba2fba3cb832911d101160811b8152600061350e6010830185613213565b6c111610113b30b63ab2911d101160991b815261352e600d820185613213565b61227d60f01b815260020195945050505050565b6f3d913a3930b4ba2fba3cb832911d101160811b815260006135676010830185613213565b6b0111610113b30b63ab2911d160a51b8152835161358c81600c8401602088016138d0565b607d60f81b600c9290910191820152600d01949350505050565b683d913730b6b2911d1160b91b815281516000906135cb8160098501602087016138d0565b601160f91b6009939091019283015250600a01919050565b66697066733a2f2f60c81b8152600082516136058160078501602087016138d0565b602f60f81b6007939091019283015250600801919050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161365581601d8501602087016138d0565b91909101601d0192915050565b6502cb0b1b43a160d51b8152600082516136838160068501602087016138d0565b9190910160060192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906136d7908301846131e7565b9695505050505050565b60018060a01b038416815282602082015260606040820152600061146f60608301846131e7565b6020808252825182820181905260009190848201906040850190845b8181101561374057835183529284019291840191600101613724565b50909695505050505050565b602081526000612f3760208301846131e7565b6020808252601f908201527f72616e646f6d536565642068617320616c7265616479206265656e2073657400604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561388157613881613986565b500190565b6000826138955761389561399c565b500490565b60008160001904831182151516156138b4576138b4613986565b500290565b6000828210156138cb576138cb613986565b500390565b60005b838110156138eb5781810151838201526020016138d3565b838111156118d65750506000910152565b600181811c9082168061391057607f821691505b6020821081141561393157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561394b5761394b613986565b5060010190565b600060ff821660ff81141561396957613969613986565b60010192915050565b6000826139815761398161399c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611c9557600080fd5b6001600160e01b031981168114611c9557600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f697066733a2f2f516d577433704265476d544567355255356a3832586f456a477561443736374c6642464a35673836696363435837ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207568886212533111f6cbb761151fde5684345de56dbeee74b8635ed561cbd3ee64736f6c63430008040033

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

000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf95623000000000000000000000000d4b61ef46ad352ea6b8846180c4fdd59f36056a1000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000060fd8a80

-----Decoded View---------------
Arg [0] : _baycAddress (address): 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
Arg [1] : _bakcAddress (address): 0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623
Arg [2] : _ahdAddress (address): 0xD4B61ef46aD352eA6B8846180C4fdd59f36056a1
Arg [3] : _linkAddress (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [4] : _vrfCoordinatorAddress (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [5] : _keyHash (bytes32): 0xaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [6] : _chainLinkFee (uint256): 2000000000000000000
Arg [7] : _startMinting (uint256): 1627228800

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d
Arg [1] : 000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf95623
Arg [2] : 000000000000000000000000d4b61ef46ad352ea6b8846180c4fdd59f36056a1
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [4] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [5] : aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [6] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [7] : 0000000000000000000000000000000000000000000000000000000060fd8a80


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

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