ETH Price: $3,047.04 (+2.83%)
Gas: 2 Gwei

Contract

0x21468e63abF3783020750F7b2e57d4B34aFAfba6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Approve202513492024-07-07 1:27:1119 mins ago1720315631IN
0x21468e63...34aFAfba6
0 ETH0.000074381.52246882
Swap V2202513292024-07-07 1:23:1123 mins ago1720315391IN
0x21468e63...34aFAfba6
0 ETH0.00034621.7133867
Approve202512472024-07-07 1:06:4739 mins ago1720314407IN
0x21468e63...34aFAfba6
0 ETH0.000088921.82012425
Swap V2202512382024-07-07 1:04:5941 mins ago1720314299IN
0x21468e63...34aFAfba6
0 ETH0.000369891.83063409
Approve202511302024-07-07 0:43:231 hr ago1720313003IN
0x21468e63...34aFAfba6
0 ETH0.00008791.79930423
Swap V2202511092024-07-07 0:39:111 hr ago1720312751IN
0x21468e63...34aFAfba6
0 ETH0.000379621.8351913
Approve202509852024-07-07 0:14:231 hr ago1720311263IN
0x21468e63...34aFAfba6
0 ETH0.000111272.27773037
Swap V2202509572024-07-07 0:08:471 hr ago1720310927IN
0x21468e63...34aFAfba6
0 ETH0.000472962.28645438
Approve202509312024-07-07 0:03:351 hr ago1720310615IN
0x21468e63...34aFAfba6
0 ETH0.000101622.08008106
Swap V2202509252024-07-07 0:02:231 hr ago1720310543IN
0x21468e63...34aFAfba6
0 ETH0.000402981.99440287
Split Held Token202509212024-07-07 0:01:351 hr ago1720310495IN
0x21468e63...34aFAfba6
0 ETH0.000559272.0903072
Approve202508582024-07-06 23:48:591 hr ago1720309739IN
0x21468e63...34aFAfba6
0 ETH0.000082291.68449921
Swap V2202508492024-07-06 23:47:111 hr ago1720309631IN
0x21468e63...34aFAfba6
0 ETH0.000356031.76204336
Approve202508362024-07-06 23:44:352 hrs ago1720309475IN
0x21468e63...34aFAfba6
0 ETH0.000095091.94653853
Swap V2202508152024-07-06 23:40:232 hrs ago1720309223IN
0x21468e63...34aFAfba6
0 ETH0.0002771.30877103
Approve202507992024-07-06 23:37:112 hrs ago1720309031IN
0x21468e63...34aFAfba6
0 ETH0.000073051.49529273
Swap V2202507902024-07-06 23:35:232 hrs ago1720308923IN
0x21468e63...34aFAfba6
0 ETH0.000330591.56195631
Approve202507782024-07-06 23:32:592 hrs ago1720308779IN
0x21468e63...34aFAfba6
0 ETH0.00008371.7133338
Swap V2202507642024-07-06 23:30:112 hrs ago1720308611IN
0x21468e63...34aFAfba6
0 ETH0.00030641.44765498
Approve202507402024-07-06 23:25:232 hrs ago1720308323IN
0x21468e63...34aFAfba6
0 ETH0.000089321.82829679
Swap V2202507152024-07-06 23:20:232 hrs ago1720308023IN
0x21468e63...34aFAfba6
0 ETH0.000349711.65229414
Split Held Token202507102024-07-06 23:19:232 hrs ago1720307963IN
0x21468e63...34aFAfba6
0 ETH0.000466161.69281134
Approve202507072024-07-06 23:18:472 hrs ago1720307927IN
0x21468e63...34aFAfba6
0 ETH0.000077411.58451894
Swap V2202506902024-07-06 23:15:232 hrs ago1720307723IN
0x21468e63...34aFAfba6
0 ETH0.000346281.63605936
Split Held Token202506782024-07-06 23:12:592 hrs ago1720307579IN
0x21468e63...34aFAfba6
0 ETH0.000385611.44124272
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HyperCycleSwapV2

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 21 : HyperCycleSwapV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '../interfaces/IHYPCSwapV2.sol';
import '../interfaces/IHYPC.sol';

/**
    @title  HyperCycle SwapV2 contract.
    @author Barry Rowe, David Liendo, Rodolfo Cova
    @notice This contract is an updated version of the c_HyPC/SwapV1 contract for HyperCycle. While the
            original contract allowed a user to swap 2^19 (524288) HyPC (ERC20) for a c_HyPC.19 token
            (ERC721), this contract allows for swapping lower powers of 2 of HyPC (known as the level 
            of the c_HyPC token), to get a correspondingly lower c_HyPC token. As an example swapping 
            2^19 HyPC will give a c_HyPC at level 19, while swapping 2^18 HyPC will give a c_HyPC at 
            level 18, and so on.

            Once HyPC is swapped for a c_HyPC NFT, it can assign a number or a string to the token.
            This acts as a way to have HyPC backing an assignment string or number, and will typically
            be used for HyperCycle licenses inside a separate contract. Unlike with the V1 contract
            system, V2's assignments focus on assigning numbers to the c_HyPC tokens instead of strings, 
            so that these assignments can be aggregated together to give more flexibility over the
            amount of backing that is given to a license number. This total backing amount can then
            be returned by the getAssignmentTargetNumber function. Assigning a string can be done 
            instead, though this is primarily a backwards compatibility option for contracts using
            swapV1 interfaces.

            Finally, the actual c_HyPC license numbers themselves are part of a branch of a binary
            tree with integers at each node, using the convention that the left child of a node will
            have two times the number of its parent while the right child has this number plus one.
            Each c_HyPC token is guaranteed to have a unique number in this tree. This impacts the
            swapping logic in that while we can ensure that there will always be enough c_HyPCs that
            can be swapped for in the contract, we can not guarantee that they will be high level
            tokens. For instance, if there are 4096 level 19 tokens, and then 8192 level 18 tokens
            are swapped for, then there would be no more level 19 tokens left to swap for in the
            future since they all needed to be split to create the 8192 level 18 tokens. Even if
            we allowed for merging (ie: unsplitting) of tokens, then we wouldn't be able to guarantee
            that neighboring c_HyPC in the tree would be available to merge together to recreate
            a parent token.

            To help mitigate this, we first have the aggregation of targetNumbers for assignments
            as previously mentioned. Secondly, we also have limits on how many tokens can be split
            down to the lower levels at a time, with only at most `LEVEL_LIMIT` amount of tokens being 
            allowed on a level after a splitting operation. In order to fill up more tokens inside
            the contract at that level then those tokens would have to be swapped with HyPC. This 
            means that to fill up level 18 for instance with 8192 tokens, then a user would have 
            to lock away nearly the entire supply of HyPC (2^31) into the swap contract itself, 
            all at once.

            Finally, to help with reducing the number of transactions needed to fill up the levels
            array (and thereby available tokens to be swapped), by default, the tokens available
            to be swapped for on a given level will only be minted by the contract when a user
            asks to swap for a given token. So, the root level 19 tokens when added to the contract
            via the addRootToken call, are in actuality only allocated for that level and are not
            physically minted into an actual ERC721 token until they are actually swapped for with
            a swap call.
*/

/* Modifier Errors */
///@dev Error for when requiring the owner of the tokenNumber to call the function.
error SenderMustOwnToken();
///@dev Error for when trying to interact with levels lower than MIN_LEVEL.
error TokenLevelTooLow();
///@dev Error for when trying to interact with levels higher than MAX_LEVEL.
error TokenLevelTooHigh();

///@dev Error for when a virtual/real token is not held by the contract at the given level.
error InvalidTokenLevelIndex();
///@dev Error for when trying to get burn data from a non-burned token.
error TokenNotBurned();
///@dev Error for when trying to use a token that's not yet minted.
error TokenNotMinted();

/* Constructor Errors */
///@dev Error when deploying a contract with a zero address token.
error InvalidToken();
///@dev Error for when deploying a contract with a startingNumber of 0.
error InvalidStartingNumber();
///@dev Error for when deploying a contract with the endingNumber less than the startingNumber.
error InvalidEndingNumber();
///@dev Error for when deploying a contract with the endingNumber greater or equal to 2*startingNumber.
error InvalidNumberRange();


/* addRootToken Errors*/
///@dev Error for when trying to add a root token to the contract past the endRootNumber.
error TooManyRootTokens();

/* splitHeldToken Errors */
///@dev Error for when skipLevels during the split call is 0.
error SkipLevelsMustBePositive();
///@dev Error for when trying to split a token beyond the MIN_LEVEL limit.
error TokenLevelTooLowToSplit();
///@dev Error for when trying to split a token and the next level has too many tokens already.
error CreatingTooManyTokens();
///@dev Error for when skipLevels is too large.
error SkipLevelsTooLarge();


