Contract 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x564d0674e13ce913828c6c5ab9f7aad790543a8c71152a81cb27dcbcb9bf15cd0x6080604051797712022-01-28 18:54:11250 days 47 mins ago0x21c853369eeb2cccbd722d313dcf727befbb02f4 IN  Create: StakingV20 ETH0.065123762707 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x4dfe2a51c3ec14dcd70f23e55cd29ab18a71e4659ea7afbd8e200c81bed1fb8e56054942022-02-08 1:36:19239 days 18 hrs ago 0xb7fdc5f89d5d76aee87328a70aec87925198566a 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x34be7e9c7d2fe7816b3bb4118e070af51b49b6a97c6e8408174a42c8947308be55866692022-02-07 18:46:38240 days 55 mins ago 0x2dc9a47124e15619a07934d14ab497a085c2c918 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x34be7e9c7d2fe7816b3bb4118e070af51b49b6a97c6e8408174a42c8947308be55866692022-02-07 18:46:38240 days 55 mins ago 0xb6945b73ed554df8d52ecdf1ab08f17564386e0f 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x34be7e9c7d2fe7816b3bb4118e070af51b49b6a97c6e8408174a42c8947308be55866692022-02-07 18:46:38240 days 55 mins ago 0x133d93566f9699b3af46fe150daa8a67a9563ed6 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x362b2dd7f65b14fd50d56d3a524e54404868907a4f74b86ba7ebbd9ce21bb28855801692022-02-07 16:37:15240 days 3 hrs ago 0x2dc9a47124e15619a07934d14ab497a085c2c918 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x362b2dd7f65b14fd50d56d3a524e54404868907a4f74b86ba7ebbd9ce21bb28855801692022-02-07 16:37:15240 days 3 hrs ago 0x2dc9a47124e15619a07934d14ab497a085c2c918 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x362b2dd7f65b14fd50d56d3a524e54404868907a4f74b86ba7ebbd9ce21bb28855801692022-02-07 16:37:15240 days 3 hrs ago 0x2dc9a47124e15619a07934d14ab497a085c2c918 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x362b2dd7f65b14fd50d56d3a524e54404868907a4f74b86ba7ebbd9ce21bb28855801692022-02-07 16:37:15240 days 3 hrs ago 0x5e3d81f47cdaf4ff4622a40b3e76fe0b896e5324 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x5e389663f6b66305a3c4d01a38708536aac1628db2781f780d13983056bf838155798562022-02-07 16:30:53240 days 3 hrs ago 0x5e3d81f47cdaf4ff4622a40b3e76fe0b896e5324 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x9306ff62d541effc2cf7c1c1706d36371c852d748ae4175e4c678d361b32dccc55798022022-02-07 16:30:48240 days 3 hrs ago 0x81f7c3796f4b024b6700a0134a1c509acf920324 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x956965ee59e2ac1d7d0099adf06e999a9efeba85b064dc3280889c7d88a3417155797622022-02-07 16:30:48240 days 3 hrs ago 0x81f7c3796f4b024b6700a0134a1c509acf920324 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x25aed4acd5fb6a8b479a1f314d88b308354c9fed2cf52131a20aa1353eaa323955750952022-02-07 15:11:10240 days 4 hrs ago 0x8791c9057566af6f55f18fdbea4465e1b1ee2f8e 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x3f01c39a12696d0f7d549e061fc7ef2f48b4baa41a02e8d18bbbc64dc74bcdc055582662022-02-07 8:41:11240 days 11 hrs ago 0xd5ff83ca36a4d8e6d3a527203b89502d3d214130 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0xb3d5249a1d498aeb0a901ba95efd21626905b11583fd4623ad174fdab64a3d2d55582432022-02-07 8:41:11240 days 11 hrs ago 0xd5ff83ca36a4d8e6d3a527203b89502d3d214130 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x2dc9a47124e15619a07934d14ab497a085c2c918 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0xb6945b73ed554df8d52ecdf1ab08f17564386e0f 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0x895a6f444be4ba9d124f61df736605792b35d66b 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
0x543a5d233f786ff4103cf9722c1e6cfb9a9db7d20871db222e0f7d28197b788655573952022-02-07 8:22:39240 days 11 hrs ago 0xb732ba79e9b36fa5abdccbe30adedd40c09789f6 0xd07668b6157a1a2b5c7687d60f731c89b9807dbf0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingV2

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Multiple files format)

File 1 of 28: StakingV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

// Goals of Staking V2
// 1. Stake RandomWalkNFT, Spiral, Crystals, SPIRALBITS and IMPISH
// 2. Allow Crystals to grow - both size and target symmetry
// 3. Allow Spirals to claim win if Spiral game ends
// 4. Allow listing on marketplace while staked

// A note on how TokenIDs work.
// TokenIDs stored inside the contract have to be >1M
// 1M+ -> RandomWalkNFT
// 2M+ -> Spiral
// 3M+ -> Staked Crystal that is growing
// 4M+ -> Fully grown crystal that is earning SPIRALBITS

import "./IERC721ReceiverUpgradeable.sol";
import "./ReentrancyGuardUpgradeable.sol";
import "./OwnableUpgradeable.sol";

import "./ERC721.sol";
import "./IERC20.sol";

import "./ImpishCrystal.sol";
import "./ImpishSpiral.sol";
import "./SpiralBits.sol";

