ETH Price: $2,957.09 (-0.26%)

Contract

0x3dd1e6c7F905322136E5DF5ECf638059877E0a20

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Create Bulk Vest...254759572025-08-26 16:05:16151 days ago1756224316IN
UNCX Network : Smart Token Vesting
0 ETH0.000008830.00046929
Create Bulk Vest...254757572025-08-26 16:01:56151 days ago1756224116IN
UNCX Network : Smart Token Vesting
0 ETH0.000008180.00042928
Create Bulk Vest...254752652025-08-26 15:53:44151 days ago1756223624IN
UNCX Network : Smart Token Vesting
0 ETH0.000008830.00047839
Create Bulk Vest...254750752025-08-26 15:50:34151 days ago1756223434IN
UNCX Network : Smart Token Vesting
0 ETH0.00000470.0002536
Create Bulk Vest...254746502025-08-26 15:43:29151 days ago1756223009IN
UNCX Network : Smart Token Vesting
0 ETH0.000001370.00008402
Create Bulk Vest...254746052025-08-26 15:42:44151 days ago1756222964IN
UNCX Network : Smart Token Vesting
0 ETH0.00000140.0000854
Set Creator Fee ...254739522025-08-26 15:31:51151 days ago1756222311IN
UNCX Network : Smart Token Vesting
0 ETH00.0001003
Set Fee Percenta...253723402025-08-25 11:18:19152 days ago1756120699IN
UNCX Network : Smart Token Vesting
0 ETH00.00011029
Set Flat Fee253723372025-08-25 11:18:16152 days ago1756120696IN
UNCX Network : Smart Token Vesting
0 ETH00.00000385
Create Airdrop V...251062892025-08-22 9:24:08155 days ago1755854648IN
UNCX Network : Smart Token Vesting
0 ETH0.000000120.00010034
Create Airdrop V...251062742025-08-22 9:23:53155 days ago1755854633IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010033
Create Airdrop V...251062652025-08-22 9:23:44155 days ago1755854624IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010033
Create Airdrop V...251062332025-08-22 9:23:12155 days ago1755854592IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010034
Create Airdrop V...251062202025-08-22 9:22:59155 days ago1755854579IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010033
Create Airdrop V...251062022025-08-22 9:22:41155 days ago1755854561IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010033
Create Airdrop V...251061922025-08-22 9:22:31155 days ago1755854551IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010032
Create Airdrop V...251061832025-08-22 9:22:22155 days ago1755854542IN
UNCX Network : Smart Token Vesting
0 ETH0.000001770.00010032
Create Airdrop V...251061712025-08-22 9:22:10155 days ago1755854530IN
UNCX Network : Smart Token Vesting
0 ETH0.000001780.00010032
Cancel250453282025-08-21 16:28:07155 days ago1755793687IN
UNCX Network : Smart Token Vesting
0 ETH0.000000010.00010032
Create Vesting250453112025-08-21 16:27:50155 days ago1755793670IN
UNCX Network : Smart Token Vesting
0 ETH0.000000050.00010032
Cancel250452752025-08-21 16:27:14155 days ago1755793634IN
UNCX Network : Smart Token Vesting
0 ETH0.000000010.00010031
Create Vesting250452532025-08-21 16:26:52155 days ago1755793612IN
UNCX Network : Smart Token Vesting
0 ETH0.000000060.0001003
Cancel250451572025-08-21 16:25:16155 days ago1755793516IN
UNCX Network : Smart Token Vesting
0 ETH0.000000010.00010031
Create Vesting250451032025-08-21 16:24:22155 days ago1755793462IN
UNCX Network : Smart Token Vesting
0 ETH0.000000080.00010031
Cancel250447862025-08-21 16:19:05155 days ago1755793145IN
UNCX Network : Smart Token Vesting
0 ETH0.000000010.00010031
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VestingManager

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 5 runs

Other Settings:
paris EvmVersion
File 1 of 24 : VestingManager.sol
/// @title VestingManager
// SPDX-License-Identifier: UNLICENSED
// ALL RIGHTS RESERVED
// UNCX by SDDTech reserves all rights on this code. You may not copy these contracts.

pragma solidity ^0.8.27;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IVestingManager.sol";
import "./interfaces/IVestingCalculator.sol";
import "./interfaces/IVesting.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IVestingSVGGenerator.sol";


