ETH Price: $3,338.31 (-1.08%)

Contract

0x78cB1769052fd44a10B3c297137c590681975806
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
stakingContract

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : staking.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;


import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; 
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "./upgradable/ERC721EnumerableUpgradeable.sol";
import "./upgradable/VRFConsumerBaseUpgradeable.sol";

interface Ipayment {
  function get_seed(uint256 seedIndex) external view returns (uint256);
  function last_seed() external view returns (uint256);

}

interface HeadStaking {
    function depositsOf(address account) external view returns (uint256[] memory);
}

interface IMint {
  struct Traits {uint8 alphaIndex; bool isHead;}
  function getPaidTokens() external view returns (uint256);
  function getTokenTraits(uint256 tokenId) external view returns (bool);
  function ownerOf(uint256 tokenId) external view returns (address);
  function safeTransferFrom(address from,address to,uint256 tokenId) external; 
  function transferFrom(address from, address to, uint256 tokenId) external;
  function safeTransferFrom(address from,address to,uint256 tokenId,  bytes memory _data) external; 
  function transferFrom(address from, address to, uint256 tokenId,  bytes memory _data) external;
}

interface IHead {
  function mint(address to, uint256 amount) external;
}

contract stakingContract is OwnableUpgradeable, IERC721ReceiverUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
  using AddressUpgradeable for address;
  using CountersUpgradeable for CountersUpgradeable.Counter;
  using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; 

                             
  struct Stake {uint16 tokenId; uint80 value; address owner;}


  IMint public erc721Contract;                                                                
  IHead public erc20Contract;                    
  HeadStaking public HeadDAOStaking; 
  Ipayment public PaymentContract;


  bool public rescueEnabled;                                          


  event TokenStaked   (address owner,   uint256 tokenId, uint256 value);
  event HeadClaimed (uint256 tokenId, uint256 earned,  bool unstaked);
  event HunterClaimed (uint256 tokenId, uint256 earned,  bool unstaked);

  mapping (address => bool)    private whitelistedContracts;  
  mapping (uint256 => Stake)   private stakedTokens;                              
  mapping (uint256 => Stake[]) public Hunters;                                
  mapping (address => EnumerableSetUpgradeable.UintSet) private _deposits;
  mapping (uint256 => uint256) public packIndices;   
  mapping(uint256 => uint256) private unstakeCounter;                      
  
  uint256 private _totalAlphaStaked;                              
  uint256 private _unaccountedRewards;                               
  uint256 private _HeadPerAlpha;     
  uint256 private _totalHeadEarned;                                    
  uint256 private _totalHeadStaked;                           
  uint256 private _lastClaimTimestamp;    
   

  uint256 public  DailyHeadEmitRate;                      
  uint256 public  minExit;                        
  uint256 public  headTax;       
  uint256 public headKingTax;     
  uint256 public  maxHead;      
  uint8   public  maxAlpha; 
  uint256 alpha; 

    
  



                      
                      
  function initialize(address _erc721contract, address _erc20contract, address _payment, address _headdaostaking) initializer public {

    __Ownable_init();
    __ReentrancyGuard_init();
    __Pausable_init();


    erc721Contract = IMint(_erc721contract);                                                  
    erc20Contract = IHead(_erc20contract);  
    PaymentContract = Ipayment(_payment);  
  
    HeadDAOStaking = HeadStaking(_headdaostaking);                                   

    _totalAlphaStaked = 0;                                    
    _unaccountedRewards = 0;                                  
    _HeadPerAlpha = 0;   
    maxHead = 2400000000 ether; 
    maxAlpha = 8; 
    alpha= 6; 

    DailyHeadEmitRate = 100 ether;                        
    minExit = 2 days;                              
    headTax = 25; 
    headKingTax = 200 ether;
    rescueEnabled = false; 


  }


  function stakeMany(address account, uint16[] calldata tokenIds) external blockExternalContracts whenNotPaused nonReentrant() {   
    address msgSender = _msgSender();
    require(account == msgSender || msgSender == address(erc721Contract) || msgSender == address(PaymentContract), "DONT GIVE YOUR TOKENS AWAY");  
    
    for (uint i = 0; i < tokenIds.length; i++) {
      if (msgSender != address(PaymentContract)) {
        require(erc721Contract.ownerOf(tokenIds[i]) == msgSender, "AINT YO TOKEN");
        erc721Contract.transferFrom(msgSender, address(this), tokenIds[i]);  //safeTransferFrom
        
      } else if (tokenIds[i] == 0) {
        continue; 
      }

      if (isHead(tokenIds[i])) 
        _stakeHeads(account, tokenIds[i]);
      else 
        _stakeHunters(account, tokenIds[i]);
    }
  }

  function claimFromStaking(uint16[] calldata tokenIds, bool unstake, bool payKings) external blockExternalContracts whenNotPaused _updateEarnings nonReentrant() {
    address msgSender = _msgSender();
    require(tx.origin == msgSender, "Only EOA");
    uint256  owed = 0;
    uint256 headEarns = 0;
    
    for (uint i = 0; i < tokenIds.length; i++) {
      if (isHead(tokenIds[i])) {
          headEarns += _claimHeads(tokenIds[i], unstake);
       } else {
         owed += _claimHunters(tokenIds[i], unstake);
       }
    }


    _payHuntersTax(headEarns * headTax / 100);   
    headEarns = headEarns * (100 - headTax) / 100;   


    owed += headEarns; 
    if (owed == 0) return;
    erc20Contract.mint(msgSender, owed);

  }
  
  function _calcBoost(address msgSender) internal view returns (uint256) {
    uint256[] memory deposits = HeadDAOStaking.depositsOf(msgSender);

    if (deposits.length == 0) return 0;

    uint256 boost = (deposits.length * 10) + 40;

    if (boost >= 100) return 100;
    return boost;

  }

  function calcBoost(address addr) external view returns (uint256 boost) {
    boost = _calcBoost(addr);
  }


  function calcHuntersReward(uint256 tokenId) public view blockExternalContracts returns (uint256 owed) {
    Stake memory stake = Hunters[alpha][packIndices[tokenId]];
    owed = (alpha) * (_HeadPerAlpha - stake.value); 
  }

  function rescue(uint256[] calldata tokenIds) external blockExternalContracts nonReentrant() {
    address msgSender = _msgSender();
    require(!msgSender.isContract(), "Contracts are not allowed");
    require(tx.origin == msgSender, "Only EOA");
    require(rescueEnabled, "RESCUE DISABLED");
    
    uint256 tokenId;
    Stake memory stake;
    Stake memory lastStake;

    for (uint i = 0; i < tokenIds.length; i++) {
      tokenId = tokenIds[i];
      if (isHead(tokenId)) {

        stake = stakedTokens[tokenId];
        require(stake.owner == msgSender, "SWIPER, NO SWIPING");
        delete stakedTokens[tokenId];
        _totalHeadStaked -= 1;
        _deposits[msgSender].remove(tokenId);
        erc721Contract.safeTransferFrom(address(this), msgSender, tokenId, ""); 
        emit HeadClaimed(tokenId, 0, true);


      } else {
        stake = Hunters[alpha][packIndices[tokenId]];
        require(stake.owner == msgSender, "SWIPER, NO SWIPING");
        _totalAlphaStaked -= alpha; 
        lastStake = Hunters[alpha][Hunters[alpha].length - 1];
        Hunters[alpha][packIndices[tokenId]] = lastStake; 
        packIndices[lastStake.tokenId] = packIndices[tokenId];
        Hunters[alpha].pop(); 
        delete packIndices[tokenId]; 
        _deposits[msgSender].remove(tokenId);
        erc721Contract.safeTransferFrom(address(this), msgSender, tokenId, ""); 
        emit HunterClaimed(tokenId, 0, true);
      }
    }
  }

  /** PRIVATE GAMEPLAY FUNCTIONS */

  function _stakeHeads(address account, uint256 tokenId) private  _updateEarnings {
    stakedTokens[tokenId] = Stake({
      owner: account,
      tokenId: uint16(tokenId),
      value: uint80(block.timestamp)
    });
    _totalHeadStaked += 1;
   
    emit TokenStaked(account, tokenId, block.timestamp);
    _deposits[account].add(tokenId);
  }

  function _stakeHunters(address account, uint256 tokenId) private _updateEarnings  {
    _totalAlphaStaked += alpha;                                               
    packIndices[tokenId] = Hunters[alpha].length;                                
    Hunters[alpha].push(Stake({                                                
      owner: account,
      tokenId: uint16(tokenId),
      value: uint80(_HeadPerAlpha)
    })); 
    emit TokenStaked(account, tokenId, _HeadPerAlpha);
    _deposits[account].add(tokenId);
  }



  function _claimHeads(uint256 tokenId, bool unstake) private returns (uint256 owed) {
    address msgSender = _msgSender();
    Stake memory stake = stakedTokens[tokenId];

    require(stake.owner == msgSender, "SWIPER, NO SWIPING");
    require(tx.origin == msgSender, "Only EOA");
    require(!msgSender.isContract(), "Contracts are not allowed");
    require(!(unstake && block.timestamp - stake.value < minExit), "Need 2 days worth of $gHead accumulated");

    owed = calcHeadRewardAddress(tokenId,msgSender);

    if (unstake) {
      
  
      unstakeCounter[tokenId]++;
      uint256 last_seed = PaymentContract.get_seed(tokenId);
      uint256 seed = uint256(keccak256(abi.encodePacked(last_seed,tokenId,unstakeCounter[tokenId])));
         
      if (seed & 1 == 1) {                                         
        _payHuntersTax(owed);
        owed = 0;  
      }

      delete stakedTokens[tokenId];
      _totalHeadStaked -= 1;
      _deposits[msgSender].remove(tokenId);
      erc721Contract.safeTransferFrom(address(this), msgSender, tokenId, "");       

    } else {
      stakedTokens[tokenId] = Stake({
        owner: msgSender,
        tokenId: uint16(tokenId),
        value: uint80(block.timestamp)
      });
                     
    }
    emit HeadClaimed(tokenId, owed, unstake);
    
  }

  function _claimHunters(uint256 tokenId, bool unstake) private returns (uint256 owed) {
    address msgSender = _msgSender();
    Stake memory stake = Hunters[alpha][packIndices[tokenId]];

    require(erc721Contract.ownerOf(tokenId) == address(this), "AINT A PART OF THE PACK");                
    require(stake.owner == msgSender, "SWIPER, NO SWIPING");
    require(tx.origin == msgSender, "Only EOA");
    require(!msgSender.isContract(), "Contracts are not allowed big man");

    owed = calcHuntersReward(tokenId);                                        

    if (unstake) {
      _totalAlphaStaked -= alpha;                                          
      Stake memory lastStake = Hunters[alpha][Hunters[alpha].length - 1];       
      Hunters[alpha][packIndices[tokenId]] = lastStake;                       
      packIndices[lastStake.tokenId] = packIndices[tokenId];               
      Hunters[alpha].pop();                                                  

      delete packIndices[tokenId];                                       
      _deposits[msgSender].remove(tokenId);
      erc721Contract.safeTransferFrom(address(this), msgSender, tokenId, "");    


    } else {

      Hunters[alpha][packIndices[tokenId]] = Stake({
        owner: msgSender,
        tokenId: uint16(tokenId),
        value: uint80(_HeadPerAlpha)
      }); // reset stake

    }
    emit HunterClaimed(tokenId, owed, unstake);
  }

  function _payHuntersTax(uint256 amount) private {

    if (_totalAlphaStaked == 0) {                                             
      _unaccountedRewards += amount; 
      return;
    }

    _HeadPerAlpha += (amount + _unaccountedRewards) / _totalAlphaStaked;        
    _unaccountedRewards = 0;
  }
                                  
  /** ADMIN FUNCTIONS */

  function setWhitelistContract(address contract_address, bool status) external onlyOwner{
    whitelistedContracts[contract_address] = status;
  }


  function setMintContract(address _erc721contract) external onlyOwner {
      erc721Contract = IMint(_erc721contract);   
  }

  function setERC20Contract(address _erc20contract) external onlyOwner {
      erc20Contract = IHead(_erc20contract);  
  }

  function setPaymentContract(address _payment) external onlyOwner {
    PaymentContract = Ipayment(_payment);
  }


  function setInit(address _erc721contract, address _erc20contract, address _payment) external onlyOwner{
    erc721Contract = IMint(_erc721contract);                                          
    erc20Contract = IHead(_erc20contract);  
    PaymentContract = Ipayment(_payment);

  }

  function changeDailyRate(uint256 _newRate) external onlyOwner{
      DailyHeadEmitRate = _newRate;
  }

  function changeMinExit(uint256 _newExit) external onlyOwner{
      minExit = _newExit ;
  }

  function changeHeadTax(uint256 _newTax) external onlyOwner {
      headTax = _newTax;
  }

  function changeMaxHead(uint256 _newMax) external onlyOwner {
      maxHead = _newMax;
  }

  function setRescueEnabled(bool _enabled) external onlyOwner {
    rescueEnabled = _enabled;
  }

  function setPaused(bool _paused) external onlyOwner {
    if (_paused) _pause();
    else _unpause();
  }

  /** OTHER */
  
  function onERC721Received(address, address from, uint256, bytes calldata) external pure override returns (bytes4) {

    require(from == address(0x0), "Cannot send tokens to staking directly");
    return IERC721ReceiverUpgradeable.onERC721Received.selector;

  }

  /** GAME PLAY EXTERNAL FUNCTIONS */

  function gheadPerAlpha() external view blockExternalContracts returns (uint256 ghead) {
    ghead = _HeadPerAlpha;
  }                           

  function unaccountedRewards() external view blockExternalContracts returns (uint256 rewards) {

    rewards = _unaccountedRewards;
  }    

  function lastClaimTimestamp() external view blockExternalContracts returns (uint256 timestamp) {
    timestamp = _lastClaimTimestamp;
  }    

  function totalHeadStaked() external view blockExternalContracts returns (uint256 nHead) {
    nHead = _totalHeadStaked;
  }    

  function totalHeadEarned() external view blockExternalContracts returns (uint256 nHead) {
    nHead = _totalHeadEarned;
  }    

  function depositsOf(address account) external view blockExternalContracts  returns (uint256[] memory) {

    EnumerableSetUpgradeable.UintSet storage depositSet = _deposits[account];
    uint256[] memory tokenIds = new uint256[] (depositSet.length());

    for (uint256 i; i < depositSet.length(); i++) {
      tokenIds[i] = depositSet.at(i);
    }

    return tokenIds;
  }

  function randomHunterOwner(uint256 seed) external view blockExternalContracts returns (address) {

    if (_totalAlphaStaked == 0) return address(0x0);

    uint256 bucket = (seed & 0xFFFFFFFF) % _totalAlphaStaked;                 
    uint256 cumulative;
    seed >>= 32;

    for (uint i = maxAlpha - 3; i <= maxAlpha; i++) {                    
      cumulative += Hunters[i].length * i;
      if (bucket >= cumulative) continue;                                 

      return Hunters[i][seed % Hunters[i].length].owner;                       
    }

    return address(0x0);
  }

  function isHead(uint256 tokenId) public view blockExternalContracts returns (bool head) {
    head = erc721Contract.getTokenTraits(tokenId);
    return head;
  }


  /** SECURITY  */

  modifier blockExternalContracts() {
    if (tx.origin != msg.sender) {
      require(whitelistedContracts[msg.sender], "You're not allowed to call this function");
      _;
      
    } else {

      _;

    }
    
  }

  modifier _updateEarnings() {

    if (_totalHeadEarned < maxHead) {
      _totalHeadEarned += 
        (block.timestamp - _lastClaimTimestamp)
        * _totalHeadStaked
        * DailyHeadEmitRate / 1 days; 
      _lastClaimTimestamp = block.timestamp;
    }
    _;
  }

  function calculateRewardAddress(uint16[] calldata tokenIds, address owner) external view blockExternalContracts returns (uint256 owed) {

    for (uint i = 0; i < tokenIds.length; i++) {
      if (isHead(tokenIds[i]))
        owed += calcHeadRewardAddress(tokenIds[i],owner);
      else
        owed +=  calcHuntersReward(tokenIds[i]);
    }
  
  }

  function calcHeadRewardAddress(uint256 tokenId, address owner) public view blockExternalContracts returns (uint256 owed) {
    uint256 boost = _calcBoost(owner) * 10**18; 
    uint256 headRate = DailyHeadEmitRate + boost; 
    Stake memory stake = stakedTokens[tokenId];
    if (_totalHeadEarned < maxHead) {
        owed = (block.timestamp - stake.value) * headRate / 1 days;

    } else if (stake.value > _lastClaimTimestamp) {
        owed = 0;

    } else {
        owed = (_lastClaimTimestamp - stake.value) * headRate / 1 days; 
    }

  }

  
}

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

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