contract StakingV2 is IERC721ReceiverUpgradeable, ReentrancyGuardUpgradeable, OwnableUpgradeable {
  // Since this is an upgradable implementation, the storage layout is important.
  // Please be careful changing variable positions when upgrading.

  // Global reward for all SPIRALBITS staked per second, across ALL staked SpiralBits
  uint256 public SPIRALBITS_STAKING_EMISSION_PER_SEC;

  // Global reward for all IMPISH staked per second, across ALL staked IMPISH
  uint256 public IMPISH_STAKING_EMISSION_PER_SEC;

  // How many SpiralBits per second are awarded to a staked spiral
  // 0.167 SPIRALBITS per second. (10 SPIRALBITS per 60 seconds)
  uint256 public SPIRALBITS_PER_SECOND_PER_SPIRAL;

  // How many SpiralBits per second are awarded to a staked RandomWalkNFTs
  // 0.0167 SPIRALBITS per second. (1 SPIRALBITS per 60 seconds)
  uint256 public SPIRALBITS_PER_SECOND_PER_RW;

  // How many SpiralBits per second are awarded to a staked, fully grown
  // spiral. 0.0835 SPIRALBITS per second (5 SPIRALBITS per 60 seconds)
  uint256 public SPIRALBITS_PER_SECOND_PER_CRYSTAL;

  // We're staking this NFT in this contract
  IERC721 public randomWalkNFT;
  ImpishSpiral public impishspiral;
  ImpishCrystal public crystals;

  // The token that is being issued for staking
  SpiralBits public spiralbits;

  // The Impish Token
  IERC20 public impish;

  struct RewardEpoch {
    uint32 epochDurationSec; // Total seconds that this epoch lasted
    uint96 totalSpiralBitsStaked; // Total SPIRALBITS staked across all accounts in whole uints for this Epoch
    uint96 totalImpishStaked; // Total IMPISH tokens staked across all accounts in whole units for this Epoch
  }
  RewardEpoch[] public epochs; // List of epochs
  uint32 public lastEpochTime; // Last epoch ended at this time

  struct StakedNFTAndTokens {
    uint16 numRWStaked;
    uint16 numSpiralsStaked;
    uint16 numGrowingCrystalsStaked;
    uint16 numFullCrystalsStaked;
    uint32 lastClaimEpoch; // Last Epoch number the rewards were accumulated into claimedSpiralBits. Cannot be 0.
    uint96 spiralBitsStaked; // Total number of SPIRALBITS staked
    uint96 impishStaked; // Total number of IMPISH tokens staked
    uint96 claimedSpiralBits; // Already claimed (but not withdrawn) spiralBits before lastClaimTime
    mapping(uint256 => uint256) ownedTokens; // index => tokenId
  }

  struct TokenIdInfo {
    uint256 ownedTokensIndex;
    address owner;
  }

  // Mapping of Contract TokenID => Address that staked it.
  mapping(uint256 => TokenIdInfo) public stakedTokenOwners;

  // Address that staked the token => Token Accounting
  mapping(address => StakedNFTAndTokens) public stakedNFTsAndTokens;

  mapping(uint32 => uint8) public crystalTargetSyms;

  // Upgradable contracts use initialize instead of contructors
  function initialize(address _crystals) public initializer {
    // Call super initializers
    __Ownable_init();
    __ReentrancyGuard_init();

    SPIRALBITS_STAKING_EMISSION_PER_SEC = 4 ether;
    IMPISH_STAKING_EMISSION_PER_SEC = 1 ether;
    SPIRALBITS_PER_SECOND_PER_SPIRAL = 0.167 ether * 1.1; // 10% bonus
    SPIRALBITS_PER_SECOND_PER_RW = 0.0167 ether * 1.8; // 80% bonus
    SPIRALBITS_PER_SECOND_PER_CRYSTAL = 0.0835 ether;

    crystals = ImpishCrystal(_crystals);
    impishspiral = ImpishSpiral(crystals.spirals());
    randomWalkNFT = IERC721(impishspiral._rwNFT());

    spiralbits = SpiralBits(crystals.SpiralBits());
    impish = IERC20(impishspiral._impishDAO());

    // To make accounting easier, we put a dummy epoch here
    epochs.push(RewardEpoch({epochDurationSec: 0, totalSpiralBitsStaked: 0, totalImpishStaked: 0}));

    // Authorize spiralbits to be spent from this contact by the Crystals contracts, used to grow crystals
    spiralbits.approve(_crystals, 2_000_000_000 ether);

    lastEpochTime = uint32(block.timestamp);
  }

  function stakeSpiralBits(uint256 amount) external nonReentrant {
    require(amount > 0, "Need SPIRALBITS");

    // Update the owner's rewards. The newly added epoch doesn't matter, because it's duration is 0.
    // This has to be done before
    _updateRewards(msg.sender);

    // Transfer the SpiralBits in. If amount is bad or user doesn't have enoug htokens, this will fail.
    spiralbits.transferFrom(msg.sender, address(this), amount);

    // Spiralbits accounting
    stakedNFTsAndTokens[msg.sender].spiralBitsStaked += uint96(amount);
  }

  function unstakeSpiralBits(bool claimReward) external nonReentrant {
    uint256 amount = stakedNFTsAndTokens[msg.sender].spiralBitsStaked;
    require(amount > 0, "NoSPIRALBITSToUnstake");

    // Update the owner's rewards first. This also updates the current epoch, since nothing has changed yet.
    _updateRewards(msg.sender);

    // Impish accounting
    stakedNFTsAndTokens[msg.sender].spiralBitsStaked = 0;

    // Transfer Spiralbits out.
    spiralbits.transfer(msg.sender, amount);

    if (claimReward) {
      _claimRewards(msg.sender);
    }
  }

  function stakeImpish(uint256 amount) external nonReentrant {
    require(amount > 0, "Need IMPISH");

    // Transfer the SpiralBits in. If amount is bad or user doesn't have enoug htokens, this will fail.
    impish.transferFrom(msg.sender, address(this), amount);

    // Update the owner's rewards first. This also updates the current epoch, since nothing has changed yet.
    _updateRewards(msg.sender);

    // Impish accounting
    stakedNFTsAndTokens[msg.sender].impishStaked += uint96(amount);
  }

  function unstakeImpish(bool claimReward) external nonReentrant {
    uint256 amount = stakedNFTsAndTokens[msg.sender].impishStaked;
    require(amount > 0, "No IMPISH to Unstake");

    // Update the owner's rewards first. This also updates the current epoch, since nothing has changed yet.
    _updateRewards(msg.sender);

    // Impish accounting
    stakedNFTsAndTokens[msg.sender].impishStaked = 0;

    // Transfer impish out.
    impish.transfer(msg.sender, amount);

    if (claimReward) {
      _claimRewards(msg.sender);
    }
  }

  function stakeNFTsForOwner(uint32[] calldata contractTokenIds, address owner) external nonReentrant {
    // Update the owner's rewards first. This also updates the current epoch, since nothing has changed yet.
    _updateRewards(owner);

    for (uint256 i = 0; i < contractTokenIds.length; i++) {
      require(contractTokenIds[i] > 1_000_000, "UseContractTokenIDs");
      uint32 nftType = contractTokenIds[i] / 1_000_000;
      uint32 tokenId = contractTokenIds[i] % 1_000_000;

      if (nftType == 1) {
        _stakeNFT(randomWalkNFT, owner, uint256(tokenId), 1_000_000);

        // Add this RWNFT to the staked struct
        stakedNFTsAndTokens[owner].numRWStaked += 1;
      } else if (nftType == 2) {
        _stakeNFT(impishspiral, owner, uint256(tokenId), 2_000_000);

        // Add this spiral to the staked struct
        stakedNFTsAndTokens[owner].numSpiralsStaked += 1;
      } else if (nftType == 3) {
        // Crystals that are growing
        _stakeNFT(crystals, owner, uint256(tokenId), 3_000_000);

        // Add this crystal (Growing) to the staked struct
        stakedNFTsAndTokens[owner].numGrowingCrystalsStaked += 1;
      } else if (nftType == 4) {
        // Crystals that are fully grown
        (uint8 currentCrystalSize, , , , ) = crystals.crystals(tokenId);
        require(currentCrystalSize == 100, "CrystalNotFullyGrown");

        _stakeNFT(crystals, owner, uint256(tokenId), 4_000_000);

        // Add this crystal (fully grown) to the staked struct
        stakedNFTsAndTokens[owner].numFullCrystalsStaked += 1;
      } else {
        revert("InvalidNFTType");
      }
    }
  }

  function unstakeNFTs(uint32[] calldata contractTokenIds, bool claim) external nonReentrant {
    // Update the owner's rewards first. This also updates the current epoch.
    _updateRewards(msg.sender);

    for (uint256 i = 0; i < contractTokenIds.length; i++) {
      require(contractTokenIds[i] > 1_000_000, "UseContractTokenIDs");
      uint32 nftType = contractTokenIds[i] / 1_000_000;
      uint32 tokenId = contractTokenIds[i] % 1_000_000;

      if (nftType == 1) {
        _unstakeNFT(randomWalkNFT, uint256(tokenId), 1_000_000);

        // Add this RWNFT to the staked struct
        stakedNFTsAndTokens[msg.sender].numRWStaked -= 1;
      } else if (nftType == 2) {
        _unstakeNFT(impishspiral, uint256(tokenId), 2_000_000);

        // Add this spiral to the staked struct
        stakedNFTsAndTokens[msg.sender].numSpiralsStaked -= 1;
      } else if (nftType == 3) {
        // Crystals that are growing
        _unstakeNFT(crystals, uint256(tokenId), 3_000_000);

        // Add this crystal (Growing) to the staked struct
        stakedNFTsAndTokens[msg.sender].numGrowingCrystalsStaked -= 1;
        delete crystalTargetSyms[tokenId + 3_000_000];
      } else if (nftType == 4) {
        // Crystals that are growing
        _unstakeNFT(crystals, uint256(tokenId), 4_000_000);

        // Add this crystal (fully grown) to the staked struct
        stakedNFTsAndTokens[msg.sender].numFullCrystalsStaked -= 1;
      } else {
        revert("InvalidNFTType");
      }
    }

    if (claim) {
      _claimRewards(msg.sender);
    }
  }

  function pendingRewards(address owner) public view returns (uint256) {
    uint256 lastClaimedEpoch = stakedNFTsAndTokens[owner].lastClaimEpoch;

    // Start with already claimed epochs
    uint256 accumulated = stakedNFTsAndTokens[owner].claimedSpiralBits;

    // Add up all pending epochs
    if (lastClaimedEpoch > 0) {
      accumulated += _getRewardsAccumulated(owner, lastClaimedEpoch);
    }

    // Add potentially upcoming epoch
    RewardEpoch memory newEpoch = _getNextEpoch();
    if (newEpoch.epochDurationSec > 0) {
      // Accumulate what will probably be the next epoch
      if (newEpoch.totalSpiralBitsStaked > 0) {
        accumulated +=
          (SPIRALBITS_STAKING_EMISSION_PER_SEC *
            newEpoch.epochDurationSec *
            uint256(stakedNFTsAndTokens[owner].spiralBitsStaked)) /
          uint256(newEpoch.totalSpiralBitsStaked);
      }

      if (newEpoch.totalImpishStaked > 0) {
        accumulated +=
          (IMPISH_STAKING_EMISSION_PER_SEC *
            newEpoch.epochDurationSec *
            uint256(stakedNFTsAndTokens[owner].impishStaked)) /
          uint256(newEpoch.totalImpishStaked);
      }

      // Rewards for Staked Spirals
      accumulated +=
        newEpoch.epochDurationSec *
        SPIRALBITS_PER_SECOND_PER_SPIRAL *
        stakedNFTsAndTokens[owner].numSpiralsStaked;

      // Rewards for staked RandomWalks
      accumulated += newEpoch.epochDurationSec * SPIRALBITS_PER_SECOND_PER_RW * stakedNFTsAndTokens[owner].numRWStaked;

      // Rewards for staked fully grown crystals
      accumulated +=
        newEpoch.epochDurationSec *
        SPIRALBITS_PER_SECOND_PER_CRYSTAL *
        stakedNFTsAndTokens[owner].numFullCrystalsStaked;
    }

    // Note: Growing crystals do not accumulate rewards

    return accumulated;
  }

  // ---------------------
  // Internal Functions
  // ---------------------

  // Claim the pending rewards
  function _claimRewards(address owner) internal {
    _updateRewards(owner);
    uint256 rewardsPending = stakedNFTsAndTokens[owner].claimedSpiralBits;

    // If there are any rewards,
    if (rewardsPending > 0) {
      // Mark rewards as claimed
      stakedNFTsAndTokens[owner].claimedSpiralBits = 0;

      // Mint new spiralbits directly to the claimer
      spiralbits.mintSpiralBits(owner, rewardsPending);
    }
  }

  // Stake an NFT
  function _stakeNFT(
    IERC721 nft,
    address owner,
    uint256 tokenId,
    uint256 tokenIdMultiplier
  ) internal {
    require(nft.ownerOf(tokenId) == msg.sender, "DontOwnNFT");

    uint256 contractTokenId = tokenIdMultiplier + tokenId;

    // Add the spiral to staked owner list to keep track of staked tokens
    _addTokenToOwnerEnumeration(owner, contractTokenId);
    stakedTokenOwners[contractTokenId].owner = owner;

    // Transfer the actual NFT to this staking contract.
    nft.safeTransferFrom(msg.sender, address(this), tokenId);
  }

  // Unstake an NFT and return it back to the sender
  function _unstakeNFT(
    IERC721 nft,
    uint256 tokenId,
    uint256 tokenIdMultiplier
  ) internal {
    uint256 contractTokenId = tokenIdMultiplier + tokenId;
    require(stakedTokenOwners[contractTokenId].owner == msg.sender, "DontOwnNFT");

    _removeTokenFromOwnerEnumeration(msg.sender, contractTokenId);

    // Transfer the NFT out
    nft.safeTransferFrom(address(this), msg.sender, tokenId);
  }

  function _getRewardsAccumulated(address owner, uint256 lastClaimedEpoch) internal view returns (uint256) {
    uint256 rewardsAccumulated = 0;
    uint256 totalDuration = 0;

    for (uint256 i = lastClaimedEpoch + 1; i < epochs.length; i++) {
      // Accumulate the durations, so we can add the NFT rewards too
      totalDuration += epochs[i].epochDurationSec;

      // Accumulate spiralbits reward
      if (epochs[i].totalSpiralBitsStaked > 0) {
        rewardsAccumulated +=
          (SPIRALBITS_STAKING_EMISSION_PER_SEC *
            uint256(epochs[i].epochDurationSec) *
            uint256(stakedNFTsAndTokens[owner].spiralBitsStaked)) /
          uint256(epochs[i].totalSpiralBitsStaked);
      }

      // accumulate impish rewards
      if (epochs[i].totalImpishStaked > 0) {
        rewardsAccumulated +=
          (IMPISH_STAKING_EMISSION_PER_SEC *
            uint256(epochs[i].epochDurationSec) *
            uint256(stakedNFTsAndTokens[owner].impishStaked)) /
          uint256(epochs[i].totalImpishStaked);
      }
    }

    // Rewards for Staked Spirals
    rewardsAccumulated +=
      totalDuration *
      SPIRALBITS_PER_SECOND_PER_SPIRAL *
      stakedNFTsAndTokens[owner].numSpiralsStaked;

    // Rewards for staked RandomWalks
    rewardsAccumulated += totalDuration * SPIRALBITS_PER_SECOND_PER_RW * stakedNFTsAndTokens[owner].numRWStaked;

    // Rewards for staked fully grown crystals
    rewardsAccumulated +=
      totalDuration *
      SPIRALBITS_PER_SECOND_PER_CRYSTAL *
      stakedNFTsAndTokens[owner].numFullCrystalsStaked;

    // Note: Growing crystals do not accumulate rewards

    return rewardsAccumulated;
  }

  // Do the internal accounting update for the address
  function _updateRewards(address owner) internal {
    // First, see if we need to add an epoch.
    // We may not always need to, especially if the time elapsed is 0 (i.e., multiple tx in same block)
    if (block.timestamp > lastEpochTime) {
      _addEpoch();
    }

    // Mark as claimed till the newly created epoch.
    uint256 lastClaimedEpoch = stakedNFTsAndTokens[owner].lastClaimEpoch;
    stakedNFTsAndTokens[owner].lastClaimEpoch = uint32(epochs.length - 1);

    // If this owner is new, just return
    if (lastClaimedEpoch == 0) {
      return;
    }

    uint256 rewardsAccumulated = _getRewardsAccumulated(owner, lastClaimedEpoch);

    // Accumulate everything
    stakedNFTsAndTokens[owner].claimedSpiralBits += uint96(rewardsAccumulated);
  }

  // -------------------
  // Rewards Epochs
  // -------------------
  // Rewards for ERC20 tokens are different from Rewards for NFTs.
  // Staked NFTs earn a fixed reward per time, but staked ERC20 earn a reward
  // proportional to how many other ERC20 of the same type are staked.
  // That is, there is a global emission per ERC20, that is split evenly among all
  // staked ERC20.
  // Therefore, we need to track how many of the total ERC20s were staked for each epoch
  // Note that if the amount of ERC20 staked by a user changes (via deposit or withdraw), then
  // the user's balance needs to be updated

  function _getNextEpoch() internal view returns (RewardEpoch memory) {
    RewardEpoch memory newEpoch = RewardEpoch({
      epochDurationSec: uint32(block.timestamp) - lastEpochTime,
      totalSpiralBitsStaked: uint96(spiralbits.balanceOf(address(this))),
      totalImpishStaked: uint96(impish.balanceOf(address(this)))
    });

    return newEpoch;
  }

  // Add a new epoch with the balances in the contract
  function _addEpoch() internal {
    // Sanity check. Can't add epoch without having the epochs up-to-date
    require(uint32(block.timestamp) > lastEpochTime, "TooNew");

    RewardEpoch memory newEpoch = _getNextEpoch();

    // Add to array
    lastEpochTime = uint32(block.timestamp);
    epochs.push(newEpoch);
  }

  // -------------------
  // Keep track of staked NFTs
  // -------------------
  function _totalTokenCountStaked(address _owner) internal view returns (uint256) {
    return
      stakedNFTsAndTokens[_owner].numRWStaked +
      stakedNFTsAndTokens[_owner].numSpiralsStaked +
      stakedNFTsAndTokens[_owner].numGrowingCrystalsStaked +
      stakedNFTsAndTokens[_owner].numFullCrystalsStaked;
  }

  // Returns a list of token Ids owned by _owner.
  function walletOfOwner(address _owner) public view returns (uint256[] memory) {
    uint256 tokenCount = _totalTokenCountStaked(_owner);

    if (tokenCount == 0) {
      // Return an empty array
      return new uint256[](0);
    }

    uint256[] memory result = new uint256[](tokenCount);
    for (uint256 i; i < tokenCount; i++) {
      result[i] = tokenOfOwnerByIndex(_owner, i);
    }
    return result;
  }

  /**
   * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
   */
  function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
    require(index < _totalTokenCountStaked(owner), "OwnerIndex out of bounds");
    return stakedNFTsAndTokens[owner].ownedTokens[index];
  }

  /**
   * @dev Private function to add a token to this extension's ownership-tracking data structures.
   * @param owner address representing the 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 owner, uint256 tokenId) private {
    uint256 length = _totalTokenCountStaked(owner);
    stakedNFTsAndTokens[owner].ownedTokens[length] = tokenId;
    stakedTokenOwners[tokenId].ownedTokensIndex = length;
  }

  /**
   * @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 = _totalTokenCountStaked(from) - 1;
    uint256 tokenIndex = stakedTokenOwners[tokenId].ownedTokensIndex;

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

      stakedNFTsAndTokens[from].ownedTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
      stakedTokenOwners[lastTokenId].ownedTokensIndex = tokenIndex; // Update the moved token's index
    }

    // This also deletes the contents at the last position of the array
    delete stakedTokenOwners[tokenId];
    delete stakedNFTsAndTokens[from].ownedTokens[lastTokenIndex];
  }

  // -----------------
  // Harvesting and Growing Crystals
  // -----------------
  function setCrystalTargetSym(uint32 crystalTokenId, uint8 targetSym) external nonReentrant {
    uint32 contractCrystalTokenId = crystalTokenId + 3_000_000;
    require(stakedTokenOwners[contractCrystalTokenId].owner == msg.sender, "NotYourCrystal");

    crystalTargetSyms[contractCrystalTokenId] = targetSym;
  }

  // Grow all the given crystals to max size for the target symmetry
  function _growCrystals(uint32[] memory contractCrystalTokenIds) internal {
    // How many spiralbits are available to grow
    uint96 availableSpiralBits = stakedNFTsAndTokens[msg.sender].claimedSpiralBits;
    stakedNFTsAndTokens[msg.sender].claimedSpiralBits = 0;
    spiralbits.mintSpiralBits(address(this), availableSpiralBits);

    for (uint256 i = 0; i < contractCrystalTokenIds.length; i++) {
      uint32 contractCrystalTokenId = contractCrystalTokenIds[i];

      uint32 crystalTokenId = contractCrystalTokenId - 3_000_000;
      require(stakedTokenOwners[contractCrystalTokenId].owner == msg.sender, "NotYourCrystal");

      // Grow the crystal to max that it can
      (uint8 currentCrystalSize, , uint8 currentSym, , ) = crystals.crystals(crystalTokenId);
      if (currentCrystalSize < 100) {
        uint96 spiralBitsNeeded = uint96(
          crystals.SPIRALBITS_PER_SYM_PER_SIZE() * uint256(100 - currentCrystalSize) * uint256(currentSym)
        );
        if (availableSpiralBits > spiralBitsNeeded) {
          crystals.grow(crystalTokenId, 100 - currentCrystalSize);
          availableSpiralBits -= spiralBitsNeeded;
        }
      }

      // Next grow syms
      if (crystalTargetSyms[contractCrystalTokenId] > 0 && crystalTargetSyms[contractCrystalTokenId] > currentSym) {
        uint8 growSyms = crystalTargetSyms[contractCrystalTokenId] - currentSym;

        uint96 spiralBitsNeeded = uint96(crystals.SPIRALBITS_PER_SYM() * uint256(growSyms));
        if (availableSpiralBits > spiralBitsNeeded) {
          crystals.addSym(crystalTokenId, growSyms);
          availableSpiralBits -= spiralBitsNeeded;
        }
      }

      // And then grow the Crystal again to max size if possible
      (currentCrystalSize, , currentSym, , ) = crystals.crystals(crystalTokenId);
      if (currentCrystalSize < 100) {
        uint96 spiralBitsNeeded = uint96(
          crystals.SPIRALBITS_PER_SYM_PER_SIZE() * uint256(100 - currentCrystalSize) * uint256(currentSym)
        );
        if (availableSpiralBits > spiralBitsNeeded) {
          crystals.grow(crystalTokenId, 100 - currentCrystalSize);
          availableSpiralBits -= spiralBitsNeeded;
        }
      }

      delete crystalTargetSyms[contractCrystalTokenId];
    }

    // Burn any unused spiralbits and credit the user back, so we can harvest more crystals
    // instead of returning a large amount of SPIRALBITS back to the user here.
    spiralbits.burn(availableSpiralBits);
    stakedNFTsAndTokens[msg.sender].claimedSpiralBits = availableSpiralBits;
  }

  function harvestCrystals(uint32[] calldata contractCrystalTokenIds, bool claim) external nonReentrant {
    _updateRewards(msg.sender);

    // First, grow all the crystals
    _growCrystals(contractCrystalTokenIds);

    // And then transfer the crystals over from growing to staked
    for (uint256 i = 0; i < contractCrystalTokenIds.length; i++) {
      uint32 contractCrystalTokenId = contractCrystalTokenIds[i];
      uint32 crystalTokenId = contractCrystalTokenId - 3_000_000;

      (uint8 currentCrystalSize, , , , ) = crystals.crystals(crystalTokenId);

      // Move this crystal over to be staked only if it is fully grown
      if (currentCrystalSize == 100) {
        // Unstake growing crystal
        _removeTokenFromOwnerEnumeration(msg.sender, contractCrystalTokenId);
        stakedNFTsAndTokens[msg.sender].numGrowingCrystalsStaked -= 1;

        // Stake fully grown crystal
        uint256 contractFullyGrownTokenId = 4_000_000 + crystalTokenId;
        _addTokenToOwnerEnumeration(msg.sender, contractFullyGrownTokenId);
        stakedTokenOwners[contractFullyGrownTokenId].owner = msg.sender;
        stakedNFTsAndTokens[msg.sender].numFullCrystalsStaked += 1;
      }
    }

    if (claim) {
      _claimRewards(msg.sender);
    }
  }

  // ------------------
  // Other functions
  // ------------------
  function claimSpiralWin(uint256 spiralTokenId) external nonReentrant {
    ImpishSpiral(address(impishspiral)).claimWin(spiralTokenId);

    // Send the ether to the Spiral's owner
    address spiralOwner = stakedTokenOwners[spiralTokenId + 2_000_000].owner;
    (bool success, ) = spiralOwner.call{value: address(this).balance}("");
    require(success, "Transfer failed.");
  }

  receive() external payable {
    // Default payable to accept ether payments for winning spirals
  }

  // -------------------
  // Overrides that allow accepting NFTs and ERC20s
  // -------------------
  // Function that marks this contract can accept incoming NFT transfers
  function onERC721Received(
    address,
    address,
    uint256,
    bytes calldata
  ) public pure returns (bytes4) {
    // Return this value to accept the NFT
    return IERC721ReceiverUpgradeable.onERC721Received.selector;
  }
}

File 2 of 28: Address.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 Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @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 3 of 28: AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 4 of 28: Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 5 of 28: ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "./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 onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    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 6 of 28: ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 7 of 28: ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 8 of 28: ERC20Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

import "./ERC20.sol";
import "./Context.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}

File 9 of 28: ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _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 = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

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

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

File 10 of 28: ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

import "./ERC721.sol";
import "./Context.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

File 11 of 28: ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 28: IERC165.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 IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 13 of 28: IERC20.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 IERC20 {
    /**
     * @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 14 of 28: IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 15 of 28: IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC721.sol";

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

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

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

File 17 of 28: IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";

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

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

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

File 18 of 28: IERC721Receiver.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 IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 19 of 28: IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 20 of 28: ImpishCrystal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./IERC20.sol";
import "./ERC20Burnable.sol";
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./ERC721Burnable.sol";
import "./Ownable.sol";
import "./ReentrancyGuard.sol";

abstract contract ISpiralStaking {
  struct TokenIdInfo {
    uint256 ownedTokensIndex;
    address owner;
  }
  mapping(uint256 => TokenIdInfo) public stakedTokenOwners;
}

contract ImpishCrystal is ERC721, ERC721Enumerable, ERC721Burnable, Ownable, ReentrancyGuard {
  // Next TokenID
  uint32 public _tokenIdCounter;

  // Base URI
  string private _baseTokenURI;

  // Entropy
  bytes32 public entropy;

  // Contract addresses
  address public spirals;
  address public spiralStaking;
  address public SpiralBits;

  // How many spiralbits it takes to grow per size per sym
  uint192 public constant SPIRALBITS_PER_SYM_PER_SIZE = 1000 ether;
  uint256 public constant SPIRALBITS_PER_SYM = 20000 ether;

  // Struct that has info about a Crystal
  struct CrystalInfo {
    uint8 size;
    uint8 generation;
    uint8 sym;
    uint32 seed;
    uint192 spiralBitsStored;
  }
  // Crystal TokenID => CrystalInfo
  mapping(uint256 => CrystalInfo) public crystals;

  // SpiralTokenID -> bitMap of generations, indicating of token was
  struct MintedSpiralInfo {
    bool minted;
    uint32 tokenId;
  }
  // SpiralTokenID => gen number => MintedSpiralInfo
  mapping(uint256 => mapping(uint256 => MintedSpiralInfo)) public mintedSpirals;

  constructor(
    address _spirals,
    address _spiralStaking,
    address _spiralbits
  ) ERC721("ImpishCrystal", "Crystal") {
    // Set BaseURI
    _baseTokenURI = "https://impishdao.com/crystalapi/crystal/metadata/";

    // Contract addresses
    spirals = _spirals;
    spiralStaking = _spiralStaking;
    SpiralBits = _spiralbits;

    // Mint 100 at startup for marketing and giveaways
    for (uint8 i = 0; i < 100; i++) {
      _mintCrystal(0); // Initial tokens are 0 gen
      crystals[i].size = 70; // With size 70
    }
  }

  // Only owner can set the BaseURI
  function setBaseURI(string memory baseURI) public onlyOwner {
    _baseTokenURI = baseURI;
  }

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

  // Increment the entropy
  function _nextEntropy() internal {
    entropy = keccak256(abi.encode(block.timestamp, blockhash(block.number), msg.sender, entropy));
  }

  event CrystalChangeEvent(uint32 indexed crystalTokenId, uint8 indexed eventType, uint8 size);

  function _mintCrystal(uint8 gen) internal {
    uint32 tokenId = _tokenIdCounter;
    _tokenIdCounter += 1;

    _nextEntropy();

    uint32 seed = uint32(uint256(entropy) & 0xFFFFFF);
    uint8 sym = uint8((uint256(entropy) >> 32) & 0x03) + 5 + gen; // Number between 5 and 8 inclusive

    // Newly born crystals always have length 30, and have 0 SPIRALBITS stored.
    crystals[tokenId] = CrystalInfo(30, gen, sym, seed, 0);
    _safeMint(msg.sender, tokenId);

    emit CrystalChangeEvent(tokenId, 0, 0);
  }

  function mintCrystals(uint32[] calldata spiralTokenIds, uint8 gen) public payable nonReentrant {
    // Only 5 gens per Spiral
    require(gen < 5, "InvalidGen");

    // Make sure there was enough ETH sent.
    // Mint prices are [0, 0.01 ether, 0.1 ether, 1 ether, 10 ether];
    uint256 mintPrice = 0;

    // Only the first gen is free. Each subsequent gen is 10x more expensive
    if (gen > 0) {
      mintPrice = 0.01 ether * uint256(10)**uint256(gen - 1);
      require(msg.value == mintPrice * spiralTokenIds.length, "NotEnoughETH");

      // All the ETH is dev fee
      (bool success, ) = owner().call{value: address(this).balance}("");
      require(success, "TransferFailed");
    }

    for (uint256 i = 0; i < spiralTokenIds.length; i++) {
      uint256 spiralTokenId = uint256(spiralTokenIds[i]);

      // Ensure user owns the spiralTokenID or has it staked
      (, address spiralOwner) = ISpiralStaking(spiralStaking).stakedTokenOwners(spiralTokenId);
      require(IERC721(spirals).ownerOf(spiralTokenId) == msg.sender || spiralOwner == msg.sender, "NotOwnerOrStaker");

      // Make sure this gen has not been minted for the spiral
      require(mintedSpirals[spiralTokenId][gen].minted == false, "AlreadyMintedThisGen");

      // Mark this spiral's gen as minted. The tokenID will be the current tokenId counter
      mintedSpirals[spiralTokenId][gen] = MintedSpiralInfo(true, _tokenIdCounter);
      _mintCrystal(gen);
    }
  }

  function grow(uint32 tokenId, uint8 size) external nonReentrant {
    require(ownerOf(tokenId) == msg.sender, "NotYoursToGrow");
    require(crystals[tokenId].size > 0, "DoesntExist");
    require(crystals[tokenId].size + size <= 100, "TooMuchGrowth");

    // Check if enough SpiralBits were sent
    uint256 SpiralBitsNeeded = uint256(size) * uint256(crystals[tokenId].sym) * SPIRALBITS_PER_SYM_PER_SIZE;
    require(IERC20(SpiralBits).balanceOf(msg.sender) >= SpiralBitsNeeded, "NotEnough SPIRALBITS");

    // Transfer the SpiralBits in
    IERC20(SpiralBits).transferFrom(msg.sender, address(this), SpiralBitsNeeded);

    // Burn half and store the rest
    uint256 spiralBitsToStore = SpiralBitsNeeded / 2;
    ERC20Burnable(SpiralBits).burn(SpiralBitsNeeded - spiralBitsToStore);
    crystals[tokenId].spiralBitsStored += uint192(spiralBitsToStore);

    crystals[tokenId].size += size;

    emit CrystalChangeEvent(tokenId, 1, size);
  }

  function addSym(uint32 tokenId, uint8 numSymstoAdd) external nonReentrant {
    require(ownerOf(tokenId) == msg.sender, "NotYoursToAddSym");

    CrystalInfo memory c = crystals[tokenId];
    require(c.size > 0, "DoesntExist");
    require(c.sym + numSymstoAdd <= 20, "TooMuchSym");

    // Check if enough SpiralBits were sent
    uint256 SpiralBitsNeeded = SPIRALBITS_PER_SYM * uint256(numSymstoAdd);
    require(IERC20(SpiralBits).balanceOf(msg.sender) >= SpiralBitsNeeded, "NotEnough SPIRALBITS");

    // Reduce length proportionally
    uint8 newLength = uint8((uint256(c.size) * uint256(c.sym)) / uint256(c.sym + numSymstoAdd));
    require(newLength >= 30, "CrystalWouldBeTooSmall");

    // Burn ALL the SpiralBits
    IERC20(SpiralBits).transferFrom(msg.sender, address(this), SpiralBitsNeeded);
    ERC20Burnable(SpiralBits).burn(SpiralBitsNeeded);

    // Record the new size
    crystals[tokenId].size = newLength;
    crystals[tokenId].sym += numSymstoAdd;

    emit CrystalChangeEvent(tokenId, 2, numSymstoAdd);
  }

  function decSym(uint32 tokenId, uint8 numSymstoRemove) external nonReentrant {
    require(ownerOf(tokenId) == msg.sender, "NotYoursToAddSym");
    require(crystals[tokenId].size > 0, "DoesntExist");
    require(crystals[tokenId].sym - numSymstoRemove >= 3, "TooFewSym");

    // Check if enough SpiralBits were sent
    uint256 SpiralBitsNeeded = SPIRALBITS_PER_SYM * uint256(numSymstoRemove);
    require(IERC20(SpiralBits).balanceOf(msg.sender) >= SpiralBitsNeeded, "NotEnough SPIRALBITS");

    // Burn ALL the SpiralBits
    IERC20(SpiralBits).transferFrom(msg.sender, address(this), SpiralBitsNeeded);
    ERC20Burnable(SpiralBits).burn(SpiralBitsNeeded);

    // Record the new length
    crystals[tokenId].sym -= numSymstoRemove;

    emit CrystalChangeEvent(tokenId, 3, numSymstoRemove);
  }

  function shatter(uint32 tokenId) external nonReentrant {
    require(ownerOf(tokenId) == msg.sender, "NotYoursToShatter");
    require(crystals[tokenId].size > 0, "DoesntExist");

    uint256 spiralBitsToReturn = crystals[tokenId].spiralBitsStored;

    _burn(tokenId);
    delete crystals[tokenId];

    // Refund the spiralBits
    IERC20(SpiralBits).transfer(msg.sender, spiralBitsToReturn);

    emit CrystalChangeEvent(tokenId, 4, 0);
  }

  // Returns a list of token Ids owned by _owner.
  function walletOfOwner(address _owner) public view returns (uint256[] memory) {
    uint256 tokenCount = balanceOf(_owner);

    if (tokenCount == 0) {
      // Return an empty array
      return new uint256[](0);
    }

    uint256[] memory result = new uint256[](tokenCount);
    for (uint256 i; i < tokenCount; i++) {
      result[i] = tokenOfOwnerByIndex(_owner, i);
    }
    return result;
  }

  // Returns a bitmap of all spirals generated for this spiralTokenId
  function mintedSpiralsForSpiral(uint256 spiralTokenId) public view returns (uint256 mintedBitMap) {
    for (uint256 i = 0; i < 5; i++) {
      bool isMinted = mintedSpirals[spiralTokenId][i].minted;
      mintedBitMap = (mintedBitMap << 1) | (isMinted ? 1 : 0);
    }
  }

  // The following functions are overrides required by Solidity.
  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 tokenId
  ) internal override(ERC721, ERC721Enumerable) {
    super._beforeTokenTransfer(from, to, tokenId);
  }

  function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) {
    return super.supportsInterface(interfaceId);
  }
}

File 21 of 28: ImpishSpiral.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./IERC20.sol";
import "./IERC721.sol";
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./ReentrancyGuard.sol";
import "./Ownable.sol";

// Interface to the RandomWalkNFT contract.
abstract contract IRandomWalkNFT is IERC721 {
  uint256 public nextTokenId;
  mapping(uint256 => bytes32) public seeds;

  function mint() public payable virtual;

  function withdraw() public virtual;

  function getMintPrice() public view virtual returns (uint256);
}

// Interface to IMPISHDAO
abstract contract IImpishDAO is IERC20 {
  function deposit() public payable virtual;
}

contract ImpishSpiral is ERC721, ERC721Enumerable, Ownable, ReentrancyGuard {
  // Next TokenID
  uint256 public _tokenIdCounter;

  // When the last token was minted
  uint256 public lastMintTime;

  // Next mint price. Starts at 0.005 ETH
  uint256 public price = 0.005 ether;

  // No mints after this much time will result in the end of the mints
  uint256 public constant MINT_EXPIRY_TIME = 3 * 24 * 3600; // 3 days

  // Address of the RandomWalkNFT contract
  IRandomWalkNFT public _rwNFT;

  // Address of ImpishDAO
  IImpishDAO public _impishDAO;

  // Base URI
  string private _baseTokenURI;

  // The RNG seed that generates the spiral artwork
  // tokenId => seed
  mapping(uint256 => bytes32) public spiralSeeds;

  // Keep track of minted RandomWalkNFTs to prevent duplicate mints
  // RandomWalk tokenId => true if minted
  mapping(uint256 => bool) public mintedRWs;

  // Entropy
  bytes32 public entropy;

  // If the sale has started
  bool public started = false;

  // Keep track of the total rewards available
  uint256 public totalReward = 0;

  // List of all winners that have claimed their prize
  // tokenId -> true if winnings have been claimed
  mapping(uint256 => bool) public winningsClaimed;

  // The length of each path
  // tokenID -> Length
  mapping(uint256 => uint256) public spiralLengths;

  // Address of the Spirals Episode 2 contract
  address public spiralBitsContract = address(0);

  constructor(address _rwNFTaddress, address _impishDAOaddress) ERC721("ImpishSpiral", "SPIRAL") {
    _rwNFT = IRandomWalkNFT(_rwNFTaddress);
    _impishDAO = IImpishDAO(_impishDAOaddress);
  }

  function startMints() public onlyOwner {
    require(!started, "Started");

    lastMintTime = block.timestamp;
    started = true;
  }

  // Only owner can set the BaseURI
  function setBaseURI(string memory baseURI) public onlyOwner {
    _baseTokenURI = baseURI;
  }

  // Overrides the one in ERC721.sol
  function _baseURI() internal view virtual override returns (string memory) {
    return _baseTokenURI;
  }

  // Mint price increases 0.5% with every mint
  function getMintPrice() public view returns (uint256) {
    return (price * 1005) / 1000;
  }

  event SpiralMinted(uint256, bytes32);

  function _mintSpiral(bytes32 seed) internal {
    require(started, "NotStarted");
    require(block.timestamp < (lastMintTime + MINT_EXPIRY_TIME), "MintsFinished");

    uint256 nextMintPrice = getMintPrice();
    require(msg.value >= nextMintPrice, "NotEnoughETH");

    // Keep track of the total reward money
    totalReward += nextMintPrice;

    uint256 excessETH = 0;
    if (msg.value > nextMintPrice) {
      excessETH = msg.value - nextMintPrice;
    }

    // Increase the mint price
    price = nextMintPrice;

    // Increment TokenId
    uint256 tokenId = _tokenIdCounter;
    _tokenIdCounter += 1;

    // Save the seed for the RNG
    spiralSeeds[tokenId] = seed;

    // Set the last mint time.
    lastMintTime = block.timestamp;

    // Send any excess money back
    (bool success, ) = msg.sender.call{value: excessETH}("");
    require(success, "Transfer failed.");

    // And actually mint
    _safeMint(msg.sender, tokenId);

    emit SpiralMinted(tokenId, seed);
  }

  // Mint a spiral based on a RandomWalkNFT
  function mintSpiralWithRWNFT(uint256 _rwnftTokenId) external payable nonReentrant {
    require(!mintedRWs[_rwnftTokenId], "Minted");
    require(_rwNFT.ownerOf(_rwnftTokenId) == msg.sender, "DoesntOwnToken");

    // Mark this RandomWalkNFT as already minted.
    mintedRWs[_rwnftTokenId] = true;

    // Record the mint price
    uint256 mintPrice = getMintPrice();

    // Since we're minting based on RW, use the same seed
    _mintSpiral(_rwNFT.seeds(_rwnftTokenId));

    // The equivalent of 33% of the ETH is used to mint IMPISH tokens.
    _impishDAO.deposit{value: (mintPrice * 33) / 100}();

    // And send the impish tokens to the caller.
    _impishDAO.transfer(msg.sender, _impishDAO.balanceOf(address(this)));
  }

  // Mint a random Spiral
  function mintSpiralRandom() external payable nonReentrant {
    entropy = keccak256(abi.encode(block.timestamp, blockhash(block.number), msg.sender, price, entropy));

    _mintSpiral(entropy);
  }

  // Claim winnings
  function claimWin(uint256 tokenId) external nonReentrant {
    require(started, "NotStarted");
    require(block.timestamp > (lastMintTime + MINT_EXPIRY_TIME), "StillOpen");
    require(tokenId < _tokenIdCounter, "OutofRange");
    require(!winningsClaimed[tokenId], "Claimed");

    // Make sure that this tokenId has actually won
    uint256 winningTokensAreGTE = 0;
    if (_tokenIdCounter > 10) {
      winningTokensAreGTE = _tokenIdCounter - 10;
    }
    require(tokenId >= winningTokensAreGTE, "DidnotWin");

    // 1st place wins 10%, 2nd place 9%.... 10th place wins 1%
    uint256 winningPercent = tokenId - winningTokensAreGTE + 1;
    uint256 winnings = (totalReward * winningPercent) / 100;

    // Mark winnings as claimed
    winningsClaimed[tokenId] = true;

    // Send the winnings to owner of the TokenID (Not the minter)
    address winnerAddress = ownerOf(tokenId);

    // Transfer winnings
    (bool success, ) = winnerAddress.call{value: winnings}("");
    require(success, "Transfer failed.");
  }

  function afterAllWinnings() external onlyOwner nonReentrant {
    require(started, "Started");
    require(address(this).balance > 0, "Empty");
    require(block.timestamp > (lastMintTime + MINT_EXPIRY_TIME), "StillOpen");

    uint256 winningTokensAreGTE = 0;
    if (_tokenIdCounter > 10) {
      winningTokensAreGTE = _tokenIdCounter - 10;
    }

    uint256 tid;
    for (tid = winningTokensAreGTE; tid < _tokenIdCounter; tid++) {
      require(winningsClaimed[tid], "NotYetClaimed");
    }

    // Transfer winnings
    (bool success, ) = owner().call{value: address(this).balance}("");
    require(success, "TfrFailed");
  }

  // Returns a list of token Ids owned by _owner.
  function walletOfOwner(address _owner) public view returns (uint256[] memory) {
    uint256 tokenCount = balanceOf(_owner);

    if (tokenCount == 0) {
      // Return an empty array
      return new uint256[](0);
    }

    uint256[] memory result = new uint256[](tokenCount);
    for (uint256 i; i < tokenCount; i++) {
      result[i] = tokenOfOwnerByIndex(_owner, i);
    }
    return result;
  }

  // Set the lengths for the spirals
  function setSpiralLengths(uint256[] calldata tokenIDs, uint256[] calldata lengths) external onlyOwner {
    require(tokenIDs.length == lengths.length, "BadCall");

    // Set the lengths
    for (uint256 i = 0; i < tokenIDs.length; i++) {
      spiralLengths[tokenIDs[i]] = lengths[i];
    }
  }

  function setSpiralBitsContract(address _bitsContract) external onlyOwner {
    require(spiralBitsContract == address(0), "AlreadySet");
    spiralBitsContract = _bitsContract;
  }

  // Increase length of a spiral
  function removeLengthFromSpiral(uint256 tokenId, uint256 trimLength) external {
    require(msg.sender == spiralBitsContract, "YouCantCall");
    require(spiralLengths[tokenId] > 0, "NoTokenID");
    // Solidity 0.8.0 does the underflow check here automatically
    require(spiralLengths[tokenId] - trimLength > 400000, "CantTrim");

    spiralLengths[tokenId] = spiralLengths[tokenId] - trimLength;
  }

  // Decrease length of a spiral
  function addLengthToSpiral(uint256 tokenId, uint256 addLength) external {
    require(msg.sender == spiralBitsContract, "CantCall");
    require(spiralLengths[tokenId] > 0, "NoID");
    // Solidity 0.8.0 does the overflow check here automatically
    require(spiralLengths[tokenId] + addLength < 10000000, "CantAdd");

    spiralLengths[tokenId] = spiralLengths[tokenId] + addLength;
  }

  // The following functions are overrides required by Solidity.
  function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) {
    return super.supportsInterface(interfaceId);
  }

  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 tokenId
  ) internal override(ERC721, ERC721Enumerable) {
    super._beforeTokenTransfer(from, to, tokenId);
  }
}

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

pragma solidity ^0.8.0;

import "./AddressUpgradeable.sol";

/**
 * @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() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 23 of 28: Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "./Context.sol";

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

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

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

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

File 24 of 28: OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "./ContextUpgradeable.sol";
import "./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 onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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 25 of 28: ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

    constructor() {
        _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;
    }
}

File 26 of 28: ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "./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 onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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 27 of 28: SpiralBits.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./ERC20.sol";
import "./ERC20Burnable.sol";
import "./Ownable.sol";

contract SpiralBits is ERC20, ERC20Burnable, Ownable {
  constructor() ERC20("SpiralBits", "SPIRALBITS") {
    // Mint 100 M SPIRALBITS into a Uniswap LP position
    _mint(owner(), 100 * 10**6 * 1 ether);
  }

  // List of allowed contracts allowed to mint SPIRALBITS
  mapping(address => bool) public allowedMinters;

  // Max supply is 2B SPIRALBITS
  uint256 public constant MAX_SUPPLY = 2 * 10**9 * 1 ether;

  // A way for Spirals and RandomWalkNFTs to mint directly to users
  function addAllowedMinter(address _minter) external onlyOwner {
    allowedMinters[_minter] = true;
  }

  // Maintainance function, don't expect to be used unless something goes wrong
  function deleteAllowedMinter(address _minter) external onlyOwner {
    delete allowedMinters[_minter];
  }

  // Must be called by an approved minter
  modifier onlyApprovedMinter() {
    require(allowedMinters[msg.sender], "NotAllowed");
    _;
  }

  // Mint spiral bits directly into the given account.
  function mintSpiralBits(address to, uint256 amount) external onlyApprovedMinter {
    require(totalSupply() + amount <= MAX_SUPPLY, "WouldExceedMax");

    _mint(to, amount);
  }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"IMPISH_STAKING_EMISSION_PER_SEC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPIRALBITS_PER_SECOND_PER_CRYSTAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPIRALBITS_PER_SECOND_PER_RW","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPIRALBITS_PER_SECOND_PER_SPIRAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPIRALBITS_STAKING_EMISSION_PER_SEC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"spiralTokenId","type":"uint256"}],"name":"claimSpiralWin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"crystalTargetSyms","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"crystals","outputs":[{"internalType":"contract ImpishCrystal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochs","outputs":[{"internalType":"uint32","name":"epochDurationSec","type":"uint32"},{"internalType":"uint96","name":"totalSpiralBitsStaked","type":"uint96"},{"internalType":"uint96","name":"totalImpishStaked","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"contractCrystalTokenIds","type":"uint32[]"},{"internalType":"bool","name":"claim","type":"bool"}],"name":"harvestCrystals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"impish","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"impishspiral","outputs":[{"internalType":"contract ImpishSpiral","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_crystals","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastEpochTime","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","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":"address","name":"owner","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomWalkNFT","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"crystalTokenId","type":"uint32"},{"internalType":"uint8","name":"targetSym","type":"uint8"}],"name":"setCrystalTargetSym","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spiralbits","outputs":[{"internalType":"contract SpiralBits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeImpish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"contractTokenIds","type":"uint32[]"},{"internalType":"address","name":"owner","type":"address"}],"name":"stakeNFTsForOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeSpiralBits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakedNFTsAndTokens","outputs":[{"internalType":"uint16","name":"numRWStaked","type":"uint16"},{"internalType":"uint16","name":"numSpiralsStaked","type":"uint16"},{"internalType":"uint16","name":"numGrowingCrystalsStaked","type":"uint16"},{"internalType":"uint16","name":"numFullCrystalsStaked","type":"uint16"},{"internalType":"uint32","name":"lastClaimEpoch","type":"uint32"},{"internalType":"uint96","name":"spiralBitsStaked","type":"uint96"},{"internalType":"uint96","name":"impishStaked","type":"uint96"},{"internalType":"uint96","name":"claimedSpiralBits","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedTokenOwners","outputs":[{"internalType":"uint256","name":"ownedTokensIndex","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"claimReward","type":"bool"}],"name":"unstakeImpish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"contractTokenIds","type":"uint32[]"},{"internalType":"bool","name":"claim","type":"bool"}],"name":"unstakeNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"claimReward","type":"bool"}],"name":"unstakeSpiralBits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50613af8806100206000396000f3fe6080604052600436106101775760003560e01c8063049b39a01461018357806307ca9f44146101ac578063150b7a02146101d957806319e5aeaa1461021e57806327d4b423146102405780632cb57ec6146102825780632f745c591461029857806331d7a262146102b85780633df883fd146102d8578063438b6300146103b2578063515f01ad146103df57806354072d4a146103ff5780635cf257741461041f578063715018a61461043f57806384c43c4914610454578063892044f01461046a57806389c614b8146104805780638b3d81b3146104aa5780638da5cb5b1461050457806390993ddd146105195780639685da5314610539578063ac95643914610559578063c4d66de814610579578063c6b61e4c14610599578063cb91e083146105e5578063cb95192f14610605578063ccc5712814610625578063d0e16ad414610645578063db029c6714610665578063e581e64114610685578063f2fde38b146106a5578063f9d1cdd7146106c557600080fd5b3661017e57005b600080fd5b34801561018f57600080fd5b5061019960995481565b6040519081526020015b60405180910390f35b3480156101b857600080fd5b50609d546101cc906001600160a01b031681565b6040516101a3919061330a565b3480156101e557600080fd5b506102056101f4366004613333565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016101a3565b34801561022a57600080fd5b5061023e6102393660046133df565b6106db565b005b34801561024c57600080fd5b5061027061025b366004613415565b60a56020526000908152604090205460ff1681565b60405160ff90911681526020016101a3565b34801561028e57600080fd5b5061019960975481565b3480156102a457600080fd5b506101996102b3366004613432565b610831565b3480156102c457600080fd5b506101996102d336600461345e565b6108b2565b3480156102e457600080fd5b506103576102f336600461345e565b60a4602052600090815260409020805460019091015461ffff80831692620100008104821692600160201b8204831692600160301b8304169163ffffffff600160401b820416916001600160601b03600160601b9283900481169282821692041688565b6040805161ffff998a16815297891660208901529588169587019590955292909516606085015263ffffffff1660808401526001600160601b0393841660a0840152831660c08301529190911660e0820152610100016101a3565b3480156103be57600080fd5b506103d26103cd36600461345e565b610b1b565b6040516101a3919061347b565b3480156103eb57600080fd5b5061023e6103fa36600461350a565b610bcf565b34801561040b57600080fd5b5061023e61041a36600461350a565b610f0a565b34801561042b57600080fd5b5061023e61043a366004613560565b611150565b34801561044b57600080fd5b5061023e611508565b34801561046057600080fd5b50610199609a5481565b34801561047657600080fd5b50610199609b5481565b34801561048c57600080fd5b5060a25461049d9063ffffffff1681565b6040516101a391906135ab565b3480156104b657600080fd5b506104e76104c53660046135bc565b60a360205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016101a3565b34801561051057600080fd5b506101cc611543565b34801561052557600080fd5b5061023e6105343660046135bc565b611552565b34801561054557600080fd5b5061023e6105543660046135bc565b61169a565b34801561056557600080fd5b50609e546101cc906001600160a01b031681565b34801561058557600080fd5b5061023e61059436600461345e565b6117f1565b3480156105a557600080fd5b506105b96105b43660046135bc565b611c71565b6040805163ffffffff90941684526001600160601b0392831660208501529116908201526060016101a3565b3480156105f157600080fd5b5061023e6106003660046135bc565b611cb3565b34801561061157600080fd5b5061023e6106203660046133df565b611dd1565b34801561063157600080fd5b50609f546101cc906001600160a01b031681565b34801561065157600080fd5b5060a0546101cc906001600160a01b031681565b34801561067157600080fd5b50609c546101cc906001600160a01b031681565b34801561069157600080fd5b5061023e6106a03660046135e4565b611eb9565b3480156106b157600080fd5b5061023e6106c036600461345e565b611f60565b3480156106d157600080fd5b5061019960985481565b600260015414156107075760405162461bcd60e51b81526004016106fe9061361d565b60405180910390fd5b6002600190815533600090815260a46020526040902001546001600160601b03168061076c5760405162461bcd60e51b81526020600482015260146024820152734e6f20494d5049534820746f20556e7374616b6560601b60448201526064016106fe565b61077533612000565b33600081815260a460205260409081902060010180546001600160601b031916905560a054905163a9059cbb60e01b81526001600160a01b039091169163a9059cbb916107c791908590600401613654565b602060405180830381600087803b1580156107e157600080fd5b505af11580156107f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610819919061366d565b5081156108295761082933612108565b505060018055565b600061083c836121d0565b82106108855760405162461bcd60e51b81526020600482015260186024820152774f776e6572496e646578206f7574206f6620626f756e647360401b60448201526064016106fe565b506001600160a01b0391909116600090815260a46020908152604080832093835260029093019052205490565b6001600160a01b038116600090815260a4602052604081208054600190910154600160401b90910463ffffffff1690600160601b90046001600160601b0316811561090e576109018483612231565b61090b90826136a0565b90505b600061091861252c565b805190915063ffffffff1615610b135760208101516001600160601b0316156109a9576020808201516001600160a01b038716600090815260a490925260409091205482516097546001600160601b0393841693600160601b909304909216916109889163ffffffff16906136b8565b61099291906136b8565b61099c91906136ed565b6109a690836136a0565b91505b60408101516001600160601b031615610a24576040818101516001600160a01b038716600090815260a4602052919091206001015482516098546001600160601b039384169390921691610a039163ffffffff16906136b8565b610a0d91906136b8565b610a1791906136ed565b610a2190836136a0565b91505b6001600160a01b038516600090815260a4602052604090205460995482516201000090920461ffff1691610a5e919063ffffffff166136b8565b610a6891906136b8565b610a7290836136a0565b6001600160a01b038616600090815260a46020526040902054609a54835192945061ffff90911691610aaa919063ffffffff166136b8565b610ab491906136b8565b610abe90836136a0565b6001600160a01b038616600090815260a46020526040902054609b548351929450600160301b90910461ffff1691610afc919063ffffffff166136b8565b610b0691906136b8565b610b1090836136a0565b91505b509392505050565b60606000610b28836121d0565b905080610b45576040805160008082526020820190925290610b13565b6000816001600160401b03811115610b5f57610b5f613701565b604051908082528060200260200182016040528015610b88578160200160208202803683370190505b50905060005b82811015610b1357610ba08582610831565b828281518110610bb257610bb2613717565b602090810291909101015280610bc78161372d565b915050610b8e565b60026001541415610bf25760405162461bcd60e51b81526004016106fe9061361d565b6002600155610c0033612000565b60005b82811015610ef157620f4240848483818110610c2157610c21613717565b9050602002016020810190610c369190613415565b63ffffffff1611610c595760405162461bcd60e51b81526004016106fe90613748565b6000620f4240858584818110610c7157610c71613717565b9050602002016020810190610c869190613415565b610c909190613775565b90506000620f4240868685818110610caa57610caa613717565b9050602002016020810190610cbf9190613415565b610cc99190613798565b90508163ffffffff1660011415610d3d57609c54610cfa906001600160a01b031663ffffffff8316620f4240612699565b33600090815260a460205260408120805460019290610d1e90849061ffff166137bb565b92506101000a81548161ffff021916908361ffff160217905550610edc565b8163ffffffff1660021415610d9957609d54610d6c906001600160a01b031663ffffffff8316621e8480612699565b33600090815260a460205260409020805460019190600290610d1e90849062010000900461ffff166137bb565b8163ffffffff1660031415610e4657609e54610dc8906001600160a01b031663ffffffff8316622dc6c0612699565b33600090815260a460205260409020805460019190600490610df6908490600160201b900461ffff166137bb565b92506101000a81548161ffff021916908361ffff16021790555060a5600082622dc6c0610e2391906137de565b63ffffffff1681526020810191909152604001600020805460ff19169055610edc565b8163ffffffff1660041415610ea357609e54610e75906001600160a01b031663ffffffff8316623d0900612699565b33600090815260a460205260409020805460019190600690610d1e908490600160301b900461ffff166137bb565b60405162461bcd60e51b815260206004820152600e60248201526d496e76616c69644e46545479706560901b60448201526064016106fe565b50508080610ee99061372d565b915050610c03565b508015610f0157610f0133612108565b50506001805550565b60026001541415610f2d5760405162461bcd60e51b81526004016106fe9061361d565b6002600155610f3b33612000565b610f7783838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061275392505050565b60005b82811015610ef1576000848483818110610f9657610f96613717565b9050602002016020810190610fab9190613415565b90506000610fbc622dc6c083613806565b609e546040516331b3ab3f60e01b81529192506000916001600160a01b03909116906331b3ab3f90610ff29085906004016135ab565b60a06040518083038186803b15801561100a57600080fd5b505afa15801561101e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611042919061383f565b5050505090508060ff166064141561113a57611064338463ffffffff16612ea1565b33600090815260a460205260409020805460019190600490611092908490600160201b900461ffff166137bb565b92506101000a81548161ffff021916908361ffff160217905550600082623d09006110bd91906137de565b63ffffffff1690506110cf3382612f59565b600081815260a360209081526040808320600190810180546001600160a01b03191633908117909155845260a4909252909120805460069061111e90849061ffff600160301b909104166138af565b92506101000a81548161ffff021916908361ffff160217905550505b50505080806111489061372d565b915050610f7a565b600260015414156111735760405162461bcd60e51b81526004016106fe9061361d565b600260015561118181612000565b60005b828110156114fe57620f42408484838181106111a2576111a2613717565b90506020020160208101906111b79190613415565b63ffffffff16116111da5760405162461bcd60e51b81526004016106fe90613748565b6000620f42408585848181106111f2576111f2613717565b90506020020160208101906112079190613415565b6112119190613775565b90506000620f424086868581811061122b5761122b613717565b90506020020160208101906112409190613415565b61124a9190613798565b90508163ffffffff16600114156112c857609c5461127c906001600160a01b03168563ffffffff8416620f4240612fa0565b6001600160a01b038416600090815260a4602052604081208054600192906112a990849061ffff166138af565b92506101000a81548161ffff021916908361ffff1602179055506114e9565b8163ffffffff166002141561132e57609d546112f8906001600160a01b03168563ffffffff8416621e8480612fa0565b6001600160a01b038416600090815260a4602052604090208054600191906002906112a990849062010000900461ffff166138af565b8163ffffffff166003141561139557609e5461135e906001600160a01b03168563ffffffff8416622dc6c0612fa0565b6001600160a01b038416600090815260a4602052604090208054600191906004906112a9908490600160201b900461ffff166138af565b8163ffffffff1660041415610ea357609e546040516331b3ab3f60e01b81526000916001600160a01b0316906331b3ab3f906113d59085906004016135ab565b60a06040518083038186803b1580156113ed57600080fd5b505afa158015611401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611425919061383f565b5050505090508060ff166064146114755760405162461bcd60e51b815260206004820152601460248201527321b93cb9ba30b62737ba233ab6363ca3b937bbb760611b60448201526064016106fe565b609e54611496906001600160a01b03168663ffffffff8516623d0900612fa0565b6001600160a01b038516600090815260a4602052604090208054600191906006906114cd908490600160301b900461ffff166138af565b92506101000a81548161ffff021916908361ffff160217905550505b505080806114f69061372d565b915050611184565b5050600180555050565b33611511611543565b6001600160a01b0316146115375760405162461bcd60e51b81526004016106fe906138cc565b61154160006130ea565b565b6065546001600160a01b031690565b600260015414156115755760405162461bcd60e51b81526004016106fe9061361d565b6002600155609d5460405163ee0144ab60e01b8152600481018390526001600160a01b039091169063ee0144ab90602401600060405180830381600087803b1580156115c057600080fd5b505af11580156115d4573d6000803e3d6000fd5b50505050600060a3600083621e84806115ed91906136a0565b81526020810191909152604090810160009081206001015491516001600160a01b03909216925090829047908381818185875af1925050503d8060008114611651576040519150601f19603f3d011682016040523d82523d6000602084013e611656565b606091505b5050905080610f015760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016106fe565b600260015414156116bd5760405162461bcd60e51b81526004016106fe9061361d565b6002600155806117015760405162461bcd60e51b815260206004820152600f60248201526e4e6565642053504952414c4249545360881b60448201526064016106fe565b61170a33612000565b609f546040516323b872dd60e01b81526001600160a01b03909116906323b872dd9061173e90339030908690600401613901565b602060405180830381600087803b15801561175857600080fd5b505af115801561176c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611790919061366d565b5033600090815260a4602052604090208054829190600c906117c3908490600160601b90046001600160601b0316613925565b92506101000a8154816001600160601b0302191690836001600160601b031602179055506001808190555050565b600054610100900460ff1661180c5760005460ff1615611810565b303b155b6118735760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106fe565b600054610100900460ff16158015611895576000805461ffff19166101011790555b61189d61313c565b6118a5613173565b673782dace9d900000609755670de0b6b3a764000060985567028ca22d3d3d4000609955666acb6925f2c000609a55670128a6cebebec000609b55609e80546001600160a01b0319166001600160a01b0384169081179091556040805163cfa2acf360e01b8152905163cfa2acf391600480820192602092909190829003018186803b15801561193457600080fd5b505afa158015611948573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196c9190613947565b609d80546001600160a01b0319166001600160a01b03929092169182179055604080516389ee100960e01b815290516389ee100991600480820192602092909190829003018186803b1580156119c157600080fd5b505afa1580156119d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f99190613947565b609c80546001600160a01b0319166001600160a01b03928316179055609e54604080516335b1ff6360e11b815290519190921691636b63fec6916004808301926020929190829003018186803b158015611a5257600080fd5b505afa158015611a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8a9190613947565b609f80546001600160a01b0319166001600160a01b03928316179055609d5460408051636030088160e11b81529051919092169163c0601102916004808301926020929190829003018186803b158015611ae357600080fd5b505afa158015611af7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1b9190613947565b60a080546001600160a01b0319166001600160a01b039283161790556040805160608101825260008082526020820181815282840182815260a1805460018101825593529251600080516020613aa383398151915290920180549151935163ffffffff9093166001600160801b031990921691909117600160201b6001600160601b039485160217600160801b600160e01b031916600160801b9390921692909202179055609f54905163095ea7b360e01b815291169063095ea7b390611bf3908590676765c793fa10079d601c1b90600401613654565b602060405180830381600087803b158015611c0d57600080fd5b505af1158015611c21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c45919061366d565b5060a2805463ffffffff19164263ffffffff161790558015611c6d576000805461ff00191690555b5050565b60a18181548110611c8157600080fd5b60009182526020909120015463ffffffff811691506001600160601b03600160201b8204811691600160801b90041683565b60026001541415611cd65760405162461bcd60e51b81526004016106fe9061361d565b600260015580611d165760405162461bcd60e51b815260206004820152600b60248201526a09ccacac840929aa092a6960ab1b60448201526064016106fe565b60a0546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611d4a90339030908690600401613901565b602060405180830381600087803b158015611d6457600080fd5b505af1158015611d78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9c919061366d565b50611da633612000565b33600090815260a46020526040812060010180548392906117c39084906001600160601b0316613925565b60026001541415611df45760405162461bcd60e51b81526004016106fe9061361d565b600260015533600090815260a46020526040902054600160601b90046001600160601b031680611e5e5760405162461bcd60e51b81526020600482015260156024820152744e6f53504952414c42495453546f556e7374616b6560581b60448201526064016106fe565b611e6733612000565b33600081815260a46020526040908190208054600160601b600160c01b0319169055609f54905163a9059cbb60e01b81526001600160a01b039091169163a9059cbb916107c791908590600401613654565b60026001541415611edc5760405162461bcd60e51b81526004016106fe9061361d565b60026001556000611ef083622dc6c06137de565b63ffffffff8116600090815260a360205260409020600101549091506001600160a01b03163314611f335760405162461bcd60e51b81526004016106fe90613964565b63ffffffff16600090815260a560205260409020805460ff191660ff929092169190911790555060018055565b33611f69611543565b6001600160a01b031614611f8f5760405162461bcd60e51b81526004016106fe906138cc565b6001600160a01b038116611ff45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106fe565b611ffd816130ea565b50565b60a25463ffffffff16421115612018576120186131a2565b6001600160a01b038116600090815260a4602052604090205460a154600160401b90910463ffffffff169061204f9060019061398c565b6001600160a01b038316600090815260a460205260409020805463ffffffff92909216600160401b0263ffffffff60401b1990921691909117905580612093575050565b600061209f8383612231565b6001600160a01b038416600090815260a46020526040902060010180549192508291600c906120df908490600160601b90046001600160601b0316613925565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550505050565b61211181612000565b6001600160a01b038116600090815260a46020526040902060010154600160601b90046001600160601b03168015611c6d576001600160a01b03808316600090815260a46020526040908190206001018054600160601b600160c01b0319169055609f5490516307264f8360e31b81529116906339327c189061219a9085908590600401613654565b600060405180830381600087803b1580156121b457600080fd5b505af11580156121c8573d6000803e3d6000fd5b505050505050565b6001600160a01b038116600090815260a4602052604081205461ffff600160301b8204811691600160201b810482169161221391620100008104821691166138af565b61221d91906138af565b61222791906138af565b61ffff1692915050565b60008080806122418560016136a0565b90505b60a1548110156124515760a1818154811061226157612261613717565b60009182526020909120015461227d9063ffffffff16836136a0565b9150600060a1828154811061229457612294613717565b600091825260209091200154600160201b90046001600160601b031611156123615760a181815481106122c9576122c9613717565b60009182526020808320909101546001600160a01b038916835260a490915260409091205460a180546001600160601b03600160201b909404841693600160601b909304909216918490811061232157612321613717565b6000918252602090912001546097546123409163ffffffff16906136b8565b61234a91906136b8565b61235491906136ed565b61235e90846136a0565b92505b600060a1828154811061237657612376613717565b600091825260209091200154600160801b90046001600160601b0316111561243f5760a181815481106123ab576123ab613717565b60009182526020808320909101546001600160a01b038916835260a490915260409091206001015460a180546001600160601b03600160801b9094048416939290921691849081106123ff576123ff613717565b60009182526020909120015460985461241e9163ffffffff16906136b8565b61242891906136b8565b61243291906136ed565b61243c90846136a0565b92505b806124498161372d565b915050612244565b506001600160a01b038516600090815260a460205260409020546099546201000090910461ffff169061248490836136b8565b61248e91906136b8565b61249890836136a0565b6001600160a01b038616600090815260a46020526040902054609a5491935061ffff16906124c690836136b8565b6124d091906136b8565b6124da90836136a0565b6001600160a01b038616600090815260a46020526040902054609b54919350600160301b900461ffff169061250f90836136b8565b61251991906136b8565b61252390836136a0565b95945050505050565b6040805160608082018352600080835260208301819052828401819052835191820190935260a25491929181906125699063ffffffff1642613806565b63ffffffff168152609f546040516370a0823160e01b81526020909201916001600160a01b03909116906370a08231906125a790309060040161330a565b60206040518083038186803b1580156125bf57600080fd5b505afa1580156125d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f791906139a3565b6001600160601b0316815260a0546040516370a0823160e01b81526020909201916001600160a01b03909116906370a082319061263890309060040161330a565b60206040518083038186803b15801561265057600080fd5b505afa158015612664573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061268891906139a3565b6001600160601b0316905292915050565b60006126a583836136a0565b600081815260a360205260409020600101549091506001600160a01b031633146126e15760405162461bcd60e51b81526004016106fe906139bc565b6126eb3382612ea1565b604051632142170760e11b81526001600160a01b038516906342842e0e9061271b90309033908890600401613901565b600060405180830381600087803b15801561273557600080fd5b505af1158015612749573d6000803e3d6000fd5b5050505050505050565b33600090815260a46020526040908190206001018054600160601b600160c01b03198116909155609f5491516307264f8360e31b8152306004820152600160601b9091046001600160601b031660248201819052916001600160a01b0316906339327c1890604401600060405180830381600087803b1580156127d557600080fd5b505af11580156127e9573d6000803e3d6000fd5b5050505060005b8251811015612dfc57600083828151811061280d5761280d613717565b602002602001015190506000622dc6c0826128289190613806565b63ffffffff8316600090815260a360205260409020600101549091506001600160a01b0316331461286b5760405162461bcd60e51b81526004016106fe90613964565b609e546040516331b3ab3f60e01b815260009182916001600160a01b03909116906331b3ab3f906128a09086906004016135ab565b60a06040518083038186803b1580156128b857600080fd5b505afa1580156128cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f0919061383f565b5050925050915060648260ff161015612a5357600060ff82166129148460646139e0565b60ff16609e60009054906101000a90046001600160a01b03166001600160a01b03166392a288186040518163ffffffff1660e01b815260040160206040518083038186803b15801561296557600080fd5b505afa158015612979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299d9190613a03565b6001600160c01b03166129b091906136b8565b6129ba91906136b8565b9050806001600160601b0316876001600160601b03161115612a5157609e546001600160a01b03166339d4831c856129f38660646139e0565b6040518363ffffffff1660e01b8152600401612a10929190613a1e565b600060405180830381600087803b158015612a2a57600080fd5b505af1158015612a3e573d6000803e3d6000fd5b505050508087612a4e9190613a37565b96505b505b63ffffffff8416600090815260a5602052604090205460ff1615801590612a94575063ffffffff8416600090815260a5602052604090205460ff8083169116115b15612be75763ffffffff8416600090815260a56020526040812054612abd90839060ff166139e0565b905060008160ff16609e60009054906101000a90046001600160a01b03166001600160a01b0316632650fca36040518163ffffffff1660e01b815260040160206040518083038186803b158015612b1357600080fd5b505afa158015612b27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b4b91906139a3565b612b5591906136b8565b9050806001600160601b0316886001600160601b03161115612be457609e5460405163644e330360e11b81526001600160a01b039091169063c89c660690612ba39088908690600401613a1e565b600060405180830381600087803b158015612bbd57600080fd5b505af1158015612bd1573d6000803e3d6000fd5b505050508088612be19190613a37565b97505b50505b609e546040516331b3ab3f60e01b81526001600160a01b03909116906331b3ab3f90612c179086906004016135ab565b60a06040518083038186803b158015612c2f57600080fd5b505afa158015612c43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c67919061383f565b5092945092505050606460ff83161015612dcb57600060ff8216612c8c8460646139e0565b60ff16609e60009054906101000a90046001600160a01b03166001600160a01b03166392a288186040518163ffffffff1660e01b815260040160206040518083038186803b158015612cdd57600080fd5b505afa158015612cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d159190613a03565b6001600160c01b0316612d2891906136b8565b612d3291906136b8565b9050806001600160601b0316876001600160601b03161115612dc957609e546001600160a01b03166339d4831c85612d6b8660646139e0565b6040518363ffffffff1660e01b8152600401612d88929190613a1e565b600060405180830381600087803b158015612da257600080fd5b505af1158015612db6573d6000803e3d6000fd5b505050508087612dc69190613a37565b96505b505b50505063ffffffff16600090815260a560205260409020805460ff1916905580612df48161372d565b9150506127f0565b50609f54604051630852cd8d60e31b81526001600160601b03831660048201526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015612e4b57600080fd5b505af1158015612e5f573d6000803e3d6000fd5b505033600090815260a46020526040902060010180546001600160601b03909416600160601b02600160601b600160c01b031990941693909317909255505050565b60006001612eae846121d0565b612eb8919061398c565b600083815260a36020526040902054909150808214612f0e576001600160a01b038416600090815260a460209081526040808320858452600201825280832054848452818420819055835260a390915290208190555b50600091825260a36020908152604080842084815560010180546001600160a01b03191690556001600160a01b0394909416835260a481528383209183526002909101905290812055565b6000612f64836121d0565b6001600160a01b03909316600090815260a460209081526040808320868452600201825280832085905593825260a39052919091209190915550565b6040516331a9108f60e11b81526004810183905233906001600160a01b03861690636352211e9060240160206040518083038186803b158015612fe257600080fd5b505afa158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a9190613947565b6001600160a01b0316146130405760405162461bcd60e51b81526004016106fe906139bc565b600061304c83836136a0565b90506130588482612f59565b600081815260a360205260409081902060010180546001600160a01b0319166001600160a01b03878116919091179091559051632142170760e11b8152908616906342842e0e906130b190339030908890600401613901565b600060405180830381600087803b1580156130cb57600080fd5b505af11580156130df573d6000803e3d6000fd5b505050505050505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166131635760405162461bcd60e51b81526004016106fe90613a57565b61316b613286565b6115416132ad565b600054610100900460ff1661319a5760405162461bcd60e51b81526004016106fe90613a57565b6115416132dd565b60a25463ffffffff90811642909116116131e75760405162461bcd60e51b8152602060048201526006602482015265546f6f4e657760d01b60448201526064016106fe565b60006131f161252c565b60a2805463ffffffff19164263ffffffff9081169190911790915560a180546001810182556000919091528251600080516020613aa383398151915290910180546020850151604090950151929093166001600160801b031990931692909217600160201b6001600160601b039485160217600160801b600160e01b031916600160801b939091169290920291909117905550565b600054610100900460ff166115415760405162461bcd60e51b81526004016106fe90613a57565b600054610100900460ff166132d45760405162461bcd60e51b81526004016106fe90613a57565b611541336130ea565b600054610100900460ff166133045760405162461bcd60e51b81526004016106fe90613a57565b60018055565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114611ffd57600080fd5b60008060008060006080868803121561334b57600080fd5b85356133568161331e565b945060208601356133668161331e565b93506040860135925060608601356001600160401b038082111561338957600080fd5b818801915088601f83011261339d57600080fd5b8135818111156133ac57600080fd5b8960208285010111156133be57600080fd5b9699959850939650602001949392505050565b8015158114611ffd57600080fd5b6000602082840312156133f157600080fd5b81356133fc816133d1565b9392505050565b63ffffffff81168114611ffd57600080fd5b60006020828403121561342757600080fd5b81356133fc81613403565b6000806040838503121561344557600080fd5b82356134508161331e565b946020939093013593505050565b60006020828403121561347057600080fd5b81356133fc8161331e565b6020808252825182820181905260009190848201906040850190845b818110156134b357835183529284019291840191600101613497565b50909695505050505050565b60008083601f8401126134d157600080fd5b5081356001600160401b038111156134e857600080fd5b6020830191508360208260051b850101111561350357600080fd5b9250929050565b60008060006040848603121561351f57600080fd5b83356001600160401b0381111561353557600080fd5b613541868287016134bf565b9094509250506020840135613555816133d1565b809150509250925092565b60008060006040848603121561357557600080fd5b83356001600160401b0381111561358b57600080fd5b613597868287016134bf565b90945092505060208401356135558161331e565b63ffffffff91909116815260200190565b6000602082840312156135ce57600080fd5b5035919050565b60ff81168114611ffd57600080fd5b600080604083850312156135f757600080fd5b823561360281613403565b91506020830135613612816135d5565b809150509250929050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b03929092168252602082015260400190565b60006020828403121561367f57600080fd5b81516133fc816133d1565b634e487b7160e01b600052601160045260246000fd5b600082198211156136b3576136b361368a565b500190565b60008160001904831182151516156136d2576136d261368a565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826136fc576136fc6136d7565b500490565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006000198214156137415761374161368a565b5060010190565b602080825260139082015272557365436f6e7472616374546f6b656e49447360681b604082015260600190565b600063ffffffff8084168061378c5761378c6136d7565b92169190910492915050565b600063ffffffff808416806137af576137af6136d7565b92169190910692915050565b600061ffff838116908316818110156137d6576137d661368a565b039392505050565b600063ffffffff8083168185168083038211156137fd576137fd61368a565b01949350505050565b600063ffffffff838116908316818110156137d6576137d661368a565b80516001600160c01b038116811461383a57600080fd5b919050565b600080600080600060a0868803121561385757600080fd5b8551613862816135d5565b6020870151909550613873816135d5565b6040870151909450613884816135d5565b606087015190935061389581613403565b91506138a360808701613823565b90509295509295909350565b600061ffff8083168185168083038211156137fd576137fd61368a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001600160601b038281168482168083038211156137fd576137fd61368a565b60006020828403121561395957600080fd5b81516133fc8161331e565b6020808252600e908201526d139bdd165bdd5c90dc9e5cdd185b60921b604082015260600190565b60008282101561399e5761399e61368a565b500390565b6000602082840312156139b557600080fd5b5051919050565b6020808252600a9082015269111bdb9d13dddb93919560b21b604082015260600190565b600060ff821660ff8416808210156139fa576139fa61368a565b90039392505050565b600060208284031215613a1557600080fd5b6133fc82613823565b63ffffffff92909216825260ff16602082015260400190565b60006001600160601b03838116908316818110156137d6576137d661368a565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056feaadc37b8ba5645e62f4546802db221593a94729ccbfc5a97d01365a88f649878a2646970667358221220324dca9ded6358fb57a6124c4bce3624511a3b735f2ede4ff11a786a1925f36664736f6c63430008090033

Deployed ByteCode Sourcemap

792:25006:26:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1445:47;;;;;;;;;;;;;;;;;;;160:25:28;;;148:2;133:18;1445:47:26;;;;;;;;1960:32;;;;;;;;;;-1:-1:-1;1960:32:26;;;;-1:-1:-1;;;;;1960:32:26;;;;;;;;;;:::i;25565:231::-;;;;;;;;;;-1:-1:-1;25565:231:26;;;;;:::i;:::-;-1:-1:-1;;;25565:231:26;;;;;;;;;;;-1:-1:-1;;;;;;1664:33:28;;;1646:52;;1634:2;1619:18;25565:231:26;1502:202:28;6290:539:26;;;;;;;;;;-1:-1:-1;6290:539:26;;;;;:::i;:::-;;:::i;:::-;;3482:49;;;;;;;;;;-1:-1:-1;3482:49:26;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2626:4:28;2614:17;;;2596:36;;2584:2;2569:18;3482:49:26;2454:184:28;1129:50:26;;;;;;;;;;;;;;;;18167:240;;;;;;;;;;-1:-1:-1;18167:240:26;;;;;:::i;:::-;;:::i;10020:1799::-;;;;;;;;;;-1:-1:-1;10020:1799:26;;;;;:::i;:::-;;:::i;3412:65::-;;;;;;;;;;-1:-1:-1;3412:65:26;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;3412:65:26;;;;;-1:-1:-1;;;3412:65:26;;;;;-1:-1:-1;;;3412:65:26;;;;-1:-1:-1;;;;;;;;3412:65:26;;;;;;;;;;;;;;;;;;;3552:6:28;3585:15;;;3567:34;;3637:15;;;3632:2;3617:18;;3610:43;3689:15;;;3669:18;;;3662:43;;;;3741:15;;;;3736:2;3721:18;;3714:43;3806:10;3794:23;3788:3;3773:19;;3766:52;-1:-1:-1;;;;;3892:15:28;;;3886:3;3871:19;;3864:44;3945:15;;3939:3;3924:19;;3917:44;3998:15;;;;3992:3;3977:19;;3970:44;3529:3;3514:19;3412:65:26;3215:805:28;17684:412:26;;;;;;;;;;-1:-1:-1;17684:412:26;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;8461:1555::-;;;;;;;;;;-1:-1:-1;8461:1555:26;;;;;:::i;:::-;;:::i;23572:1258::-;;;;;;;;;;-1:-1:-1;23572:1258:26;;;;;:::i;:::-;;:::i;6833:1624::-;;;;;;;;;;-1:-1:-1;6833:1624:26;;;;;:::i;:::-;;:::i;1924:101:22:-;;;;;;;;;;;;;:::i;1637:43:26:-;;;;;;;;;;;;;;;;1830:48;;;;;;;;;;;;;;;;2524:27;;;;;;;;;;-1:-1:-1;2524:27:26;;;;;;;;;;;;;;;:::i;3296:56::-;;;;;;;;;;-1:-1:-1;3296:56:26;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3296:56:26;;;;;;;6733:25:28;;;-1:-1:-1;;;;;6794:32:28;;;6789:2;6774:18;;6767:60;6706:18;3296:56:26;6559:274:28;1292:85:22;;;;;;;;;;;;;:::i;24903:379:26:-;;;;;;;;;;-1:-1:-1;24903:379:26;;;;;:::i;:::-;;:::i;4662:551::-;;;;;;;;;;-1:-1:-1;4662:551:26;;;;;:::i;:::-;;:::i;1996:29::-;;;;;;;;;;-1:-1:-1;1996:29:26;;;;-1:-1:-1;;;;;1996:29:26;;;3600:1058;;;;;;;;;;-1:-1:-1;3600:1058:26;;;;;:::i;:::-;;:::i;2475:27::-;;;;;;;;;;-1:-1:-1;2475:27:26;;;;;:::i;:::-;;:::i;:::-;;;;7502:10:28;7490:23;;;7472:42;;-1:-1:-1;;;;;7587:15:28;;;7582:2;7567:18;;7560:43;7639:15;;7619:18;;;7612:43;7460:2;7445:18;2475:27:26;7276:385:28;5781:505:26;;;;;;;;;;-1:-1:-1;5781:505:26;;;;;:::i;:::-;;:::i;5217:560::-;;;;;;;;;;-1:-1:-1;5217:560:26;;;;;:::i;:::-;;:::i;2078:28::-;;;;;;;;;;-1:-1:-1;2078:28:26;;;;-1:-1:-1;;;;;2078:28:26;;;2133:20;;;;;;;;;;-1:-1:-1;2133:20:26;;;;-1:-1:-1;;;;;2133:20:26;;;1928:28;;;;;;;;;;-1:-1:-1;1928:28:26;;;;-1:-1:-1;;;;;1928:28:26;;;20635:314;;;;;;;;;;-1:-1:-1;20635:314:26;;;;;:::i;:::-;;:::i;2174:198:22:-;;;;;;;;;;-1:-1:-1;2174:198:22;;;;;:::i;:::-;;:::i;1262:46:26:-;;;;;;;;;;;;;;;;6290:539;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;;;;;;;;;1802:1;2686:7;:18;;;6396:10:26::1;6359:14;6376:31:::0;;;:19:::1;:31;::::0;;;;:44:::1;::::0;-1:-1:-1;;;;;6376:44:26::1;6434:10:::0;6426:43:::1;;;::::0;-1:-1:-1;;;6426:43:26;;9408:2:28;6426:43:26::1;::::0;::::1;9390:21:28::0;9447:2;9427:18;;;9420:30;-1:-1:-1;;;9466:18:28;;;9459:50;9526:18;;6426:43:26::1;9206:344:28::0;6426:43:26::1;6585:26;6600:10;6585:14;:26::i;:::-;6663:10;6690:1;6643:31:::0;;;:19:::1;:31;::::0;;;;;;:44:::1;;:48:::0;;-1:-1:-1;;;;;;6643:48:26::1;::::0;;6726:6:::1;::::0;:35;;-1:-1:-1;;;6726:35:26;;-1:-1:-1;;;;;6726:6:26;;::::1;::::0;:15:::1;::::0;:35:::1;::::0;6663:10;6754:6;;6726:35:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;6772:11;6768:57;;;6793:25;6807:10;6793:13;:25::i;:::-;-1:-1:-1::0;;1759:1:24;2859:22;;6290:539:26:o;18167:240::-;18255:7;18286:29;18309:5;18286:22;:29::i;:::-;18278:5;:37;18270:74;;;;-1:-1:-1;;;18270:74:26;;10286:2:28;18270:74:26;;;10268:21:28;10325:2;10305:18;;;10298:30;-1:-1:-1;;;10344:18:28;;;10337:54;10408:18;;18270:74:26;10084:348:28;18270:74:26;-1:-1:-1;;;;;;18357:26:26;;;;;;;;:19;:26;;;;;;;;:45;;;:38;;;;:45;;;;;18167:240::o;10020:1799::-;-1:-1:-1;;;;;10122:26:26;;10080:7;10122:26;;;:19;:26;;;;;:41;;10233:44;;;;;-1:-1:-1;;;10122:41:26;;;;;;-1:-1:-1;;;10233:44:26;;-1:-1:-1;;;;;10233:44:26;10321:20;;10317:103;;10366:47;10389:5;10396:16;10366:22;:47::i;:::-;10351:62;;;;:::i;:::-;;;10317:103;10464:27;10494:15;:13;:15::i;:::-;10519:25;;10464:45;;-1:-1:-1;10519:29:26;;;10515:1218;;10619:30;;;;-1:-1:-1;;;;;10619:34:26;;10615:280;;10855:30;;;;;-1:-1:-1;;;;;10789:26:26;;;;;;:19;:26;;;;;;;:43;10741:25;;10691:35;;-1:-1:-1;;;;;10847:39:26;;;;-1:-1:-1;;;10789:43:26;;;;;;;10691:75;;;;;;:::i;:::-;:142;;;;:::i;:::-;10690:196;;;;:::i;:::-;10665:221;;;;:::i;:::-;;;10615:280;10907:26;;;;-1:-1:-1;;;;;10907:30:26;;10903:264;;11131:26;;;;;-1:-1:-1;;;;;11069:26:26;;;;;;:19;:26;;;;;;:39;;;11021:25;;10975:31;;-1:-1:-1;;;;;11123:35:26;;;;11069:39;;;;10975:71;;;;;;:::i;:::-;:134;;;;:::i;:::-;10974:184;;;;:::i;:::-;10949:209;;;;:::i;:::-;;;10903:264;-1:-1:-1;;;;;11313:26:26;;;;;;:19;:26;;;;;:43;11270:32;;11234:25;;11313:43;;;;;;;11234:68;;11270:32;11234:68;;;:::i;:::-;:122;;;;:::i;:::-;11211:145;;;;:::i;:::-;-1:-1:-1;;;;;11479:26:26;;;;;;:19;:26;;;;;:38;11448:28;;11420:25;;11211:145;;-1:-1:-1;11479:38:26;;;;;11420:56;;11448:28;11420:56;;;:::i;:::-;:97;;;;:::i;:::-;11405:112;;;;:::i;:::-;-1:-1:-1;;;;;11678:26:26;;;;;;:19;:26;;;;;:48;11634:33;;11598:25;;11405:112;;-1:-1:-1;;;;11678:48:26;;;;;;11598:69;;11634:33;11598:69;;;:::i;:::-;:128;;;;:::i;:::-;11575:151;;;;:::i;:::-;;;10515:1218;-1:-1:-1;11803:11:26;10020:1799;-1:-1:-1;;;10020:1799:26:o;17684:412::-;17744:16;17768:18;17789:30;17812:6;17789:22;:30::i;:::-;17768:51;-1:-1:-1;17830:15:26;17826:90;;17893:16;;;17907:1;17893:16;;;;;;;;;;;;17826:90;17922:23;17962:10;-1:-1:-1;;;;;17948:25:26;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;17948:25:26;;17922:51;;17984:9;17979:94;17999:10;17995:1;:14;17979:94;;;18036:30;18056:6;18064:1;18036:19;:30::i;:::-;18024:6;18031:1;18024:9;;;;;;;;:::i;:::-;;;;;;;;;;:42;18011:3;;;;:::i;:::-;;;;17979:94;;8461:1555;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;8636:26:26::1;8651:10;8636:14;:26::i;:::-;8674:9;8669:1286;8689:27:::0;;::::1;8669:1286;;;8761:9;8739:16;;8756:1;8739:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;8731:63;;;;-1:-1:-1::0;;;8731:63:26::1;;;;;;;:::i;:::-;8802:14;8841:9;8819:16;;8836:1;8819:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;;:::i;:::-;8802:48;;8858:14;8897:9;8875:16;;8892:1;8875:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;;:::i;:::-;8858:48;;8919:7;:12;;8930:1;8919:12;8915:1034;;;8955:13;::::0;8943:55:::1;::::0;-1:-1:-1;;;;;8955:13:26::1;8970:16;::::0;::::1;8988:9;8943:11;:55::i;:::-;9076:10;9056:31;::::0;;;:19:::1;:31;::::0;;;;:48;;9103:1:::1;::::0;9056:31;:48:::1;::::0;9103:1;;9056:48:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;8915:1034;;;9123:7;:12;;9134:1;9123:12;9119:830;;;9159:12;::::0;9147:54:::1;::::0;-1:-1:-1;;;;;9159:12:26::1;9173:16;::::0;::::1;9191:9;9147:11;:54::i;:::-;9280:10;9260:31;::::0;;;:19:::1;:31;::::0;;;;:53;;9312:1:::1;::::0;9260:31;:48:::1;::::0;:53:::1;::::0;9312:1;;9260:53;;::::1;;;;:::i;9119:830::-;9332:7;:12;;9343:1;9332:12;9328:621;;;9405:8;::::0;9393:50:::1;::::0;-1:-1:-1;;;;;9405:8:26::1;9415:16;::::0;::::1;9433:9;9393:11;:50::i;:::-;9533:10;9513:31;::::0;;;:19:::1;:31;::::0;;;;:61;;9573:1:::1;::::0;9513:31;:56:::1;::::0;:61:::1;::::0;9573:1;;-1:-1:-1;;;9513:61:26;::::1;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;9591:17;:38;9609:7;9619:9;9609:19;;;;:::i;:::-;9591:38;;::::0;;::::1;::::0;::::1;::::0;;;;;;-1:-1:-1;9591:38:26;9584:45;;-1:-1:-1;;9584:45:26::1;::::0;;9328:621:::1;;;9648:7;:12;;9659:1;9648:12;9644:305;;;9721:8;::::0;9709:50:::1;::::0;-1:-1:-1;;;;;9721:8:26::1;9731:16;::::0;::::1;9749:9;9709:11;:50::i;:::-;9853:10;9833:31;::::0;;;:19:::1;:31;::::0;;;;:58;;9890:1:::1;::::0;9833:31;:53:::1;::::0;:58:::1;::::0;9890:1;;-1:-1:-1;;;9833:58:26;::::1;;;;:::i;9644:305::-;9916:24;::::0;-1:-1:-1;;;9916:24:26;;12925:2:28;9916:24:26::1;::::0;::::1;12907:21:28::0;12964:2;12944:18;;;12937:30;-1:-1:-1;;;12983:18:28;;;12976:44;13037:18;;9916:24:26::1;12723:338:28::0;9644:305:26::1;8723:1232;;8718:3;;;;;:::i;:::-;;;;8669:1286;;;;9965:5;9961:51;;;9980:25;9994:10;9980:13;:25::i;:::-;-1:-1:-1::0;;1759:1:24;2859:22;;-1:-1:-1;8461:1555:26:o;23572:1258::-;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;23680:26:26::1;23695:10;23680:14;:26::i;:::-;23749:38;23763:23;;23749:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;23749:13:26::1;::::0;-1:-1:-1;;;23749:38:26:i:1;:::-;23865:9;23860:909;23880:34:::0;;::::1;23860:909;;;23929:29;23961:23;;23985:1;23961:26;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;23929:58:::0;-1:-1:-1;23995:21:26::1;24019:34;24044:9;23929:58:::0;24019:34:::1;:::i;:::-;24099:8;::::0;:33:::1;::::0;-1:-1:-1;;;24099:33:26;;23995:58;;-1:-1:-1;24063:24:26::1;::::0;-1:-1:-1;;;;;24099:8:26;;::::1;::::0;:17:::1;::::0;:33:::1;::::0;23995:58;;24099:33:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;24062:70;;;;;;24216:18;:25;;24238:3;24216:25;24212:551;;;24288:68;24321:10;24333:22;24288:68;;:32;:68::i;:::-;24386:10;24366:31;::::0;;;:19:::1;:31;::::0;;;;:61;;24426:1:::1;::::0;24366:31;:56:::1;::::0;:61:::1;::::0;24426:1;;-1:-1:-1;;;24366:61:26;::::1;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;24475:33;24523:14;24511:9;:26;;;;:::i;:::-;24475:62;;;;24547:66;24575:10;24587:25;24547:27;:66::i;:::-;24623:44;::::0;;;:17:::1;:44;::::0;;;;;;;:50:::1;::::0;;::::1;:63:::0;;-1:-1:-1;;;;;;24623:63:26::1;24676:10;24623:63:::0;;::::1;::::0;;;24696:31;;:19:::1;:31:::0;;;;;;:58;;:53:::1;::::0;:58:::1;::::0;24623:50;;24696:58:::1;-1:-1:-1::0;;;24696:58:26;;::::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;24243:520;24212:551;23921:848;;;23916:3;;;;;:::i;:::-;;;;23860:909;;6833:1624:::0;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;7048:21:26::1;7063:5:::0;7048:14:::1;:21::i;:::-;7081:9;7076:1377;7096:27:::0;;::::1;7076:1377;;;7168:9;7146:16;;7163:1;7146:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;7138:63;;;;-1:-1:-1::0;;;7138:63:26::1;;;;;;;:::i;:::-;7209:14;7248:9;7226:16;;7243:1;7226:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;;:::i;:::-;7209:48;;7265:14;7304:9;7282:16;;7299:1;7282:19;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:31;;;;:::i;:::-;7265:48;;7326:7;:12;;7337:1;7326:12;7322:1125;;;7360:13;::::0;7350:60:::1;::::0;-1:-1:-1;;;;;7360:13:26::1;7375:5:::0;7382:16:::1;::::0;::::1;7400:9;7350;:60::i;:::-;-1:-1:-1::0;;;;;7468:26:26;::::1;;::::0;;;:19:::1;:26;::::0;;;;:43;;7510:1:::1;::::0;7468:26;:43:::1;::::0;7510:1;;7468:43:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;7322:1125;;;7530:7;:12;;7541:1;7530:12;7526:921;;;7564:12;::::0;7554:59:::1;::::0;-1:-1:-1;;;;;7564:12:26::1;7578:5:::0;7585:16:::1;::::0;::::1;7603:9;7554;:59::i;:::-;-1:-1:-1::0;;;;;7672:26:26;::::1;;::::0;;;:19:::1;:26;::::0;;;;:48;;7719:1:::1;::::0;7672:26;:43:::1;::::0;:48:::1;::::0;7719:1;;7672:48;;::::1;;;;:::i;7526:921::-;7739:7;:12;;7750:1;7739:12;7735:712;;;7810:8;::::0;7800:55:::1;::::0;-1:-1:-1;;;;;7810:8:26::1;7820:5:::0;7827:16:::1;::::0;::::1;7845:9;7800;:55::i;:::-;-1:-1:-1::0;;;;;7925:26:26;::::1;;::::0;;;:19:::1;:26;::::0;;;;:56;;7980:1:::1;::::0;7925:26;:51:::1;::::0;:56:::1;::::0;7980:1;;-1:-1:-1;;;7925:56:26;::::1;;;;:::i;7735:712::-;8000:7;:12;;8011:1;8000:12;7996:451;;;8102:8;::::0;:26:::1;::::0;-1:-1:-1;;;8102:26:26;;8066:24:::1;::::0;-1:-1:-1;;;;;8102:8:26::1;::::0;:17:::1;::::0;:26:::1;::::0;8120:7;;8102:26:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8065:63;;;;;;8146:18;:25;;8168:3;8146:25;8138:58;;;::::0;-1:-1:-1;;;8138:58:26;;14834:2:28;8138:58:26::1;::::0;::::1;14816:21:28::0;14873:2;14853:18;;;14846:30;-1:-1:-1;;;14892:18:28;;;14885:50;14952:18;;8138:58:26::1;14632:344:28::0;8138:58:26::1;8217:8;::::0;8207:55:::1;::::0;-1:-1:-1;;;;;8217:8:26::1;8227:5:::0;8234:16:::1;::::0;::::1;8252:9;8207;:55::i;:::-;-1:-1:-1::0;;;;;8336:26:26;::::1;;::::0;;;:19:::1;:26;::::0;;;;:53;;8388:1:::1;::::0;8336:26;:48:::1;::::0;:53:::1;::::0;8388:1;;-1:-1:-1;;;8336:53:26;::::1;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;8014:384;7996:451;7130:1323;;7125:3;;;;;:::i;:::-;;;;7076:1377;;;-1:-1:-1::0;;1759:1:24;2859:22;;-1:-1:-1;;6833:1624:26:o;1924:101:22:-;952:10:3;1504:7:22;:5;:7::i;:::-;-1:-1:-1;;;;;1504:23:22;;1496:68;;;;-1:-1:-1;;;1496:68:22;;;;;;;:::i;:::-;1988:30:::1;2015:1;1988:18;:30::i;:::-;1924:101::o:0;1292:85::-;1364:6;;-1:-1:-1;;;;;1364:6:22;;1292:85::o;24903:379:26:-;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;24999:12:26::1;::::0;24978:59:::1;::::0;-1:-1:-1;;;24978:59:26;;::::1;::::0;::::1;160:25:28::0;;;-1:-1:-1;;;;;24999:12:26;;::::1;::::0;24978:44:::1;::::0;133:18:28;;24978:59:26::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;25088:19;25110:17;:44;25128:13;25144:9;25128:25;;;;:::i;:::-;25110:44:::0;;::::1;::::0;::::1;::::0;;;;;;;;-1:-1:-1;25110:44:26;;;:50:::1;;::::0;25185;;-1:-1:-1;;;;;25110:50:26;;::::1;::::0;-1:-1:-1;;25110:50:26;;25209:21:::1;::::0;-1:-1:-1;25185:50:26;-1:-1:-1;25185:50:26;25209:21;25110:50;25185::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;25166:69;;;25249:7;25241:36;;;::::0;-1:-1:-1;;;25241:36:26;;15754:2:28;25241:36:26::1;::::0;::::1;15736:21:28::0;15793:2;15773:18;;;15766:30;-1:-1:-1;;;15812:18:28;;;15805:46;15868:18;;25241:36:26::1;15552:340:28::0;4662:551:26;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;4739:10:26;4731:38:::1;;;::::0;-1:-1:-1;;;4731:38:26;;16099:2:28;4731:38:26::1;::::0;::::1;16081:21:28::0;16138:2;16118:18;;;16111:30;-1:-1:-1;;;16157:18:28;;;16150:45;16212:18;;4731:38:26::1;15897:339:28::0;4731:38:26::1;4911:26;4926:10;4911:14;:26::i;:::-;5048:10;::::0;:58:::1;::::0;-1:-1:-1;;;5048:58:26;;-1:-1:-1;;;;;5048:10:26;;::::1;::::0;:23:::1;::::0;:58:::1;::::0;5072:10:::1;::::0;5092:4:::1;::::0;5099:6;;5048:58:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;5162:10:26::1;5142:31;::::0;;;:19:::1;:31;::::0;;;;:66;;5201:6;;5142:31;:48:::1;::::0;:66:::1;::::0;5201:6;;-1:-1:-1;;;5142:66:26;::::1;-1:-1:-1::0;;;;;5142:66:26::1;;:::i;:::-;;;;;;;;-1:-1:-1::0;;;;;5142:66:26::1;;;;;-1:-1:-1::0;;;;;5142:66:26::1;;;;;;1759:1:24::0;2859:7;:22;;;;4662:551:26;:::o;3600:1058::-;2337:13:20;;;;;;;:48;;2373:12;;;;2372:13;2337:48;;;3115:4;1098:20:1;1144:8;2353:16:20;2329:107;;;;-1:-1:-1;;;2329:107:20;;17064:2:28;2329:107:20;;;17046:21:28;17103:2;17083:18;;;17076:30;17142:34;17122:18;;;17115:62;-1:-1:-1;;;17193:18:28;;;17186:44;17247:19;;2329:107:20;16862:410:28;2329:107:20;2447:19;2470:13;;;;;;2469:14;2493:98;;;;2527:13;:20;;-1:-1:-1;;2561:19:20;;;;;2493:98;3695:16:26::1;:14;:16::i;:::-;3717:24;:22;:24::i;:::-;3786:7;3748:35;:45:::0;3833:7:::1;3799:31;:41:::0;3881:17:::1;3846:32;:52:::0;3948:18:::1;3917:28;:49:::0;4021:12:::1;3985:33;:48:::0;4040:8:::1;:35:::0;;-1:-1:-1;;;;;;4040:35:26::1;-1:-1:-1::0;;;;;4040:35:26;::::1;::::0;;::::1;::::0;;;4109:18:::1;::::0;;-1:-1:-1;;;4109:18:26;;;;:16:::1;::::0;:18:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;;4040:35;4109:18;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4081:12;:47:::0;;-1:-1:-1;;;;;;4081:47:26::1;-1:-1:-1::0;;;;;4081:47:26;;;::::1;::::0;;::::1;::::0;;4158:21:::1;::::0;;-1:-1:-1;;;4158:21:26;;;;:19:::1;::::0;:21:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;;4081:47;4158:21;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4134:13;:46:::0;;-1:-1:-1;;;;;;4134:46:26::1;-1:-1:-1::0;;;;;4134:46:26;;::::1;;::::0;;4211:8:::1;::::0;:21:::1;::::0;;-1:-1:-1;;;4211:21:26;;;;:8;;;::::1;::::0;:19:::1;::::0;:21:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;:8;:21;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4187:10;:46:::0;;-1:-1:-1;;;;;;4187:46:26::1;-1:-1:-1::0;;;;;4187:46:26;;::::1;;::::0;;4255:12:::1;::::0;:25:::1;::::0;;-1:-1:-1;;;4255:25:26;;;;:12;;;::::1;::::0;:23:::1;::::0;:25:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;:12;:25;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4239:6;:42:::0;;-1:-1:-1;;;;;;4239:42:26::1;-1:-1:-1::0;;;;;4239:42:26;;::::1;;::::0;;4360:82:::1;::::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;4360:82:26;;;::::1;::::0;::::1;::::0;;;;;;;;;4348:6:::1;:95:::0;;-1:-1:-1;4348:95:26;::::1;::::0;;;;;;-1:-1:-1;;;;;;;;;;;4348:95:26;;::::1;::::0;;;;;;4360:82:::1;4348:95:::0;;::::1;-1:-1:-1::0;;;;;;4348:95:26;;;;;;;-1:-1:-1;;;;;;;;4348:95:26;;::::1;;;-1:-1:-1::0;;;;;;;;4348:95:26::1;-1:-1:-1::0;;;4348:95:26;;;::::1;::::0;;;::::1;;::::0;;4557:10:::1;::::0;:50;;-1:-1:-1;;;4557:50:26;;:10;::::1;::::0;:18:::1;::::0;:50:::1;::::0;4576:9;;-1:-1:-1;;;4587:19:26;4348:95:::1;4557:50;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;4614:13:26::1;:39:::0;;-1:-1:-1;;4614:39:26::1;4637:15;4614:39;;;::::0;;2613:66:20;;;;2663:5;2647:21;;-1:-1:-1;;2647:21:20;;;2613:66;2048:637;3600:1058:26;:::o;2475:27::-;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;2475:27:26;;;;;-1:-1:-1;;;2475:27:26;;;;:::o;5781:505::-;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;5854:10:26;5846:34:::1;;;::::0;-1:-1:-1;;;5846:34:26;;18603:2:28;5846:34:26::1;::::0;::::1;18585:21:28::0;18642:2;18622:18;;;18615:30;-1:-1:-1;;;18661:18:28;;;18654:41;18712:18;;5846:34:26::1;18401:335:28::0;5846:34:26::1;5991:6;::::0;:54:::1;::::0;-1:-1:-1;;;5991:54:26;;-1:-1:-1;;;;;5991:6:26;;::::1;::::0;:19:::1;::::0;:54:::1;::::0;6011:10:::1;::::0;6031:4:::1;::::0;6038:6;;5991:54:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;6161:26;6176:10;6161:14;:26::i;:::-;6239:10;6219:31;::::0;;;:19:::1;:31;::::0;;;;:44:::1;;:62:::0;;6274:6;;6219:31;:62:::1;::::0;6274:6;;-1:-1:-1;;;;;6219:62:26::1;;:::i;5217:560::-:0;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;5327:10:26::1;5290:14;5307:31:::0;;;:19:::1;:31;::::0;;;;:48;-1:-1:-1;;;5307:48:26;::::1;-1:-1:-1::0;;;;;5307:48:26::1;::::0;5361:44:::1;;;::::0;-1:-1:-1;;;5361:44:26;;18943:2:28;5361:44:26::1;::::0;::::1;18925:21:28::0;18982:2;18962:18;;;18955:30;-1:-1:-1;;;19001:18:28;;;18994:51;19062:18;;5361:44:26::1;18741:345:28::0;5361:44:26::1;5521:26;5536:10;5521:14;:26::i;:::-;5599:10;5630:1;5579:31:::0;;;:19:::1;:31;::::0;;;;;;:52;;-1:-1:-1;;;;;;;;5579:52:26::1;::::0;;5670:10:::1;::::0;:39;;-1:-1:-1;;;5670:39:26;;-1:-1:-1;;;;;5670:10:26;;::::1;::::0;:19:::1;::::0;:39:::1;::::0;5599:10;5702:6;;5670:39:::1;;;:::i;20635:314::-:0;1802:1:24;2556:7;;:19;;2548:63;;;;-1:-1:-1;;;2548:63:24;;;;;;;:::i;:::-;1802:1;2686:7;:18;20732:29:26::1;20764:26;:14:::0;20781:9:::1;20764:26;:::i;:::-;20804:41;::::0;::::1;;::::0;;;:17:::1;:41;::::0;;;;:47:::1;;::::0;20732:58;;-1:-1:-1;;;;;;20804:47:26::1;20855:10;20804:61;20796:88;;;;-1:-1:-1::0;;;20796:88:26::1;;;;;;;:::i;:::-;20891:41;;;::::0;;;:17:::1;:41;::::0;;;;:53;;-1:-1:-1;;20891:53:26::1;;::::0;;;::::1;::::0;;;::::1;::::0;;-1:-1:-1;;2859:22:24;;20635:314:26:o;2174:198:22:-;952:10:3;1504:7:22;:5;:7::i;:::-;-1:-1:-1;;;;;1504:23:22;;1496:68;;;;-1:-1:-1;;;1496:68:22;;;;;;;:::i;:::-;-1:-1:-1;;;;;2262:22:22;::::1;2254:73;;;::::0;-1:-1:-1;;;2254:73:22;;19636:2:28;2254:73:22::1;::::0;::::1;19618:21:28::0;19675:2;19655:18;;;19648:30;19714:34;19694:18;;;19687:62;-1:-1:-1;;;19765:18:28;;;19758:36;19811:19;;2254:73:22::1;19434:402:28::0;2254:73:22::1;2337:28;2356:8;2337:18;:28::i;:::-;2174:198:::0;:::o;15115:762:26:-;15341:13;;;;15323:15;:31;15319:63;;;15364:11;:9;:11::i;:::-;-1:-1:-1;;;;;15468:26:26;;15441:24;15468:26;;;:19;:26;;;;;:41;15566:6;:13;-1:-1:-1;;;15468:41:26;;;;;;15566:17;;15582:1;;15566:17;:::i;:::-;-1:-1:-1;;;;;15515:26:26;;;;;;:19;:26;;;;;:69;;;;;;;-1:-1:-1;;;15515:69:26;-1:-1:-1;;;;15515:69:26;;;;;;;;;15636:21;15632:48;;15667:7;15115:762;:::o;15632:48::-;15686:26;15715:47;15738:5;15745:16;15715:22;:47::i;:::-;-1:-1:-1;;;;;15798:26:26;;;;;;:19;:26;;;;;:44;;:74;;15686:76;;-1:-1:-1;15686:76:26;;15798:44;;:74;;15686:76;;-1:-1:-1;;;15798:74:26;;-1:-1:-1;;;;;15798:74:26;;:::i;:::-;;;;;;;;-1:-1:-1;;;;;15798:74:26;;;;;-1:-1:-1;;;;;15798:74:26;;;;;;15163:714;;15115:762;:::o;11933:423::-;11986:21;12001:5;11986:14;:21::i;:::-;-1:-1:-1;;;;;12038:26:26;;12013:22;12038:26;;;:19;:26;;;;;:44;;;-1:-1:-1;;;12038:44:26;;-1:-1:-1;;;;;12038:44:26;12126:18;;12122:230;;-1:-1:-1;;;;;12187:26:26;;;12234:1;12187:26;;;:19;:26;;;;;;;:44;;:48;;-1:-1:-1;;;;;;;;12187:48:26;;;12297:10;;:48;;-1:-1:-1;;;12297:48:26;;:10;;;:25;;:48;;12207:5;;12330:14;;12297:48;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11980:376;11933:423;:::o;17315:315::-;-1:-1:-1;;;;;17576:27:26;;17386:7;17576:27;;;:19;:27;;;;;:49;;-1:-1:-1;;;17576:49:26;;;;;-1:-1:-1;;;17515:52:26;;;;;17414:92;;17462:44;;;;;;17414:39;:92;:::i;:::-;:153;;;;:::i;:::-;:211;;;;:::i;:::-;17401:224;;;17315:315;-1:-1:-1;;17315:315:26:o;13402:1654::-;13498:7;;;;13598:20;:16;13617:1;13598:20;:::i;:::-;13586:32;;13581:861;13624:6;:13;13620:17;;13581:861;;;13738:6;13745:1;13738:9;;;;;;;;:::i;:::-;;;;;;;;;;:26;13721:43;;13738:26;;13721:43;;:::i;:::-;;;13849:1;13815:6;13822:1;13815:9;;;;;;;;:::i;:::-;;;;;;;;;;:31;-1:-1:-1;;;13815:31:26;;-1:-1:-1;;;;;13815:31:26;:35;13811:299;;;14069:6;14076:1;14069:9;;;;;;;;:::i;:::-;;;;;;;;;;;;:31;-1:-1:-1;;;;;14003:26:26;;;;:19;:26;;;;;;;:43;13953:6;:9;;-1:-1:-1;;;;;;;;14069:31:26;;;;;;-1:-1:-1;;;14003:43:26;;;;;;;13960:1;;13953:9;;;;;;:::i;:::-;;;;;;;;;;:26;13895:35;;:85;;13953:26;;;13895:85;:::i;:::-;:152;;;;:::i;:::-;13894:207;;;;:::i;:::-;13862:239;;;;:::i;:::-;;;13811:299;14187:1;14157:6;14164:1;14157:9;;;;;;;;:::i;:::-;;;;;;;;;;:27;-1:-1:-1;;;14157:27:26;;-1:-1:-1;;;;;14157:27:26;:31;14153:283;;;14399:6;14406:1;14399:9;;;;;;;;:::i;:::-;;;;;;;;;;;;:27;-1:-1:-1;;;;;14337:26:26;;;;:19;:26;;;;;;;:39;;;14287:6;:9;;-1:-1:-1;;;;;;;;14399:27:26;;;;;;14337:39;;;;;14294:1;;14287:9;;;;;;:::i;:::-;;;;;;;;;;:26;14233:31;;:81;;14287:26;;;14233:81;:::i;:::-;:144;;;;:::i;:::-;14232:195;;;;:::i;:::-;14200:227;;;;:::i;:::-;;;14153:283;13639:3;;;;:::i;:::-;;;;13581:861;;;-1:-1:-1;;;;;;14573:26:26;;;;;;:19;:26;;;;;:43;14532:32;;14573:43;;;;;;;14510:54;;:13;:54;:::i;:::-;:106;;;;:::i;:::-;14482:134;;;;:::i;:::-;-1:-1:-1;;;;;14730:26:26;;;;;;:19;:26;;;;;:38;14699:28;;14482:134;;-1:-1:-1;14730:38:26;;;14683:44;;:13;:44;:::i;:::-;:85;;;;:::i;:::-;14661:107;;;;:::i;:::-;-1:-1:-1;;;;;14914:26:26;;;;;;:19;:26;;;;;:48;14872:33;;14661:107;;-1:-1:-1;;;;14914:48:26;;;;;14850:55;;:13;:55;:::i;:::-;:112;;;;:::i;:::-;14822:140;;;;:::i;:::-;;13402:1654;-1:-1:-1;;;;;13402:1654:26:o;16498:355::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;16602:224:26;;;;;;;;16666:13;;-1:-1:-1;;;16602:224:26;;16640:39;;16666:13;;16647:15;16640:39;:::i;:::-;16602:224;;;;16717:10;;:35;;-1:-1:-1;;;16717:35:26;;16602:224;;;;;-1:-1:-1;;;;;16717:10:26;;;;:20;;:35;;16746:4;;16717:35;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;16602:224:26;;;16787:6;;:31;;-1:-1:-1;;;16787:31:26;;16602:224;;;;;-1:-1:-1;;;;;16787:6:26;;;;:16;;:31;;16812:4;;16787:31;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;16602:224:26;;;16572:254;16498:355;-1:-1:-1;;16498:355:26:o;12989:409::-;13098:23;13124:27;13144:7;13124:17;:27;:::i;:::-;13165:34;;;;:17;:34;;;;;:40;;;13098:53;;-1:-1:-1;;;;;;13165:40:26;13209:10;13165:54;13157:77;;;;-1:-1:-1;;;13157:77:26;;;;;;;:::i;:::-;13241:61;13274:10;13286:15;13241:32;:61::i;:::-;13337:56;;-1:-1:-1;;;13337:56:26;;-1:-1:-1;;;;;13337:20:26;;;;;:56;;13366:4;;13373:10;;13385:7;;13337:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13092:306;12989:409;;;:::o;21022:2546::-;21199:10;21150:26;21179:31;;;:19;:31;;;;;;;:49;;;;-1:-1:-1;;;;;;;;21234:53:26;;;;;21293:10;;:61;;-1:-1:-1;;;21293:61:26;;21327:4;21293:61;;;20672:51:28;-1:-1:-1;;;21179:49:26;;;-1:-1:-1;;;;;21179:49:26;20739:18:28;;;20732:59;;;21179:49:26;-1:-1:-1;;;;;21293:10:26;;:25;;20645:18:28;;21293:61:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21366:9;21361:1911;21385:23;:30;21381:1;:34;21361:1911;;;21430:29;21462:23;21486:1;21462:26;;;;;;;;:::i;:::-;;;;;;;21430:58;;21497:21;21546:9;21521:22;:34;;;;:::i;:::-;21571:41;;;;;;;:17;:41;;;;;:47;;;21497:58;;-1:-1:-1;;;;;;21571:47:26;21622:10;21571:61;21563:88;;;;-1:-1:-1;;;21563:88:26;;;;;;;:::i;:::-;21758:8;;:33;;-1:-1:-1;;;21758:33:26;;21706:24;;;;-1:-1:-1;;;;;21758:8:26;;;;:17;;:33;;21776:14;;21758:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;21705:86;;;;;;;21824:3;21803:18;:24;;;21799:381;;;21839:23;21960:19;;;21932:24;21938:18;21932:3;:24;:::i;:::-;21924:33;;21883:8;;;;;;;;;-1:-1:-1;;;;;21883:8:26;-1:-1:-1;;;;;21883:36:26;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;21883:74:26;;;;;:::i;:::-;:96;;;;:::i;:::-;21839:150;;22025:16;-1:-1:-1;;;;;22003:38:26;:19;-1:-1:-1;;;;;22003:38:26;;21999:173;;;22055:8;;-1:-1:-1;;;;;22055:8:26;:13;22069:14;22085:24;22091:18;22085:3;:24;:::i;:::-;22055:55;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22145:16;22122:39;;;;;:::i;:::-;;;21999:173;21829:351;21799:381;22216:41;;;22260:1;22216:41;;;:17;:41;;;;;;;;:45;;;;:103;;-1:-1:-1;22265:41:26;;;;;;;:17;:41;;;;;;:54;;;;:41;;:54;22216:103;22212:461;;;22348:41;;;22331:14;22348:41;;;:17;:41;;;;;;:54;;22392:10;;22348:41;;:54;:::i;:::-;22331:71;;22413:23;22486:8;22478:17;;22446:8;;;;;;;;;-1:-1:-1;;;;;22446:8:26;-1:-1:-1;;;;;22446:27:26;;:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;;;;:::i;:::-;22413:83;;22532:16;-1:-1:-1;;;;;22510:38:26;:19;-1:-1:-1;;;;;22510:38:26;;22506:159;;;22562:8;;:41;;-1:-1:-1;;;22562:41:26;;-1:-1:-1;;;;;22562:8:26;;;;:15;;:41;;22578:14;;22594:8;;22562:41;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22638:16;22615:39;;;;;:::i;:::-;;;22506:159;22321:352;;22212:461;22787:8;;:33;;-1:-1:-1;;;22787:33:26;;-1:-1:-1;;;;;22787:8:26;;;;:17;;:33;;22805:14;;22787:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;22746:74:26;;-1:-1:-1;22746:74:26;-1:-1:-1;;;22853:3:26;22832:24;;;;22828:381;;;22868:23;22989:19;;;22961:24;22967:18;22961:3;:24;:::i;:::-;22953:33;;22912:8;;;;;;;;;-1:-1:-1;;;;;22912:8:26;-1:-1:-1;;;;;22912:36:26;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;22912:74:26;;;;;:::i;:::-;:96;;;;:::i;:::-;22868:150;;23054:16;-1:-1:-1;;;;;23032:38:26;:19;-1:-1:-1;;;;;23032:38:26;;23028:173;;;23084:8;;-1:-1:-1;;;;;23084:8:26;:13;23098:14;23114:24;23120:18;23114:3;:24;:::i;:::-;23084:55;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23174:16;23151:39;;;;;:::i;:::-;;;23028:173;22858:351;22828:381;-1:-1:-1;;;23224:41:26;;;;;;:17;:41;;;;;23217:48;;-1:-1:-1;;23217:48:26;;;21417:3;;;;:::i;:::-;;;;21361:1911;;;-1:-1:-1;23450:10:26;;:36;;-1:-1:-1;;;23450:36:26;;-1:-1:-1;;;;;21887:31:28;;23450:36:26;;;21869:50:28;-1:-1:-1;;;;;23450:10:26;;;;:15;;21842:18:28;;23450:36:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;23512:10:26;23492:31;;;;:19;:31;;;;;:49;;:71;;-1:-1:-1;;;;;23492:71:26;;;-1:-1:-1;;;23492:71:26;-1:-1:-1;;;;;;;;23492:71:26;;;;;;;;;;-1:-1:-1;;;21022:2546:26:o;19541:1007::-;19791:22;19847:1;19816:28;19839:4;19816:22;:28::i;:::-;:32;;;;:::i;:::-;19854:18;19875:26;;;:17;:26;;;;;:43;19791:57;;-1:-1:-1;20014:28:26;;;20010:356;;-1:-1:-1;;;;;20074:25:26;;20052:19;20074:25;;;:19;:25;;;;;;;;:53;;;:37;;:53;;;;;;20136:49;;;;;;:63;;;20265:30;;:17;:30;;;;;:60;;;20010:356;-1:-1:-1;20451:26:26;;;;:17;:26;;;;;;;;20444:33;;;;;;;-1:-1:-1;;;;;;20444:33:26;;;-1:-1:-1;;;;;20490:25:26;;;;;;:19;:25;;;;;:53;;;:37;;;;:53;;;;;20483:60;19541:1007::o;18688:254::-;18771:14;18788:29;18811:5;18788:22;:29::i;:::-;-1:-1:-1;;;;;18823:26:26;;;;;;;:19;:26;;;;;;;;:46;;;:38;;:46;;;;;:56;;;18885:26;;;:17;:26;;;;;;:52;;;;-1:-1:-1;18688:254:26:o;12378:554::-;12512:20;;-1:-1:-1;;;12512:20:26;;;;;160:25:28;;;12536:10:26;;-1:-1:-1;;;;;12512:11:26;;;;;133:18:28;;12512:20:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;12512:34:26;;12504:57;;;;-1:-1:-1;;;12504:57:26;;;;;;;:::i;:::-;12568:23;12594:27;12614:7;12594:17;:27;:::i;:::-;12568:53;;12702:51;12730:5;12737:15;12702:27;:51::i;:::-;12759:34;;;;:17;:34;;;;;;;:40;;:48;;-1:-1:-1;;;;;;12759:48:26;-1:-1:-1;;;;;12759:48:26;;;;;;;;;;12871:56;;-1:-1:-1;;;12871:56:26;;:20;;;;;;:56;;12892:10;;12912:4;;12919:7;;12871:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12498:434;12378:554;;;;:::o;2526:187:22:-;2618:6;;;-1:-1:-1;;;;;2634:17:22;;;-1:-1:-1;;;;;;2634:17:22;;;;;;;2666:40;;2618:6;;;2634:17;2618:6;;2666:40;;2599:16;;2666:40;2589:124;2526:187;:::o;968:131::-;2920:13:20;;;;;;;2912:69;;;;-1:-1:-1;;;2912:69:20;;;;;;;:::i;:::-;1030:26:22::1;:24;:26::i;:::-;1066;:24;:26::i;1840:111:24:-:0;2920:13:20;;;;;;;2912:69;;;;-1:-1:-1;;;2912:69:20;;;;;;;:::i;:::-;1910:34:24::1;:32;:34::i;16912:318:26:-:0;17056:13;;;;;;17037:15;17030:39;;;;17022:58;;;;-1:-1:-1;;;17022:58:26;;22544:2:28;17022:58:26;;;22526:21:28;22583:1;22563:18;;;22556:29;-1:-1:-1;;;22601:18:28;;;22594:36;22647:18;;17022:58:26;22342:329:28;17022:58:26;17087:27;17117:15;:13;:15::i;:::-;17159:13;:39;;-1:-1:-1;;17159:39:26;17182:15;17159:39;;;;;;;;;;;17204:6;:21;;-1:-1:-1;17204:21:26;;;;-1:-1:-1;17204:21:26;;;;;;-1:-1:-1;;;;;;;;;;;17204:21:26;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;17204:21:26;;;;;;;-1:-1:-1;;;;;;;;17204:21:26;;;;;-1:-1:-1;;;;;;;;17204:21:26;-1:-1:-1;;;17204:21:26;;;;;;;;;;;;;;-1:-1:-1;16912:318:26:o;799:69:3:-;2920:13:20;;;;;;;2912:69;;;;-1:-1:-1;;;2912:69:20;;;;;;;:::i;1105:111:22:-;2920:13:20;;;;;;;2912:69;;;;-1:-1:-1;;;2912:69:20;;;;;;;:::i;:::-;1177:32:22::1;952:10:3::0;1177:18:22::1;:32::i;1957:109:24:-:0;2920:13:20;;;;;;;2912:69;;;;-1:-1:-1;;;2912:69:20;;;;;;;:::i;:::-;1759:1:24::1;2037:22:::0;;1957:109::o;196:224:28:-;-1:-1:-1;;;;;381:32:28;;;;363:51;;351:2;336:18;;196:224::o;425:131::-;-1:-1:-1;;;;;500:31:28;;490:42;;480:70;;546:1;543;536:12;561:936;658:6;666;674;682;690;743:3;731:9;722:7;718:23;714:33;711:53;;;760:1;757;750:12;711:53;799:9;786:23;818:31;843:5;818:31;:::i;:::-;868:5;-1:-1:-1;925:2:28;910:18;;897:32;938:33;897:32;938:33;:::i;:::-;990:7;-1:-1:-1;1044:2:28;1029:18;;1016:32;;-1:-1:-1;1099:2:28;1084:18;;1071:32;-1:-1:-1;;;;;1152:14:28;;;1149:34;;;1179:1;1176;1169:12;1149:34;1217:6;1206:9;1202:22;1192:32;;1262:7;1255:4;1251:2;1247:13;1243:27;1233:55;;1284:1;1281;1274:12;1233:55;1324:2;1311:16;1350:2;1342:6;1339:14;1336:34;;;1366:1;1363;1356:12;1336:34;1411:7;1406:2;1397:6;1393:2;1389:15;1385:24;1382:37;1379:57;;;1432:1;1429;1422:12;1379:57;561:936;;;;-1:-1:-1;561:936:28;;-1:-1:-1;1463:2:28;1455:11;;1485:6;561:936;-1:-1:-1;;;561:936:28:o;1709:118::-;1795:5;1788:13;1781:21;1774:5;1771:32;1761:60;;1817:1;1814;1807:12;1832:241;1888:6;1941:2;1929:9;1920:7;1916:23;1912:32;1909:52;;;1957:1;1954;1947:12;1909:52;1996:9;1983:23;2015:28;2037:5;2015:28;:::i;:::-;2062:5;1832:241;-1:-1:-1;;;1832:241:28:o;2078:121::-;2163:10;2156:5;2152:22;2145:5;2142:33;2132:61;;2189:1;2186;2179:12;2204:245;2262:6;2315:2;2303:9;2294:7;2290:23;2286:32;2283:52;;;2331:1;2328;2321:12;2283:52;2370:9;2357:23;2389:30;2413:5;2389:30;:::i;2643:315::-;2711:6;2719;2772:2;2760:9;2751:7;2747:23;2743:32;2740:52;;;2788:1;2785;2778:12;2740:52;2827:9;2814:23;2846:31;2871:5;2846:31;:::i;:::-;2896:5;2948:2;2933:18;;;;2920:32;;-1:-1:-1;;;2643:315:28:o;2963:247::-;3022:6;3075:2;3063:9;3054:7;3050:23;3046:32;3043:52;;;3091:1;3088;3081:12;3043:52;3130:9;3117:23;3149:31;3174:5;3149:31;:::i;4025:632::-;4196:2;4248:21;;;4318:13;;4221:18;;;4340:22;;;4167:4;;4196:2;4419:15;;;;4393:2;4378:18;;;4167:4;4462:169;4476:6;4473:1;4470:13;4462:169;;;4537:13;;4525:26;;4606:15;;;;4571:12;;;;4498:1;4491:9;4462:169;;;-1:-1:-1;4648:3:28;;4025:632;-1:-1:-1;;;;;;4025:632:28:o;4662:366::-;4724:8;4734:6;4788:3;4781:4;4773:6;4769:17;4765:27;4755:55;;4806:1;4803;4796:12;4755:55;-1:-1:-1;4829:20:28;;-1:-1:-1;;;;;4861:30:28;;4858:50;;;4904:1;4901;4894:12;4858:50;4941:4;4933:6;4929:17;4917:29;;5001:3;4994:4;4984:6;4981:1;4977:14;4969:6;4965:27;4961:38;4958:47;4955:67;;;5018:1;5015;5008:12;4955:67;4662:366;;;;;:::o;5033:564::-;5124:6;5132;5140;5193:2;5181:9;5172:7;5168:23;5164:32;5161:52;;;5209:1;5206;5199:12;5161:52;5236:23;;-1:-1:-1;;;;;5271:30:28;;5268:50;;;5314:1;5311;5304:12;5268:50;5353:69;5414:7;5405:6;5394:9;5390:22;5353:69;:::i;:::-;5441:8;;-1:-1:-1;5327:95:28;-1:-1:-1;;5526:2:28;5511:18;;5498:32;5539:28;5498:32;5539:28;:::i;:::-;5586:5;5576:15;;;5033:564;;;;;:::o;5602:570::-;5696:6;5704;5712;5765:2;5753:9;5744:7;5740:23;5736:32;5733:52;;;5781:1;5778;5771:12;5733:52;5808:23;;-1:-1:-1;;;;;5843:30:28;;5840:50;;;5886:1;5883;5876:12;5840:50;5925:69;5986:7;5977:6;5966:9;5962:22;5925:69;:::i;:::-;6013:8;;-1:-1:-1;5899:95:28;-1:-1:-1;;6098:2:28;6083:18;;6070:32;6111:31;6070:32;6111:31;:::i;6177:192::-;6351:10;6339:23;;;;6321:42;;6309:2;6294:18;;6177:192::o;6374:180::-;6433:6;6486:2;6474:9;6465:7;6461:23;6457:32;6454:52;;;6502:1;6499;6492:12;6454:52;-1:-1:-1;6525:23:28;;6374:180;-1:-1:-1;6374:180:28:o;8340:114::-;8424:4;8417:5;8413:16;8406:5;8403:27;8393:55;;8444:1;8441;8434:12;8459:382;8524:6;8532;8585:2;8573:9;8564:7;8560:23;8556:32;8553:52;;;8601:1;8598;8591:12;8553:52;8640:9;8627:23;8659:30;8683:5;8659:30;:::i;:::-;8708:5;-1:-1:-1;8765:2:28;8750:18;;8737:32;8778:31;8737:32;8778:31;:::i;:::-;8828:7;8818:17;;;8459:382;;;;;:::o;8846:355::-;9048:2;9030:21;;;9087:2;9067:18;;;9060:30;9126:33;9121:2;9106:18;;9099:61;9192:2;9177:18;;8846:355::o;9555:274::-;-1:-1:-1;;;;;9747:32:28;;;;9729:51;;9811:2;9796:18;;9789:34;9717:2;9702:18;;9555:274::o;9834:245::-;9901:6;9954:2;9942:9;9933:7;9929:23;9925:32;9922:52;;;9970:1;9967;9960:12;9922:52;10002:9;9996:16;10021:28;10043:5;10021:28;:::i;10437:127::-;10498:10;10493:3;10489:20;10486:1;10479:31;10529:4;10526:1;10519:15;10553:4;10550:1;10543:15;10569:128;10609:3;10640:1;10636:6;10633:1;10630:13;10627:39;;;10646:18;;:::i;:::-;-1:-1:-1;10682:9:28;;10569:128::o;10702:168::-;10742:7;10808:1;10804;10800:6;10796:14;10793:1;10790:21;10785:1;10778:9;10771:17;10767:45;10764:71;;;10815:18;;:::i;:::-;-1:-1:-1;10855:9:28;;10702:168::o;10875:127::-;10936:10;10931:3;10927:20;10924:1;10917:31;10967:4;10964:1;10957:15;10991:4;10988:1;10981:15;11007:120;11047:1;11073;11063:35;;11078:18;;:::i;:::-;-1:-1:-1;11112:9:28;;11007:120::o;11132:127::-;11193:10;11188:3;11184:20;11181:1;11174:31;11224:4;11221:1;11214:15;11248:4;11245:1;11238:15;11264:127;11325:10;11320:3;11316:20;11313:1;11306:31;11356:4;11353:1;11346:15;11380:4;11377:1;11370:15;11396:135;11435:3;-1:-1:-1;;11456:17:28;;11453:43;;;11476:18;;:::i;:::-;-1:-1:-1;11523:1:28;11512:13;;11396:135::o;11536:343::-;11738:2;11720:21;;;11777:2;11757:18;;;11750:30;-1:-1:-1;;;11811:2:28;11796:18;;11789:49;11870:2;11855:18;;11536:343::o;11884:191::-;11923:1;11949:10;11986:2;11983:1;11979:10;12008:3;11998:37;;12015:18;;:::i;:::-;12053:10;;12049:20;;;;;11884:191;-1:-1:-1;;11884:191:28:o;12080:183::-;12111:1;12137:10;12174:2;12171:1;12167:10;12196:3;12186:37;;12203:18;;:::i;:::-;12241:10;;12237:20;;;;;12080:183;-1:-1:-1;;12080:183:28:o;12268:217::-;12307:4;12336:6;12392:10;;;;12362;;12414:12;;;12411:38;;;12429:18;;:::i;:::-;12466:13;;12268:217;-1:-1:-1;;;12268:217:28:o;12490:228::-;12529:3;12557:10;12594:2;12591:1;12587:10;12624:2;12621:1;12617:10;12655:3;12651:2;12647:12;12642:3;12639:21;12636:47;;;12663:18;;:::i;:::-;12699:13;;12490:228;-1:-1:-1;;;;12490:228:28:o;13066:221::-;13105:4;13134:10;13194;;;;13164;;13216:12;;;13213:38;;;13231:18;;:::i;13490:177::-;13569:13;;-1:-1:-1;;;;;13611:31:28;;13601:42;;13591:70;;13657:1;13654;13647:12;13591:70;13490:177;;;:::o;13672:726::-;13771:6;13779;13787;13795;13803;13856:3;13844:9;13835:7;13831:23;13827:33;13824:53;;;13873:1;13870;13863:12;13824:53;13905:9;13899:16;13924:29;13947:5;13924:29;:::i;:::-;14022:2;14007:18;;14001:25;13972:5;;-1:-1:-1;14035:31:28;14001:25;14035:31;:::i;:::-;14137:2;14122:18;;14116:25;14085:7;;-1:-1:-1;14150:31:28;14116:25;14150:31;:::i;:::-;14252:2;14237:18;;14231:25;14200:7;;-1:-1:-1;14265:32:28;14231:25;14265:32;:::i;:::-;14316:7;-1:-1:-1;14342:50:28;14387:3;14372:19;;14342:50;:::i;:::-;14332:60;;13672:726;;;;;;;;:::o;14403:224::-;14442:3;14470:6;14503:2;14500:1;14496:10;14533:2;14530:1;14526:10;14564:3;14560:2;14556:12;14551:3;14548:21;14545:47;;;14572:18;;:::i;14981:356::-;15183:2;15165:21;;;15202:18;;;15195:30;15261:34;15256:2;15241:18;;15234:62;15328:2;15313:18;;14981:356::o;16241:375::-;-1:-1:-1;;;;;16499:15:28;;;16481:34;;16551:15;;;;16546:2;16531:18;;16524:43;16598:2;16583:18;;16576:34;;;;16431:2;16416:18;;16241:375::o;16621:236::-;16660:3;-1:-1:-1;;;;;16726:10:28;;;16756;;;16786:12;;;16778:21;;16775:47;;;16802:18;;:::i;17277:251::-;17347:6;17400:2;17388:9;17379:7;17375:23;17371:32;17368:52;;;17416:1;17413;17406:12;17368:52;17448:9;17442:16;17467:31;17492:5;17467:31;:::i;19091:338::-;19293:2;19275:21;;;19332:2;19312:18;;;19305:30;-1:-1:-1;;;19366:2:28;19351:18;;19344:44;19420:2;19405:18;;19091:338::o;19841:125::-;19881:4;19909:1;19906;19903:8;19900:34;;;19914:18;;:::i;:::-;-1:-1:-1;19951:9:28;;19841:125::o;19971:184::-;20041:6;20094:2;20082:9;20073:7;20069:23;20065:32;20062:52;;;20110:1;20107;20100:12;20062:52;-1:-1:-1;20133:16:28;;19971:184;-1:-1:-1;19971:184:28:o;20160:334::-;20362:2;20344:21;;;20401:2;20381:18;;;20374:30;-1:-1:-1;;;20435:2:28;20420:18;;20413:40;20485:2;20470:18;;20160:334::o;20802:195::-;20840:4;20877;20874:1;20870:12;20909:4;20906:1;20902:12;20934:3;20929;20926:12;20923:38;;;20941:18;;:::i;:::-;20978:13;;;20802:195;-1:-1:-1;;;20802:195:28:o;21002:208::-;21072:6;21125:2;21113:9;21104:7;21100:23;21096:32;21093:52;;;21141:1;21138;21131:12;21093:52;21164:40;21194:9;21164:40;:::i;21215:270::-;21413:10;21401:23;;;;21383:42;;21473:4;21461:17;21456:2;21441:18;;21434:45;21371:2;21356:18;;21215:270::o;21490:229::-;21529:4;-1:-1:-1;;;;;21626:10:28;;;;21596;;21648:12;;;21645:38;;;21663:18;;:::i;21930:407::-;22132:2;22114:21;;;22171:2;22151:18;;;22144:30;22210:34;22205:2;22190:18;;22183:62;-1:-1:-1;;;22276:2:28;22261:18;;22254:41;22327:3;22312:19;;21930:407::o

Metadata Hash

324dca9ded6358fb57a6124c4bce3624511a3b735f2ede4ff11a786a1925f366
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.