ETH Price: $3,063.66 (+2.79%)
Gas: 1 Gwei

Contract

0x4BFbA79CF232361a53eDdd17C67C6c77A6F00379
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Create Share Tok...202515562024-07-07 2:09:114 mins ago1720318151IN
0x4BFbA79C...7A6F00379
0 ETH0.000988061.80579176
Create Share Tok...202515352024-07-07 2:04:478 mins ago1720317887IN
0x4BFbA79C...7A6F00379
0 ETH0.000952671.77450708
Create Share Tok...202515112024-07-07 1:59:5913 mins ago1720317599IN
0x4BFbA79C...7A6F00379
0 ETH0.000955921.82230268
Create Share Tok...202514912024-07-07 1:55:5917 mins ago1720317359IN
0x4BFbA79C...7A6F00379
0 ETH0.001194672.18341059
Create Share Tok...202514732024-07-07 1:51:5921 mins ago1720317119IN
0x4BFbA79C...7A6F00379
0 ETH0.00089191.70026434
Create Share Tok...202513542024-07-07 1:28:1145 mins ago1720315691IN
0x4BFbA79C...7A6F00379
0 ETH0.000954161.78395187
Create Share Tok...202512542024-07-07 1:08:111 hr ago1720314491IN
0x4BFbA79C...7A6F00379
0 ETH0.000999891.86245867
Create Share Tok...202511352024-07-07 0:44:231 hr ago1720313063IN
0x4BFbA79C...7A6F00379
0 ETH0.000920271.75435765
Create Share Tok...202509982024-07-07 0:16:591 hr ago1720311419IN
0x4BFbA79C...7A6F00379
0 ETH0.001122182.13925703
Create Share Tok...202509332024-07-07 0:03:592 hrs ago1720310639IN
0x4BFbA79C...7A6F00379
0 ETH0.001039421.93608928
Create Share Tok...202508602024-07-06 23:49:232 hrs ago1720309763IN
0x4BFbA79C...7A6F00379
0 ETH0.000821941.53674232
Create Share Tok...202508382024-07-06 23:44:592 hrs ago1720309499IN
0x4BFbA79C...7A6F00379
0 ETH0.001044791.90947307
Create Share Tok...202508012024-07-06 23:37:352 hrs ago1720309055IN
0x4BFbA79C...7A6F00379
0 ETH0.000816891.52730488
Create Share Tok...202507812024-07-06 23:33:352 hrs ago1720308815IN
0x4BFbA79C...7A6F00379
0 ETH0.000953591.78288311
Create Share Tok...202507422024-07-06 23:25:472 hrs ago1720308347IN
0x4BFbA79C...7A6F00379
0 ETH0.000812661.51942217
Create Share Tok...202507122024-07-06 23:19:472 hrs ago1720307987IN
0x4BFbA79C...7A6F00379
0 ETH0.000853891.59050766
Create Share Tok...202504022024-07-06 22:17:473 hrs ago1720304267IN
0x4BFbA79C...7A6F00379
0 ETH0.000723811.34822365
Create Share Tok...202503752024-07-06 22:12:234 hrs ago1720303943IN
0x4BFbA79C...7A6F00379
0 ETH0.000803511.46850864
Create Share Tok...202503562024-07-06 22:08:354 hrs ago1720303715IN
0x4BFbA79C...7A6F00379
0 ETH0.000884041.65284582
Create Share Tok...202503172024-07-06 22:00:474 hrs ago1720303247IN
0x4BFbA79C...7A6F00379
0 ETH0.00101661.85796327
Create Share Tok...202502522024-07-06 21:47:474 hrs ago1720302467IN
0x4BFbA79C...7A6F00379
0 ETH0.000911741.69826457
Create Share Tok...202502242024-07-06 21:42:114 hrs ago1720302131IN
0x4BFbA79C...7A6F00379
0 ETH0.000799661.46147856
Create Share Tok...202502012024-07-06 21:37:354 hrs ago1720301855IN
0x4BFbA79C...7A6F00379
0 ETH0.000890161.66428119
Create Share Tok...202501752024-07-06 21:32:234 hrs ago1720301543IN
0x4BFbA79C...7A6F00379
0 ETH0.001022861.8693932
Create Share Tok...202501462024-07-06 21:26:354 hrs ago1720301195IN
0x4BFbA79C...7A6F00379
0 ETH0.001135482.12294996
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:
HyperCycleShareTokensV2

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : HyperCycleShareTokensV2.sol
// SPDX-License-Identifier: MIT
/*
    Version 1 of the HyperCycle Share contract.
*/

pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../interfaces/IHyperCycleLicense.sol";
import "../interfaces/ICHYPC.sol";
import "../interfaces/IHYPCSwapV2.sol";
import "../interfaces/IHyperCycleShareTokens.sol";
import "../interfaces/IHYPC.sol";

/*
@title HyperCycle Share ERC1155, revenue sharing contract.
@author Barry Rowe, Rodolfo Cova 
@notice This contract is a mechanism to share revenue for participants in the HyperCycle system.
      
        HyperCycle is a network of AI computation nodes offering different AI services in a 
        decentralized manner. In this system, there are license holders, token holders, hardware
        operators, and AI developers. Using the HyperCycleSwapV2 contract, an amount of HyPC (erc20)
        can be swapped for a cHyPC (containerized HyPC) token, which can then point towards a
        license (HyperCycleLicense) NFT id. At this point, the owner of this license can assign
        their license to some hardware running the HyperCycle Node Manager, and can from then
        on accept AI service requests on the network. 

        While all of this can be done by a single user, there are benefits to dividing up the
        responsibilities of each party, so a user can participate as a license holder, token holder,
        hardware operator, or AI developer. This is where the HyperCycle Share contracts come into
        play. The HyperCycleShareTokens contract is an ERC1155 contract that accepts a deposit of
        a license NFT and a cHyPC NFT, and creates two new tokens: a wealth token, and a revenue
        token. While the license and cHyPC are locked in the new Share, revenue can be deposited
        into the HyperCycleShareTokens by the hardware manager (that is, using the node manager
        software) with the depositRevenue() method. After some HyPC has been deposited this way,
        the revenue becomes locked for a minimum waiting period (for example, 7 days), after which,
        this revenue can be unlocked, and at that point, owners of the revenue token can claim 
        their portion of the share's income by using the claimRevenue() method. This will update 
        their withdrawable amount of HyPC that they can then withdraw from the contract. The revenue
        deposit delay is useful for ensuring more fairness of the revenue sharing. For instance,
        without a delay, the hardware operator could buy a lot of revenue tokens from an exchange,
        then make a huge revenue deposit into the contract, and then immediately claim their revenue
        and then sell the revenue tokens back to the exchange. With a delay period, the hardware
        operator would have to hold onto those tokens for the 7 day period, and with the pending
        deposit coming through, the revenue token price would increase (similar to dividend yielding
        stocks when leading up to the day a dividend will be paid out). The other holders of the
        revenue tokens can sell their tokens at the higher price, and then buy back the revenue
        tokens after the revenue is unlocked and claimable by the contract, when the price is lower.
        This counteracts the advantage the hardware operator,or users who would front run a deposit
        transaction, would have.

        Since revenue tokens can be transferred at any time, while revenue is collected only on the 
        claimRevenue call, whenever a transfer of revenue tokens happens, a claimRevenue call is 
        made for both the sender and receiver of the tokens first via the safeTransferFrom ERC1155 
        overrides defined at the end of the contract. This prevents the following situation:
        suppose Alice and Bob have 50% of the revenue tokens each, and the contract earns 1000 HyPC.
        Alice then sends Bob half of her revenue tokens. Bob now owns 75% of the revenue tokens and
        can claim 75% of the 1000 HyPC, even though the 1000 HyPC was deposited when Alice owned
        50% of those tokens. 

        The claimRevenue hook on the transfer of revenue tokens fixes this issue by forcing the
        revenue to be claimed whenever revenue tokens are transferred between parties. In effect,
        the issue is that revenue tokens are only fungible if they have collected revenue at the
        same time (if Alice claims revenue on her tokens while Bob has not, then these tokens
        are not equivalent to each other). If both holders of the tokens have collected at the
        same time however, then these tokens are indeed equivalent.

        Besides the revenue tokens, there are also the wealth tokens. In this contract they do not
        have any special usage, but are intended for use in future contracts (for example: a share
        manager contract) that can use them for governance functions. Right now, the current contract
        is intended to be used either via a multi-sig wallet with a general delgation mechanism 
        (eg: gnosis), or more likely via an external manager contract that interfaces with this 
        contract. In that case, the license holder and cHyPC holders would use the manager contract
        to create the share and divide the wealth and revenue tokens amongst themselves, or other
        parties, using governing mechanisms inside the manager contract.

        If the original creator of the share (or someone that had the share transferred to them) 
        decides to cancel the share itself by calling the cancelShareTokens() method, then the 
        original license and cHyPC NFTs are sent back to the creator (or new owner), and future
        deposits to share are halted. At this time, owners of the revenue tokens can claim their 
        last amounts of HyPC, and withdraw their HyPC from the contract.

        As well, while the typical use case is that the original creator of the share deposits 
        both the license and cHyPC tokens into the share contract, there are some use cases where 
        it might make sense to only deposit the license instead. This could be the case where 
        this creator is a smart contract that used the CrowdFundHYPCPoolV2 contract get an 
        assignment pointed to the license Id. In this case, the smart contract would have an 
        external guarantee that the license has backing but does not own the cHyPC itself. 
        In this case, a share can be created instead with a cHyPC id of 0, which will bypass the 
        cHyPC retrieval and assignment in that case. 
 
        Finally, there's also a message function to allow the owner of a share to set a message
        associated to this share. This is mainly intended for future manager contracts to use.
*/

/* Errors */
// Modifier Errors
//@dev Error for when requiring the caller to be the owner of the share
error MustBeShareOwner();
//@dev Error for when the given share has to be active (not previously cancelled).
error ShareMustBeActive();
//@dev Error for when the given shareNumber has not been created yet.
error ShareDoesntExist();
//@dev Error for when the pending deposit does not exist.
error PendingDepositMustExist();

/* Constructor Errors */

//@dev Error for when the give end share number would cause an overflow when creating the token Ids.
error EndShareNumberWouldOverflow();
//@dev Error for when the inputed end number is greater than 2 times the start number.
//     This ensures that 2 times the current share number (ie: the revenueToken id) will be unique.
//     This error is also raised when the endNumber given is less than the startNumber.
error InvalidShareNumberRange();
//@dev Error for when the license contract address is zero.
error InvalidLicenseAddress();
//@dev Error for when the swapV2 contract address is zero.
error InvalidSwapV2Address();
//@dev Error for when the HyPC contract address is zero.
error InvalidHYPCAddress();
//@dev Error for when the cHyPCV1 contract address is zero.
error InvalidCHYPCV1Address();
//@dev Error for when the startLimit amount for the constructor is outside the share number range.
error InvalidStartingLimit();

/* increaseShareLimit Errors */
//@dev Error for when trying to increase the soft share limit beyond the endShareNumber.
error ShareLimitIncreasedTooMuch();

/* createShareTokens Errors */
//@dev Error for when trying to create a share beyond the share limit.
error CantCreateSharesBeyondShareLimit();
//@dev Error for when trying to create a share without CHYPC backing (via SwapV1 or SwapV2).
error LicenseMustHaveCHYPCBacking();
//@dev Error for when trying to create a share with CHYPC level lower than license level.
error InvalidCHYPCTokenLevel();



/* unlockRevenue Errors */
//@dev Error for when trying to unlock a pending deposits before the delay time has passed.
error UnlockingRevenueTooEarly();

/* claimRevenue Errors */
//@dev Error for when trying to claim revenue for a share when you don't have any of its revenue tokens.
error NoRevenueTokensForThisShare();
//@dev Error for when trying to claim revenue when there is none to claim.
error NoRevenueToClaim();

/* transferShareOwnership Errors */
//@dev Error for when trying to transfer ownership of a share to the zero address.
error CantTransferToZeroAddress();

/* cancelShareTokens Errors */
//@dev Error for when trying to cancel a share before the MIN_DURATION time has passed.
error ShareMinDurationHasNotPassed();

/* withdrawEarnings Errors */
//@dev Error for when trying to withdraw claimed revenue when there is none in the contract.
error NothingToWithdraw();

/* burn Errors */
//@dev Error for when trying to burn revenue tokens that have unclaimed revenue
error MustClaimRevenueToBurnTokens();
//@dev Error for when trying to burn revenue tokens before a share has ended.
error ShareMustBeEnded();
//@dev Error for when trying to burn zero revenue tokens.
error MustBurnSomeRevenueTokens();
//@dev Error for when user trys to burn more revenue tokens than they own.
error NotEnoughRevenueTokensOwned();
//@dev Error for when trying to burn zero wealth tokens.
error MustBurnSomeWealthTokens();
//@dev Error for when user trys to burn more wealth tokens than they own.
error NotEnoughWealthTokensOwned();