/// @notice Main contract for managing vesting schedules
contract VestingManager is ERC721, Ownable2Step, ReentrancyGuard, IVestingManager {
    using SafeERC20 for IERC20;

    // State variables
    /// @notice Calculator contract used for vesting calculations
    IVestingCalculator public immutable calculator;
    /// @notice SVG Generator contract used for NFT metadata
    IVestingSVGGenerator public svgGenerator;
    /// @notice Counter for generating unique vesting IDs
    uint256 public nextVestingId;

    /// @notice Maps token address to total shares
    mapping(address => uint256) private _totalTokenShares;
    /// @notice Maps vesting ID to deposited shares
    mapping(uint256 => uint256) private _depositedShares;

    /// @notice Maps vesting ID to its vesting schedule details
    mapping(uint256 => VestingSchedule) public vestingSchedules;

    /// @notice Maps vesting ID to whether it can be transferred
    mapping(uint256 => bool) private _transferable;

    /// @notice Maps token address to share ratio (starts at 1:1)
    mapping(address => uint256) private _shareRatio;

    /// @notice Fee percentage in basis points (1/100 of 1%)
    uint256 public feePercentage;
    /// @notice Flat fee amount in wei
    uint256 public flatFee;
    /// @notice Address that receives fees
    address public feeCollector;

    /// @notice Mapping of creators exempt from fees
    mapping(address => bool) public feeExemptCreators;
    /// @notice Mapping of tokens exempt from fees
    mapping(address => bool) public feeExemptTokens;


    /// @notice Initializes the contract with a calculator address and SVG generator
    /// @param _calculator Address of the vesting calculator contract
    /// @param _svgGenerator Address of the SVG generator contract
    /// @param _feeCollector Address of the fee collector
    constructor(
        address _calculator, 
        address _svgGenerator, 
        address _feeCollector
    ) ERC721("Vesting NFT", "VNFT") Ownable(msg.sender) {
        if (_calculator == address(0)) revert InvalidCalculator();
        if (_svgGenerator == address(0)) revert InvalidSVGGenerator();
        if (_feeCollector == address(0)) revert InvalidFeeCollector();
        
        calculator = IVestingCalculator(_calculator);
        svgGenerator = IVestingSVGGenerator(_svgGenerator);
        feeCollector = _feeCollector;
    }

    /// @notice Creates a standard linear vesting schedule
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiary Address that will receive the vested tokens
    /// @param isSoft Whether the vesting can be cancelled
    /// @param isNftized Whether the vesting NFT can be minted
    /// @param isTransferable Whether the vesting NFT can be transferred
    /// @param isTopable Whether the vesting can be topped up
    /// @return The ID of the created vesting schedule
    function createVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external override payable nonReentrant returns (uint256) {
        return _createVesting(
            token,
            tranches,
            beneficiary,
            isSoft,
            IVesting.VestingType.NORMAL,
            isNftized,
            isTransferable,
            isTopable
        );
    }

    /// @notice Creates a daily soft vesting schedule
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiary Address that will receive the vested tokens
    /// @return The ID of the created vesting schedule
    function createDailySoftVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary
    ) external payable nonReentrant returns (uint256) {
        return _createVesting(
            token,
            tranches,
            beneficiary,
            true,
            IVesting.VestingType.NORMAL,
            false,
            false,
            true      // Topable by default for daily soft vesting
        );
    }


    /// @notice Creates multiple vesting schedules in a single transaction
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiaries Array of addresses that will receive the vested tokens
    /// @param isSoft Whether the vestings can be cancelled
    /// @param isNftized Whether the vesting NFTs can be minted
    /// @param isTransferable Whether the vesting NFTs can be transferred
    /// @param isTopable Whether the vestings can be topped up
        /// @return Array of created vesting IDs
    // solhint-disable-next-line code-complexity
     function createAirdropVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address[] calldata beneficiaries,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external override payable nonReentrant returns (uint256[] memory) {
        if (beneficiaries.length == 0) revert InvalidArray();
        
        // Compute per-vesting totals
        uint256 totalAmountPer = calculator.getTotalAmount(tranches);
        if (totalAmountPer == 0) revert InvalidAmount();

        bool shouldPayTokenFees = !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
        uint256 tokenFeePer = 0;
        if (shouldPayTokenFees && feePercentage > 0) {
            tokenFeePer = (totalAmountPer * feePercentage) / 10000;
        }
        uint256 netPer = totalAmountPer - tokenFeePer;

        // Handle flat fee once (if configured and not exempt)
        bool shouldPayFlatFee = flatFee > 0 && !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
        if (shouldPayFlatFee) {
            if (msg.value < flatFee) revert InvalidFlatFee();
            (bool success, ) = feeCollector.call{value: flatFee}("");
            if (!success) revert FeeTransferFailed();
            emit FeesCollected(token, 0, flatFee);
        }

        // Lock current share ratio once before minting shares
        _updateShareRatio(token);

        // Transfer all tokens once
        uint256 totalTransferAmount = totalAmountPer * beneficiaries.length;
        IERC20(token).safeTransferFrom(msg.sender, address(this), totalTransferAmount);

        // Transfer aggregated percentage fee once
        if (tokenFeePer > 0) {
            uint256 totalTokenFee = tokenFeePer * beneficiaries.length;
            IERC20(token).safeTransfer(feeCollector, totalTokenFee);
            emit FeesCollected(token, totalTokenFee, 0);
        }
        
        uint256[] memory vestingIds = new uint256[](beneficiaries.length);
        
        for (uint256 i = 0; i < beneficiaries.length; i++) {
            vestingIds[i] = _createVestingPrepaid(
                token,
                tranches,
                beneficiaries[i],
                isSoft,
                IVesting.VestingType.NORMAL,
                isNftized,
                isTransferable,
                isTopable,
                netPer
            );
        }

        emit AirdropVestingCreated(vestingIds, beneficiaries);
        return vestingIds;
    }

    // solhint-disable-next-line code-complexity
    function createBulkVestingForBeneficiary(
        address[] calldata tokens,
        IVestingCalculator.TimeAmount[][] calldata tranchesList,
        address beneficiary,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external override payable nonReentrant returns (uint256[] memory) {
        if (beneficiary == address(0)) revert InvalidBeneficiary();
        if (tokens.length == 0 || tokens.length != tranchesList.length) revert InvalidArray();

        // Pay flat fee once if applicable
        bool shouldPayFlatFee = flatFee > 0 && !feeExemptCreators[msg.sender];
        if (shouldPayFlatFee) {
            if (msg.value < flatFee) revert InvalidFlatFee();
            (bool success, ) = feeCollector.call{value: flatFee}("");
            if (!success) revert FeeTransferFailed();
            emit FeesCollected(address(0), 0, flatFee);
        }

        // Aggregate per-token totals to minimize transfers and fees
        // totalGrossPerToken[token] => total gross to transfer
        // totalFeePerToken[token] => total percentage fee to collect
        uint256[] memory totalsPerIndex = new uint256[](tokens.length);
        uint256[] memory netPerIndex = new uint256[](tokens.length);

        // First pass: compute gross and net per vesting, and aggregate per token
        // Use local map-like arrays for unique token handling
        address[] memory uniqueTokens = new address[](tokens.length);
        uint256[] memory grossPerToken = new uint256[](tokens.length);
        uint256[] memory feePerToken = new uint256[](tokens.length);
        uint256 uniqueCount = 0;

        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            uint256 gross = calculator.getTotalAmount(tranchesList[i]);
            if (gross == 0) revert InvalidAmount();

            bool shouldPayTokenFees = !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
            uint256 tokenFee = (shouldPayTokenFees && feePercentage > 0)
                ? (gross * feePercentage) / 10000
                : 0;
            uint256 net = gross - tokenFee;

            totalsPerIndex[i] = gross;
            netPerIndex[i] = net;

            // find or add token in uniqueTokens
            uint256 idx = type(uint256).max;
            for (uint256 j = 0; j < uniqueCount; j++) {
                if (uniqueTokens[j] == token) { idx = j; break; }
            }
            if (idx == type(uint256).max) {
                uniqueTokens[uniqueCount] = token;
                grossPerToken[uniqueCount] = gross;
                feePerToken[uniqueCount] = tokenFee;
                uniqueCount++;
            } else {
                grossPerToken[idx] += gross;
                feePerToken[idx] += tokenFee;
            }
        }

        // Lock share ratio per unique token once
        for (uint256 j = 0; j < uniqueCount; j++) {
            _updateShareRatio(uniqueTokens[j]);
        }

        // Transfer aggregated gross per token once, then send aggregated fee per token
        for (uint256 j = 0; j < uniqueCount; j++) {
            address token = uniqueTokens[j];
            uint256 totalGross = grossPerToken[j];
            uint256 totalFee = feePerToken[j];
            IERC20(token).safeTransferFrom(msg.sender, address(this), totalGross);
            if (totalFee > 0) {
                IERC20(token).safeTransfer(feeCollector, totalFee);
                emit FeesCollected(token, totalFee, 0);
            }
        }

        // Create vestings using prepaid net amounts
        uint256[] memory vestingIds = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            vestingIds[i] = _createVestingPrepaid(
                tokens[i],
                tranchesList[i],
                beneficiary,
                isSoft,
                IVesting.VestingType.NORMAL,
                isNftized,
                isTransferable,
                isTopable,
                netPerIndex[i]
            );
        }

        emit BulkVestingCreated(vestingIds, beneficiary);
        return vestingIds;
    }

    /// @notice Creates multiple vestings for multiple beneficiaries in a single transaction
    /// @dev tokens[i], tranchesList[i], and beneficiaries[i] correspond to one vesting
    // solhint-disable-next-line code-complexity
    function createBulkVestingForBeneficiaries(
        address[] calldata tokens,
        IVestingCalculator.TimeAmount[][] calldata tranchesList,
        address[] calldata beneficiaries,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external override payable nonReentrant returns (uint256[] memory) {
        if (tokens.length == 0) revert InvalidArray();
        if (tokens.length != tranchesList.length) revert InvalidArray();
        if (tokens.length != beneficiaries.length) revert InvalidArray();

        // Pay flat fee once if applicable (creator-based)
        bool shouldPayFlatFee = flatFee > 0 && !feeExemptCreators[msg.sender];
        if (shouldPayFlatFee) {
            if (msg.value < flatFee) revert InvalidFlatFee();
            (bool success, ) = feeCollector.call{value: flatFee}("");
            if (!success) revert FeeTransferFailed();
            emit FeesCollected(address(0), 0, flatFee);
        }

        // Precompute per-index gross and net, aggregate by token for single transfers and single fee per token
        uint256[] memory totalsPerIndex = new uint256[](tokens.length);
        uint256[] memory netPerIndex = new uint256[](tokens.length);
        
        address[] memory uniqueTokens = new address[](tokens.length);
        uint256[] memory grossPerToken = new uint256[](tokens.length);
        uint256[] memory feePerToken = new uint256[](tokens.length);
        uint256 uniqueCount = 0;

        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            address beneficiary = beneficiaries[i];
            if (beneficiary == address(0)) revert InvalidBeneficiary();

            uint256 gross = calculator.getTotalAmount(tranchesList[i]);
            if (gross == 0) revert InvalidAmount();

            bool shouldPayTokenFees = !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
            uint256 tokenFee = (shouldPayTokenFees && feePercentage > 0)
                ? (gross * feePercentage) / 10000
                : 0;
            uint256 net = gross - tokenFee;

            totalsPerIndex[i] = gross;
            netPerIndex[i] = net;

            // add/aggregate per unique token
            uint256 idx = type(uint256).max;
            for (uint256 j = 0; j < uniqueCount; j++) {
                if (uniqueTokens[j] == token) { idx = j; break; }
            }
            if (idx == type(uint256).max) {
                uniqueTokens[uniqueCount] = token;
                grossPerToken[uniqueCount] = gross;
                feePerToken[uniqueCount] = tokenFee;
                uniqueCount++;
            } else {
                grossPerToken[idx] += gross;
                feePerToken[idx] += tokenFee;
            }
        }

        // Lock share ratio per unique token once
        for (uint256 j = 0; j < uniqueCount; j++) {
            _updateShareRatio(uniqueTokens[j]);
        }

        // Transfer aggregated gross per token once, then send aggregated fee per token
        for (uint256 j = 0; j < uniqueCount; j++) {
            address token = uniqueTokens[j];
            uint256 totalGross = grossPerToken[j];
            uint256 totalFee = feePerToken[j];
            IERC20(token).safeTransferFrom(msg.sender, address(this), totalGross);
            if (totalFee > 0) {
                IERC20(token).safeTransfer(feeCollector, totalFee);
                emit FeesCollected(token, totalFee, 0);
            }
        }

        // Create each vesting using the net amount and its beneficiary
        uint256[] memory vestingIds = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            vestingIds[i] = _createVestingPrepaid(
                tokens[i],
                tranchesList[i],
                beneficiaries[i],
                isSoft,
                IVesting.VestingType.NORMAL,
                isNftized,
                isTransferable,
                isTopable,
                netPerIndex[i]
            );
        }

        emit BulkVestingCreatedForBeneficiaries(vestingIds, beneficiaries);
        return vestingIds;
    }

    /// @notice Internal function to create a vesting schedule using a pre-paid/net amount
    /// @dev Skips fee handling and assumes caller has already handled token transfers and fees
    function _createVestingPrepaid(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary,
        bool isSoft,
        IVesting.VestingType vestingType,
        bool isNftized,
        bool isTransferable,
        bool isTopable,
        uint256 vestingAmount
    ) internal returns (uint256) {
        if (token == address(0)) revert InvalidToken();
        if (beneficiary == address(0)) revert InvalidBeneficiary();
        if (vestingAmount == 0) revert InvalidAmount();

        uint256 vestingId = nextVestingId++;
        _setupVestingSchedule(vestingId, token, beneficiary, vestingAmount, isSoft, vestingType, isNftized, isTopable);
        _setupTranches(vestingId, tranches);
        _setupShares(vestingId, token, vestingAmount);

        if (isNftized) {
            _mint(beneficiary, vestingId);
        }
        _transferable[vestingId] = isTransferable;

        emit VestingCreated(
            vestingId,
            beneficiary,
            token,
            tranches,
            isSoft,
            isTopable,
            isTransferable
        );

        return vestingId;
    }

    /// @notice Internal function to create a vesting schedule
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiary Address that will receive the vested tokens
    /// @param isSoft Whether the vesting can be cancelled
    /// @param vestingType Type of vesting schedule
    /// @param isNftized Whether the vesting NFT can be minted
    /// @param isTransferable Whether the vesting NFT can be transferred
    /// @param isTopable Whether the vesting can be topped up
    /// @return The ID of the created vesting schedule
    function _createVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary,
        bool isSoft,
        IVesting.VestingType vestingType,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) internal returns (uint256) {
        if (token == address(0)) revert InvalidToken();
        if (beneficiary == address(0)) revert InvalidBeneficiary();
        
        _updateShareRatio(token);
        uint256 totalAmount = calculator.getTotalAmount(tranches);
        if (totalAmount == 0) revert InvalidAmount();

        // Handle fee collection and transfers
        uint256 vestingAmount = _handleCreationFees(token, totalAmount);

        // Create vesting schedule
        uint256 vestingId = nextVestingId++;
        _setupVestingSchedule(vestingId, token, beneficiary, vestingAmount, isSoft, vestingType, isNftized, isTopable);
        _setupTranches(vestingId, tranches);
        _setupShares(vestingId, token, vestingAmount);

        // Setup NFT if needed
        if (isNftized) {
            _mint(beneficiary, vestingId);
        }
        _transferable[vestingId] = isTransferable;

        // Update the event emission to include tranches
        emit VestingCreated(
            vestingId,
            beneficiary,
            token,
            tranches,
            isSoft,
            isTopable,
            isTransferable
        );

        return vestingId;
    }

    /// @notice Handles fee calculation and collection for vesting creation
    /// @param token The token address
    /// @param totalAmount The total amount to be vested
    /// @return The amount available for vesting after fees
    function _handleCreationFees(address token, uint256 totalAmount) internal returns (uint256) {
        // Calculate fees based on exemption status
        uint256 tokenFee = 0;
        uint256 flatFeeAmount = 0;
        bool shouldPayTokenFees = !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
        bool shouldPayFlatFee = flatFee > 0 && !feeExemptTokens[token] && !feeExemptCreators[msg.sender];
        
        // Calculate token percentage fee (always applied unless whitelisted)
        if (shouldPayTokenFees && feePercentage > 0) {
            tokenFee = (totalAmount * feePercentage) / 10000;
        }
        
        // Calculate flat fee (optional, only if configured and not whitelisted)
        if (shouldPayFlatFee) {
            flatFeeAmount = flatFee;
        }
        
        // Transfer total amount including fees
        IERC20(token).safeTransferFrom(msg.sender, address(this), totalAmount);
        
        // Transfer token fees to fee collector if any
        if (tokenFee > 0) {
            IERC20(token).safeTransfer(feeCollector, tokenFee);
            emit FeesCollected(token, tokenFee, 0);
        }
        
        // Transfer flat fee in ETH if any
        if (flatFeeAmount > 0) {
            if (msg.value < flatFeeAmount) revert InvalidFlatFee();
            (bool success, ) = feeCollector.call{value: flatFeeAmount}("");
            if (!success) revert FeeTransferFailed();
            emit FeesCollected(token, 0, flatFeeAmount);
        }

        // Return the amount available for vesting (after token fees)
        return totalAmount - tokenFee;
    }



    function _setupVestingSchedule(
        uint256 vestingId,
        address token,
        address beneficiary,
        uint256 totalAmount,
        bool isSoft,
        IVesting.VestingType vestingType,
        bool isNftized,
        bool isTopable
    ) internal {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        schedule.token = token;
        schedule.creator = msg.sender;
        schedule.beneficiary = beneficiary;
        schedule.totalAmount = totalAmount;
        schedule.isSoft = isSoft;
        schedule.isNftized = isNftized;
        schedule.isTopable = isTopable;
        schedule.released = 0;
        schedule.cancelled = false;
        schedule.vestingType = vestingType;
    }

    function _setupTranches(
        uint256 vestingId,
        IVestingCalculator.TimeAmount[] calldata tranches
    ) internal {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        for (uint256 i = 0; i < tranches.length; i++) {
            schedule.tranches.push(tranches[i]);
        }
    }

    function _setupShares(
        uint256 vestingId,
        address token,
        uint256 totalAmount
    ) internal {
        // Add offset to total shares to prevent inflation attacks
        uint256 shares = _toShares(token, totalAmount);
        _depositedShares[vestingId] = shares;
        _totalTokenShares[token] += shares;
    }

    /// @notice Cancels a soft vesting schedule
    /// @param vestingId ID of the vesting schedule to cancel
    function cancel(uint256 vestingId) external nonReentrant {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        if (schedule.creator != msg.sender) revert NotAuthorized();
        if (!schedule.isSoft) revert NotCancellable();
        if (schedule.cancelled) revert VestingAlreadyCancelled();

        uint256 vestedAmount = getVestedAmount(vestingId);
        uint256 remainingAmount = schedule.totalAmount - vestedAmount;
        
        // Calculate vested shares with proper handling for edge cases
        uint256 vestedShare;
        if (schedule.totalAmount == 0) {
            vestedShare = 0;
        } else {
            vestedShare = vestedAmount * _depositedShares[vestingId] / schedule.totalAmount;
            // Ensure vestedShare doesn't exceed deposited shares due to rounding
            if (vestedShare > _depositedShares[vestingId]) {
                vestedShare = _depositedShares[vestingId];
            }
        }

        // Update total shares safely
        uint256 sharesToRemove = _depositedShares[vestingId] - vestedShare;
        if (sharesToRemove > 0) {
            _totalTokenShares[schedule.token] -= sharesToRemove;
        }
        
        _depositedShares[vestingId] = vestedShare;

        schedule.cancelled = true;
        schedule.totalAmount = vestedAmount;

        if (remainingAmount > 0) {
            IERC20(schedule.token).safeTransfer(schedule.creator, remainingAmount);
        }

        emit VestingCancelled(vestingId);
    }

    /// @notice Gets the full vesting schedule for a given ID
    /// @param vestingId ID of the vesting schedule
    /// @return The complete vesting schedule
    function getVestingSchedule(uint256 vestingId) external view override returns (VestingSchedule memory) {
        return vestingSchedules[vestingId];
    }

    /// @notice Calculates the total amount vested at current time
    /// @param vestingId ID of the vesting schedule
    /// @return The total amount vested
    function getVestedAmount(uint256 vestingId) public view returns (uint256) {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        if (schedule.cancelled) return schedule.totalAmount;
        
        uint256 rawVestedAmount = calculator.calculateVestedAmount(
            schedule.tranches,
            block.timestamp
        );

        // Return raw amount - no need to convert to shares and back
        return rawVestedAmount;
    }

    /// @notice Calculates the amount that can be released
    /// @param vestingId ID of the vesting schedule
    /// @return The amount that can be released
    function getReleasableAmount(uint256 vestingId) public view returns (uint256) {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        uint256 releasableShares = _getReleasableShares(vestingId);
        return _toAmount(schedule.token, releasableShares);
    }

    /// @notice Releases vested tokens to the beneficiary
    /// @param vestingId ID of the vesting schedule
    function release(uint256 vestingId) external nonReentrant {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        
        if (schedule.isNftized) {
            if (msg.sender != ownerOf(vestingId)) revert NotAuthorized();
        } else {
            if (msg.sender != schedule.beneficiary) revert NotAuthorized();
        }

        // Update ratio before calculating releasable shares
        _updateShareRatio(schedule.token);

        // Get releasable shares using the consistent calculation method
        uint256 releasableShares = _getReleasableShares(vestingId);
        if (releasableShares == 0) revert NoTokensToRelease();

        // Calculate amount proportional to shares
        uint256 balance = IERC20(schedule.token).balanceOf(address(this));
        uint256 amount = (releasableShares * balance) / _totalTokenShares[schedule.token];

        // Update shares state
        schedule.released += releasableShares;
        _totalTokenShares[schedule.token] -= releasableShares;

        // Transfer tokens
        IERC20(schedule.token).safeTransfer(msg.sender, amount);

        emit TokensReleased(vestingId, msg.sender, amount);
    }

    /// @notice Override of ERC721 _update to enforce transferability rules
    /// @param to Address to transfer to
    /// @param tokenId ID of the token being transferred
    /// @param auth Address authorized to make the transfer
    /// @return The from address_
    function _update(
        address to,
        uint256 tokenId,
        address auth
    ) internal virtual override returns (address) {
        address from = super._update(to, tokenId, auth);
        
        // Skip transferability check for mints and burns
        if (from != address(0) && to != address(0)) {
            if (!_transferable[tokenId]) {
                revert NonTransferableToken();
            }
            // Update beneficiary for actual transfers
            VestingSchedule storage schedule = vestingSchedules[tokenId];
            schedule.beneficiary = to;
        }else if(to == address(0)){
            VestingSchedule storage schedule = vestingSchedules[tokenId];
            schedule.isNftized = false;
        }

        return from;
    }

    /// @notice Allows beneficiary to mint their vesting NFT if not already minted
    /// @param vestingId ID of the vesting schedule to mint NFT for
    function mintVestingNFT(uint256 vestingId) external {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        
        // Only beneficiary can mint
        if (msg.sender != schedule.beneficiary) revert NotAuthorized();
        if (schedule.isNftized) revert NFTAlreadyMinted();
        
        // Set NFT as minted before actual mint to prevent reentrance
        schedule.isNftized = true;
        
        // Mint NFT to beneficiary
        _mint(schedule.beneficiary, vestingId);
    }

    /// @notice Transfers a vesting schedule to a new beneficiary
    /// @param vestingId ID of the vesting schedule to transfer
    /// @param newBeneficiary Address of the new beneficiary
    function transferVesting(uint256 vestingId, address newBeneficiary) external {
        if (newBeneficiary == address(0)) revert InvalidBeneficiary();
        
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        
        // Only current beneficiary can transfer
        if (msg.sender != schedule.beneficiary) revert NotAuthorized();

        if (schedule.isNftized) {
            super._update( newBeneficiary, vestingId,address(0));
        }
        
        // If not NFTized, just update beneficiary
        schedule.beneficiary = newBeneficiary;

        emit VestingTransferred(vestingId, msg.sender, newBeneficiary);
    }

    /// @notice Tops up a vesting schedule with additional tranches
    /// @param vestingId ID of the vesting to top up
    /// @param additionalTranches Array of additional vesting tranches
    function topUpVesting(
        uint256 vestingId,
        IVestingCalculator.TimeAmount[] calldata additionalTranches
    ) external nonReentrant {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        
        _validateTopUpAuthorization(schedule);
        _validateTopUpTranches(schedule, additionalTranches);
        
        uint256 topUpAmount = _calculateTopUpAmount(schedule, additionalTranches);
        
        uint256 actualTopUpAmount = _processTopUpTransfer(schedule, topUpAmount);
        _updateTopUpState(schedule, vestingId, additionalTranches, actualTopUpAmount);
        
        emit VestingToppedUp(vestingId, msg.sender, actualTopUpAmount, additionalTranches);
    }

    /// @notice Validates authorization for top-up operation
    function _validateTopUpAuthorization(VestingSchedule storage schedule) internal view {
        if(msg.sender != schedule.creator) revert NotAuthorized();
        if(schedule.cancelled) revert VestingAlreadyCancelled();
        if(!schedule.isTopable) revert NotTopable();
    }

    /// @notice Validates the additional tranches for top-up
    function _validateTopUpTranches(
        VestingSchedule storage schedule, 
        IVestingCalculator.TimeAmount[] calldata additionalTranches
    ) internal view {
        uint256 lastTime = schedule.tranches[schedule.tranches.length - 1].time;
        if (additionalTranches[0].time <= lastTime) revert InvalidTime();

        uint256 newFinalAmount = calculator.getTotalAmount(additionalTranches);
        if (newFinalAmount <= schedule.totalAmount) revert InvalidAmount();
        if (additionalTranches[0].amount < schedule.totalAmount) revert InvalidAmount();
    }

    /// @notice Calculates the top-up amount
    function _calculateTopUpAmount(
        VestingSchedule storage schedule, 
        IVestingCalculator.TimeAmount[] calldata additionalTranches
    ) internal view returns (uint256) {
        uint256 newFinalAmount = calculator.getTotalAmount(additionalTranches);
        return newFinalAmount - schedule.totalAmount;
    }



    /// @notice Processes the token transfer for top-up
    function _processTopUpTransfer(VestingSchedule storage schedule, uint256 topUpAmount) internal returns (uint256) {
        _updateShareRatio(schedule.token);

        // Calculate percentage fee for top-up if not whitelisted
        uint256 tokenFee = 0;
        bool shouldPayTokenFees = !feeExemptTokens[schedule.token] && !feeExemptCreators[msg.sender];
        
        if (shouldPayTokenFees && feePercentage > 0) {
            tokenFee = (topUpAmount * feePercentage) / 10000;
        }
        
        // Transfer the full amount including fees
        uint256 totalTransferAmount = topUpAmount + tokenFee;
        uint256 balanceBefore = IERC20(schedule.token).balanceOf(address(this));
        IERC20(schedule.token).safeTransferFrom(msg.sender, address(this), totalTransferAmount);
        uint256 actualReceived = IERC20(schedule.token).balanceOf(address(this)) - balanceBefore;
        
        // Transfer token fees to fee collector if any
        if (tokenFee > 0) {
            IERC20(schedule.token).safeTransfer(feeCollector, tokenFee);
            emit FeesCollected(schedule.token, tokenFee, 0);
        }
        
        // Return the actual amount for vesting (excluding fees)
        return actualReceived - tokenFee;
    }

    /// @notice Updates the vesting state after top-up
    function _updateTopUpState(
        VestingSchedule storage schedule, 
        uint256 vestingId, 
        IVestingCalculator.TimeAmount[] calldata additionalTranches, 
        uint256 actualTopUpAmount
    ) internal {
        uint256 newFinalAmount = calculator.getTotalAmount(additionalTranches);
        uint256 newShares = _toShares(schedule.token, actualTopUpAmount);

        schedule.totalAmount = newFinalAmount;
        _depositedShares[vestingId] += newShares;
        _totalTokenShares[schedule.token] += newShares;

        for (uint256 i = 0; i < additionalTranches.length; i++) {
            schedule.tranches.push(additionalTranches[i]);
        }
    }

    function _toShares(address token, uint256 amount) internal view returns (uint256) {
        return (amount * _shareRatio[token]) / 1e18;
    }

    function _toAmount(address token, uint256 shares) internal view returns (uint256) {
        return (shares * 1e18) / _shareRatio[token];
    }

    function _getReleasableShares(uint256 vestingId) public view returns (uint256) {
        VestingSchedule storage schedule = vestingSchedules[vestingId];
        if (schedule.cancelled) {
            return _depositedShares[vestingId] - schedule.released;
        }

        // Get raw vested amount
        uint256 rawVestedAmount = calculator.calculateVestedAmount(
            schedule.tranches,
            block.timestamp
        );

        // Cap at total amount
        if (rawVestedAmount > schedule.totalAmount) {
            rawVestedAmount = schedule.totalAmount;
        }

        // Convert amount to shares with higher precision
        uint256 vestedShares;
        if (schedule.totalAmount == 0) {
            vestedShares = 0;
        } else {
            // First multiply deposited shares by vested amount to maintain precision
            uint256 vestedSharesTimesPrecision = _depositedShares[vestingId] * rawVestedAmount;
            // Then divide by total amount
            vestedShares = vestedSharesTimesPrecision / schedule.totalAmount;
        }
        
        // Cap at deposited shares
        if (vestedShares > _depositedShares[vestingId]) {
            vestedShares = _depositedShares[vestingId];
        }

        // Calculate releasable shares
        if (vestedShares <= schedule.released) return 0;
        return vestedShares - schedule.released;
    }

    function _updateShareRatio(address token) internal {
        uint256 totalShares = _totalTokenShares[token];       
        if(totalShares == 0){
            _shareRatio[token] = 1e18;
            return;
        }
        uint256 balance = IERC20(token).balanceOf(address(this));

        // Handle edge case where balance is very low to prevent overflow
        if (balance == 0) {
            _shareRatio[token] = 1e18;
            return;
        }

        // Calculate share ratio with overflow protection
        uint256 numerator = (totalShares + 1) * 1e18;
        uint256 denominator = balance + 1;
        
        // Ensure we don't have division by zero and handle overflow
        if (denominator == 0) {
            _shareRatio[token] = 1e18;
        } else {
            _shareRatio[token] = numerator / denominator;
        }
    }

    /// @notice Set the fee percentage
    /// @param _feePercentage New fee percentage in basis points
    function setFeePercentage(uint256 _feePercentage) external onlyOwner {
        if (_feePercentage > 500) revert InvalidFeePercentage(); // Max 5%
        feePercentage = _feePercentage;
        emit FeePercentageUpdated(_feePercentage);
    }

    /// @notice Set the flat fee
    /// @param _flatFee New flat fee amount in wei
    function setFlatFee(uint256 _flatFee) external onlyOwner {
        flatFee = _flatFee;
        emit FlatFeeUpdated(_flatFee);
    }

    /// @notice Set whether a creator is exempt from fees
    /// @param _creator Creator address to update
    /// @param _isExempt Whether the creator should be exempt from fees
    function setCreatorFeeExempt(address _creator, bool _isExempt) external onlyOwner {
        feeExemptCreators[_creator] = _isExempt;
        emit CreatorFeeExemptionUpdated(_creator, _isExempt);
    }

    /// @notice Set whether a token is exempt from fees
    /// @param _token Token address to update
    /// @param _isExempt Whether the token should be exempt from fees
    function setTokenFeeExempt(address _token, bool _isExempt) external onlyOwner {
        feeExemptTokens[_token] = _isExempt;
        emit TokenFeeExemptionUpdated(_token, _isExempt);
    }

    /// @notice Set the fee collector
    /// @param newFeeCollector Address of the new fee collector
    function setFeeCollector(address newFeeCollector) external onlyOwner {
        if (newFeeCollector == address(0)) revert InvalidFeeCollector();
        address oldFeeCollector = feeCollector;
        feeCollector = newFeeCollector;
        emit FeeCollectorUpdated(oldFeeCollector, newFeeCollector);
    }

    /// @notice Set the SVG generator contract
    /// @param newSVGGenerator Address of the new SVG generator contract
    function setSVGGenerator(address newSVGGenerator) external onlyOwner {
        if (newSVGGenerator == address(0)) revert InvalidSVGGenerator();
        address oldSVGGenerator = address(svgGenerator);
        svgGenerator = IVestingSVGGenerator(newSVGGenerator);
        emit SVGGeneratorUpdated(oldSVGGenerator, newSVGGenerator);
    }

    /// @notice Returns the token URI for a given vesting NFT
    /// @param tokenId The vesting ID
    /// @return The token URI containing SVG metadata
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        if (ownerOf(tokenId) == address(0)) revert TokenDoesNotExist();
        
        VestingSchedule storage schedule = vestingSchedules[tokenId];
        (string memory tokenSymbol, string memory tokenName, uint8 tokenDecimals) = _getTokenMetadata(schedule.token);
        
        // Calculate start and end times from tranches
        uint256 startTime = schedule.tranches.length > 0 ? 
            schedule.tranches[0].time : block.timestamp;
        uint256 endTime = schedule.tranches.length > 0 ? 
            schedule.tranches[schedule.tranches.length - 1].time : block.timestamp;
        
        // Calculate vested amount (available to claim)
        uint256 vestedAmount = getVestedAmount(tokenId);
        
        return svgGenerator.generateTokenURI(
            tokenId,
            tokenSymbol,
            tokenName,
            schedule.totalAmount,
            vestedAmount,
            startTime,
            endTime,
            schedule.isSoft,
            schedule.isTopable,
            schedule.beneficiary,
            tokenDecimals
        );
    }

    /// @notice Gets comprehensive token metadata from the token contract
    /// @param token The token address
    /// @return symbol The token symbol
    /// @return name The token name
    /// @return decimals The token decimals
    function _getTokenMetadata(address token) internal view returns (
        string memory symbol, 
        string memory name, 
        uint8 decimals
    ) {
        try IERC20Metadata(token).symbol() returns (string memory _symbol) {
            symbol = _symbol;
        } catch {
            symbol = "TOKEN";
        }
        
        try IERC20Metadata(token).name() returns (string memory _name) {
            name = _name;
        } catch {
            name = symbol; // Fall back to symbol if name fails
        }
        
        try IERC20Metadata(token).decimals() returns (uint8 _decimals) {
            decimals = _decimals;
        } catch {
            decimals = 18; // Default to 18 decimals
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

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

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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(token).code.length > 0;
    }
}

