ETH Price: $3,128.57 (-0.26%)

Token

TokenVestingPlans (TVP)
 

Overview

Max Total Supply

594 TVP

Holders

443

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 TVP
0x4e7b103A995ee0E49b13062edd6C1960222813f9
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
TokenVestingPlans

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 25 : TokenVestingPlans.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '../ERC721Delegate/ERC721Delegate.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '../libraries/TransferHelper.sol';
import '../libraries/TimelockLibrary.sol';
import '../sharedContracts/URIAdmin.sol';
import '../sharedContracts/VestingStorage.sol';

/// @title TokenVestingPlans - An efficient way to allocate tokens to employees that vest over time
/// @notice This contract allows people to grant tokens to beneficiaries that vest over time with the added functionalities;
/// Each vesting plan is a unique NFT, leveraging the backbone of the ERC721 contract to represent a unique vesting plan
/// 1. Revokable: plans can be revoked and unvested tokens returned to the company (vesting admin)
/// 2. Soul Bound: plans are by default soul bound and not transferable, however can be transferred by an admin in emergencies
/// 3. Governance optimized for snapshot voting: These are built to allow beneficiaries to vote with their unvested tokens on snapshot, or delegate them to other delegatees
/// 4. Beneficiary Claims: Beneficiaries get to choose when to claim their tokens, and can claim partial amounts that are less than the amount they vested for tax optimization

contract TokenVestingPlans is ERC721Delegate, VestingStorage, ReentrancyGuard, URIAdmin {
  /// @notice uses counters for incrementing token IDs which are the planIds
  using Counters for Counters.Counter;
  Counters.Counter private _planIds;

  constructor(string memory name, string memory symbol) ERC721(name, symbol) {
    uriAdmin = msg.sender;
  }

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

  /****CORE EXTERNAL FUNCTIONS*********************************************************************************************************************************************/

  /// @notice function to create a vesting plan.
  /// @dev this function will pull the tokens into this contract for escrow, increment the planIds, mint an NFT to the recipient, and create the storage Plan and map it to the newly minted NFT token ID in storage
  /// @param recipient the address of the recipient and beneficiary of the plan
  /// @param token the address of the ERC20 token
  /// @param amount the amount of tokens to be locked in the plan
  /// @param start the start date of the vesting plan, unix time
  /// @param cliff a cliff date which is a discrete date where tokens are not vested until this date, and then vest in a large single chunk on the cliff date
  /// @param rate the amount of tokens that vest in a single period
  /// @param period the amount of time in between each vesting time stamp, in seconds. A period of 1 means that tokens vest every second in a 'streaming' style.
  /// @param vestingAdmin is the address of an administrator in charge of revoking the plan, pulling back any unvested tokens to the vestingAdmin address
  /// @param adminTransferOBO is an optional toggle to allow the vestingAdmin to transfer a plan and NFT to another wallet on behalf of (OBO) a beneficiary. To be used only for emergencies.
  function createPlan(
    address recipient,
    address token,
    uint256 amount,
    uint256 start,
    uint256 cliff,
    uint256 rate,
    uint256 period,
    address vestingAdmin,
    bool adminTransferOBO
  ) external nonReentrant returns (uint256 newPlanId) {
    require(recipient != address(0), '0_recipient');
    require(token != address(0), '0_token');
    (uint256 end, bool valid) = TimelockLibrary.validateEnd(start, cliff, amount, rate, period);
    require(valid);
    _planIds.increment();
    newPlanId = _planIds.current();
    TransferHelper.transferTokens(token, msg.sender, address(this), amount);
    plans[newPlanId] = Plan(token, amount, start, cliff, rate, period, vestingAdmin, adminTransferOBO);
    _safeMint(recipient, newPlanId);
    emit PlanCreated(
      newPlanId,
      recipient,
      token,
      amount,
      start,
      cliff,
      end,
      rate,
      period,
      vestingAdmin,
      adminTransferOBO
    );
  }

  /// @notice function for a beneficiary to redeem vested tokens from a group of plans
  /// @dev this will call an internal function for processing the actual redemption of tokens, which will withdraw vested tokens and deliver them to the beneficiary
  /// @dev this function will redeem all claimable and vested tokens up to the current block.timestamp
  /// @param planIds is the array of the NFT planIds that are to be redeemed. If any have no redeemable balance they will be skipped.
  function redeemPlans(uint256[] calldata planIds) external nonReentrant {
    _redeemPlans(planIds, block.timestamp);
  }

  /// @notice function for a beneficiary to redeem vested tokens from a group of plans
  /// @dev this will call an internal function for processing the actual redemption of tokens, which will withdraw vested tokens and deliver them to the beneficiary
  /// @dev this function will redeem only a partial amount of tokens based on a redemption timestamp that is in the past. This allows holders to redeem less than their fully vested amount for various reasons
  /// @param planIds is the array of the NFT planIds that are to be redeemed. If any have no redeemable balance they will be skipped.
  /// @param redemptionTime is the timestamp which will calculate the amount of tokens redeemable and redeem them based on that timestamp
  function partialRedeemPlans(uint256[] calldata planIds, uint256 redemptionTime) external nonReentrant {
    require(redemptionTime < block.timestamp, '!future');
    _redeemPlans(planIds, redemptionTime);
  }

  /// @notice this function will redeem all plans owned by a single wallet - useful for custodians or other intermeidaries that do not have the ability to lookup individual planIds
  /// @dev this will iterate through all of the plans owned by the wallet based on the ERC721Enumerable backbone, and redeem each one with a redemption time of the current block.timestamp
  function redeemAllPlans() external nonReentrant {
    uint256 balance = balanceOf(msg.sender);
    uint256[] memory planIds = new uint256[](balance);
    for (uint256 i; i < balance; i++) {
      uint256 planId = tokenOfOwnerByIndex(msg.sender, i);
      planIds[i] = planId;
    }
    _redeemPlans(planIds, block.timestamp);
  }

  /// @notice the function for a vestingAdmin to revoke vesting plans.
  /// @dev this will call an internal function to revoke plans, whereby unvested tokens will be returned to the vestingAdmin, and any tokens that are vested will be delivered to the beneficiary(s)
  /// @param planIds is the array of the plan ids to be redeemed. the caller must be the vesting admin for all of the plans.
  function revokePlans(uint256[] calldata planIds) external nonReentrant {
    for (uint256 i; i < planIds.length; i++) {
      _revokePlan(planIds[i], block.timestamp);
    }
  }

  /// @notice this function allows a vesting admin to revoke a plan with a future date
  /// @dev different than the revokePlans function this takes an input time that is used for all of the plan revoking, which must be at least the current time stamp or future
  /// @param planIds is the array of the plan ids to be redeemed. the caller must be the vesting admin for all of the plans.
  /// @param revokeTime is the future time which the plans will be revoked effectively at
  function futureRevokePlans(uint256[] calldata planIds, uint256 revokeTime) external nonReentrant {
    require(revokeTime >= block.timestamp, '!past revoke');
    for (uint256 i; i < planIds.length; i++) {
      _revokePlan(planIds[i], revokeTime);
    }
  }

  /// @notice the function for a vestingAdmin to assing a new vestingAdmin wallet for a specific plan. Used in emergencies where DAOs are changing multi-sigs or other events
  /// @dev the new vesting admin address cannot be the beneficiary of the plan
  /// @param planId is the NFT token id of the plan
  /// @param newVestingAdmin is the address which the vesting admin of the plan will be assigned
  function changeVestingPlanAdmin(uint256 planId, address newVestingAdmin) external {
    Plan storage plan = plans[planId];
    require(msg.sender == plan.vestingAdmin, '!vestingAdmin');
    require(ownerOf(planId) != newVestingAdmin, '!planOwner');
    plan.vestingAdmin = newVestingAdmin;
    emit VestingPlanAdminChanged(planId, newVestingAdmin);
  }

  /****EXTERNAL VOTING & DELEGATION FUNCTIONS*********************************************************************************************************************************************/
  /// @notice delegation functions do not move any tokens and do not alter any information about the vesting plan object.
  /// the specifically delegate the NFTs using the ERC721Delegate.sol extension.
  /// Use the dedicated snapshot strategy 'hedgey-delegate' to leverage the delegation functions for voting with snapshot

  /// @notice function to delegate an individual NFT tokenId to another wallet address.
  /// @dev by default all plans are self delegated, this allows for the owner of a plan to delegate their NFT to a different address. This calls the internal _delegateToken function from ERC721Delegate.sol contract
  /// @param planId is the token Id of the NFT and vesting plan to be delegated
  /// @param delegatee is the address that the plan will be delegated to
  function delegate(uint256 planId, address delegatee) external {
    _delegateToken(delegatee, planId);
  }

  /// @notice functeion to delegate multiple plans to multiple delegates in a single transaction
  /// @dev this also calls the internal _delegateToken function from ERC721Delegate.sol to delegate an NFT to another wallet.
  /// @dev this function iterates through the array of plans and delegatees, delegating each individual NFT.
  /// @param planIds is the array of planIds that will be delegated
  /// @param delegatees is the array of addresses that each corresponding planId will be delegated to
  function delegatePlans(uint256[] calldata planIds, address[] calldata delegatees) external nonReentrant {
    require(planIds.length == delegatees.length, 'array error');
    for (uint256 i; i < planIds.length; i++) {
      _delegateToken(delegatees[i], planIds[i]);
    }
  }

  /// @notice function to delegate all plans related to a specific token to a single delegatee address
  /// @dev this function pulls the balances of a wallet, checks that the token in the vesting plan matches the token input param, and then delegates it to the delegatee
  /// @param token is the address of the ERC20 tokens that are locked in the vesting plans desired to be delegated
  /// @param delegatee is the address of the delegate that all of the NFTs / plans will be delegated to.
  function delegateAll(address token, address delegatee) external {
    uint256 balance = balanceOf(msg.sender);
    for (uint256 i; i < balance; i++) {
      uint256 planId = tokenOfOwnerByIndex(msg.sender, i);
      if (plans[planId].token == token) _delegateToken(delegatee, planId);
    }
  }

  /****CORE INTERNAL FUNCTIONS*********************************************************************************************************************************************/

  /// @notice function that will intake an array of planIds and a redemption time, and then check the balances that are available to be redeemed
  /// @dev if the nft has an available balance, it is then passed on to the _redeemPlan function for further processing
  /// if there is no balance to be redeemed, the plan is skipped from being processed
  /// @param planIds is the array of plans to be redeemed
  /// @param redemptionTime is the requested redemption time, either the current block.timestamp or a timestamp from the past, but must be greater than the start date
  function _redeemPlans(uint256[] memory planIds, uint256 redemptionTime) internal {
    for (uint256 i; i < planIds.length; i++) {
      (uint256 balance, uint256 remainder, uint256 latestUnlock) = planBalanceOf(
        planIds[i],
        block.timestamp,
        redemptionTime
      );
      if (balance > 0) _redeemPlan(planIds[i], balance, remainder, latestUnlock);
    }
  }

  /// @notice internal function that process the redemption for a single vesting plan
  /// @dev this takes the inputs from the _redeemPlans and processes the redemption delivering the available balance of redeemable tokens to the beneficiary
  /// if the plan is fully redeemed, as defined that the balance == amount, then the plan is deleted and NFT burned
  // if the plan is not fully redeemed, then the storage of start and amount are updated to reflect the remaining amount and most recent time redeemed for the new start date
  /// @param planId is the id of the vesting plan and NFT
  /// @param balance is the available redeemable balance
  /// @param remainder is the amount of tokens that are still unvested in the plan, and will be the new amount in the plan storage
  /// @param latestUnlock is the most recent timestamp for when redemption occured. Because periods may be longer than 1 second, the latestUnlock time may be the current block time, or the timestamp of the most recent period timestamp
  function _redeemPlan(uint256 planId, uint256 balance, uint256 remainder, uint256 latestUnlock) internal {
    require(ownerOf(planId) == msg.sender, '!owner');
    address token = plans[planId].token;
    if (remainder == 0) {
      delete plans[planId];
      _burn(planId);
    } else {
      plans[planId].amount = remainder;
      plans[planId].start = latestUnlock;
    }
    TransferHelper.withdrawTokens(token, msg.sender, balance);
    emit PlanRedeemed(planId, balance, remainder, latestUnlock);
  }

  /// @notice the internal function to revoke a vesting plan
  /// @dev this is called by the external revokePlans function, which inputs the msg.sender as the vestingAdmin and the planId from the inputs
  /// this function checks that the vestingAdmin is the vestingAdmin, and that there is actually a revokable balance.
  /// The function then withdraws the unvested tokens that are revoked, delivering them to the vestingAdmin
  /// the function will not automatically transfer the tokens to the plan beneficiary.
  /// If the vesting plan has no balance left, because the remainder is the entire amount then it will be burned and deleted
  /// otherwise the NFT will still exist, but the amount is set to the balance that is still to be vested so it can vest along the same time as its original vesting terms
  /// but the vestingAdmin is set to 0 address so that it cannot be revoked again or transferred
  /// if the plan has an external voting vault setup, then tokens will be withdrawn from the voting vault rather than this contract address
  /// finally the function deletes the plan held in storage and burns the NFT.
  /// @param planId is the id of the plan and NFT
  /// @param revokeTime is the time that the plan will be revoked effectively at, which can be in the future but not the past
  function _revokePlan(uint256 planId, uint256 revokeTime) internal {
    Plan memory plan = plans[planId];
    require(msg.sender == plan.vestingAdmin, '!vestingAdmin');
    (uint256 balance, uint256 remainder, ) = planBalanceOf(planId, block.timestamp, revokeTime);
    require(remainder > 0, '!Remainder');
    if (balance == 0) {
      delete plans[planId];
      _burn(planId);
    } else {
      plans[planId].amount = balance;
      plans[planId].vestingAdmin = address(0);
    }
    TransferHelper.withdrawTokens(plan.token, msg.sender, remainder);
    emit PlanRevoked(planId, balance, remainder);
  }

  /****VIEW VOTING FUNCTIONS*********************************************************************************************************************************************/

  /// @notice this function will pull all of the unclaimed tokens for a specific holder across all of their plans, based on a single ERC20 token
  /// very useful for snapshot voting, and other view functionalities
  /// @param holder is the address of the beneficiary who owns the vesting plan(s)
  /// @param token is the ERC20 address of the token that is stored across the vesting plans
  function lockedBalances(address holder, address token) external view returns (uint256 lockedBalance) {
    uint256 holdersBalance = balanceOf(holder);
    for (uint256 i; i < holdersBalance; i++) {
      uint256 planId = tokenOfOwnerByIndex(holder, i);
      Plan memory plan = plans[planId];
      if (token == plan.token) {
        lockedBalance += plan.amount;
      }
    }
  }

  /// @notice this function will pull all of the tokens locked in vesting plans where the NFT has been delegated to a specific delegatee wallet address
  /// this is useful for the snapshot strategy hedgey-delegate, polling this function based on the wallet signed into snapshot
  /// by default all NFTs are self-delegated when they are minted.
  /// @param delegatee is the address of the delegate where NFTs have been delegated to
  /// @param token is the address of the ERC20 token that is locked in vesting plans and has been delegated
  function delegatedBalances(address delegatee, address token) external view returns (uint256 delegatedBalance) {
    uint256 delegateBalance = balanceOfDelegate(delegatee);
    for (uint256 i; i < delegateBalance; i++) {
      uint256 planId = tokenOfDelegateByIndex(delegatee, i);
      Plan memory plan = plans[planId];
      if (token == plan.token) {
        delegatedBalance += plan.amount;
      }
    }
  }

  /****NFT FRANSFER SPECIAL FUNCTIONS*********************************************************************************************************************************************/

  /// @notice a function for the owner of a vesting plan to toggle on or off the adminTransferOBO boolean
  /// @param planId is the id of the vesting plan
  /// @param transferrable is the boolean true or false that updates the plan struct for adminTransferOBO
  function toggleAdminTransferOBO(uint256 planId, bool transferrable) external nonReentrant {
    require(msg.sender == ownerOf(planId), '!owner');
    plans[planId].adminTransferOBO = transferrable;
    emit PlanVestingAdminTransferToggle(planId, transferrable);
  }

  ///  @notice special function to transfer an NFT that overrides the normal ERC721 transferFrom function.
  /// this function lets a vestingAdmin of a plan transfer the NFT on behalf of a the holder of an NFT.
  /// the vesting plan must have the adminTransferOBO toggle turned on to true for this function to be called.
  /// this functin cannot be called by the owner / beneficiary of the NFT and vesting plan.
  /// the to address cannot be the vestingAdmin address
  ///  @param from is the address the NFT and plan is transferred from
  ///  @param to is the address where the NFT and plan is being transferred to
  ///  @param tokenId is the NFT tokenID, the same as the planId to be transferred
  function transferFrom(address from, address to, uint256 tokenId) public override(IERC721, ERC721) {
    require(plans[tokenId].adminTransferOBO, '!transferrable');
    require(to != plans[tokenId].vestingAdmin, '!transfer to admin');
    require(msg.sender == plans[tokenId].vestingAdmin, '!vestingAdmin');
    _transfer(from, to, tokenId);
    emit PlanTransferredByVestingAdmin(tokenId, from, to);
  }

  /// @notice vesting plans are not transferable, with the exception of the above method.
  function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal override {
    revert('!transferrable');
  }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 25 : 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 5 of 25 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

        _owners[tokenId] = to;

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

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

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

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

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

        // Clear approvals
        delete _tokenApprovals[tokenId];

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId, 1);

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

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

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

        emit Transfer(from, to, tokenId);

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

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

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

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

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

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

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

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