contract HyperCycleShareTokensV2 is 
    ERC1155, ERC721Holder, Ownable, ReentrancyGuard, IHyperCycleShareTokens {

    //@dev Contract interfaces
    IHYPC private immutable hypcToken;
    ICHYPC private immutable chypcV1Contract;
    IHYPCSwapV2 private immutable swapV2Contract;
    IHyperCycleLicense private immutable licenseContract;

    // Contract constants
    //@dev The max supply to use for revenue tokens.
    uint256 public constant REVENUE_TOKEN_MAX_SUPPLY = 2**19;
    //@dev The max supply to use for wealth tokens.
    uint256 public constant WEALTH_TOKEN_MAX_SUPPLY = 2**19;
    //@dev The minimum time that has to pass before a share can be cancelled.
    uint256 public constant MIN_SHARE_DURATION = 24 hours;
    //@dev The number of decimals to use when doing revenue sharing calculations.
    uint256 public constant RATIO_DECIMALS = 10**12;

    //@dev Enum for the status of a share.
    enum Status {
        NOT_CREATED,
        STARTED,
        ENDED
    }

    //@dev Struct for data specific to a single share, accessible via the following mapping.
    struct ShareData {
        uint256 licenseId;
        uint256 chypcId;
        Status status;
        address owner;
        uint256 rTokenNumber;
        uint256 wTokenNumber;
        uint256 rTokenSupply;
        uint256 wTokenSupply;
        uint256 startTimestamp;
        uint256 revenueDeposited;
        uint256 revenueDepositDelay;
        string message;
        bool chypcTokenHeld;
    }

    //@dev Struct for storing pending share deposits
    //struct PendingDeposit {
    //    uint256 availableAtTimestamp;
    //    uint256 amount;
    //}

    // Mappings
    //@dev Main storage for individual share information
    mapping(uint256=>ShareData) public shareData;
    //@dev Storage for keeping track of the last totalRevenue a revenue token owner claimed their
    //     revenue against.
    mapping(uint256=>mapping(address=>uint256)) public lastShareClaimRevenue;
    //@dev Storage for keeping track of how much HyPC a given address can withdraw, updated by
    //     claimRevenue() calls.
    mapping(uint256=>mapping(address=>uint256)) public withdrawableAmounts;
    //@dev Helper function to get the last shareNumber to use this given licenseId NFT.
    mapping(uint256=>uint256) public licenseToShareNumber;
    //@dev Storage array for pending revenue deposits.
    mapping(uint256=> PendingDeposit[]) public pendingDeposits;

    // Variables
    //@dev The starting shareNumber to be issued.
    uint256 public startShareNumber;
    //@dev The last possible shareNumber to be issued.
    uint256 public endShareNumber;

    //@dev Soft limit for the upper value of shareNumbers. Can be increased by the owner of this
    //     contract.
    uint256 public shareLimitNumber;
    //@dev The next valid shareNumber to be issued.
    uint256 public currentShareNumber;
    //@dev The total amount of HyPC deposited so far into this contract.
    uint256 public totalDeposited;

    // Events
    // @dev   The event for when the contract owner increase the soft share limit.
    // @param amount: The amount that the soft shareNumber limit was increased by.
    event IncreaseShareLimit(uint256 amount);

    // @dev   The event for when a user creates a new share.
    // @param licenseNumber: The HyperCycleLicense NFT id used for this share.
    // @param chypcNumber: The SwapV2 cHyPC NFT id used for this share.
    // @param owner: The user that created this share.
    // @param shareNumber: The shareNumber given to this new share.
    // @param rToken: The revenue token id in this contract for this share.
    // @param wToken: The wealth token id in the contract for this share.
    // @param startTime: The timestamp for when this share was created.
    // @param startingMessage: The message assigned to this share when created.
    event CreateShare(
        uint256 licenseNumber, 
        uint256 chypcNumber,
        address owner, 
        uint256 shareNumber,
        bool chypcTokenHeld
    );

    // @dev   The event for when an owner of a share transfers it to someone else.
    // @param shareNumber: The share being transferred.
    // @param to: The address this share is being transferred to.
    event ShareOwnershipTransferred(uint256 shareNumber, address to);

    // @dev   The event for when an owner of a share changes the pending revenue delay.
    // @param shareNumber: The share to change the maximum revenue deposit of.
    // @param newDelay: The new pending revenue minimum delay, in seconds.
    event PendingRevenueDelayChange(uint256 shareNumber, uint256 newDelay);

    // @dev   The event for when revenue is deposited into a share.
    // @param shareNumber: The share receiving the revenue.
    // @param amount: The amount of HyPC being deposited.
    // @param timestamp: The time this revenue was deposited.
    event RevenueDeposited(uint256 shareNumber, uint256 amount, uint256 timestamp);
 
    // @dev   The event for when pending revenue is deposited into a share.
    // @param shareNumber: The share receiving the revenue.
    // @param amount: The amount of HyPC being deposited.
    // @param pendingUntil: The time this deposit becomes available to be claimed.
    event PendingRevenueDeposit(uint256 shareNumber, uint256 index, uint256 amount);
 
    // @dev   The event for when a share is cancelled and the NFTs returned to the owner.
    // @param shareNumber: The share being cancelled.
    // @param chypcNumber: The cHyPC NFT id being returned.
    // @param licenseNumber: The license NFT id being returned.
    event CancelledSharedTokens(uint256 shareNumber, uint256 chypcNumber, uint256 licenseNumber);

    // @dev   The event for when an address claims HyPC from deposits.
    // @param shareNumber: The share whose revenue is being withdrawn.
    // @param claimer: The address withdrawing its claimed revenue.
    // @param amount: The amount of HyPC claimed.
    event ClaimRevenue(uint256 shareNumber, address claimer, uint256 amount);
 
    // @dev   The event for when an address withdraws its claimed HyPC from deposits.
    // @param shareNumber: The share whose revenue is being withdrawn.
    // @param claimer: The address withdrawing its claimed revenue.
    // @param amount: The amount of HyPC that was withdrawn.
    event EarningsWithdrawal(uint256 shareNumber, address claimer, uint256 amount);

    // @dev   The event for when an share has its message changed.
    // @param shareNumber: The share whose message is being changed.
    // @param message: The new message
    event ShareMessageChangedTo(uint256 shareNumber, string message);
 
    // Modifiers
    // @dev   Checks if the sender is the owner of this share.
    // @param shareNumber: The share id to check.
    modifier shareOwner(uint256 shareNumber) {
        if (shareData[shareNumber].owner != msg.sender) revert MustBeShareOwner();
        _;
    }
 
    // @dev   Checks if the given share is still active.
    // @param shareNumber: The share id to check.
    modifier shareActive(uint256 shareNumber) {
        if (shareData[shareNumber].status != Status.STARTED) revert ShareMustBeActive();
        _;
    }

    // @dev   Checks if the given share was created.
    // @param shareNumber: The share id to check.
    modifier shareExists(uint256 shareNumber) {
        if (shareData[shareNumber].status == Status.NOT_CREATED) revert ShareDoesntExist();
        _;
    }

    // @dev   Checks if the given share has been ended.
    // @param shareNumber: The share id to check.
    modifier shareEnded(uint256 shareNumber) {
        if (shareData[shareNumber].status != Status.ENDED) revert ShareMustBeEnded();
        _;
    }

    // @dev   Checks if the given pending deposit exists.
    // @param shareNumber: The share to check the pending deposits of.
    // @param index: The index to check
    modifier pendingDepositExists(uint256 shareNumber, uint256 index) {
        if (index >= pendingDeposits[shareNumber].length) revert PendingDepositMustExist();
        _;
    }


    /**
        @dev   The constructor takes in the share range to use, from startNumber to endNumber
               inclusive, as well as the contract addresses for the license and cHyPC NFTs, and the
               address for the HyPC token. The revenue token Id for a share is twice its shareNumber,
               and twice the shareNumber plus one for the corresponding wealth token. To ensure no
               overlap between shareNumbers and token Ids, the endNumber must be greater than or
               equal to the startNumber and less than the startNumber times two.
        @param startNumber: The first shareNumber id to use.
        @param endNumber: The last shareNumber id to use.
        @param startLimit: The starting shareLimtt to use.
        @param licenseAddress: The license ERC721 contract address.
        @param swapV2Address: The cHyPC ERC721 contract address.
        @param hypcAddress: The HyPC ERC20 contract address.
    */
    constructor(uint256 startNumber, uint256 endNumber, uint256 startLimit, address licenseAddress,
                address chypcV1Address, address swapV2Address, address hypcAddress) ERC1155("") {
        if (endNumber >= 2**255 - 2) revert EndShareNumberWouldOverflow();
        if (endNumber/2 >= startNumber) revert InvalidShareNumberRange();
        if (endNumber < startNumber) revert InvalidShareNumberRange();
        if (licenseAddress == address(0)) revert InvalidLicenseAddress();
        if (swapV2Address == address(0)) revert InvalidSwapV2Address();
        if (hypcAddress == address(0)) revert InvalidHYPCAddress();
        if (chypcV1Address == address(0)) revert InvalidCHYPCV1Address();
        if (startLimit < startNumber || startLimit > endNumber) revert InvalidStartingLimit();

        startShareNumber = startNumber;//8590983168 = 2**33+2**20
        endShareNumber = endNumber;//8592031743 = 2**33 + 2**21 - 1

        shareLimitNumber = startLimit;
        currentShareNumber = startShareNumber;

        chypcV1Contract = ICHYPC(chypcV1Address);
        swapV2Contract = IHYPCSwapV2(swapV2Address);
        licenseContract = IHyperCycleLicense(licenseAddress);
        hypcToken = IHYPC(hypcAddress);
    }

    // @notice Allows the owner of the contract to increase the soft limit of share numbers in the
    //         contract. This is put in place to alow future upgrades of this contract to reserve
    //         higher ranges of shareNumbers, and restrict the older contract from overlapping the
    //         shareNumbers.
    // @param  number: The amount to increase the soft share limit by. 
    function increaseShareLimit(uint256 number) external onlyOwner {
        if (shareLimitNumber+number > endShareNumber) revert ShareLimitIncreasedTooMuch();

        shareLimitNumber+=number;
        emit IncreaseShareLimit({amount: number});
    }

    // @notice Allows a user to create a new share. Takes the given licenseNumber and chypcNumber NFTs
    //         and sends the wealth and revenue tokens to the owner for the corresponding created
    //         share.
    // @param  licenseNumber: The license NFT Id to deposit into this share.
    // @param  chypcNumber: The cHyPC NFT Id to deposit into this share.
    function createShareTokens(uint256 licenseNumber, uint256 chypcNumber, bool chypcTokenHeld, string memory startingMessage, uint256 revenueDepositDelay) external nonReentrant {
        if (currentShareNumber > shareLimitNumber) revert CantCreateSharesBeyondShareLimit();
        if (!chypcTokenHeld) {
            _verifyCHYPCAssignment(chypcNumber, licenseNumber);
        }
        if (_getLicenseLevel(licenseNumber) > _getCHYPCLevel(chypcNumber)) {
            revert InvalidCHYPCTokenLevel();
        }

        address to = msg.sender;

        uint256 shareNumber = currentShareNumber;
        uint256 rTokenType = shareNumber*2;
        uint256 wTokenType = shareNumber*2+1;
        uint256 licenseLevel = _getLicenseLevel(licenseNumber);

        currentShareNumber+=1;

        shareData[shareNumber] = ShareData(
            licenseNumber, 
            chypcNumber, 
            Status.STARTED, 
            to, 
            rTokenType, 
            wTokenType, 
            REVENUE_TOKEN_MAX_SUPPLY/(2**(19-licenseLevel)),
            WEALTH_TOKEN_MAX_SUPPLY/(2**(19-licenseLevel)),
            block.timestamp, 
            0,
            revenueDepositDelay,
            startingMessage,
            chypcTokenHeld
        );
        licenseToShareNumber[licenseNumber] = shareNumber;

        licenseContract.safeTransferFrom(to, address(this), licenseNumber);

        if (chypcTokenHeld) {
            swapV2Contract.safeTransferFrom(to, address(this), chypcNumber);
            swapV2Contract.assignNumber(chypcNumber, licenseNumber);
        }

        _mint(to, rTokenType, REVENUE_TOKEN_MAX_SUPPLY/(2**(19-licenseLevel)), "");
        _mint(to, wTokenType, WEALTH_TOKEN_MAX_SUPPLY/(2**(19-licenseLevel)), ""); 
       
        emit CreateShare({licenseNumber: licenseNumber, 
            chypcNumber: chypcNumber, 
            owner: to, 
            shareNumber: shareNumber, 
            chypcTokenHeld: chypcTokenHeld
        });
    }

    // @notice An internal function to check the backing of the license from the given
    //         chypcNumber. This checks assignments via the SwapV2 contract first, and
    //         then the SwapV1 contract.
    // @param  chypcNumber: The cHyPC NFT Id pointing to the licenseNumber.
    // @param  licenseNumber: The license NFT Id to deposit into this share.
    function _verifyCHYPCAssignment(uint256 chypcNumber, uint256 licenseNumber) internal {
        string memory stringAssigned = Strings.toString(licenseNumber);
        if (swapV2Contract.getAssignmentNumber(chypcNumber) != licenseNumber && 
            !Strings.equal(swapV2Contract.getAssignmentString(chypcNumber), stringAssigned) && 
            !Strings.equal(chypcV1Contract.getAssignment(chypcNumber), stringAssigned)) {
            revert LicenseMustHaveCHYPCBacking();
        }
    }

    // @notice An internal function to return the license level of a license token.
    // @param  licenseNumber: The license NFT id.
    function _getLicenseLevel(uint256 licenseNumber) internal returns (uint256) {
        return licenseContract.getLicenseHeight(licenseNumber);
    }

    // @notice An internal function to return the chypc level of a chypc token.
    // @param  chypcNumber: The chypc NFT id (V1 or V2) to check.
    function _getCHYPCLevel(uint256 chypcNumber) internal returns (uint256) {
        //@dev SwapV2 token
        try swapV2Contract.getTokenLevel(chypcNumber) returns (uint256) {
            return swapV2Contract.getTokenLevel(chypcNumber);
        } catch {}

        //@dev SwapV1 token
        if (chypcNumber >= 67108864 && chypcNumber < 67108864+160) {
            return 19;
        }
        return 0;
    }

    // @notice Transfers the ownership of a share to another address. Useful for transferring from an
    //         existing multi-sig or manager contract to another one.
    // @param  shareNumber: The share to transfer to a new owner
    // @parma  to: The new owner of this share.
    function transferShareOwnership(uint256 shareNumber, address to) external shareOwner(shareNumber) shareActive(shareNumber) {
        if (to == address(0)) revert CantTransferToZeroAddress();
        shareData[shareNumber].owner = to;
        emit ShareOwnershipTransferred({shareNumber: shareNumber, to: to});
    }

    // @notice Changes the maximum allowed revenue deposit.
    // @param  shareNumber: The share to change the maximum revenue deposit of.
    // @param  newDelay: The new delay to wait for in seconds.
    function changePendingRevenueDelay(uint256 shareNumber, uint256 newDelay) external shareOwner(shareNumber) shareActive(shareNumber) {
        shareData[shareNumber].revenueDepositDelay = newDelay;
        emit PendingRevenueDelayChange({shareNumber: shareNumber, newDelay: newDelay});
    }

    // @notice Cancels a given share and returns the deposited license and cHyPC NFTs to the owner.
    //         Once cancelled, no more revenue can be deposited to this share, but existing owners
    //         of revenue tokens can still claim any deposited HyPC they previously didn't claim.
    // @param  shareNumber: The share to cancel.
    function cancelShareTokens(uint256 shareNumber) external shareOwner(shareNumber) shareActive(shareNumber) nonReentrant {
        if (shareData[shareNumber].startTimestamp + MIN_SHARE_DURATION > block.timestamp) revert ShareMinDurationHasNotPassed();

        uint256 licenseNumber = shareData[shareNumber].licenseId;
        uint256 chypcNumber = shareData[shareNumber].chypcId;
        bool chypcTokenHeld = shareData[shareNumber].chypcTokenHeld;
        shareData[shareNumber].status = Status.ENDED;
        delete licenseToShareNumber[licenseNumber];

        if (chypcTokenHeld) {
            swapV2Contract.assignNumber(chypcNumber, 0);
            swapV2Contract.safeTransferFrom(address(this), msg.sender, chypcNumber);
        }
        licenseContract.safeTransferFrom(address(this), msg.sender, licenseNumber);      
        emit CancelledSharedTokens({
            shareNumber: shareNumber, 
            chypcNumber: chypcNumber, 
            licenseNumber: licenseNumber
        });
    }
   
    // @notice Sets the stored message for this share.
    // @param  shareNumber: The share to set the message of.
    // @param  message: The message to set for this share.
    function setShareMessage(uint256 shareNumber, string memory message) external shareOwner(shareNumber) shareActive(shareNumber) {
        shareData[shareNumber].message = message;
        emit ShareMessageChangedTo({shareNumber: shareNumber, message: message});
    }

    /* Revenue sharing functions */
    // @notice Deposits revenue into a share. It remains locked until it is later released.
    // @param  shareNumber: The share this revenue is deposited for.
    // @param  amt: The amount of HyPC being deposited.
    function depositRevenue(uint256 shareNumber, uint256 amt) external shareActive(shareNumber) {
        pendingDeposits[shareNumber].push(
            PendingDeposit({
                availableAtTimestamp: block.timestamp+shareData[shareNumber].revenueDepositDelay,
                amount: amt
            })
        );
        hypcToken.transferFrom(msg.sender, address(this), amt);
        emit PendingRevenueDeposit({
            shareNumber: shareNumber, 
            index: pendingDeposits[shareNumber].length-1, 
            amount: amt
        });
    }

    // @notice Unlocks a pending revenue deposit to be claimable by the rToken holders
    // @param shareNumber: The share this revenue is being unlocked for.
    // @param index: The index of the pending deposit to unlock.
    function unlockRevenue(uint256 shareNumber, uint256 index) external pendingDepositExists(shareNumber, index) {
        PendingDeposit memory pd = pendingDeposits[shareNumber][index];
        if (pd.availableAtTimestamp > block.timestamp) {
            revert UnlockingRevenueTooEarly();
        }
        totalDeposited += pd.amount;
        shareData[shareNumber].revenueDeposited += pd.amount;

        //Remove old index now;
        if (pendingDeposits[shareNumber].length > 1 && index < pendingDeposits[shareNumber].length -1 ) {
            pendingDeposits[shareNumber][index] = pendingDeposits[shareNumber][pendingDeposits[shareNumber].length -1];
        }
        pendingDeposits[shareNumber].pop();

        emit RevenueDeposited({
            shareNumber: shareNumber, 
            amount: pd.amount,
            timestamp: block.timestamp
        });
    }

    // @notice Internal function for claiming revenue share of a token. This is called whenever a
    //         revenue token holder wants to claim their propotional revenue in this contract. This
    //         is also called whenever a user transfers revenue tokens to another user as mentioned
    //         in the contract description above.
    // @param  shareNumber: The share to claim revenue for.
    // @param  claimerAddress: The address claiming their revenue.
    function _claimRevenue(uint256 shareNumber, address claimerAddress) internal returns (uint256) {
        uint256 rTokenNumber = shareData[shareNumber].rTokenNumber;
        uint256 revenueDeposited = shareData[shareNumber].revenueDeposited;
        uint256 licenseLevel = _getLicenseLevel(shareData[shareNumber].licenseId);
        uint256 rTokenStartingSupply = REVENUE_TOKEN_MAX_SUPPLY/(2**(19-licenseLevel));

        uint256 ownershipRatio = RATIO_DECIMALS*balanceOf(claimerAddress, rTokenNumber)/rTokenStartingSupply;

        uint256 amountToGiveAddress = (revenueDeposited-lastShareClaimRevenue[shareNumber][claimerAddress])*ownershipRatio/RATIO_DECIMALS;
        lastShareClaimRevenue[shareNumber][claimerAddress] = revenueDeposited;
        withdrawableAmounts[shareNumber][claimerAddress] += amountToGiveAddress;
        emit ClaimRevenue(shareNumber, claimerAddress, amountToGiveAddress);
        return amountToGiveAddress;
    }

    // @notice External function for _claimRevenue for when a user wants to explictly claim their
    //         revenue for a given share (without any revenue token transfer).
    // @param  shareNumber: The share to claim the revenue of.
    function claimRevenue(uint256 shareNumber) external shareExists(shareNumber) {
        if (balanceOf(msg.sender, shareData[shareNumber].rTokenNumber) == 0) revert NoRevenueTokensForThisShare();
        if (_claimRevenue(shareNumber, msg.sender) == 0) revert NoRevenueToClaim();
    }

    // @notice Internal function for withdrawEarnings, which withdraws HyPC from the share.
    // @param  shareNumber: The share to withdraw from.
    function _withdrawEarnings(uint256 shareNumber) internal shareExists(shareNumber) {
        uint256 amt = withdrawableAmounts[shareNumber][msg.sender];
        if (amt == 0) revert NothingToWithdraw();
        withdrawableAmounts[shareNumber][msg.sender] = 0;
        hypcToken.transfer(msg.sender, amt);
        emit EarningsWithdrawal({
            shareNumber: shareNumber,
            claimer: msg.sender,
            amount: amt
        });
    }

    // @notice Withdraws claimed revenue for this user, if there is any.
    // @param  shareNumber: The share to withdraw revenue from.
    function withdrawEarnings(uint256 shareNumber) external {
        _withdrawEarnings(shareNumber);
    }

    // @notice Utility function to claim and withdraw from a share.
    // @param  shareNumber: The share to claim and withdraw revenue from.
    function claimAndWithdraw(uint256 shareNumber) external {
        if (balanceOf(msg.sender, shareData[shareNumber].rTokenNumber) == 0) revert NoRevenueTokensForThisShare();
        if (_claimRevenue(shareNumber, msg.sender) == 0) revert NoRevenueToClaim();
        _withdrawEarnings(shareNumber);
    }

    // @notice Allows a user to burn revenue tokens from an ended share.
    // @param  shareNumber: The share to burn revenue tokens from.
    // @param  amount: The amount of revenue tokens to burn.
    function burnRevenueTokens(uint256 shareNumber, uint256 amount) external shareEnded(shareNumber) {
        if (_claimRevenue(shareNumber, msg.sender) > 0) revert MustClaimRevenueToBurnTokens();
        if (amount == 0) revert MustBurnSomeRevenueTokens();
        if (balanceOf(msg.sender, shareData[shareNumber].rTokenNumber) < amount) revert NotEnoughRevenueTokensOwned();
        shareData[shareNumber].rTokenSupply -= amount;
        _burn(msg.sender, shareData[shareNumber].rTokenNumber, amount);
    }

    // @notice Allows a user to burn wealth tokens from an ended share.
    // @param  shareNumber: The share to burn wealth tokens from.
    // @param  amount: The amount of wealth tokens to burn.
    function burnWealthTokens(uint256 shareNumber, uint256 amount) external shareOwner(shareNumber) shareEnded(shareNumber) {
        if (amount == 0) revert MustBurnSomeWealthTokens();
        if (balanceOf(msg.sender, shareData[shareNumber].wTokenNumber) < amount) revert NotEnoughWealthTokensOwned();
        shareData[shareNumber].wTokenSupply -= amount;
    }

    /* Getters */
    // @notice Returns the license NFT Id for a share.
    // @param  shareNumber: The share to get the license Id of.
    // @return licenseId: The license NFT Id.
    function getShareLicenseId(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].licenseId;
    }

    // @notice Returns the cHypC NFT Id for a share.
    // @param  shareNumber: The share to get the cHyPC Id of.
    // @return chypcId: The cHyPC NFT Id.
    function getShareCHyPCId(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].chypcId;
    }

    // @notice Returns the owner of a share.
    // @param  shareNumber: The share to get the owner of.
    // @return owner: The owner address.
    function getShareOwner(uint256 shareNumber) external view returns (address) {
        return shareData[shareNumber].owner;
    }

    // @notice Returns the revenue token Id for a share.
    // @param  shareNumber: The share to get the revenue token Id of.
    // @return rTokenNumber: The revenue token Id.
    function getShareRevenueTokenId(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].rTokenNumber;
    }

    // @notice Returns the wealth token Id for a share.
    // @param  shareNumber: The share to get the wealth token Id of.
    // @return wTokenNumber: The wealth token Id.
    function getShareWealthTokenId(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].wTokenNumber;
    }

    // @notice Returns the total revenue obtained for a share.
    // @param  shareNumber: The share to get the total revenue of.
    // @return revenueDeposited: The total revenue deposited for this share.
    function getShareTotalRevenue(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].revenueDeposited;
    }

    // @notice Returns the start time of a share.
    // @param  shareNumber: The share to get the start time of.
    // @return startTimestamp: The block timestamp when this share was created.
    function getShareStartTime(uint256 shareNumber) external view returns (uint256) {
        return shareData[shareNumber].startTimestamp;
    }

    // @notice Returns the message for a share.
    // @param  shareNumber: The share to get the message of.
    // @return message: The message that was set for this share.
    function getShareMessage(uint256 shareNumber) external view returns (string memory) {
        return shareData[shareNumber].message;
    }

    // @notice Returns whether the given share is active.
    // @param  shareNumber: The share to get the status of.
    // @return active: Returns true if the share is active, otherwise false.
    function isShareActive(uint256 shareNumber) external view returns (bool) {
        return shareData[shareNumber].status == Status.STARTED;
    }

    // @notice Returns whether the given share was created yet or not.
    // @param  shareNumber: The share to get the created status of.
    // @return active: Returns true if the share was created, otherwise false.
    function shareCreated(uint256 shareNumber) external view returns (bool) {
        return shareData[shareNumber].status != Status.NOT_CREATED;
    }

    // @notice Returns the total supply of revenue tokens for a share.
    // @param  shareNumber: The share to get the total supply of revenue tokens.
    function getRevenueTokenTotalSupply(uint256 shareNumber) external shareExists(shareNumber) view returns (uint256) {
        return shareData[shareNumber].rTokenSupply;
    }

    // @notice Returns the total supply of wealth tokens for a share.
    // @param  shareNumber: The share to get the total supply of wealth tokens.
    function getWealthTokenTotalSupply(uint256 shareNumber) external shareExists(shareNumber) view returns (uint256) {
        return shareData[shareNumber].wTokenSupply;
    }

    // @notice Returns the pending deposit at the given index.
    // @param  shareNumber: The share to get the pending deposit of.
    // @param  index: The index to look up.
    function getPendingDeposit(uint256 shareNumber, uint256 index) external pendingDepositExists(shareNumber, index) view returns (PendingDeposit memory) {
        return pendingDeposits[shareNumber][index];
    }

    // @notice Returns the length of the pending deposits array for this shareNumber.
    // @param  shareNumber: The share to look up.
    function getPendingDepositsLength(uint256 shareNumber) external shareExists(shareNumber) view returns (uint256) {
        return pendingDeposits[shareNumber].length;
    }

    /* ERC1155 Overrides */

    // @notice Override hooks into the transfer functions of the ERC1155 contract for revenue 
    //         claiming. This allows ERC20-like tokens to be used for revenue sharing purposes.
    //         See ERC1155 contract for details on parameters.
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public override(ERC1155, IERC1155) {
        //@dev If this is a revenue sharing token, then update the claimed revenue before transfering
        if (id % 2 == 0) {   
            uint256 shareNumber = id/2;
            if (shareData[shareNumber].status == Status.NOT_CREATED) revert ShareDoesntExist();
            _claimRevenue(shareNumber, from);
            _claimRevenue(shareNumber, to);
        }
        super.safeTransferFrom(from, to, id, value, data);  
    }

    // @notice Override hooks into the batch transfer functions of the ERC1155 contract for revenue 
    //         claiming. This allows ERC20-like tokens to be used for revenue sharing purposes.
    //         See ERC1155 contract for details on parameters.
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) public override(ERC1155, IERC1155) {
        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            if (id % 2 == 0) {   
                uint256 shareNumber = id/2;
                if (shareData[shareNumber].status == Status.NOT_CREATED) revert ShareDoesntExist();
                _claimRevenue(shareNumber, from);
                _claimRevenue(shareNumber, to);
            }
        }
        super.safeBatchTransferFrom(from, to, ids, values, data);
    }
}