File 8 of 24 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.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}.
 */
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    mapping(uint256 tokenId => address) private _owners;

    mapping(address owner => uint256) private _balances;

    mapping(uint256 tokenId => address) private _tokenApprovals;

    mapping(address owner => mapping(address operator => 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 returns (uint256) {
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

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

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

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

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(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 {
        _approve(to, tokenId, _msgSender());
    }

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

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is 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`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        return _tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        unchecked {
            _balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                _balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                _balances[to] += 1;
            }
        }

        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @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 {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * 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 {
        _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);
        _checkOnERC721Received(address(0), to, tokenId, data);
    }

    /**
     * @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 {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard 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 like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - 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) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        _tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. 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
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../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 address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

File 11 of 24 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                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.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @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), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(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) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
 
interface IERC20Metadata is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}

File 21 of 24 : IVesting.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

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

interface IVesting {
    enum VestingType {
        NORMAL
        // Removed DAILY_SOFT, WEEKLY_SOFT, MONTHLY_SOFT since they're just NORMAL with specific tranches
    }
    
    error NoTokensToRelease();
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import "./IVesting.sol";

interface IVestingCalculator {
    enum EquationType {
        LINEAR,      // Linear release between points
        EXPONENTIAL, // Exponential curve between points
        INTERVAL,    // Immediate release at each point (same as STEPWISE)
        QUADRATIC    // Quadratic curve between points
    }

    struct TimeAmount {
        uint256 time;        // Unix timestamp
        uint256 amount;      // Cumulative amount of tokens until this time
        EquationType eqType; // Equation type for calculation until next point
    }
    
    error InvalidTranches();
    error TimesMustBeInAscendingOrder();
    error AmountsMustBeIncreasing();
    error InvalidEquationType();
    error InvalidParameters();
    error VestingTypeNotEnabled();

    function calculateVestedAmount(
        TimeAmount[] calldata tranches,
        uint256 currentTime
    ) external view returns (uint256);

    function getTotalAmount(TimeAmount[] calldata tranches) external pure returns (uint256);

}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

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

interface IVestingManager is IERC721, IVesting {
    // Custom errors
    error InvalidBeneficiary();
    error InvalidToken();
    error InvalidAmount();
    error NotAuthorized();
    error VestingAlreadyCancelled();
    error NotCancellable();
    error NotSoftVesting();
    error OnlyCreatorCanCancel();
    error NonTransferableToken();
    error InvalidArray();
    error InvalidTime();
    error NFTAlreadyMinted();
    error InvalidCalculator();
    error InvalidSVGGenerator();
    error NotWhitelisted();
    error InvalidFeePercentage();
    error InvalidFeeCollector();
    error InvalidFlatFee();
    error OnlyOwner();
    error FeeTransferFailed();
    error NotTopable();
    error TokenDoesNotExist();

    // Events
    event VestingCreated(
        uint256 indexed vestingId,
        address indexed beneficiary,
        address token,
        IVestingCalculator.TimeAmount[] tranches,
        bool isSoft,
        bool isTopable,
        bool isTransferable
    );
    event TokensReleased(uint256 indexed vestingId, address indexed beneficiary, uint256 amount);
    event VestingCancelled(uint256 indexed vestingId);
    event AirdropVestingCreated(uint256[] vestingIds, address[] beneficiaries);
    event VestingTransferred(uint256 indexed vestingId, address indexed from, address indexed to);
    event VestingToppedUp(
        uint256 indexed vestingId,
        address indexed sender,
        uint256 amount,
        IVestingCalculator.TimeAmount[] tranches
    );
    event FeePercentageUpdated(uint256 newFeePercentage);
    event FlatFeeUpdated(uint256 newFlatFee);
    event FeeCollectorUpdated(address indexed oldFeeCollector, address indexed newFeeCollector);
    event SVGGeneratorUpdated(address indexed oldSVGGenerator, address indexed newSVGGenerator);
    event FeesCollected(address token, uint256 amount, uint256 flatFee);
    event TokenFeeExemptionUpdated(address token, bool isExempt);
    event CreatorFeeExemptionUpdated(address creator, bool isExempt);
    event FeeExemptionStatusUpdated(bool enabled);
    event BulkVestingCreated(uint256[] vestingIds, address indexed beneficiary);
    event BulkVestingCreatedForBeneficiaries(uint256[] vestingIds, address[] beneficiaries);

    struct VestingSchedule {
        address token;
        address creator;
        address beneficiary;
        uint256 totalAmount;
        uint256 released;
        bool isSoft;
        bool isNftized;
        bool cancelled;
        bool isTopable;
        IVesting.VestingType vestingType;
        IVestingCalculator.TimeAmount[] tranches;
    }

    // Function declarations
    function createVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external payable returns (uint256);

    /// @notice Creates a daily soft vesting schedule
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiary Address that will receive the vested tokens
    /// @return The ID of the created vesting schedule
    function createDailySoftVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address beneficiary
    ) external payable returns (uint256);

    /// @notice Creates multiple vesting schedules in a single transaction
    /// @param token Address of the token to vest
    /// @param tranches Array of vesting tranches with time and amount
    /// @param beneficiaries Array of addresses that will receive the vested tokens
    /// @param isSoft Whether the vestings can be cancelled
    /// @param isNftized Whether the vesting NFTs can be minted
    /// @param isTransferable Whether the vesting NFTs can be transferred
    /// @param isTopable Whether the vestings can be topped up
    /// @return Array of created vesting IDs
    function createAirdropVesting(
        address token,
        IVestingCalculator.TimeAmount[] calldata tranches,
        address[] calldata beneficiaries,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external payable returns (uint256[] memory);

    /// @notice Creates multiple vestings for the same beneficiary in a single transaction
    /// @dev Supports multiple tokens and distinct tranche arrays per vesting
    /// @param tokens Array of token addresses for each vesting
    /// @param tranchesList Array of tranche arrays; each element is the tranche array for the corresponding vesting
    /// @param beneficiary The shared beneficiary for all created vestings
    /// @param isSoft Whether the vestings can be cancelled
    /// @param isNftized Whether the vesting NFTs can be minted
    /// @param isTransferable Whether the vesting NFTs can be transferred
    /// @param isTopable Whether the vestings can be topped up
    /// @return Array of created vesting IDs
    function createBulkVestingForBeneficiary(
        address[] calldata tokens,
        IVestingCalculator.TimeAmount[][] calldata tranchesList,
        address beneficiary,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external payable returns (uint256[] memory);

    /// @notice Creates multiple vestings for multiple beneficiaries in a single transaction
    /// @dev tokens[i], tranchesList[i], beneficiaries[i] correspond to one vesting
    /// @param tokens Array of token addresses for each vesting
    /// @param tranchesList Array of tranche arrays; each element is the tranche array for the corresponding vesting
    /// @param beneficiaries Addresses to receive each corresponding vesting
    /// @param isSoft Whether the vestings can be cancelled
    /// @param isNftized Whether the vesting NFTs can be minted
    /// @param isTransferable Whether the vesting NFTs can be transferred
    /// @param isTopable Whether the vestings can be topped up
    /// @return Array of created vesting IDs
    function createBulkVestingForBeneficiaries(
        address[] calldata tokens,
        IVestingCalculator.TimeAmount[][] calldata tranchesList,
        address[] calldata beneficiaries,
        bool isSoft,
        bool isNftized,
        bool isTransferable,
        bool isTopable
    ) external payable returns (uint256[] memory);

    function cancel(uint256 vestingId) external;
    function getVestingSchedule(uint256 vestingId) external view returns (VestingSchedule memory);
    function getVestedAmount(uint256 vestingId) external view returns (uint256);
    function getReleasableAmount(uint256 vestingId) external view returns (uint256);
    function release(uint256 vestingId) external;

    // Fee management functions
    function setFeePercentage(uint256 _feePercentage) external;
    function setFlatFee(uint256 _flatFee) external;
    function setFeeCollector(address newFeeCollector) external;

    // Fee exemption functions
    function setCreatorFeeExempt(address _creator, bool _isExempt) external;
    function setTokenFeeExempt(address _token, bool _isExempt) external;

    // Top-up functions
    function topUpVesting(
        uint256 vestingId,
        IVestingCalculator.TimeAmount[] calldata additionalTranches
    ) external;
}

// SPDX-License-Identifier: UNLICENSED
// ALL RIGHTS RESERVED
// UNCX by SDDTech reserves all rights on this code. You may not copy these contracts.

pragma solidity ^0.8.27;

/// @title IVestingSVGGenerator
/// @notice Interface for the VestingSVGGenerator contract
interface IVestingSVGGenerator {
    /// @notice Generates the complete SVG for a vesting NFT
    /// @param vestingId The vesting ID
    /// @param tokenSymbol The token symbol
    /// @param tokenName The token name
    /// @param totalAmount The total amount to be vested
    /// @param vestedAmount The amount currently vested and available to claim
    /// @param startTime The vesting start time
    /// @param endTime The vesting end time
    /// @param isSoft Whether the vesting is soft
    /// @param isTopable Whether the vesting can be topped up
    /// @param beneficiary The beneficiary address
    /// @param tokenDecimals The token decimals
    /// @return The generated SVG string
    function generateVestingSVG(
        uint256 vestingId,
        string memory tokenSymbol,
        string memory tokenName,
        uint256 totalAmount,
        uint256 vestedAmount,
        uint256 startTime,
        uint256 endTime,
        bool isSoft,
        bool isTopable,
        address beneficiary,
        uint8 tokenDecimals
    ) external view returns (string memory);

    /// @notice Generates the complete token URI for a vesting NFT
    /// @param vestingId The vesting ID
    /// @param tokenSymbol The token symbol
    /// @param tokenName The token name
    /// @param totalAmount The total amount to be vested
    /// @param vestedAmount The amount currently vested and available to claim
    /// @param startTime The vesting start time
    /// @param endTime The vesting end time
    /// @param isSoft Whether the vesting is soft
    /// @param isTopable Whether the vesting can be topped up
    /// @param beneficiary The beneficiary address
    /// @param tokenDecimals The token decimals
    /// @return The generated token URI string
    function generateTokenURI(
        uint256 vestingId,
        string memory tokenSymbol,
        string memory tokenName,
        uint256 totalAmount,
        uint256 vestedAmount,
        uint256 startTime,
        uint256 endTime,
        bool isSoft,
        bool isTopable,
        address beneficiary,
        uint8 tokenDecimals
    ) external view returns (string memory);
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 5
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris"
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_calculator","type":"address"},{"internalType":"address","name":"_svgGenerator","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"FeeTransferFailed","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidArray","type":"error"},{"inputs":[],"name":"InvalidBeneficiary","type":"error"},{"inputs":[],"name":"InvalidCalculator","type":"error"},{"inputs":[],"name":"InvalidFeeCollector","type":"error"},{"inputs":[],"name":"InvalidFeePercentage","type":"error"},{"inputs":[],"name":"InvalidFlatFee","type":"error"},{"inputs":[],"name":"InvalidSVGGenerator","type":"error"},{"inputs":[],"name":"InvalidTime","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"NFTAlreadyMinted","type":"error"},{"inputs":[],"name":"NoTokensToRelease","type":"error"},{"inputs":[],"name":"NonTransferableToken","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotCancellable","type":"error"},{"inputs":[],"name":"NotSoftVesting","type":"error"},{"inputs":[],"name":"NotTopable","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"OnlyCreatorCanCancel","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"VestingAlreadyCancelled","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"vestingIds","type":"uint256[]"},{"indexed":false,"internalType":"address[]","name":"beneficiaries","type":"address[]"}],"name":"AirdropVestingCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"vestingIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"}],"name":"BulkVestingCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"vestingIds","type":"uint256[]"},{"indexed":false,"internalType":"address[]","name":"beneficiaries","type":"address[]"}],"name":"BulkVestingCreatedForBeneficiaries","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"bool","name":"isExempt","type":"bool"}],"name":"CreatorFeeExemptionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldFeeCollector","type":"address"},{"indexed":true,"internalType":"address","name":"newFeeCollector","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"FeeExemptionStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFeePercentage","type":"uint256"}],"name":"FeePercentageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"}],"name":"FeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFlatFee","type":"uint256"}],"name":"FlatFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldSVGGenerator","type":"address"},{"indexed":true,"internalType":"address","name":"newSVGGenerator","type":"address"}],"name":"SVGGeneratorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"isExempt","type":"bool"}],"name":"TokenFeeExemptionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"vestingId","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensReleased","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":true,"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"VestingCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"vestingId","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"indexed":false,"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"},{"indexed":false,"internalType":"bool","name":"isSoft","type":"bool"},{"indexed":false,"internalType":"bool","name":"isTopable","type":"bool"},{"indexed":false,"internalType":"bool","name":"isTransferable","type":"bool"}],"name":"VestingCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"vestingId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"indexed":false,"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"}],"name":"VestingToppedUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"vestingId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"VestingTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"_getReleasableShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculator","outputs":[{"internalType":"contract IVestingCalculator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"},{"internalType":"address[]","name":"beneficiaries","type":"address[]"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"isTransferable","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"}],"name":"createAirdropVesting","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[][]","name":"tranchesList","type":"tuple[][]"},{"internalType":"address[]","name":"beneficiaries","type":"address[]"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"isTransferable","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"}],"name":"createBulkVestingForBeneficiaries","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[][]","name":"tranchesList","type":"tuple[][]"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"isTransferable","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"}],"name":"createBulkVestingForBeneficiary","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"},{"internalType":"address","name":"beneficiary","type":"address"}],"name":"createDailySoftVesting","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"isTransferable","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"}],"name":"createVesting","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeExemptCreators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeExemptTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flatFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"vestingId","type":"uint256"}],"name":"getReleasableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"getVestedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"getVestingSchedule","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"cancelled","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"},{"internalType":"enum IVesting.VestingType","name":"vestingType","type":"uint8"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[]","name":"tranches","type":"tuple[]"}],"internalType":"struct IVestingManager.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"mintVestingNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextVestingId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_creator","type":"address"},{"internalType":"bool","name":"_isExempt","type":"bool"}],"name":"setCreatorFeeExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFeeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"setFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_flatFee","type":"uint256"}],"name":"setFlatFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSVGGenerator","type":"address"}],"name":"setSVGGenerator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isExempt","type":"bool"}],"name":"setTokenFeeExempt","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":"svgGenerator","outputs":[{"internalType":"contract IVestingSVGGenerator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"},{"components":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IVestingCalculator.EquationType","name":"eqType","type":"uint8"}],"internalType":"struct IVestingCalculator.TimeAmount[]","name":"additionalTranches","type":"tuple[]"}],"name":"topUpVesting","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":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingId","type":"uint256"},{"internalType":"address","name":"newBeneficiary","type":"address"}],"name":"transferVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vestingSchedules","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"isSoft","type":"bool"},{"internalType":"bool","name":"isNftized","type":"bool"},{"internalType":"bool","name":"cancelled","type":"bool"},{"internalType":"bool","name":"isTopable","type":"bool"},{"internalType":"enum IVesting.VestingType","name":"vestingType","type":"uint8"}],"stateMutability":"view","type":"function"}]

60a06040523461049357614b2c6060813803918261001c81610498565b93849283398101031261049357610032816104bd565b61004a6040610043602085016104bd565b93016104bd565b916100556040610498565b92600b84526a15995cdd1a5b99c813919560aa1b60208501526100786040610498565b60048152631593919560e21b6020820152845190946001600160401b0382116103935760005490600182811c92168015610489575b60208310146103735781601f84931161041a575b50602090601f83116001146103b4576000926103a9575b50508160011b916000199060031b1c1916176000555b83516001600160401b03811161039357600154600181811c91168015610389575b602082101461037357601f811161030e575b50602094601f82116001146102a75794819293949560009261029c575b50508160011b916000199060031b1c1916176001555b331561028657600780546001600160a01b0319908116909155600680549182163390811790915560405194916001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a360016008556001600160a01b0316918215610275576001600160a01b0316908115610264576001600160a01b03169182156102535760805260018060a01b0319600954161760095560018060a01b0319601254161760125561465a90816104d282396080518181816102e8015281816109270152818161154801528181611dc00152818161270e01528181612a1901528181612e3801528181613b910152613c460152f35b63bb0bac9960e01b60005260046000fd5b63086665d760e31b60005260046000fd5b6396590cbb60e01b60005260046000fd5b631e4fbdf760e01b600052600060045260246000fd5b01519050388061013e565b601f198216956001600052806000209160005b8881106102f6575083600195969798106102dd575b505050811b01600155610154565b015160001960f88460031b161c191690553880806102cf565b919260206001819286850151815501940192016102ba565b60016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6601f830160051c81019160208410610369575b601f0160051c01905b81811061035d5750610121565b60008155600101610350565b9091508190610347565b634e487b7160e01b600052602260045260246000fd5b90607f169061010f565b634e487b7160e01b600052604160045260246000fd5b0151905038806100d8565b60008080528281209350601f198516905b81811061040257509084600195949392106103e9575b505050811b016000556100ee565b015160001960f88460031b161c191690553880806103db565b929360206001819287860151815501950193016103c5565b600080529091507f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563601f840160051c8101916020851061047f575b90601f859493920160051c01905b81811061047057506100c1565b60008155849350600101610463565b9091508190610455565b91607f16916100ad565b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761039357604052565b51906001600160a01b03821682036104935756fe61022080604052600436101561001457600080fd5b60003560e01c90816301ffc9a7146133b757508063025d3c831461334657806306fdde031461328b578063081812fc1461324d578063095ea7b31461315e5780630c558e4414612d735780631878559014612cc15780631ce113491461296a5780631e6492b11461290057806323241b131461240557806323b872dd146123ee57806323fa495a146123a257806337bdc99b146121ea57806340e58ee51461205357806340ee653814611acb57806342842e0e14611aa1578063495f3d2714611a835780636352211e14611a535780636d3cbe21146119925780636d6060f5146119695780636de18fbb1461192a57806370a08231146118d4578063715018a61461187f57806379ba5097146118075780638799ce22146114ab5780638da5cb5b1461148257806395d89b411461137757806397b5bb3a14611338578063a001ecdd1461131a578063a22cb4651461127f578063a42dce80146111fa578063ae06c1b714611193578063b3a0f37d1461110e578063b8677ebd14611087578063b88d4fde14610fff578063beb8f88314610d07578063c415b95c14610cde578063c86055cb14610c6b578063c87b56dd14610974578063cafeedf614610956578063ce3e39c014610911578063d9eb5947146108f3578063dda085cf146108cd578063e30c3978146108a4578063e985e9c514610849578063f2fde38b146107dc5763fc48422c1461022557600080fd5b34610753576040366003190112610753576004356024356001600160401b038111610753576102589036906004016134ac565b9091610262613d93565b6000818152600d6020526040902060018101549093906001600160a01b031633036107cb57600584015460ff8160101c166107ba5760181c60ff16156107a9576006840180546000198101908111610793576102be9082613a62565b5054841561077d578235111561076c57604051630a7951fb60e11b815260206004820181905290957f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692918780610322602482018a89613639565b0381865afa96871561076057600097610727575b50600381019081548098111561071657600097806020870135106107075760405190630a7951fb60e11b8252602060048301526020828061037b602482018d8c613639565b0381895afa80156106fc578a906106c4575b61039792506136c6565b81546103ab906001600160a01b0316613fae565b81546001600160a01b0316808a52601460205260408a205490918a9160ff1615806106ad575b806106a2575b610685575b816103e691613845565b6040516370a0823160e01b815230600482015292602084602481845afa938415610641578c9461064c575b509061042091309033906140d6565b82546040516370a0823160e01b81523060048201526001600160a01b0390911690602081602481855afa908115610641578c91610608575b5061047593610466916136c6565b9082806105bb575b50506136c6565b9360206040518092630a7951fb60e11b8252826004830152818061049e8d60248301908d613639565b03915afa9081156105b057899161057a575b5081546104c79086906001600160a01b0316614513565b9255858852600c602052604088206104e0838254613845565b9055546001600160a01b03168752600b602052604087208054909161050491613845565b9055855b85811061055d575050907f3ca9c0d48ed2e86756871eee17814f70a8e4471f79823d1fd8836be2ddd8bdde9161055260405192839283526040602084015233966040840191613639565b0390a3600160085580f35b8061057461056e60019389886142f5565b84614305565b01610508565b90506020813d6020116105a8575b81610595602093836135ee565b810103126105a45751386104b0565b8880fd5b3d9150610588565b6040513d8b823e3d90fd5b6012546105d3926001600160a01b0390911690614121565b6000805160206145c5833981519152606060018060a01b038654166040519081528460208201528d6040820152a1388261046e565b90508b8160203d60201161063a575b60209261062482846135ee565b50810103126106365751610475610458565b8b80fd5b503d610617565b6040513d8e823e3d90fd5b919093508b8260203d60201161067e575b60209261066a82846135ee565b508101031261063657905192610420610411565b503d61065d565b90506103e661271061069960105484613693565b049190506103dc565b5060105415156103d7565b50338b52601360205260ff60408c205416156103d1565b506020823d6020116106f4575b816106de602093836135ee565b810103126106f057610397915161038d565b8980fd5b3d91506106d1565b6040513d8c823e3d90fd5b63162908e360e11b8952600489fd5b63162908e360e11b60005260046000fd5b9096506020813d602011610758575b81610743602093836135ee565b8101031261075357519538610336565b600080fd5b3d9150610736565b6040513d6000823e3d90fd5b6337bf561360e11b60005260046000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6303813f7960e41b60005260046000fd5b635bc2daf760e01b60005260046000fd5b63ea8e4eb560e01b60005260046000fd5b34610753576020366003190112610753576107f561346a565b6107fd61422b565b600780546001600160a01b0319166001600160a01b039283169081179091556006549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346107535760403660031901126107535761086261346a565b61086a613496565b9060018060a01b0316600052600560205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b34610753576000366003190112610753576007546040516001600160a01b039091168152602090f35b346107535760203660031901126107535760206108eb600435613c03565b604051908152f35b34610753576000366003190112610753576020601154604051908152f35b34610753576000366003190112610753576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346107535760203660031901126107535760206108eb600435613b4c565b34610753576020366003190112610753576004356001600160a01b0361099982613d5c565b1615610c5a5780600052600d602052604060002060018060a01b03815416916000604051906395d89b4160e01b82528082600481885afa90918282610c3d575b5050610c3757506040516109ee6040826135ee565b60058152642a27a5a2a760d91b6020820152905b6040516306fdde0360e01b8152600081600481885afa60009181610c1a575b50610c0f57506004602083955b60405163313ce56760e01b815292839182905afa8091600091610bcc575b5090610bc7575060125b6006840180548015801593929190610bc0576000825415610bac578083602092522054935b15610ba357600019810190811161079357610a9591613a62565b5054945b610aa284613b4c565b90600160a01b600190036009541696600382015494600583015492600160a01b60019003906002015416936040519a8b998a99632af8528160e11b8b5260048b015260248a0161016090526101648a01610afb91613445565b8981036003190160448b0152610b1091613445565b966064890152608488015260a487015260c486015260ff8116151560e486015260181c60ff16151561010485015261012484015260ff1661014483015203815a93600094fa801561076057610b7c91600091610b80575b50604051918291602083526020830190613445565b0390f35b610b9d91503d806000833e610b9581836135ee565b810190613a7e565b82610b67565b50504294610a99565b634e487b7160e01b81526032600452602490fd5b4293610a7b565b610a56565b6020813d602011610c07575b81610be5602093836135ee565b81010312610c0357519060ff82168203610c00575086610a4c565b80fd5b5080fd5b3d9150610bd8565b602060049195610a2e565b610c309192503d806000833e610b9581836135ee565b9086610a21565b90610a02565b610c529293503d8091833e610b9581836135ee565b9085806109d9565b63677510db60e11b60005260046000fd5b34610753576020366003190112610753576004356000818152600d6020526040902060028101546001600160a01b03169190338390036107cb576005019182549260ff8460081c16610ccd57610100610ccb9461ff00191617905561423f565b005b634b3aaa7960e11b60005260046000fd5b34610753576000366003190112610753576012546040516001600160a01b039091168152602090f35b34610753576020366003190112610753576060610140604051610d29816135d2565b60008152600060208201526000604082015260008382015260006080820152600060a0820152600060c0820152600060e0820152600061010082015260006101208201520152600435600052600d602052604060002060405190610d8c826135d2565b60018060a01b03815416825260018060a01b03600182015416602083015260018060a01b036002820154169060408301918252600381015492606081019384526004820154916080820192835260058101549060a0830160ff83161515815260c084019160ff8460081c161515835260ff60e0860194818160101c1615158652818160181c16151561010088015260201c16906001821015610fd3579260068693948996936101208c9901520193845494610e4686613703565b95610e5460405197886135ee565b80875260208701916000526020600020916000905b828210610f65575050505091839161012093610140610f049601968752604051998a9960208b526101808b019960018060a01b0387511660208d015260018060a01b0360208801511660408d015260018060a01b0390511660608c01525160808b01525160a08a015251151560c089015251151560e088015251151561010087015261010081015115158287015201516101408501906135c5565b519061016080840152815180915260206101a0840192019060005b818110610f2d575050500390f35b9193509160206060600192610f57604088518051845285810151868501520151604083019061362c565b019401910191849392610f1f565b60409b9495969798999a9b5180606081011060018060401b03606083011117610fe95760608101604052845481526001850154602082015260ff6002860154166004811015610fd35760019282602092604060039501528152019401910190929a999897969594939a610e69565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346107535760803660031901126107535761101861346a565b611020613496565b606435916001600160401b03831161075357366023840112156107535782600401359161104c83613611565b9261105a60405194856135ee565b8084523660248287010111610753576020816000926024610ccb9801838801378501015260443591613943565b34610753576040366003190112610753577f4bf9282e3599b6ced47a6b43d6cc20c76b84e799284fcc9a2630e5760cb31fc96110c161346a565b6110c9613518565b906110d261422b565b60018060a01b03811660005260146020526110f18260406000206137f0565b604080516001600160a01b039290921682529115156020820152a1005b346107535760203660031901126107535761112761346a565b61112f61422b565b6001600160a01b0316801561118257600980546001600160a01b0319811683179091556001600160a01b03167f7c5678af833b27d4a7e7c941e937740f7a52441e57ccee32a250aafbcf6fdfe1600080a3005b63086665d760e31b60005260046000fd5b34610753576020366003190112610753576004356111af61422b565b6101f481116111e9576020817f74516f05eb4bd2461d57aa1e935ee553f86a3e02bfed7759f2f772915de3d9be92601055604051908152a1005b63390edff560e11b60005260046000fd5b346107535760203660031901126107535761121361346a565b61121b61422b565b6001600160a01b0316801561126e57601280546001600160a01b0319811683179091556001600160a01b03167f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f38600080a3005b63bb0bac9960e01b60005260046000fd5b346107535760403660031901126107535761129861346a565b6112a0613518565b6001600160a01b03909116908115611305573360005260056020526040600020826000526020526112d58160406000206137f0565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b50630b61174360e31b60005260045260246000fd5b34610753576000366003190112610753576020601054604051908152f35b34610753576020366003190112610753576001600160a01b0361135961346a565b166000526013602052602060ff604060002054166040519015158152f35b346107535760003660031901126107535760405160006001548060011c90600181168015611478575b6020831081146114645782855290811561144057506001146113e1575b610b7c836113cd818503826135ee565b604051918291602083526020830190613445565b600160009081527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6939250905b808210611426575090915081016020016113cd6113bd565b91926001816020925483858801015201910190929161140e565b60ff191660208086019190915291151560051b840190910191506113cd90506113bd565b634e487b7160e01b84526022600452602484fd5b91607f16916113a0565b34610753576000366003190112610753576006546040516001600160a01b039091168152602090f35b6060366003190112610753576114bf61346a565b6024356001600160401b038111610753576114de9036906004016134ac565b916114e7613480565b906114f0613d93565b6000936001600160a01b0382169384156117f8576001600160a01b0384169485156117e95761151e84613fae565b604051630a7951fb60e11b81526020600482018190528180611544602482018888613639565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156117de5788916117a8575b50801561179957879188818a52601460205260ff60408b2054161580611782575b60115490811515908161176a575b81611752575b80611747575b61172f575b611727575b506115d2833033856140d6565b836116e6575b8061166f575b5050906115ea916136c6565b9586600a5497889683806115fd8a613852565b600a55600161160f9481948b8d614369565b61161a84848861441a565b61162590858761445d565b848152600e6020526040812060ff198154169055604051936001859461164d94829387613db5565b036000805160206145a583398151915291a36001600855604051908152602090f35b8034106116d757898080808460018060a01b03601254165af16116906136d3565b50156116c85760606115ea9493926000805160206145c5833981519152926040519182528c60208301526040820152a19091896115de565b634033e4e360e01b8a5260048afd5b6383e05c6760e01b8a5260048afd5b6012546116fe9085906001600160a01b031684614121565b6000805160206145c583398151915260606040518481528660208201528c6040820152a16115d8565b90508a6115c5565b945061271061174060105486613693565b04946115c0565b5060105415156115bb565b338d52601360205260408d205460ff161591506115b5565b848d52601460205260408d205460ff161591506115af565b50338a52601360205260ff60408b205416156115a1565b63162908e360e11b8852600488fd5b90506020813d6020116117d6575b816117c3602093836135ee565b810103126117d2575188611580565b8780fd5b3d91506117b6565b6040513d8a823e3d90fd5b631559b7d760e21b8752600487fd5b63c1ab6dc160e01b8652600486fd5b3461075357600036600319011261075357600754336001600160a01b039091160361186a57600780546001600160a01b0319908116909155600680543392811683179091556001600160a01b03166000805160206145e5833981519152600080a3005b63118cdaa760e01b6000523360045260246000fd5b346107535760003660031901126107535761189861422b565b600780546001600160a01b03199081169091556006805491821690556000906001600160a01b03166000805160206145e58339815191528280a3005b34610753576020366003190112610753576001600160a01b036118f561346a565b1680156119145760005260036020526020604060002054604051908152f35b6322718ad960e21b600052600060045260246000fd5b34610753576020366003190112610753576001600160a01b0361194b61346a565b166000526014602052602060ff604060002054166040519015158152f35b34610753576000366003190112610753576009546040516001600160a01b039091168152602090f35b3461075357602036600319011261075357600435600052600d6020526101406040600020611a5160018060a01b038254169160018060a01b036001820154169060018060a01b036002820154166003820154906005600484015493015493604051968752602087015260408601526060850152608084015260ff8116151560a084015260ff8160081c16151560c084015260ff8160101c16151560e084015260ff8160181c16151561010084015260ff61012084019160201c166135c5565bf35b34610753576020366003190112610753576020611a71600435613d5c565b6040516001600160a01b039091168152f35b34610753576000366003190112610753576020600a54604051908152f35b3461075357610ccb611ab23661358b565b9060405192611ac26020856135ee565b60008452613943565b60e0366003190112610753576004356001600160401b03811161075357611af6903690600401613527565b6101405260a0526024356001600160401b03811161075357611b1c903690600401613527565b90608052611b28613480565b61012052611b346134dc565b90611b3d6134eb565b611b456134fa565b611b4d613509565b90611b56613d93565b610120516001600160a01b0316156120425761014051158015612035575b612024576011548015158061200b575b611f8e575b50611b966101405161371a565b92611ba36101405161371a565b93611bb06101405161371a565b611bbc6101405161371a565b90611bc96101405161371a565b9060009384905b610140518210611d7a57505060005b848110611d55575060005b848110611ccd575050505050611c026101405161371a565b9560005b610140518110611c7357610b7c88604051602081527f2d341c7697798648bc908b4256501fbc76cd15da64aae8fbbdf825d06078c26760018060a01b0361012051169180611c576020820186613557565b0390a26001600855604051918291602083526020830190613557565b80611cbc87878787878d87611cb0611ca882611c9f611c9a60019e6101405160a05161374c565b61375c565b94608051613801565b929098613770565b5196610120519261415c565b611cc6828b613770565b5201611c06565b6001906001600160a01b03611ce28285613770565b5116611cee8287613770565b51611d06611cfc8488613770565b51913033856140d6565b80611d14575b505001611bea565b6000805160206145c58339815191529181611d3b606093878060a01b036012541684614121565b604051918252602082015260006040820152a18c80611d0c565b600190611d746001600160a01b03611d6d8386613770565b5116613fae565b01611bdf565b90948a611dbc6020611d9989611c9f611c9a826101405160a05161374c565b604051630a7951fb60e11b81526004810184905293849283926024840191613639565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561076057600091611f5d575b508015610716576001600160a01b03821660009081526014602052604090205460ff161580611f44575b80611f39575b60009015611f335750612710611e4160105483613693565b04915b8c611e658a611e5386866136c6565b9285611e5f838b613770565b52613770565b5260001960005b858110611f06575b506000198103611ec25750600193611eb993909290916001600160a01b0316611e9d8489613770565b52611ea8838a613770565b52611eb38288613770565b52613852565b955b0190611bd0565b91611f0091506001949993611ee4611ef992611ede868d613770565b51613845565b611eee858c613770565b52611ede848a613770565b9187613770565b52611ebb565b6001600160a01b0383811690611f1c838b613770565b511614611f2b57600101611e6c565b905038611e74565b91611e44565b506010541515611e29565b5033600052601360205260ff6040600020541615611e23565b906020823d8211611f86575b81611f76602093836135ee565b81010312610c005750518e611df9565b3d9150611f69565b803410611ffa576012546000918291829182916001600160a01b03165af1611fb46136d3565b5015611fe9576000805160206145c583398151915260606011546040519060008252600060208301526040820152a185611b89565b634033e4e360e01b60005260046000fd5b6383e05c6760e01b60005260046000fd5b5033600052601360205260ff6040600020541615611b84565b631ec5aa5160e01b60005260046000fd5b5083610140511415611b74565b631559b7d760e21b60005260046000fd5b346107535760203660031901126107535760043561206f613d93565b6000818152600d602052604090206001810180546001600160a01b031633036107cb576005820190815460ff8116156121d95760101c60ff166107ba576120b584613b4c565b600384018054936120c683866136c6565b948061218d575060005b87600052600c6020526120e8816040600020546136c6565b80612163575b5087600052600c6020526040600020556201000062ff0000198254161790555581612141575b837f7e54bd6094c71de17a15debc487b7c7d159855192adae118555e86f58df3217f600080a26001600855005b9154915461215b926001600160a01b039182169116614121565b818080612114565b60018060a01b03885416600052600b60205261218560406000209182546136c6565b9055886120ee565b6121ae9088600052600c6020526121a960406000205486613693565b6136a6565b87600052600c6020526040600020548111156120d0575086600052600c6020526040600020546120d0565b6367909b1560e01b60005260046000fd5b3461075357602036600319011261075357600435612206613d93565b80600052600d60205260406000209060ff600583015460081c1660001461237d576001600160a01b0361223882613d5c565b1633036107cb575b8154612254906001600160a01b0316613fae565b61225d81613c03565b91821561236c5780546040516370a0823160e01b8152306004820152916001600160a01b0390911690602083602481855afa92831561076057600093612336575b506122c46122af6123039487613693565b83600052600b602052604060002054906136a6565b948592600483016122d6838254613845565b9055600052600b6020526122f060406000209182546136c6565b90555433906001600160a01b0316614121565b6040519182527fa6c812047c4dc10f52f9e7943b1b3dfafae864d5e0d4ded081bbbde69dd6ff0d60203393a36001600855005b92506020833d602011612364575b81612351602093836135ee565b81010312610753579151916122c461229e565b3d9150612344565b63094b911b60e41b60005260046000fd5b60028201546001600160a01b031633146122405763ea8e4eb560e01b60005260046000fd5b34610753576020366003190112610753577f2dfc898b3677e9a8db0ccd358b29e83d409f092f876498f4cf135d707165f85f60206004356123e161422b565b80601155604051908152a1005b3461075357610ccb6123ff3661358b565b91613861565b60e0366003190112610753576004356001600160401b03811161075357612430903690600401613527565b61018052610100526024356001600160401b03811161075357612457903690600401613527565b60e0919091526044356001600160401b0381116107535761247c903690600401613527565b60c0526101605261248b6134dc565b6124936134eb565b9161249c6134fa565b906124a5613509565b610200526124b1613d93565b6101805115612024578061018051036120245760c051610180510361202457601154801515806128e7575b61288c575b506124ee6101805161371a565b916124fb6101805161371a565b926125086101805161371a565b6125146101805161371a565b906125216101805161371a565b9060009384905b6101805182106126c257505060005b8481106126a4575060005b84811061262657505050505061255a6101805161371a565b9460005b6101805181106125be57610b7c877f66e7e3b09cc02b8629f3bfb57a8df3ec300fcc82ac09025e4056ee07789f80e5604051806125a260c051610160518684613784565b0390a16001600855604051918291602083526020830190613557565b80612615866125d9611c9a600195610180516101005161374c565b86868b6125e9878c60e051613801565b61260989612603611c9a8260c09b969b516101605161374c565b93613770565b5196610200519661415c565b61261f828a613770565b520161255e565b6001906001600160a01b0361263b8285613770565b51166126478287613770565b51612655611cfc8488613770565b80612663575b505001612542565b6000805160206145c5833981519152918161268a606093878060a01b036012541684614121565b604051918252602082015260006040820152a18b8061265b565b6001906126bc6001600160a01b03611d6d8386613770565b01612537565b90946126d8611c9a87610180516101005161374c565b60018060a01b036126f2611c9a8960c0516101605161374c565b16156120425761270a6020611d99898c60e051613801565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156107605760009161285b575b508015610716576001600160a01b03821660009081526014602052604090205460ff161580612842575b80612837575b60009015612831575061271061278f60105483613693565b04915b8b6127a18a611e5386866136c6565b5260001960005b858110612804575b5060001981036127e257506001936127d993909290916001600160a01b0316611e9d8489613770565b955b0190612528565b916127fe91506001949993611ee4611ef992611ede868d613770565b526127db565b6001600160a01b038381169061281a838b613770565b511614612829576001016127a8565b90508f6127b0565b91612792565b506010541515612777565b5033600052601360205260ff6040600020541615612771565b906020823d8211612884575b81612874602093836135ee565b81010312610c005750518d612747565b3d9150612867565b803410611ffa576012546000918291829182916001600160a01b03165af16128b26136d3565b5015611fe9576000805160206145c583398151915260606011546040519060008252600060208301526040820152a1846124e1565b5033600052601360205260ff60406000205416156124dc565b34610753576040366003190112610753577f4f2b5251c8f306eb85fdbe1289e523181135fc91cea742686337ccf264194c4b61293a61346a565b612942613518565b9061294b61422b565b60018060a01b03811660005260136020526110f18260406000206137f0565b60e03660031901126107535761297e61346a565b6024356001600160401b0381116107535761299d9036906004016134ac565b906044356001600160401b038111610753576129bd903690600401613527565b916129c66134dc565b6129ce6134eb565b6129d66134fa565b906129df613509565b926129e8613d93565b86156120245760405198630a7951fb60e11b8a52602060048b015260208a80612a15602482018d8b613639565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa998a156107605760009a612c8d575b508915610716576001600160a01b03811660008181526014602052604090205460ff161590899082612c70575b8c60009380612c65575b612c48575b83612a98916136c6565b9c60115480151580612c2f575b80612c16575b612bae575b50612ac783612acf92612ac288613fae565b613693565b3033846140d6565b82612b60575b50612ae0915061371a565b9860005b898110612b2257610b7c8b7ffaaa088e25588dbd6e83ae9fad440a4572e7e028ad331b943999846d4609cea58c8c6125a26040519283928684613784565b808b612b59828f612b53908f8f8f8f928f928f928f92908f928f9260019f611c9a91612b4d9361374c565b9261415c565b92613770565b5201612ae4565b612b7b6060926000805160206145c583398151915294613693565b601254612b939082906001600160a01b031684614121565b604051918252602082015260006040820152a18a8881612ad5565b809193503410611ffa576012546000918291829182916001600160a01b03165af1612bd76136d3565b5015611fe957612acf612ac78c80946000805160206145c5833981519152606060115460405190888252600060208301526040820152a1925050612ab0565b5033600052601360205260ff6040600020541615612aab565b5082600052601460205260ff6040600020541615612aa5565b9250612a98612710612c5c60105486613693565b04939050612a8e565b506010541515612a89565b9150503360005260136020528860ff604060002054161591612a7f565b90996020823d602011612cb9575b81612ca8602093836135ee565b81010312610c00575051988a612a52565b3d9150612c9b565b3461075357604036600319011261075357600435612cdd613496565b6001600160a01b03811691908215612042576000828152600d60205260409020600281018054909291906001600160a01b031633036107cb5760ff60058592015460081c16612d62575b505080546001600160a01b0319168317905533907f7371e69f52f4d686cd45411aa8f42c54be6f5296342d67e6e43daf1db1bc25c6600080a4005b612d6b91613df2565b508382612d27565b60e036600319011261075357612d8761346a565b6101a0526024356001600160401b03811161075357612daa9036906004016134ac565b612db2613480565b91612dbb6134dc565b612dc36134eb565b93612dcc6134fa565b612dd4613509565b612ddc613d93565b6101a051600097906001600160a01b0316801561314f576001600160a01b0385161561314057612e0e6101a051613fae565b604051630a7951fb60e11b81526020600482018190528180612e34602482018d8d613639565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156106fc578a9161310e575b5080156130ff5789918a818c52601460205260ff60408d20541615806130e8575b8c6011549182151591826130d0575b826130b7575b50806130ac575b613094575b61308c575b50612ec4833033856140d6565b8361304a575b80612fad575b50509360406000805160206145a583398151915298999a829594612efa612f6695612f84996136c6565b6101e052600a546101c052612f116101c051613852565b600a55612f2e8682848d8d6101e051906101a0516101c051614369565b612f3c8d8d6101c05161441a565b612f506101e0516101a0516101c05161445d565b612f9b575b6101c0518152600e602052206137f0565b60405194859460018060a01b0316986101c051986101a05187613db5565b0390a36101c0516001600855604051908152602090f35b612fa86101c0518961423f565b612f55565b80341061303b578b8080808460018060a01b03601254165af1612fce6136d3565b501561302c579a869594612efa612f6695612f8499956000805160206145a58339815191529d9e9f60606040976000805160206145c583398151915292895191825288602083015289820152a19550955050949596509a9998612ed0565b634033e4e360e01b8c5260048cfd5b6383e05c6760e01b8c5260048cfd5b6012546130629085906001600160a01b031684614121565b6000805160206145c583398151915260608d604051908582528760208301526040820152a1612eca565b90508c612eb7565b94506127106130a560105486613693565b0494612eb2565b506010541515612ead565b3381526013602052604090205460ff161591508e612ea6565b8581526014602052604081205460ff16159250612ea0565b50338c52601360205260ff60408d20541615612e91565b63162908e360e11b8a5260048afd5b90506020813d602011613138575b81613129602093836135ee565b810103126106f057518a612e70565b3d915061311c565b631559b7d760e21b8952600489fd5b63c1ab6dc160e01b8952600489fd5b346107535760403660031901126107535761317761346a565b60243561318381613d5c565b3315158061323a575b8061320c575b6131f75781906001600160a01b0384811691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4600090815260046020526040902080546001600160a01b0319166001600160a01b03909216919091179055005b63a9fbf51f60e01b6000523360045260246000fd5b506001600160a01b038116600090815260056020908152604080832033845290915290205460ff1615613192565b506001600160a01b03811633141561318c565b346107535760203660031901126107535760043561326a81613d5c565b506000526004602052602060018060a01b0360406000205416604051908152f35b3461075357600036600319011261075357604051600080548060011c9060018116801561333c575b6020831081146114645782855290811561144057506001146132df57610b7c836113cd818503826135ee565b60008080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563939250905b808210613322575090915081016020016113cd6113bd565b91926001816020925483858801015201910190929161330a565b91607f16916132b3565b346107535760203660031901126107535760043580600052600d602052613371604060002091613c03565b9060018060a01b03905416670de0b6b3a7640000820291808304670de0b6b3a76400001490151715610793576020916108eb91600052600f8352604060002054906136a6565b34610753576020366003190112610753576004359063ffffffff60e01b8216809203610753576020916380ac58cd60e01b8114908115613411575b8115613400575b5015158152f35b6301ffc9a760e01b149050836133f9565b635b5e139f60e01b811491506133f2565b60005b8381106134355750506000910152565b8181015183820152602001613425565b9060209161345e81518092818552858086019101613422565b601f01601f1916010190565b600435906001600160a01b038216820361075357565b604435906001600160a01b038216820361075357565b602435906001600160a01b038216820361075357565b9181601f84011215610753578235916001600160401b038311610753576020808501946060850201011161075357565b60643590811515820361075357565b60843590811515820361075357565b60a43590811515820361075357565b60c43590811515820361075357565b60243590811515820361075357565b9181601f84011215610753578235916001600160401b038311610753576020808501948460051b01011161075357565b906020808351928381520192019060005b8181106135755750505090565b8251845260209384019390920191600101613568565b6060906003190112610753576004356001600160a01b038116810361075357906024356001600160a01b0381168103610753579060443590565b906001821015610fd35752565b61016081019081106001600160401b03821117610fe957604052565b601f909101601f19168101906001600160401b03821190821017610fe957604052565b6001600160401b038111610fe957601f01601f191660200190565b906004821015610fd35752565b916020908281520191906000905b8082106136545750505090565b909192833581526020840135602082015260408401359060048210156107535760608161368860019460408495019061362c565b019401920190613647565b8181029291811591840414171561079357565b81156136b0570490565b634e487b7160e01b600052601260045260246000fd5b9190820391821161079357565b3d156136fe573d906136e482613611565b916136f260405193846135ee565b82523d6000602084013e565b606090565b6001600160401b038111610fe95760051b60200190565b9061372482613703565b61373160405191826135ee565b8281528092613742601f1991613703565b0190602036910137565b919081101561077d5760051b0190565b356001600160a01b03811681036107535790565b805182101561077d5760209160051b010190565b61379b602092949394604083526040830190613557565b90828183039101528281520191906000905b8082106137ba5750505090565b91929091908335906001600160a01b0382168203610753576001600160a01b0390911681526020908101930191600101906137ad565b9060ff801983541691151516179055565b919081101561077d5760051b81013590601e19813603018212156107535701803591906001600160401b038311610753576020016060830236038113610753579190565b9190820180921161079357565b60001981146107935760010190565b9091906001600160a01b0383161561392d57600092613881338483613ea7565b6001600160a01b0381169490919085151580613925575b1561391e57848152600e60205260ff6040822054161561390f57848152600d6020526040902060020180546001600160a01b0319166001600160a01b039092169190911790555b506001600160a01b03168083036138f557505050565b6364283d7b60e01b60005260045260245260445260646000fd5b6330d4e75d60e01b8152600490fd5b50506138df565b506001613898565b633250574960e11b600052600060045260246000fd5b9291613950818386613861565b813b61395d575b50505050565b604051630a85bd0160e11b81523360048201526001600160a01b03948516602482015260448101919091526080606482015292169190602090829081906139a8906084830190613445565b03816000865af18091600091613a1f575b50906139ea57506139c86136d3565b805190816139e55782633250574960e11b60005260045260246000fd5b602001fd5b6001600160e01b03191663757a42ff60e11b01613a0b575038808080613957565b633250574960e11b60005260045260246000fd5b6020813d602011613a5a575b81613a38602093836135ee565b81010312610c035751906001600160e01b031982168203610c005750386139b9565b3d9150613a2b565b805482101561077d576000526003602060002091020190600090565b602081830312610753578051906001600160401b038211610753570181601f82011215610753578051613ab081613611565b92613abe60405194856135ee565b8184526020828401011161075357613adc9160208085019101613422565b90565b9291906040840190604085528054809252606085019060005260206000209160005b818110613b1357505060209150930152565b90916003606060019286548152838701546020820152613b3e60ff600289015416604083019061362c565b019401910192919092613b01565b600052600d602052604060002060ff600582015460101c16613bfc576020613b8d916040518093819263eaa9048560e01b8352600642910160048401613adf565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561076057600091613bcd575090565b90506020813d602011613bf4575b81613be8602093836135ee565b81010312610753575190565b3d9150613bdb565b6003015490565b80600052600d602052604060002060ff600582015460101c16613d3f5760405163eaa9048560e01b815260208180613c42426006870160048401613adf565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561076057600091613d0d575b506003820154808211613d05575b600081613ce6575050506000915b80600052600c6020526040600020548311613cce575b506004015480821115613cc757613adc916136c6565b5050600090565b6000908152600c602052604090205491506004613cb1565b613cff92604082876121a99452600c6020522054613693565b91613c9b565b905080613c8d565b906020823d602011613d37575b81613d27602093836135ee565b81010312610c0057505138613c7f565b3d9150613d1a565b613adc91600052600c6020526004604060002054910154906136c6565b6000818152600260205260409020546001600160a01b0316908115613d7f575090565b637e27328960e01b60005260045260246000fd5b600260085414613da4576002600855565b633ee5aeb560e01b60005260046000fd5b9491608094979693613ddc9260018060a01b0316875260a0602088015260a0870191613639565b9515156040850152151560608401521515910152565b6000828152600260205260409020546001600160a01b0316919082613e70575b6001600160a01b031680613e56575b600082815260026020526040812080546001600160a01b0319168317905583906000805160206146058339815191529080a490565b806000526003602052604060002060018154019055613e21565b600082815260046020526040902080546001600160a01b031916905582600052600360205260406000206000198154019055613e12565b6000828152600260205260409020546001600160a01b03908116931680151580613f16575b505082613e70576001600160a01b031680613e5657600082815260026020526040812080546001600160a01b0319168317905583906000805160206146058339815191529080a490565b80613f5a575b15613f275780613ecc565b905082613f435750637e27328960e01b60005260045260246000fd5b63177e802f60e01b60005260045260245260446000fd5b508084148015613f8a575b80613f1c57506000838152600460205260409020546001600160a01b03168114613f1c565b5083600052600560205260406000208160005260205260ff60406000205416613f65565b6001600160a01b03166000818152600b602052604090205480156140bc576040516370a0823160e01b8152306004820152602081602481865afa9081156107605760009161408a575b50801561406f576001820180921161079357670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561079357600181018091116107935780614055575050600052600f602052670de0b6b3a7640000604060002055565b61405e916136a6565b90600052600f602052604060002055565b5050600052600f602052670de0b6b3a7640000604060002055565b906020823d6020116140b4575b816140a4602093836135ee565b81010312610c0057505138613ff7565b3d9150614097565b50600052600f602052670de0b6b3a7640000604060002055565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815261411f9161411a6084836135ee565b61449c565b565b60405163a9059cbb60e01b60208201526001600160a01b03909216602483015260448083019390935291815261411f9161411a6064836135ee565b92959093969794919760018060a01b0384161561421a576001600160a01b03871697881561204257861561071657600a54998a9889988785888c8785876141a284613852565b600a556141b196600094614369565b6141bc838a8c61441a565b6141c790888b61445d565b6000805160206145a5833981519152986142049661420a575b9050600052600e6020526141f88460406000206137f0565b60405196879687613db5565b0390a390565b6142139161423f565b38896141e0565b63c1ab6dc160e01b60005260046000fd5b6006546001600160a01b0316330361186a57565b6001600160a01b0381161561392d5760009061425c828483613ea7565b6001600160a01b03811615159390929084806142ed575b156142e557808252600e60205260ff604083205416156142d6578152600d6020526040902060020180546001600160a01b0319166001600160a01b039092169190911790555b506142c057565b6339e3563760e11b600052600060045260246000fd5b6330d4e75d60e01b8252600482fd5b5050506142b9565b506001614273565b919081101561077d576060020190565b8054600160401b811015610fe95761432291600182018155613a62565b614353578135815560208201356001820155600201906040013560048110156107535760ff80198354169116179055565b634e487b7160e01b600052600060045260246000fd5b6000908152600d6020526040902080546001600160a01b039283166001600160a01b03199182161782556001820180543390831617905560028201805494909316931692909217905560038101919091556005810194939092916143cd90866137f0565b61ff00855491151560081b169061ff0019161784556000600485549301556001811015610fd35763ff0000009060ff60201b9060201b1692151560181b169064ffffff0000191617179055565b919091600052600d602052604060002090600660009201915b8181106144405750505050565b8061445761445160019385886142f5565b85614305565b01614433565b916144689082614513565b91600052600c6020528160406000205560018060a01b0316600052600b6020526144986040600020918254613845565b9055565b6000806144c59260018060a01b03169360208151910182865af16144be6136d3565b9083614543565b80519081151591826144ef575b50506144db5750565b635274afe760e01b60005260045260246000fd5b819250906020918101031261075357602001518015908115036107535738806144d2565b6001600160a01b03166000908152600f6020526040902054670de0b6b3a76400009161453f9190613693565b0490565b90614569575080511561455857805190602001fd5b630a12f52160e11b60005260046000fd5b8151158061459b575b61457a575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b1561457256fecfcd2ea84a9e988255710b3adc4919275a012aa72f68b63acf1e9f67296e134f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea8411698be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207735b669f2510af4e8e016c90cd472f134c9c5e0ffc51986c114f9ed556c96d264736f6c634300081b00330000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f67000000000000000000000000ce77b3a862f0fdd1d53a6ef62ddd7146fb7d27eb00000000000000000000000090cf3e1fb9d1b35fad621649ca503ea13cf37163

Deployed Bytecode

0x61022080604052600436101561001457600080fd5b60003560e01c90816301ffc9a7146133b757508063025d3c831461334657806306fdde031461328b578063081812fc1461324d578063095ea7b31461315e5780630c558e4414612d735780631878559014612cc15780631ce113491461296a5780631e6492b11461290057806323241b131461240557806323b872dd146123ee57806323fa495a146123a257806337bdc99b146121ea57806340e58ee51461205357806340ee653814611acb57806342842e0e14611aa1578063495f3d2714611a835780636352211e14611a535780636d3cbe21146119925780636d6060f5146119695780636de18fbb1461192a57806370a08231146118d4578063715018a61461187f57806379ba5097146118075780638799ce22146114ab5780638da5cb5b1461148257806395d89b411461137757806397b5bb3a14611338578063a001ecdd1461131a578063a22cb4651461127f578063a42dce80146111fa578063ae06c1b714611193578063b3a0f37d1461110e578063b8677ebd14611087578063b88d4fde14610fff578063beb8f88314610d07578063c415b95c14610cde578063c86055cb14610c6b578063c87b56dd14610974578063cafeedf614610956578063ce3e39c014610911578063d9eb5947146108f3578063dda085cf146108cd578063e30c3978146108a4578063e985e9c514610849578063f2fde38b146107dc5763fc48422c1461022557600080fd5b34610753576040366003190112610753576004356024356001600160401b038111610753576102589036906004016134ac565b9091610262613d93565b6000818152600d6020526040902060018101549093906001600160a01b031633036107cb57600584015460ff8160101c166107ba5760181c60ff16156107a9576006840180546000198101908111610793576102be9082613a62565b5054841561077d578235111561076c57604051630a7951fb60e11b815260206004820181905290957f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b031692918780610322602482018a89613639565b0381865afa96871561076057600097610727575b50600381019081548098111561071657600097806020870135106107075760405190630a7951fb60e11b8252602060048301526020828061037b602482018d8c613639565b0381895afa80156106fc578a906106c4575b61039792506136c6565b81546103ab906001600160a01b0316613fae565b81546001600160a01b0316808a52601460205260408a205490918a9160ff1615806106ad575b806106a2575b610685575b816103e691613845565b6040516370a0823160e01b815230600482015292602084602481845afa938415610641578c9461064c575b509061042091309033906140d6565b82546040516370a0823160e01b81523060048201526001600160a01b0390911690602081602481855afa908115610641578c91610608575b5061047593610466916136c6565b9082806105bb575b50506136c6565b9360206040518092630a7951fb60e11b8252826004830152818061049e8d60248301908d613639565b03915afa9081156105b057899161057a575b5081546104c79086906001600160a01b0316614513565b9255858852600c602052604088206104e0838254613845565b9055546001600160a01b03168752600b602052604087208054909161050491613845565b9055855b85811061055d575050907f3ca9c0d48ed2e86756871eee17814f70a8e4471f79823d1fd8836be2ddd8bdde9161055260405192839283526040602084015233966040840191613639565b0390a3600160085580f35b8061057461056e60019389886142f5565b84614305565b01610508565b90506020813d6020116105a8575b81610595602093836135ee565b810103126105a45751386104b0565b8880fd5b3d9150610588565b6040513d8b823e3d90fd5b6012546105d3926001600160a01b0390911690614121565b6000805160206145c5833981519152606060018060a01b038654166040519081528460208201528d6040820152a1388261046e565b90508b8160203d60201161063a575b60209261062482846135ee565b50810103126106365751610475610458565b8b80fd5b503d610617565b6040513d8e823e3d90fd5b919093508b8260203d60201161067e575b60209261066a82846135ee565b508101031261063657905192610420610411565b503d61065d565b90506103e661271061069960105484613693565b049190506103dc565b5060105415156103d7565b50338b52601360205260ff60408c205416156103d1565b506020823d6020116106f4575b816106de602093836135ee565b810103126106f057610397915161038d565b8980fd5b3d91506106d1565b6040513d8c823e3d90fd5b63162908e360e11b8952600489fd5b63162908e360e11b60005260046000fd5b9096506020813d602011610758575b81610743602093836135ee565b8101031261075357519538610336565b600080fd5b3d9150610736565b6040513d6000823e3d90fd5b6337bf561360e11b60005260046000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6303813f7960e41b60005260046000fd5b635bc2daf760e01b60005260046000fd5b63ea8e4eb560e01b60005260046000fd5b34610753576020366003190112610753576107f561346a565b6107fd61422b565b600780546001600160a01b0319166001600160a01b039283169081179091556006549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346107535760403660031901126107535761086261346a565b61086a613496565b9060018060a01b0316600052600560205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b34610753576000366003190112610753576007546040516001600160a01b039091168152602090f35b346107535760203660031901126107535760206108eb600435613c03565b604051908152f35b34610753576000366003190112610753576020601154604051908152f35b34610753576000366003190112610753576040517f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03168152602090f35b346107535760203660031901126107535760206108eb600435613b4c565b34610753576020366003190112610753576004356001600160a01b0361099982613d5c565b1615610c5a5780600052600d602052604060002060018060a01b03815416916000604051906395d89b4160e01b82528082600481885afa90918282610c3d575b5050610c3757506040516109ee6040826135ee565b60058152642a27a5a2a760d91b6020820152905b6040516306fdde0360e01b8152600081600481885afa60009181610c1a575b50610c0f57506004602083955b60405163313ce56760e01b815292839182905afa8091600091610bcc575b5090610bc7575060125b6006840180548015801593929190610bc0576000825415610bac578083602092522054935b15610ba357600019810190811161079357610a9591613a62565b5054945b610aa284613b4c565b90600160a01b600190036009541696600382015494600583015492600160a01b60019003906002015416936040519a8b998a99632af8528160e11b8b5260048b015260248a0161016090526101648a01610afb91613445565b8981036003190160448b0152610b1091613445565b966064890152608488015260a487015260c486015260ff8116151560e486015260181c60ff16151561010485015261012484015260ff1661014483015203815a93600094fa801561076057610b7c91600091610b80575b50604051918291602083526020830190613445565b0390f35b610b9d91503d806000833e610b9581836135ee565b810190613a7e565b82610b67565b50504294610a99565b634e487b7160e01b81526032600452602490fd5b4293610a7b565b610a56565b6020813d602011610c07575b81610be5602093836135ee565b81010312610c0357519060ff82168203610c00575086610a4c565b80fd5b5080fd5b3d9150610bd8565b602060049195610a2e565b610c309192503d806000833e610b9581836135ee565b9086610a21565b90610a02565b610c529293503d8091833e610b9581836135ee565b9085806109d9565b63677510db60e11b60005260046000fd5b34610753576020366003190112610753576004356000818152600d6020526040902060028101546001600160a01b03169190338390036107cb576005019182549260ff8460081c16610ccd57610100610ccb9461ff00191617905561423f565b005b634b3aaa7960e11b60005260046000fd5b34610753576000366003190112610753576012546040516001600160a01b039091168152602090f35b34610753576020366003190112610753576060610140604051610d29816135d2565b60008152600060208201526000604082015260008382015260006080820152600060a0820152600060c0820152600060e0820152600061010082015260006101208201520152600435600052600d602052604060002060405190610d8c826135d2565b60018060a01b03815416825260018060a01b03600182015416602083015260018060a01b036002820154169060408301918252600381015492606081019384526004820154916080820192835260058101549060a0830160ff83161515815260c084019160ff8460081c161515835260ff60e0860194818160101c1615158652818160181c16151561010088015260201c16906001821015610fd3579260068693948996936101208c9901520193845494610e4686613703565b95610e5460405197886135ee565b80875260208701916000526020600020916000905b828210610f65575050505091839161012093610140610f049601968752604051998a9960208b526101808b019960018060a01b0387511660208d015260018060a01b0360208801511660408d015260018060a01b0390511660608c01525160808b01525160a08a015251151560c089015251151560e088015251151561010087015261010081015115158287015201516101408501906135c5565b519061016080840152815180915260206101a0840192019060005b818110610f2d575050500390f35b9193509160206060600192610f57604088518051845285810151868501520151604083019061362c565b019401910191849392610f1f565b60409b9495969798999a9b5180606081011060018060401b03606083011117610fe95760608101604052845481526001850154602082015260ff6002860154166004811015610fd35760019282602092604060039501528152019401910190929a999897969594939a610e69565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346107535760803660031901126107535761101861346a565b611020613496565b606435916001600160401b03831161075357366023840112156107535782600401359161104c83613611565b9261105a60405194856135ee565b8084523660248287010111610753576020816000926024610ccb9801838801378501015260443591613943565b34610753576040366003190112610753577f4bf9282e3599b6ced47a6b43d6cc20c76b84e799284fcc9a2630e5760cb31fc96110c161346a565b6110c9613518565b906110d261422b565b60018060a01b03811660005260146020526110f18260406000206137f0565b604080516001600160a01b039290921682529115156020820152a1005b346107535760203660031901126107535761112761346a565b61112f61422b565b6001600160a01b0316801561118257600980546001600160a01b0319811683179091556001600160a01b03167f7c5678af833b27d4a7e7c941e937740f7a52441e57ccee32a250aafbcf6fdfe1600080a3005b63086665d760e31b60005260046000fd5b34610753576020366003190112610753576004356111af61422b565b6101f481116111e9576020817f74516f05eb4bd2461d57aa1e935ee553f86a3e02bfed7759f2f772915de3d9be92601055604051908152a1005b63390edff560e11b60005260046000fd5b346107535760203660031901126107535761121361346a565b61121b61422b565b6001600160a01b0316801561126e57601280546001600160a01b0319811683179091556001600160a01b03167f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f38600080a3005b63bb0bac9960e01b60005260046000fd5b346107535760403660031901126107535761129861346a565b6112a0613518565b6001600160a01b03909116908115611305573360005260056020526040600020826000526020526112d58160406000206137f0565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b50630b61174360e31b60005260045260246000fd5b34610753576000366003190112610753576020601054604051908152f35b34610753576020366003190112610753576001600160a01b0361135961346a565b166000526013602052602060ff604060002054166040519015158152f35b346107535760003660031901126107535760405160006001548060011c90600181168015611478575b6020831081146114645782855290811561144057506001146113e1575b610b7c836113cd818503826135ee565b604051918291602083526020830190613445565b600160009081527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6939250905b808210611426575090915081016020016113cd6113bd565b91926001816020925483858801015201910190929161140e565b60ff191660208086019190915291151560051b840190910191506113cd90506113bd565b634e487b7160e01b84526022600452602484fd5b91607f16916113a0565b34610753576000366003190112610753576006546040516001600160a01b039091168152602090f35b6060366003190112610753576114bf61346a565b6024356001600160401b038111610753576114de9036906004016134ac565b916114e7613480565b906114f0613d93565b6000936001600160a01b0382169384156117f8576001600160a01b0384169485156117e95761151e84613fae565b604051630a7951fb60e11b81526020600482018190528180611544602482018888613639565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa9081156117de5788916117a8575b50801561179957879188818a52601460205260ff60408b2054161580611782575b60115490811515908161176a575b81611752575b80611747575b61172f575b611727575b506115d2833033856140d6565b836116e6575b8061166f575b5050906115ea916136c6565b9586600a5497889683806115fd8a613852565b600a55600161160f9481948b8d614369565b61161a84848861441a565b61162590858761445d565b848152600e6020526040812060ff198154169055604051936001859461164d94829387613db5565b036000805160206145a583398151915291a36001600855604051908152602090f35b8034106116d757898080808460018060a01b03601254165af16116906136d3565b50156116c85760606115ea9493926000805160206145c5833981519152926040519182528c60208301526040820152a19091896115de565b634033e4e360e01b8a5260048afd5b6383e05c6760e01b8a5260048afd5b6012546116fe9085906001600160a01b031684614121565b6000805160206145c583398151915260606040518481528660208201528c6040820152a16115d8565b90508a6115c5565b945061271061174060105486613693565b04946115c0565b5060105415156115bb565b338d52601360205260408d205460ff161591506115b5565b848d52601460205260408d205460ff161591506115af565b50338a52601360205260ff60408b205416156115a1565b63162908e360e11b8852600488fd5b90506020813d6020116117d6575b816117c3602093836135ee565b810103126117d2575188611580565b8780fd5b3d91506117b6565b6040513d8a823e3d90fd5b631559b7d760e21b8752600487fd5b63c1ab6dc160e01b8652600486fd5b3461075357600036600319011261075357600754336001600160a01b039091160361186a57600780546001600160a01b0319908116909155600680543392811683179091556001600160a01b03166000805160206145e5833981519152600080a3005b63118cdaa760e01b6000523360045260246000fd5b346107535760003660031901126107535761189861422b565b600780546001600160a01b03199081169091556006805491821690556000906001600160a01b03166000805160206145e58339815191528280a3005b34610753576020366003190112610753576001600160a01b036118f561346a565b1680156119145760005260036020526020604060002054604051908152f35b6322718ad960e21b600052600060045260246000fd5b34610753576020366003190112610753576001600160a01b0361194b61346a565b166000526014602052602060ff604060002054166040519015158152f35b34610753576000366003190112610753576009546040516001600160a01b039091168152602090f35b3461075357602036600319011261075357600435600052600d6020526101406040600020611a5160018060a01b038254169160018060a01b036001820154169060018060a01b036002820154166003820154906005600484015493015493604051968752602087015260408601526060850152608084015260ff8116151560a084015260ff8160081c16151560c084015260ff8160101c16151560e084015260ff8160181c16151561010084015260ff61012084019160201c166135c5565bf35b34610753576020366003190112610753576020611a71600435613d5c565b6040516001600160a01b039091168152f35b34610753576000366003190112610753576020600a54604051908152f35b3461075357610ccb611ab23661358b565b9060405192611ac26020856135ee565b60008452613943565b60e0366003190112610753576004356001600160401b03811161075357611af6903690600401613527565b6101405260a0526024356001600160401b03811161075357611b1c903690600401613527565b90608052611b28613480565b61012052611b346134dc565b90611b3d6134eb565b611b456134fa565b611b4d613509565b90611b56613d93565b610120516001600160a01b0316156120425761014051158015612035575b612024576011548015158061200b575b611f8e575b50611b966101405161371a565b92611ba36101405161371a565b93611bb06101405161371a565b611bbc6101405161371a565b90611bc96101405161371a565b9060009384905b610140518210611d7a57505060005b848110611d55575060005b848110611ccd575050505050611c026101405161371a565b9560005b610140518110611c7357610b7c88604051602081527f2d341c7697798648bc908b4256501fbc76cd15da64aae8fbbdf825d06078c26760018060a01b0361012051169180611c576020820186613557565b0390a26001600855604051918291602083526020830190613557565b80611cbc87878787878d87611cb0611ca882611c9f611c9a60019e6101405160a05161374c565b61375c565b94608051613801565b929098613770565b5196610120519261415c565b611cc6828b613770565b5201611c06565b6001906001600160a01b03611ce28285613770565b5116611cee8287613770565b51611d06611cfc8488613770565b51913033856140d6565b80611d14575b505001611bea565b6000805160206145c58339815191529181611d3b606093878060a01b036012541684614121565b604051918252602082015260006040820152a18c80611d0c565b600190611d746001600160a01b03611d6d8386613770565b5116613fae565b01611bdf565b90948a611dbc6020611d9989611c9f611c9a826101405160a05161374c565b604051630a7951fb60e11b81526004810184905293849283926024840191613639565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa90811561076057600091611f5d575b508015610716576001600160a01b03821660009081526014602052604090205460ff161580611f44575b80611f39575b60009015611f335750612710611e4160105483613693565b04915b8c611e658a611e5386866136c6565b9285611e5f838b613770565b52613770565b5260001960005b858110611f06575b506000198103611ec25750600193611eb993909290916001600160a01b0316611e9d8489613770565b52611ea8838a613770565b52611eb38288613770565b52613852565b955b0190611bd0565b91611f0091506001949993611ee4611ef992611ede868d613770565b51613845565b611eee858c613770565b52611ede848a613770565b9187613770565b52611ebb565b6001600160a01b0383811690611f1c838b613770565b511614611f2b57600101611e6c565b905038611e74565b91611e44565b506010541515611e29565b5033600052601360205260ff6040600020541615611e23565b906020823d8211611f86575b81611f76602093836135ee565b81010312610c005750518e611df9565b3d9150611f69565b803410611ffa576012546000918291829182916001600160a01b03165af1611fb46136d3565b5015611fe9576000805160206145c583398151915260606011546040519060008252600060208301526040820152a185611b89565b634033e4e360e01b60005260046000fd5b6383e05c6760e01b60005260046000fd5b5033600052601360205260ff6040600020541615611b84565b631ec5aa5160e01b60005260046000fd5b5083610140511415611b74565b631559b7d760e21b60005260046000fd5b346107535760203660031901126107535760043561206f613d93565b6000818152600d602052604090206001810180546001600160a01b031633036107cb576005820190815460ff8116156121d95760101c60ff166107ba576120b584613b4c565b600384018054936120c683866136c6565b948061218d575060005b87600052600c6020526120e8816040600020546136c6565b80612163575b5087600052600c6020526040600020556201000062ff0000198254161790555581612141575b837f7e54bd6094c71de17a15debc487b7c7d159855192adae118555e86f58df3217f600080a26001600855005b9154915461215b926001600160a01b039182169116614121565b818080612114565b60018060a01b03885416600052600b60205261218560406000209182546136c6565b9055886120ee565b6121ae9088600052600c6020526121a960406000205486613693565b6136a6565b87600052600c6020526040600020548111156120d0575086600052600c6020526040600020546120d0565b6367909b1560e01b60005260046000fd5b3461075357602036600319011261075357600435612206613d93565b80600052600d60205260406000209060ff600583015460081c1660001461237d576001600160a01b0361223882613d5c565b1633036107cb575b8154612254906001600160a01b0316613fae565b61225d81613c03565b91821561236c5780546040516370a0823160e01b8152306004820152916001600160a01b0390911690602083602481855afa92831561076057600093612336575b506122c46122af6123039487613693565b83600052600b602052604060002054906136a6565b948592600483016122d6838254613845565b9055600052600b6020526122f060406000209182546136c6565b90555433906001600160a01b0316614121565b6040519182527fa6c812047c4dc10f52f9e7943b1b3dfafae864d5e0d4ded081bbbde69dd6ff0d60203393a36001600855005b92506020833d602011612364575b81612351602093836135ee565b81010312610753579151916122c461229e565b3d9150612344565b63094b911b60e41b60005260046000fd5b60028201546001600160a01b031633146122405763ea8e4eb560e01b60005260046000fd5b34610753576020366003190112610753577f2dfc898b3677e9a8db0ccd358b29e83d409f092f876498f4cf135d707165f85f60206004356123e161422b565b80601155604051908152a1005b3461075357610ccb6123ff3661358b565b91613861565b60e0366003190112610753576004356001600160401b03811161075357612430903690600401613527565b61018052610100526024356001600160401b03811161075357612457903690600401613527565b60e0919091526044356001600160401b0381116107535761247c903690600401613527565b60c0526101605261248b6134dc565b6124936134eb565b9161249c6134fa565b906124a5613509565b610200526124b1613d93565b6101805115612024578061018051036120245760c051610180510361202457601154801515806128e7575b61288c575b506124ee6101805161371a565b916124fb6101805161371a565b926125086101805161371a565b6125146101805161371a565b906125216101805161371a565b9060009384905b6101805182106126c257505060005b8481106126a4575060005b84811061262657505050505061255a6101805161371a565b9460005b6101805181106125be57610b7c877f66e7e3b09cc02b8629f3bfb57a8df3ec300fcc82ac09025e4056ee07789f80e5604051806125a260c051610160518684613784565b0390a16001600855604051918291602083526020830190613557565b80612615866125d9611c9a600195610180516101005161374c565b86868b6125e9878c60e051613801565b61260989612603611c9a8260c09b969b516101605161374c565b93613770565b5196610200519661415c565b61261f828a613770565b520161255e565b6001906001600160a01b0361263b8285613770565b51166126478287613770565b51612655611cfc8488613770565b80612663575b505001612542565b6000805160206145c5833981519152918161268a606093878060a01b036012541684614121565b604051918252602082015260006040820152a18b8061265b565b6001906126bc6001600160a01b03611d6d8386613770565b01612537565b90946126d8611c9a87610180516101005161374c565b60018060a01b036126f2611c9a8960c0516101605161374c565b16156120425761270a6020611d99898c60e051613801565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa9081156107605760009161285b575b508015610716576001600160a01b03821660009081526014602052604090205460ff161580612842575b80612837575b60009015612831575061271061278f60105483613693565b04915b8b6127a18a611e5386866136c6565b5260001960005b858110612804575b5060001981036127e257506001936127d993909290916001600160a01b0316611e9d8489613770565b955b0190612528565b916127fe91506001949993611ee4611ef992611ede868d613770565b526127db565b6001600160a01b038381169061281a838b613770565b511614612829576001016127a8565b90508f6127b0565b91612792565b506010541515612777565b5033600052601360205260ff6040600020541615612771565b906020823d8211612884575b81612874602093836135ee565b81010312610c005750518d612747565b3d9150612867565b803410611ffa576012546000918291829182916001600160a01b03165af16128b26136d3565b5015611fe9576000805160206145c583398151915260606011546040519060008252600060208301526040820152a1846124e1565b5033600052601360205260ff60406000205416156124dc565b34610753576040366003190112610753577f4f2b5251c8f306eb85fdbe1289e523181135fc91cea742686337ccf264194c4b61293a61346a565b612942613518565b9061294b61422b565b60018060a01b03811660005260136020526110f18260406000206137f0565b60e03660031901126107535761297e61346a565b6024356001600160401b0381116107535761299d9036906004016134ac565b906044356001600160401b038111610753576129bd903690600401613527565b916129c66134dc565b6129ce6134eb565b6129d66134fa565b906129df613509565b926129e8613d93565b86156120245760405198630a7951fb60e11b8a52602060048b015260208a80612a15602482018d8b613639565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa998a156107605760009a612c8d575b508915610716576001600160a01b03811660008181526014602052604090205460ff161590899082612c70575b8c60009380612c65575b612c48575b83612a98916136c6565b9c60115480151580612c2f575b80612c16575b612bae575b50612ac783612acf92612ac288613fae565b613693565b3033846140d6565b82612b60575b50612ae0915061371a565b9860005b898110612b2257610b7c8b7ffaaa088e25588dbd6e83ae9fad440a4572e7e028ad331b943999846d4609cea58c8c6125a26040519283928684613784565b808b612b59828f612b53908f8f8f8f928f928f928f92908f928f9260019f611c9a91612b4d9361374c565b9261415c565b92613770565b5201612ae4565b612b7b6060926000805160206145c583398151915294613693565b601254612b939082906001600160a01b031684614121565b604051918252602082015260006040820152a18a8881612ad5565b809193503410611ffa576012546000918291829182916001600160a01b03165af1612bd76136d3565b5015611fe957612acf612ac78c80946000805160206145c5833981519152606060115460405190888252600060208301526040820152a1925050612ab0565b5033600052601360205260ff6040600020541615612aab565b5082600052601460205260ff6040600020541615612aa5565b9250612a98612710612c5c60105486613693565b04939050612a8e565b506010541515612a89565b9150503360005260136020528860ff604060002054161591612a7f565b90996020823d602011612cb9575b81612ca8602093836135ee565b81010312610c00575051988a612a52565b3d9150612c9b565b3461075357604036600319011261075357600435612cdd613496565b6001600160a01b03811691908215612042576000828152600d60205260409020600281018054909291906001600160a01b031633036107cb5760ff60058592015460081c16612d62575b505080546001600160a01b0319168317905533907f7371e69f52f4d686cd45411aa8f42c54be6f5296342d67e6e43daf1db1bc25c6600080a4005b612d6b91613df2565b508382612d27565b60e036600319011261075357612d8761346a565b6101a0526024356001600160401b03811161075357612daa9036906004016134ac565b612db2613480565b91612dbb6134dc565b612dc36134eb565b93612dcc6134fa565b612dd4613509565b612ddc613d93565b6101a051600097906001600160a01b0316801561314f576001600160a01b0385161561314057612e0e6101a051613fae565b604051630a7951fb60e11b81526020600482018190528180612e34602482018d8d613639565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa9081156106fc578a9161310e575b5080156130ff5789918a818c52601460205260ff60408d20541615806130e8575b8c6011549182151591826130d0575b826130b7575b50806130ac575b613094575b61308c575b50612ec4833033856140d6565b8361304a575b80612fad575b50509360406000805160206145a583398151915298999a829594612efa612f6695612f84996136c6565b6101e052600a546101c052612f116101c051613852565b600a55612f2e8682848d8d6101e051906101a0516101c051614369565b612f3c8d8d6101c05161441a565b612f506101e0516101a0516101c05161445d565b612f9b575b6101c0518152600e602052206137f0565b60405194859460018060a01b0316986101c051986101a05187613db5565b0390a36101c0516001600855604051908152602090f35b612fa86101c0518961423f565b612f55565b80341061303b578b8080808460018060a01b03601254165af1612fce6136d3565b501561302c579a869594612efa612f6695612f8499956000805160206145a58339815191529d9e9f60606040976000805160206145c583398151915292895191825288602083015289820152a19550955050949596509a9998612ed0565b634033e4e360e01b8c5260048cfd5b6383e05c6760e01b8c5260048cfd5b6012546130629085906001600160a01b031684614121565b6000805160206145c583398151915260608d604051908582528760208301526040820152a1612eca565b90508c612eb7565b94506127106130a560105486613693565b0494612eb2565b506010541515612ead565b3381526013602052604090205460ff161591508e612ea6565b8581526014602052604081205460ff16159250612ea0565b50338c52601360205260ff60408d20541615612e91565b63162908e360e11b8a5260048afd5b90506020813d602011613138575b81613129602093836135ee565b810103126106f057518a612e70565b3d915061311c565b631559b7d760e21b8952600489fd5b63c1ab6dc160e01b8952600489fd5b346107535760403660031901126107535761317761346a565b60243561318381613d5c565b3315158061323a575b8061320c575b6131f75781906001600160a01b0384811691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4600090815260046020526040902080546001600160a01b0319166001600160a01b03909216919091179055005b63a9fbf51f60e01b6000523360045260246000fd5b506001600160a01b038116600090815260056020908152604080832033845290915290205460ff1615613192565b506001600160a01b03811633141561318c565b346107535760203660031901126107535760043561326a81613d5c565b506000526004602052602060018060a01b0360406000205416604051908152f35b3461075357600036600319011261075357604051600080548060011c9060018116801561333c575b6020831081146114645782855290811561144057506001146132df57610b7c836113cd818503826135ee565b60008080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563939250905b808210613322575090915081016020016113cd6113bd565b91926001816020925483858801015201910190929161330a565b91607f16916132b3565b346107535760203660031901126107535760043580600052600d602052613371604060002091613c03565b9060018060a01b03905416670de0b6b3a7640000820291808304670de0b6b3a76400001490151715610793576020916108eb91600052600f8352604060002054906136a6565b34610753576020366003190112610753576004359063ffffffff60e01b8216809203610753576020916380ac58cd60e01b8114908115613411575b8115613400575b5015158152f35b6301ffc9a760e01b149050836133f9565b635b5e139f60e01b811491506133f2565b60005b8381106134355750506000910152565b8181015183820152602001613425565b9060209161345e81518092818552858086019101613422565b601f01601f1916010190565b600435906001600160a01b038216820361075357565b604435906001600160a01b038216820361075357565b602435906001600160a01b038216820361075357565b9181601f84011215610753578235916001600160401b038311610753576020808501946060850201011161075357565b60643590811515820361075357565b60843590811515820361075357565b60a43590811515820361075357565b60c43590811515820361075357565b60243590811515820361075357565b9181601f84011215610753578235916001600160401b038311610753576020808501948460051b01011161075357565b906020808351928381520192019060005b8181106135755750505090565b8251845260209384019390920191600101613568565b6060906003190112610753576004356001600160a01b038116810361075357906024356001600160a01b0381168103610753579060443590565b906001821015610fd35752565b61016081019081106001600160401b03821117610fe957604052565b601f909101601f19168101906001600160401b03821190821017610fe957604052565b6001600160401b038111610fe957601f01601f191660200190565b906004821015610fd35752565b916020908281520191906000905b8082106136545750505090565b909192833581526020840135602082015260408401359060048210156107535760608161368860019460408495019061362c565b019401920190613647565b8181029291811591840414171561079357565b81156136b0570490565b634e487b7160e01b600052601260045260246000fd5b9190820391821161079357565b3d156136fe573d906136e482613611565b916136f260405193846135ee565b82523d6000602084013e565b606090565b6001600160401b038111610fe95760051b60200190565b9061372482613703565b61373160405191826135ee565b8281528092613742601f1991613703565b0190602036910137565b919081101561077d5760051b0190565b356001600160a01b03811681036107535790565b805182101561077d5760209160051b010190565b61379b602092949394604083526040830190613557565b90828183039101528281520191906000905b8082106137ba5750505090565b91929091908335906001600160a01b0382168203610753576001600160a01b0390911681526020908101930191600101906137ad565b9060ff801983541691151516179055565b919081101561077d5760051b81013590601e19813603018212156107535701803591906001600160401b038311610753576020016060830236038113610753579190565b9190820180921161079357565b60001981146107935760010190565b9091906001600160a01b0383161561392d57600092613881338483613ea7565b6001600160a01b0381169490919085151580613925575b1561391e57848152600e60205260ff6040822054161561390f57848152600d6020526040902060020180546001600160a01b0319166001600160a01b039092169190911790555b506001600160a01b03168083036138f557505050565b6364283d7b60e01b60005260045260245260445260646000fd5b6330d4e75d60e01b8152600490fd5b50506138df565b506001613898565b633250574960e11b600052600060045260246000fd5b9291613950818386613861565b813b61395d575b50505050565b604051630a85bd0160e11b81523360048201526001600160a01b03948516602482015260448101919091526080606482015292169190602090829081906139a8906084830190613445565b03816000865af18091600091613a1f575b50906139ea57506139c86136d3565b805190816139e55782633250574960e11b60005260045260246000fd5b602001fd5b6001600160e01b03191663757a42ff60e11b01613a0b575038808080613957565b633250574960e11b60005260045260246000fd5b6020813d602011613a5a575b81613a38602093836135ee565b81010312610c035751906001600160e01b031982168203610c005750386139b9565b3d9150613a2b565b805482101561077d576000526003602060002091020190600090565b602081830312610753578051906001600160401b038211610753570181601f82011215610753578051613ab081613611565b92613abe60405194856135ee565b8184526020828401011161075357613adc9160208085019101613422565b90565b9291906040840190604085528054809252606085019060005260206000209160005b818110613b1357505060209150930152565b90916003606060019286548152838701546020820152613b3e60ff600289015416604083019061362c565b019401910192919092613b01565b600052600d602052604060002060ff600582015460101c16613bfc576020613b8d916040518093819263eaa9048560e01b8352600642910160048401613adf565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa90811561076057600091613bcd575090565b90506020813d602011613bf4575b81613be8602093836135ee565b81010312610753575190565b3d9150613bdb565b6003015490565b80600052600d602052604060002060ff600582015460101c16613d3f5760405163eaa9048560e01b815260208180613c42426006870160048401613adf565b03817f0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f676001600160a01b03165afa90811561076057600091613d0d575b506003820154808211613d05575b600081613ce6575050506000915b80600052600c6020526040600020548311613cce575b506004015480821115613cc757613adc916136c6565b5050600090565b6000908152600c602052604090205491506004613cb1565b613cff92604082876121a99452600c6020522054613693565b91613c9b565b905080613c8d565b906020823d602011613d37575b81613d27602093836135ee565b81010312610c0057505138613c7f565b3d9150613d1a565b613adc91600052600c6020526004604060002054910154906136c6565b6000818152600260205260409020546001600160a01b0316908115613d7f575090565b637e27328960e01b60005260045260246000fd5b600260085414613da4576002600855565b633ee5aeb560e01b60005260046000fd5b9491608094979693613ddc9260018060a01b0316875260a0602088015260a0870191613639565b9515156040850152151560608401521515910152565b6000828152600260205260409020546001600160a01b0316919082613e70575b6001600160a01b031680613e56575b600082815260026020526040812080546001600160a01b0319168317905583906000805160206146058339815191529080a490565b806000526003602052604060002060018154019055613e21565b600082815260046020526040902080546001600160a01b031916905582600052600360205260406000206000198154019055613e12565b6000828152600260205260409020546001600160a01b03908116931680151580613f16575b505082613e70576001600160a01b031680613e5657600082815260026020526040812080546001600160a01b0319168317905583906000805160206146058339815191529080a490565b80613f5a575b15613f275780613ecc565b905082613f435750637e27328960e01b60005260045260246000fd5b63177e802f60e01b60005260045260245260446000fd5b508084148015613f8a575b80613f1c57506000838152600460205260409020546001600160a01b03168114613f1c565b5083600052600560205260406000208160005260205260ff60406000205416613f65565b6001600160a01b03166000818152600b602052604090205480156140bc576040516370a0823160e01b8152306004820152602081602481865afa9081156107605760009161408a575b50801561406f576001820180921161079357670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561079357600181018091116107935780614055575050600052600f602052670de0b6b3a7640000604060002055565b61405e916136a6565b90600052600f602052604060002055565b5050600052600f602052670de0b6b3a7640000604060002055565b906020823d6020116140b4575b816140a4602093836135ee565b81010312610c0057505138613ff7565b3d9150614097565b50600052600f602052670de0b6b3a7640000604060002055565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815261411f9161411a6084836135ee565b61449c565b565b60405163a9059cbb60e01b60208201526001600160a01b03909216602483015260448083019390935291815261411f9161411a6064836135ee565b92959093969794919760018060a01b0384161561421a576001600160a01b03871697881561204257861561071657600a54998a9889988785888c8785876141a284613852565b600a556141b196600094614369565b6141bc838a8c61441a565b6141c790888b61445d565b6000805160206145a5833981519152986142049661420a575b9050600052600e6020526141f88460406000206137f0565b60405196879687613db5565b0390a390565b6142139161423f565b38896141e0565b63c1ab6dc160e01b60005260046000fd5b6006546001600160a01b0316330361186a57565b6001600160a01b0381161561392d5760009061425c828483613ea7565b6001600160a01b03811615159390929084806142ed575b156142e557808252600e60205260ff604083205416156142d6578152600d6020526040902060020180546001600160a01b0319166001600160a01b039092169190911790555b506142c057565b6339e3563760e11b600052600060045260246000fd5b6330d4e75d60e01b8252600482fd5b5050506142b9565b506001614273565b919081101561077d576060020190565b8054600160401b811015610fe95761432291600182018155613a62565b614353578135815560208201356001820155600201906040013560048110156107535760ff80198354169116179055565b634e487b7160e01b600052600060045260246000fd5b6000908152600d6020526040902080546001600160a01b039283166001600160a01b03199182161782556001820180543390831617905560028201805494909316931692909217905560038101919091556005810194939092916143cd90866137f0565b61ff00855491151560081b169061ff0019161784556000600485549301556001811015610fd35763ff0000009060ff60201b9060201b1692151560181b169064ffffff0000191617179055565b919091600052600d602052604060002090600660009201915b8181106144405750505050565b8061445761445160019385886142f5565b85614305565b01614433565b916144689082614513565b91600052600c6020528160406000205560018060a01b0316600052600b6020526144986040600020918254613845565b9055565b6000806144c59260018060a01b03169360208151910182865af16144be6136d3565b9083614543565b80519081151591826144ef575b50506144db5750565b635274afe760e01b60005260045260246000fd5b819250906020918101031261075357602001518015908115036107535738806144d2565b6001600160a01b03166000908152600f6020526040902054670de0b6b3a76400009161453f9190613693565b0490565b90614569575080511561455857805190602001fd5b630a12f52160e11b60005260046000fd5b8151158061459b575b61457a575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b1561457256fecfcd2ea84a9e988255710b3adc4919275a012aa72f68b63acf1e9f67296e134f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea8411698be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207735b669f2510af4e8e016c90cd472f134c9c5e0ffc51986c114f9ed556c96d264736f6c634300081b0033

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

0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f67000000000000000000000000ce77b3a862f0fdd1d53a6ef62ddd7146fb7d27eb00000000000000000000000090cf3e1fb9d1b35fad621649ca503ea13cf37163

-----Decoded View---------------
Arg [0] : _calculator (address): 0x7D6857b6303e39a532482ec89409D9bca7B06f67
Arg [1] : _svgGenerator (address): 0xCE77B3a862f0FDd1d53A6EF62DDD7146Fb7D27Eb
Arg [2] : _feeCollector (address): 0x90Cf3e1FB9D1b35Fad621649ca503Ea13cF37163

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000007d6857b6303e39a532482ec89409d9bca7b06f67
Arg [1] : 000000000000000000000000ce77b3a862f0fdd1d53a6ef62ddd7146fb7d27eb
Arg [2] : 00000000000000000000000090cf3e1fb9d1b35fad621649ca503ea13cf37163


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Vesting smart contract available for advanced token vesting, payments, streams and airdrops. The UNCX Network team has deployed this contract and it is can be used by all its users.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

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

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