File 7 of 25 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);

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

        uint256 tokenId = firstTokenId;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 25 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 9 of 25 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 10 of 25 : 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 25 : 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 25 : 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 13 of 25 : 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 14 of 25 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 15 of 25 : 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 25 : 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 25 : 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 25 : 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 25 : 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 25 : ERC721Delegate.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

import '../sharedContracts/PlanDelegator.sol';

abstract contract ERC721Delegate is PlanDelegator {
  event TokenDelegated(uint256 indexed tokenId, address indexed delegate);
  event DelegateRemoved(uint256 indexed tokenId, address indexed delegate);

  function _delegateToken(address delegate, uint256 tokenId) internal {
    require(_isApprovedDelegatorOrOwner(msg.sender, tokenId), '!delegator');
    _transferDelegate(delegate, tokenId);
  }

  // function for minting should add the token to the delegate and increase the balance
  function _addDelegate(address to, uint256 tokenId) private {
    require(to != address(0), '!address(0)');
    uint256 length = _delegateBalances[to];
    _delegatedTokens[to][length] = tokenId;
    _delegatedTokensIndex[tokenId] = length;
    _delegates[tokenId] = to;
    _delegateBalances[to] += 1;
    emit TokenDelegated(tokenId, to);
  }

  // function for burning should reduce the balances and set the token mapped to 0x0 address
  function _removeDelegate(uint256 tokenId) private {
    address from = _delegates[tokenId];
    require(from != address(0), '!address(0)');
    uint256 lastTokenIndex = _delegateBalances[from] - 1;
    uint256 tokenIndex = _delegatedTokensIndex[tokenId];
    if (tokenIndex != lastTokenIndex) {
      uint256 lastTokenId = _delegatedTokens[from][lastTokenIndex];
      _delegatedTokens[from][tokenIndex] = lastTokenId;
      _delegatedTokensIndex[lastTokenId] = tokenIndex;
    }
    delete _delegatedTokensIndex[tokenId];
    delete _delegatedTokens[from][lastTokenIndex];
    _delegateBalances[from] -= 1;
    _delegates[tokenId] = address(0);
    emit DelegateRemoved(tokenId, from);
  }

  // function for transfering should reduce the balances of from by 1, increase the balances of to by 1, and set the delegate address To
  function _transferDelegate(address to, uint256 tokenId) internal {
    _removeDelegate(tokenId);
    _addDelegate(to, tokenId);
  }

  //mapping from tokenId to the delegate address
  mapping(uint256 => address) private _delegates;

  // mapping from delegate address to token count
  mapping(address => uint256) private _delegateBalances;

  // mapping from delegate to the list of delegated token Ids
  mapping(address => mapping(uint256 => uint256)) private _delegatedTokens;

  // maping from token ID to the index of the delegates token list
  mapping(uint256 => uint256) private _delegatedTokensIndex;

  function balanceOfDelegate(address delegate) public view returns (uint256) {
    require(delegate != address(0), '!address(0)');
    return _delegateBalances[delegate];
  }

  function delegatedTo(uint256 tokenId) public view returns (address) {
    address delegate = _delegates[tokenId];
    return delegate;
  }

  function tokenOfDelegateByIndex(address delegate, uint256 index) public view returns (uint256) {
    require(index < _delegateBalances[delegate], 'out of bounds');
    return _delegatedTokens[delegate][index];
  }

  function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual override {
    super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
    uint256 tokenId = firstTokenId;
    if (from == address(0)) {
      _addDelegate(to, tokenId);
    }
    if (to == address(0)) { 
      _removeDelegate(tokenId);
    }
  }
}

File 21 of 25 : TimelockLibrary.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/// @notice Library to assist with calculation methods of the balances, ends, period amounts for a given plan
/// used by both the Lockup and Vesting Plans
library TimelockLibrary {
  function min(uint256 a, uint256 b) internal pure returns (uint256 _min) {
    _min = (a <= b) ? a : b;
  }

  /// @notice function to calculate the end date of a plan based on its start, amount, rate and period
  function endDate(uint256 start, uint256 amount, uint256 rate, uint256 period) internal pure returns (uint256 end) {
    end = (amount % rate == 0) ? (amount / rate) * period + start : ((amount / rate) * period) + period + start;
  }

  /// @notice function to calculate the end period and validate that the parameters passed in are valid
  function validateEnd(
    uint256 start,
    uint256 cliff,
    uint256 amount,
    uint256 rate,
    uint256 period
  ) internal pure returns (uint256 end, bool valid) {
    require(amount > 0, '0_amount');
    require(rate > 0, '0_rate');
    require(rate <= amount, 'rate > amount');
    require(period > 0, '0_period');
    end = (amount % rate == 0) ? (amount / rate) * period + start : ((amount / rate) * period) + period + start;
    require(cliff <= end, 'cliff > end');
    valid = true;
  }

  /// @notice function to calculate the unlocked (claimable) balance, still locked balance, and the most recent timestamp the unlock would take place
  /// the most recent unlock time is based on the periods, so if the periods are 1, then the unlock time will be the same as the redemption time,
  /// however if the period more than 1 second, the latest unlock will be a discrete time stamp
  /// @param start is the start time of the plan
  /// @param cliffDate is the timestamp of the cliff of the plan
  /// @param amount is the total unclaimed amount tokens still in the vesting plan
  /// @param rate is the amount of tokens that unlock per period
  /// @param period is the seconds in each period, a 1 is a period of 1 second whereby tokens unlock every second
  /// @param currentTime is the current time being evaluated, typically the block.timestamp, but used just to check the plan is past the start or cliff
  /// @param redemptionTime is the time requested for the plan to be redeemed, this can be the same as the current time or prior to it for partial redemptions
  function balanceAtTime(
    uint256 start,
    uint256 cliffDate,
    uint256 amount,
    uint256 rate,
    uint256 period,
    uint256 currentTime,
    uint256 redemptionTime
  ) internal pure returns (uint256 unlockedBalance, uint256 lockedBalance, uint256 unlockTime) {
    if (start > currentTime || cliffDate > currentTime || redemptionTime <= start) {
      lockedBalance = amount;
      unlockTime = start;
    } else {
      uint256 periodsElapsed = (redemptionTime - start) / period;
      uint256 calculatedBalance = periodsElapsed * rate;
      unlockedBalance = min(calculatedBalance, amount);
      lockedBalance = amount - unlockedBalance;
      unlockTime = start + (period * periodsElapsed);
    }
  }

  function calculateCombinedRate(
    uint256 combinedAmount,
    uint256 combinedRates,
    uint256 start,
    uint256 period,
    uint256 targetEnd
  ) internal pure returns (uint256 rate, uint256 end) {
    uint256 numerator = combinedAmount * period;
    uint256 denominator = (combinedAmount % combinedRates == 0) ? targetEnd - start : targetEnd - start - period;
    rate = numerator / denominator;
    end = endDate(start, combinedAmount, rate, period);
  }

  function calculateSegmentRates(
    uint256 originalRate,
    uint256 originalAmount,
    uint256 planAmount,
    uint256 segmentAmount,
    uint256 start,
    uint256 end,
    uint256 period,
    uint256 cliff
  ) internal pure returns (uint256 planRate, uint256 segmentRate, uint256 planEnd, uint256 segmentEnd) {
    planRate = (originalRate * ((planAmount * (10 ** 18)) / originalAmount)) / (10 ** 18);
    segmentRate = (segmentAmount % (originalRate - planRate) == 0)
      ? (segmentAmount * period) / (end - start)
      : (segmentAmount * period) / (end - start - period);
    bool validPlanEnd;
    bool validSegmentEnd;
    (planEnd, validPlanEnd) = validateEnd(start, cliff, planAmount, planRate, period);
    (segmentEnd, validSegmentEnd) = validateEnd(start, cliff, segmentAmount, segmentRate, period);
    require(validPlanEnd && validSegmentEnd, 'invalid end date');
  }
}