import "@chainlink/contracts/src/v0.8/VRFRequestIDBase.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.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 VRFConsumerBaseUpgradeable is VRFRequestIDBase, Initializable {

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

  /**
   * @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 internal LINK;
  address 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
   */
  function __VRFConsumerBase_init(address _vrfCoordinator, address _link) internal initializer {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
    USER_SEED_PLACEHOLDER = 0;
  }

  // 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 22 : ERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;


import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.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 ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
    using AddressUpgradeable for address;

    function __ERC721Enumerable_init() internal initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721Enumerable_init_unchained();
    }

    function __ERC721Enumerable_init_unchained() internal initializer {
    }
    // 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(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {
        return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(!_msgSender().isContract(), "Contracts are not allowed big man");
        require(index < ERC721Upgradeable.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(!_msgSender().isContract(), "Contracts are not allowed big man");
        require(index < ERC721EnumerableUpgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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();
    }
    uint256[46] private __gap;
}

File 4 of 22 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 5 of 22 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 7 of 22 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    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 8 of 22 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 9 of 22 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 10 of 22 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    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 Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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 11 of 22 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

File 12 of 22 : IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @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 13 of 22 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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 14 of 22 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @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 15 of 22 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable 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.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return
            interfaceId == type(IERC721Upgradeable).interfaceId ||
            interfaceId == type(IERC721MetadataUpgradeable).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 = ERC721Upgradeable.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 {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: 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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
    }

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

    /**
     * @dev 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.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 {}
    uint256[44] private __gap;
}

File 16 of 22 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 17 of 22 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

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

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

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

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

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 18 of 22 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

File 19 of 22 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 20 of 22 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        _transferOwnership(_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 {
        _transferOwnership(address(0));
    }

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

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

File 21 of 22 : 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 22 of 22 : 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));
  }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"},{"indexed":false,"internalType":"bool","name":"unstaked","type":"bool"}],"name":"HeadClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"},{"indexed":false,"internalType":"bool","name":"unstaked","type":"bool"}],"name":"HunterClaimed","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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokenStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DailyHeadEmitRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HeadDAOStaking","outputs":[{"internalType":"contract HeadStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"Hunters","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint80","name":"value","type":"uint80"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PaymentContract","outputs":[{"internalType":"contract Ipayment","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"calcBoost","outputs":[{"internalType":"uint256","name":"boost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"calcHeadRewardAddress","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"calcHuntersReward","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"},{"internalType":"address","name":"owner","type":"address"}],"name":"calculateRewardAddress","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRate","type":"uint256"}],"name":"changeDailyRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTax","type":"uint256"}],"name":"changeHeadTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMax","type":"uint256"}],"name":"changeMaxHead","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newExit","type":"uint256"}],"name":"changeMinExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"},{"internalType":"bool","name":"unstake","type":"bool"},{"internalType":"bool","name":"payKings","type":"bool"}],"name":"claimFromStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"depositsOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20Contract","outputs":[{"internalType":"contract IHead","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc721Contract","outputs":[{"internalType":"contract IMint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gheadPerAlpha","outputs":[{"internalType":"uint256","name":"ghead","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"headKingTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"headTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_erc721contract","type":"address"},{"internalType":"address","name":"_erc20contract","type":"address"},{"internalType":"address","name":"_payment","type":"address"},{"internalType":"address","name":"_headdaostaking","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isHead","outputs":[{"internalType":"bool","name":"head","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastClaimTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAlpha","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxHead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minExit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"packIndices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seed","type":"uint256"}],"name":"randomHunterOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_erc20contract","type":"address"}],"name":"setERC20Contract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_erc721contract","type":"address"},{"internalType":"address","name":"_erc20contract","type":"address"},{"internalType":"address","name":"_payment","type":"address"}],"name":"setInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_erc721contract","type":"address"}],"name":"setMintContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_payment","type":"address"}],"name":"setPaymentContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setRescueEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contract_address","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setWhitelistContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"stakeMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalHeadEarned","outputs":[{"internalType":"uint256","name":"nHead","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalHeadStaked","outputs":[{"internalType":"uint256","name":"nHead","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unaccountedRewards","outputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50614845806100206000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c80637a93feb91161015c578063c4601f56116100ce578063dbdc1f6b11610087578063dbdc1f6b1461058c578063dfeef91b1461059f578063e3a9db1a146105b2578063ec0767bf146105d2578063f2fde38b146105e5578063f8c8765e146105f857600080fd5b8063c4601f5614610525578063cac8d5381461052d578063ce84291214610540578063cedb363b14610553578063d6bd632e14610566578063d7c97fb41461057957600080fd5b8063a447519911610120578063a4475199146104c6578063a8f6c913146104cf578063abf4f3a5146104e2578063baabc2c2146104eb578063beeb7e5b1461050a578063c0c472c01461051d57600080fd5b80637a93feb91461047e5780637ce522d0146104875780638abb20cc1461049a5780638da5cb5b146104ad578063940d41c0146104be57600080fd5b80634328ee66116101f5578063607af397116101b9578063607af397146104155780636a3ef0571461041d5780636f234fb5146104305780636fde344014610450578063715018a614610463578063765310081461046b57600080fd5b80634328ee661461038d57806356942d9d146103a05780635c74a42c146103b35780635c975abb146103f75780635fb64a6a1461040257600080fd5b80631aace9b7116102475780631aace9b71461030d5780632fb641c91461033857806339db714f1461034b5780633bbba0781461035f5780634191adfb1461036757806342174b201461037a57600080fd5b80630b999fe3146102845780630f7f5ce2146102ac5780631078c88b146102c3578063150b7a02146102cc57806316c38b3c146102f8575b600080fd5b610297610292366004614429565b61060b565b60405190151581526020015b60405180910390f35b6102b560dd5481565b6040519081526020016102a3565b6102b560d95481565b6102df6102da3660046140ee565b6106d3565b6040516001600160e01b031990911681526020016102a3565b61030b6103063660046143cb565b61074d565b005b61032061031b366004614429565b610790565b6040516001600160a01b0390911681526020016102a3565b61030b610346366004614047565b610957565b60cc5461029790600160a01b900460ff1681565b6102b56109c0565b60cb54610320906001600160a01b031681565b6102b5610388366004614429565b6109ff565b6102b561039b36600461400d565b610ad4565b61030b6103ae366004614429565b610adf565b6103c66103c1366004614480565b610b0e565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b0316908201526060016102a3565b60655460ff16610297565b61030b61041036600461400d565b610b61565b6102b5610bad565b61030b61042b3660046142c4565b610bec565b6102b561043e366004614429565b60d16020526000908152604090205481565b61030b61045e366004614429565b611733565b61030b611762565b61030b6104793660046143cb565b611798565b6102b560db5481565b61030b610495366004614429565b6117e0565b61030b6104a836600461400d565b61180f565b6033546001600160a01b0316610320565b6102b561185b565b6102b560dc5481565b60ca54610320906001600160a01b031681565b6102b560da5481565b60de546104f89060ff1681565b60405160ff90911681526020016102a3565b6102b561051836600461445b565b61189a565b6102b5611b25565b6102b5611b64565b61030b61053b36600461400d565b611ba3565b60cc54610320906001600160a01b031681565b61030b6105613660046141e2565b611bef565b6102b561057436600461421b565b611c44565b60c954610320906001600160a01b031681565b61030b61059a36600461418d565b611de3565b61030b6105ad366004614267565b6124ac565b6105c56105c036600461400d565b612955565b6040516102a391906144d5565b61030b6105e0366004614429565b612afb565b61030b6105f336600461400d565b612b2a565b61030b610606366004614092565b612bc2565b600032331461064c5733600090815260cd602052604090205460ff1661064c5760405162461bcd60e51b8152600401610643906145df565b60405180910390fd5b60c9546040516394e5684760e01b8152600481018490526001600160a01b03909116906394e568479060240160206040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c891906143e8565b92915050565b919050565b60006001600160a01b0385161561073b5760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f742073656e6420746f6b656e7320746f207374616b696e67206469604482015265726563746c7960d01b6064820152608401610643565b50630a85bd0160e11b95945050505050565b6033546001600160a01b031633146107775760405162461bcd60e51b815260040161064390614627565b801561078857610785612cf5565b50565b610785612d6a565b60003233146108c05733600090815260cd602052604090205460ff166107c85760405162461bcd60e51b8152600401610643906145df565b60d3546107d757506000919050565b600060d3548363ffffffff166107ed919061476a565b60de5460209490941c93909150600090819061080e9060039060ff1661472c565b60ff1690505b60de5460ff1681116108b557600081815260cf602052604090205461083a9082906146f6565b61084490836146ca565b9150818310610852576108a3565b600081815260cf60205260409020805461086c908761476a565b8154811061087c5761087c6147c0565b600091825260209091200154600160601b90046001600160a01b031693506106ce92505050565b806108ad8161474f565b915050610814565b506000949350505050565b60d3546108cf57506000919050565b600060d3548363ffffffff166108e5919061476a565b60de5460209490941c9390915060009081906109069060039060ff1661472c565b60ff1690505b60de5460ff1681116108b557600081815260cf60205260409020546109329082906146f6565b61093c90836146ca565b9150818310610852578061094f8161474f565b91505061090c565b6033546001600160a01b031633146109815760405162461bcd60e51b815260040161064390614627565b60c980546001600160a01b039485166001600160a01b03199182161790915560ca80549385169382169390931790925560cc8054919093169116179055565b60003233146109f85733600090815260cd602052604090205460ff166109f85760405162461bcd60e51b8152600401610643906145df565b5060d75490565b6000323314610a375733600090815260cd602052604090205460ff16610a375760405162461bcd60e51b8152600401610643906145df565b60df54600090815260cf6020908152604080832085845260d190925282205481548110610a6657610a666147c0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b0316938301849052600160601b90046001600160a01b03169082015260d554909250610ac09190614715565b60df54610acd91906146f6565b9392505050565b60006106c882612de4565b6033546001600160a01b03163314610b095760405162461bcd60e51b815260040161064390614627565b60db55565b60cf6020528160005260406000208181548110610b2a57600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b6033546001600160a01b03163314610b8b5760405162461bcd60e51b815260040161064390614627565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b6000323314610be55733600090815260cd602052604090205460ff16610be55760405162461bcd60e51b8152600401610643906145df565b5060d85490565b3233146111ab5733600090815260cd602052604090205460ff16610c225760405162461bcd60e51b8152600401610643906145df565b60026097541415610c455760405162461bcd60e51b81526004016106439061465c565b600260975533803b15610c6a5760405162461bcd60e51b815260040161064390614693565b326001600160a01b03821614610c925760405162461bcd60e51b815260040161064390614519565b60cc54600160a01b900460ff16610cdd5760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610643565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052825b8581101561119b57868682818110610d2c57610d2c6147c0565b905060200201359350610d3e8461060b565b15610ead57600084815260ce60209081526040918290208251606081018452905461ffff811682526001600160501b0362010000820416928201929092526001600160a01b03600160601b90920482169281018390529450861614610db55760405162461bcd60e51b81526004016106439061453b565b600084815260ce6020526040812081905560d7805460019290610dd9908490614715565b90915550506001600160a01b038516600090815260d060205260409020610e009085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde90610e35903090899089906004016144a2565b600060405180830381600087803b158015610e4f57600080fd5b505af1158015610e63573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e53339350908190036060019150a1611189565b60df54600090815260cf6020908152604080832087845260d19092529091205481548110610edd57610edd6147c0565b600091825260209182902060408051606081018252919092015461ffff811682526001600160501b0362010000820416938201939093526001600160a01b03600160601b9093048316918101829052945090861614610f4e5760405162461bcd60e51b81526004016106439061453b565b60df5460d36000828254610f629190614715565b909155505060df54600090815260cf602052604090208054610f8690600190614715565b81548110610f9657610f966147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf825280842088855260d1909252909220548254919450849291811061100b5761100b6147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905587835260d1815283832054865190921683528383209190915560df54825260cf905220805480611099576110996147aa565b60008281526020808220830160001990810183905590920190925585825260d1815260408083208390556001600160a01b038816835260d090915290206110e09085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde90611115903090899089906004016144a2565b600060405180830381600087803b15801561112f57600080fd5b505af1158015611143573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f9350908190036060019150a15b806111938161474f565b915050610d12565b505060016097555061172f915050565b600260975414156111ce5760405162461bcd60e51b81526004016106439061465c565b600260975533803b156111f35760405162461bcd60e51b815260040161064390614693565b326001600160a01b0382161461121b5760405162461bcd60e51b815260040161064390614519565b60cc54600160a01b900460ff166112665760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610643565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052825b85811015611724578686828181106112b5576112b56147c0565b9050602002013593506112c78461060b565b1561143657600084815260ce60209081526040918290208251606081018452905461ffff811682526001600160501b0362010000820416928201929092526001600160a01b03600160601b9092048216928101839052945086161461133e5760405162461bcd60e51b81526004016106439061453b565b600084815260ce6020526040812081905560d7805460019290611362908490614715565b90915550506001600160a01b038516600090815260d0602052604090206113899085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde906113be903090899089906004016144a2565b600060405180830381600087803b1580156113d857600080fd5b505af11580156113ec573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e53339350908190036060019150a1611712565b60df54600090815260cf6020908152604080832087845260d19092529091205481548110611466576114666147c0565b600091825260209182902060408051606081018252919092015461ffff811682526001600160501b0362010000820416938201939093526001600160a01b03600160601b90930483169181018290529450908616146114d75760405162461bcd60e51b81526004016106439061453b565b60df5460d360008282546114eb9190614715565b909155505060df54600090815260cf60205260409020805461150f90600190614715565b8154811061151f5761151f6147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf825280842088855260d19092529092205482549194508492918110611594576115946147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905587835260d1815283832054865190921683528383209190915560df54825260cf905220805480611622576116226147aa565b60008281526020808220830160001990810183905590920190925585825260d1815260408083208390556001600160a01b038816835260d090915290206116699085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde9061169e903090899089906004016144a2565b600060405180830381600087803b1580156116b857600080fd5b505af11580156116cc573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f9350908190036060019150a15b8061171c8161474f565b91505061129b565b505060016097555050505b5050565b6033546001600160a01b0316331461175d5760405162461bcd60e51b815260040161064390614627565b60dd55565b6033546001600160a01b0316331461178c5760405162461bcd60e51b815260040161064390614627565b6117966000612eb9565b565b6033546001600160a01b031633146117c25760405162461bcd60e51b815260040161064390614627565b60cc8054911515600160a01b0260ff60a01b19909216919091179055565b6033546001600160a01b0316331461180a5760405162461bcd60e51b815260040161064390614627565b60da55565b6033546001600160a01b031633146118395760405162461bcd60e51b815260040161064390614627565b60cc80546001600160a01b0319166001600160a01b0392909216919091179055565b60003233146118935733600090815260cd602052604090205460ff166118935760405162461bcd60e51b8152600401610643906145df565b5060d65490565b60003233146119fb5733600090815260cd602052604090205460ff166118d25760405162461bcd60e51b8152600401610643906145df565b60006118dd83612de4565b6118ef90670de0b6b3a76400006146f6565b905060008160d95461190191906146ca565b600086815260ce60209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181019190915260dd5460d6549293509091101561199c57620151808282602001516001600160501b0316426119819190614715565b61198b91906146f6565b61199591906146e2565b93506119f3565b60d85481602001516001600160501b031611156119bc57600093506119f3565b620151808282602001516001600160501b031660d8546119dc9190614715565b6119e691906146f6565b6119f091906146e2565b93505b5050506106c8565b6000611a0683612de4565b611a1890670de0b6b3a76400006146f6565b905060008160d954611a2a91906146ca565b600086815260ce60209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181019190915260dd5460d65492935090911015611ac557620151808282602001516001600160501b031642611aaa9190614715565b611ab491906146f6565b611abe91906146e2565b9350611b1c565b60d85481602001516001600160501b03161115611ae55760009350611b1c565b620151808282602001516001600160501b031660d854611b059190614715565b611b0f91906146f6565b611b1991906146e2565b93505b50505092915050565b6000323314611b5d5733600090815260cd602052604090205460ff16611b5d5760405162461bcd60e51b8152600401610643906145df565b5060d45490565b6000323314611b9c5733600090815260cd602052604090205460ff16611b9c5760405162461bcd60e51b8152600401610643906145df565b5060d55490565b6033546001600160a01b03163314611bcd5760405162461bcd60e51b815260040161064390614627565b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314611c195760405162461bcd60e51b815260040161064390614627565b6001600160a01b0391909116600090815260cd60205260409020805460ff1916911515919091179055565b6000323314611d5c5733600090815260cd602052604090205460ff16611c7c5760405162461bcd60e51b8152600401610643906145df565b60005b83811015611d5657611cba858583818110611c9c57611c9c6147c0565b9050602002016020810190611cb19190614405565b61ffff1661060b565b15611d0457611cf3858583818110611cd457611cd46147c0565b9050602002016020810190611ce99190614405565b61ffff168461189a565b611cfd90836146ca565b9150611d44565b611d37858583818110611d1957611d196147c0565b9050602002016020810190611d2e9190614405565b61ffff166109ff565b611d4190836146ca565b91505b80611d4e8161474f565b915050611c7f565b50610acd565b60005b83811015611ddb57611d7c858583818110611c9c57611c9c6147c0565b15611da757611d96858583818110611cd457611cd46147c0565b611da090836146ca565b9150611dc9565b611dbc858583818110611d1957611d196147c0565b611dc690836146ca565b91505b80611dd38161474f565b915050611d5f565b509392505050565b3233146121845733600090815260cd602052604090205460ff16611e195760405162461bcd60e51b8152600401610643906145df565b60655460ff1615611e3c5760405162461bcd60e51b815260040161064390614567565b60026097541415611e5f5760405162461bcd60e51b81526004016106439061465c565b6002609755336001600160a01b038416811480611e89575060c9546001600160a01b038281169116145b80611ea1575060cc546001600160a01b038281169116145b611eed5760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610643565b60005b828110156121785760cc546001600160a01b038381169116146120ab5760c9546001600160a01b038084169116636352211e868685818110611f3457611f346147c0565b9050602002016020810190611f499190614405565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b158015611f8357600080fd5b505afa158015611f97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbb919061402a565b6001600160a01b0316146120015760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610643565b60c9546001600160a01b03166323b872dd8330878786818110612026576120266147c0565b905060200201602081019061203b9190614405565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b15801561208e57600080fd5b505af11580156120a2573d6000803e3d6000fd5b505050506120df565b8383828181106120bd576120bd6147c0565b90506020020160208101906120d29190614405565b61ffff166120df57612166565b6120f4848483818110611c9c57611c9c6147c0565b156121325761212d8585858481811061210f5761210f6147c0565b90506020020160208101906121249190614405565b61ffff16612f0b565b612166565b61216685858584818110612148576121486147c0565b905060200201602081019061215d9190614405565b61ffff16613071565b806121708161474f565b915050611ef0565b50506001609755505050565b60655460ff16156121a75760405162461bcd60e51b815260040161064390614567565b600260975414156121ca5760405162461bcd60e51b81526004016106439061465c565b6002609755336001600160a01b0384168114806121f4575060c9546001600160a01b038281169116145b8061220c575060cc546001600160a01b038281169116145b6122585760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610643565b60005b828110156121785760cc546001600160a01b038381169116146124165760c9546001600160a01b038084169116636352211e86868581811061229f5761229f6147c0565b90506020020160208101906122b49190614405565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b1580156122ee57600080fd5b505afa158015612302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612326919061402a565b6001600160a01b03161461236c5760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610643565b60c9546001600160a01b03166323b872dd8330878786818110612391576123916147c0565b90506020020160208101906123a69190614405565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b1580156123f957600080fd5b505af115801561240d573d6000803e3d6000fd5b5050505061244a565b838382818110612428576124286147c0565b905060200201602081019061243d9190614405565b61ffff1661244a57612495565b61245f848483818110611c9c57611c9c6147c0565b1561247f5761247a8585858481811061210f5761210f6147c0565b612495565b61249585858584818110612148576121486147c0565b8061249f8161474f565b91505061225b565b505050565b3233146127415733600090815260cd602052604090205460ff166124e25760405162461bcd60e51b8152600401610643906145df565b60655460ff16156125055760405162461bcd60e51b815260040161064390614567565b60dd5460d6541015612562576201518060d95460d75460d854426125299190614715565b61253391906146f6565b61253d91906146f6565b61254791906146e2565b60d6600082825461255891906146ca565b90915550504260d8555b600260975414156125855760405162461bcd60e51b81526004016106439061465c565b6002609755333281146125aa5760405162461bcd60e51b815260040161064390614519565b60008060005b8681101561266a576125cd888883818110611c9c57611c9c6147c0565b15612617576126068888838181106125e7576125e76147c0565b90506020020160208101906125fc9190614405565b61ffff16876131da565b61261090836146ca565b9150612658565b61264b88888381811061262c5761262c6147c0565b90506020020160208101906126419190614405565b61ffff16876135b8565b61265590846146ca565b92505b806126628161474f565b9150506125b0565b5061268d606460db548361267e91906146f6565b61268891906146e2565b613aea565b606460db54606461269e9190614715565b6126a890836146f6565b6126b291906146e2565b90506126be81836146ca565b9150816126cd57505050612737565b60ca546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b15801561271b57600080fd5b505af115801561272f573d6000803e3d6000fd5b505050505050505b600160975561294f565b60655460ff16156127645760405162461bcd60e51b815260040161064390614567565b60dd5460d65410156127c1576201518060d95460d75460d854426127889190614715565b61279291906146f6565b61279c91906146f6565b6127a691906146e2565b60d660008282546127b791906146ca565b90915550504260d8555b600260975414156127e45760405162461bcd60e51b81526004016106439061465c565b6002609755333281146128095760405162461bcd60e51b815260040161064390614519565b60008060005b8681101561288b5761282c888883818110611c9c57611c9c6147c0565b15612857576128468888838181106125e7576125e76147c0565b61285090836146ca565b9150612879565b61286c88888381811061262c5761262c6147c0565b61287690846146ca565b92505b806128838161474f565b91505061280f565b5061289f606460db548361267e91906146f6565b606460db5460646128b09190614715565b6128ba90836146f6565b6128c491906146e2565b90506128d081836146ca565b9150816128df57505050612949565b60ca546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b15801561292d57600080fd5b505af1158015612941573d6000803e3d6000fd5b505050505050505b60016097555b50505050565b6060323314612a495733600090815260cd602052604090205460ff1661298d5760405162461bcd60e51b8152600401610643906145df565b6001600160a01b038216600090815260d060205260408120906129af82613b43565b67ffffffffffffffff8111156129c7576129c76147d6565b6040519080825280602002602001820160405280156129f0578160200160208202803683370190505b50905060005b6129ff83613b43565b811015612a3f57612a108382613b4d565b828281518110612a2257612a226147c0565b602090810291909101015280612a378161474f565b9150506129f6565b5091506106ce9050565b6001600160a01b038216600090815260d06020526040812090612a6b82613b43565b67ffffffffffffffff811115612a8357612a836147d6565b604051908082528060200260200182016040528015612aac578160200160208202803683370190505b50905060005b612abb83613b43565b811015611ddb57612acc8382613b4d565b828281518110612ade57612ade6147c0565b602090810291909101015280612af38161474f565b915050612ab2565b6033546001600160a01b03163314612b255760405162461bcd60e51b815260040161064390614627565b60d955565b6033546001600160a01b03163314612b545760405162461bcd60e51b815260040161064390614627565b6001600160a01b038116612bb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610643565b61078581612eb9565b600054610100900460ff1680612bdb575060005460ff16155b612bf75760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015612c19576000805461ffff19166101011790555b612c21613b59565b612c29613bd4565b612c31613c33565b60c980546001600160a01b03199081166001600160a01b038881169190911790925560ca8054821687841617905560cc805460cb805490931686851617909255600060d381905560d481905560d5556b07c13bc4b2c133c56000000060dd5560de8054600860ff19909116179055600660df5568056bc75e2d6310000060d9556202a30060da55601960db55680ad78ebc5ac620000060dc559185166001600160a81b03199091161790558015612cee576000805461ff00191690555b5050505050565b60655460ff1615612d185760405162461bcd60e51b815260040161064390614567565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d4d3390565b6040516001600160a01b03909116815260200160405180910390a1565b60655460ff16612db35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610643565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612d4d565b60cb546040516371d4ed8d60e11b81526001600160a01b038381166004830152600092839291169063e3a9db1a9060240160006040518083038186803b158015612e2d57600080fd5b505afa158015612e41573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e699190810190614306565b9050805160001415612e7e5750600092915050565b60008151600a612e8e91906146f6565b612e999060286146ca565b905060648110610acd575060649392505050565b6000610acd8383613c9a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60dd5460d6541015612f68576201518060d95460d75460d85442612f2f9190614715565b612f3991906146f6565b612f4391906146f6565b612f4d91906146e2565b60d66000828254612f5e91906146ca565b90915550504260d8555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260ce9093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b0319909316941693909317179390931692909217905560d7805460019290612ffd9084906146ca565b9091555050604080516001600160a01b03841681526020810183905242918101919091527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d2906060015b60405180910390a16001600160a01b038216600090815260d0602052604090206124a79082613d8d565b60dd5460d65410156130ce576201518060d95460d75460d854426130959190614715565b61309f91906146f6565b6130a991906146f6565b6130b391906146e2565b60d660008282546130c491906146ca565b90915550504260d8555b60df5460d360008282546130e291906146ca565b909155505060df8054600090815260cf602081815260408084205486855260d18352818520559354835290815282822083516060808201865261ffff808816835260d580546001600160501b039081168588019081526001600160a01b038c8116878c018181528954600181018b55998c529a8a9020975197909801805492519a51979095166001600160601b031990921691909117620100009990921698909802176001600160601b0316600160601b949097169390930295909517909455548451918252918101859052928301527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d29101613047565b600082815260ce602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b0316908201819052339190821461324a5760405162461bcd60e51b81526004016106439061453b565b326001600160a01b038316146132725760405162461bcd60e51b815260040161064390614519565b6001600160a01b0382163b1561329a5760405162461bcd60e51b815260040161064390614693565b8380156132bf575060da5460208201516132bd906001600160501b031642614715565b105b1561331c5760405162461bcd60e51b815260206004820152602760248201527f4e6565642032206461797320776f727468206f662024674865616420616363756044820152661b5d5b185d195960ca1b6064820152608401610643565b613326858361189a565b925083156134e457600085815260d2602052604081208054916133488361474f565b909155505060cc54604051634b20b5d960e11b8152600481018790526000916001600160a01b0316906396416bb29060240160206040518083038186803b15801561339257600080fd5b505afa1580156133a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ca9190614442565b600087815260d2602090815260408083205481519283018590529082018a90526060820152919250906080016040516020818303038152906040528051906020012060001c9050806001166001141561342b5761342685613aea565b600094505b600087815260ce6020526040812081905560d780546001929061344f908490614715565b90915550506001600160a01b038416600090815260d0602052604090206134769088612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde906134ab90309088908c906004016144a2565b600060405180830381600087803b1580156134c557600080fd5b505af11580156134d9573d6000803e3d6000fd5b50505050505061356a565b6040805160608101825261ffff8781168252426001600160501b0390811660208085019182526001600160a01b0388811686880190815260008d815260ce90935296909120945185549251965194166001600160601b031990921691909117620100009590921694909402176001600160601b0316600160601b91909316029190911790555b6040805186815260208101859052851515918101919091527fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e5333906060015b60405180910390a1505092915050565b60df54600090815260cf6020908152604080832085845260d1909252822054815433928492909181106135ed576135ed6147c0565b600091825260209182902060408051606081018252929091015461ffff811683526001600160501b0362010000820416938301939093526001600160a01b03600160601b90930483168282015260c95490516331a9108f60e11b81526004810189905291935030921690636352211e9060240160206040518083038186803b15801561367857600080fd5b505afa15801561368c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136b0919061402a565b6001600160a01b0316146137065760405162461bcd60e51b815260206004820152601760248201527f41494e5420412050415254204f4620544845205041434b0000000000000000006044820152606401610643565b816001600160a01b031681604001516001600160a01b03161461373b5760405162461bcd60e51b81526004016106439061453b565b326001600160a01b038316146137635760405162461bcd60e51b815260040161064390614519565b6001600160a01b0382163b156137c55760405162461bcd60e51b815260206004820152602160248201527f436f6e74726163747320617265206e6f7420616c6c6f77656420626967206d616044820152603760f91b6064820152608401610643565b6137ce856109ff565b925083156139d55760df5460d360008282546137ea9190614715565b909155505060df54600090815260cf60205260408120805461380e90600190614715565b8154811061381e5761381e6147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf82528084208a855260d19092529092205482549193508392918110613893576138936147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905589835260d1815283832054855190921683528383209190915560df54825260cf905220805480613921576139216147aa565b60008281526020808220830160001990810183905590920190925587825260d1815260408083208390556001600160a01b038616835260d090915290206139689087612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde9061399d90309087908b906004016144a2565b600060405180830381600087803b1580156139b757600080fd5b505af11580156139cb573d6000803e3d6000fd5b5050505050613aa8565b60405180606001604052808661ffff16815260200160d5546001600160501b03168152602001836001600160a01b031681525060cf600060df54815260200190815260200160002060d160008881526020019081526020016000205481548110613a4157613a416147c0565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b6040805186815260208101859052851515918101919091527fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f906060016135a8565b60d354613b0b578060d46000828254613b0391906146ca565b909155505050565b60d35460d454613b1b90836146ca565b613b2591906146e2565b60d56000828254613b3691906146ca565b9091555050600060d45550565b60006106c8825490565b6000610acd8383613d99565b600054610100900460ff1680613b72575060005460ff16155b613b8e5760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613bb0576000805461ffff19166101011790555b613bb8613dc3565b613bc0613e2d565b8015610785576000805461ff001916905550565b600054610100900460ff1680613bed575060005460ff16155b613c095760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613c2b576000805461ffff19166101011790555b613bc0613e8d565b600054610100900460ff1680613c4c575060005460ff16155b613c685760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613c8a576000805461ffff19166101011790555b613c92613dc3565b613bc0613efd565b60008181526001830160205260408120548015613d83576000613cbe600183614715565b8554909150600090613cd290600190614715565b9050818114613d37576000866000018281548110613cf257613cf26147c0565b9060005260206000200154905080876000018481548110613d1557613d156147c0565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613d4857613d486147aa565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106c8565b60009150506106c8565b6000610acd8383613f72565b6000826000018281548110613db057613db06147c0565b9060005260206000200154905092915050565b600054610100900460ff1680613ddc575060005460ff16155b613df85760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613bc0576000805461ffff19166101011790558015610785576000805461ff001916905550565b600054610100900460ff1680613e46575060005460ff16155b613e625760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613e84576000805461ffff19166101011790555b613bc033612eb9565b600054610100900460ff1680613ea6575060005460ff16155b613ec25760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613ee4576000805461ffff19166101011790555b60016097558015610785576000805461ff001916905550565b600054610100900460ff1680613f16575060005460ff16155b613f325760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613f54576000805461ffff19166101011790555b6065805460ff191690558015610785576000805461ff001916905550565b6000818152600183016020526040812054613fb9575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106c8565b5060006106c8565b60008083601f840112613fd357600080fd5b50813567ffffffffffffffff811115613feb57600080fd5b6020830191508360208260051b850101111561400657600080fd5b9250929050565b60006020828403121561401f57600080fd5b8135610acd816147ec565b60006020828403121561403c57600080fd5b8151610acd816147ec565b60008060006060848603121561405c57600080fd5b8335614067816147ec565b92506020840135614077816147ec565b91506040840135614087816147ec565b809150509250925092565b600080600080608085870312156140a857600080fd5b84356140b3816147ec565b935060208501356140c3816147ec565b925060408501356140d3816147ec565b915060608501356140e3816147ec565b939692955090935050565b60008060008060006080868803121561410657600080fd5b8535614111816147ec565b94506020860135614121816147ec565b935060408601359250606086013567ffffffffffffffff8082111561414557600080fd5b818801915088601f83011261415957600080fd5b81358181111561416857600080fd5b89602082850101111561417a57600080fd5b9699959850939650602001949392505050565b6000806000604084860312156141a257600080fd5b83356141ad816147ec565b9250602084013567ffffffffffffffff8111156141c957600080fd5b6141d586828701613fc1565b9497909650939450505050565b600080604083850312156141f557600080fd5b8235614200816147ec565b9150602083013561421081614801565b809150509250929050565b60008060006040848603121561423057600080fd5b833567ffffffffffffffff81111561424757600080fd5b61425386828701613fc1565b9094509250506020840135614087816147ec565b6000806000806060858703121561427d57600080fd5b843567ffffffffffffffff81111561429457600080fd5b6142a087828801613fc1565b90955093505060208501356142b481614801565b915060408501356140e381614801565b600080602083850312156142d757600080fd5b823567ffffffffffffffff8111156142ee57600080fd5b6142fa85828601613fc1565b90969095509350505050565b6000602080838503121561431957600080fd5b825167ffffffffffffffff8082111561433157600080fd5b818501915085601f83011261434557600080fd5b815181811115614357576143576147d6565b8060051b604051601f19603f8301168101818110858211171561437c5761437c6147d6565b604052828152858101935084860182860187018a101561439b57600080fd5b600095505b838610156143be5780518552600195909501949386019386016143a0565b5098975050505050505050565b6000602082840312156143dd57600080fd5b8135610acd81614801565b6000602082840312156143fa57600080fd5b8151610acd81614801565b60006020828403121561441757600080fd5b813561ffff81168114610acd57600080fd5b60006020828403121561443b57600080fd5b5035919050565b60006020828403121561445457600080fd5b5051919050565b6000806040838503121561446e57600080fd5b823591506020830135614210816147ec565b6000806040838503121561449357600080fd5b50508035926020909101359150565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b6020808252825182820181905260009190848201906040850190845b8181101561450d578351835292840192918401916001016144f1565b50909695505050505050565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b6020808252601290820152715357495045522c204e4f2053574950494e4760701b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526028908201527f596f75277265206e6f7420616c6c6f77656420746f2063616c6c207468697320604082015267333ab731ba34b7b760c11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526019908201527f436f6e74726163747320617265206e6f7420616c6c6f77656400000000000000604082015260600190565b600082198211156146dd576146dd61477e565b500190565b6000826146f1576146f1614794565b500490565b60008160001904831182151516156147105761471061477e565b500290565b6000828210156147275761472761477e565b500390565b600060ff821660ff8416808210156147465761474661477e565b90039392505050565b60006000198214156147635761476361477e565b5060010190565b60008261477957614779614794565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461078557600080fd5b801515811461078557600080fdfea2646970667358221220e2b0e53e7b90167807d75b37370208582e19d26d5e1460a5ebe180aa2772ed4f64736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80637a93feb91161015c578063c4601f56116100ce578063dbdc1f6b11610087578063dbdc1f6b1461058c578063dfeef91b1461059f578063e3a9db1a146105b2578063ec0767bf146105d2578063f2fde38b146105e5578063f8c8765e146105f857600080fd5b8063c4601f5614610525578063cac8d5381461052d578063ce84291214610540578063cedb363b14610553578063d6bd632e14610566578063d7c97fb41461057957600080fd5b8063a447519911610120578063a4475199146104c6578063a8f6c913146104cf578063abf4f3a5146104e2578063baabc2c2146104eb578063beeb7e5b1461050a578063c0c472c01461051d57600080fd5b80637a93feb91461047e5780637ce522d0146104875780638abb20cc1461049a5780638da5cb5b146104ad578063940d41c0146104be57600080fd5b80634328ee66116101f5578063607af397116101b9578063607af397146104155780636a3ef0571461041d5780636f234fb5146104305780636fde344014610450578063715018a614610463578063765310081461046b57600080fd5b80634328ee661461038d57806356942d9d146103a05780635c74a42c146103b35780635c975abb146103f75780635fb64a6a1461040257600080fd5b80631aace9b7116102475780631aace9b71461030d5780632fb641c91461033857806339db714f1461034b5780633bbba0781461035f5780634191adfb1461036757806342174b201461037a57600080fd5b80630b999fe3146102845780630f7f5ce2146102ac5780631078c88b146102c3578063150b7a02146102cc57806316c38b3c146102f8575b600080fd5b610297610292366004614429565b61060b565b60405190151581526020015b60405180910390f35b6102b560dd5481565b6040519081526020016102a3565b6102b560d95481565b6102df6102da3660046140ee565b6106d3565b6040516001600160e01b031990911681526020016102a3565b61030b6103063660046143cb565b61074d565b005b61032061031b366004614429565b610790565b6040516001600160a01b0390911681526020016102a3565b61030b610346366004614047565b610957565b60cc5461029790600160a01b900460ff1681565b6102b56109c0565b60cb54610320906001600160a01b031681565b6102b5610388366004614429565b6109ff565b6102b561039b36600461400d565b610ad4565b61030b6103ae366004614429565b610adf565b6103c66103c1366004614480565b610b0e565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b0316908201526060016102a3565b60655460ff16610297565b61030b61041036600461400d565b610b61565b6102b5610bad565b61030b61042b3660046142c4565b610bec565b6102b561043e366004614429565b60d16020526000908152604090205481565b61030b61045e366004614429565b611733565b61030b611762565b61030b6104793660046143cb565b611798565b6102b560db5481565b61030b610495366004614429565b6117e0565b61030b6104a836600461400d565b61180f565b6033546001600160a01b0316610320565b6102b561185b565b6102b560dc5481565b60ca54610320906001600160a01b031681565b6102b560da5481565b60de546104f89060ff1681565b60405160ff90911681526020016102a3565b6102b561051836600461445b565b61189a565b6102b5611b25565b6102b5611b64565b61030b61053b36600461400d565b611ba3565b60cc54610320906001600160a01b031681565b61030b6105613660046141e2565b611bef565b6102b561057436600461421b565b611c44565b60c954610320906001600160a01b031681565b61030b61059a36600461418d565b611de3565b61030b6105ad366004614267565b6124ac565b6105c56105c036600461400d565b612955565b6040516102a391906144d5565b61030b6105e0366004614429565b612afb565b61030b6105f336600461400d565b612b2a565b61030b610606366004614092565b612bc2565b600032331461064c5733600090815260cd602052604090205460ff1661064c5760405162461bcd60e51b8152600401610643906145df565b60405180910390fd5b60c9546040516394e5684760e01b8152600481018490526001600160a01b03909116906394e568479060240160206040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c891906143e8565b92915050565b919050565b60006001600160a01b0385161561073b5760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f742073656e6420746f6b656e7320746f207374616b696e67206469604482015265726563746c7960d01b6064820152608401610643565b50630a85bd0160e11b95945050505050565b6033546001600160a01b031633146107775760405162461bcd60e51b815260040161064390614627565b801561078857610785612cf5565b50565b610785612d6a565b60003233146108c05733600090815260cd602052604090205460ff166107c85760405162461bcd60e51b8152600401610643906145df565b60d3546107d757506000919050565b600060d3548363ffffffff166107ed919061476a565b60de5460209490941c93909150600090819061080e9060039060ff1661472c565b60ff1690505b60de5460ff1681116108b557600081815260cf602052604090205461083a9082906146f6565b61084490836146ca565b9150818310610852576108a3565b600081815260cf60205260409020805461086c908761476a565b8154811061087c5761087c6147c0565b600091825260209091200154600160601b90046001600160a01b031693506106ce92505050565b806108ad8161474f565b915050610814565b506000949350505050565b60d3546108cf57506000919050565b600060d3548363ffffffff166108e5919061476a565b60de5460209490941c9390915060009081906109069060039060ff1661472c565b60ff1690505b60de5460ff1681116108b557600081815260cf60205260409020546109329082906146f6565b61093c90836146ca565b9150818310610852578061094f8161474f565b91505061090c565b6033546001600160a01b031633146109815760405162461bcd60e51b815260040161064390614627565b60c980546001600160a01b039485166001600160a01b03199182161790915560ca80549385169382169390931790925560cc8054919093169116179055565b60003233146109f85733600090815260cd602052604090205460ff166109f85760405162461bcd60e51b8152600401610643906145df565b5060d75490565b6000323314610a375733600090815260cd602052604090205460ff16610a375760405162461bcd60e51b8152600401610643906145df565b60df54600090815260cf6020908152604080832085845260d190925282205481548110610a6657610a666147c0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b0316938301849052600160601b90046001600160a01b03169082015260d554909250610ac09190614715565b60df54610acd91906146f6565b9392505050565b60006106c882612de4565b6033546001600160a01b03163314610b095760405162461bcd60e51b815260040161064390614627565b60db55565b60cf6020528160005260406000208181548110610b2a57600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b6033546001600160a01b03163314610b8b5760405162461bcd60e51b815260040161064390614627565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b6000323314610be55733600090815260cd602052604090205460ff16610be55760405162461bcd60e51b8152600401610643906145df565b5060d85490565b3233146111ab5733600090815260cd602052604090205460ff16610c225760405162461bcd60e51b8152600401610643906145df565b60026097541415610c455760405162461bcd60e51b81526004016106439061465c565b600260975533803b15610c6a5760405162461bcd60e51b815260040161064390614693565b326001600160a01b03821614610c925760405162461bcd60e51b815260040161064390614519565b60cc54600160a01b900460ff16610cdd5760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610643565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052825b8581101561119b57868682818110610d2c57610d2c6147c0565b905060200201359350610d3e8461060b565b15610ead57600084815260ce60209081526040918290208251606081018452905461ffff811682526001600160501b0362010000820416928201929092526001600160a01b03600160601b90920482169281018390529450861614610db55760405162461bcd60e51b81526004016106439061453b565b600084815260ce6020526040812081905560d7805460019290610dd9908490614715565b90915550506001600160a01b038516600090815260d060205260409020610e009085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde90610e35903090899089906004016144a2565b600060405180830381600087803b158015610e4f57600080fd5b505af1158015610e63573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e53339350908190036060019150a1611189565b60df54600090815260cf6020908152604080832087845260d19092529091205481548110610edd57610edd6147c0565b600091825260209182902060408051606081018252919092015461ffff811682526001600160501b0362010000820416938201939093526001600160a01b03600160601b9093048316918101829052945090861614610f4e5760405162461bcd60e51b81526004016106439061453b565b60df5460d36000828254610f629190614715565b909155505060df54600090815260cf602052604090208054610f8690600190614715565b81548110610f9657610f966147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf825280842088855260d1909252909220548254919450849291811061100b5761100b6147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905587835260d1815283832054865190921683528383209190915560df54825260cf905220805480611099576110996147aa565b60008281526020808220830160001990810183905590920190925585825260d1815260408083208390556001600160a01b038816835260d090915290206110e09085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde90611115903090899089906004016144a2565b600060405180830381600087803b15801561112f57600080fd5b505af1158015611143573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f9350908190036060019150a15b806111938161474f565b915050610d12565b505060016097555061172f915050565b600260975414156111ce5760405162461bcd60e51b81526004016106439061465c565b600260975533803b156111f35760405162461bcd60e51b815260040161064390614693565b326001600160a01b0382161461121b5760405162461bcd60e51b815260040161064390614519565b60cc54600160a01b900460ff166112665760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610643565b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101839052825b85811015611724578686828181106112b5576112b56147c0565b9050602002013593506112c78461060b565b1561143657600084815260ce60209081526040918290208251606081018452905461ffff811682526001600160501b0362010000820416928201929092526001600160a01b03600160601b9092048216928101839052945086161461133e5760405162461bcd60e51b81526004016106439061453b565b600084815260ce6020526040812081905560d7805460019290611362908490614715565b90915550506001600160a01b038516600090815260d0602052604090206113899085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde906113be903090899089906004016144a2565b600060405180830381600087803b1580156113d857600080fd5b505af11580156113ec573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e53339350908190036060019150a1611712565b60df54600090815260cf6020908152604080832087845260d19092529091205481548110611466576114666147c0565b600091825260209182902060408051606081018252919092015461ffff811682526001600160501b0362010000820416938201939093526001600160a01b03600160601b90930483169181018290529450908616146114d75760405162461bcd60e51b81526004016106439061453b565b60df5460d360008282546114eb9190614715565b909155505060df54600090815260cf60205260409020805461150f90600190614715565b8154811061151f5761151f6147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf825280842088855260d19092529092205482549194508492918110611594576115946147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905587835260d1815283832054865190921683528383209190915560df54825260cf905220805480611622576116226147aa565b60008281526020808220830160001990810183905590920190925585825260d1815260408083208390556001600160a01b038816835260d090915290206116699085612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde9061169e903090899089906004016144a2565b600060405180830381600087803b1580156116b857600080fd5b505af11580156116cc573d6000803e3d6000fd5b5050604080518781526000602082015260018183015290517fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f9350908190036060019150a15b8061171c8161474f565b91505061129b565b505060016097555050505b5050565b6033546001600160a01b0316331461175d5760405162461bcd60e51b815260040161064390614627565b60dd55565b6033546001600160a01b0316331461178c5760405162461bcd60e51b815260040161064390614627565b6117966000612eb9565b565b6033546001600160a01b031633146117c25760405162461bcd60e51b815260040161064390614627565b60cc8054911515600160a01b0260ff60a01b19909216919091179055565b6033546001600160a01b0316331461180a5760405162461bcd60e51b815260040161064390614627565b60da55565b6033546001600160a01b031633146118395760405162461bcd60e51b815260040161064390614627565b60cc80546001600160a01b0319166001600160a01b0392909216919091179055565b60003233146118935733600090815260cd602052604090205460ff166118935760405162461bcd60e51b8152600401610643906145df565b5060d65490565b60003233146119fb5733600090815260cd602052604090205460ff166118d25760405162461bcd60e51b8152600401610643906145df565b60006118dd83612de4565b6118ef90670de0b6b3a76400006146f6565b905060008160d95461190191906146ca565b600086815260ce60209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181019190915260dd5460d6549293509091101561199c57620151808282602001516001600160501b0316426119819190614715565b61198b91906146f6565b61199591906146e2565b93506119f3565b60d85481602001516001600160501b031611156119bc57600093506119f3565b620151808282602001516001600160501b031660d8546119dc9190614715565b6119e691906146f6565b6119f091906146e2565b93505b5050506106c8565b6000611a0683612de4565b611a1890670de0b6b3a76400006146f6565b905060008160d954611a2a91906146ca565b600086815260ce60209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181019190915260dd5460d65492935090911015611ac557620151808282602001516001600160501b031642611aaa9190614715565b611ab491906146f6565b611abe91906146e2565b9350611b1c565b60d85481602001516001600160501b03161115611ae55760009350611b1c565b620151808282602001516001600160501b031660d854611b059190614715565b611b0f91906146f6565b611b1991906146e2565b93505b50505092915050565b6000323314611b5d5733600090815260cd602052604090205460ff16611b5d5760405162461bcd60e51b8152600401610643906145df565b5060d45490565b6000323314611b9c5733600090815260cd602052604090205460ff16611b9c5760405162461bcd60e51b8152600401610643906145df565b5060d55490565b6033546001600160a01b03163314611bcd5760405162461bcd60e51b815260040161064390614627565b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314611c195760405162461bcd60e51b815260040161064390614627565b6001600160a01b0391909116600090815260cd60205260409020805460ff1916911515919091179055565b6000323314611d5c5733600090815260cd602052604090205460ff16611c7c5760405162461bcd60e51b8152600401610643906145df565b60005b83811015611d5657611cba858583818110611c9c57611c9c6147c0565b9050602002016020810190611cb19190614405565b61ffff1661060b565b15611d0457611cf3858583818110611cd457611cd46147c0565b9050602002016020810190611ce99190614405565b61ffff168461189a565b611cfd90836146ca565b9150611d44565b611d37858583818110611d1957611d196147c0565b9050602002016020810190611d2e9190614405565b61ffff166109ff565b611d4190836146ca565b91505b80611d4e8161474f565b915050611c7f565b50610acd565b60005b83811015611ddb57611d7c858583818110611c9c57611c9c6147c0565b15611da757611d96858583818110611cd457611cd46147c0565b611da090836146ca565b9150611dc9565b611dbc858583818110611d1957611d196147c0565b611dc690836146ca565b91505b80611dd38161474f565b915050611d5f565b509392505050565b3233146121845733600090815260cd602052604090205460ff16611e195760405162461bcd60e51b8152600401610643906145df565b60655460ff1615611e3c5760405162461bcd60e51b815260040161064390614567565b60026097541415611e5f5760405162461bcd60e51b81526004016106439061465c565b6002609755336001600160a01b038416811480611e89575060c9546001600160a01b038281169116145b80611ea1575060cc546001600160a01b038281169116145b611eed5760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610643565b60005b828110156121785760cc546001600160a01b038381169116146120ab5760c9546001600160a01b038084169116636352211e868685818110611f3457611f346147c0565b9050602002016020810190611f499190614405565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b158015611f8357600080fd5b505afa158015611f97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbb919061402a565b6001600160a01b0316146120015760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610643565b60c9546001600160a01b03166323b872dd8330878786818110612026576120266147c0565b905060200201602081019061203b9190614405565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b15801561208e57600080fd5b505af11580156120a2573d6000803e3d6000fd5b505050506120df565b8383828181106120bd576120bd6147c0565b90506020020160208101906120d29190614405565b61ffff166120df57612166565b6120f4848483818110611c9c57611c9c6147c0565b156121325761212d8585858481811061210f5761210f6147c0565b90506020020160208101906121249190614405565b61ffff16612f0b565b612166565b61216685858584818110612148576121486147c0565b905060200201602081019061215d9190614405565b61ffff16613071565b806121708161474f565b915050611ef0565b50506001609755505050565b60655460ff16156121a75760405162461bcd60e51b815260040161064390614567565b600260975414156121ca5760405162461bcd60e51b81526004016106439061465c565b6002609755336001600160a01b0384168114806121f4575060c9546001600160a01b038281169116145b8061220c575060cc546001600160a01b038281169116145b6122585760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610643565b60005b828110156121785760cc546001600160a01b038381169116146124165760c9546001600160a01b038084169116636352211e86868581811061229f5761229f6147c0565b90506020020160208101906122b49190614405565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b1580156122ee57600080fd5b505afa158015612302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612326919061402a565b6001600160a01b03161461236c5760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610643565b60c9546001600160a01b03166323b872dd8330878786818110612391576123916147c0565b90506020020160208101906123a69190614405565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b1580156123f957600080fd5b505af115801561240d573d6000803e3d6000fd5b5050505061244a565b838382818110612428576124286147c0565b905060200201602081019061243d9190614405565b61ffff1661244a57612495565b61245f848483818110611c9c57611c9c6147c0565b1561247f5761247a8585858481811061210f5761210f6147c0565b612495565b61249585858584818110612148576121486147c0565b8061249f8161474f565b91505061225b565b505050565b3233146127415733600090815260cd602052604090205460ff166124e25760405162461bcd60e51b8152600401610643906145df565b60655460ff16156125055760405162461bcd60e51b815260040161064390614567565b60dd5460d6541015612562576201518060d95460d75460d854426125299190614715565b61253391906146f6565b61253d91906146f6565b61254791906146e2565b60d6600082825461255891906146ca565b90915550504260d8555b600260975414156125855760405162461bcd60e51b81526004016106439061465c565b6002609755333281146125aa5760405162461bcd60e51b815260040161064390614519565b60008060005b8681101561266a576125cd888883818110611c9c57611c9c6147c0565b15612617576126068888838181106125e7576125e76147c0565b90506020020160208101906125fc9190614405565b61ffff16876131da565b61261090836146ca565b9150612658565b61264b88888381811061262c5761262c6147c0565b90506020020160208101906126419190614405565b61ffff16876135b8565b61265590846146ca565b92505b806126628161474f565b9150506125b0565b5061268d606460db548361267e91906146f6565b61268891906146e2565b613aea565b606460db54606461269e9190614715565b6126a890836146f6565b6126b291906146e2565b90506126be81836146ca565b9150816126cd57505050612737565b60ca546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b15801561271b57600080fd5b505af115801561272f573d6000803e3d6000fd5b505050505050505b600160975561294f565b60655460ff16156127645760405162461bcd60e51b815260040161064390614567565b60dd5460d65410156127c1576201518060d95460d75460d854426127889190614715565b61279291906146f6565b61279c91906146f6565b6127a691906146e2565b60d660008282546127b791906146ca565b90915550504260d8555b600260975414156127e45760405162461bcd60e51b81526004016106439061465c565b6002609755333281146128095760405162461bcd60e51b815260040161064390614519565b60008060005b8681101561288b5761282c888883818110611c9c57611c9c6147c0565b15612857576128468888838181106125e7576125e76147c0565b61285090836146ca565b9150612879565b61286c88888381811061262c5761262c6147c0565b61287690846146ca565b92505b806128838161474f565b91505061280f565b5061289f606460db548361267e91906146f6565b606460db5460646128b09190614715565b6128ba90836146f6565b6128c491906146e2565b90506128d081836146ca565b9150816128df57505050612949565b60ca546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b15801561292d57600080fd5b505af1158015612941573d6000803e3d6000fd5b505050505050505b60016097555b50505050565b6060323314612a495733600090815260cd602052604090205460ff1661298d5760405162461bcd60e51b8152600401610643906145df565b6001600160a01b038216600090815260d060205260408120906129af82613b43565b67ffffffffffffffff8111156129c7576129c76147d6565b6040519080825280602002602001820160405280156129f0578160200160208202803683370190505b50905060005b6129ff83613b43565b811015612a3f57612a108382613b4d565b828281518110612a2257612a226147c0565b602090810291909101015280612a378161474f565b9150506129f6565b5091506106ce9050565b6001600160a01b038216600090815260d06020526040812090612a6b82613b43565b67ffffffffffffffff811115612a8357612a836147d6565b604051908082528060200260200182016040528015612aac578160200160208202803683370190505b50905060005b612abb83613b43565b811015611ddb57612acc8382613b4d565b828281518110612ade57612ade6147c0565b602090810291909101015280612af38161474f565b915050612ab2565b6033546001600160a01b03163314612b255760405162461bcd60e51b815260040161064390614627565b60d955565b6033546001600160a01b03163314612b545760405162461bcd60e51b815260040161064390614627565b6001600160a01b038116612bb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610643565b61078581612eb9565b600054610100900460ff1680612bdb575060005460ff16155b612bf75760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015612c19576000805461ffff19166101011790555b612c21613b59565b612c29613bd4565b612c31613c33565b60c980546001600160a01b03199081166001600160a01b038881169190911790925560ca8054821687841617905560cc805460cb805490931686851617909255600060d381905560d481905560d5556b07c13bc4b2c133c56000000060dd5560de8054600860ff19909116179055600660df5568056bc75e2d6310000060d9556202a30060da55601960db55680ad78ebc5ac620000060dc559185166001600160a81b03199091161790558015612cee576000805461ff00191690555b5050505050565b60655460ff1615612d185760405162461bcd60e51b815260040161064390614567565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d4d3390565b6040516001600160a01b03909116815260200160405180910390a1565b60655460ff16612db35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610643565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612d4d565b60cb546040516371d4ed8d60e11b81526001600160a01b038381166004830152600092839291169063e3a9db1a9060240160006040518083038186803b158015612e2d57600080fd5b505afa158015612e41573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e699190810190614306565b9050805160001415612e7e5750600092915050565b60008151600a612e8e91906146f6565b612e999060286146ca565b905060648110610acd575060649392505050565b6000610acd8383613c9a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60dd5460d6541015612f68576201518060d95460d75460d85442612f2f9190614715565b612f3991906146f6565b612f4391906146f6565b612f4d91906146e2565b60d66000828254612f5e91906146ca565b90915550504260d8555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260ce9093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b0319909316941693909317179390931692909217905560d7805460019290612ffd9084906146ca565b9091555050604080516001600160a01b03841681526020810183905242918101919091527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d2906060015b60405180910390a16001600160a01b038216600090815260d0602052604090206124a79082613d8d565b60dd5460d65410156130ce576201518060d95460d75460d854426130959190614715565b61309f91906146f6565b6130a991906146f6565b6130b391906146e2565b60d660008282546130c491906146ca565b90915550504260d8555b60df5460d360008282546130e291906146ca565b909155505060df8054600090815260cf602081815260408084205486855260d18352818520559354835290815282822083516060808201865261ffff808816835260d580546001600160501b039081168588019081526001600160a01b038c8116878c018181528954600181018b55998c529a8a9020975197909801805492519a51979095166001600160601b031990921691909117620100009990921698909802176001600160601b0316600160601b949097169390930295909517909455548451918252918101859052928301527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d29101613047565b600082815260ce602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b0316908201819052339190821461324a5760405162461bcd60e51b81526004016106439061453b565b326001600160a01b038316146132725760405162461bcd60e51b815260040161064390614519565b6001600160a01b0382163b1561329a5760405162461bcd60e51b815260040161064390614693565b8380156132bf575060da5460208201516132bd906001600160501b031642614715565b105b1561331c5760405162461bcd60e51b815260206004820152602760248201527f4e6565642032206461797320776f727468206f662024674865616420616363756044820152661b5d5b185d195960ca1b6064820152608401610643565b613326858361189a565b925083156134e457600085815260d2602052604081208054916133488361474f565b909155505060cc54604051634b20b5d960e11b8152600481018790526000916001600160a01b0316906396416bb29060240160206040518083038186803b15801561339257600080fd5b505afa1580156133a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ca9190614442565b600087815260d2602090815260408083205481519283018590529082018a90526060820152919250906080016040516020818303038152906040528051906020012060001c9050806001166001141561342b5761342685613aea565b600094505b600087815260ce6020526040812081905560d780546001929061344f908490614715565b90915550506001600160a01b038416600090815260d0602052604090206134769088612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde906134ab90309088908c906004016144a2565b600060405180830381600087803b1580156134c557600080fd5b505af11580156134d9573d6000803e3d6000fd5b50505050505061356a565b6040805160608101825261ffff8781168252426001600160501b0390811660208085019182526001600160a01b0388811686880190815260008d815260ce90935296909120945185549251965194166001600160601b031990921691909117620100009590921694909402176001600160601b0316600160601b91909316029190911790555b6040805186815260208101859052851515918101919091527fb07a7c84badacf6c35c1af1e5b1b7fe78b3598af4e9479f13c7c9dfa7c7e5333906060015b60405180910390a1505092915050565b60df54600090815260cf6020908152604080832085845260d1909252822054815433928492909181106135ed576135ed6147c0565b600091825260209182902060408051606081018252929091015461ffff811683526001600160501b0362010000820416938301939093526001600160a01b03600160601b90930483168282015260c95490516331a9108f60e11b81526004810189905291935030921690636352211e9060240160206040518083038186803b15801561367857600080fd5b505afa15801561368c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136b0919061402a565b6001600160a01b0316146137065760405162461bcd60e51b815260206004820152601760248201527f41494e5420412050415254204f4620544845205041434b0000000000000000006044820152606401610643565b816001600160a01b031681604001516001600160a01b03161461373b5760405162461bcd60e51b81526004016106439061453b565b326001600160a01b038316146137635760405162461bcd60e51b815260040161064390614519565b6001600160a01b0382163b156137c55760405162461bcd60e51b815260206004820152602160248201527f436f6e74726163747320617265206e6f7420616c6c6f77656420626967206d616044820152603760f91b6064820152608401610643565b6137ce856109ff565b925083156139d55760df5460d360008282546137ea9190614715565b909155505060df54600090815260cf60205260408120805461380e90600190614715565b8154811061381e5761381e6147c0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015260df54845260cf82528084208a855260d19092529092205482549193508392918110613893576138936147c0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff96871617929092171617905589835260d1815283832054855190921683528383209190915560df54825260cf905220805480613921576139216147aa565b60008281526020808220830160001990810183905590920190925587825260d1815260408083208390556001600160a01b038616835260d090915290206139689087612ead565b5060c954604051635c46a7ef60e11b81526001600160a01b039091169063b88d4fde9061399d90309087908b906004016144a2565b600060405180830381600087803b1580156139b757600080fd5b505af11580156139cb573d6000803e3d6000fd5b5050505050613aa8565b60405180606001604052808661ffff16815260200160d5546001600160501b03168152602001836001600160a01b031681525060cf600060df54815260200190815260200160002060d160008881526020019081526020016000205481548110613a4157613a416147c0565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b6040805186815260208101859052851515918101919091527fab26c19bf9d4df384ad1254328cb49b07bfd0223137b1fff90b1e1eb1956950f906060016135a8565b60d354613b0b578060d46000828254613b0391906146ca565b909155505050565b60d35460d454613b1b90836146ca565b613b2591906146e2565b60d56000828254613b3691906146ca565b9091555050600060d45550565b60006106c8825490565b6000610acd8383613d99565b600054610100900460ff1680613b72575060005460ff16155b613b8e5760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613bb0576000805461ffff19166101011790555b613bb8613dc3565b613bc0613e2d565b8015610785576000805461ff001916905550565b600054610100900460ff1680613bed575060005460ff16155b613c095760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613c2b576000805461ffff19166101011790555b613bc0613e8d565b600054610100900460ff1680613c4c575060005460ff16155b613c685760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613c8a576000805461ffff19166101011790555b613c92613dc3565b613bc0613efd565b60008181526001830160205260408120548015613d83576000613cbe600183614715565b8554909150600090613cd290600190614715565b9050818114613d37576000866000018281548110613cf257613cf26147c0565b9060005260206000200154905080876000018481548110613d1557613d156147c0565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613d4857613d486147aa565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106c8565b60009150506106c8565b6000610acd8383613f72565b6000826000018281548110613db057613db06147c0565b9060005260206000200154905092915050565b600054610100900460ff1680613ddc575060005460ff16155b613df85760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613bc0576000805461ffff19166101011790558015610785576000805461ff001916905550565b600054610100900460ff1680613e46575060005460ff16155b613e625760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613e84576000805461ffff19166101011790555b613bc033612eb9565b600054610100900460ff1680613ea6575060005460ff16155b613ec25760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613ee4576000805461ffff19166101011790555b60016097558015610785576000805461ff001916905550565b600054610100900460ff1680613f16575060005460ff16155b613f325760405162461bcd60e51b815260040161064390614591565b600054610100900460ff16158015613f54576000805461ffff19166101011790555b6065805460ff191690558015610785576000805461ff001916905550565b6000818152600183016020526040812054613fb9575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106c8565b5060006106c8565b60008083601f840112613fd357600080fd5b50813567ffffffffffffffff811115613feb57600080fd5b6020830191508360208260051b850101111561400657600080fd5b9250929050565b60006020828403121561401f57600080fd5b8135610acd816147ec565b60006020828403121561403c57600080fd5b8151610acd816147ec565b60008060006060848603121561405c57600080fd5b8335614067816147ec565b92506020840135614077816147ec565b91506040840135614087816147ec565b809150509250925092565b600080600080608085870312156140a857600080fd5b84356140b3816147ec565b935060208501356140c3816147ec565b925060408501356140d3816147ec565b915060608501356140e3816147ec565b939692955090935050565b60008060008060006080868803121561410657600080fd5b8535614111816147ec565b94506020860135614121816147ec565b935060408601359250606086013567ffffffffffffffff8082111561414557600080fd5b818801915088601f83011261415957600080fd5b81358181111561416857600080fd5b89602082850101111561417a57600080fd5b9699959850939650602001949392505050565b6000806000604084860312156141a257600080fd5b83356141ad816147ec565b9250602084013567ffffffffffffffff8111156141c957600080fd5b6141d586828701613fc1565b9497909650939450505050565b600080604083850312156141f557600080fd5b8235614200816147ec565b9150602083013561421081614801565b809150509250929050565b60008060006040848603121561423057600080fd5b833567ffffffffffffffff81111561424757600080fd5b61425386828701613fc1565b9094509250506020840135614087816147ec565b6000806000806060858703121561427d57600080fd5b843567ffffffffffffffff81111561429457600080fd5b6142a087828801613fc1565b90955093505060208501356142b481614801565b915060408501356140e381614801565b600080602083850312156142d757600080fd5b823567ffffffffffffffff8111156142ee57600080fd5b6142fa85828601613fc1565b90969095509350505050565b6000602080838503121561431957600080fd5b825167ffffffffffffffff8082111561433157600080fd5b818501915085601f83011261434557600080fd5b815181811115614357576143576147d6565b8060051b604051601f19603f8301168101818110858211171561437c5761437c6147d6565b604052828152858101935084860182860187018a101561439b57600080fd5b600095505b838610156143be5780518552600195909501949386019386016143a0565b5098975050505050505050565b6000602082840312156143dd57600080fd5b8135610acd81614801565b6000602082840312156143fa57600080fd5b8151610acd81614801565b60006020828403121561441757600080fd5b813561ffff81168114610acd57600080fd5b60006020828403121561443b57600080fd5b5035919050565b60006020828403121561445457600080fd5b5051919050565b6000806040838503121561446e57600080fd5b823591506020830135614210816147ec565b6000806040838503121561449357600080fd5b50508035926020909101359150565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b6020808252825182820181905260009190848201906040850190845b8181101561450d578351835292840192918401916001016144f1565b50909695505050505050565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b6020808252601290820152715357495045522c204e4f2053574950494e4760701b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526028908201527f596f75277265206e6f7420616c6c6f77656420746f2063616c6c207468697320604082015267333ab731ba34b7b760c11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526019908201527f436f6e74726163747320617265206e6f7420616c6c6f77656400000000000000604082015260600190565b600082198211156146dd576146dd61477e565b500190565b6000826146f1576146f1614794565b500490565b60008160001904831182151516156147105761471061477e565b500290565b6000828210156147275761472761477e565b500390565b600060ff821660ff8416808210156147465761474661477e565b90039392505050565b60006000198214156147635761476361477e565b5060010190565b60008261477957614779614794565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461078557600080fd5b801515811461078557600080fdfea2646970667358221220e2b0e53e7b90167807d75b37370208582e19d26d5e1460a5ebe180aa2772ed4f64736f6c63430008070033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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