ETH Price: $3,387.33 (+0.79%)

Token

Bound-TokenLockupPlans (B-TLP)
 

Overview

Max Total Supply

3,327 B-TLP

Holders

3,043

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 B-TLP
0xd1e7cbc38828e7aa639062bf94199a70085a0795
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:
TokenLockupPlans_Bound

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

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

import '../TokenLockupPlans.sol';

/// @title TokenLockupPlans_Bound - An efficient way to allocate tokens to beneficiaries that unlock over time
/// @notice This contract allows people to grant tokens to beneficiaries that unlock over time with the added functionalities;
/// Owners of unlock plans can manage all of their token unlocks across all of their positions in a single contract. 
/// Each lockup plan is a unique NFT, leveraging the backbone of the ERC721 contract to represent a unique lockup plan 
/// 1. Not-Revokable: plans cannot be revoked, once granted the entire amount will be claimable by the beneficiary over time. 
/// 2. Non-Transferable: Lockup plans are soul bound and cannot be transferred or participate in defi activities. 
/// 3. Governance optimized for snapshot voting: These are built to allow beneficiaries to vote with their locked 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 have unlocked for tax optimization
/// 5. Segmenting plans: Beneficiaries can segment a single lockup into  smaller chunks for subdelegation of tokens, or to use in defi with smaller chunks
/// 6. Combingin Plans: Beneficiaries can combine plans that have the same details in one larger chunk for easier bulk management

contract TokenLockupPlans_Bound is TokenLockupPlans {
  constructor(string memory name, string memory symbol) TokenLockupPlans(name, symbol) {}

  /// @notice this function overrides the internal transfer function so that these plans and tokens cannot be transferred
  /// we check that the from address is not 0, which would indicate a mint, or that the to address is not 0, which would be a burn
  /// if neither address is the 0x0, then it is a transfer between wallets and is not allowable
  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 firstTokenId,
    uint256 batchSize
  ) internal virtual override {
    super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
    if (from != address(0) && to != address(0)) revert('Not Transferable');
  }
}

File 2 of 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : 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 26 : TokenLockupPlans.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/LockupStorage.sol';

/// @title TokenLockupPlans - An efficient way to allocate tokens to beneficiaries that unlock over time
/// @notice This contract allows people to grant tokens to beneficiaries that unlock over time with the added functionalities;
/// Owners of unlock plans can manage all of their token unlocks across all of their positions in a single contract.
/// Each lockup plan is a unique NFT, leveraging the backbone of the ERC721 contract to represent a unique lockup plan
/// 1. Not-Revokable: plans cannot be revoked, once granted the entire amount will be claimable by the beneficiary over time.
/// 2. Transferable: Lockup plans can be transferred by the owner - opening up defi opportunities like NFT sales, borrowing and lending, and many others.
/// 3. Governance optimized for snapshot voting: These are built to allow beneficiaries to vote with their locked 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 have unlocked for tax optimization
/// 5. Segmenting plans: Beneficiaries can segment a single lockup into  smaller chunks for subdelegation of tokens, or to use in defi with smaller chunks
/// 6. Combingin Plans: Beneficiaries can combine plans that have the same details in one larger chunk for easier bulk management