File 22 of 25 : TransferHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';


/// @notice Library to help safely transfer tokens and handle ETH wrapping and unwrapping of WETH
library TransferHelper {
  using SafeERC20 for IERC20;

  /// @notice Internal function used for standard ERC20 transferFrom method
  /// @notice it contains a pre and post balance check
  /// @notice as well as a check on the msg.senders balance
  /// @param token is the address of the ERC20 being transferred
  /// @param from is the remitting address
  /// @param to is the location where they are being delivered
  function transferTokens(
    address token,
    address from,
    address to,
    uint256 amount
  ) internal {
    uint256 priorBalance = IERC20(token).balanceOf(address(to));
    require(IERC20(token).balanceOf(from) >= amount, 'THL01');
    SafeERC20.safeTransferFrom(IERC20(token), from, to, amount);
    uint256 postBalance = IERC20(token).balanceOf(address(to));
    require(postBalance - priorBalance == amount, 'THL02');
  }

  /// @notice Internal function is used with standard ERC20 transfer method
  /// @notice this function ensures that the amount received is the amount sent with pre and post balance checking
  /// @param token is the ERC20 contract address that is being transferred
  /// @param to is the address of the recipient
  /// @param amount is the amount of tokens that are being transferred
  function withdrawTokens(
    address token,
    address to,
    uint256 amount
  ) internal {
    uint256 priorBalance = IERC20(token).balanceOf(address(to));
    SafeERC20.safeTransfer(IERC20(token), to, amount);
    uint256 postBalance = IERC20(token).balanceOf(address(to));
    require(postBalance - priorBalance == amount, 'THL02');
  }

}

File 23 of 25 : PlanDelegator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';

abstract contract PlanDelegator is ERC721Enumerable {
  // mapping of tokenId to address who can delegate an NFT on behalf of the owner
  /// @dev follows tokenApprovals logic
  mapping(uint256 => address) private _approvedDelegators;

  /// @dev operatorApprovals simialr to ERC721 standards
  mapping(address => mapping(address => bool)) private _approvedOperatorDelegators;

  /// @dev event that is emitted when a single plan delegator has been approved
  event DelegatorApproved(uint256 indexed id, address owner, address delegator);

  /// @dev event emit when the operator delegator has been approved to manage all delegation of a single address
  event ApprovalForAllDelegation(address owner, address operator, bool approved);

  /// @notice function to assign a single planId to a delegator. The delegator then has authority to call functions on other contracts such as delegate
  /// @param delegator is the address of the delegator who can delegate on behalf of the nft owner
  /// @param planId is the id of the vesting or lockup plan
  function approveDelegator(address delegator, uint256 planId) public virtual {
    address owner = ownerOf(planId);
    require(msg.sender == owner || isApprovedForAllDelegation(owner, msg.sender), '!ownerOperator');
    require(delegator != msg.sender, '!self approval');
    _approveDelegator(delegator, planId);
  }

  /// @notice function that performs both the approveDelegator function and approves a spender
  /// @param spender is the address who is approved to spend and is also a Delegator
  /// @param planId is the vesting plan id
  function approveSpenderDelegator(address spender, uint256 planId) public virtual {
    address owner = ownerOf(planId);
    require(
      msg.sender == owner || (isApprovedForAllDelegation(owner, msg.sender) && isApprovedForAll(owner, msg.sender)),
      '!ownerOperator'
    );
    require(spender != msg.sender, '!self approval');
    _approveDelegator(spender, planId);
    _approve(spender, planId);
  }

  /// @notice this function sets an address to be an operator delegator for the msg.sender, whereby the operator can delegate all tokens owned by the msg.sender
  /// the operator can also approve other single plan delegators
  /// @param operator address of the operator for the msg.sender
  /// @param approved boolean for approved if true, and false if not
  function setApprovalForAllDelegation(address operator, bool approved) public virtual {
    _setApprovalForAllDelegation(msg.sender, operator, approved);
  }

  /// @notice functeion to set the approval operator for both delegation and for spending NFTs of the msg.sender
  /// @param operator is the address who will be allowed to spend and delegate
  /// @param approved is the bool determining if they are allowed or not
  function setApprovalForOperator(address operator, bool approved) public virtual {
    _setApprovalForAllDelegation(msg.sender, operator, approved);
    _setApprovalForAll(msg.sender, operator, approved);
  }

  /// @notice internal function to update the storage of approvedDelegators and emit the event
  function _approveDelegator(address delegator, uint256 planId) internal virtual {
    _approvedDelegators[planId] = delegator;
    emit DelegatorApproved(planId, ownerOf(planId), delegator);
  }

  /// @notice internal function to update the storage of approvedOperatorDelegators, and emit the event
  function _setApprovalForAllDelegation(address owner, address operator, bool approved) internal virtual {
    require(owner != operator, '!operator');
    _approvedOperatorDelegators[owner][operator] = approved;
    emit ApprovalForAllDelegation(owner, operator, approved);
  }

  /// @notice we call the beforeTokenTransfer hook to delete the approvedDelegators storage variable so that the Delegator approval does not travel with the NFT when transferred
  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 firstTokenId,
    uint256 batchSize
  ) internal virtual override {
    super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
    delete _approvedDelegators[firstTokenId];
  }

  /// @notice function to get the approved delegator of a single planId
  function getApprovedDelegator(uint256 planId) public view returns (address) {
    _requireMinted(planId);
    return _approvedDelegators[planId];
  }

  /// @notice function to evaluate if an operator is approved to manage delegations of an owner address
  function isApprovedForAllDelegation(address owner, address operator) public view returns (bool) {
    return _approvedOperatorDelegators[owner][operator];
  }

  /// @notice internal view function to determine if a delegator, typically the msg.sender is allowed to delegate a token, based on being either the Owner, Delegator or Operator.
  function _isApprovedDelegatorOrOwner(address delegator, uint256 planId) internal view returns (bool) {
    address owner = ownerOf(planId);
    return (delegator == owner ||
      isApprovedForAllDelegation(owner, delegator) ||
      getApprovedDelegator(planId) == delegator);
  }
}

File 24 of 25 : URIAdmin.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

contract URIAdmin {
    /// @dev baseURI is the URI directory where the metadata is stored
  string public baseURI;
  /// @dev bool to ensure uri has been set before admin can be deleted
  bool internal uriSet;
  /// @dev admin for setting the baseURI;
  address internal uriAdmin;

  /// @notice event for when a new URI is set for the NFT metadata linking
  event URISet(string newURI);

  /// @notice event for when the URI admin is deleted
  event URIAdminDeleted(address _admin);


  /// @notice function to set the base URI after the contract has been launched, only the admin can call
  /// @param _uri is the new baseURI for the metadata
  function updateBaseURI(string memory _uri) external {
    require(msg.sender == uriAdmin, '!ADMIN');
    baseURI = _uri;
    uriSet = true;
    emit URISet(_uri);
  }

  /// @notice function to delete the admin once the uri has been set
  function deleteAdmin() external {
    require(msg.sender == uriAdmin, '!ADMIN');
    require(uriSet, '!SET');
    delete uriAdmin;
    emit URIAdminDeleted(msg.sender);
  }
}

File 25 of 25 : VestingStorage.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import '../libraries/TimelockLibrary.sol';

/// @notice This is the storage contract for the Vesting Plans
/// it contains the logic of the vesting plan object (struct), as well as the events that are utilized and emitted by the contracts