File 2 of 24 : 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 24 : 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 24 : 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 24 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    ) public view virtual override returns (uint256[] memory) {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address from, uint256 id, uint256 amount) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @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, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 6 of 24 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 7 of 24 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

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

pragma solidity ^0.8.0;

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

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

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

File 9 of 24 : 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 10 of 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : ICHYPC.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/// @notice Interface for the CHYPC.sol contract.
interface ICHYPC is IERC721 {
    /**
     * Accesses the assignment function of c_HyPC so the swap can remove 
     * the assignment data when a token is redeemed or swapped.
     */
    /// @notice Assigns a string to the given c_HyPC token.
    function assign(
        uint256 tokenId,
        string memory data
    ) external;

    /// @notice Returns the assigned string for this token.
    function getAssignment(
        uint256 tokenId
    ) external view  returns (string memory);
}

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

File 23 of 24 : IHyperCycleLicense.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/// @notice Interface for the CHYPC.sol contract.
interface IHyperCycleLicense is IERC721 {
    /**
     * Accesses the assignment function of c_HyPC so the swap can remove 
     * the assignment data when a token is redeemed or swapped.
     */
    /// @notice Creates a new root token inside this contract, with a specified licenseID.
    function mint(
        uint256 numTokens
    ) external;

    /// @notice Splits a given token into two new tokens, with corresponding licenseID's.
    function split(
        uint256 tokenId
    ) external;