contract HyperCycleSwapV2 is ERC721Enumerable, ERC721Holder, Ownable, ReentrancyGuard, IHYPCSwapV2 {
    /// @dev The HyPC ERC20 contract
    IHYPC private immutable _hypcToken;

    /** @dev The soft limit of how many tokens to be created at a level.
    *   The limit is soft since the split call will only add at most this number
    *   of tokens at the given limit. The number of tokens can be increased
    *   beyond this number through redemptions.
    */
    uint256 public constant LEVEL_LIMIT = 16;

    /// @dev The level for created root tokens.
    uint256 public constant MAX_LEVEL = 19;

    /// @dev The lowest level token that can be created.
    uint256 public constant MIN_LEVEL = 10;

    /// @dev The number of decimals of the HyPC token.
    uint256 public constant SIX_DECIMALS = 10 ** 6;

    /// @dev The token data storing the assignment data for each c_HyPC.
    struct TokenData {
        string assignedString;
        uint256 assignedNumber;
        uint256 level;
        bool minted;
    }

    struct RootData {
        /// @dev The first token number to be added
        uint256 startRootNumber;
        /// @dev The next token to be added to the contract from the addRootTokens call.
        uint256 currentRootNumber;
        /// @dev The last root token to be created, inclusive.
        uint256 endRootNumber;
    }

    /// @dev Main mapping for token data of each cHyPC token.
    mapping(uint256 => TokenData) public nftTokens;

    /// @dev The aggregated amount of HyPC tokens backing a given assignedNumber.
    mapping(uint256 => uint256) public assignedNumbers;

    /// @dev The aggregated amount of HyPC tokens backing a given assignedString.
    mapping(string => uint256) public assignedStrings;
   
    /// @dev The last block time that assignNumber/assignString function was called for a tokenId.
    mapping(uint256 => uint256) public _lastBlockAssigned;

    /// @dev The list of token numbers available at different levels.
    mapping(uint256 => uint256[]) public levels;

    /// @dev Backwards compatibility with SwapV1 contract integrations that used the
    ///      nfts[0] element to get the token to be returned from a swap call.
    uint256[] public nfts;

    /// @dev global root token metadata
    RootData private _rootData;

    /// @dev The total HyPC locked into this contract from swaps.
    uint256 public totalLocked;

    //Events
    /// @dev   The event for when adding a new rootToken to level 19.
    /// @param rootNumber: The token number being added.
    event AddRootToken(uint256 rootNumber);

    /// @dev   The event for splitting a token from a parent level to a sub-level.
    /// @param tokenNumber: The token itself being split down.
    /// @param level: The level of the tokenNumber token.
    /// @param skipLevels: The number of levels below the tokenNumber level for the new tokens.
    ///                    Two to the power of this number is the number of tokens created.
    event SplitHeldTokens(uint256 tokenNumber, uint256 level, uint256 skipLevels);

    /// @dev   The event for swapping HyPC for a c_HyPC token.
    /// @param tokenNumber: The tokenNumber swapped for.
    /// @param level: The level of c_HyPC token swapped for.
    /// @param hypcAmount: The amount of HyPC locked for this swap.
    event Swap(uint256 tokenNumber, uint256 level, uint256 hypcAmount);

    /// @dev   The event for redeeming a c_HyPC token for HyPC token.
    /// @param level: The level of c_HyPC token redeemed.
    /// @param tokenNumber: The tokenNumber redeemed.
    /// @param hypcAmount: The amount of HyPC unlocked for this redemption.
    event Redeem(uint256 level, uint256 tokenNumber, uint256 hypcAmount);

    /// @dev   The event for assigning a target number to a c_HyPC token.
    /// @param tokenNumber: The token being given the assignment.
    /// @param targetNumber: The number being assigned to this token.
    /// @param backingAmount: The amount of backing HyPC used in this assignment.
    /// @param totalAmount: The total amount assigned to this targetNumber now.
    event AssignNumber(uint256 tokenNumber, uint256 targetNumber, uint256 backingAmount, uint256 totalAmount);

    /// @dev   The event for assigning a target string to a c_HyPC token.
    /// @param tokenNumber: The token being given the assignment.
    /// @param targetString: The string being assigned to this token.
    /// @param backingAmount: The amount of backing HyPC used in this assignment.
    event AssignString(uint256 tokenNumber, string targetString, uint256 backingAmount);

    /// @dev   The event for burning a token with a string.
    /// @param tokenNumber: The c_HyPC token being burnt.
    /// @param burnString: The string being assigned on burn.
    event Burn(uint256 tokenNumber, string burnString);

    //Modifiers
    /// @dev   Check if the caller owns the given c_HyPC token.
    /// @param tokenNumber: The c_HyPC token ID.
    modifier isOwnerOf(uint256 tokenNumber) {
        if (ownerOf(tokenNumber) != _msgSender()) revert SenderMustOwnToken();
        _;
    }

    /// @dev   Checks if the index is available in the levels array at this level.
    /// @param level: The token height for this check (MIN_LEVEL to MAX_LEVEL).
    /// @param index: The array index to check at this level.
    modifier validHeldToken(uint256 level, uint256 index) {
        if (level < MIN_LEVEL) revert TokenLevelTooLow();
        if (level > MAX_LEVEL) revert TokenLevelTooHigh();
        if (levels[level].length <= index ) revert InvalidTokenLevelIndex();
        _;
    }

    /// @dev   Checks if this tokenNumber has been minted and then burned.
    /// @param tokenNumber: The c_HyPC token ID.
    modifier isMintedAndBurned(uint256 tokenNumber) {
        if (_exists(tokenNumber) || !nftTokens[tokenNumber].minted) revert TokenNotBurned();
        _;
    }

    /// @dev   Checks if this tokenNumber has been minted.
    /// @param tokenNumber: The c_HyPC token ID.
    modifier isMinted(uint256 tokenNumber) {
        if (!nftTokens[tokenNumber].minted) revert TokenNotMinted();
        _;
    }

    /**
        @dev   The constructor takes in the HyPC token, the starting root c_HyPC number
               and the ending root c_HyPC numbers to be created. Valid starting and ending
               numbers should be between consecutive powers of 2 (eg: [8,16) ) to ensure all 
               root tokens are at the same level inside the binary tree, however, for token 
               uniqueness it is only required that that the ending number is less than two
               times the starting number.
        @param hypcTokenAddress: The address for the HyPC token contract
        @param startingNumber: The first root c_HyPC to be created.
        @param endingNumber: The last root c_HyPC number that can be created.
    */
    constructor(address hypcTokenAddress, uint256 startingNumber, uint256 endingNumber) ERC721('c_HyPC', 'c_HyPC') {
        if (hypcTokenAddress == address(0)) revert InvalidToken();
        if (startingNumber == 0) revert InvalidStartingNumber();
        if (endingNumber < startingNumber) revert InvalidEndingNumber();
        if (endingNumber >= 2*startingNumber) revert InvalidNumberRange();

        _hypcToken = IHYPC(hypcTokenAddress);
        _rootData.startRootNumber = startingNumber; //67108864;
        _rootData.endRootNumber = endingNumber; //67108864+4095 = 67112959;
        _rootData.currentRootNumber = startingNumber;
    }

    /// @notice Allows the owner of the contract to add more root tokens into the contract.
    ///         This is limited to the owner to allow for future upgrades if needed so a
    ///         later number range can be reserved for a new contract and the ownership
    ///         of this contract transferred to a null address.
    /// @param  tokens: The number of tokenNumbers to add to the highest level (19).
    function addRootTokens(uint256 tokens) external onlyOwner {
        uint256 currentRootNumber = _rootData.currentRootNumber;
        if (tokens > 1+_rootData.endRootNumber - _rootData.startRootNumber) revert TooManyRootTokens();

        //@dev _rootData.endRootNumber is inclusive, so we need to add 1 to it for this check.
        if (currentRootNumber + tokens > _rootData.endRootNumber + 1) revert TooManyRootTokens();

        uint256 endLimit = currentRootNumber+tokens;
        for (uint256 i=currentRootNumber; i < endLimit; i++) {
            levels[MAX_LEVEL].push(i);
            nftTokens[i] = TokenData('', 0, MAX_LEVEL, false);

            emit AddRootToken({
                rootNumber: i
            });
        }

        _rootData.currentRootNumber += tokens;
        _updateNFTArray(MAX_LEVEL);
    }

    /// @notice This splits a token inside the contract (either minted or not yet minted),
    ///         at the given level and index location inside the levels[level] array. The
    ///         skipLevels allows for the created tokens to be fully split down multiple levels
    ///         to avoid taking to do multiple contract calls.
    /// @param  level: The level of the token to split.
    /// @param  skipLevels: The number of levels to split down.
    function splitHeldToken(uint256 level, uint256 skipLevels) external validHeldToken(level, 0) {
        //@dev underflow check
        if (skipLevels > level) revert SkipLevelsTooLarge();

        if (skipLevels == 0) revert SkipLevelsMustBePositive();
        uint256 levelMinusSkipLevels = level-skipLevels;
        if (levelMinusSkipLevels < MIN_LEVEL) revert TokenLevelTooLowToSplit();

        uint256 tokensToCreate = 2 ** skipLevels;
        if (levels[levelMinusSkipLevels].length + tokensToCreate > LEVEL_LIMIT) revert CreatingTooManyTokens();

        uint256[] storage _targetLevel = levels[level];
        //@dev Remove the token at [0] by swapping it with the last element
        uint256 tokenNumber = _targetLevel[0];
        _targetLevel[0] = _targetLevel[_targetLevel.length - 1];
        _targetLevel.pop();
        _updateNFTArray(level);

        if (nftTokens[tokenNumber].minted) {
            _burn(tokenNumber);
        }

        //@dev add new tokens to the lower level.
        uint256 endLimit = tokenNumber*tokensToCreate+tokensToCreate;
        for (uint256 i=tokenNumber*tokensToCreate; i < endLimit; i++) {
            levels[levelMinusSkipLevels].push(i);
            nftTokens[i] = TokenData('', 0, levelMinusSkipLevels, false);
        }

        emit SplitHeldTokens({
            tokenNumber: tokenNumber, 
            level: level, 
            skipLevels: skipLevels
        });
    }

    /// @dev   Internal function that updates the nfts[0] entry for backwards compatibility with
    ///        swapV1 contract callers, like the PoolV1/V2 contracts.
    /// @param level: The level of tokens that was being split, redeemed, or swapped.
    function _updateNFTArray(uint256 level) internal {
        if (level == MAX_LEVEL) {
            if (levels[MAX_LEVEL].length > 0) {
                if (nfts.length == 0) {
                    nfts.push(levels[MAX_LEVEL][0]);
                } else {
                    nfts[0] = levels[MAX_LEVEL][0];
                }
            } else {
                if (nfts.length > 0) {
                    nfts.pop();
                }
            }
        }
    }

    /// @dev   Wrapper around the main _swapV2 call.
    /// @param level: The level of token to swap for.
    function swapV2(uint256 level) external validHeldToken(level, 0) nonReentrant {
        _swapV2(level);
    }

    /// @notice The main swap function. This asks for the token at the index location of the levels[level]
    ///         array. The tokens in this array, while allocated to this level, may not have been minted
    ///         yet (if it was not swapped for previously), so if it wasn't minted yet, the token will
    ///         be minted to the sender, otherwise it will be transferred to them. This call will request
    ///         2^level amount of HyPC to get the corresponding c_HyPC.
    /// @param  level: The level of the token to swap for.
    function _swapV2(uint256 level) internal {
        //accept the HyPC here and deposit into the contract.
        uint256 amount = 2 ** level;
        totalLocked += amount;

        uint256[] storage _targetLevel = levels[level];
        ///@dev Remove the token at [0] by swapping it with the last element
        uint256 tokenNumber = _targetLevel[0];
        _targetLevel[0] = _targetLevel[_targetLevel.length - 1];
        _targetLevel.pop();
        _updateNFTArray(level);

        //Send this token from this contract to the user.
        //If the token wasn't minted yet, mint it, otherwise send it.
        TokenData storage _targetToken = nftTokens[tokenNumber];

        if (_targetToken.minted) {
            _safeTransfer(address(this), _msgSender(), tokenNumber, "");
        } else {
            _targetToken.minted = true;
            _safeMint(_msgSender(), tokenNumber);
        }
        _hypcToken.transferFrom(_msgSender(), address(this), amount * SIX_DECIMALS);

        emit Swap({
            tokenNumber: tokenNumber, 
            level: level, 
            hypcAmount: amount
        });
    }

    /// @notice The function that redeems a c_HyPC token for the amount of tokens that were deposited
    ///         for it.
    /// @param  tokenNumber: The c_HyPC token to be redeemed.
    function redeem(uint256 tokenNumber) external nonReentrant isOwnerOf(tokenNumber) {
        _unassign(tokenNumber);

        uint256 level = nftTokens[tokenNumber].level;
        levels[level].push(tokenNumber);
        _updateNFTArray(level);
        
        uint256 amount = 2 ** level;
        totalLocked -= amount;
        safeTransferFrom(_msgSender(), address(this), tokenNumber);
        _hypcToken.transfer(_msgSender(), amount * SIX_DECIMALS);

        emit Redeem({
            level: level, 
            tokenNumber: tokenNumber, 
            hypcAmount: amount
        });
    }

    //Assigning functions
    /// @notice The function to assign a targetNumber to a c_HyPC token.
    /// @param  tokenNumber: The c_HyPC to be assigned the targetNumber.
    /// @param  targetNumber: The targetNumber to be assigned.
    function assignNumber(uint256 tokenNumber, uint256 targetNumber) external isOwnerOf(tokenNumber) {
        _unassign(tokenNumber);

        if (targetNumber > 0) {

            TokenData storage _targetToken = nftTokens[tokenNumber];
            _targetToken.assignedNumber = targetNumber;
            assignedNumbers[targetNumber] += 2 ** (_targetToken.level);
            
            emit AssignNumber({
                tokenNumber: tokenNumber,
                targetNumber: targetNumber,
                backingAmount: 2 ** (_targetToken.level),
                totalAmount: assignedNumbers[targetNumber]
            });
        }
    }

    /// @notice Wrapper around the _assignString function.
    /// @param  tokenNumber: The c_HyPC to be assigned the targetNumber.
    /// @param  data: The target string to be assigned.
    function assignString(uint256 tokenNumber, string memory data) external isOwnerOf(tokenNumber) {
        _assignString(tokenNumber, data);
    }

    /// @notice The function to assign a targetString to a c_HyPC token. Mainly for backwards
    ///         compatibility with SwapV1 supporting contracts.
    /// @param  tokenNumber: The c_HyPC to be assigned the targetNumber.
    /// @param  data: The target string to be assigned.
    function _assignString(uint256 tokenNumber, string memory data) internal {
        _unassign(tokenNumber);

        TokenData storage _targetToken = nftTokens[tokenNumber];
        _targetToken.assignedString = data;
        assignedStrings[data] += 2 ** (_targetToken.level);

        emit AssignString({
            tokenNumber: tokenNumber,
            targetString: data,
            backingAmount: 2 ** (_targetToken.level)
        });
    }

    /// @notice The function to burn a c_HyPC token with a burn string.
    /// @param  tokenNumber: The c_HyPC to be burned.
    /// @param  data: The burn string to use.
    function burn(uint256 tokenNumber, string memory data) external isOwnerOf(tokenNumber) {
        _assignString(tokenNumber, data);
        _burn(tokenNumber);
        emit Burn(tokenNumber, data);
    }

    /// @dev   Internal function to remove an existing token assignment cleanly.
    /// @param tokenNumber: the c_HyPC token to clear the assignment of.
    function _unassign(uint256 tokenNumber) internal {
        TokenData storage _targetToken = nftTokens[tokenNumber];
        _lastBlockAssigned[tokenNumber] = block.timestamp;

        //if previously assigned, decrease the assignedNumber value
        if (_targetToken.assignedNumber > 0) {
            //unassign the assigned number
            assignedNumbers[_targetToken.assignedNumber] -= 2 ** (_targetToken.level);
            delete _targetToken.assignedNumber;
        }
        //if previously assigned, decrease the assignedNumber value
        if (bytes(_targetToken.assignedString).length > 0) {
            //unassign the assigned string
            assignedStrings[_targetToken.assignedString] -= 2 ** (_targetToken.level);
            delete _targetToken.assignedString;
        }
    }

    // Backwards compatibility for v2 pools
    /// @notice Wrapper around _assignString for backwards compatibility.
    /// @param  tokenNumber: The c_HyPC to be assigned the targetNumber.
    /// @param  data: The target string to be assigned.
    function assign(uint256 tokenNumber, string memory data) external isOwnerOf(tokenNumber) {
        //assign a string
        _assignString(tokenNumber, data);
    }

    /// @notice Wrapper around the _swapV2 function to swap for the first level 19 token,
    ///         for backwards compatibility.
    function swap() external nonReentrant validHeldToken(MAX_LEVEL, 0) {
        _swapV2(MAX_LEVEL);
    }

    //Getters
    /// @notice Copy of getAssignmentString. Mainly for backwards compatibility.
    /// @dev    Copies the getAssignmentString code to lower gas usage
    /// @param  tokenNumber: The c_HyPC token to get the assignment of.
    function getAssignment(uint256 tokenNumber) external view returns (string memory) {
        return _getAssignmentString(tokenNumber);
    }

    /// @notice Function to get the number of tokens available to be swapped for at a given level.
    /// @param  level: The level to get the number of tokens available to be swapped for.
    function getLevelLength(uint256 level) external view returns (uint256) {
        return levels[level].length;
    }

    /// @notice Function to get the tokenId to be swapped for at level and index.
    /// @param  level: The level of the token we want to swap for.
    /// @param  index: The index inside the level array that we want to swap for.
    function getAvailableToken(uint256 level, uint256 index) external view validHeldToken(level, index) returns (uint256) {
        return levels[level][index];
    }

    /// @notice Function to get the assigned string to a c_HyPC token. Mainly for backwards
    ///         compatibility.
    /// @param  tokenNumber: The c_HyPC token to get the assignment of.
    function getAssignmentString(uint256 tokenNumber) external view returns (string memory) {
        return _getAssignmentString(tokenNumber);
    }

    function _getAssignmentString(uint256 tokenNumber) internal view returns (string memory) {
        return nftTokens[tokenNumber].assignedString;
    }



    /// @notice Function to get the assigned number to a c_HyPC token.
    /// @param  tokenNumber: The c_HyPC token to get the assignment of.
    function getAssignmentNumber(uint256 tokenNumber) external view returns (uint256) {
        return nftTokens[tokenNumber].assignedNumber;
    }

    /// @notice Function to get total backing amount for this targetNumber from assignments.
    /// @param  targetNumber: The target number to get the total backing amount of.
    function getAssignmentTargetNumber(uint256 targetNumber) external view returns (uint256) {
        return assignedNumbers[targetNumber];
    }

    /// @notice Function to get total backing amount for this targetString from assignments.
    /// @param  targetString: The target string to get the total backing amount of.
    function getAssignmentTargetString(string memory targetString) external view returns (uint256) {
        return assignedStrings[targetString];
    }

    /// @notice Function to get the last block that this token was assigned at.
    ///
    function getLastAssigned(uint256 tokenId) external view returns (uint256) {
        return _lastBlockAssigned[tokenId];
    }

    /// @notice Function to get the burn data for a burned c_HyPC token.
    /// @param  tokenNumber: The c_HyPC token to get the burn data of.
    function getBurnData(uint256 tokenNumber) external view isMintedAndBurned(tokenNumber) returns (string memory) {
        return nftTokens[tokenNumber].assignedString;
    }

    /// @notice Function to get the token level for a given tokenNumber.
    /// @param  tokenNumber: The c_HyPC token to get the level of.
    function getTokenLevel(uint256 tokenNumber) external view isMinted(tokenNumber) returns (uint256) {
        return nftTokens[tokenNumber].level;
    }
}