contract VestingStorage {
  /// @dev the Plan is the storage in a struct of the tokens that are currently being vested
  /// @param token is the token address being timelocked
  /// @param amount is the current amount of tokens locked in the vesting plan, both unclaimed vested and unvested tokens. This parameter is updated each time tokens are redeemed, reset to the new remaining unvested and unclaimed amount
  /// @param start is the start date when token vesting begins or began. This parameter gets updated each time tokens are redeemed and claimed, reset to the most recent redeem time
  /// @param cliff is an optional field to add a single cliff date prior to which the tokens cannot be redeemed, this does not change
  /// @param rate is the amount of tokens that vest in a period. This parameter is constand for each plan. 
  /// @param period is the length of time in between each discrete time when tokens vest. If this is set to 1, then tokens unlocke every second. Otherwise the period is longer to allow for interval vesting plans. 
  /// @param vestingAdmin is the adress of the administrator of the plans who can revoke plans at any time prior to them fully vesting. They may also be allowed to transfer plans on behalf of the beneficiary. 
  /// @param adminTransferOBO is a toggle that when true allows a vesting admin to transfer plans on behalf of (OBO) beneficiaries to another wallet. This is really just used for emergencies. 
  struct Plan {
    address token;
    uint256 amount;
    uint256 start;
    uint256 cliff;
    uint256 rate;
    uint256 period;
    address vestingAdmin;
    bool adminTransferOBO;
  }

  /// @dev a mapping of the planId to the Plan struct. This is also mapped of the NFT token ID to the Plan struct, as the planId is the NFT token Id. 
  mapping(uint256 => Plan) public plans;

  ///@notice event emitted when a new vesting plan is created, emits the NFT and planId, as well as all of the info from the plan struct
  event PlanCreated(
    uint256 indexed id,
    address indexed recipient,
    address indexed token,
    uint256 amount,
    uint256 start,
    uint256 cliff,
    uint256 end,
    uint256 rate,
    uint256 period,
    address vestingAdmin,
    bool adminTransferOBO
  );

  /// @notice event emitted when a beneficiary redeems some or all of the tokens in their plan. 
  /// It emits the id of the plan, as well as the amount redeemed, any remaining unvested or unclaimed tokens and the date that was the effective new start date, the reset date. 
  event PlanRedeemed(uint256 indexed id, uint256 amountRedeemed, uint256 planRemainder, uint256 resetDate);

  /// @notice event that is emitted when a plan is revoked. emits the plan Id as well as the amount that is vested and redeemed to the beneficiary, and the amount that is revoked and sent to the vesting admin. 
  event PlanRevoked(uint256 indexed id, uint256 amountRedeemed, uint256 revokedAmount);

  /// @notice event emitted when a vesting admin changes itself, assigning a new vesting admin to the plan
  event VestingPlanAdminChanged(uint256 indexed id, address _newVestingAdmin);

  /// @notice event emitted when a plan admin transfers an plan and NFT on behalf of a beneficiary from one wallet address to another
  event PlanTransferredByVestingAdmin(uint256 indexed id, address indexed from, address indexed to);

  event PlanVestingAdminTransferToggle(uint256 indexed id, bool transferable);

  /// @notice public function to get the balance of a plan, this function is used by the contracts to calculate how much can be redeemed and revoked, and how to reset the start date
  /// @param planId is the NFT token ID and plan Id
  /// @param timeStamp is the effective current time stamp, can be polled for the future for estimating redeemable tokens
  /// @param redemptionTime is the time of the request that the user is attemptint to redeem tokens, which can be prior to the timeStamp, though not beyond it. 
  function planBalanceOf(
    uint256 planId,
    uint256 timeStamp,
    uint256 redemptionTime
  ) public view returns (uint256 balance, uint256 remainder, uint256 latestUnlock) {
    Plan memory plan = plans[planId];
    (balance, remainder, latestUnlock) = TimelockLibrary.balanceAtTime(
      plan.start,
      plan.cliff,
      plan.amount,
      plan.rate,
      plan.period,
      timeStamp,
      redemptionTime
    );
  }

  /// @dev function to calculate the end date in seconds of a given vesting plan
  /// @param planId is the NFT token ID
  function planEnd(uint256 planId) public view returns (uint256 end) {
    Plan memory plan = plans[planId];
    end = TimelockLibrary.endDate(plan.start, plan.amount, plan.rate, plan.period);
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAllDelegation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"delegate","type":"address"}],"name":"DelegateRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"delegator","type":"address"}],"name":"DelegatorApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cliff","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"address","name":"vestingAdmin","type":"address"},{"indexed":false,"internalType":"bool","name":"adminTransferOBO","type":"bool"}],"name":"PlanCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRedeemed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"planRemainder","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resetDate","type":"uint256"}],"name":"PlanRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRedeemed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"revokedAmount","type":"uint256"}],"name":"PlanRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PlanTransferredByVestingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bool","name":"transferable","type":"bool"}],"name":"PlanVestingAdminTransferToggle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"delegate","type":"address"}],"name":"TokenDelegated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_admin","type":"address"}],"name":"URIAdminDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"URISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"_newVestingAdmin","type":"address"}],"name":"VestingPlanAdminChanged","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"},{"internalType":"uint256","name":"planId","type":"uint256"}],"name":"approveDelegator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"planId","type":"uint256"}],"name":"approveSpenderDelegator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"}],"name":"balanceOfDelegate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"newVestingAdmin","type":"address"}],"name":"changeVestingPlanAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"vestingAdmin","type":"address"},{"internalType":"bool","name":"adminTransferOBO","type":"bool"}],"name":"createPlan","outputs":[{"internalType":"uint256","name":"newPlanId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegateAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"planIds","type":"uint256[]"},{"internalType":"address[]","name":"delegatees","type":"address[]"}],"name":"delegatePlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"delegatedBalances","outputs":[{"internalType":"uint256","name":"delegatedBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"delegatedTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"planIds","type":"uint256[]"},{"internalType":"uint256","name":"revokeTime","type":"uint256"}],"name":"futureRevokePlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"}],"name":"getApprovedDelegator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAllDelegation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"lockedBalances","outputs":[{"internalType":"uint256","name":"lockedBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"planIds","type":"uint256[]"},{"internalType":"uint256","name":"redemptionTime","type":"uint256"}],"name":"partialRedeemPlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256","name":"timeStamp","type":"uint256"},{"internalType":"uint256","name":"redemptionTime","type":"uint256"}],"name":"planBalanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"remainder","type":"uint256"},{"internalType":"uint256","name":"latestUnlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"}],"name":"planEnd","outputs":[{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"plans","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"vestingAdmin","type":"address"},{"internalType":"bool","name":"adminTransferOBO","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemAllPlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"planIds","type":"uint256[]"}],"name":"redeemPlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"planIds","type":"uint256[]"}],"name":"revokePlans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAllDelegation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"bool","name":"transferrable","type":"bool"}],"name":"toggleAdminTransferOBO","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfDelegateByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"updateBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052346200033c5762003f3a803803806200001d8162000341565b9283398101906040818303126200033c5780516001600160401b03908181116200033c57836200004f91840162000367565b91602093848201518381116200033c576200006b920162000367565b825190828211620003265760008054926001958685811c951680156200031b575b8886101462000307578190601f95868111620002b4575b5088908683116001146200025057849262000244575b5050600019600383901b1c191690861b1781555b8151938411620002305784548581811c9116801562000225575b878210146200021157838111620001c9575b50859284116001146200016457839495509262000158575b5050600019600383901b1c191690821b1781555b60115560138054610100600160a81b0319163360081b610100600160a81b0316179055604051613b609081620003da8239f35b01519050388062000111565b9190601f1984169585845280842093905b878210620001b15750508385961062000197575b505050811b01815562000125565b015160001960f88460031b161c1916905538808062000189565b80878596829496860151815501950193019062000175565b8582528682208480870160051c82019289881062000207575b0160051c019086905b828110620001fb575050620000f9565b838155018690620001eb565b92508192620001e2565b634e487b7160e01b82526022600452602482fd5b90607f1690620000e7565b634e487b7160e01b81526041600452602490fd5b015190503880620000b9565b8480528985208994509190601f198416865b8c8282106200029d575050841162000283575b505050811b018155620000cd565b015160001960f88460031b161c1916905538808062000275565b8385015186558c9790950194938401930162000262565b9091508380528884208680850160051c8201928b8610620002fd575b918a91869594930160051c01915b828110620002ee575050620000a3565b8681558594508a9101620002de565b92508192620002d0565b634e487b7160e01b83526022600452602483fd5b94607f16946200008c565b634e487b7160e01b600052604160045260246000fd5b600080fd5b6040519190601f01601f191682016001600160401b038111838210176200032657604052565b919080601f840112156200033c5782516001600160401b03811162000326576020906200039d601f8201601f1916830162000341565b928184528282870101116200033c5760005b818110620003c557508260009394955001015290565b8581018301518482018401528201620003af56fe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a7146122dc57508063050fbad714611bb757806306fdde0314611b14578063081812fc14611af657806308bbb82414611ad2578063095ea7b3146119a157806316c099671461192d57806318160ddd1461190f5780631f25ccb61461188957806323b872dd146114da57806323ed81fb1461140f5780632f745c59146113e8578063402d5a77146113ca57806342842e0e146113975780634c6839cc146113745780634f6ccce7146112e357806352e5b7e4146111f05780636352211e146111c05780636b040218146111635780636b8e3d73146110705780636bb3c73f1461103c5780636c0360eb1461102057806370a0823114610ffd5780637b4e51f614610fc75780637e5d8b4d14610f2c57806388cccd8014610f01578063931688cb14610ceb57806395d89b4114610c0c578063968b3e5914610bbe5780639e866c4714610b5d578063a22cb46514610b32578063a414159614610a78578063a8973e2b1461099d578063b162061614610916578063b6f97787146108c0578063b88d4fde14610768578063b9bdac2c146106db578063c3ca57551461060b578063c7711c4c1461056f578063c7d74fa71461052d578063c87b56dd14610314578063d0c524b71461028d578063dc1fa5681461025e5763e985e9c51461020357600080fd5b346102595760403660031901126102595761021c612361565b610224612377565b9060018060a01b03809116600052600560205260406000209116600052602052602060ff604060002054166040519015158152f35b600080fd5b3461025957604036600319011261025957602061028561027c612361565b602435906129b2565b604051908152f35b346102595761029b36612449565b90916102a5612a22565b4282106102e05760005b8381106102bd576001601155005b806102d6846102d06102db948887612ea2565b3561331d565b612e7f565b6102af565b60405162461bcd60e51b815260206004820152600c60248201526b2170617374207265766f6b6560a01b6044820152606490fd5b34610259576020806003193601126102595760043560008181526002602052604090205461034c906001600160a01b03161515612694565b8161035561250d565b80519092901561051457600090807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008181811015610506575b5050836d04ee2d6d415b85acef8100000000808310156104fa575b5050662386f26fc10000808210156104ed575b506305f5e100808210156104e0575b50612710808210156104d3575b5060648110156104c5575b600a809110156104bb575b6001808401928160216104146103fe876125cb565b9661040c60405198896124ec565b8088526125cb565b8689019790601f1901368937860101905b610485575b505050509261046b929161045f946040519583610450889551809288808901910161239c565b8401915180938684019061239c565b010380845201826124ec565b905b6104816040519282849384528301906123bf565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156104b657919082610425565b61042a565b91600101916103e9565b6064600291049201916103de565b60049104920191866103d3565b60089104920191866103c6565b60109104920191866103b7565b930192900483876103a4565b604094500490508680610389565b505050604051610523816124d1565b600081529061046d565b3461025957606036600319011261025957610481610552604435602435600435613a18565b604080519384526020840192909252908201529081906060820190565b346102595760003660031901126102595760135461059b33600883901c6001600160a01b0316146139e3565b60ff8116156105e057610100600160a81b0319166013556040513381527fa775782c93424d570e142a52abffaedcebb0e9cd73cca502455acb0587efb6b790602090a1005b606460405162461bcd60e51b81526020600482015260046024820152630854d15560e21b6044820152fd5b346102595760203660031901126102595760043560005260106020526020604060002060405161063a816124b5565b60018060a01b03808354168252600183015480858401526002840154928360408201526003850154606082015260e060ff60048701549485608085015260066005890154988960a0870152015490811660c085015260a01c1615159101526106a282826134f7565b6106c157926106b76106bc9261028595612933565b613501565b612c42565b926106bc816106b76106bc946106d697612933565b610285565b34610259576000366003190112610259576106f4612a22565b6106fd3361261d565b61070681612e1a565b9061071460405192836124ec565b808252601f1961072382612e1a565b0136602084013760005b8181106107455761073e4284612f9b565b6001601155005b806107536107639233612858565b61075d8286612e8e565b52612e7f565b61072d565b3461025957608036600319011261025957610781612361565b5061078a612377565b506044356064356001600160401b0381116102595736602382011215610259576107be9036906024816004013591016125e6565b506001600160a01b0390816107d2826126e0565b1691823314928315610899575b508215610883575b5050156108285760405162461bcd60e51b815260206004820152600e60248201526d217472616e736665727261626c6560901b6044820152606490fd5b0390fd5b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b9091506108903392612706565b161481806107e7565b909250600052600560205260406000203360005260205260ff6040600020541691836107df565b34610259576040366003190112610259576108d9612361565b6108e1612377565b9060018060a01b03809116600052600b60205260406000209116600052602052602060ff604060002054166040519015158152f35b34610259576020366003190112610259576004356000526010602052610100604060002060ff60018060a01b03918281541692600182015491600281015460038201546004830154916006600585015494015495604051988952602089015260408801526060870152608086015260a0850152811660c084015260a01c16151560e0820152f35b34610259576040366003190112610259576001600160401b03600435818111610259576109ce903690600401612419565b91602435908111610259576109e7903690600401612419565b6109f2929192612a22565b808403610a455760005b848110610a0a576001601155005b610a15818386612ea2565b35906001600160a01b0382168203610259576102d6610a4092610a39838988612ea2565b3590612eee565b6109fc565b60405162461bcd60e51b815260206004820152600b60248201526a30b93930bc9032b93937b960a91b6044820152606490fd5b3461025957604036600319011261025957610adb610a94612361565b60243590610acc6001600160a01b0380610aad856126e0565b168033148015610add575b610ac29150613816565b8216331415613853565b610ad68282613890565b612744565b005b5080600052600b60205260406000203360005260205260ff6040600020541680610b0c575b610ac29150610ab8565b506000526005602052604060002033600052602052610ac260ff60406000205416610b02565b3461025957604036600319011261025957610adb610b4e612361565b610b5661238d565b90336127a1565b34610259576020366003190112610259576004356001600160401b03811161025957610b8d903690600401612419565b610b95612a22565b60005b818110610ba6576001601155005b610bb9906102d6426102d0838688612ea2565b610b98565b34610259576020366003190112610259576004356001600160401b03811161025957610c07610bf461073e923690600401612419565b9190610bfe612a22565b42923691612e31565b612f9b565b346102595760003660031901126102595760405160006001805490610c308261247b565b80855291818116908115610cc45750600114610c6b575b61048184610c57818603826124ec565b6040519182916020835260208301906123bf565b600081815292507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610cac575050508101602001610c5782610c47565b80546020858701810191909152909301928101610c94565b60ff191660208087019190915292151560051b85019092019250610c579150839050610c47565b3461025957602080600319360112610259576001600160401b0390600435828111610259573660238201121561025957610d2f9036906024816004013591016125e6565b90610d4860018060a01b0360135460081c1633146139e3565b8151928311610eeb57610d5c60125461247b565b601f8111610e87575b508092601f8111600114610de457807fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912894600091610dd9575b508160011b916000199060031b1c1916176012555b600160ff196013541617601355610dd46040519282849384528301906123bf565b0390a1005b905083015185610d9e565b601f1981169360126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34449460005b818110610e7057509482916001937fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c91289710610e57575b5050811b01601255610db3565b85015160001960f88460031b161c191690558580610e4a565b858301518755600190960195918401918401610e14565b60126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444601f850160051c810191838610610ee1575b601f0160051c01905b818110610ed55750610d65565b60008155600101610ec8565b9091508190610ebf565b634e487b7160e01b600052604160045260246000fd5b3461025957604036600319011261025957610adb610f1d612361565b610f2561238d565b90336138f7565b34610259576040366003190112610259576004357f15e344fba3d60744c30f71eed830999cdb736cf0f1d09f414983adbaeb55d2a66020610f6b61238d565b610f73612a22565b610f8f6001600160a01b03610f87866126e0565b1633146130c7565b60008481526010835260409020600601805460ff60a01b191682151560a01b60ff60a01b161790556040519015158152a26001601155005b3461025957604036600319011261025957610adb610fe3612361565b610feb61238d565b90610ff78282336138f7565b336127a1565b3461025957602036600319011261025957602061028561101b612361565b61261d565b3461025957600036600319011261025957610481610c5761250d565b3461025957602036600319011261025957600435600052600c602052602060018060a01b0360406000205416604051908152f35b3461025957604036600319011261025957611089612361565b611091612377565b60009161109d8161298d565b916001600160a01b039081169160005b8481106110bf57602086604051908152f35b6110c981836129b2565b60005260206010815260406000206040516110e3816124b5565b60e060ff878454169384845260018101548096850152600281015460408501526003810154606085015260048101546080850152600660058201549160a0928387015201549089821660c08601521c161515910152851461114e575b5061114990612e7f565b6110ad565b61115c906111499297612c42565b959061113f565b346102595761117136612449565b9061117a612a22565b428210156111915761073e92610c07913691612e31565b60405162461bcd60e51b81526020600482015260076024820152662166757475726560c81b6044820152606490fd5b346102595760203660031901126102595760206111de6004356126e0565b6040516001600160a01b039091168152f35b3461025957604036600319011261025957611209612361565b611211612377565b60009161121d8161261d565b916001600160a01b039081169160005b84811061123f57602086604051908152f35b6112498183612858565b6000526020601081526040600020604051611263816124b5565b60e060ff878454169384845260018101548096850152600281015460408501526003810154606085015260048101546080850152600660058201549160a0928387015201549089821660c08601521c16151591015285146112ce575b506112c990612e7f565b61122d565b6112dc906112c99297612c42565b95906112bf565b346102595760203660031901126102595760043560085481101561131a5761130c6020916128e6565b90546040519160031b1c8152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b34610259576020366003190112610259576020610285611392612361565b61298d565b34610259576113a5366123e4565b91505060006040516113b6816124d1565b526001600160a01b0390816107d2826126e0565b346102595760203660031901126102595760206111de6004356139a5565b34610259576040366003190112610259576020610285611406612361565b60243590612858565b346102595760403660031901126102595760043561142b612377565b6000828152601060205260409020600601805490916001600160a01b03906114563383851614612eb2565b81611460866126e0565b9116911681146114a8577f423d5f6f62e79d3e51b096bd7715b454f212603530cdca551d6a37554889725a92816020936001600160601b0360a01b16179055604051908152a2005b60405162461bcd60e51b815260206004820152600a60248201526910b83630b727bbb732b960b11b6044820152606490fd5b34610259576114e8366123e4565b806000939293526020916010835260069360ff856040600020015460a01c161561185357600083815260108552604090208501546001600160a01b03828116969095918616871461181957846000526010825261154f868260406000200154163314612eb2565b8561156861155c876126e0565b8683169816881461349d565b87156117c85786801595866000146116ef57505060085490866000526009845281604060002055600160401b821015610eeb57600294611610936115d0896115b78660018e98016008556128e6565b90919082549060031b91821b91600019901b1916179055565b838b036116b9575b5087600052600a8552876040600020976001600160601b0360a01b988981541690556116a9575b61160991506126e0565b161461349d565b83600052600481526040600020838154169055846000526003815260406000206000198154019055856000526040600020600181540190558360005252836040600020918254161790558083837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a47f52f56ec49519b0e1b434f05fcf39068afe732dec973010ca61efa6e0a087bdeb600080a4005b6116b291612c4f565b89876115ff565b6116c28261261d565b908b600052865260406000208160005286528860406000205588600052600786526040600020558a6115d8565b8982949203611708575b509060029461161093926115d0565b61171391935061261d565b6000198101919082116117b257600294611610938993896000526007875260406000205481810361176e575b5089600052600060408120558460005281875260406000209060005286526000604081205591929350946116f9565b85600052828852604060002082600052885260406000205486600052838952604060002082600052895280604060002055600052600788526040600020558c61173f565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152600481018490526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b60405162461bcd60e51b815260048101839052601260248201527110ba3930b739b332b9103a379030b236b4b760711b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d217472616e736665727261626c6560901b6044820152606490fd5b34610259576040366003190112610259576118a2612361565b6118aa612377565b6118b33361261d565b6001600160a01b039283169290919060005b8381106118ce57005b806118dc6118fa9233612858565b806000526010602052868460406000205416146118ff575b50612e7f565b6118c5565b6119099085612eee565b866118f4565b34610259576000366003190112610259576020600854604051908152f35b3461025957604036600319011261025957610adb611949612361565b602435906119766001600160a01b0380611962856126e0565b16803314801561197b57610ac29150613816565b613890565b50600052600b602052604060002033600052602052610ac260ff60406000205416610ab8565b34610259576040366003190112610259576119ba612361565b6024356001600160a01b03806119cf836126e0565b168091841614611a8357803314908115611a5e575b50156119f357610adb91612744565b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b9050600052600560205260406000203360005260205260ff60406000205416836119e4565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b3461025957604036600319011261025957610adb600435611af1612377565b612eee565b346102595760203660031901126102595760206111de600435612706565b346102595760003660031901126102595760405160008054611b358161247b565b80845290600190818116908115610cc45750600114611b5e5761048184610c57818603826124ec565b600080805292507f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b828410611b9f575050508101602001610c5782610c47565b80546020858701810191909152909301928101611b87565b346102595761012036600319011261025957611bd1612361565b611bd9612377565b60e435916001600160a01b0383168303610259576101043591821515830361025957611c03612a22565b6001600160a01b038216156122a9576001600160a01b0381161561227a576044351561224a5760a4351561221c5760443560a435116121e75760c435156121b757611c5260a4356044356134f7565b61219557611c706064356106bc60c4356106b760a435604435612933565b905b81608435116121625760148054600101908190556040516370a0823160e01b81523060048201529094906020816024816001600160a01b0387165afa9081156120c557600091612130575b506040516370a0823160e01b81523360048201526020816024816001600160a01b0388165afa9081156120c5576000916120fe575b50604435116120d1576040516323b872dd60e01b60208201523360248201523060448201526044356064820152606481528060a08101106001600160401b0360a083011117610eeb5760a08101604052611d55906001600160a01b038516613548565b6040516370a0823160e01b8152306004820152906020826024816001600160a01b0388165afa9182156120c55760009261208f575b5090611d9c611da29260443592612cfc565b14613514565b611e8e604051611db1816124b5565b60018060a01b0384168152604435602082015260643560408201526060810160843581526006608083019260a435845260a0810160c435815260c082019460018060a01b038d16865260e083019488151586528c60005260106020526040806000209460018060a01b038151166001600160601b0360a01b8754161786556020810151600187015501516002850155516003840155516004830155516005820155019160018060a01b039051166001600160601b0360a01b83541617825551151581549060ff60a01b90151560a01b169060ff60a01b1916179055565b604051611e9a816124d1565b600080825286815260026020526040902054611ec2906001600160a01b031615155b15612acb565b6008549086600052600960205281604060002055600160401b821015610eeb57611ef9876115b7846001611fe696016008556128e6565b611f028661261d565b60018060a01b038716600052600660205260406000208160005260205287604060002055876000526007602052604060002055600a60205260406000206001600160601b0360a01b8154169055611f598787612c4f565b600087815260026020526040902054611f7c906001600160a01b03161515611ebc565b6001600160a01b0386166000818152600360209081526040808320805460010190558a83526002909152812080546001600160a01b031916831790558891907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a48686612b47565b156120765761010085927f6d5fb3665416b633057b4e53641a7dec63a802702a55e386df478871ea22af9b926020986040519660443588526064358b8901526084356040890152606088015260a435608088015260c43560a088015260018060a01b031660c0870152151560e086015260018060a01b03169460018060a01b031693a46001601155604051908152f35b60405162461bcd60e51b81528061082460048201612a78565b91506020823d6020116120bd575b816120aa602093836124ec565b8101031261025957905190611d9c611d8a565b3d915061209d565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260206004820152600560248201526454484c303160d81b6044820152606490fd5b90506020813d602011612128575b81612119602093836124ec565b81010312610259575188611cf2565b3d915061210c565b90506020813d60201161215a575b8161214b602093836124ec565b81010312610259575187611cbd565b3d915061213e565b60405162461bcd60e51b815260206004820152600b60248201526a18db1a5999880f88195b9960aa1b6044820152606490fd5b6121b16064356106bc60c43581816106b760a435604435612933565b90611c72565b60405162461bcd60e51b81526020600482015260086024820152670c17dc195c9a5bd960c21b6044820152606490fd5b60405162461bcd60e51b815260206004820152600d60248201526c1c985d19480f88185b5bdd5b9d609a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526006602482015265305f7261746560d01b6044820152606490fd5b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b60405162461bcd60e51b8152602060048201526007602482015266182fba37b5b2b760c91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a0c17dc9958da5c1a595b9d60aa1b6044820152606490fd5b34610259576020366003190112610259576004359063ffffffff60e01b82168092036102595760209163780e9d6360e01b811490811561231e575b5015158152f35b6380ac58cd60e01b811491508115612350575b811561233f575b5083612317565b6301ffc9a760e01b14905083612338565b635b5e139f60e01b81149150612331565b600435906001600160a01b038216820361025957565b602435906001600160a01b038216820361025957565b60243590811515820361025957565b60005b8381106123af5750506000910152565b818101518382015260200161239f565b906020916123d88151809281855285808601910161239c565b601f01601f1916010190565b6060906003190112610259576001600160a01b0390600435828116810361025957916024359081168103610259579060443590565b9181601f84011215610259578235916001600160401b038311610259576020808501948460051b01011161025957565b604060031982011261025957600435906001600160401b0382116102595761247391600401612419565b909160243590565b90600182811c921680156124ab575b602083101461249557565b634e487b7160e01b600052602260045260246000fd5b91607f169161248a565b61010081019081106001600160401b03821117610eeb57604052565b602081019081106001600160401b03821117610eeb57604052565b90601f801991011681019081106001600160401b03821117610eeb57604052565b60405190600082601254916125218361247b565b808352926001908181169081156125a9575060011461254a575b50612548925003836124ec565b565b6012600090815291507fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34445b84831061258e575061254893505081016020013861253b565b81935090816020925483858a01015201910190918592612575565b90506020925061254894915060ff191682840152151560051b8201013861253b565b6001600160401b038111610eeb57601f01601f191660200190565b9291926125f2826125cb565b9161260060405193846124ec565b829481845281830111610259578281602093846000960137010152565b6001600160a01b0316801561263d57600052600360205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b1561269b57565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b6000908152600260205260409020546001600160a01b0316612703811515612694565b90565b600081815260026020526040902054612729906001600160a01b03161515612694565b6000908152600460205260409020546001600160a01b031690565b600082815260046020526040902080546001600160a01b0319166001600160a01b0392831690811790915590612779836126e0565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6001600160a01b03918216929116908183146128135760207f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191836000526005825260406000208560005282526128088160406000209060ff801983541691151516179055565b6040519015158152a3565b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b6128618161261d565b82101561288d5760018060a01b0316600052600660205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b60085481101561291d5760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b634e487b7160e01b600052603260045260246000fd5b811561293d570490565b634e487b7160e01b600052601260045260246000fd5b1561295a57565b60405162461bcd60e51b815260206004820152600b60248201526a216164647265737328302960a81b6044820152606490fd5b6001600160a01b03166129a1811515612953565b600052600d60205260406000205490565b6001600160a01b03166000818152600d6020526040812054919290918110156129ed576040928252600e602052828220908252602052205490565b60405162461bcd60e51b815260206004820152600d60248201526c6f7574206f6620626f756e647360981b6044820152606490fd5b600260115414612a33576002601155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b15612ad257565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b3d15612b42573d90612b28826125cb565b91612b3660405193846124ec565b82523d6000602084013e565b606090565b9091600091803b15612c3957612b926020918493604051948580948193630a85bd0160e11b9a8b845233600485015284602485015260448401526080606484015260848301906123bf565b03926001600160a01b03165af190829082612bea575b5050612bdc57612bb6612b17565b80519081612bd75760405162461bcd60e51b81528061082460048201612a78565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612c31575b81612c06602093836124ec565b81010312612c2d5751906001600160e01b031982168203612c2a5750903880612ba8565b80fd5b5080fd5b3d9150612bf9565b50505050600190565b919082018092116117b257565b6001600160a01b031690612c64821515612953565b60008281526020600d8152600d60409182842054600e825283852081865282528584862055858552600f825283852055600c8152828420866001600160601b0360a01b82541617905585845252812080549060018201809211612ce857557fcd57880fa6fb6b4aedb77272d2cfa8d03186b5034f9b672ccfcd3cd6edfecc9b9080a3565b634e487b7160e01b83526011600452602483fd5b919082039182116117b257565b6000818152600c60209081526040808320546001600160a01b0316939291612d32851515612953565b848352600d81528183205460001990818101908111612dcf57858552600f835283852054818103612de3575b508585528484812055868552600e835283852090855282528383812055858452600d82528284208054918201918211612dcf5755838352600c9052812080546001600160a01b03191690557f09f87139523b83583b15f476015dd9a27fae3a03f17202cdf77d063bef5d21c29080a3565b634e487b7160e01b85526011600452602485fd5b878652600e8452848620828752845284862054888752600e8552858720828852855280868820558652600f84528486205538612d5e565b6001600160401b038111610eeb5760051b60200190565b9291612e3c82612e1a565b91612e4a60405193846124ec565b829481845260208094019160051b810192831161025957905b828210612e705750505050565b81358152908301908301612e63565b60001981146117b25760010190565b805182101561291d5760209160051b010190565b919081101561291d5760051b0190565b15612eb957565b60405162461bcd60e51b815260206004820152600d60248201526c10bb32b9ba34b733a0b236b4b760991b6044820152606490fd5b906001600160a01b0380612f01836126e0565b1690813314918215612f74575b508115612f60575b5015612f2e5761254891612f2982612d09565b612c4f565b60405162461bcd60e51b815260206004820152600a60248201526910b232b632b3b0ba37b960b11b6044820152606490fd5b339150612f6c836139a5565b161438612f16565b909150600052600b60205260406000203360005260205260ff604060002054169038612f0e565b919091600090815b81518110156130c057612fd590612fc58642612fbf8487612e8e565b51613a18565b919081612fda575b505050612e7f565b612fa3565b7fa6faee2246474597b6de7c76bf9a45d256737543cb0806e6e805b55b38c7663f916130a56130098689612e8e565b51948961308a84613019896126e0565b6001600160a01b039061302f90821633146130c7565b8984526010602052846040809520918254169189156000146130b05761307a915060066000918281558260018201558260028201558260038201558260048201558260058201550155565b6130838a6130fc565b33906136e8565b51938493846040919493926060820195825260208201520152565b0390a2388080612fcd565b808a600160029301550155613083565b5050509050565b156130ce57565b60405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b6044820152606490fd5b613105816126e0565b6001600160a01b0390808216801591821561329757505060085483600052600960205280604060002055600160401b811015610eeb57836115b782600161314f94016008556128e6565b60085460001991908281019081116117b2576000938585526020906009825260409261317e84882054916128e6565b90549060031b1c613192816115b7846128e6565b87526009835283872055868652858381205560085480156132835785016131b8816128e6565b8782549160031b1b19169055600855868652600a8252828620936001600160601b0360a01b9485815416905561325257906002916131f588612d09565b6131fe886126e0565b888852600483528488208681541690551694858752600382528387209081540190558686525283209081541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b50606491519062461bcd60e51b82526004820152600b60248201526a216164647265737328302960a81b6044820152fd5b634e487b7160e01b87526031600452602487fd5b6132a09061261d565b6000198101919082116117b257600091858352602060078152604092838520548381036132e6575b5087855284848120558452600681528284209184525281205561314f565b81865260068352848620848752835284862054828752600684528587208288528452808688205586526007835284862055386132c8565b919091600081815260209060108252604091828220906133b5845197613342896124b5565b83546001600160a01b039081168a526001850154848b01526002850154878b0152600385015460608b0152600485015460808b0152600585015460a08b8101919091526006959095015480821660c08c01819052951c60ff16151560e08b0152936133ae903314612eb2565b4287613a18565b50929093831561346c577fa4489f0d65c1250dc8e830211cb0442bfcbf6a32300cb9cfa67f2b2176bd18f396979861343b92859288881560001461344657818c6134299352601088522060066000918281558260018201558260028201558260038201558260048201558260058201550155565b6134328a6130fc565b339151166136e8565b8351928352820152a2565b8b82526010875290206001810188905560060180546001600160a01b0319169055613432565b855162461bcd60e51b815260048101849052600a60248201526910a932b6b0b4b73232b960b11b6044820152606490fd5b156134a457565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b811561293d570690565b818102929181159184041417156117b257565b1561351b57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b60018060a01b03169060405160408101908082106001600160401b03831117610eeb576135b9916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af16135b3612b17565b9161364f565b80519182159184831561362b575b5050509050156135d45750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612c2d57820151908115158203612c2a5750803880846135c7565b919290156136b15750815115613663575090565b3b1561366c5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156136c45750805190602001fd5b60405162461bcd60e51b8152602060048201529081906108249060248301906123bf565b604080516370a0823160e01b8082526001600160a01b039485166004830181905291949293909216916020918286602481875afa95861561380b576000966137dc575b50845163a9059cbb60e01b848201528160248201528760448201526044815260808101928184106001600160401b03851117610eeb576137716024928695895287613548565b86519586938492835260048301525afa9283156137d257506000926137a1575b50506125489291611d9c91612cfc565b81819392933d83116137cb575b6137b881836124ec565b81010312612c2a57505181611d9c613791565b503d6137ae565b513d6000823e3d90fd5b90958382813d8311613804575b6137f381836124ec565b81010312612c2a575051943861372b565b503d6137e9565b85513d6000823e3d90fd5b1561381d57565b60405162461bcd60e51b815260206004820152600e60248201526d10b7bbb732b927b832b930ba37b960911b6044820152606490fd5b1561385a57565b60405162461bcd60e51b815260206004820152600e60248201526d085cd95b1988185c1c1c9bdd985b60921b6044820152606490fd5b6000828152600a60205260409081902080546001600160a01b0319166001600160a01b039384169081179091557f5f05f4f4b46d943d34b887b4741055b5ab6decb7b4fd2670a98969d38a36408092906138e9856126e0565b8351921682526020820152a2565b6001600160a01b039182169116808214613974577f947bc3b5c76434e50335b9127e82fb1abb17b34d9380caf2a64cd8c6f43711849260609282600052600b60205260406000208160005260205261395f8260406000209060ff801983541691151516179055565b604051928352602083015215156040820152a1565b60405162461bcd60e51b815260206004820152600960248201526810b7b832b930ba37b960b91b6044820152606490fd5b6000818152600260205260409020546139c8906001600160a01b03161515612694565b6000908152600a60205260409020546001600160a01b031690565b156139ea57565b60405162461bcd60e51b815260206004820152600660248201526510a0a226a4a760d11b6044820152606490fd5b9091600091825260106020526040822060405192613a35846124b5565b60018060a01b039081835416855260018301549384602087015260028401549586604082015260038501549081606082015260e060ff600488015496876080850152600660058a0154998a60a0870152015490811660c085015260a01c1615159101528297808811918215613b20575b50508015613b16575b15613abb57505050509192565b613b0794965090613ae6613adf85613ada89613b0197969a989a612cfc565b612933565b9283613501565b9050868111613b0c57613afb905b8097612cfc565b94613501565b90612c42565b909192565b50613afb86613af4565b5085811115613aae565b1190503880613aa556fea264697066735822122007d95367b270feb6f73f0696739c9dcc9277ca07116e0ab14c3551509e1bd8fd64736f6c63430008130033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000011546f6b656e56657374696e67506c616e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035456500000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a7146122dc57508063050fbad714611bb757806306fdde0314611b14578063081812fc14611af657806308bbb82414611ad2578063095ea7b3146119a157806316c099671461192d57806318160ddd1461190f5780631f25ccb61461188957806323b872dd146114da57806323ed81fb1461140f5780632f745c59146113e8578063402d5a77146113ca57806342842e0e146113975780634c6839cc146113745780634f6ccce7146112e357806352e5b7e4146111f05780636352211e146111c05780636b040218146111635780636b8e3d73146110705780636bb3c73f1461103c5780636c0360eb1461102057806370a0823114610ffd5780637b4e51f614610fc75780637e5d8b4d14610f2c57806388cccd8014610f01578063931688cb14610ceb57806395d89b4114610c0c578063968b3e5914610bbe5780639e866c4714610b5d578063a22cb46514610b32578063a414159614610a78578063a8973e2b1461099d578063b162061614610916578063b6f97787146108c0578063b88d4fde14610768578063b9bdac2c146106db578063c3ca57551461060b578063c7711c4c1461056f578063c7d74fa71461052d578063c87b56dd14610314578063d0c524b71461028d578063dc1fa5681461025e5763e985e9c51461020357600080fd5b346102595760403660031901126102595761021c612361565b610224612377565b9060018060a01b03809116600052600560205260406000209116600052602052602060ff604060002054166040519015158152f35b600080fd5b3461025957604036600319011261025957602061028561027c612361565b602435906129b2565b604051908152f35b346102595761029b36612449565b90916102a5612a22565b4282106102e05760005b8381106102bd576001601155005b806102d6846102d06102db948887612ea2565b3561331d565b612e7f565b6102af565b60405162461bcd60e51b815260206004820152600c60248201526b2170617374207265766f6b6560a01b6044820152606490fd5b34610259576020806003193601126102595760043560008181526002602052604090205461034c906001600160a01b03161515612694565b8161035561250d565b80519092901561051457600090807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008181811015610506575b5050836d04ee2d6d415b85acef8100000000808310156104fa575b5050662386f26fc10000808210156104ed575b506305f5e100808210156104e0575b50612710808210156104d3575b5060648110156104c5575b600a809110156104bb575b6001808401928160216104146103fe876125cb565b9661040c60405198896124ec565b8088526125cb565b8689019790601f1901368937860101905b610485575b505050509261046b929161045f946040519583610450889551809288808901910161239c565b8401915180938684019061239c565b010380845201826124ec565b905b6104816040519282849384528301906123bf565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156104b657919082610425565b61042a565b91600101916103e9565b6064600291049201916103de565b60049104920191866103d3565b60089104920191866103c6565b60109104920191866103b7565b930192900483876103a4565b604094500490508680610389565b505050604051610523816124d1565b600081529061046d565b3461025957606036600319011261025957610481610552604435602435600435613a18565b604080519384526020840192909252908201529081906060820190565b346102595760003660031901126102595760135461059b33600883901c6001600160a01b0316146139e3565b60ff8116156105e057610100600160a81b0319166013556040513381527fa775782c93424d570e142a52abffaedcebb0e9cd73cca502455acb0587efb6b790602090a1005b606460405162461bcd60e51b81526020600482015260046024820152630854d15560e21b6044820152fd5b346102595760203660031901126102595760043560005260106020526020604060002060405161063a816124b5565b60018060a01b03808354168252600183015480858401526002840154928360408201526003850154606082015260e060ff60048701549485608085015260066005890154988960a0870152015490811660c085015260a01c1615159101526106a282826134f7565b6106c157926106b76106bc9261028595612933565b613501565b612c42565b926106bc816106b76106bc946106d697612933565b610285565b34610259576000366003190112610259576106f4612a22565b6106fd3361261d565b61070681612e1a565b9061071460405192836124ec565b808252601f1961072382612e1a565b0136602084013760005b8181106107455761073e4284612f9b565b6001601155005b806107536107639233612858565b61075d8286612e8e565b52612e7f565b61072d565b3461025957608036600319011261025957610781612361565b5061078a612377565b506044356064356001600160401b0381116102595736602382011215610259576107be9036906024816004013591016125e6565b506001600160a01b0390816107d2826126e0565b1691823314928315610899575b508215610883575b5050156108285760405162461bcd60e51b815260206004820152600e60248201526d217472616e736665727261626c6560901b6044820152606490fd5b0390fd5b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b9091506108903392612706565b161481806107e7565b909250600052600560205260406000203360005260205260ff6040600020541691836107df565b34610259576040366003190112610259576108d9612361565b6108e1612377565b9060018060a01b03809116600052600b60205260406000209116600052602052602060ff604060002054166040519015158152f35b34610259576020366003190112610259576004356000526010602052610100604060002060ff60018060a01b03918281541692600182015491600281015460038201546004830154916006600585015494015495604051988952602089015260408801526060870152608086015260a0850152811660c084015260a01c16151560e0820152f35b34610259576040366003190112610259576001600160401b03600435818111610259576109ce903690600401612419565b91602435908111610259576109e7903690600401612419565b6109f2929192612a22565b808403610a455760005b848110610a0a576001601155005b610a15818386612ea2565b35906001600160a01b0382168203610259576102d6610a4092610a39838988612ea2565b3590612eee565b6109fc565b60405162461bcd60e51b815260206004820152600b60248201526a30b93930bc9032b93937b960a91b6044820152606490fd5b3461025957604036600319011261025957610adb610a94612361565b60243590610acc6001600160a01b0380610aad856126e0565b168033148015610add575b610ac29150613816565b8216331415613853565b610ad68282613890565b612744565b005b5080600052600b60205260406000203360005260205260ff6040600020541680610b0c575b610ac29150610ab8565b506000526005602052604060002033600052602052610ac260ff60406000205416610b02565b3461025957604036600319011261025957610adb610b4e612361565b610b5661238d565b90336127a1565b34610259576020366003190112610259576004356001600160401b03811161025957610b8d903690600401612419565b610b95612a22565b60005b818110610ba6576001601155005b610bb9906102d6426102d0838688612ea2565b610b98565b34610259576020366003190112610259576004356001600160401b03811161025957610c07610bf461073e923690600401612419565b9190610bfe612a22565b42923691612e31565b612f9b565b346102595760003660031901126102595760405160006001805490610c308261247b565b80855291818116908115610cc45750600114610c6b575b61048184610c57818603826124ec565b6040519182916020835260208301906123bf565b600081815292507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610cac575050508101602001610c5782610c47565b80546020858701810191909152909301928101610c94565b60ff191660208087019190915292151560051b85019092019250610c579150839050610c47565b3461025957602080600319360112610259576001600160401b0390600435828111610259573660238201121561025957610d2f9036906024816004013591016125e6565b90610d4860018060a01b0360135460081c1633146139e3565b8151928311610eeb57610d5c60125461247b565b601f8111610e87575b508092601f8111600114610de457807fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912894600091610dd9575b508160011b916000199060031b1c1916176012555b600160ff196013541617601355610dd46040519282849384528301906123bf565b0390a1005b905083015185610d9e565b601f1981169360126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34449460005b818110610e7057509482916001937fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c91289710610e57575b5050811b01601255610db3565b85015160001960f88460031b161c191690558580610e4a565b858301518755600190960195918401918401610e14565b60126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444601f850160051c810191838610610ee1575b601f0160051c01905b818110610ed55750610d65565b60008155600101610ec8565b9091508190610ebf565b634e487b7160e01b600052604160045260246000fd5b3461025957604036600319011261025957610adb610f1d612361565b610f2561238d565b90336138f7565b34610259576040366003190112610259576004357f15e344fba3d60744c30f71eed830999cdb736cf0f1d09f414983adbaeb55d2a66020610f6b61238d565b610f73612a22565b610f8f6001600160a01b03610f87866126e0565b1633146130c7565b60008481526010835260409020600601805460ff60a01b191682151560a01b60ff60a01b161790556040519015158152a26001601155005b3461025957604036600319011261025957610adb610fe3612361565b610feb61238d565b90610ff78282336138f7565b336127a1565b3461025957602036600319011261025957602061028561101b612361565b61261d565b3461025957600036600319011261025957610481610c5761250d565b3461025957602036600319011261025957600435600052600c602052602060018060a01b0360406000205416604051908152f35b3461025957604036600319011261025957611089612361565b611091612377565b60009161109d8161298d565b916001600160a01b039081169160005b8481106110bf57602086604051908152f35b6110c981836129b2565b60005260206010815260406000206040516110e3816124b5565b60e060ff878454169384845260018101548096850152600281015460408501526003810154606085015260048101546080850152600660058201549160a0928387015201549089821660c08601521c161515910152851461114e575b5061114990612e7f565b6110ad565b61115c906111499297612c42565b959061113f565b346102595761117136612449565b9061117a612a22565b428210156111915761073e92610c07913691612e31565b60405162461bcd60e51b81526020600482015260076024820152662166757475726560c81b6044820152606490fd5b346102595760203660031901126102595760206111de6004356126e0565b6040516001600160a01b039091168152f35b3461025957604036600319011261025957611209612361565b611211612377565b60009161121d8161261d565b916001600160a01b039081169160005b84811061123f57602086604051908152f35b6112498183612858565b6000526020601081526040600020604051611263816124b5565b60e060ff878454169384845260018101548096850152600281015460408501526003810154606085015260048101546080850152600660058201549160a0928387015201549089821660c08601521c16151591015285146112ce575b506112c990612e7f565b61122d565b6112dc906112c99297612c42565b95906112bf565b346102595760203660031901126102595760043560085481101561131a5761130c6020916128e6565b90546040519160031b1c8152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b34610259576020366003190112610259576020610285611392612361565b61298d565b34610259576113a5366123e4565b91505060006040516113b6816124d1565b526001600160a01b0390816107d2826126e0565b346102595760203660031901126102595760206111de6004356139a5565b34610259576040366003190112610259576020610285611406612361565b60243590612858565b346102595760403660031901126102595760043561142b612377565b6000828152601060205260409020600601805490916001600160a01b03906114563383851614612eb2565b81611460866126e0565b9116911681146114a8577f423d5f6f62e79d3e51b096bd7715b454f212603530cdca551d6a37554889725a92816020936001600160601b0360a01b16179055604051908152a2005b60405162461bcd60e51b815260206004820152600a60248201526910b83630b727bbb732b960b11b6044820152606490fd5b34610259576114e8366123e4565b806000939293526020916010835260069360ff856040600020015460a01c161561185357600083815260108552604090208501546001600160a01b03828116969095918616871461181957846000526010825261154f868260406000200154163314612eb2565b8561156861155c876126e0565b8683169816881461349d565b87156117c85786801595866000146116ef57505060085490866000526009845281604060002055600160401b821015610eeb57600294611610936115d0896115b78660018e98016008556128e6565b90919082549060031b91821b91600019901b1916179055565b838b036116b9575b5087600052600a8552876040600020976001600160601b0360a01b988981541690556116a9575b61160991506126e0565b161461349d565b83600052600481526040600020838154169055846000526003815260406000206000198154019055856000526040600020600181540190558360005252836040600020918254161790558083837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a47f52f56ec49519b0e1b434f05fcf39068afe732dec973010ca61efa6e0a087bdeb600080a4005b6116b291612c4f565b89876115ff565b6116c28261261d565b908b600052865260406000208160005286528860406000205588600052600786526040600020558a6115d8565b8982949203611708575b509060029461161093926115d0565b61171391935061261d565b6000198101919082116117b257600294611610938993896000526007875260406000205481810361176e575b5089600052600060408120558460005281875260406000209060005286526000604081205591929350946116f9565b85600052828852604060002082600052885260406000205486600052838952604060002082600052895280604060002055600052600788526040600020558c61173f565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152600481018490526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b60405162461bcd60e51b815260048101839052601260248201527110ba3930b739b332b9103a379030b236b4b760711b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d217472616e736665727261626c6560901b6044820152606490fd5b34610259576040366003190112610259576118a2612361565b6118aa612377565b6118b33361261d565b6001600160a01b039283169290919060005b8381106118ce57005b806118dc6118fa9233612858565b806000526010602052868460406000205416146118ff575b50612e7f565b6118c5565b6119099085612eee565b866118f4565b34610259576000366003190112610259576020600854604051908152f35b3461025957604036600319011261025957610adb611949612361565b602435906119766001600160a01b0380611962856126e0565b16803314801561197b57610ac29150613816565b613890565b50600052600b602052604060002033600052602052610ac260ff60406000205416610ab8565b34610259576040366003190112610259576119ba612361565b6024356001600160a01b03806119cf836126e0565b168091841614611a8357803314908115611a5e575b50156119f357610adb91612744565b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b9050600052600560205260406000203360005260205260ff60406000205416836119e4565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b3461025957604036600319011261025957610adb600435611af1612377565b612eee565b346102595760203660031901126102595760206111de600435612706565b346102595760003660031901126102595760405160008054611b358161247b565b80845290600190818116908115610cc45750600114611b5e5761048184610c57818603826124ec565b600080805292507f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b828410611b9f575050508101602001610c5782610c47565b80546020858701810191909152909301928101611b87565b346102595761012036600319011261025957611bd1612361565b611bd9612377565b60e435916001600160a01b0383168303610259576101043591821515830361025957611c03612a22565b6001600160a01b038216156122a9576001600160a01b0381161561227a576044351561224a5760a4351561221c5760443560a435116121e75760c435156121b757611c5260a4356044356134f7565b61219557611c706064356106bc60c4356106b760a435604435612933565b905b81608435116121625760148054600101908190556040516370a0823160e01b81523060048201529094906020816024816001600160a01b0387165afa9081156120c557600091612130575b506040516370a0823160e01b81523360048201526020816024816001600160a01b0388165afa9081156120c5576000916120fe575b50604435116120d1576040516323b872dd60e01b60208201523360248201523060448201526044356064820152606481528060a08101106001600160401b0360a083011117610eeb5760a08101604052611d55906001600160a01b038516613548565b6040516370a0823160e01b8152306004820152906020826024816001600160a01b0388165afa9182156120c55760009261208f575b5090611d9c611da29260443592612cfc565b14613514565b611e8e604051611db1816124b5565b60018060a01b0384168152604435602082015260643560408201526060810160843581526006608083019260a435845260a0810160c435815260c082019460018060a01b038d16865260e083019488151586528c60005260106020526040806000209460018060a01b038151166001600160601b0360a01b8754161786556020810151600187015501516002850155516003840155516004830155516005820155019160018060a01b039051166001600160601b0360a01b83541617825551151581549060ff60a01b90151560a01b169060ff60a01b1916179055565b604051611e9a816124d1565b600080825286815260026020526040902054611ec2906001600160a01b031615155b15612acb565b6008549086600052600960205281604060002055600160401b821015610eeb57611ef9876115b7846001611fe696016008556128e6565b611f028661261d565b60018060a01b038716600052600660205260406000208160005260205287604060002055876000526007602052604060002055600a60205260406000206001600160601b0360a01b8154169055611f598787612c4f565b600087815260026020526040902054611f7c906001600160a01b03161515611ebc565b6001600160a01b0386166000818152600360209081526040808320805460010190558a83526002909152812080546001600160a01b031916831790558891907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a48686612b47565b156120765761010085927f6d5fb3665416b633057b4e53641a7dec63a802702a55e386df478871ea22af9b926020986040519660443588526064358b8901526084356040890152606088015260a435608088015260c43560a088015260018060a01b031660c0870152151560e086015260018060a01b03169460018060a01b031693a46001601155604051908152f35b60405162461bcd60e51b81528061082460048201612a78565b91506020823d6020116120bd575b816120aa602093836124ec565b8101031261025957905190611d9c611d8a565b3d915061209d565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260206004820152600560248201526454484c303160d81b6044820152606490fd5b90506020813d602011612128575b81612119602093836124ec565b81010312610259575188611cf2565b3d915061210c565b90506020813d60201161215a575b8161214b602093836124ec565b81010312610259575187611cbd565b3d915061213e565b60405162461bcd60e51b815260206004820152600b60248201526a18db1a5999880f88195b9960aa1b6044820152606490fd5b6121b16064356106bc60c43581816106b760a435604435612933565b90611c72565b60405162461bcd60e51b81526020600482015260086024820152670c17dc195c9a5bd960c21b6044820152606490fd5b60405162461bcd60e51b815260206004820152600d60248201526c1c985d19480f88185b5bdd5b9d609a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526006602482015265305f7261746560d01b6044820152606490fd5b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b60405162461bcd60e51b8152602060048201526007602482015266182fba37b5b2b760c91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a0c17dc9958da5c1a595b9d60aa1b6044820152606490fd5b34610259576020366003190112610259576004359063ffffffff60e01b82168092036102595760209163780e9d6360e01b811490811561231e575b5015158152f35b6380ac58cd60e01b811491508115612350575b811561233f575b5083612317565b6301ffc9a760e01b14905083612338565b635b5e139f60e01b81149150612331565b600435906001600160a01b038216820361025957565b602435906001600160a01b038216820361025957565b60243590811515820361025957565b60005b8381106123af5750506000910152565b818101518382015260200161239f565b906020916123d88151809281855285808601910161239c565b601f01601f1916010190565b6060906003190112610259576001600160a01b0390600435828116810361025957916024359081168103610259579060443590565b9181601f84011215610259578235916001600160401b038311610259576020808501948460051b01011161025957565b604060031982011261025957600435906001600160401b0382116102595761247391600401612419565b909160243590565b90600182811c921680156124ab575b602083101461249557565b634e487b7160e01b600052602260045260246000fd5b91607f169161248a565b61010081019081106001600160401b03821117610eeb57604052565b602081019081106001600160401b03821117610eeb57604052565b90601f801991011681019081106001600160401b03821117610eeb57604052565b60405190600082601254916125218361247b565b808352926001908181169081156125a9575060011461254a575b50612548925003836124ec565b565b6012600090815291507fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34445b84831061258e575061254893505081016020013861253b565b81935090816020925483858a01015201910190918592612575565b90506020925061254894915060ff191682840152151560051b8201013861253b565b6001600160401b038111610eeb57601f01601f191660200190565b9291926125f2826125cb565b9161260060405193846124ec565b829481845281830111610259578281602093846000960137010152565b6001600160a01b0316801561263d57600052600360205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b1561269b57565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b6000908152600260205260409020546001600160a01b0316612703811515612694565b90565b600081815260026020526040902054612729906001600160a01b03161515612694565b6000908152600460205260409020546001600160a01b031690565b600082815260046020526040902080546001600160a01b0319166001600160a01b0392831690811790915590612779836126e0565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6001600160a01b03918216929116908183146128135760207f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191836000526005825260406000208560005282526128088160406000209060ff801983541691151516179055565b6040519015158152a3565b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b6128618161261d565b82101561288d5760018060a01b0316600052600660205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b60085481101561291d5760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b634e487b7160e01b600052603260045260246000fd5b811561293d570490565b634e487b7160e01b600052601260045260246000fd5b1561295a57565b60405162461bcd60e51b815260206004820152600b60248201526a216164647265737328302960a81b6044820152606490fd5b6001600160a01b03166129a1811515612953565b600052600d60205260406000205490565b6001600160a01b03166000818152600d6020526040812054919290918110156129ed576040928252600e602052828220908252602052205490565b60405162461bcd60e51b815260206004820152600d60248201526c6f7574206f6620626f756e647360981b6044820152606490fd5b600260115414612a33576002601155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b15612ad257565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b3d15612b42573d90612b28826125cb565b91612b3660405193846124ec565b82523d6000602084013e565b606090565b9091600091803b15612c3957612b926020918493604051948580948193630a85bd0160e11b9a8b845233600485015284602485015260448401526080606484015260848301906123bf565b03926001600160a01b03165af190829082612bea575b5050612bdc57612bb6612b17565b80519081612bd75760405162461bcd60e51b81528061082460048201612a78565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612c31575b81612c06602093836124ec565b81010312612c2d5751906001600160e01b031982168203612c2a5750903880612ba8565b80fd5b5080fd5b3d9150612bf9565b50505050600190565b919082018092116117b257565b6001600160a01b031690612c64821515612953565b60008281526020600d8152600d60409182842054600e825283852081865282528584862055858552600f825283852055600c8152828420866001600160601b0360a01b82541617905585845252812080549060018201809211612ce857557fcd57880fa6fb6b4aedb77272d2cfa8d03186b5034f9b672ccfcd3cd6edfecc9b9080a3565b634e487b7160e01b83526011600452602483fd5b919082039182116117b257565b6000818152600c60209081526040808320546001600160a01b0316939291612d32851515612953565b848352600d81528183205460001990818101908111612dcf57858552600f835283852054818103612de3575b508585528484812055868552600e835283852090855282528383812055858452600d82528284208054918201918211612dcf5755838352600c9052812080546001600160a01b03191690557f09f87139523b83583b15f476015dd9a27fae3a03f17202cdf77d063bef5d21c29080a3565b634e487b7160e01b85526011600452602485fd5b878652600e8452848620828752845284862054888752600e8552858720828852855280868820558652600f84528486205538612d5e565b6001600160401b038111610eeb5760051b60200190565b9291612e3c82612e1a565b91612e4a60405193846124ec565b829481845260208094019160051b810192831161025957905b828210612e705750505050565b81358152908301908301612e63565b60001981146117b25760010190565b805182101561291d5760209160051b010190565b919081101561291d5760051b0190565b15612eb957565b60405162461bcd60e51b815260206004820152600d60248201526c10bb32b9ba34b733a0b236b4b760991b6044820152606490fd5b906001600160a01b0380612f01836126e0565b1690813314918215612f74575b508115612f60575b5015612f2e5761254891612f2982612d09565b612c4f565b60405162461bcd60e51b815260206004820152600a60248201526910b232b632b3b0ba37b960b11b6044820152606490fd5b339150612f6c836139a5565b161438612f16565b909150600052600b60205260406000203360005260205260ff604060002054169038612f0e565b919091600090815b81518110156130c057612fd590612fc58642612fbf8487612e8e565b51613a18565b919081612fda575b505050612e7f565b612fa3565b7fa6faee2246474597b6de7c76bf9a45d256737543cb0806e6e805b55b38c7663f916130a56130098689612e8e565b51948961308a84613019896126e0565b6001600160a01b039061302f90821633146130c7565b8984526010602052846040809520918254169189156000146130b05761307a915060066000918281558260018201558260028201558260038201558260048201558260058201550155565b6130838a6130fc565b33906136e8565b51938493846040919493926060820195825260208201520152565b0390a2388080612fcd565b808a600160029301550155613083565b5050509050565b156130ce57565b60405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b6044820152606490fd5b613105816126e0565b6001600160a01b0390808216801591821561329757505060085483600052600960205280604060002055600160401b811015610eeb57836115b782600161314f94016008556128e6565b60085460001991908281019081116117b2576000938585526020906009825260409261317e84882054916128e6565b90549060031b1c613192816115b7846128e6565b87526009835283872055868652858381205560085480156132835785016131b8816128e6565b8782549160031b1b19169055600855868652600a8252828620936001600160601b0360a01b9485815416905561325257906002916131f588612d09565b6131fe886126e0565b888852600483528488208681541690551694858752600382528387209081540190558686525283209081541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b50606491519062461bcd60e51b82526004820152600b60248201526a216164647265737328302960a81b6044820152fd5b634e487b7160e01b87526031600452602487fd5b6132a09061261d565b6000198101919082116117b257600091858352602060078152604092838520548381036132e6575b5087855284848120558452600681528284209184525281205561314f565b81865260068352848620848752835284862054828752600684528587208288528452808688205586526007835284862055386132c8565b919091600081815260209060108252604091828220906133b5845197613342896124b5565b83546001600160a01b039081168a526001850154848b01526002850154878b0152600385015460608b0152600485015460808b0152600585015460a08b8101919091526006959095015480821660c08c01819052951c60ff16151560e08b0152936133ae903314612eb2565b4287613a18565b50929093831561346c577fa4489f0d65c1250dc8e830211cb0442bfcbf6a32300cb9cfa67f2b2176bd18f396979861343b92859288881560001461344657818c6134299352601088522060066000918281558260018201558260028201558260038201558260048201558260058201550155565b6134328a6130fc565b339151166136e8565b8351928352820152a2565b8b82526010875290206001810188905560060180546001600160a01b0319169055613432565b855162461bcd60e51b815260048101849052600a60248201526910a932b6b0b4b73232b960b11b6044820152606490fd5b156134a457565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b811561293d570690565b818102929181159184041417156117b257565b1561351b57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b60018060a01b03169060405160408101908082106001600160401b03831117610eeb576135b9916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af16135b3612b17565b9161364f565b80519182159184831561362b575b5050509050156135d45750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612c2d57820151908115158203612c2a5750803880846135c7565b919290156136b15750815115613663575090565b3b1561366c5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156136c45750805190602001fd5b60405162461bcd60e51b8152602060048201529081906108249060248301906123bf565b604080516370a0823160e01b8082526001600160a01b039485166004830181905291949293909216916020918286602481875afa95861561380b576000966137dc575b50845163a9059cbb60e01b848201528160248201528760448201526044815260808101928184106001600160401b03851117610eeb576137716024928695895287613548565b86519586938492835260048301525afa9283156137d257506000926137a1575b50506125489291611d9c91612cfc565b81819392933d83116137cb575b6137b881836124ec565b81010312612c2a57505181611d9c613791565b503d6137ae565b513d6000823e3d90fd5b90958382813d8311613804575b6137f381836124ec565b81010312612c2a575051943861372b565b503d6137e9565b85513d6000823e3d90fd5b1561381d57565b60405162461bcd60e51b815260206004820152600e60248201526d10b7bbb732b927b832b930ba37b960911b6044820152606490fd5b1561385a57565b60405162461bcd60e51b815260206004820152600e60248201526d085cd95b1988185c1c1c9bdd985b60921b6044820152606490fd5b6000828152600a60205260409081902080546001600160a01b0319166001600160a01b039384169081179091557f5f05f4f4b46d943d34b887b4741055b5ab6decb7b4fd2670a98969d38a36408092906138e9856126e0565b8351921682526020820152a2565b6001600160a01b039182169116808214613974577f947bc3b5c76434e50335b9127e82fb1abb17b34d9380caf2a64cd8c6f43711849260609282600052600b60205260406000208160005260205261395f8260406000209060ff801983541691151516179055565b604051928352602083015215156040820152a1565b60405162461bcd60e51b815260206004820152600960248201526810b7b832b930ba37b960b91b6044820152606490fd5b6000818152600260205260409020546139c8906001600160a01b03161515612694565b6000908152600a60205260409020546001600160a01b031690565b156139ea57565b60405162461bcd60e51b815260206004820152600660248201526510a0a226a4a760d11b6044820152606490fd5b9091600091825260106020526040822060405192613a35846124b5565b60018060a01b039081835416855260018301549384602087015260028401549586604082015260038501549081606082015260e060ff600488015496876080850152600660058a0154998a60a0870152015490811660c085015260a01c1615159101528297808811918215613b20575b50508015613b16575b15613abb57505050509192565b613b0794965090613ae6613adf85613ada89613b0197969a989a612cfc565b612933565b9283613501565b9050868111613b0c57613afb905b8097612cfc565b94613501565b90612c42565b909192565b50613afb86613af4565b5085811115613aae565b1190503880613aa556fea264697066735822122007d95367b270feb6f73f0696739c9dcc9277ca07116e0ab14c3551509e1bd8fd64736f6c63430008130033

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

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000011546f6b656e56657374696e67506c616e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035456500000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): TokenVestingPlans
Arg [1] : symbol (string): TVP

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [3] : 546f6b656e56657374696e67506c616e73000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [5] : 5456500000000000000000000000000000000000000000000000000000000000


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

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