    /// @notice Burns a given tokenId with a specified burn string.
    function burn(
        uint256 tokenId,
        string memory burnString          
    ) external;

    /// @notice Merges together two child licenses into a parent license.
    function merge(
        uint256 tokenId
    ) external;

    /// @notice Returns the burn data from the given tokenId.
    function getBurnData(
        uint256 tokenId
    ) external view returns (string memory);

    /// @notice Returns the license height of the given tokenId.
    function getLicenseHeight(
        uint256 licenseId
    ) external view returns (uint8);

    /// @notice Returns the license height of the given tokenId.
    function getLicenseStatus(
        uint256 licenseId
    ) external view returns (uint256);
}

File 24 of 24 : IHyperCycleShareTokens.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

/// @notice Interface for the HyperCycleShareTokens.sol contract.
interface IHyperCycleShareTokens is IERC1155 {

    struct PendingDeposit {
        uint256 availableAtTimestamp;
        uint256 amount;
    }

    function increaseShareLimit(uint256 number) external;

    function createShareTokens(uint256 licenseNumber, uint256 chypcNumber, bool chypcTokenHeld, string memory startingMessage, uint256 maxRevenueDeposit) external;

    function transferShareOwnership(uint256 shareNumber, address to) external;


    function cancelShareTokens(uint256 shareNumber) external;

    function depositRevenue(uint256 shareNumber, uint256 amt) external;

    function claimRevenue(uint256 shareNumber) external;

    function withdrawEarnings(uint256 shareNumber) external;

    function setShareMessage(uint256 shareNumber, string memory message) external;

    function burnRevenueTokens(uint256 shareNumber, uint256 amount) external;
    
    function burnWealthTokens(uint256 shareNumber, uint256 amount) external;