File 2 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 3 of 21 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721.sol";

File 4 of 21 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 5 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

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

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

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

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

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

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

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

        _owners[tokenId] = to;

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

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

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

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

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

        // Clear approvals
        delete _tokenApprovals[tokenId];

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId, 1);

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

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

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

        emit Transfer(from, to, tokenId);

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

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

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

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

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

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

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

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

File 7 of 21 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 See {ERC721-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);

        if (batchSize > 1) {
            // Will only trigger during construction. Batch transferring (minting) is not available afterwards.
            revert("ERC721Enumerable: consecutive transfers not supported");
        }

        uint256 tokenId = firstTokenId;

        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 8 of 21 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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);

    /**
     * @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 9 of 21 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 12 of 21 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 21 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 20 of 21 : IHYPC.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @notice Interface for the HyperCycleToken.sol contract.
interface IHYPC is IERC20 {
    /*
     * Accesses the ERC20 functions of the HYPC contract. The burn function
     * is also exposed for future contracts.
    */
    /// @notice Burns an amount of the HyPC ERC20.
    function burn(uint256 amount) external;
}

File 21 of 21 : IHYPCSwapV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/interfaces/IERC721.sol";

/// @notice Interface for the HYPCSwap.sol contract.
interface IHYPCSwapV2 is IERC721 {
    /**
     * Accesses the addNFT function so that the CHYPC contract can
     * add the newly created NFT into this contract.
     */