contract TokenLockupPlans is ERC721Delegate, LockupStorage, 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 lockup 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 lockup plan, unix time
  /// @param cliff a cliff date which is a discrete date where tokens are not unlocked 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 unlock time stamp, in seconds. A period of 1 means that tokens vest every second in a 'streaming' style.
  function createPlan(
    address recipient,
    address token,
    uint256 amount,
    uint256 start,
    uint256 cliff,
    uint256 rate,
    uint256 period
  ) 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);
    _safeMint(recipient, newPlanId);
    emit PlanCreated(newPlanId, recipient, token, amount, start, cliff, end, rate, period);
  }

  /// @notice function for a beneficiary to redeem unlocked tokens from a group of plans
  /// @dev this will call an internal function for processing the actual redemption of tokens, which will withdraw unlocked tokens and deliver them to the beneficiary
  /// @dev this function will redeem all claimable and unlocked 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 unlocked tokens from a group of plans
  /// @dev this will call an internal function for processing the actual redemption of tokens, which will withdraw unlocked 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 unlocked 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 function for an owner of a lockup plan to segment a single plan into multiple chunks; segments.
  /// @dev the single plan can be divided up into many segments in this transaction, but care must be taken to ensure that the array is processed in a proper order
  /// if the tokens are send in the wrong order the function will revert becuase the amount of the segment could be larger than the original plan.
  /// this function iterates through the segment amounts and breaks up the same original plan into smaller sizes
  /// each time a segment happens it is always with the single planId, which will generate a new NFT for each new segment, and the original plan is updated in storage
  /// the original plan amount newPlanAmount + segmentAmount && original plan Rate = newPlanRate + segmentRate
  /// @dev Segmenting plans where the segment amount is not divisible by the rate will result in a new End date that is 1 period farther than the original plan
  /// @param planId is the plan that is going to be segmented
  /// @param segmentAmounts is the array of amounts of each individual segment, which must each be smaller than the plan when it is being segmented.
  function segmentPlan(
    uint256 planId,
    uint256[] memory segmentAmounts
  ) external nonReentrant returns (uint256[] memory newPlanIds) {
    newPlanIds = new uint256[](segmentAmounts.length);
    for (uint256 i; i < segmentAmounts.length; i++) {
      uint256 newPlanId = _segmentPlan(planId, segmentAmounts[i]);
      newPlanIds[i] = newPlanId;
    }
  }

  /// @notice this function combines the functionality of segmenting plans and then immediately delegating the new semgent plans to a delegate address
  /// @dev this function does NOT delegate the original planId at all, it will only delegate the newly create segments
  /// @param planId is the plan that will be segmented (and not delegated)
  /// @param segmentAmounts is the array of each segment amount
  /// @param delegatees is the array of delegatees that each new segment will be delegated to
  function segmentAndDelegatePlans(
    uint256 planId,
    uint256[] memory segmentAmounts,
    address[] memory delegatees
  ) external nonReentrant returns (uint256[] memory newPlanIds) {
    require(segmentAmounts.length == delegatees.length, 'length_error');
    newPlanIds = new uint256[](segmentAmounts.length);
    for (uint256 i; i < segmentAmounts.length; i++) {
      uint256 newPlanId = _segmentPlan(planId, segmentAmounts[i]);
      _delegateToken(delegatees[i], newPlanId);
      newPlanIds[i] = newPlanId;
    }
  }

  /// @notice this function allows a beneficiary of two plans that share the same details to combine them into a single surviving plan
  /// @dev the plans must have the same details except the amount and rate, but must share the same end date to be combined
  /// @param planId0 is the planId of a first plan to be combined
  /// @param planId1 is the planId of a second plan to be combined
  function combinePlans(uint256 planId0, uint256 planId1) external nonReentrant returns (uint256 survivingPlanId) {
    survivingPlanId = _combinePlans(planId0, planId1);
  }

  /****EXTERNAL VOTING & DELEGATION FUNCTIONS*********************************************************************************************************************************************/
  /// @notice delegation functions do not move any tokens and do not alter any information about the lockup 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 lockup plan to be delegated
  /// @param delegatee is the address that the plan will be delegated to
  function delegate(uint256 planId, address delegatee) external nonReentrant {
    _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 lockup 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 lockup 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 nonReentrant {
    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);
    }
  }

  function transferAndDelegate(uint256 planId, address from, address to) external virtual nonReentrant {
    safeTransferFrom(from, to, planId);
    _transferDelegate(to, 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 lockup 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 lockup plan and NFT
  /// @param balance is the available redeemable balance
  /// @param remainder is the amount of tokens that are still lcoked 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 for segmenting a single plan into two
  /// @dev the function takes a plan, performs some checks that the segment amount cannot be 0 and must be strictly less than the original plan amount
  /// then it will subtract the segmentamount from the original plan amount to get the new plan amount
  /// then it will get a new pro-rata rate for the newplan based on the new plan amount divided by the original plan amount
  /// while this pro-rata new rate is not perfect because of unitization (ie no decimal suppport), the segment rate is calculated by subtracting the new plan rate from the original plan rate
  /// because the newplan amount and segment amount == original plan amount, and the new plan rate + segment rate == original plan rate, the beneficiary will still unlock the same number of tokens at approximatley the same rate
  /// however because of uneven division, the end dates of each of the new rates may be different than the original rate. We check to make sure that the new end is farther than the original end
  /// so that tokens do not unlock early, and then it is a valid segment.
  /// finally a new NFT is minted with the Segment plan details
  /// and the storage of the original plan amount and rate is updated with the newplan amount and rate.
  /// @param planId is the id of the lockup plan
  /// @param segmentAmount is the amount of tokens to be segmented off from the original plan and created into a new segment plan
  function _segmentPlan(uint256 planId, uint256 segmentAmount) internal returns (uint256 newPlanId) {
    require(ownerOf(planId) == msg.sender, '!owner');
    Plan memory plan = plans[planId];
    require(segmentAmount < plan.amount, 'amount error');
    require(segmentAmount > 0, '0_segment');
    uint256 end = TimelockLibrary.endDate(plan.start, plan.amount, plan.rate, plan.period);
    _planIds.increment();
    newPlanId = _planIds.current();
    uint256 planAmount = plan.amount - segmentAmount;
    (uint256 planRate, uint256 segmentRate, uint256 planEnd, uint256 segmentEnd) = TimelockLibrary
      .calculateSegmentRates(
        plan.rate,
        plan.amount,
        planAmount,
        segmentAmount,
        plan.start,
        end,
        plan.period,
        plan.cliff
      );
    uint256 endCheck = segmentOriginalEnd[planId] == 0 ? end : segmentOriginalEnd[planId];
    require(planEnd >= endCheck, 'plan end error');
    require(segmentEnd >= endCheck, 'segmentEnd error');
    plans[planId].amount = planAmount;
    plans[planId].rate = planRate;
    _safeMint(msg.sender, newPlanId);
    plans[newPlanId] = Plan(plan.token, segmentAmount, plan.start, plan.cliff, segmentRate, plan.period);
    if (segmentOriginalEnd[planId] == 0) {
      segmentOriginalEnd[planId] = end;
      segmentOriginalEnd[newPlanId] = end;
    } else {
      segmentOriginalEnd[newPlanId] = segmentOriginalEnd[planId];
    }
    emit PlanSegmented(
      planId,
      newPlanId,
      planAmount,
      planRate,
      segmentAmount,
      segmentRate,
      plan.start,
      plan.cliff,
      plan.period,
      planEnd,
      segmentEnd
    );
  }

  /// @notice this funtion allows the holder of two plans that have the same parameters to combine them into a single surviving plan
  /// @dev all of the details of the plans must be the same except the amounts and rates may be different
  /// this function will check that the owners are the same, the ERC20 tokens are the same, the start, cliff and periods are the same.
  /// then it performs some checks on the end dates to ensure that either the end dates are the same, or if the user is combining previously segmented plans,
  /// that the original end dates of those segments are the same.
  /// if everything checks out, and the new end date of the combined plan will result in an end date equal to or later than the two plans, then they can be combined
  /// combining plans will delete the plan1 and burn the NFT related to it
  /// and then update the storage of the plan0 with the combined amount and combined rate
  /// @param planId0 is the planId of the first plan in the combination
  /// @param planId1 is the planId of a second plan to be combined
  function _combinePlans(uint256 planId0, uint256 planId1) internal returns (uint256 survivingPlan) {
    require(ownerOf(planId0) == msg.sender, '!owner');
    require(ownerOf(planId1) == msg.sender, '!owner');
    Plan memory plan0 = plans[planId0];
    Plan memory plan1 = plans[planId1];
    require(plan0.token == plan1.token, 'token error');
    require(plan0.start == plan1.start, 'start error');
    require(plan0.cliff == plan1.cliff, 'cliff error');
    require(plan0.period == plan1.period, 'period error');
    uint256 plan0End = TimelockLibrary.endDate(plan0.start, plan0.amount, plan0.rate, plan0.period);
    uint256 plan1End = TimelockLibrary.endDate(plan1.start, plan1.amount, plan1.rate, plan1.period);
    require(
      plan0End == plan1End ||
        (segmentOriginalEnd[planId0] == segmentOriginalEnd[planId1] && segmentOriginalEnd[planId0] != 0),
      'end error'
    );
    plans[planId0].amount += plans[planId1].amount;
    (uint256 survivorRate, uint256 survivorEnd) = TimelockLibrary.calculateCombinedRate(
      plan0.amount + plan1.amount,
      plan0.rate + plan1.rate,
      plan0.start,
      plan0.period,
      plan0End
    );
    plans[planId0].rate = survivorRate;
    if (survivorEnd < plan0End) {
      require(
        survivorEnd == segmentOriginalEnd[planId0] || survivorEnd == segmentOriginalEnd[planId1],
        'original end error'
      );
    }
    delete plans[planId1];
    _burn(planId1);
    survivingPlan = planId0;
    emit PlansCombined(
      planId0,
      planId1,
      survivingPlan,
      plans[planId0].amount,
      survivorRate,
      plan0.start,
      plan0.cliff,
      plan0.period,
      survivorEnd
    );
  }

  /****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 lockup plan(s)
  /// @param token is the ERC20 address of the token that is stored across the lockup 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 lockup plans for a specific delegate
  /// 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 lockup 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;
      }
    }
  }
}

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

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

/// @notice This contract is the storage contract for the Lockup Plans contracts.
/// it contains the storage of the lockup plan object (Plan struct), as well as the events that the lockup plan contracts emit

contract LockupStorage {
  /// @dev the Plan is the storage in a struct of the tokens that are locked and being unlocked
  /// @param token is the token address being timelocked
  /// @param amount is the current amount of tokens locked in the lockup plan, both unclaimed unlocked and still locked tokens. This parameter is updated each time tokens are redeemed, reset to the new remaining locked and unclaimed amount
  /// @param start is the start date when token unlock 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 unlock in a period. This parameter is constand for each plan. 
  /// @param period is the length of time in between each discrete time when tokens unlock. If this is set to 1, then tokens unlocke every second. Otherwise the period is longer to allow for interval lockup plans. 
  struct Plan {
    address token;
    uint256 amount;
    uint256 start;
    uint256 cliff;
    uint256 rate;
    uint256 period;
  }

  /// @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;

  /// @dev this stores the original end date of a plan. This is only used when a token is segmented, which sometimes results in a new end that is longer than the original, 
  /// the original end date is stored for the case of recombining those plans. 
  mapping(uint256 => uint256) public segmentOriginalEnd;

  ///@notice event emitted when a new lockup 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
  );

  /// @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 this event is emitted when a plan owner segments a plan into a new plan. The event spits out all of the details that have changed for the original plan and the new segmented plan
  event PlanSegmented(
    uint256 indexed id,
    uint256 indexed segmentId,
    uint256 newPlanAmount,
    uint256 newPlanRate,
    uint256 segmentAmount,
    uint256 segmentRate,
    uint256 start,
    uint256 cliff,
    uint256 period,
    uint256 newPlanEnd,
    uint256 segmentEnd
  );

  /// @notice this event is emitted when two plans with the same parameters are combined, it emits the two combined plans ids, the surviving plan id, and the details of the surviving plan
  event PlansCombined(
    uint256 indexed id0,
    uint256 indexed id1,
    uint256 indexed survivingId,
    uint256 amount,
    uint256 rate,
    uint256 start,
    uint256 cliff,
    uint256 period,
    uint256 end
  );

  /// @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 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) external view returns (uint256 end) {
    Plan memory plan = plans[planId];
    end = TimelockLibrary.endDate(plan.start, plan.amount, plan.rate, plan.period);
  }
}

File 25 of 26 : 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 26 of 26 : 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);
  }
}

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"}],"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":true,"internalType":"uint256","name":"segmentId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPlanAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPlanRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"segmentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"segmentRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cliff","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPlanEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"segmentEnd","type":"uint256"}],"name":"PlanSegmented","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id0","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"id1","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"survivingId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cliff","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"}],"name":"PlansCombined","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"},{"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":"planId0","type":"uint256"},{"internalType":"uint256","name":"planId1","type":"uint256"}],"name":"combinePlans","outputs":[{"internalType":"uint256","name":"survivingPlanId","type":"uint256"}],"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"}],"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":"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"}],"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":"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":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256[]","name":"segmentAmounts","type":"uint256[]"},{"internalType":"address[]","name":"delegatees","type":"address[]"}],"name":"segmentAndDelegatePlans","outputs":[{"internalType":"uint256[]","name":"newPlanIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"segmentOriginalEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256[]","name":"segmentAmounts","type":"uint256[]"}],"name":"segmentPlan","outputs":[{"internalType":"uint256[]","name":"newPlanIds","type":"uint256[]"}],"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":"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":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"transferAndDelegate","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":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"updateBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052346200033c57620045e1803803806200001d8162000341565b9283398101906040818303126200033c5780516001600160401b03908181116200033c57836200004f91840162000367565b91602093848201518381116200033c576200006b920162000367565b825190828211620003265760008054926001958685811c951680156200031b575b8886101462000307578190601f95868111620002b4575b5088908683116001146200025057849262000244575b5050600019600383901b1c191690861b1781555b8151938411620002305784548581811c9116801562000225575b878210146200021157838111620001c9575b50859284116001146200016457839495509262000158575b5050600019600383901b1c191690821b1781555b60125560148054610100600160a81b0319163360081b610100600160a81b03161790556040516142079081620003da8239f35b01519050388062000111565b9190601f1984169585845280842093905b878210620001b15750508385961062000197575b505050811b01815562000125565b015160001960f88460031b161c1916905538808062000189565b80878596829496860151815501950193019062000175565b8582528682208480870160051c82019289881062000207575b0160051c019086905b828110620001fb575050620000f9565b838155018690620001eb565b92508192620001e2565b634e487b7160e01b82526022600452602482fd5b90607f1690620000e7565b634e487b7160e01b81526041600452602490fd5b015190503880620000b9565b8480528985208994509190601f198416865b8c8282106200029d575050841162000283575b505050811b018155620000cd565b015160001960f88460031b161c1916905538808062000275565b8385015186558c9790950194938401930162000262565b9091508380528884208680850160051c8201928b8610620002fd575b918a91869594930160051c01915b828110620002ee575050620000a3565b8681558594508a9101620002de565b92508192620002d0565b634e487b7160e01b83526022600452602483fd5b94607f16946200008c565b634e487b7160e01b600052604160045260246000fd5b600080fd5b6040519190601f01601f191682016001600160401b038111838210176200032657604052565b919080601f840112156200033c5782516001600160401b03811162000326576020906200039d601f8201601f1916830162000341565b928184528282870101116200033c5760005b818110620003c557508260009394955001015290565b8581018301518482018401528201620003af56fe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611f2f5750806306fdde0314611e8c578063081812fc14611e6e57806308bbb82414611e41578063095ea7b314611d105780630aef166c1461185757806316c09967146117e357806318160ddd146117c55780631f25ccb61461173257806323b872dd1461170e57806323bdaea9146116ba5780632f745c59146116935780632f809b3814611539578063402d5a771461151b57806342842e0e146115045780634c6839cc146114e15780634e897e16146111055780634f6ccce71461107457806352e5b7e414610f9d5780636352211e14610f6d5780636b04021814610eeb5780636b8e3d7314610e145780636bb3c73f14610de05780636c0360eb14610dc457806370a0823114610da15780637b4e51f614610d7e57806388cccd8014610d66578063931688cb14610b5057806395d89b4114610a71578063968b3e5914610a23578063a22cb46514610a0b578063a414159614610953578063a8973e2b14610873578063b162061614610808578063b6f97787146107b2578063b88d4fde1461072b578063b9bdac2c146106c7578063c3ca57551461064d578063c7711c4c146105b1578063c7d74fa71461056f578063c83d7818146104dd578063c87b56dd146102c4578063dc1fa56814610295578063e985e9c51461023f5763fcbdd1961461020e57600080fd5b3461023a57602036600319011261023a5760043560005260116020526020604060002054604051908152f35b600080fd5b3461023a57604036600319011261023a57610258612012565b610260611ffc565b9060018060a01b03809116600052600560205260406000209116600052602052602060ff604060002054166040519015158152f35b3461023a57604036600319011261023a5760206102bc6102b3612012565b60243590612cde565b604051908152f35b3461023a5760208060031936011261023a576004356000818152600260205260409020546102fc906001600160a01b03161515612392565b816103056121dc565b8051909290156104c457600090807a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000081818110156104b6575b5050836d04ee2d6d415b85acef8100000000808310156104aa575b5050662386f26fc100008082101561049d575b506305f5e10080821015610490575b5061271080821015610483575b506064811015610475575b600a8091101561046b575b6001808401928160216103c46103ae876122c9565b966103bc6040519889612093565b8088526122c9565b8689019790601f1901368937860101905b610435575b505050509261041b929161040f9460405195836104008895518092888089019101611fb4565b84019151809386840190611fb4565b01038084520182612093565b905b610431604051928284938452830190611fd7565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215610466579190826103d5565b6103da565b9160010191610399565b60646002910492019161038e565b6004910492019186610383565b6008910492019186610376565b6010910492019186610367565b93019290048387610354565b604094500490508680610339565b5050506040516104d381612078565b600081529061041d565b3461023a57604036600319011261023a576004356024356001600160401b03811161023a57610510903690600401612119565b610518612f26565b6105228151613165565b9160005b825181101561055c578061054761054061055793866131a6565b5184613717565b61055182876131a6565b52613197565b610526565b6001601255604051806104318682612137565b3461023a57606036600319011261023a57610431610594604435602435600435613eda565b604080519384526020840192909252908201529081906060820190565b3461023a57600036600319011261023a576014546105dd33600883901c6001600160a01b03161461419c565b60ff81161561062257610100600160a81b0319166014556040513381527fa775782c93424d570e142a52abffaedcebb0e9cd73cca502455acb0587efb6b790602090a1005b606460405162461bcd60e51b81526020600482015260046024820152630854d15560e21b6044820152fd5b3461023a57602036600319011261023a57600435600052601060205260206102bc60a060406000206040516106818161205d565b600180841b038254168152600182015490818682015260028301549081604082015260038401546060820152600560048501549485608084015201549485910152613b6c565b3461023a57600036600319011261023a576106e0612f26565b6106e93361231b565b6106f281613165565b9060005b81811061070e576107074284613272565b6001601255005b8061071c6107269233612b84565b61055182866131a6565b6106f6565b3461023a57608036600319011261023a57610744612012565b61074c611ffc565b90606435906044356001600160401b03831161023a573660238401121561023a576107b0936107886107ab9436906024816004013591016122e4565b9261079b610796843361253e565b61243f565b6107a6838383612606565b612b09565b61251a565b005b3461023a57604036600319011261023a576107cb612012565b6107d3611ffc565b9060018060a01b03809116600052600b60205260406000209116600052602052602060ff604060002054166040519015158152f35b3461023a57602036600319011261023a57600435600052601060205260c0604060002060018060a01b038154169060018101549060028101546003820154906005600484015493015493604051958652602086015260408501526060840152608083015260a0820152f35b3461023a57604036600319011261023a576001600160401b0360043581811161023a576108a4903690600401612172565b9160243590811161023a576108bd903690600401612172565b6108c8929192612f26565b8084036109205760005b8481106108e0576001601255005b6108eb818386613262565b35906001600160a01b038216820361023a5761091661091b9261090f838988613262565b35906131ba565b613197565b6108d2565b60405162461bcd60e51b815260206004820152600b60248201526a30b93930bc9032b93937b960a91b6044820152606490fd5b3461023a57604036600319011261023a576107b061096f612012565b602435906109a76001600160a01b0380610988856123de565b1680331480156109b6575b61099d9150613fcf565b821633141561400c565b6109b18282614049565b6128ca565b5080600052600b60205260406000203360005260205260ff60406000205416806109e5575b61099d9150610993565b50600052600560205260406000203360005260205261099d60ff604060002054166109db565b3461023a576107b0610a1c3661229a565b9033612927565b3461023a57602036600319011261023a576004356001600160401b03811161023a57610a6c610a59610707923690600401612172565b9190610a63612f26565b429236916120cb565b613272565b3461023a57600036600319011261023a5760405160006001805490610a95826121a2565b80855291818116908115610b295750600114610ad0575b61043184610abc81860382612093565b604051918291602083526020830190611fd7565b600081815292507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610b11575050508101602001610abc82610aac565b80546020858701810191909152909301928101610af9565b60ff191660208087019190915292151560051b85019092019250610abc9150839050610aac565b3461023a5760208060031936011261023a576001600160401b039060043582811161023a573660238201121561023a57610b949036906024816004013591016122e4565b90610bad60018060a01b0360145460081c16331461419c565b8151928311610d5057610bc16013546121a2565b601f8111610cec575b508092601f8111600114610c4957807fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912894600091610c3e575b508160011b916000199060031b1c1916176013555b600160ff196014541617601455610c39604051928284938452830190611fd7565b0390a1005b905083015185610c03565b601f1981169360136000527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0909460005b818110610cd557509482916001937fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c91289710610cbc575b5050811b01601355610c18565b85015160001960f88460031b161c191690558580610caf565b858301518755600190960195918401918401610c79565b60136000527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a090601f850160051c810191838610610d46575b601f0160051c01905b818110610d3a5750610bca565b60008155600101610d2d565b9091508190610d24565b634e487b7160e01b600052604160045260246000fd5b3461023a576107b0610d773661229a565b90336140b0565b3461023a576107b0610d8f3661229a565b90610d9b8282336140b0565b33612927565b3461023a57602036600319011261023a5760206102bc610dbf612012565b61231b565b3461023a57600036600319011261023a57610431610abc6121dc565b3461023a57602036600319011261023a57600435600052600c602052602060018060a01b0360406000205416604051908152f35b3461023a57604036600319011261023a57610e2d612012565b610e35611ffc565b600091610e4181612cb9565b916001600160a01b039081169160005b848110610e6357602086604051908152f35b610e6d8183612cde565b6000526020601081526040600020604051610e878161205d565b60a0600587845416938484526001810154809685015260028101546040850152600381015460608501526004810154608085015201549101528514610ed6575b50610ed190613197565b610e51565b610ee490610ed19297612d4e565b9590610ec7565b3461023a57604036600319011261023a576004356001600160401b03811161023a57610f1b903690600401612172565b60243590610f27612f26565b42821015610f3e5761070792610a6c9136916120cb565b60405162461bcd60e51b81526020600482015260076024820152662166757475726560c81b6044820152606490fd5b3461023a57602036600319011261023a576020610f8b6004356123de565b6040516001600160a01b039091168152f35b3461023a57604036600319011261023a57610fb6612012565b610fbe611ffc565b600091610fca8161231b565b916001600160a01b039081169160005b848110610fec57602086604051908152f35b610ff68183612b84565b60005260206010815260406000206040516110108161205d565b60a060058784541693848452600181015480968501526002810154604085015260038101546060850152600481015460808501520154910152851461105f575b5061105a90613197565b610fda565b61106d9061105a9297612d4e565b9590611050565b3461023a57602036600319011261023a576004356008548110156110ab5761109d602091612c12565b90546040519160031b1c8152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b3461023a5760e036600319011261023a5761111e612012565b611126611ffc565b9061112f612f26565b6001600160a01b038116156114ae576001600160a01b0382161561147f5761116460c43560a435604435608435606435613bac565b9190911561023a5760158054600101908190556040516370a0823160e01b8152306004820152939092906020856024816001600160a01b0385165afa9485156113e05760009561144b575b506040516370a0823160e01b81523360048201526020816024816001600160a01b0386165afa9081156113e057600091611419575b50604435116113ec576040516323b872dd60e01b60208201523360248201523060448201526044356064820152606481528060a08101106001600160401b0360a083011117610d505760a08101604052611247906001600160a01b038316613d3a565b6040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa9081156113e0576000916113ac575b5061139c85926112bb7fe7d9b7fd810a51c7f2f160d0c100b1bb756592fdeaf6b9b84425b44eca133e9b936112b560209a60443592612e08565b14613d06565b6040516112c78161205d565b60018060a01b038216815260058982016044358152604083016064358152606084016084358152608085019160a435835260a086019360c43585528a60005260108f5260406000209660018060a01b039051166001600160601b0360a01b885416178755516001870155516002860155516003850155516004840155519101556113518487612f7c565b604080516044358152606435602082015260843591810191909152606081019590955260a435608086015260c43560a08601526001600160a01b0390811695169390819060c0820190565b0390a46001601255604051908152f35b90506020813d6020116113d8575b816113c760209383612093565b8101031261023a575161139c61127b565b3d91506113ba565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260206004820152600560248201526454484c303160d81b6044820152606490fd5b90506020813d602011611443575b8161143460209383612093565b8101031261023a5751866111e4565b3d9150611427565b9094506020813d602011611477575b8161146760209383612093565b8101031261023a575193856111af565b3d915061145a565b60405162461bcd60e51b8152602060048201526007602482015266182fba37b5b2b760c91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a0c17dc9958da5c1a595b9d60aa1b6044820152606490fd5b3461023a57602036600319011261023a5760206102bc6114ff612012565b612cb9565b3461023a576107b061151536612028565b916124a1565b3461023a57602036600319011261023a576020610f8b60043561415e565b3461023a57606036600319011261023a576004356001600160401b0360243581811161023a5761156d903690600401612119565b9060443590811161023a573660238201121561023a578060040135611591816120b4565b9161159f6040519384612093565b81835260209160248385019160051b8301019136831161023a57602401905b828210611674575050506115d0612f26565b825182510361164157506115e48251613165565b9260005b835181101561162e578061160261054061162993876131a6565b61161f816001600160a01b0361161885896131a6565b51166131ba565b61055182886131a6565b6115e8565b6001601255604051806104318782612137565b6064906040519062461bcd60e51b82526004820152600c60248201526b3632b733ba342fb2b93937b960a11b6044820152fd5b81356001600160a01b038116810361023a5781529083019083016115be565b3461023a57604036600319011261023a5760206102bc6116b1612012565b60243590612b84565b3461023a57606036600319011261023a576004356116d6611ffc565b906044356001600160a01b038116810361023a576117008282610707956116fb612f26565b6124a1565b61170982612e15565b612d5b565b3461023a576107b061171f36612028565b9161172d610796843361253e565b612606565b3461023a57604036600319011261023a5761174b612012565b611753611ffc565b61175b612f26565b6117643361231b565b6001600160a01b039283169290919060005b838110611784576001601255005b806117926117b09233612b84565b806000526010602052868460406000205416146117b5575b50613197565b611776565b6117bf90856131ba565b866117aa565b3461023a57600036600319011261023a576020600854604051908152f35b3461023a57604036600319011261023a576107b06117ff612012565b6024359061182c6001600160a01b0380611818856123de565b1680331480156118315761099d9150613fcf565b614049565b50600052600b60205260406000203360005260205261099d60ff60406000205416610993565b3461023a57604036600319011261023a57611870612f26565b61187b6004356123de565b6001600160a01b039061189190821633146134c1565b6118a833826118a16024356123de565b16146134c1565b60043560005260106020526040600020906005604051926118c88461205d565b82815416845260018101546020850152600281015460408501526003810154606085015260048101546080850152015460a0830152602435600052601060205260406000206040519161191a8361205d565b8082541690818452600183015460208501526002830154604085015260056003840154936060860194855260048101546080870152015460a085015284511603611cdd576040830151604083015103611caa576060830151905103611c775760a082015160a082015103611c43576119a66040830151602084015160808501519060a086015192613b6c565b6119c46040830151602084015160808501519060a086015192613b6c565b81148015611c0a575b15611bd95760243560005260106020526001604060002001546004356000526119ff6001604060002001918254612d4e565b9055611a68611a2a611a1a6020860151602086015190612d4e565b9360808087015191015190612d4e565b6040850151611a6060a087015192611a4c611a458589613b59565b9188613b4f565b611bc657611a5a8387612e08565b90612c5f565b948591613b6c565b906004356000526010602052826004604060002001558110611b60575b6024356000526010602052611abc604060002060056000918281558260018201558260028201558260038201558260048201550155565b611ac76024356134f6565b60043560005260106020527f68362f23abee957d51cf9ad5676447be98bb329fda7263be069a80d23569a8e860016040600020015491604085015194611b4c60a0606083015192015192604051938493600435996024359960043599879260a094919796959260c0850198855260208501526040840152606083015260808201520152565b0390a4600160125560206040516004358152f35b601160205260406000205481148015611bb2575b611a855760405162461bcd60e51b815260206004820152601260248201527137b934b3b4b730b61032b7321032b93937b960711b6044820152606490fd5b506024356000526040600020548114611b74565b611a5a84611bd48589612e08565b612e08565b60405162461bcd60e51b815260206004820152600960248201526832b7321032b93937b960b91b6044820152606490fd5b5060043560005260116020526040600020546024356000526040600020541480156119cd575060043560005260406000205415156119cd565b60405162461bcd60e51b815260206004820152600c60248201526b3832b934b7b21032b93937b960a11b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a31b634b3331032b93937b960a91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a39ba30b93a1032b93937b960a91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a3a37b5b2b71032b93937b960a91b6044820152606490fd5b3461023a57604036600319011261023a57611d29612012565b6024356001600160a01b0380611d3e836123de565b168091841614611df257803314908115611dcd575b5015611d62576107b0916128ca565b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b9050600052600560205260406000203360005260205260ff6040600020541683611d53565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b3461023a57604036600319011261023a57610707611e5d611ffc565b611e65612f26565b600435906131ba565b3461023a57602036600319011261023a576020610f8b600435612401565b3461023a57600036600319011261023a5760405160008054611ead816121a2565b80845290600190818116908115610b295750600114611ed65761043184610abc81860382612093565b600080805292507f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b828410611f17575050508101602001610abc82610aac565b80546020858701810191909152909301928101611eff565b3461023a57602036600319011261023a576004359063ffffffff60e01b821680920361023a5760209163780e9d6360e01b8114908115611f71575b5015158152f35b6380ac58cd60e01b811491508115611fa3575b8115611f92575b5083611f6a565b6301ffc9a760e01b14905083611f8b565b635b5e139f60e01b81149150611f84565b60005b838110611fc75750506000910152565b8181015183820152602001611fb7565b90602091611ff081518092818552858086019101611fb4565b601f01601f1916010190565b602435906001600160a01b038216820361023a57565b600435906001600160a01b038216820361023a57565b606090600319011261023a576001600160a01b0390600435828116810361023a5791602435908116810361023a579060443590565b60c081019081106001600160401b03821117610d5057604052565b602081019081106001600160401b03821117610d5057604052565b90601f801991011681019081106001600160401b03821117610d5057604052565b6001600160401b038111610d505760051b60200190565b92916120d6826120b4565b916120e46040519384612093565b829481845260208094019160051b810192831161023a57905b82821061210a5750505050565b813581529083019083016120fd565b9080601f8301121561023a57816020612134933591016120cb565b90565b6020908160408183019282815285518094520193019160005b82811061215e575050505090565b835185529381019392810192600101612150565b9181601f8401121561023a578235916001600160401b03831161023a576020808501948460051b01011161023a57565b90600182811c921680156121d2575b60208310146121bc57565b634e487b7160e01b600052602260045260246000fd5b91607f16916121b1565b60405190600082601354916121f0836121a2565b808352926001908181169081156122785750600114612219575b5061221792500383612093565b565b6013600090815291507f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0905b84831061225d575061221793505081016020013861220a565b81935090816020925483858a01015201910190918592612244565b90506020925061221794915060ff191682840152151560051b8201013861220a565b604090600319011261023a576004356001600160a01b038116810361023a5790602435801515810361023a5790565b6001600160401b038111610d5057601f01601f191660200190565b9291926122f0826122c9565b916122fe6040519384612093565b82948184528183011161023a578281602093846000960137010152565b6001600160a01b0316801561233b57600052600360205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b1561239957565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b6000908152600260205260409020546001600160a01b0316612134811515612392565b600081815260026020526040902054612424906001600160a01b03161515612392565b6000908152600460205260409020546001600160a01b031690565b1561244657565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b612217926107ab92604051926124b684612078565b6000845261079b610796843361253e565b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561252157565b60405162461bcd60e51b81528061253a600482016124c7565b0390fd5b906001600160a01b038080612552846123de565b16931691838314938415612585575b50831561256f575b50505090565b61257b91929350612401565b1614388080612569565b909350600052600560205260406000208260005260205260ff604060002054169238612561565b156125b357565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b9061262c90612614846123de565b6001600160a01b0384811693909291831684146125ac565b8181169384156128795783159081156127cd575060085486600052600960205280604060002055600160401b811015610d50578661267382600161268c9401600855612c12565b90919082549060031b91821b91600019901b1916179055565b83850361279b575b600092868452600a6020526040918285209388826001600160601b0360a01b9687815416905561278b575b50501580612783575b61274c577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9392916127068688936126ff8b6123de565b16146125ac565b87845260046020528084208381541690558584526003602052808420600019815401905581845280842060018154019055878452600260205283209182541617905580a4565b815162461bcd60e51b815260206004820152601060248201526f4e6f74205472616e7366657261626c6560801b6044820152606490fd5b5060016126c8565b61279491612d5b565b38886126bf565b6127a48261231b565b604060008781526006602052818120838252602052888282205588815260076020522055612694565b8585036127db575b5061268c565b6127e49061231b565b600019810190811161286357600090878252602090600782526040918284205482810361282c575b5089845283838120558784526006815282842091845252812055386127d5565b888552600682528385208386528252838520548986526006835284862082875283528085872055855260078252838520553861280c565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b600082815260046020526040902080546001600160a01b0319166001600160a01b03928316908117909155906128ff836123de565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6001600160a01b03918216929116908183146129995760207f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31918360005260058252604060002085600052825261298e8160406000209060ff801983541691151516179055565b6040519015158152a3565b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b3d15612a09573d906129ef826122c9565b916129fd6040519384612093565b82523d6000602084013e565b606090565b9091600091803b15612b0057612a596020918493604051948580948193630a85bd0160e11b9a8b84523360048501528460248501526044840152608060648401526084830190611fd7565b03926001600160a01b03165af190829082612ab1575b5050612aa357612a7d6129de565b80519081612a9e5760405162461bcd60e51b81528061253a600482016124c7565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612af8575b81612acd60209383612093565b81010312612af45751906001600160e01b031982168203612af15750903880612a6f565b80fd5b5080fd5b3d9150612ac0565b50505050600190565b91926000929190813b15612b7a57602091612b5f9185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b0380951660248501526044840152608060648401526084830190611fd7565b0393165af190829082612ab1575050612aa357612a7d6129de565b5050505050600190565b612b8d8161231b565b821015612bb95760018060a01b0316600052600660205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b600854811015612c495760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b634e487b7160e01b600052603260045260246000fd5b8115612c69570490565b634e487b7160e01b600052601260045260246000fd5b15612c8657565b60405162461bcd60e51b815260206004820152600b60248201526a216164647265737328302960a81b6044820152606490fd5b6001600160a01b0316612ccd811515612c7f565b600052600d60205260406000205490565b6001600160a01b03166000818152600d602052604081205491929091811015612d19576040928252600e602052828220908252602052205490565b60405162461bcd60e51b815260206004820152600d60248201526c6f7574206f6620626f756e647360981b6044820152606490fd5b9190820180921161286357565b6001600160a01b031690612d70821515612c7f565b60008281526020600d8152600d60409182842054600e825283852081865282528584862055858552600f825283852055600c8152828420866001600160601b0360a01b82541617905585845252812080549060018201809211612df457557fcd57880fa6fb6b4aedb77272d2cfa8d03186b5034f9b672ccfcd3cd6edfecc9b9080a3565b634e487b7160e01b83526011600452602483fd5b9190820391821161286357565b6000818152600c60209081526040808320546001600160a01b0316939291612e3e851515612c7f565b848352600d81528183205460001990818101908111612edb57858552600f835283852054818103612eef575b508585528484812055868552600e835283852090855282528383812055858452600d82528284208054918201918211612edb5755838352600c9052812080546001600160a01b03191690557f09f87139523b83583b15f476015dd9a27fae3a03f17202cdf77d063bef5d21c29080a3565b634e487b7160e01b85526011600452602485fd5b878652600e8452848620828752845284862054888752600e8552858720828852855280868820558652600f84528486205538612e6a565b600260125414612f37576002601255565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b90604091825192612f8c84612078565b60008085526001600160a01b0383169182156130d657600085815260026020526040902054612fc7906001600160a01b031615155b15613119565b60085490858352602091600983528082852055600160401b8110156130c257928694919282869461300a6107ab9a6126738960016122179f9d9b01600855612c12565b6130138761231b565b82855260068452818520818652845286828620558685526007845281852055600a83526002818520936001600160601b0360a01b94858154169055613058888a612d5b565b60008881526002602052604090205461307b906001600160a01b03161515612fc1565b8386526003815282862060018154019055878652528320918254161790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612a0e565b634e487b7160e01b84526041600452602484fd5b5162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606490fd5b1561312057565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b9061316f826120b4565b61317c6040519182612093565b828152809261318d601f19916120b4565b0190602036910137565b60001981146128635760010190565b8051821015612c495760209160051b010190565b906001600160a01b03806131cd836123de565b169081331491821561323b575b508115613227575b50156131f5576122179161170982612e15565b60405162461bcd60e51b815260206004820152600a60248201526910b232b632b3b0ba37b960b11b6044820152606490fd5b3391506132338361415e565b1614386131e2565b909150600052600b60205260406000203360005260205260ff6040600020541690386131da565b9190811015612c495760051b0190565b919060005b83518110156134bb57613295824261328f84886131a6565b51613eda565b91806132ad575b5050506132a890613197565b613277565b6132b784886131a6565b51926132c2846123de565b6001600160a01b03906132d890821633146134c1565b84600052602090601082526040918383600020928354169287156000146134ab57613322915060056000918281558260018201558260028201558260038201558260048201550155565b61332b876134f6565b8251916370a0823160e01b808452600490338286015260249084868381875afa9586156134a057600096613471575b50865163a9059cbb60e01b86820152338382015260448082018b90528152608081016001600160401b0381118282101761345d57869493929161339f918a5286613d3a565b87519485938492835233908301525afa91821561345257600092613421575b50509284926133fb7fa6faee2246474597b6de7c76bf9a45d256737543cb0806e6e805b55b38c7663f966112b5613416956132a89c9b9a98612e08565b51938493846040919493926060820195825260208201520152565b0390a290388061329c565b81819392933d831161344b575b6134388183612093565b81010312612af1575051826133fb6133be565b503d61342e565b84513d6000823e3d90fd5b83604186634e487b7160e01b600052526000fd5b90958582813d8311613499575b6134888183612093565b81010312612af1575051943861335a565b503d61347e565b87513d6000823e3d90fd5b808860016002930155015561332b565b50509050565b156134c857565b60405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b6044820152606490fd5b6134ff816123de565b6001600160a01b0390808216801591821561369157505060085483600052600960205280604060002055600160401b811015610d5057836126738260016135499401600855612c12565b600854600019919082810190811161286357600093858552602090600982526040926135788488205491612c12565b90549060031b1c61358c8161267384612c12565b875260098352838720558686528583812055600854801561367d5785016135b281612c12565b8782549160031b1b19169055600855868652600a8252828620936001600160601b0360a01b9485815416905561364c57906002916135ef88612e15565b6135f8886123de565b888852600483528488208681541690551694858752600382528387209081540190558686525283209081541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b50606491519062461bcd60e51b82526004820152600b60248201526a216164647265737328302960a81b6044820152fd5b634e487b7160e01b87526031600452602487fd5b61369a9061231b565b60001981019190821161286357600091858352602060078152604092838520548381036136e0575b50878552848481205584526006815282842091845252812055613549565b81865260068352848620848752835284862054828752600684528587208288528452808688205586526007835284862055386136c2565b919091613736613726826123de565b6001600160a01b031633146134c1565b806000526010602052604060002090604051936137528561205d565b82546001600160a01b03168552600183015460208601818152600285015460408801526003850154606088015260048501546080880190815260059095015460a08801529390821015613b1b578115613aea576137bd6040870151855183519060a08a015192613b6c565b90600160155401948560155585976137d6858351612e08565b925191519160408201519160a08101519660608201519486670de0b6b3a7640000810204670de0b6b3a7640000148715171561286357613838670de0b6b3a764000061383061382a61383e94838c02612c5f565b87613b59565b048095612e08565b82613b4f565b613ac65761387561385c6138528a84613b59565b611a5a878b612e08565b985b898361386d83888c8c8c613bac565b999098613bac565b86919691613abe575b5015613a86578860005260116020526040600020548015600014613a815750865b808510613a4b578510613a13577f951d6388fa4b9c632ce8fdc16c4275079f7a0f61173a15b277546c9810fa44dd97610120978a600052601060205284600460406000208a600182015501556138f58c33612f7c565b60018060a01b0384511660058d604087015190606088015160a089015192604051956139208761205d565b8652602086018981526040870191825260608701928352608087019389855260a08801958652600052601060205260406000209660018060a01b039051166001600160601b0360a01b885416178755516001870155516002860155516003850155516004840155519101558a60005260116020526040600020548015600014613a0257508a6000526011602052806040600020558b6000526040600020555b60408301519160a0606085015194015194604051988952602089015260408801526060870152608086015260a085015260c084015260e0830152610100820152a3565b90508b6000526040600020556139bf565b60405162461bcd60e51b815260206004820152601060248201526f39b2b3b6b2b73a22b7321032b93937b960811b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d383630b71032b7321032b93937b960911b6044820152606490fd5b61389f565b60405162461bcd60e51b815260206004820152601060248201526f696e76616c696420656e64206461746560801b6044820152606490fd5b90503861387e565b613875613ae4613ad68a84613b59565b611a5a8b611bd4898d612e08565b9861385e565b60405162461bcd60e51b81526020600482015260096024820152680c17dcd959db595b9d60ba1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600c60248201526b30b6b7bab73a1032b93937b960a11b6044820152606490fd5b8115612c69570690565b8181029291811591840414171561286357565b9190613b788282613b4f565b613b975792613b8d613b929261213495612c5f565b613b59565b612d4e565b92613b9281613b8d613b929461213497612c5f565b9194939290948015613cd6578115613ca857808211613c73578315613c4357613bd58282613b4f565b613c295792613b8d613b9292613bea95612c5f565b809211613bf657600190565b60405162461bcd60e51b815260206004820152600b60248201526a18db1a5999880f88195b9960aa1b6044820152606490fd5b92613b9281613b8d613b9294613c3e97612c5f565b613bea565b60405162461bcd60e51b81526020600482015260086024820152670c17dc195c9a5bd960c21b6044820152606490fd5b60405162461bcd60e51b815260206004820152600d60248201526c1c985d19480f88185b5bdd5b9d609a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526006602482015265305f7261746560d01b6044820152606490fd5b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b15613d0d57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b60018060a01b03169060405160408101908082106001600160401b03831117610d5057613dab916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1613da56129de565b91613e41565b805191821591848315613e1d575b505050905015613dc65750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612af457820151908115158203612af1575080388084613db9565b91929015613ea35750815115613e55575090565b3b15613e5e5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015613eb65750805190602001fd5b60405162461bcd60e51b81526020600482015290819061253a906024830190611fd7565b90916000918252601060205260a06040832060405193613ef98561205d565b600180841b0382541685526001820154938460208701526002830154958660408201526003840154908160608201526005600486015495866080840152015495869101528297808811918215613fc5575b50508015613fbb575b15613f6057505050509192565b613fac94965090613f8b613f8485613f7f89613fa697969a989a612e08565b612c5f565b9283613b59565b9050868111613fb157613fa0905b8097612e08565b94613b59565b90612d4e565b909192565b50613fa086613f99565b5085811115613f53565b1190503880613f4a565b15613fd657565b60405162461bcd60e51b815260206004820152600e60248201526d10b7bbb732b927b832b930ba37b960911b6044820152606490fd5b1561401357565b60405162461bcd60e51b815260206004820152600e60248201526d085cd95b1988185c1c1c9bdd985b60921b6044820152606490fd5b6000828152600a60205260409081902080546001600160a01b0319166001600160a01b039384169081179091557f5f05f4f4b46d943d34b887b4741055b5ab6decb7b4fd2670a98969d38a36408092906140a2856123de565b8351921682526020820152a2565b6001600160a01b03918216911680821461412d577f947bc3b5c76434e50335b9127e82fb1abb17b34d9380caf2a64cd8c6f43711849260609282600052600b6020526040600020816000526020526141188260406000209060ff801983541691151516179055565b604051928352602083015215156040820152a1565b60405162461bcd60e51b815260206004820152600960248201526810b7b832b930ba37b960b91b6044820152606490fd5b600081815260026020526040902054614181906001600160a01b03161515612392565b6000908152600a60205260409020546001600160a01b031690565b156141a357565b60405162461bcd60e51b815260206004820152600660248201526510a0a226a4a760d11b6044820152606490fdfea2646970667358221220f46b5f2f81a6de2cc22d670249a73e3e114a9cf391bcff949fe5bd9fb99f6e8b64736f6c63430008130033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000016426f756e642d546f6b656e4c6f636b7570506c616e73000000000000000000000000000000000000000000000000000000000000000000000000000000000005422d544c50000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611f2f5750806306fdde0314611e8c578063081812fc14611e6e57806308bbb82414611e41578063095ea7b314611d105780630aef166c1461185757806316c09967146117e357806318160ddd146117c55780631f25ccb61461173257806323b872dd1461170e57806323bdaea9146116ba5780632f745c59146116935780632f809b3814611539578063402d5a771461151b57806342842e0e146115045780634c6839cc146114e15780634e897e16146111055780634f6ccce71461107457806352e5b7e414610f9d5780636352211e14610f6d5780636b04021814610eeb5780636b8e3d7314610e145780636bb3c73f14610de05780636c0360eb14610dc457806370a0823114610da15780637b4e51f614610d7e57806388cccd8014610d66578063931688cb14610b5057806395d89b4114610a71578063968b3e5914610a23578063a22cb46514610a0b578063a414159614610953578063a8973e2b14610873578063b162061614610808578063b6f97787146107b2578063b88d4fde1461072b578063b9bdac2c146106c7578063c3ca57551461064d578063c7711c4c146105b1578063c7d74fa71461056f578063c83d7818146104dd578063c87b56dd146102c4578063dc1fa56814610295578063e985e9c51461023f5763fcbdd1961461020e57600080fd5b3461023a57602036600319011261023a5760043560005260116020526020604060002054604051908152f35b600080fd5b3461023a57604036600319011261023a57610258612012565b610260611ffc565b9060018060a01b03809116600052600560205260406000209116600052602052602060ff604060002054166040519015158152f35b3461023a57604036600319011261023a5760206102bc6102b3612012565b60243590612cde565b604051908152f35b3461023a5760208060031936011261023a576004356000818152600260205260409020546102fc906001600160a01b03161515612392565b816103056121dc565b8051909290156104c457600090807a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000081818110156104b6575b5050836d04ee2d6d415b85acef8100000000808310156104aa575b5050662386f26fc100008082101561049d575b506305f5e10080821015610490575b5061271080821015610483575b506064811015610475575b600a8091101561046b575b6001808401928160216103c46103ae876122c9565b966103bc6040519889612093565b8088526122c9565b8689019790601f1901368937860101905b610435575b505050509261041b929161040f9460405195836104008895518092888089019101611fb4565b84019151809386840190611fb4565b01038084520182612093565b905b610431604051928284938452830190611fd7565b0390f35b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215610466579190826103d5565b6103da565b9160010191610399565b60646002910492019161038e565b6004910492019186610383565b6008910492019186610376565b6010910492019186610367565b93019290048387610354565b604094500490508680610339565b5050506040516104d381612078565b600081529061041d565b3461023a57604036600319011261023a576004356024356001600160401b03811161023a57610510903690600401612119565b610518612f26565b6105228151613165565b9160005b825181101561055c578061054761054061055793866131a6565b5184613717565b61055182876131a6565b52613197565b610526565b6001601255604051806104318682612137565b3461023a57606036600319011261023a57610431610594604435602435600435613eda565b604080519384526020840192909252908201529081906060820190565b3461023a57600036600319011261023a576014546105dd33600883901c6001600160a01b03161461419c565b60ff81161561062257610100600160a81b0319166014556040513381527fa775782c93424d570e142a52abffaedcebb0e9cd73cca502455acb0587efb6b790602090a1005b606460405162461bcd60e51b81526020600482015260046024820152630854d15560e21b6044820152fd5b3461023a57602036600319011261023a57600435600052601060205260206102bc60a060406000206040516106818161205d565b600180841b038254168152600182015490818682015260028301549081604082015260038401546060820152600560048501549485608084015201549485910152613b6c565b3461023a57600036600319011261023a576106e0612f26565b6106e93361231b565b6106f281613165565b9060005b81811061070e576107074284613272565b6001601255005b8061071c6107269233612b84565b61055182866131a6565b6106f6565b3461023a57608036600319011261023a57610744612012565b61074c611ffc565b90606435906044356001600160401b03831161023a573660238401121561023a576107b0936107886107ab9436906024816004013591016122e4565b9261079b610796843361253e565b61243f565b6107a6838383612606565b612b09565b61251a565b005b3461023a57604036600319011261023a576107cb612012565b6107d3611ffc565b9060018060a01b03809116600052600b60205260406000209116600052602052602060ff604060002054166040519015158152f35b3461023a57602036600319011261023a57600435600052601060205260c0604060002060018060a01b038154169060018101549060028101546003820154906005600484015493015493604051958652602086015260408501526060840152608083015260a0820152f35b3461023a57604036600319011261023a576001600160401b0360043581811161023a576108a4903690600401612172565b9160243590811161023a576108bd903690600401612172565b6108c8929192612f26565b8084036109205760005b8481106108e0576001601255005b6108eb818386613262565b35906001600160a01b038216820361023a5761091661091b9261090f838988613262565b35906131ba565b613197565b6108d2565b60405162461bcd60e51b815260206004820152600b60248201526a30b93930bc9032b93937b960a91b6044820152606490fd5b3461023a57604036600319011261023a576107b061096f612012565b602435906109a76001600160a01b0380610988856123de565b1680331480156109b6575b61099d9150613fcf565b821633141561400c565b6109b18282614049565b6128ca565b5080600052600b60205260406000203360005260205260ff60406000205416806109e5575b61099d9150610993565b50600052600560205260406000203360005260205261099d60ff604060002054166109db565b3461023a576107b0610a1c3661229a565b9033612927565b3461023a57602036600319011261023a576004356001600160401b03811161023a57610a6c610a59610707923690600401612172565b9190610a63612f26565b429236916120cb565b613272565b3461023a57600036600319011261023a5760405160006001805490610a95826121a2565b80855291818116908115610b295750600114610ad0575b61043184610abc81860382612093565b604051918291602083526020830190611fd7565b600081815292507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610b11575050508101602001610abc82610aac565b80546020858701810191909152909301928101610af9565b60ff191660208087019190915292151560051b85019092019250610abc9150839050610aac565b3461023a5760208060031936011261023a576001600160401b039060043582811161023a573660238201121561023a57610b949036906024816004013591016122e4565b90610bad60018060a01b0360145460081c16331461419c565b8151928311610d5057610bc16013546121a2565b601f8111610cec575b508092601f8111600114610c4957807fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912894600091610c3e575b508160011b916000199060031b1c1916176013555b600160ff196014541617601455610c39604051928284938452830190611fd7565b0390a1005b905083015185610c03565b601f1981169360136000527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0909460005b818110610cd557509482916001937fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c91289710610cbc575b5050811b01601355610c18565b85015160001960f88460031b161c191690558580610caf565b858301518755600190960195918401918401610c79565b60136000527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a090601f850160051c810191838610610d46575b601f0160051c01905b818110610d3a5750610bca565b60008155600101610d2d565b9091508190610d24565b634e487b7160e01b600052604160045260246000fd5b3461023a576107b0610d773661229a565b90336140b0565b3461023a576107b0610d8f3661229a565b90610d9b8282336140b0565b33612927565b3461023a57602036600319011261023a5760206102bc610dbf612012565b61231b565b3461023a57600036600319011261023a57610431610abc6121dc565b3461023a57602036600319011261023a57600435600052600c602052602060018060a01b0360406000205416604051908152f35b3461023a57604036600319011261023a57610e2d612012565b610e35611ffc565b600091610e4181612cb9565b916001600160a01b039081169160005b848110610e6357602086604051908152f35b610e6d8183612cde565b6000526020601081526040600020604051610e878161205d565b60a0600587845416938484526001810154809685015260028101546040850152600381015460608501526004810154608085015201549101528514610ed6575b50610ed190613197565b610e51565b610ee490610ed19297612d4e565b9590610ec7565b3461023a57604036600319011261023a576004356001600160401b03811161023a57610f1b903690600401612172565b60243590610f27612f26565b42821015610f3e5761070792610a6c9136916120cb565b60405162461bcd60e51b81526020600482015260076024820152662166757475726560c81b6044820152606490fd5b3461023a57602036600319011261023a576020610f8b6004356123de565b6040516001600160a01b039091168152f35b3461023a57604036600319011261023a57610fb6612012565b610fbe611ffc565b600091610fca8161231b565b916001600160a01b039081169160005b848110610fec57602086604051908152f35b610ff68183612b84565b60005260206010815260406000206040516110108161205d565b60a060058784541693848452600181015480968501526002810154604085015260038101546060850152600481015460808501520154910152851461105f575b5061105a90613197565b610fda565b61106d9061105a9297612d4e565b9590611050565b3461023a57602036600319011261023a576004356008548110156110ab5761109d602091612c12565b90546040519160031b1c8152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b3461023a5760e036600319011261023a5761111e612012565b611126611ffc565b9061112f612f26565b6001600160a01b038116156114ae576001600160a01b0382161561147f5761116460c43560a435604435608435606435613bac565b9190911561023a5760158054600101908190556040516370a0823160e01b8152306004820152939092906020856024816001600160a01b0385165afa9485156113e05760009561144b575b506040516370a0823160e01b81523360048201526020816024816001600160a01b0386165afa9081156113e057600091611419575b50604435116113ec576040516323b872dd60e01b60208201523360248201523060448201526044356064820152606481528060a08101106001600160401b0360a083011117610d505760a08101604052611247906001600160a01b038316613d3a565b6040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa9081156113e0576000916113ac575b5061139c85926112bb7fe7d9b7fd810a51c7f2f160d0c100b1bb756592fdeaf6b9b84425b44eca133e9b936112b560209a60443592612e08565b14613d06565b6040516112c78161205d565b60018060a01b038216815260058982016044358152604083016064358152606084016084358152608085019160a435835260a086019360c43585528a60005260108f5260406000209660018060a01b039051166001600160601b0360a01b885416178755516001870155516002860155516003850155516004840155519101556113518487612f7c565b604080516044358152606435602082015260843591810191909152606081019590955260a435608086015260c43560a08601526001600160a01b0390811695169390819060c0820190565b0390a46001601255604051908152f35b90506020813d6020116113d8575b816113c760209383612093565b8101031261023a575161139c61127b565b3d91506113ba565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260206004820152600560248201526454484c303160d81b6044820152606490fd5b90506020813d602011611443575b8161143460209383612093565b8101031261023a5751866111e4565b3d9150611427565b9094506020813d602011611477575b8161146760209383612093565b8101031261023a575193856111af565b3d915061145a565b60405162461bcd60e51b8152602060048201526007602482015266182fba37b5b2b760c91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a0c17dc9958da5c1a595b9d60aa1b6044820152606490fd5b3461023a57602036600319011261023a5760206102bc6114ff612012565b612cb9565b3461023a576107b061151536612028565b916124a1565b3461023a57602036600319011261023a576020610f8b60043561415e565b3461023a57606036600319011261023a576004356001600160401b0360243581811161023a5761156d903690600401612119565b9060443590811161023a573660238201121561023a578060040135611591816120b4565b9161159f6040519384612093565b81835260209160248385019160051b8301019136831161023a57602401905b828210611674575050506115d0612f26565b825182510361164157506115e48251613165565b9260005b835181101561162e578061160261054061162993876131a6565b61161f816001600160a01b0361161885896131a6565b51166131ba565b61055182886131a6565b6115e8565b6001601255604051806104318782612137565b6064906040519062461bcd60e51b82526004820152600c60248201526b3632b733ba342fb2b93937b960a11b6044820152fd5b81356001600160a01b038116810361023a5781529083019083016115be565b3461023a57604036600319011261023a5760206102bc6116b1612012565b60243590612b84565b3461023a57606036600319011261023a576004356116d6611ffc565b906044356001600160a01b038116810361023a576117008282610707956116fb612f26565b6124a1565b61170982612e15565b612d5b565b3461023a576107b061171f36612028565b9161172d610796843361253e565b612606565b3461023a57604036600319011261023a5761174b612012565b611753611ffc565b61175b612f26565b6117643361231b565b6001600160a01b039283169290919060005b838110611784576001601255005b806117926117b09233612b84565b806000526010602052868460406000205416146117b5575b50613197565b611776565b6117bf90856131ba565b866117aa565b3461023a57600036600319011261023a576020600854604051908152f35b3461023a57604036600319011261023a576107b06117ff612012565b6024359061182c6001600160a01b0380611818856123de565b1680331480156118315761099d9150613fcf565b614049565b50600052600b60205260406000203360005260205261099d60ff60406000205416610993565b3461023a57604036600319011261023a57611870612f26565b61187b6004356123de565b6001600160a01b039061189190821633146134c1565b6118a833826118a16024356123de565b16146134c1565b60043560005260106020526040600020906005604051926118c88461205d565b82815416845260018101546020850152600281015460408501526003810154606085015260048101546080850152015460a0830152602435600052601060205260406000206040519161191a8361205d565b8082541690818452600183015460208501526002830154604085015260056003840154936060860194855260048101546080870152015460a085015284511603611cdd576040830151604083015103611caa576060830151905103611c775760a082015160a082015103611c43576119a66040830151602084015160808501519060a086015192613b6c565b6119c46040830151602084015160808501519060a086015192613b6c565b81148015611c0a575b15611bd95760243560005260106020526001604060002001546004356000526119ff6001604060002001918254612d4e565b9055611a68611a2a611a1a6020860151602086015190612d4e565b9360808087015191015190612d4e565b6040850151611a6060a087015192611a4c611a458589613b59565b9188613b4f565b611bc657611a5a8387612e08565b90612c5f565b948591613b6c565b906004356000526010602052826004604060002001558110611b60575b6024356000526010602052611abc604060002060056000918281558260018201558260028201558260038201558260048201550155565b611ac76024356134f6565b60043560005260106020527f68362f23abee957d51cf9ad5676447be98bb329fda7263be069a80d23569a8e860016040600020015491604085015194611b4c60a0606083015192015192604051938493600435996024359960043599879260a094919796959260c0850198855260208501526040840152606083015260808201520152565b0390a4600160125560206040516004358152f35b601160205260406000205481148015611bb2575b611a855760405162461bcd60e51b815260206004820152601260248201527137b934b3b4b730b61032b7321032b93937b960711b6044820152606490fd5b506024356000526040600020548114611b74565b611a5a84611bd48589612e08565b612e08565b60405162461bcd60e51b815260206004820152600960248201526832b7321032b93937b960b91b6044820152606490fd5b5060043560005260116020526040600020546024356000526040600020541480156119cd575060043560005260406000205415156119cd565b60405162461bcd60e51b815260206004820152600c60248201526b3832b934b7b21032b93937b960a11b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a31b634b3331032b93937b960a91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a39ba30b93a1032b93937b960a91b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a3a37b5b2b71032b93937b960a91b6044820152606490fd5b3461023a57604036600319011261023a57611d29612012565b6024356001600160a01b0380611d3e836123de565b168091841614611df257803314908115611dcd575b5015611d62576107b0916128ca565b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b9050600052600560205260406000203360005260205260ff6040600020541683611d53565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b3461023a57604036600319011261023a57610707611e5d611ffc565b611e65612f26565b600435906131ba565b3461023a57602036600319011261023a576020610f8b600435612401565b3461023a57600036600319011261023a5760405160008054611ead816121a2565b80845290600190818116908115610b295750600114611ed65761043184610abc81860382612093565b600080805292507f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b828410611f17575050508101602001610abc82610aac565b80546020858701810191909152909301928101611eff565b3461023a57602036600319011261023a576004359063ffffffff60e01b821680920361023a5760209163780e9d6360e01b8114908115611f71575b5015158152f35b6380ac58cd60e01b811491508115611fa3575b8115611f92575b5083611f6a565b6301ffc9a760e01b14905083611f8b565b635b5e139f60e01b81149150611f84565b60005b838110611fc75750506000910152565b8181015183820152602001611fb7565b90602091611ff081518092818552858086019101611fb4565b601f01601f1916010190565b602435906001600160a01b038216820361023a57565b600435906001600160a01b038216820361023a57565b606090600319011261023a576001600160a01b0390600435828116810361023a5791602435908116810361023a579060443590565b60c081019081106001600160401b03821117610d5057604052565b602081019081106001600160401b03821117610d5057604052565b90601f801991011681019081106001600160401b03821117610d5057604052565b6001600160401b038111610d505760051b60200190565b92916120d6826120b4565b916120e46040519384612093565b829481845260208094019160051b810192831161023a57905b82821061210a5750505050565b813581529083019083016120fd565b9080601f8301121561023a57816020612134933591016120cb565b90565b6020908160408183019282815285518094520193019160005b82811061215e575050505090565b835185529381019392810192600101612150565b9181601f8401121561023a578235916001600160401b03831161023a576020808501948460051b01011161023a57565b90600182811c921680156121d2575b60208310146121bc57565b634e487b7160e01b600052602260045260246000fd5b91607f16916121b1565b60405190600082601354916121f0836121a2565b808352926001908181169081156122785750600114612219575b5061221792500383612093565b565b6013600090815291507f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0905b84831061225d575061221793505081016020013861220a565b81935090816020925483858a01015201910190918592612244565b90506020925061221794915060ff191682840152151560051b8201013861220a565b604090600319011261023a576004356001600160a01b038116810361023a5790602435801515810361023a5790565b6001600160401b038111610d5057601f01601f191660200190565b9291926122f0826122c9565b916122fe6040519384612093565b82948184528183011161023a578281602093846000960137010152565b6001600160a01b0316801561233b57600052600360205260406000205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b1561239957565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b6000908152600260205260409020546001600160a01b0316612134811515612392565b600081815260026020526040902054612424906001600160a01b03161515612392565b6000908152600460205260409020546001600160a01b031690565b1561244657565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b612217926107ab92604051926124b684612078565b6000845261079b610796843361253e565b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561252157565b60405162461bcd60e51b81528061253a600482016124c7565b0390fd5b906001600160a01b038080612552846123de565b16931691838314938415612585575b50831561256f575b50505090565b61257b91929350612401565b1614388080612569565b909350600052600560205260406000208260005260205260ff604060002054169238612561565b156125b357565b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b9061262c90612614846123de565b6001600160a01b0384811693909291831684146125ac565b8181169384156128795783159081156127cd575060085486600052600960205280604060002055600160401b811015610d50578661267382600161268c9401600855612c12565b90919082549060031b91821b91600019901b1916179055565b83850361279b575b600092868452600a6020526040918285209388826001600160601b0360a01b9687815416905561278b575b50501580612783575b61274c577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9392916127068688936126ff8b6123de565b16146125ac565b87845260046020528084208381541690558584526003602052808420600019815401905581845280842060018154019055878452600260205283209182541617905580a4565b815162461bcd60e51b815260206004820152601060248201526f4e6f74205472616e7366657261626c6560801b6044820152606490fd5b5060016126c8565b61279491612d5b565b38886126bf565b6127a48261231b565b604060008781526006602052818120838252602052888282205588815260076020522055612694565b8585036127db575b5061268c565b6127e49061231b565b600019810190811161286357600090878252602090600782526040918284205482810361282c575b5089845283838120558784526006815282842091845252812055386127d5565b888552600682528385208386528252838520548986526006835284862082875283528085872055855260078252838520553861280c565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b600082815260046020526040902080546001600160a01b0319166001600160a01b03928316908117909155906128ff836123de565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6001600160a01b03918216929116908183146129995760207f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31918360005260058252604060002085600052825261298e8160406000209060ff801983541691151516179055565b6040519015158152a3565b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b3d15612a09573d906129ef826122c9565b916129fd6040519384612093565b82523d6000602084013e565b606090565b9091600091803b15612b0057612a596020918493604051948580948193630a85bd0160e11b9a8b84523360048501528460248501526044840152608060648401526084830190611fd7565b03926001600160a01b03165af190829082612ab1575b5050612aa357612a7d6129de565b80519081612a9e5760405162461bcd60e51b81528061253a600482016124c7565b602001fd5b6001600160e01b0319161490565b909192506020813d8211612af8575b81612acd60209383612093565b81010312612af45751906001600160e01b031982168203612af15750903880612a6f565b80fd5b5080fd5b3d9150612ac0565b50505050600190565b91926000929190813b15612b7a57602091612b5f9185604051958680958194630a85bd0160e11b9b8c845233600485015260018060a01b0380951660248501526044840152608060648401526084830190611fd7565b0393165af190829082612ab1575050612aa357612a7d6129de565b5050505050600190565b612b8d8161231b565b821015612bb95760018060a01b0316600052600660205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b600854811015612c495760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b634e487b7160e01b600052603260045260246000fd5b8115612c69570490565b634e487b7160e01b600052601260045260246000fd5b15612c8657565b60405162461bcd60e51b815260206004820152600b60248201526a216164647265737328302960a81b6044820152606490fd5b6001600160a01b0316612ccd811515612c7f565b600052600d60205260406000205490565b6001600160a01b03166000818152600d602052604081205491929091811015612d19576040928252600e602052828220908252602052205490565b60405162461bcd60e51b815260206004820152600d60248201526c6f7574206f6620626f756e647360981b6044820152606490fd5b9190820180921161286357565b6001600160a01b031690612d70821515612c7f565b60008281526020600d8152600d60409182842054600e825283852081865282528584862055858552600f825283852055600c8152828420866001600160601b0360a01b82541617905585845252812080549060018201809211612df457557fcd57880fa6fb6b4aedb77272d2cfa8d03186b5034f9b672ccfcd3cd6edfecc9b9080a3565b634e487b7160e01b83526011600452602483fd5b9190820391821161286357565b6000818152600c60209081526040808320546001600160a01b0316939291612e3e851515612c7f565b848352600d81528183205460001990818101908111612edb57858552600f835283852054818103612eef575b508585528484812055868552600e835283852090855282528383812055858452600d82528284208054918201918211612edb5755838352600c9052812080546001600160a01b03191690557f09f87139523b83583b15f476015dd9a27fae3a03f17202cdf77d063bef5d21c29080a3565b634e487b7160e01b85526011600452602485fd5b878652600e8452848620828752845284862054888752600e8552858720828852855280868820558652600f84528486205538612e6a565b600260125414612f37576002601255565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b90604091825192612f8c84612078565b60008085526001600160a01b0383169182156130d657600085815260026020526040902054612fc7906001600160a01b031615155b15613119565b60085490858352602091600983528082852055600160401b8110156130c257928694919282869461300a6107ab9a6126738960016122179f9d9b01600855612c12565b6130138761231b565b82855260068452818520818652845286828620558685526007845281852055600a83526002818520936001600160601b0360a01b94858154169055613058888a612d5b565b60008881526002602052604090205461307b906001600160a01b03161515612fc1565b8386526003815282862060018154019055878652528320918254161790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612a0e565b634e487b7160e01b84526041600452602484fd5b5162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606490fd5b1561312057565b60405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b9061316f826120b4565b61317c6040519182612093565b828152809261318d601f19916120b4565b0190602036910137565b60001981146128635760010190565b8051821015612c495760209160051b010190565b906001600160a01b03806131cd836123de565b169081331491821561323b575b508115613227575b50156131f5576122179161170982612e15565b60405162461bcd60e51b815260206004820152600a60248201526910b232b632b3b0ba37b960b11b6044820152606490fd5b3391506132338361415e565b1614386131e2565b909150600052600b60205260406000203360005260205260ff6040600020541690386131da565b9190811015612c495760051b0190565b919060005b83518110156134bb57613295824261328f84886131a6565b51613eda565b91806132ad575b5050506132a890613197565b613277565b6132b784886131a6565b51926132c2846123de565b6001600160a01b03906132d890821633146134c1565b84600052602090601082526040918383600020928354169287156000146134ab57613322915060056000918281558260018201558260028201558260038201558260048201550155565b61332b876134f6565b8251916370a0823160e01b808452600490338286015260249084868381875afa9586156134a057600096613471575b50865163a9059cbb60e01b86820152338382015260448082018b90528152608081016001600160401b0381118282101761345d57869493929161339f918a5286613d3a565b87519485938492835233908301525afa91821561345257600092613421575b50509284926133fb7fa6faee2246474597b6de7c76bf9a45d256737543cb0806e6e805b55b38c7663f966112b5613416956132a89c9b9a98612e08565b51938493846040919493926060820195825260208201520152565b0390a290388061329c565b81819392933d831161344b575b6134388183612093565b81010312612af1575051826133fb6133be565b503d61342e565b84513d6000823e3d90fd5b83604186634e487b7160e01b600052526000fd5b90958582813d8311613499575b6134888183612093565b81010312612af1575051943861335a565b503d61347e565b87513d6000823e3d90fd5b808860016002930155015561332b565b50509050565b156134c857565b60405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b6044820152606490fd5b6134ff816123de565b6001600160a01b0390808216801591821561369157505060085483600052600960205280604060002055600160401b811015610d5057836126738260016135499401600855612c12565b600854600019919082810190811161286357600093858552602090600982526040926135788488205491612c12565b90549060031b1c61358c8161267384612c12565b875260098352838720558686528583812055600854801561367d5785016135b281612c12565b8782549160031b1b19169055600855868652600a8252828620936001600160601b0360a01b9485815416905561364c57906002916135ef88612e15565b6135f8886123de565b888852600483528488208681541690551694858752600382528387209081540190558686525283209081541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b50606491519062461bcd60e51b82526004820152600b60248201526a216164647265737328302960a81b6044820152fd5b634e487b7160e01b87526031600452602487fd5b61369a9061231b565b60001981019190821161286357600091858352602060078152604092838520548381036136e0575b50878552848481205584526006815282842091845252812055613549565b81865260068352848620848752835284862054828752600684528587208288528452808688205586526007835284862055386136c2565b919091613736613726826123de565b6001600160a01b031633146134c1565b806000526010602052604060002090604051936137528561205d565b82546001600160a01b03168552600183015460208601818152600285015460408801526003850154606088015260048501546080880190815260059095015460a08801529390821015613b1b578115613aea576137bd6040870151855183519060a08a015192613b6c565b90600160155401948560155585976137d6858351612e08565b925191519160408201519160a08101519660608201519486670de0b6b3a7640000810204670de0b6b3a7640000148715171561286357613838670de0b6b3a764000061383061382a61383e94838c02612c5f565b87613b59565b048095612e08565b82613b4f565b613ac65761387561385c6138528a84613b59565b611a5a878b612e08565b985b898361386d83888c8c8c613bac565b999098613bac565b86919691613abe575b5015613a86578860005260116020526040600020548015600014613a815750865b808510613a4b578510613a13577f951d6388fa4b9c632ce8fdc16c4275079f7a0f61173a15b277546c9810fa44dd97610120978a600052601060205284600460406000208a600182015501556138f58c33612f7c565b60018060a01b0384511660058d604087015190606088015160a089015192604051956139208761205d565b8652602086018981526040870191825260608701928352608087019389855260a08801958652600052601060205260406000209660018060a01b039051166001600160601b0360a01b885416178755516001870155516002860155516003850155516004840155519101558a60005260116020526040600020548015600014613a0257508a6000526011602052806040600020558b6000526040600020555b60408301519160a0606085015194015194604051988952602089015260408801526060870152608086015260a085015260c084015260e0830152610100820152a3565b90508b6000526040600020556139bf565b60405162461bcd60e51b815260206004820152601060248201526f39b2b3b6b2b73a22b7321032b93937b960811b6044820152606490fd5b60405162461bcd60e51b815260206004820152600e60248201526d383630b71032b7321032b93937b960911b6044820152606490fd5b61389f565b60405162461bcd60e51b815260206004820152601060248201526f696e76616c696420656e64206461746560801b6044820152606490fd5b90503861387e565b613875613ae4613ad68a84613b59565b611a5a8b611bd4898d612e08565b9861385e565b60405162461bcd60e51b81526020600482015260096024820152680c17dcd959db595b9d60ba1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600c60248201526b30b6b7bab73a1032b93937b960a11b6044820152606490fd5b8115612c69570690565b8181029291811591840414171561286357565b9190613b788282613b4f565b613b975792613b8d613b929261213495612c5f565b613b59565b612d4e565b92613b9281613b8d613b929461213497612c5f565b9194939290948015613cd6578115613ca857808211613c73578315613c4357613bd58282613b4f565b613c295792613b8d613b9292613bea95612c5f565b809211613bf657600190565b60405162461bcd60e51b815260206004820152600b60248201526a18db1a5999880f88195b9960aa1b6044820152606490fd5b92613b9281613b8d613b9294613c3e97612c5f565b613bea565b60405162461bcd60e51b81526020600482015260086024820152670c17dc195c9a5bd960c21b6044820152606490fd5b60405162461bcd60e51b815260206004820152600d60248201526c1c985d19480f88185b5bdd5b9d609a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526006602482015265305f7261746560d01b6044820152606490fd5b60405162461bcd60e51b81526020600482015260086024820152670c17d85b5bdd5b9d60c21b6044820152606490fd5b15613d0d57565b60405162461bcd60e51b81526020600482015260056024820152642a2426181960d91b6044820152606490fd5b60018060a01b03169060405160408101908082106001600160401b03831117610d5057613dab916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1613da56129de565b91613e41565b805191821591848315613e1d575b505050905015613dc65750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612af457820151908115158203612af1575080388084613db9565b91929015613ea35750815115613e55575090565b3b15613e5e5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015613eb65750805190602001fd5b60405162461bcd60e51b81526020600482015290819061253a906024830190611fd7565b90916000918252601060205260a06040832060405193613ef98561205d565b600180841b0382541685526001820154938460208701526002830154958660408201526003840154908160608201526005600486015495866080840152015495869101528297808811918215613fc5575b50508015613fbb575b15613f6057505050509192565b613fac94965090613f8b613f8485613f7f89613fa697969a989a612e08565b612c5f565b9283613b59565b9050868111613fb157613fa0905b8097612e08565b94613b59565b90612d4e565b909192565b50613fa086613f99565b5085811115613f53565b1190503880613f4a565b15613fd657565b60405162461bcd60e51b815260206004820152600e60248201526d10b7bbb732b927b832b930ba37b960911b6044820152606490fd5b1561401357565b60405162461bcd60e51b815260206004820152600e60248201526d085cd95b1988185c1c1c9bdd985b60921b6044820152606490fd5b6000828152600a60205260409081902080546001600160a01b0319166001600160a01b039384169081179091557f5f05f4f4b46d943d34b887b4741055b5ab6decb7b4fd2670a98969d38a36408092906140a2856123de565b8351921682526020820152a2565b6001600160a01b03918216911680821461412d577f947bc3b5c76434e50335b9127e82fb1abb17b34d9380caf2a64cd8c6f43711849260609282600052600b6020526040600020816000526020526141188260406000209060ff801983541691151516179055565b604051928352602083015215156040820152a1565b60405162461bcd60e51b815260206004820152600960248201526810b7b832b930ba37b960b91b6044820152606490fd5b600081815260026020526040902054614181906001600160a01b03161515612392565b6000908152600a60205260409020546001600160a01b031690565b156141a357565b60405162461bcd60e51b815260206004820152600660248201526510a0a226a4a760d11b6044820152606490fdfea2646970667358221220f46b5f2f81a6de2cc22d670249a73e3e114a9cf391bcff949fe5bd9fb99f6e8b64736f6c63430008130033

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

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000016426f756e642d546f6b656e4c6f636b7570506c616e73000000000000000000000000000000000000000000000000000000000000000000000000000000000005422d544c50000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): Bound-TokenLockupPlans
Arg [1] : symbol (string): B-TLP

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [3] : 426f756e642d546f6b656e4c6f636b7570506c616e7300000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [5] : 422d544c50000000000000000000000000000000000000000000000000000000


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.