    function getShareLicenseId(uint256 shareNumber) external view returns (uint256);
    function getShareCHyPCId(uint256 shareNumber) external view returns (uint256);
    function getShareOwner(uint256 shareNumber) external view returns (address);
    function getShareRevenueTokenId(uint256 shareNumber) external view returns (uint256);
    function getShareWealthTokenId(uint256 shareNumber) external view returns (uint256);
    function getShareTotalRevenue(uint256 shareNumber) external view returns (uint256);
    function getShareStartTime(uint256 shareNumber) external view returns (uint256);
    function getShareMessage(uint256 shareNumber) external view returns (string memory);
    function isShareActive(uint256 shareNumber) external view returns (bool);
    function shareCreated(uint256 shareNumber) external view returns (bool);
    function getRevenueTokenTotalSupply(uint256 shareNumber) external view returns (uint256);
    function getWealthTokenTotalSupply(uint256 shareNumber) external view returns (uint256);
    function getPendingDeposit(uint256 shareNumber, uint256 index) external view returns (PendingDeposit memory);
    function getPendingDepositsLength(uint256 shareNumber) 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":"uint256","name":"startNumber","type":"uint256"},{"internalType":"uint256","name":"endNumber","type":"uint256"},{"internalType":"uint256","name":"startLimit","type":"uint256"},{"internalType":"address","name":"licenseAddress","type":"address"},{"internalType":"address","name":"chypcV1Address","type":"address"},{"internalType":"address","name":"swapV2Address","type":"address"},{"internalType":"address","name":"hypcAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CantCreateSharesBeyondShareLimit","type":"error"},{"inputs":[],"name":"CantTransferToZeroAddress","type":"error"},{"inputs":[],"name":"EndShareNumberWouldOverflow","type":"error"},{"inputs":[],"name":"InvalidCHYPCTokenLevel","type":"error"},{"inputs":[],"name":"InvalidCHYPCV1Address","type":"error"},{"inputs":[],"name":"InvalidHYPCAddress","type":"error"},{"inputs":[],"name":"InvalidLicenseAddress","type":"error"},{"inputs":[],"name":"InvalidShareNumberRange","type":"error"},{"inputs":[],"name":"InvalidStartingLimit","type":"error"},{"inputs":[],"name":"InvalidSwapV2Address","type":"error"},{"inputs":[],"name":"LicenseMustHaveCHYPCBacking","type":"error"},{"inputs":[],"name":"MustBeShareOwner","type":"error"},{"inputs":[],"name":"MustBurnSomeRevenueTokens","type":"error"},{"inputs":[],"name":"MustBurnSomeWealthTokens","type":"error"},{"inputs":[],"name":"MustClaimRevenueToBurnTokens","type":"error"},{"inputs":[],"name":"NoRevenueToClaim","type":"error"},{"inputs":[],"name":"NoRevenueTokensForThisShare","type":"error"},{"inputs":[],"name":"NotEnoughRevenueTokensOwned","type":"error"},{"inputs":[],"name":"NotEnoughWealthTokensOwned","type":"error"},{"inputs":[],"name":"NothingToWithdraw","type":"error"},{"inputs":[],"name":"PendingDepositMustExist","type":"error"},{"inputs":[],"name":"ShareDoesntExist","type":"error"},{"inputs":[],"name":"ShareLimitIncreasedTooMuch","type":"error"},{"inputs":[],"name":"ShareMinDurationHasNotPassed","type":"error"},{"inputs":[],"name":"ShareMustBeActive","type":"error"},{"inputs":[],"name":"ShareMustBeEnded","type":"error"},{"inputs":[],"name":"UnlockingRevenueTooEarly","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chypcNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"licenseNumber","type":"uint256"}],"name":"CancelledSharedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimRevenue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"licenseNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chypcNumber","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"bool","name":"chypcTokenHeld","type":"bool"}],"name":"CreateShare","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EarningsWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"IncreaseShareLimit","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":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDelay","type":"uint256"}],"name":"PendingRevenueDelayChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PendingRevenueDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RevenueDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"ShareMessageChangedTo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"shareNumber","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"ShareOwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"MIN_SHARE_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATIO_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVENUE_TOKEN_MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEALTH_TOKEN_MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnRevenueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnWealthTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"cancelShareTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"newDelay","type":"uint256"}],"name":"changePendingRevenueDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"claimAndWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"claimRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"licenseNumber","type":"uint256"},{"internalType":"uint256","name":"chypcNumber","type":"uint256"},{"internalType":"bool","name":"chypcTokenHeld","type":"bool"},{"internalType":"string","name":"startingMessage","type":"string"},{"internalType":"uint256","name":"revenueDepositDelay","type":"uint256"}],"name":"createShareTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentShareNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"depositRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endShareNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getPendingDeposit","outputs":[{"components":[{"internalType":"uint256","name":"availableAtTimestamp","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IHyperCycleShareTokens.PendingDeposit","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getPendingDepositsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getRevenueTokenTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareCHyPCId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareLicenseId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareMessage","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareRevenueTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareTotalRevenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getShareWealthTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"getWealthTokenTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"number","type":"uint256"}],"name":"increaseShareLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"isShareActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"lastShareClaimRevenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"licenseToShareNumber","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":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingDeposits","outputs":[{"internalType":"uint256","name":"availableAtTimestamp","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","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":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","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":"shareNumber","type":"uint256"},{"internalType":"string","name":"message","type":"string"}],"name":"setShareMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"shareCreated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"shareData","outputs":[{"internalType":"uint256","name":"licenseId","type":"uint256"},{"internalType":"uint256","name":"chypcId","type":"uint256"},{"internalType":"enum HyperCycleShareTokensV2.Status","name":"status","type":"uint8"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"rTokenNumber","type":"uint256"},{"internalType":"uint256","name":"wTokenNumber","type":"uint256"},{"internalType":"uint256","name":"rTokenSupply","type":"uint256"},{"internalType":"uint256","name":"wTokenSupply","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"revenueDeposited","type":"uint256"},{"internalType":"uint256","name":"revenueDepositDelay","type":"uint256"},{"internalType":"string","name":"message","type":"string"},{"internalType":"bool","name":"chypcTokenHeld","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shareLimitNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startShareNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"transferShareOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"unlockRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareNumber","type":"uint256"}],"name":"withdrawEarnings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"withdrawableAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101006040523480156200001257600080fd5b50604051620047d9380380620047d983398101604081905262000035916200025f565b6040805160208101909152600081526200004f81620001de565b506200005b33620001f0565b60016004556002600160ff1b038610620000885760405163136bb8a560e01b815260040160405180910390fd5b8662000096600288620002d9565b10620000b55760405163135abbd360e01b815260040160405180910390fd5b86861015620000d75760405163135abbd360e01b815260040160405180910390fd5b6001600160a01b038416620000ff576040516373cfb64f60e11b815260040160405180910390fd5b6001600160a01b0382166200012757604051633f60e15960e21b815260040160405180910390fd5b6001600160a01b0381166200014f57604051632a40136360e01b815260040160405180910390fd5b6001600160a01b0383166200017757604051632df1ad8d60e21b815260040160405180910390fd5b868510806200018557508585115b15620001a457604051630b85b2a360e31b815260040160405180910390fd5b600a879055600b95909555600c93909355600d949094556001600160a01b0393841660a05290831660c052821660e052166080526200046d565b6002620001ec8282620003a1565b5050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200025a57600080fd5b919050565b600080600080600080600060e0888a0312156200027b57600080fd5b8751965060208801519550604088015194506200029b6060890162000242565b9350620002ab6080890162000242565b9250620002bb60a0890162000242565b9150620002cb60c0890162000242565b905092959891949750929550565b600082620002f757634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620002fc565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516142ec620004ed60003960008181610da10152818161110201526125f6015260008181610ca301528181610d1c0152818161119201528181611218015281816123010152818161238f015281816124b10152612537015260006124410152600081816109f80152612a5701526142ec6000f3fe608060405234801561001057600080fd5b50600436106103265760003560e01c8063637c77f1116101b85780639d18e54211610104578063f242432a116100a2578063f62b46c91161007c578063f62b46c914610812578063f7ce46b714610825578063fc247f5214610838578063ff50abdc1461084b57600080fd5b8063f242432a146107c4578063f2fde38b146107d7578063f458f568146107ea57600080fd5b8063a83622e0116100de578063a83622e014610746578063c4fd622414610752578063d04720cd14610775578063e985e9c51461078857600080fd5b80639d18e542146106fd578063a22cb46514610710578063a266bcf21461072357600080fd5b806380a62256116101715780638a82f2401161014b5780638a82f2401461069b5780638da5cb5b146106c65780639732d56f146106d75780639c50ff74146106ea57600080fd5b806380a622561461067657806381e0aaa41461067f5780638792290e1461068857600080fd5b8063637c77f1146106095780636da58de31461062c5780636e70096e146106355780636f7286c21461064857806370b394a61461065b578063715018a61461066e57600080fd5b806337a8dd981161027757806352aa9932116102305780635b5bc9431161020a5780635b5bc943146105a55780635c3db6e2146105ae5780635d2938b4146105b857806362d28bfd146105db57600080fd5b806352aa99321461054757806352f66b841461057257806359a6b0361461058557600080fd5b806337a8dd98146104b2578063389fe464146104955780633a340c92146104c557806347e154e2146104d85780634c106406146105045780634e1273f41461052757600080fd5b8063150b7a02116102e45780631aeb776c116102be5780631aeb776c1461046f5780631cb536ed146104825780632916b8b3146104955780632eb2c2d61461049f57600080fd5b8063150b7a02146103dc578063160e553614610413578063181965971461042657600080fd5b8062fdd58e1461032b57806301ffc9a7146103515780630269c589146103745780630cae7afc146103945780630e89341c146103a957806314443549146103c9575b600080fd5b61033e6103393660046134e3565b610854565b6040519081526020015b60405180910390f35b61036461035f366004613523565b6108ed565b6040519015158152602001610348565b61033e610382366004613540565b60086020526000908152604090205481565b6103a76103a2366004613559565b61093d565b005b6103bc6103b7366004613540565b610ad9565b60405161034891906135cb565b6103a76103d7366004613540565b610b6d565b6103fa6103ea3660046136a3565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610348565b6103bc610421366004613540565b610e60565b610457610434366004613540565b60009081526005602052604090206002015461010090046001600160a01b031690565b6040516001600160a01b039091168152602001610348565b6103a761047d366004613718565b610e80565b6103a7610490366004613540565b611339565b61033e6208000081565b6103a76104ad366004613816565b6113eb565b6103a76104c0366004613540565b6114b5565b6103a76104d33660046138bf565b61153a565b6104eb6104e6366004613540565b61161e565b6040516103489d9c9b9a9998979695949392919061391b565b61033e610512366004613540565b60009081526005602052604090206008015490565b61053a6105353660046139c6565b611716565b6040516103489190613ac1565b61033e610555366004613ad4565b600760209081526000928352604080842090915290825290205481565b61033e610580366004613540565b61183f565b61033e610593366004613540565b60009081526005602052604090205490565b61033e600b5481565b61033e6201518081565b61033e6105c6366004613540565b60009081526005602052604090206007015490565b6105ee6105e9366004613559565b6118a3565b60408051825181526020928301519281019290925201610348565b61033e610617366004613540565b60009081526005602052604090206001015490565b61033e600d5481565b6103a7610643366004613540565b61193f565b610364610656366004613540565b61194b565b6103a7610669366004613559565b61197d565b6103a7611a93565b61033e600a5481565b61033e600c5481565b6103a7610696366004613559565b611aa7565b61033e6106a9366004613ad4565b600660209081526000928352604080842090915290825290205481565b6003546001600160a01b0316610457565b6103a76106e5366004613ad4565b611cd8565b61033e6106f8366004613540565b611df2565b61036461070b366004613540565b611e53565b6103a761071e366004613b00565b611e85565b61033e610731366004613540565b60009081526005602052604090206003015490565b61033e64e8d4a5100081565b61033e610760366004613540565b60009081526005602052604090206004015490565b6103a7610783366004613559565b611e90565b610364610796366004613b37565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6103a76107d2366004613b61565b611fa4565b6103a76107e5366004613bc5565b612030565b6107fd6107f8366004613559565b6120a6565b60408051928352602083019190915201610348565b6103a7610820366004613540565b6120e2565b6103a7610833366004613559565b612149565b61033e610846366004613540565b61221d565b61033e600e5481565b60006001600160a01b0383166108c45760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061091e57506001600160e01b031982166303a24d0760e21b145b806108e757506301ffc9a760e01b6001600160e01b03198316146108e7565b816001600082815260056020526040902060029081015460ff169081111561096757610967613905565b14610985576040516324ca9b7560e11b815260040160405180910390fd5b600083815260096020818152604080842081518083018352600590935293209091015481906109b49042613bf6565b8152602090810185905282546001818101855560009485529382902083516002909202019081559101519101556040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90610a3190339030908790600401613c09565b6020604051808303816000875af1158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a749190613c2d565b506000838152600960205260409020547f8d3add996cf7244e1103c44d6abcc43c1fd55a709738ae15dbe04e8a33c58eaa908490610ab490600190613c4a565b60408051928352602083019190915281018490526060015b60405180910390a1505050565b606060028054610ae890613c5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1490613c5d565b8015610b615780601f10610b3657610100808354040283529160200191610b61565b820191906000526020600020905b815481529060010190602001808311610b4457829003601f168201915b50505050509050919050565b600081815260056020526040902060020154819061010090046001600160a01b03163314610bae5760405163e2b2255d60e01b815260040160405180910390fd5b816001600082815260056020526040902060029081015460ff1690811115610bd857610bd8613905565b14610bf6576040516324ca9b7560e11b815260040160405180910390fd5b610bfe61227a565b6000838152600560205260409020600701544290610c20906201518090613bf6565b1115610c3f5760405163db34e39960e01b815260040160405180910390fd5b600083815260056020908152604080832080546001820154600b8301546002938401805460ff19169094179093558186526008909452918420939093559160ff168015610d8a5760405163f682c34960e01b815260048101839052600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f682c34990604401600060405180830381600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b5050604051632142170760e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692506342842e0e9150610d5790309033908790600401613c09565b600060405180830381600087803b158015610d7157600080fd5b505af1158015610d85573d6000803e3d6000fd5b505050505b604051632142170760e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90610dda90309033908890600401613c09565b600060405180830381600087803b158015610df457600080fd5b505af1158015610e08573d6000803e3d6000fd5b505060408051898152602081018690529081018690527fee9fe7deda64d74e417c336ae700a03e73fdf6bc96cb92c7187a3b1fe76e05109250606001905060405180910390a1505050610e5b6001600455565b505050565b6000818152600560205260409020600a01805460609190610ae890613c5d565b610e8861227a565b600c54600d541115610ead57604051634171432d60e11b815260040160405180910390fd5b82610ebc57610ebc84866122d3565b610ec584612498565b610ece866125dd565b1115610eed57604051631b74b8cf60e31b815260040160405180910390fd5b600d5433906000610eff826002613c91565b90506000610f0e836002613c91565b610f19906001613bf6565b90506000610f268a6125dd565b90506001600d6000828254610f3b9190613bf6565b9091555050604080516101a0810182528b8152602081018b905290810160018152602001866001600160a01b03168152602001848152602001838152602001826013610f879190613c4a565b610f92906002613d8c565b610f9f9062080000613dae565b8152602001610faf836013613c4a565b610fba906002613d8c565b610fc79062080000613dae565b81526020014281526020016000815260200187815260200188815260200189151581525060056000868152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083600281111561103c5761103c613905565b02179055506060820151600282018054610100600160a81b0319166101006001600160a01b0390931683021790556080830151600383015560a0830151600483015560c0830151600583015560e08301516006830155820151600782015561012082015160088201556101408201516009820155610160820151600a8201906110c59082613e08565b506101809190910151600b909101805460ff191691151591909117905560008a8152600860205260409081902085905551632142170760e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342842e0e9061114390889030908f90600401613c09565b600060405180830381600087803b15801561115d57600080fd5b505af1158015611171573d6000803e3d6000fd5b50505050871561127f57604051632142170760e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342842e0e906111cb90889030908e90600401613c09565b600060405180830381600087803b1580156111e557600080fd5b505af11580156111f9573d6000803e3d6000fd5b505060405163f682c34960e01b8152600481018c9052602481018d90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316925063f682c3499150604401600060405180830381600087803b15801561126657600080fd5b505af115801561127a573d6000803e3d6000fd5b505050505b6112bc858461128f846013613c4a565b61129a906002613d8c565b6112a79062080000613dae565b60405180602001604052806000815250612672565b6112cc858361128f846013613c4a565b604080518b8152602081018b90526001600160a01b0387168183015260608101869052891515608082015290517fb80ad1ed7f488a2ff9837465e2694eafd9981e90b78b920e83b8adedf9217b5e9181900360a00190a150505050506113326001600455565b5050505050565b8060008082815260056020526040902060029081015460ff169081111561136257611362613905565b0361138057604051631aa7900f60e21b815260040160405180910390fd5b60008281526005602052604090206003015461139d903390610854565b6000036113bd57604051632032648b60e01b815260040160405180910390fd5b6113c78233612786565b6000036113e7576040516374d4d10160e11b815260040160405180910390fd5b5050565b60005b83518110156114a757600084828151811061140b5761140b613ec7565b602002602001015190506002816114229190613edd565b600003611496576000611436600283613dae565b905060008082815260056020526040902060029081015460ff169081111561146057611460613905565b0361147e57604051631aa7900f60e21b815260040160405180910390fd5b6114888189612786565b506114938188612786565b50505b506114a081613ef1565b90506113ee565b5061133285858585856128f3565b6114bd612938565b600b5481600c546114ce9190613bf6565b11156114ed57604051639b5abc5160e01b815260040160405180910390fd5b80600c60008282546114ff9190613bf6565b90915550506040518181527f1b735d12f447802826825c2519a6c37142c4d6a71ed6e0f5d30b447e11359ad89060200160405180910390a150565b600082815260056020526040902060020154829061010090046001600160a01b0316331461157b5760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff16908111156115a5576115a5613905565b146115c3576040516324ca9b7560e11b815260040160405180910390fd5b6000848152600560205260409020600a016115de8482613e08565b507f4e0214d0995fefc26259a79ffd8f6a4c93a350ed9109ae3bc693237722b115898484604051611610929190613f0a565b60405180910390a150505050565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009890154600a8a018054999b989a60ff89169a6101009099046001600160a01b031699979890919061168a90613c5d565b80601f01602080910402602001604051908101604052809291908181526020018280546116b690613c5d565b80156117035780601f106116d857610100808354040283529160200191611703565b820191906000526020600020905b8154815290600101906020018083116116e657829003601f168201915b505050600b909301549192505060ff168d565b6060815183511461177b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016108bb565b600083516001600160401b03811115611796576117966135de565b6040519080825280602002602001820160405280156117bf578160200160208202803683370190505b50905060005b84518110156118375761180a8582815181106117e3576117e3613ec7565b60200260200101518583815181106117fd576117fd613ec7565b6020026020010151610854565b82828151811061181c5761181c613ec7565b602090810291909101015261183081613ef1565b90506117c5565b509392505050565b60008181600082815260056020526040902060029081015460ff169081111561186a5761186a613905565b0361188857604051631aa7900f60e21b815260040160405180910390fd5b60008381526005602052604090206006015491505b50919050565b60408051808201909152600080825260208201526000838152600960205260409020548390839081106118e8576040516256239b60e41b815260040160405180910390fd5b600085815260096020526040902080548590811061190857611908613ec7565b9060005260206000209060020201604051806040016040529081600082015481526020016001820154815250509250505092915050565b61194881612992565b50565b600080600083815260056020526040902060029081015460ff169081111561197557611975613905565b141592915050565b816002600082815260056020526040902060029081015460ff16908111156119a7576119a7613905565b146119c557604051635ae0460d60e01b815260040160405180910390fd5b60006119d18433612786565b11156119f057604051630e71bbeb60e21b815260040160405180910390fd5b81600003611a1157604051630aaa553f60e01b815260040160405180910390fd5b6000838152600560205260409020600301548290611a30903390610854565b1015611a4f57604051630adea48360e41b815260040160405180910390fd5b60008381526005602081905260408220018054849290611a70908490613c4a565b9091555050600083815260056020526040902060030154610e5b90339084612b02565b611a9b612938565b611aa56000612c7e565b565b600082815260096020526040902054829082908110611ad8576040516256239b60e41b815260040160405180910390fd5b6000848152600960205260408120805485908110611af857611af8613ec7565b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090504281600001511115611b4c5760405163555e39a160e01b815260040160405180910390fd5b8060200151600e6000828254611b629190613bf6565b90915550506020808201516000878152600590925260408220600801805491929091611b8f908490613bf6565b90915550506000858152600960205260409020546001108015611bcb5750600085815260096020526040902054611bc890600190613c4a565b84105b15611c4d5760008581526009602052604090208054611bec90600190613c4a565b81548110611bfc57611bfc613ec7565b9060005260206000209060020201600960008781526020019081526020016000208581548110611c2e57611c2e613ec7565b6000918252602090912082546002909202019081556001918201549101555b6000858152600960205260409020805480611c6a57611c6a613f2b565b600082815260208082206002600019949094019384020182815560010191909155915581810151604080518881529283019190915242908201527f271447a7fc6bd5726818ce06a9d9ffdecd61963481f678d3903cc5bacc523c869060600160405180910390a15050505050565b600082815260056020526040902060020154829061010090046001600160a01b03163314611d195760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff1690811115611d4357611d43613905565b14611d61576040516324ca9b7560e11b815260040160405180910390fd5b6001600160a01b038316611d8857604051631003778160e21b815260040160405180910390fd5b6000848152600560209081526040918290206002018054610100600160a81b0319166101006001600160a01b038816908102919091179091558251878152918201527fc2540c28b8d63a418124b5d4e8bae3f86c0de4728ba95b5f68e5dfb6bca989fc9101611610565b60008181600082815260056020526040902060029081015460ff1690811115611e1d57611e1d613905565b03611e3b57604051631aa7900f60e21b815260040160405180910390fd5b50506000908152600560208190526040909120015490565b60006001600083815260056020526040902060029081015460ff1690811115611e7e57611e7e613905565b1492915050565b6113e7338383612cd0565b600082815260056020526040902060020154829061010090046001600160a01b03163314611ed15760405163e2b2255d60e01b815260040160405180910390fd5b826002600082815260056020526040902060029081015460ff1690811115611efb57611efb613905565b14611f1957604051635ae0460d60e01b815260040160405180910390fd5b82600003611f3a576040516352ff31dd60e01b815260040160405180910390fd5b6000848152600560205260409020600401548390611f59903390610854565b1015611f785760405163b5dc18c960e01b815260040160405180910390fd5b60008481526005602052604081206006018054859290611f99908490613c4a565b909155505050505050565b611faf600284613edd565b600003612023576000611fc3600285613dae565b905060008082815260056020526040902060029081015460ff1690811115611fed57611fed613905565b0361200b57604051631aa7900f60e21b815260040160405180910390fd5b6120158187612786565b506120208186612786565b50505b6113328585858585612db0565b612038612938565b6001600160a01b03811661209d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108bb565b61194881612c7e565b600960205281600052604060002081815481106120c257600080fd5b600091825260209091206002909102018054600190910154909250905082565b6000818152600560205260409020600301546120ff903390610854565b60000361211f57604051632032648b60e01b815260040160405180910390fd5b6121298133612786565b60000361193f576040516374d4d10160e11b815260040160405180910390fd5b600082815260056020526040902060020154829061010090046001600160a01b0316331461218a5760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff16908111156121b4576121b4613905565b146121d2576040516324ca9b7560e11b815260040160405180910390fd5b60008481526005602090815260409182902060090185905581518681529081018590527fbf1c36c04102e8dc9c545101dc75f62063fb6025d53f0f9352bf2e52971c66289101611610565b60008181600082815260056020526040902060029081015460ff169081111561224857612248613905565b0361226657604051631aa7900f60e21b815260040160405180910390fd5b505060009081526009602052604090205490565b6002600454036122cc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108bb565b6002600455565b60006122de82612df5565b604051632214836b60e21b81526004810185905290915082906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906388520dac90602401602060405180830381865afa158015612348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236c9190613f41565b14158015612420575060405163552251cd60e11b81526004810184905261241e907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aa44a39a906024015b600060405180830381865afa1580156123df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124079190810190613f5a565b828051602091820120825192909101919091201490565b155b801561247a5750604051635e38790560e01b815260048101849052612478907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635e387905906024016123c2565b155b15610e5b57604051630c285eed60e31b815260040160405180910390fd5b604051633404591760e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d011645c90602401602060405180830381865afa92505050801561251c575060408051601f3d908101601f1916820190925261251991810190613f41565b60015b156125b157604051633404591760e21b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d011645c90602401602060405180830381865afa158015612586573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125aa9190613f41565b9392505050565b630400000082101580156125c8575063040000a082105b156125d557506013919050565b506000919050565b6040516392680e9560e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906392680e9590602401602060405180830381865afa158015612645573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126699190613fdb565b60ff1692915050565b6001600160a01b0384166126d25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016108bb565b3360006126de85612e87565b905060006126eb85612e87565b90506000868152602081815260408083206001600160a01b038b1684529091528120805487929061271d908490613bf6565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461277d83600089898989612eda565b50505050505050565b600082815260056020526040812060038101546008820154915490919083906127ae906125dd565b905060006127bd826013613c4a565b6127c8906002613d8c565b6127d59062080000613dae565b90506000816127e48887610854565b6127f39064e8d4a51000613c91565b6127fd9190613dae565b60008981526006602090815260408083206001600160a01b038c1684529091528120549192509064e8d4a510009083906128379088613c4a565b6128419190613c91565b61284b9190613dae565b60008a81526006602090815260408083206001600160a01b038d168085529083528184208a90558d845260078352818420908452909152812080549293508392909190612899908490613bf6565b9091555050604080518a81526001600160a01b038a1660208201529081018290527f304c98b08d8ff54f5608bc843e35d86b87a0b9968d66edce5a8dd5ceb7bbd5889060600160405180910390a198975050505050505050565b6001600160a01b03851633148061290f575061290f8533610796565b61292b5760405162461bcd60e51b81526004016108bb90613ffe565b6113328585858585613035565b6003546001600160a01b03163314611aa55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108bb565b8060008082815260056020526040902060029081015460ff16908111156129bb576129bb613905565b036129d957604051631aa7900f60e21b815260040160405180910390fd5b600082815260076020908152604080832033845290915281205490819003612a1457604051630686827b60e51b815260040160405180910390fd5b600083815260076020908152604080832033808552925280832092909255905163a9059cbb60e01b81526004810191909152602481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015612aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac49190613c2d565b50604080518481523360208201529081018290527f9722cdc65dd852fc27a66eb73f3075ebafbfe00a914437ce1b7b8c8d9fcde12790606001610acc565b6001600160a01b038316612b645760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b60648201526084016108bb565b336000612b7084612e87565b90506000612b7d84612e87565b60408051602080820183526000918290528882528181528282206001600160a01b038b1683529052205490915084811015612c065760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b60648201526084016108bb565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a460408051602081019091526000905261277d565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031603612d435760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016108bb565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038516331480612dcc5750612dcc8533610796565b612de85760405162461bcd60e51b81526004016108bb90613ffe565b611332858585858561320a565b60606000612e0283613334565b60010190506000816001600160401b03811115612e2157612e216135de565b6040519080825280601f01601f191660200182016040528015612e4b576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612e5557509392505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612ec157612ec1613ec7565b602090810291909101015292915050565b505050505050565b6001600160a01b0384163b15612ed25760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612f1e908990899088908890889060040161404c565b6020604051808303816000875af1925050508015612f59575060408051601f3d908101601f19168201909252612f5691810190614091565b60015b61300557612f656140ae565b806308c379a003612f9e5750612f796140ca565b80612f845750612fa0565b8060405162461bcd60e51b81526004016108bb91906135cb565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016108bb565b6001600160e01b0319811663f23a6e6160e01b1461277d5760405162461bcd60e51b81526004016108bb90614153565b81518351146130975760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108bb565b6001600160a01b0384166130bd5760405162461bcd60e51b81526004016108bb9061419b565b3360005b84518110156131a45760008582815181106130de576130de613ec7565b6020026020010151905060008583815181106130fc576130fc613ec7565b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561314c5760405162461bcd60e51b81526004016108bb906141e0565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290613189908490613bf6565b925050819055505050508061319d90613ef1565b90506130c1565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516131f492919061422a565b60405180910390a4612ed281878787878761340c565b6001600160a01b0384166132305760405162461bcd60e51b81526004016108bb9061419b565b33600061323c85612e87565b9050600061324985612e87565b90506000868152602081815260408083206001600160a01b038c1684529091529020548581101561328c5760405162461bcd60e51b81526004016108bb906141e0565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906132c9908490613bf6565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4613329848a8a8a8a8a612eda565b505050505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106133735772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061339f576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106133bd57662386f26fc10000830492506010015b6305f5e10083106133d5576305f5e100830492506008015b61271083106133e957612710830492506004015b606483106133fb576064830492506002015b600a83106108e75760010192915050565b6001600160a01b0384163b15612ed25760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906134509089908990889088908890600401614258565b6020604051808303816000875af192505050801561348b575060408051601f3d908101601f1916820190925261348891810190614091565b60015b61349757612f656140ae565b6001600160e01b0319811663bc197c8160e01b1461277d5760405162461bcd60e51b81526004016108bb90614153565b80356001600160a01b03811681146134de57600080fd5b919050565b600080604083850312156134f657600080fd5b6134ff836134c7565b946020939093013593505050565b6001600160e01b03198116811461194857600080fd5b60006020828403121561353557600080fd5b81356125aa8161350d565b60006020828403121561355257600080fd5b5035919050565b6000806040838503121561356c57600080fd5b50508035926020909101359150565b60005b8381101561359657818101518382015260200161357e565b50506000910152565b600081518084526135b781602086016020860161357b565b601f01601f19169290920160200192915050565b6020815260006125aa602083018461359f565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613619576136196135de565b6040525050565b60006001600160401b03821115613639576136396135de565b50601f01601f191660200190565b600082601f83011261365857600080fd5b813561366381613620565b60405161367082826135f4565b82815285602084870101111561368557600080fd5b82602086016020830137600092810160200192909252509392505050565b600080600080608085870312156136b957600080fd5b6136c2856134c7565b93506136d0602086016134c7565b92506040850135915060608501356001600160401b038111156136f257600080fd5b6136fe87828801613647565b91505092959194509250565b801515811461194857600080fd5b600080600080600060a0868803121561373057600080fd5b853594506020860135935060408601356137498161370a565b925060608601356001600160401b0381111561376457600080fd5b61377088828901613647565b95989497509295608001359392505050565b60006001600160401b0382111561379b5761379b6135de565b5060051b60200190565b600082601f8301126137b657600080fd5b813560206137c382613782565b6040516137d082826135f4565b83815260059390931b85018201928281019150868411156137f057600080fd5b8286015b8481101561380b57803583529183019183016137f4565b509695505050505050565b600080600080600060a0868803121561382e57600080fd5b613837866134c7565b9450613845602087016134c7565b935060408601356001600160401b038082111561386157600080fd5b61386d89838a016137a5565b9450606088013591508082111561388357600080fd5b61388f89838a016137a5565b935060808801359150808211156138a557600080fd5b506138b288828901613647565b9150509295509295909350565b600080604083850312156138d257600080fd5b8235915060208301356001600160401b038111156138ef57600080fd5b6138fb85828601613647565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b60006101a08f83528e602084015260038e1061394757634e487b7160e01b600052602160045260246000fd5b8d6040840152613962606084018e6001600160a01b03169052565b8b60808401528a60a08401528960c08401528860e0840152876101008401528661012084015285610140840152806101608401526139a28184018661359f565b9150506139b461018083018415159052565b9e9d5050505050505050505050505050565b600080604083850312156139d957600080fd5b82356001600160401b03808211156139f057600080fd5b818501915085601f830112613a0457600080fd5b81356020613a1182613782565b604051613a1e82826135f4565b83815260059390931b8501820192828101915089841115613a3e57600080fd5b948201945b83861015613a6357613a54866134c7565b82529482019490820190613a43565b96505086013592505080821115613a7957600080fd5b506138fb858286016137a5565b600081518084526020808501945080840160005b83811015613ab657815187529582019590820190600101613a9a565b509495945050505050565b6020815260006125aa6020830184613a86565b60008060408385031215613ae757600080fd5b82359150613af7602084016134c7565b90509250929050565b60008060408385031215613b1357600080fd5b613b1c836134c7565b91506020830135613b2c8161370a565b809150509250929050565b60008060408385031215613b4a57600080fd5b613b53836134c7565b9150613af7602084016134c7565b600080600080600060a08688031215613b7957600080fd5b613b82866134c7565b9450613b90602087016134c7565b9350604086013592506060860135915060808601356001600160401b03811115613bb957600080fd5b6138b288828901613647565b600060208284031215613bd757600080fd5b6125aa826134c7565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e7576108e7613be0565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215613c3f57600080fd5b81516125aa8161370a565b818103818111156108e7576108e7613be0565b600181811c90821680613c7157607f821691505b60208210810361189d57634e487b7160e01b600052602260045260246000fd5b80820281158282048414176108e7576108e7613be0565b600181815b80851115613ce3578160001904821115613cc957613cc9613be0565b80851615613cd657918102915b93841c9390800290613cad565b509250929050565b600082613cfa575060016108e7565b81613d07575060006108e7565b8160018114613d1d5760028114613d2757613d43565b60019150506108e7565b60ff841115613d3857613d38613be0565b50506001821b6108e7565b5060208310610133831016604e8410600b8410161715613d66575081810a6108e7565b613d708383613ca8565b8060001904821115613d8457613d84613be0565b029392505050565b60006125aa8383613ceb565b634e487b7160e01b600052601260045260246000fd5b600082613dbd57613dbd613d98565b500490565b601f821115610e5b57600081815260208120601f850160051c81016020861015613de95750805b601f850160051c820191505b81811015612ed257828155600101613df5565b81516001600160401b03811115613e2157613e216135de565b613e3581613e2f8454613c5d565b84613dc2565b602080601f831160018114613e6a5760008415613e525750858301515b600019600386901b1c1916600185901b178555612ed2565b600085815260208120601f198616915b82811015613e9957888601518255948401946001909101908401613e7a565b5085821015613eb75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b600082613eec57613eec613d98565b500690565b600060018201613f0357613f03613be0565b5060010190565b828152604060208201526000613f23604083018461359f565b949350505050565b634e487b7160e01b600052603160045260246000fd5b600060208284031215613f5357600080fd5b5051919050565b600060208284031215613f6c57600080fd5b81516001600160401b03811115613f8257600080fd5b8201601f81018413613f9357600080fd5b8051613f9e81613620565b604051613fab82826135f4565b828152866020848601011115613fc057600080fd5b613fd183602083016020870161357b565b9695505050505050565b600060208284031215613fed57600080fd5b815160ff811681146125aa57600080fd5b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906140869083018461359f565b979650505050505050565b6000602082840312156140a357600080fd5b81516125aa8161350d565b600060033d11156140c75760046000803e5060005160e01c5b90565b600060443d10156140d85790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561410757505050505090565b828501915081518181111561411f5750505050505090565b843d87010160208285010111156141395750505050505090565b614148602082860101876135f4565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60408152600061423d6040830185613a86565b828103602084015261424f8185613a86565b95945050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061428490830186613a86565b82810360608401526142968186613a86565b905082810360808401526142aa818561359f565b9897505050505050505056fea2646970667358221220f43dfac8e935397951a31ef1a98102f2a38de3297a94136a0efea6d9c73e656a64736f6c63430008130033000000000000000000000000000000000000000000000000000000020010000000000000000000000000000000000000000000000000000000000002001fffff0000000000000000000000000000000000000000000000000000000200100032000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad616690000000000000000000000000b84dcf0d13678c68ba9ca976c02eaaa0a44932b00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba6000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103265760003560e01c8063637c77f1116101b85780639d18e54211610104578063f242432a116100a2578063f62b46c91161007c578063f62b46c914610812578063f7ce46b714610825578063fc247f5214610838578063ff50abdc1461084b57600080fd5b8063f242432a146107c4578063f2fde38b146107d7578063f458f568146107ea57600080fd5b8063a83622e0116100de578063a83622e014610746578063c4fd622414610752578063d04720cd14610775578063e985e9c51461078857600080fd5b80639d18e542146106fd578063a22cb46514610710578063a266bcf21461072357600080fd5b806380a62256116101715780638a82f2401161014b5780638a82f2401461069b5780638da5cb5b146106c65780639732d56f146106d75780639c50ff74146106ea57600080fd5b806380a622561461067657806381e0aaa41461067f5780638792290e1461068857600080fd5b8063637c77f1146106095780636da58de31461062c5780636e70096e146106355780636f7286c21461064857806370b394a61461065b578063715018a61461066e57600080fd5b806337a8dd981161027757806352aa9932116102305780635b5bc9431161020a5780635b5bc943146105a55780635c3db6e2146105ae5780635d2938b4146105b857806362d28bfd146105db57600080fd5b806352aa99321461054757806352f66b841461057257806359a6b0361461058557600080fd5b806337a8dd98146104b2578063389fe464146104955780633a340c92146104c557806347e154e2146104d85780634c106406146105045780634e1273f41461052757600080fd5b8063150b7a02116102e45780631aeb776c116102be5780631aeb776c1461046f5780631cb536ed146104825780632916b8b3146104955780632eb2c2d61461049f57600080fd5b8063150b7a02146103dc578063160e553614610413578063181965971461042657600080fd5b8062fdd58e1461032b57806301ffc9a7146103515780630269c589146103745780630cae7afc146103945780630e89341c146103a957806314443549146103c9575b600080fd5b61033e6103393660046134e3565b610854565b6040519081526020015b60405180910390f35b61036461035f366004613523565b6108ed565b6040519015158152602001610348565b61033e610382366004613540565b60086020526000908152604090205481565b6103a76103a2366004613559565b61093d565b005b6103bc6103b7366004613540565b610ad9565b60405161034891906135cb565b6103a76103d7366004613540565b610b6d565b6103fa6103ea3660046136a3565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610348565b6103bc610421366004613540565b610e60565b610457610434366004613540565b60009081526005602052604090206002015461010090046001600160a01b031690565b6040516001600160a01b039091168152602001610348565b6103a761047d366004613718565b610e80565b6103a7610490366004613540565b611339565b61033e6208000081565b6103a76104ad366004613816565b6113eb565b6103a76104c0366004613540565b6114b5565b6103a76104d33660046138bf565b61153a565b6104eb6104e6366004613540565b61161e565b6040516103489d9c9b9a9998979695949392919061391b565b61033e610512366004613540565b60009081526005602052604090206008015490565b61053a6105353660046139c6565b611716565b6040516103489190613ac1565b61033e610555366004613ad4565b600760209081526000928352604080842090915290825290205481565b61033e610580366004613540565b61183f565b61033e610593366004613540565b60009081526005602052604090205490565b61033e600b5481565b61033e6201518081565b61033e6105c6366004613540565b60009081526005602052604090206007015490565b6105ee6105e9366004613559565b6118a3565b60408051825181526020928301519281019290925201610348565b61033e610617366004613540565b60009081526005602052604090206001015490565b61033e600d5481565b6103a7610643366004613540565b61193f565b610364610656366004613540565b61194b565b6103a7610669366004613559565b61197d565b6103a7611a93565b61033e600a5481565b61033e600c5481565b6103a7610696366004613559565b611aa7565b61033e6106a9366004613ad4565b600660209081526000928352604080842090915290825290205481565b6003546001600160a01b0316610457565b6103a76106e5366004613ad4565b611cd8565b61033e6106f8366004613540565b611df2565b61036461070b366004613540565b611e53565b6103a761071e366004613b00565b611e85565b61033e610731366004613540565b60009081526005602052604090206003015490565b61033e64e8d4a5100081565b61033e610760366004613540565b60009081526005602052604090206004015490565b6103a7610783366004613559565b611e90565b610364610796366004613b37565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6103a76107d2366004613b61565b611fa4565b6103a76107e5366004613bc5565b612030565b6107fd6107f8366004613559565b6120a6565b60408051928352602083019190915201610348565b6103a7610820366004613540565b6120e2565b6103a7610833366004613559565b612149565b61033e610846366004613540565b61221d565b61033e600e5481565b60006001600160a01b0383166108c45760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061091e57506001600160e01b031982166303a24d0760e21b145b806108e757506301ffc9a760e01b6001600160e01b03198316146108e7565b816001600082815260056020526040902060029081015460ff169081111561096757610967613905565b14610985576040516324ca9b7560e11b815260040160405180910390fd5b600083815260096020818152604080842081518083018352600590935293209091015481906109b49042613bf6565b8152602090810185905282546001818101855560009485529382902083516002909202019081559101519101556040516323b872dd60e01b81526001600160a01b037f000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e416906323b872dd90610a3190339030908790600401613c09565b6020604051808303816000875af1158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a749190613c2d565b506000838152600960205260409020547f8d3add996cf7244e1103c44d6abcc43c1fd55a709738ae15dbe04e8a33c58eaa908490610ab490600190613c4a565b60408051928352602083019190915281018490526060015b60405180910390a1505050565b606060028054610ae890613c5d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1490613c5d565b8015610b615780601f10610b3657610100808354040283529160200191610b61565b820191906000526020600020905b815481529060010190602001808311610b4457829003601f168201915b50505050509050919050565b600081815260056020526040902060020154819061010090046001600160a01b03163314610bae5760405163e2b2255d60e01b815260040160405180910390fd5b816001600082815260056020526040902060029081015460ff1690811115610bd857610bd8613905565b14610bf6576040516324ca9b7560e11b815260040160405180910390fd5b610bfe61227a565b6000838152600560205260409020600701544290610c20906201518090613bf6565b1115610c3f5760405163db34e39960e01b815260040160405180910390fd5b600083815260056020908152604080832080546001820154600b8301546002938401805460ff19169094179093558186526008909452918420939093559160ff168015610d8a5760405163f682c34960e01b815260048101839052600060248201527f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba66001600160a01b03169063f682c34990604401600060405180830381600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b5050604051632142170760e11b81526001600160a01b037f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba61692506342842e0e9150610d5790309033908790600401613c09565b600060405180830381600087803b158015610d7157600080fd5b505af1158015610d85573d6000803e3d6000fd5b505050505b604051632142170760e11b81526001600160a01b037f000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad6166916906342842e0e90610dda90309033908890600401613c09565b600060405180830381600087803b158015610df457600080fd5b505af1158015610e08573d6000803e3d6000fd5b505060408051898152602081018690529081018690527fee9fe7deda64d74e417c336ae700a03e73fdf6bc96cb92c7187a3b1fe76e05109250606001905060405180910390a1505050610e5b6001600455565b505050565b6000818152600560205260409020600a01805460609190610ae890613c5d565b610e8861227a565b600c54600d541115610ead57604051634171432d60e11b815260040160405180910390fd5b82610ebc57610ebc84866122d3565b610ec584612498565b610ece866125dd565b1115610eed57604051631b74b8cf60e31b815260040160405180910390fd5b600d5433906000610eff826002613c91565b90506000610f0e836002613c91565b610f19906001613bf6565b90506000610f268a6125dd565b90506001600d6000828254610f3b9190613bf6565b9091555050604080516101a0810182528b8152602081018b905290810160018152602001866001600160a01b03168152602001848152602001838152602001826013610f879190613c4a565b610f92906002613d8c565b610f9f9062080000613dae565b8152602001610faf836013613c4a565b610fba906002613d8c565b610fc79062080000613dae565b81526020014281526020016000815260200187815260200188815260200189151581525060056000868152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083600281111561103c5761103c613905565b02179055506060820151600282018054610100600160a81b0319166101006001600160a01b0390931683021790556080830151600383015560a0830151600483015560c0830151600583015560e08301516006830155820151600782015561012082015160088201556101408201516009820155610160820151600a8201906110c59082613e08565b506101809190910151600b909101805460ff191691151591909117905560008a8152600860205260409081902085905551632142170760e11b81527f000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad616696001600160a01b0316906342842e0e9061114390889030908f90600401613c09565b600060405180830381600087803b15801561115d57600080fd5b505af1158015611171573d6000803e3d6000fd5b50505050871561127f57604051632142170760e11b81526001600160a01b037f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba616906342842e0e906111cb90889030908e90600401613c09565b600060405180830381600087803b1580156111e557600080fd5b505af11580156111f9573d6000803e3d6000fd5b505060405163f682c34960e01b8152600481018c9052602481018d90527f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba66001600160a01b0316925063f682c3499150604401600060405180830381600087803b15801561126657600080fd5b505af115801561127a573d6000803e3d6000fd5b505050505b6112bc858461128f846013613c4a565b61129a906002613d8c565b6112a79062080000613dae565b60405180602001604052806000815250612672565b6112cc858361128f846013613c4a565b604080518b8152602081018b90526001600160a01b0387168183015260608101869052891515608082015290517fb80ad1ed7f488a2ff9837465e2694eafd9981e90b78b920e83b8adedf9217b5e9181900360a00190a150505050506113326001600455565b5050505050565b8060008082815260056020526040902060029081015460ff169081111561136257611362613905565b0361138057604051631aa7900f60e21b815260040160405180910390fd5b60008281526005602052604090206003015461139d903390610854565b6000036113bd57604051632032648b60e01b815260040160405180910390fd5b6113c78233612786565b6000036113e7576040516374d4d10160e11b815260040160405180910390fd5b5050565b60005b83518110156114a757600084828151811061140b5761140b613ec7565b602002602001015190506002816114229190613edd565b600003611496576000611436600283613dae565b905060008082815260056020526040902060029081015460ff169081111561146057611460613905565b0361147e57604051631aa7900f60e21b815260040160405180910390fd5b6114888189612786565b506114938188612786565b50505b506114a081613ef1565b90506113ee565b5061133285858585856128f3565b6114bd612938565b600b5481600c546114ce9190613bf6565b11156114ed57604051639b5abc5160e01b815260040160405180910390fd5b80600c60008282546114ff9190613bf6565b90915550506040518181527f1b735d12f447802826825c2519a6c37142c4d6a71ed6e0f5d30b447e11359ad89060200160405180910390a150565b600082815260056020526040902060020154829061010090046001600160a01b0316331461157b5760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff16908111156115a5576115a5613905565b146115c3576040516324ca9b7560e11b815260040160405180910390fd5b6000848152600560205260409020600a016115de8482613e08565b507f4e0214d0995fefc26259a79ffd8f6a4c93a350ed9109ae3bc693237722b115898484604051611610929190613f0a565b60405180910390a150505050565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009890154600a8a018054999b989a60ff89169a6101009099046001600160a01b031699979890919061168a90613c5d565b80601f01602080910402602001604051908101604052809291908181526020018280546116b690613c5d565b80156117035780601f106116d857610100808354040283529160200191611703565b820191906000526020600020905b8154815290600101906020018083116116e657829003601f168201915b505050600b909301549192505060ff168d565b6060815183511461177b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016108bb565b600083516001600160401b03811115611796576117966135de565b6040519080825280602002602001820160405280156117bf578160200160208202803683370190505b50905060005b84518110156118375761180a8582815181106117e3576117e3613ec7565b60200260200101518583815181106117fd576117fd613ec7565b6020026020010151610854565b82828151811061181c5761181c613ec7565b602090810291909101015261183081613ef1565b90506117c5565b509392505050565b60008181600082815260056020526040902060029081015460ff169081111561186a5761186a613905565b0361188857604051631aa7900f60e21b815260040160405180910390fd5b60008381526005602052604090206006015491505b50919050565b60408051808201909152600080825260208201526000838152600960205260409020548390839081106118e8576040516256239b60e41b815260040160405180910390fd5b600085815260096020526040902080548590811061190857611908613ec7565b9060005260206000209060020201604051806040016040529081600082015481526020016001820154815250509250505092915050565b61194881612992565b50565b600080600083815260056020526040902060029081015460ff169081111561197557611975613905565b141592915050565b816002600082815260056020526040902060029081015460ff16908111156119a7576119a7613905565b146119c557604051635ae0460d60e01b815260040160405180910390fd5b60006119d18433612786565b11156119f057604051630e71bbeb60e21b815260040160405180910390fd5b81600003611a1157604051630aaa553f60e01b815260040160405180910390fd5b6000838152600560205260409020600301548290611a30903390610854565b1015611a4f57604051630adea48360e41b815260040160405180910390fd5b60008381526005602081905260408220018054849290611a70908490613c4a565b9091555050600083815260056020526040902060030154610e5b90339084612b02565b611a9b612938565b611aa56000612c7e565b565b600082815260096020526040902054829082908110611ad8576040516256239b60e41b815260040160405180910390fd5b6000848152600960205260408120805485908110611af857611af8613ec7565b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090504281600001511115611b4c5760405163555e39a160e01b815260040160405180910390fd5b8060200151600e6000828254611b629190613bf6565b90915550506020808201516000878152600590925260408220600801805491929091611b8f908490613bf6565b90915550506000858152600960205260409020546001108015611bcb5750600085815260096020526040902054611bc890600190613c4a565b84105b15611c4d5760008581526009602052604090208054611bec90600190613c4a565b81548110611bfc57611bfc613ec7565b9060005260206000209060020201600960008781526020019081526020016000208581548110611c2e57611c2e613ec7565b6000918252602090912082546002909202019081556001918201549101555b6000858152600960205260409020805480611c6a57611c6a613f2b565b600082815260208082206002600019949094019384020182815560010191909155915581810151604080518881529283019190915242908201527f271447a7fc6bd5726818ce06a9d9ffdecd61963481f678d3903cc5bacc523c869060600160405180910390a15050505050565b600082815260056020526040902060020154829061010090046001600160a01b03163314611d195760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff1690811115611d4357611d43613905565b14611d61576040516324ca9b7560e11b815260040160405180910390fd5b6001600160a01b038316611d8857604051631003778160e21b815260040160405180910390fd5b6000848152600560209081526040918290206002018054610100600160a81b0319166101006001600160a01b038816908102919091179091558251878152918201527fc2540c28b8d63a418124b5d4e8bae3f86c0de4728ba95b5f68e5dfb6bca989fc9101611610565b60008181600082815260056020526040902060029081015460ff1690811115611e1d57611e1d613905565b03611e3b57604051631aa7900f60e21b815260040160405180910390fd5b50506000908152600560208190526040909120015490565b60006001600083815260056020526040902060029081015460ff1690811115611e7e57611e7e613905565b1492915050565b6113e7338383612cd0565b600082815260056020526040902060020154829061010090046001600160a01b03163314611ed15760405163e2b2255d60e01b815260040160405180910390fd5b826002600082815260056020526040902060029081015460ff1690811115611efb57611efb613905565b14611f1957604051635ae0460d60e01b815260040160405180910390fd5b82600003611f3a576040516352ff31dd60e01b815260040160405180910390fd5b6000848152600560205260409020600401548390611f59903390610854565b1015611f785760405163b5dc18c960e01b815260040160405180910390fd5b60008481526005602052604081206006018054859290611f99908490613c4a565b909155505050505050565b611faf600284613edd565b600003612023576000611fc3600285613dae565b905060008082815260056020526040902060029081015460ff1690811115611fed57611fed613905565b0361200b57604051631aa7900f60e21b815260040160405180910390fd5b6120158187612786565b506120208186612786565b50505b6113328585858585612db0565b612038612938565b6001600160a01b03811661209d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108bb565b61194881612c7e565b600960205281600052604060002081815481106120c257600080fd5b600091825260209091206002909102018054600190910154909250905082565b6000818152600560205260409020600301546120ff903390610854565b60000361211f57604051632032648b60e01b815260040160405180910390fd5b6121298133612786565b60000361193f576040516374d4d10160e11b815260040160405180910390fd5b600082815260056020526040902060020154829061010090046001600160a01b0316331461218a5760405163e2b2255d60e01b815260040160405180910390fd5b826001600082815260056020526040902060029081015460ff16908111156121b4576121b4613905565b146121d2576040516324ca9b7560e11b815260040160405180910390fd5b60008481526005602090815260409182902060090185905581518681529081018590527fbf1c36c04102e8dc9c545101dc75f62063fb6025d53f0f9352bf2e52971c66289101611610565b60008181600082815260056020526040902060029081015460ff169081111561224857612248613905565b0361226657604051631aa7900f60e21b815260040160405180910390fd5b505060009081526009602052604090205490565b6002600454036122cc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108bb565b6002600455565b60006122de82612df5565b604051632214836b60e21b81526004810185905290915082906001600160a01b037f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba616906388520dac90602401602060405180830381865afa158015612348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236c9190613f41565b14158015612420575060405163552251cd60e11b81526004810184905261241e907f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba66001600160a01b03169063aa44a39a906024015b600060405180830381865afa1580156123df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124079190810190613f5a565b828051602091820120825192909101919091201490565b155b801561247a5750604051635e38790560e01b815260048101849052612478907f0000000000000000000000000b84dcf0d13678c68ba9ca976c02eaaa0a44932b6001600160a01b031690635e387905906024016123c2565b155b15610e5b57604051630c285eed60e31b815260040160405180910390fd5b604051633404591760e21b8152600481018290526000907f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba66001600160a01b03169063d011645c90602401602060405180830381865afa92505050801561251c575060408051601f3d908101601f1916820190925261251991810190613f41565b60015b156125b157604051633404591760e21b8152600481018490527f00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba66001600160a01b03169063d011645c90602401602060405180830381865afa158015612586573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125aa9190613f41565b9392505050565b630400000082101580156125c8575063040000a082105b156125d557506013919050565b506000919050565b6040516392680e9560e01b8152600481018290526000907f000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad616696001600160a01b0316906392680e9590602401602060405180830381865afa158015612645573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126699190613fdb565b60ff1692915050565b6001600160a01b0384166126d25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016108bb565b3360006126de85612e87565b905060006126eb85612e87565b90506000868152602081815260408083206001600160a01b038b1684529091528120805487929061271d908490613bf6565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461277d83600089898989612eda565b50505050505050565b600082815260056020526040812060038101546008820154915490919083906127ae906125dd565b905060006127bd826013613c4a565b6127c8906002613d8c565b6127d59062080000613dae565b90506000816127e48887610854565b6127f39064e8d4a51000613c91565b6127fd9190613dae565b60008981526006602090815260408083206001600160a01b038c1684529091528120549192509064e8d4a510009083906128379088613c4a565b6128419190613c91565b61284b9190613dae565b60008a81526006602090815260408083206001600160a01b038d168085529083528184208a90558d845260078352818420908452909152812080549293508392909190612899908490613bf6565b9091555050604080518a81526001600160a01b038a1660208201529081018290527f304c98b08d8ff54f5608bc843e35d86b87a0b9968d66edce5a8dd5ceb7bbd5889060600160405180910390a198975050505050505050565b6001600160a01b03851633148061290f575061290f8533610796565b61292b5760405162461bcd60e51b81526004016108bb90613ffe565b6113328585858585613035565b6003546001600160a01b03163314611aa55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108bb565b8060008082815260056020526040902060029081015460ff16908111156129bb576129bb613905565b036129d957604051631aa7900f60e21b815260040160405180910390fd5b600082815260076020908152604080832033845290915281205490819003612a1457604051630686827b60e51b815260040160405180910390fd5b600083815260076020908152604080832033808552925280832092909255905163a9059cbb60e01b81526004810191909152602481018290526001600160a01b037f000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4169063a9059cbb906044016020604051808303816000875af1158015612aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac49190613c2d565b50604080518481523360208201529081018290527f9722cdc65dd852fc27a66eb73f3075ebafbfe00a914437ce1b7b8c8d9fcde12790606001610acc565b6001600160a01b038316612b645760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b60648201526084016108bb565b336000612b7084612e87565b90506000612b7d84612e87565b60408051602080820183526000918290528882528181528282206001600160a01b038b1683529052205490915084811015612c065760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b60648201526084016108bb565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a460408051602081019091526000905261277d565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031603612d435760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016108bb565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038516331480612dcc5750612dcc8533610796565b612de85760405162461bcd60e51b81526004016108bb90613ffe565b611332858585858561320a565b60606000612e0283613334565b60010190506000816001600160401b03811115612e2157612e216135de565b6040519080825280601f01601f191660200182016040528015612e4b576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612e5557509392505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612ec157612ec1613ec7565b602090810291909101015292915050565b505050505050565b6001600160a01b0384163b15612ed25760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612f1e908990899088908890889060040161404c565b6020604051808303816000875af1925050508015612f59575060408051601f3d908101601f19168201909252612f5691810190614091565b60015b61300557612f656140ae565b806308c379a003612f9e5750612f796140ca565b80612f845750612fa0565b8060405162461bcd60e51b81526004016108bb91906135cb565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016108bb565b6001600160e01b0319811663f23a6e6160e01b1461277d5760405162461bcd60e51b81526004016108bb90614153565b81518351146130975760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108bb565b6001600160a01b0384166130bd5760405162461bcd60e51b81526004016108bb9061419b565b3360005b84518110156131a45760008582815181106130de576130de613ec7565b6020026020010151905060008583815181106130fc576130fc613ec7565b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561314c5760405162461bcd60e51b81526004016108bb906141e0565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290613189908490613bf6565b925050819055505050508061319d90613ef1565b90506130c1565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516131f492919061422a565b60405180910390a4612ed281878787878761340c565b6001600160a01b0384166132305760405162461bcd60e51b81526004016108bb9061419b565b33600061323c85612e87565b9050600061324985612e87565b90506000868152602081815260408083206001600160a01b038c1684529091529020548581101561328c5760405162461bcd60e51b81526004016108bb906141e0565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906132c9908490613bf6565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4613329848a8a8a8a8a612eda565b505050505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106133735772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061339f576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106133bd57662386f26fc10000830492506010015b6305f5e10083106133d5576305f5e100830492506008015b61271083106133e957612710830492506004015b606483106133fb576064830492506002015b600a83106108e75760010192915050565b6001600160a01b0384163b15612ed25760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906134509089908990889088908890600401614258565b6020604051808303816000875af192505050801561348b575060408051601f3d908101601f1916820190925261348891810190614091565b60015b61349757612f656140ae565b6001600160e01b0319811663bc197c8160e01b1461277d5760405162461bcd60e51b81526004016108bb90614153565b80356001600160a01b03811681146134de57600080fd5b919050565b600080604083850312156134f657600080fd5b6134ff836134c7565b946020939093013593505050565b6001600160e01b03198116811461194857600080fd5b60006020828403121561353557600080fd5b81356125aa8161350d565b60006020828403121561355257600080fd5b5035919050565b6000806040838503121561356c57600080fd5b50508035926020909101359150565b60005b8381101561359657818101518382015260200161357e565b50506000910152565b600081518084526135b781602086016020860161357b565b601f01601f19169290920160200192915050565b6020815260006125aa602083018461359f565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613619576136196135de565b6040525050565b60006001600160401b03821115613639576136396135de565b50601f01601f191660200190565b600082601f83011261365857600080fd5b813561366381613620565b60405161367082826135f4565b82815285602084870101111561368557600080fd5b82602086016020830137600092810160200192909252509392505050565b600080600080608085870312156136b957600080fd5b6136c2856134c7565b93506136d0602086016134c7565b92506040850135915060608501356001600160401b038111156136f257600080fd5b6136fe87828801613647565b91505092959194509250565b801515811461194857600080fd5b600080600080600060a0868803121561373057600080fd5b853594506020860135935060408601356137498161370a565b925060608601356001600160401b0381111561376457600080fd5b61377088828901613647565b95989497509295608001359392505050565b60006001600160401b0382111561379b5761379b6135de565b5060051b60200190565b600082601f8301126137b657600080fd5b813560206137c382613782565b6040516137d082826135f4565b83815260059390931b85018201928281019150868411156137f057600080fd5b8286015b8481101561380b57803583529183019183016137f4565b509695505050505050565b600080600080600060a0868803121561382e57600080fd5b613837866134c7565b9450613845602087016134c7565b935060408601356001600160401b038082111561386157600080fd5b61386d89838a016137a5565b9450606088013591508082111561388357600080fd5b61388f89838a016137a5565b935060808801359150808211156138a557600080fd5b506138b288828901613647565b9150509295509295909350565b600080604083850312156138d257600080fd5b8235915060208301356001600160401b038111156138ef57600080fd5b6138fb85828601613647565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b60006101a08f83528e602084015260038e1061394757634e487b7160e01b600052602160045260246000fd5b8d6040840152613962606084018e6001600160a01b03169052565b8b60808401528a60a08401528960c08401528860e0840152876101008401528661012084015285610140840152806101608401526139a28184018661359f565b9150506139b461018083018415159052565b9e9d5050505050505050505050505050565b600080604083850312156139d957600080fd5b82356001600160401b03808211156139f057600080fd5b818501915085601f830112613a0457600080fd5b81356020613a1182613782565b604051613a1e82826135f4565b83815260059390931b8501820192828101915089841115613a3e57600080fd5b948201945b83861015613a6357613a54866134c7565b82529482019490820190613a43565b96505086013592505080821115613a7957600080fd5b506138fb858286016137a5565b600081518084526020808501945080840160005b83811015613ab657815187529582019590820190600101613a9a565b509495945050505050565b6020815260006125aa6020830184613a86565b60008060408385031215613ae757600080fd5b82359150613af7602084016134c7565b90509250929050565b60008060408385031215613b1357600080fd5b613b1c836134c7565b91506020830135613b2c8161370a565b809150509250929050565b60008060408385031215613b4a57600080fd5b613b53836134c7565b9150613af7602084016134c7565b600080600080600060a08688031215613b7957600080fd5b613b82866134c7565b9450613b90602087016134c7565b9350604086013592506060860135915060808601356001600160401b03811115613bb957600080fd5b6138b288828901613647565b600060208284031215613bd757600080fd5b6125aa826134c7565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e7576108e7613be0565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215613c3f57600080fd5b81516125aa8161370a565b818103818111156108e7576108e7613be0565b600181811c90821680613c7157607f821691505b60208210810361189d57634e487b7160e01b600052602260045260246000fd5b80820281158282048414176108e7576108e7613be0565b600181815b80851115613ce3578160001904821115613cc957613cc9613be0565b80851615613cd657918102915b93841c9390800290613cad565b509250929050565b600082613cfa575060016108e7565b81613d07575060006108e7565b8160018114613d1d5760028114613d2757613d43565b60019150506108e7565b60ff841115613d3857613d38613be0565b50506001821b6108e7565b5060208310610133831016604e8410600b8410161715613d66575081810a6108e7565b613d708383613ca8565b8060001904821115613d8457613d84613be0565b029392505050565b60006125aa8383613ceb565b634e487b7160e01b600052601260045260246000fd5b600082613dbd57613dbd613d98565b500490565b601f821115610e5b57600081815260208120601f850160051c81016020861015613de95750805b601f850160051c820191505b81811015612ed257828155600101613df5565b81516001600160401b03811115613e2157613e216135de565b613e3581613e2f8454613c5d565b84613dc2565b602080601f831160018114613e6a5760008415613e525750858301515b600019600386901b1c1916600185901b178555612ed2565b600085815260208120601f198616915b82811015613e9957888601518255948401946001909101908401613e7a565b5085821015613eb75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b600082613eec57613eec613d98565b500690565b600060018201613f0357613f03613be0565b5060010190565b828152604060208201526000613f23604083018461359f565b949350505050565b634e487b7160e01b600052603160045260246000fd5b600060208284031215613f5357600080fd5b5051919050565b600060208284031215613f6c57600080fd5b81516001600160401b03811115613f8257600080fd5b8201601f81018413613f9357600080fd5b8051613f9e81613620565b604051613fab82826135f4565b828152866020848601011115613fc057600080fd5b613fd183602083016020870161357b565b9695505050505050565b600060208284031215613fed57600080fd5b815160ff811681146125aa57600080fd5b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906140869083018461359f565b979650505050505050565b6000602082840312156140a357600080fd5b81516125aa8161350d565b600060033d11156140c75760046000803e5060005160e01c5b90565b600060443d10156140d85790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561410757505050505090565b828501915081518181111561411f5750505050505090565b843d87010160208285010111156141395750505050505090565b614148602082860101876135f4565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60408152600061423d6040830185613a86565b828103602084015261424f8185613a86565b95945050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061428490830186613a86565b82810360608401526142968186613a86565b905082810360808401526142aa818561359f565b9897505050505050505056fea2646970667358221220f43dfac8e935397951a31ef1a98102f2a38de3297a94136a0efea6d9c73e656a64736f6c63430008130033

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

000000000000000000000000000000000000000000000000000000020010000000000000000000000000000000000000000000000000000000000002001fffff0000000000000000000000000000000000000000000000000000000200100032000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad616690000000000000000000000000b84dcf0d13678c68ba9ca976c02eaaa0a44932b00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba6000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4

-----Decoded View---------------
Arg [0] : startNumber (uint256): 8590983168
Arg [1] : endNumber (uint256): 8592031743
Arg [2] : startLimit (uint256): 8590983218
Arg [3] : licenseAddress (address): 0xd32CB5f76989A27782e44c5297AAba728Ad61669
Arg [4] : chypcV1Address (address): 0x0b84DCf0d13678C68Ba9CA976c02eAaA0A44932b
Arg [5] : swapV2Address (address): 0x21468e63abF3783020750F7b2e57d4B34aFAfba6
Arg [6] : hypcAddress (address): 0xeA7B7DC089c9a4A916B5a7a37617f59fD54e37E4

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000200100000
Arg [1] : 00000000000000000000000000000000000000000000000000000002001fffff
Arg [2] : 0000000000000000000000000000000000000000000000000000000200100032
Arg [3] : 000000000000000000000000d32cb5f76989a27782e44c5297aaba728ad61669
Arg [4] : 0000000000000000000000000b84dcf0d13678c68ba9ca976c02eaaa0a44932b
Arg [5] : 00000000000000000000000021468e63abf3783020750f7b2e57d4b34afafba6
Arg [6] : 000000000000000000000000ea7b7dc089c9a4a916b5a7a37617f59fd54e37e4


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.