    function addRootTokens(uint256 tokens) external;

    function splitHeldToken(uint256 level, uint256 skipLevels) external;

    function swapV2(uint256 level) external;

    function redeem(uint256 tokenNumber) external;

    function assignNumber(uint256 tokenNumber, uint256 targetNumber) external;

    function assignString(uint256 tokenNumber, string memory data) external;

    function burn(uint256 tokenNumber, string memory data) external;

    function assign(uint256 tokenNumber, string memory data) external;

    function swap() external;


    function getAssignment(uint256 tokenNumber) external view returns (string memory);
    function getAssignmentNumber(uint256 tokenNumber) external view returns (uint256);
    function getAssignmentString(uint256 tokenNumber) external view returns (string memory);



    function getBurnData(uint256 tokenNumber) external view returns (string memory);

    function getAvailableToken(uint256 level, uint256 index) external view returns (uint256);

    function getTokenLevel(uint256 tokenNumber) external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"hypcTokenAddress","type":"address"},{"internalType":"uint256","name":"startingNumber","type":"uint256"},{"internalType":"uint256","name":"endingNumber","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CreatingTooManyTokens","type":"error"},{"inputs":[],"name":"InvalidEndingNumber","type":"error"},{"inputs":[],"name":"InvalidNumberRange","type":"error"},{"inputs":[],"name":"InvalidStartingNumber","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTokenLevelIndex","type":"error"},{"inputs":[],"name":"SenderMustOwnToken","type":"error"},{"inputs":[],"name":"SkipLevelsMustBePositive","type":"error"},{"inputs":[],"name":"SkipLevelsTooLarge","type":"error"},{"inputs":[],"name":"TokenLevelTooHigh","type":"error"},{"inputs":[],"name":"TokenLevelTooLow","type":"error"},{"inputs":[],"name":"TokenLevelTooLowToSplit","type":"error"},{"inputs":[],"name":"TokenNotBurned","type":"error"},{"inputs":[],"name":"TokenNotMinted","type":"error"},{"inputs":[],"name":"TooManyRootTokens","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rootNumber","type":"uint256"}],"name":"AddRootToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"targetNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"backingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"AssignNumber","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"string","name":"targetString","type":"string"},{"indexed":false,"internalType":"uint256","name":"backingAmount","type":"uint256"}],"name":"AssignString","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"string","name":"burnString","type":"string"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"hypcAmount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"skipLevels","type":"uint256"}],"name":"SplitHeldTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"hypcAmount","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"LEVEL_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LEVEL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LEVEL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIX_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_lastBlockAssigned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"addRootTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"internalType":"string","name":"data","type":"string"}],"name":"assign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"internalType":"uint256","name":"targetNumber","type":"uint256"}],"name":"assignNumber","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"internalType":"string","name":"data","type":"string"}],"name":"assignString","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"assignedNumbers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"assignedStrings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"},{"internalType":"string","name":"data","type":"string"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"getAssignment","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"getAssignmentNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"getAssignmentString","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"targetNumber","type":"uint256"}],"name":"getAssignmentTargetNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"targetString","type":"string"}],"name":"getAssignmentTargetString","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getAvailableToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"getBurnData","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLastAssigned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"getLevelLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"getTokenLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"levels","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftTokens","outputs":[{"internalType":"string","name":"assignedString","type":"string"},{"internalType":"uint256","name":"assignedNumber","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"bool","name":"minted","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nfts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenNumber","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"skipLevels","type":"uint256"}],"name":"splitHeldToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"swapV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b506040516200385c3803806200385c8339810160408190526200003491620001b4565b604080518082018252600680825265635f4879504360d01b60208084018290528451808601909552918452908301529060006200007283826200029e565b5060016200008182826200029e565b5050506200009e620000986200015e60201b60201c565b62000162565b6001600b556001600160a01b038316620000cb5760405163c1ab6dc160e01b815260040160405180910390fd5b81600003620000ed5760405163f28bc86160e01b815260040160405180910390fd5b818110156200010f57604051630c1f8edd60e41b815260040160405180910390fd5b6200011c8260026200036a565b81106200013c57604051634f19dcef60e01b815260040160405180910390fd5b6001600160a01b03909216608052601281905560149190915560135562000396565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080600060608486031215620001ca57600080fd5b83516001600160a01b0381168114620001e257600080fd5b602085015160409095015190969495509392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022457607f821691505b6020821081036200024557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200029957600081815260208120601f850160051c81016020861015620002745750805b601f850160051c820191505b81811015620002955782815560010162000280565b5050505b505050565b81516001600160401b03811115620002ba57620002ba620001f9565b620002d281620002cb84546200020f565b846200024b565b602080601f8311600181146200030a5760008415620002f15750858301515b600019600386901b1c1916600185901b17855562000295565b600085815260208120601f198616915b828110156200033b578886015182559484019460019091019084016200031a565b50858210156200035a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176200039057634e487b7160e01b600052601160045260246000fd5b92915050565b6080516134a3620003b9600039600081816112d00152611f0701526134a36000f3fe608060405234801561001057600080fd5b50600436106102d65760003560e01c806388338ea411610182578063bd60b83f116100e9578063e68b0944116100a2578063f2db9dee1161007c578063f2db9dee14610699578063f2fde38b146106b9578063f682c349146106cc578063fbdb7ad3146106df57600080fd5b8063e68b094414610627578063e7768bf01461064a578063e985e9c51461065d57600080fd5b8063bd60b83f146105c6578063c87b56dd146105ce578063d011645c146105e1578063da95b76914610438578063db006a75146105f4578063df760b091461060757600080fd5b8063a22cb4651161013b578063a22cb46514610565578063a49062d414610578578063a92b6fc514610580578063aa44a39a14610467578063aefb3434146105a0578063b88d4fde146105b357600080fd5b806388338ea4146104cb57806388520dac146104eb5780638bd3ced61461050e5780638da5cb5b1461052157806395d89b41146105325780639b0df9131461053a57600080fd5b806332232aac116102415780635e387905116101fa57806370a08231116101d457806370a0823114610495578063715018a6146104a85780637641e6f3146104b05780638119c065146104c357600080fd5b80635e387905146104675780636352211e1461047a5780636867bd4a1461048d57600080fd5b806332232aac146103ff57806342842e0e146104125780634f6ccce714610425578063515c8b0f14610438578063568914121461044b5780635b151e6e1461045457600080fd5b806318160ddd1161029357806318160ddd1461039757806323b872dd146103a9578063250ea476146103bc578063265aa621146103cf5780632b180bcf146103e25780632f745c59146103ec57600080fd5b806301ffc9a7146102db578063020884141461030357806306fdde0314610323578063081812fc1461032b578063095ea7b314610356578063150b7a021461036b575b600080fd5b6102ee6102e9366004612b80565b6106ff565b60405190151581526020015b60405180910390f35b610316610311366004612b9d565b61072a565b6040516102fa9190612c06565b610316610829565b61033e610339366004612b9d565b6108bb565b6040516001600160a01b0390911681526020016102fa565b610369610364366004612c35565b6108e2565b005b61037e610379366004612ceb565b6109fc565b6040516001600160e01b031990911681526020016102fa565b6008545b6040519081526020016102fa565b6103696103b7366004612d67565b610a0d565b6103696103ca366004612b9d565b610a3e565b61039b6103dd366004612b9d565b610bed565b61039b620f424081565b61039b6103fa366004612c35565b610c0e565b61036961040d366004612b9d565b610ca4565b610369610420366004612d67565b610d34565b61039b610433366004612b9d565b610d4f565b610369610446366004612dc3565b610de2565b61039b60155481565b61039b610462366004612e0a565b610e1e565b610316610475366004612b9d565b610ec9565b61033e610488366004612b9d565b610ed4565b61039b601081565b61039b6104a3366004612e2c565b610f34565b610369610fba565b6103696104be366004612dc3565b610fce565b610369611051565b61039b6104d9366004612b9d565b600d6020526000908152604090205481565b61039b6104f9366004612b9d565b6000908152600c602052604090206001015490565b61039b61051c366004612e47565b6110a8565b600a546001600160a01b031661033e565b6103166110d0565b61039b610548366004612e47565b8051602081830181018051600e8252928201919093012091525481565b610369610573366004612e8a565b6110df565b61039b601381565b61039b61058e366004612b9d565b60009081526010602052604090205490565b61039b6105ae366004612e0a565b6110ee565b6103696105c1366004612ceb565b61111f565b61039b600a81565b6103166105dc366004612b9d565b611157565b61039b6105ef366004612b9d565b6111cb565b610369610602366004612b9d565b611216565b61039b610615366004612b9d565b6000908152600d602052604090205490565b61063a610635366004612b9d565b6113c4565b6040516102fa9493929190612ec1565b610369610658366004612e0a565b611479565b6102ee61066b366004612ef2565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61039b6106a7366004612b9d565b6000908152600f602052604090205490565b6103696106c7366004612e2c565b611799565b6103696106da366004612e0a565b61180f565b61039b6106ed366004612b9d565b600f6020526000908152604090205481565b60006001600160e01b0319821663780e9d6360e01b1480610724575061072482611905565b92915050565b60608161074e816000908152600260205260409020546001600160a01b0316151590565b8061076b57506000818152600c602052604090206003015460ff16155b1561078957604051631308ae0d60e31b815260040160405180910390fd5b6000838152600c6020526040902080546107a290612f25565b80601f01602080910402602001604051908101604052809291908181526020018280546107ce90612f25565b801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b505050505091505b50919050565b60606000805461083890612f25565b80601f016020809104026020016040519081016040528092919081815260200182805461086490612f25565b80156108b15780601f10610886576101008083540402835291602001916108b1565b820191906000526020600020905b81548152906001019060200180831161089457829003601f168201915b5050505050905090565b60006108c682611955565b506000908152600460205260409020546001600160a01b031690565b60006108ed82610ed4565b9050806001600160a01b0316836001600160a01b03160361095f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061097b575061097b813361066b565b6109ed5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610956565b6109f783836119b4565b505050565b630a85bd0160e11b5b949350505050565b610a173382611a22565b610a335760405162461bcd60e51b815260040161095690612f59565b6109f7838383611aa0565b610a46611c11565b601354601254601454610a5a906001612fbc565b610a649190612fcf565b821115610a84576040516341a3c7a760e01b815260040160405180910390fd5b601454610a92906001612fbc565b610a9c8383612fbc565b1115610abb576040516341a3c7a760e01b815260040160405180910390fd5b6000610ac78383612fbc565b9050815b81811015610bc75760008051602061344e8339815191528054600181019091557f9c0edea247a057c4e16063140de72c14d2750a5bdea07c53ffa918662a8d7af2018190556040805160a0810182526000608082018181528252602082810182905260138385015260608301829052848252600c90529190912081518190610b539082613030565b50602082810151600183015560408084015160028401556060909301516003909201805460ff19169215159290921790915590518281527f1e929d7e2988c1e1a26286b445a3802c7eb75760e7137f543110cf0ccb19cb3c910160405180910390a180610bbf816130f0565b915050610acb565b508260126001016000828254610bdd9190612fbc565b909155506109f790506013611c6b565b60118181548110610bfd57600080fd5b600091825260209091200154905081565b6000610c1983610f34565b8210610c7b5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610956565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b806000600a821015610cc95760405163909fe6a160e01b815260040160405180910390fd5b6013821115610ceb57604051637ac8add760e01b815260040160405180910390fd5b6000828152601060205260409020548110610d1957604051632bc7640360e11b815260040160405180910390fd5b610d21611d77565b610d2a83611dd0565b6109f76001600b55565b6109f78383836040518060200160405280600081525061111f565b6000610d5a60085490565b8210610dbd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610956565b60088281548110610dd057610dd0613109565b90600052602060002001549050919050565b8133610ded82610ed4565b6001600160a01b031614610e14576040516313ae7ef760e21b815260040160405180910390fd5b6109f78383611ffc565b60008282600a821015610e445760405163909fe6a160e01b815260040160405180910390fd5b6013821115610e6657604051637ac8add760e01b815260040160405180910390fd5b6000828152601060205260409020548110610e9457604051632bc7640360e11b815260040160405180910390fd5b6000858152601060205260409020805485908110610eb457610eb4613109565b90600052602060002001549250505092915050565b6060610724826120a5565b6000818152600260205260408120546001600160a01b0316806107245760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610956565b60006001600160a01b038216610f9e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610956565b506001600160a01b031660009081526003602052604090205490565b610fc2611c11565b610fcc6000612147565b565b8133610fd982610ed4565b6001600160a01b031614611000576040516313ae7ef760e21b815260040160405180910390fd5b61100a8383611ffc565b61101383612199565b7f055f408bc5c6d7bacc099d9cb2b83c4c6fde6fd3b196e6d18f0f59fc6c0fc363838360405161104492919061311f565b60405180910390a1505050565b611059611d77565b60136000818152601060205260008051602061344e8339815191525461109257604051632bc7640360e11b815260040160405180910390fd5b61109c6013611dd0565b5050610fcc6001600b55565b6000600e826040516110ba9190613138565b9081526020016040518091039020549050919050565b60606001805461083890612f25565b6110ea33838361223c565b5050565b6010602052816000526040600020818154811061110a57600080fd5b90600052602060002001600091509150505481565b6111293383611a22565b6111455760405162461bcd60e51b815260040161095690612f59565b6111518484848461230a565b50505050565b606061116282611955565b600061117960408051602081019091526000815290565b9050600081511161119957604051806020016040528060008152506111c4565b806111a38461233d565b6040516020016111b4929190613154565b6040516020818303038152906040525b9392505050565b6000818152600c6020526040812060030154829060ff166111ff5760405163d03ce9df60e01b815260040160405180910390fd5b50506000908152600c602052604090206002015490565b61121e611d77565b803361122982610ed4565b6001600160a01b031614611250576040516313ae7ef760e21b815260040160405180910390fd5b611259826123d0565b6000828152600c6020908152604080832060020154808452601083529083208054600181018255908452919092200183905561129481611c6b565b60006112a1826002613267565b905080601560008282546112b59190612fcf565b909155506112c69050333086610d34565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb33611303620f424085613273565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561134e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611372919061328a565b5060408051838152602081018690529081018290527f70d4d13dc6a7ecab4daf04ef8818b27210ec56ba0fa05d767b00f95c3080df919060600160405180910390a15050506113c16001600b55565b50565b600c602052600090815260409020805481906113df90612f25565b80601f016020809104026020016040519081016040528092919081815260200182805461140b90612f25565b80156114585780601f1061142d57610100808354040283529160200191611458565b820191906000526020600020905b81548152906001019060200180831161143b57829003601f168201915b50505050600183015460028401546003909401549293909290915060ff1684565b816000600a82101561149e5760405163909fe6a160e01b815260040160405180910390fd5b60138211156114c057604051637ac8add760e01b815260040160405180910390fd5b60008281526010602052604090205481106114ee57604051632bc7640360e11b815260040160405180910390fd5b8383111561150f5760405163cea1042360e01b815260040160405180910390fd5b8260000361152f57604051629d330160e31b815260040160405180910390fd5b600061153b8486612fcf565b9050600a81101561155f576040516349b6be5960e11b815260040160405180910390fd5b600061156c856002613267565b6000838152601060208190526040909120549192509061158d908390612fbc565b11156115ab5760405162588ce360e81b815260040160405180910390fd5b60008681526010602052604081208054909190829082906115ce576115ce613109565b9060005260206000200154905081600183805490506115ed9190612fcf565b815481106115fd576115fd613109565b90600052602060002001548260008154811061161b5761161b613109565b906000526020600020018190555081805480611639576116396132a7565b6001900381819060005260206000200160009055905561165888611c6b565b6000818152600c602052604090206003015460ff161561167b5761167b81612199565b6000836116888184613273565b6116929190612fbc565b905060006116a08584613273565b90505b8181101561174c576000868152601060209081526040808320805460018101825590845282842001849055805160a0810182526080810184815281528083018490528082018a905260608101849052848452600c9092529091208151819061170b9082613030565b5060208201516001820155604082015160028201556060909101516003909101805460ff191691151591909117905580611744816130f0565b9150506116a3565b5060408051838152602081018b90529081018990527fd2baea580be49f4686f9010fd8d18c763f89350bdfac59a3479b37b9e5a355b59060600160405180910390a1505050505050505050565b6117a1611c11565b6001600160a01b0381166118065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610956565b6113c181612147565b813361181a82610ed4565b6001600160a01b031614611841576040516313ae7ef760e21b815260040160405180910390fd5b61184a836123d0565b81156109f7576000838152600c602052604090206001810183905560028082015461187491613267565b6000848152600d602052604081208054909190611892908490612fbc565b925050819055507feeac879960dabc89f36df08da42d5d46e6b6d210be7a7bb8a20334805621ddc28484836002015460026118cd9190613267565b6000878152600d602090815260409182902054825195865290850193909352830152606082015260800160405180910390a150505050565b60006001600160e01b031982166380ac58cd60e01b148061193657506001600160e01b03198216635b5e139f60e01b145b8061072457506301ffc9a760e01b6001600160e01b0319831614610724565b6000818152600260205260409020546001600160a01b03166113c15760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610956565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119e982610ed4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080611a2e83610ed4565b9050806001600160a01b0316846001600160a01b03161480611a7557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610a055750836001600160a01b0316611a8e846108bb565b6001600160a01b031614949350505050565b826001600160a01b0316611ab382610ed4565b6001600160a01b031614611ad95760405162461bcd60e51b8152600401610956906132bd565b6001600160a01b038216611b3b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610956565b611b48838383600161249c565b826001600160a01b0316611b5b82610ed4565b6001600160a01b031614611b815760405162461bcd60e51b8152600401610956906132bd565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a546001600160a01b03163314610fcc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610956565b601381036113c1576013600052601060205260008051602061344e8339815191525415611d4557601154600003611ceb5760136000908152601060205260008051602061344e833981519152805460119290611cc957611cc9613109565b6000918252602080832090910154835460018101855593835291209091015550565b60136000908152601060205260008051602061344e8339815191528054909190611d1757611d17613109565b90600052602060002001546011600081548110611d3657611d36613109565b60009182526020909120015550565b601154156113c1576011805480611d5e57611d5e6132a7565b6001900381819060005260206000200160009055905550565b6002600b5403611dc95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610956565b6002600b55565b6000611ddd826002613267565b90508060156000828254611df19190612fbc565b90915550506000828152601060205260408120805490919082908290611e1957611e19613109565b906000526020600020015490508160018380549050611e389190612fcf565b81548110611e4857611e48613109565b906000526020600020015482600081548110611e6657611e66613109565b906000526020600020018190555081805480611e8457611e846132a7565b60019003818190600052602060002001600090559055611ea384611c6b565b6000818152600c60205260409020600381015460ff1615611ede57611ed93033846040518060200160405280600081525061230a565b611efd565b60038101805460ff19166001179055611efd611ef73390565b836125d0565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd3330611f3b620f424089613273565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb3919061328a565b5060408051838152602081018790529081018590527f92d941e0c114cd4379ba1e7d068a433f9e84070e2bd5213006935001f2720c3c9060600160405180910390a15050505050565b612005826123d0565b6000828152600c602052604090208061201e8382613030565b5060028082015461202e91613267565b600e8360405161203e9190613138565b9081526020016040518091039020600082825461205b9190612fbc565b925050819055507f14b4ef292c892a7b5ff4d146f58129326fdbf19e0723ba2696e147441cc68f488383836002015460026120969190613267565b60405161104493929190613302565b6000818152600c602052604090208054606091906120c290612f25565b80601f01602080910402602001604051908101604052809291908181526020018280546120ee90612f25565b801561213b5780601f106121105761010080835404028352916020019161213b565b820191906000526020600020905b81548152906001019060200180831161211e57829003601f168201915b50505050509050919050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006121a482610ed4565b90506121b481600084600161249c565b6121bd82610ed4565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b03160361229d5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610956565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612315848484611aa0565b612321848484846125ea565b6111515760405162461bcd60e51b81526004016109569061332b565b6060600061234a836126e8565b600101905060008167ffffffffffffffff81111561236a5761236a612c5f565b6040519080825280601f01601f191660200182016040528015612394576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461239e57509392505050565b6000818152600c60209081526040808320600f9092529091204290556001810154156124355760028082015461240591613267565b60018201546000908152600d602052604081208054909190612428908490612fcf565b9091555050600060018201555b600081600001805461244690612f25565b905011156110ea5760028082015461245d91613267565b604051600e9061246e90849061337d565b9081526020016040518091039020600082825461248b9190612fcf565b909155506110ea9050816000612b1c565b600181111561250b5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610956565b816001600160a01b0385166125675761256281600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61258a565b836001600160a01b0316856001600160a01b03161461258a5761258a85826127c0565b6001600160a01b0384166125a6576125a18161285d565b6125c9565b846001600160a01b0316846001600160a01b0316146125c9576125c9848261290c565b5050505050565b6110ea828260405180602001604052806000815250612950565b60006001600160a01b0384163b156126e057604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061262e9033908990889088906004016133f3565b6020604051808303816000875af1925050508015612669575060408051601f3d908101601f1916820190925261266691810190613430565b60015b6126c6573d808015612697576040519150601f19603f3d011682016040523d82523d6000602084013e61269c565b606091505b5080516000036126be5760405162461bcd60e51b81526004016109569061332b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610a05565b506001610a05565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127275772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612753576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061277157662386f26fc10000830492506010015b6305f5e1008310612789576305f5e100830492506008015b612710831061279d57612710830492506004015b606483106127af576064830492506002015b600a83106107245760010192915050565b600060016127cd84610f34565b6127d79190612fcf565b60008381526007602052604090205490915080821461282a576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061286f90600190612fcf565b6000838152600960205260408120546008805493945090928490811061289757612897613109565b9060005260206000200154905080600883815481106128b8576128b8613109565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806128f0576128f06132a7565b6001900381819060005260206000200160009055905550505050565b600061291783610f34565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b61295a8383612983565b61296760008484846125ea565b6109f75760405162461bcd60e51b81526004016109569061332b565b6001600160a01b0382166129d95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610956565b6000818152600260205260409020546001600160a01b031615612a3e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610956565b612a4c60008383600161249c565b6000818152600260205260409020546001600160a01b031615612ab15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610956565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b508054612b2890612f25565b6000825580601f10612b38575050565b601f0160209004906000526020600020908101906113c191905b80821115612b665760008155600101612b52565b5090565b6001600160e01b0319811681146113c157600080fd5b600060208284031215612b9257600080fd5b81356111c481612b6a565b600060208284031215612baf57600080fd5b5035919050565b60005b83811015612bd1578181015183820152602001612bb9565b50506000910152565b60008151808452612bf2816020860160208601612bb6565b601f01601f19169290920160200192915050565b6020815260006111c46020830184612bda565b80356001600160a01b0381168114612c3057600080fd5b919050565b60008060408385031215612c4857600080fd5b612c5183612c19565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612c9057612c90612c5f565b604051601f8501601f19908116603f01168101908282118183101715612cb857612cb8612c5f565b81604052809350858152868686011115612cd157600080fd5b858560208301376000602087830101525050509392505050565b60008060008060808587031215612d0157600080fd5b612d0a85612c19565b9350612d1860208601612c19565b925060408501359150606085013567ffffffffffffffff811115612d3b57600080fd5b8501601f81018713612d4c57600080fd5b612d5b87823560208401612c75565b91505092959194509250565b600080600060608486031215612d7c57600080fd5b612d8584612c19565b9250612d9360208501612c19565b9150604084013590509250925092565b600082601f830112612db457600080fd5b6111c483833560208501612c75565b60008060408385031215612dd657600080fd5b82359150602083013567ffffffffffffffff811115612df457600080fd5b612e0085828601612da3565b9150509250929050565b60008060408385031215612e1d57600080fd5b50508035926020909101359150565b600060208284031215612e3e57600080fd5b6111c482612c19565b600060208284031215612e5957600080fd5b813567ffffffffffffffff811115612e7057600080fd5b610a0584828501612da3565b80151581146113c157600080fd5b60008060408385031215612e9d57600080fd5b612ea683612c19565b91506020830135612eb681612e7c565b809150509250929050565b608081526000612ed46080830187612bda565b60208301959095525060408101929092521515606090910152919050565b60008060408385031215612f0557600080fd5b612f0e83612c19565b9150612f1c60208401612c19565b90509250929050565b600181811c90821680612f3957607f821691505b60208210810361082357634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072457610724612fa6565b8181038181111561072457610724612fa6565b601f8211156109f757600081815260208120601f850160051c810160208610156130095750805b601f850160051c820191505b8181101561302857828155600101613015565b505050505050565b815167ffffffffffffffff81111561304a5761304a612c5f565b61305e816130588454612f25565b84612fe2565b602080601f831160018114613093576000841561307b5750858301515b600019600386901b1c1916600185901b178555613028565b600085815260208120601f198616915b828110156130c2578886015182559484019460019091019084016130a3565b50858210156130e05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001820161310257613102612fa6565b5060010190565b634e487b7160e01b600052603260045260246000fd5b828152604060208201526000610a056040830184612bda565b6000825161314a818460208701612bb6565b9190910192915050565b60008351613166818460208801612bb6565b83519083019061317a818360208801612bb6565b01949350505050565b600181815b808511156131be5781600019048211156131a4576131a4612fa6565b808516156131b157918102915b93841c9390800290613188565b509250929050565b6000826131d557506001610724565b816131e257506000610724565b81600181146131f857600281146132025761321e565b6001915050610724565b60ff84111561321357613213612fa6565b50506001821b610724565b5060208310610133831016604e8410600b8410161715613241575081810a610724565b61324b8383613183565b806000190482111561325f5761325f612fa6565b029392505050565b60006111c483836131c6565b808202811582820484141761072457610724612fa6565b60006020828403121561329c57600080fd5b81516111c481612e7c565b634e487b7160e01b600052603160045260246000fd5b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b83815260606020820152600061331b6060830185612bda565b9050826040830152949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600080835461338b81612f25565b600182811680156133a357600181146133b8576133e7565b60ff19841687528215158302870194506133e7565b8760005260208060002060005b858110156133de5781548a8201529084019082016133c5565b50505082870194505b50929695505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061342690830184612bda565b9695505050505050565b60006020828403121561344257600080fd5b81516111c481612b6a56feab6e88ec9844f266cae57004e7e0869495b951c20b7a4491e795bfa666c3d029a2646970667358221220ae3a52bb365b57a9701d4c99e3eab320f8649285c9c91061cffb5be310b77c9c64736f6c63430008130033000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e400000000000000000000000000000000000000000000000000000000040000a00000000000000000000000000000000000000000000000000000000004000fff

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d65760003560e01c806388338ea411610182578063bd60b83f116100e9578063e68b0944116100a2578063f2db9dee1161007c578063f2db9dee14610699578063f2fde38b146106b9578063f682c349146106cc578063fbdb7ad3146106df57600080fd5b8063e68b094414610627578063e7768bf01461064a578063e985e9c51461065d57600080fd5b8063bd60b83f146105c6578063c87b56dd146105ce578063d011645c146105e1578063da95b76914610438578063db006a75146105f4578063df760b091461060757600080fd5b8063a22cb4651161013b578063a22cb46514610565578063a49062d414610578578063a92b6fc514610580578063aa44a39a14610467578063aefb3434146105a0578063b88d4fde146105b357600080fd5b806388338ea4146104cb57806388520dac146104eb5780638bd3ced61461050e5780638da5cb5b1461052157806395d89b41146105325780639b0df9131461053a57600080fd5b806332232aac116102415780635e387905116101fa57806370a08231116101d457806370a0823114610495578063715018a6146104a85780637641e6f3146104b05780638119c065146104c357600080fd5b80635e387905146104675780636352211e1461047a5780636867bd4a1461048d57600080fd5b806332232aac146103ff57806342842e0e146104125780634f6ccce714610425578063515c8b0f14610438578063568914121461044b5780635b151e6e1461045457600080fd5b806318160ddd1161029357806318160ddd1461039757806323b872dd146103a9578063250ea476146103bc578063265aa621146103cf5780632b180bcf146103e25780632f745c59146103ec57600080fd5b806301ffc9a7146102db578063020884141461030357806306fdde0314610323578063081812fc1461032b578063095ea7b314610356578063150b7a021461036b575b600080fd5b6102ee6102e9366004612b80565b6106ff565b60405190151581526020015b60405180910390f35b610316610311366004612b9d565b61072a565b6040516102fa9190612c06565b610316610829565b61033e610339366004612b9d565b6108bb565b6040516001600160a01b0390911681526020016102fa565b610369610364366004612c35565b6108e2565b005b61037e610379366004612ceb565b6109fc565b6040516001600160e01b031990911681526020016102fa565b6008545b6040519081526020016102fa565b6103696103b7366004612d67565b610a0d565b6103696103ca366004612b9d565b610a3e565b61039b6103dd366004612b9d565b610bed565b61039b620f424081565b61039b6103fa366004612c35565b610c0e565b61036961040d366004612b9d565b610ca4565b610369610420366004612d67565b610d34565b61039b610433366004612b9d565b610d4f565b610369610446366004612dc3565b610de2565b61039b60155481565b61039b610462366004612e0a565b610e1e565b610316610475366004612b9d565b610ec9565b61033e610488366004612b9d565b610ed4565b61039b601081565b61039b6104a3366004612e2c565b610f34565b610369610fba565b6103696104be366004612dc3565b610fce565b610369611051565b61039b6104d9366004612b9d565b600d6020526000908152604090205481565b61039b6104f9366004612b9d565b6000908152600c602052604090206001015490565b61039b61051c366004612e47565b6110a8565b600a546001600160a01b031661033e565b6103166110d0565b61039b610548366004612e47565b8051602081830181018051600e8252928201919093012091525481565b610369610573366004612e8a565b6110df565b61039b601381565b61039b61058e366004612b9d565b60009081526010602052604090205490565b61039b6105ae366004612e0a565b6110ee565b6103696105c1366004612ceb565b61111f565b61039b600a81565b6103166105dc366004612b9d565b611157565b61039b6105ef366004612b9d565b6111cb565b610369610602366004612b9d565b611216565b61039b610615366004612b9d565b6000908152600d602052604090205490565b61063a610635366004612b9d565b6113c4565b6040516102fa9493929190612ec1565b610369610658366004612e0a565b611479565b6102ee61066b366004612ef2565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61039b6106a7366004612b9d565b6000908152600f602052604090205490565b6103696106c7366004612e2c565b611799565b6103696106da366004612e0a565b61180f565b61039b6106ed366004612b9d565b600f6020526000908152604090205481565b60006001600160e01b0319821663780e9d6360e01b1480610724575061072482611905565b92915050565b60608161074e816000908152600260205260409020546001600160a01b0316151590565b8061076b57506000818152600c602052604090206003015460ff16155b1561078957604051631308ae0d60e31b815260040160405180910390fd5b6000838152600c6020526040902080546107a290612f25565b80601f01602080910402602001604051908101604052809291908181526020018280546107ce90612f25565b801561081b5780601f106107f05761010080835404028352916020019161081b565b820191906000526020600020905b8154815290600101906020018083116107fe57829003601f168201915b505050505091505b50919050565b60606000805461083890612f25565b80601f016020809104026020016040519081016040528092919081815260200182805461086490612f25565b80156108b15780601f10610886576101008083540402835291602001916108b1565b820191906000526020600020905b81548152906001019060200180831161089457829003601f168201915b5050505050905090565b60006108c682611955565b506000908152600460205260409020546001600160a01b031690565b60006108ed82610ed4565b9050806001600160a01b0316836001600160a01b03160361095f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061097b575061097b813361066b565b6109ed5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610956565b6109f783836119b4565b505050565b630a85bd0160e11b5b949350505050565b610a173382611a22565b610a335760405162461bcd60e51b815260040161095690612f59565b6109f7838383611aa0565b610a46611c11565b601354601254601454610a5a906001612fbc565b610a649190612fcf565b821115610a84576040516341a3c7a760e01b815260040160405180910390fd5b601454610a92906001612fbc565b610a9c8383612fbc565b1115610abb576040516341a3c7a760e01b815260040160405180910390fd5b6000610ac78383612fbc565b9050815b81811015610bc75760008051602061344e8339815191528054600181019091557f9c0edea247a057c4e16063140de72c14d2750a5bdea07c53ffa918662a8d7af2018190556040805160a0810182526000608082018181528252602082810182905260138385015260608301829052848252600c90529190912081518190610b539082613030565b50602082810151600183015560408084015160028401556060909301516003909201805460ff19169215159290921790915590518281527f1e929d7e2988c1e1a26286b445a3802c7eb75760e7137f543110cf0ccb19cb3c910160405180910390a180610bbf816130f0565b915050610acb565b508260126001016000828254610bdd9190612fbc565b909155506109f790506013611c6b565b60118181548110610bfd57600080fd5b600091825260209091200154905081565b6000610c1983610f34565b8210610c7b5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610956565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b806000600a821015610cc95760405163909fe6a160e01b815260040160405180910390fd5b6013821115610ceb57604051637ac8add760e01b815260040160405180910390fd5b6000828152601060205260409020548110610d1957604051632bc7640360e11b815260040160405180910390fd5b610d21611d77565b610d2a83611dd0565b6109f76001600b55565b6109f78383836040518060200160405280600081525061111f565b6000610d5a60085490565b8210610dbd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610956565b60088281548110610dd057610dd0613109565b90600052602060002001549050919050565b8133610ded82610ed4565b6001600160a01b031614610e14576040516313ae7ef760e21b815260040160405180910390fd5b6109f78383611ffc565b60008282600a821015610e445760405163909fe6a160e01b815260040160405180910390fd5b6013821115610e6657604051637ac8add760e01b815260040160405180910390fd5b6000828152601060205260409020548110610e9457604051632bc7640360e11b815260040160405180910390fd5b6000858152601060205260409020805485908110610eb457610eb4613109565b90600052602060002001549250505092915050565b6060610724826120a5565b6000818152600260205260408120546001600160a01b0316806107245760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610956565b60006001600160a01b038216610f9e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610956565b506001600160a01b031660009081526003602052604090205490565b610fc2611c11565b610fcc6000612147565b565b8133610fd982610ed4565b6001600160a01b031614611000576040516313ae7ef760e21b815260040160405180910390fd5b61100a8383611ffc565b61101383612199565b7f055f408bc5c6d7bacc099d9cb2b83c4c6fde6fd3b196e6d18f0f59fc6c0fc363838360405161104492919061311f565b60405180910390a1505050565b611059611d77565b60136000818152601060205260008051602061344e8339815191525461109257604051632bc7640360e11b815260040160405180910390fd5b61109c6013611dd0565b5050610fcc6001600b55565b6000600e826040516110ba9190613138565b9081526020016040518091039020549050919050565b60606001805461083890612f25565b6110ea33838361223c565b5050565b6010602052816000526040600020818154811061110a57600080fd5b90600052602060002001600091509150505481565b6111293383611a22565b6111455760405162461bcd60e51b815260040161095690612f59565b6111518484848461230a565b50505050565b606061116282611955565b600061117960408051602081019091526000815290565b9050600081511161119957604051806020016040528060008152506111c4565b806111a38461233d565b6040516020016111b4929190613154565b6040516020818303038152906040525b9392505050565b6000818152600c6020526040812060030154829060ff166111ff5760405163d03ce9df60e01b815260040160405180910390fd5b50506000908152600c602052604090206002015490565b61121e611d77565b803361122982610ed4565b6001600160a01b031614611250576040516313ae7ef760e21b815260040160405180910390fd5b611259826123d0565b6000828152600c6020908152604080832060020154808452601083529083208054600181018255908452919092200183905561129481611c6b565b60006112a1826002613267565b905080601560008282546112b59190612fcf565b909155506112c69050333086610d34565b6001600160a01b037f000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e41663a9059cbb33611303620f424085613273565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561134e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611372919061328a565b5060408051838152602081018690529081018290527f70d4d13dc6a7ecab4daf04ef8818b27210ec56ba0fa05d767b00f95c3080df919060600160405180910390a15050506113c16001600b55565b50565b600c602052600090815260409020805481906113df90612f25565b80601f016020809104026020016040519081016040528092919081815260200182805461140b90612f25565b80156114585780601f1061142d57610100808354040283529160200191611458565b820191906000526020600020905b81548152906001019060200180831161143b57829003601f168201915b50505050600183015460028401546003909401549293909290915060ff1684565b816000600a82101561149e5760405163909fe6a160e01b815260040160405180910390fd5b60138211156114c057604051637ac8add760e01b815260040160405180910390fd5b60008281526010602052604090205481106114ee57604051632bc7640360e11b815260040160405180910390fd5b8383111561150f5760405163cea1042360e01b815260040160405180910390fd5b8260000361152f57604051629d330160e31b815260040160405180910390fd5b600061153b8486612fcf565b9050600a81101561155f576040516349b6be5960e11b815260040160405180910390fd5b600061156c856002613267565b6000838152601060208190526040909120549192509061158d908390612fbc565b11156115ab5760405162588ce360e81b815260040160405180910390fd5b60008681526010602052604081208054909190829082906115ce576115ce613109565b9060005260206000200154905081600183805490506115ed9190612fcf565b815481106115fd576115fd613109565b90600052602060002001548260008154811061161b5761161b613109565b906000526020600020018190555081805480611639576116396132a7565b6001900381819060005260206000200160009055905561165888611c6b565b6000818152600c602052604090206003015460ff161561167b5761167b81612199565b6000836116888184613273565b6116929190612fbc565b905060006116a08584613273565b90505b8181101561174c576000868152601060209081526040808320805460018101825590845282842001849055805160a0810182526080810184815281528083018490528082018a905260608101849052848452600c9092529091208151819061170b9082613030565b5060208201516001820155604082015160028201556060909101516003909101805460ff191691151591909117905580611744816130f0565b9150506116a3565b5060408051838152602081018b90529081018990527fd2baea580be49f4686f9010fd8d18c763f89350bdfac59a3479b37b9e5a355b59060600160405180910390a1505050505050505050565b6117a1611c11565b6001600160a01b0381166118065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610956565b6113c181612147565b813361181a82610ed4565b6001600160a01b031614611841576040516313ae7ef760e21b815260040160405180910390fd5b61184a836123d0565b81156109f7576000838152600c602052604090206001810183905560028082015461187491613267565b6000848152600d602052604081208054909190611892908490612fbc565b925050819055507feeac879960dabc89f36df08da42d5d46e6b6d210be7a7bb8a20334805621ddc28484836002015460026118cd9190613267565b6000878152600d602090815260409182902054825195865290850193909352830152606082015260800160405180910390a150505050565b60006001600160e01b031982166380ac58cd60e01b148061193657506001600160e01b03198216635b5e139f60e01b145b8061072457506301ffc9a760e01b6001600160e01b0319831614610724565b6000818152600260205260409020546001600160a01b03166113c15760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610956565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119e982610ed4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080611a2e83610ed4565b9050806001600160a01b0316846001600160a01b03161480611a7557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610a055750836001600160a01b0316611a8e846108bb565b6001600160a01b031614949350505050565b826001600160a01b0316611ab382610ed4565b6001600160a01b031614611ad95760405162461bcd60e51b8152600401610956906132bd565b6001600160a01b038216611b3b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610956565b611b48838383600161249c565b826001600160a01b0316611b5b82610ed4565b6001600160a01b031614611b815760405162461bcd60e51b8152600401610956906132bd565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a546001600160a01b03163314610fcc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610956565b601381036113c1576013600052601060205260008051602061344e8339815191525415611d4557601154600003611ceb5760136000908152601060205260008051602061344e833981519152805460119290611cc957611cc9613109565b6000918252602080832090910154835460018101855593835291209091015550565b60136000908152601060205260008051602061344e8339815191528054909190611d1757611d17613109565b90600052602060002001546011600081548110611d3657611d36613109565b60009182526020909120015550565b601154156113c1576011805480611d5e57611d5e6132a7565b6001900381819060005260206000200160009055905550565b6002600b5403611dc95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610956565b6002600b55565b6000611ddd826002613267565b90508060156000828254611df19190612fbc565b90915550506000828152601060205260408120805490919082908290611e1957611e19613109565b906000526020600020015490508160018380549050611e389190612fcf565b81548110611e4857611e48613109565b906000526020600020015482600081548110611e6657611e66613109565b906000526020600020018190555081805480611e8457611e846132a7565b60019003818190600052602060002001600090559055611ea384611c6b565b6000818152600c60205260409020600381015460ff1615611ede57611ed93033846040518060200160405280600081525061230a565b611efd565b60038101805460ff19166001179055611efd611ef73390565b836125d0565b6001600160a01b037f000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4166323b872dd3330611f3b620f424089613273565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb3919061328a565b5060408051838152602081018790529081018590527f92d941e0c114cd4379ba1e7d068a433f9e84070e2bd5213006935001f2720c3c9060600160405180910390a15050505050565b612005826123d0565b6000828152600c602052604090208061201e8382613030565b5060028082015461202e91613267565b600e8360405161203e9190613138565b9081526020016040518091039020600082825461205b9190612fbc565b925050819055507f14b4ef292c892a7b5ff4d146f58129326fdbf19e0723ba2696e147441cc68f488383836002015460026120969190613267565b60405161104493929190613302565b6000818152600c602052604090208054606091906120c290612f25565b80601f01602080910402602001604051908101604052809291908181526020018280546120ee90612f25565b801561213b5780601f106121105761010080835404028352916020019161213b565b820191906000526020600020905b81548152906001019060200180831161211e57829003601f168201915b50505050509050919050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006121a482610ed4565b90506121b481600084600161249c565b6121bd82610ed4565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b03160361229d5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610956565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612315848484611aa0565b612321848484846125ea565b6111515760405162461bcd60e51b81526004016109569061332b565b6060600061234a836126e8565b600101905060008167ffffffffffffffff81111561236a5761236a612c5f565b6040519080825280601f01601f191660200182016040528015612394576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461239e57509392505050565b6000818152600c60209081526040808320600f9092529091204290556001810154156124355760028082015461240591613267565b60018201546000908152600d602052604081208054909190612428908490612fcf565b9091555050600060018201555b600081600001805461244690612f25565b905011156110ea5760028082015461245d91613267565b604051600e9061246e90849061337d565b9081526020016040518091039020600082825461248b9190612fcf565b909155506110ea9050816000612b1c565b600181111561250b5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610956565b816001600160a01b0385166125675761256281600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61258a565b836001600160a01b0316856001600160a01b03161461258a5761258a85826127c0565b6001600160a01b0384166125a6576125a18161285d565b6125c9565b846001600160a01b0316846001600160a01b0316146125c9576125c9848261290c565b5050505050565b6110ea828260405180602001604052806000815250612950565b60006001600160a01b0384163b156126e057604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061262e9033908990889088906004016133f3565b6020604051808303816000875af1925050508015612669575060408051601f3d908101601f1916820190925261266691810190613430565b60015b6126c6573d808015612697576040519150601f19603f3d011682016040523d82523d6000602084013e61269c565b606091505b5080516000036126be5760405162461bcd60e51b81526004016109569061332b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610a05565b506001610a05565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127275772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612753576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061277157662386f26fc10000830492506010015b6305f5e1008310612789576305f5e100830492506008015b612710831061279d57612710830492506004015b606483106127af576064830492506002015b600a83106107245760010192915050565b600060016127cd84610f34565b6127d79190612fcf565b60008381526007602052604090205490915080821461282a576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061286f90600190612fcf565b6000838152600960205260408120546008805493945090928490811061289757612897613109565b9060005260206000200154905080600883815481106128b8576128b8613109565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806128f0576128f06132a7565b6001900381819060005260206000200160009055905550505050565b600061291783610f34565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b61295a8383612983565b61296760008484846125ea565b6109f75760405162461bcd60e51b81526004016109569061332b565b6001600160a01b0382166129d95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610956565b6000818152600260205260409020546001600160a01b031615612a3e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610956565b612a4c60008383600161249c565b6000818152600260205260409020546001600160a01b031615612ab15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610956565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b508054612b2890612f25565b6000825580601f10612b38575050565b601f0160209004906000526020600020908101906113c191905b80821115612b665760008155600101612b52565b5090565b6001600160e01b0319811681146113c157600080fd5b600060208284031215612b9257600080fd5b81356111c481612b6a565b600060208284031215612baf57600080fd5b5035919050565b60005b83811015612bd1578181015183820152602001612bb9565b50506000910152565b60008151808452612bf2816020860160208601612bb6565b601f01601f19169290920160200192915050565b6020815260006111c46020830184612bda565b80356001600160a01b0381168114612c3057600080fd5b919050565b60008060408385031215612c4857600080fd5b612c5183612c19565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612c9057612c90612c5f565b604051601f8501601f19908116603f01168101908282118183101715612cb857612cb8612c5f565b81604052809350858152868686011115612cd157600080fd5b858560208301376000602087830101525050509392505050565b60008060008060808587031215612d0157600080fd5b612d0a85612c19565b9350612d1860208601612c19565b925060408501359150606085013567ffffffffffffffff811115612d3b57600080fd5b8501601f81018713612d4c57600080fd5b612d5b87823560208401612c75565b91505092959194509250565b600080600060608486031215612d7c57600080fd5b612d8584612c19565b9250612d9360208501612c19565b9150604084013590509250925092565b600082601f830112612db457600080fd5b6111c483833560208501612c75565b60008060408385031215612dd657600080fd5b82359150602083013567ffffffffffffffff811115612df457600080fd5b612e0085828601612da3565b9150509250929050565b60008060408385031215612e1d57600080fd5b50508035926020909101359150565b600060208284031215612e3e57600080fd5b6111c482612c19565b600060208284031215612e5957600080fd5b813567ffffffffffffffff811115612e7057600080fd5b610a0584828501612da3565b80151581146113c157600080fd5b60008060408385031215612e9d57600080fd5b612ea683612c19565b91506020830135612eb681612e7c565b809150509250929050565b608081526000612ed46080830187612bda565b60208301959095525060408101929092521515606090910152919050565b60008060408385031215612f0557600080fd5b612f0e83612c19565b9150612f1c60208401612c19565b90509250929050565b600181811c90821680612f3957607f821691505b60208210810361082357634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561072457610724612fa6565b8181038181111561072457610724612fa6565b601f8211156109f757600081815260208120601f850160051c810160208610156130095750805b601f850160051c820191505b8181101561302857828155600101613015565b505050505050565b815167ffffffffffffffff81111561304a5761304a612c5f565b61305e816130588454612f25565b84612fe2565b602080601f831160018114613093576000841561307b5750858301515b600019600386901b1c1916600185901b178555613028565b600085815260208120601f198616915b828110156130c2578886015182559484019460019091019084016130a3565b50858210156130e05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001820161310257613102612fa6565b5060010190565b634e487b7160e01b600052603260045260246000fd5b828152604060208201526000610a056040830184612bda565b6000825161314a818460208701612bb6565b9190910192915050565b60008351613166818460208801612bb6565b83519083019061317a818360208801612bb6565b01949350505050565b600181815b808511156131be5781600019048211156131a4576131a4612fa6565b808516156131b157918102915b93841c9390800290613188565b509250929050565b6000826131d557506001610724565b816131e257506000610724565b81600181146131f857600281146132025761321e565b6001915050610724565b60ff84111561321357613213612fa6565b50506001821b610724565b5060208310610133831016604e8410600b8410161715613241575081810a610724565b61324b8383613183565b806000190482111561325f5761325f612fa6565b029392505050565b60006111c483836131c6565b808202811582820484141761072457610724612fa6565b60006020828403121561329c57600080fd5b81516111c481612e7c565b634e487b7160e01b600052603160045260246000fd5b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b83815260606020820152600061331b6060830185612bda565b9050826040830152949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600080835461338b81612f25565b600182811680156133a357600181146133b8576133e7565b60ff19841687528215158302870194506133e7565b8760005260208060002060005b858110156133de5781548a8201529084019082016133c5565b50505082870194505b50929695505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061342690830184612bda565b9695505050505050565b60006020828403121561344257600080fd5b81516111c481612b6a56feab6e88ec9844f266cae57004e7e0869495b951c20b7a4491e795bfa666c3d029a2646970667358221220ae3a52bb365b57a9701d4c99e3eab320f8649285c9c91061cffb5be310b77c9c64736f6c63430008130033

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

000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e400000000000000000000000000000000000000000000000000000000040000a00000000000000000000000000000000000000000000000000000000004000fff

-----Decoded View---------------
Arg [0] : hypcTokenAddress (address): 0xeA7B7DC089c9a4A916B5a7a37617f59fD54e37E4
Arg [1] : startingNumber (uint256): 67109024
Arg [2] : endingNumber (uint256): 67112959

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4
Arg [1] : 00000000000000000000000000000000000000000000000000000000040000a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000004000fff


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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