ETH Price: $2,495.16 (+3.31%)
Gas: 0.12 GWei

Token

Option LYNX Token (oLYNX)

Overview

Max Total Supply

17,000,362.728061561295678641 oLYNX

Holders

14,574

Market

Price

$0.00 @ 0.000000 ETH

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
4.149491639095716555 oLYNX

Value
$0.00
0x932ce0cbcd156c624d63ec351e14efd5dcc4af1a
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
OptionTokenV3

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 34 : OptionTokenV3.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.13;

import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "../libraries/Math.sol";
import {IVotingEscrowV2} from "../VoterV5/VotingEscrow/interfaces/IVotingEscrowV2.sol";
import {IVoter} from "../interfaces/IVoter.sol";
import {IPair} from "../interfaces/IPair.sol";
import {IGauge} from "../interfaces/IGauge.sol";
import {IRouter} from "../interfaces/IRouter.sol";
import {IDynamicTwapOracle} from "./DynamicTwapOracle/IDynamicTwapOracle.sol";
import {IOptionTokenV3} from "./IOptionTokenV3.sol";
import {IOptionFeeDistributor} from "./IOptionFeeDistributor.sol";
import {IOption} from "./IOption.sol";

/// @title Option Token
/// @notice Option token representing the right to purchase the underlying token
/// at TWAP reduced rate. Similar to call options but with a variable strike
/// price that's always at a certain discount to the market price.
/// Credit to Velocimeter for the original implementation
contract OptionTokenV3 is IOptionTokenV3, ERC20, AccessControlEnumerable {
    using SafeERC20 for IERC20;

    /// -----------------------------------------------------------------------
    /// Constants
    /// -----------------------------------------------------------------------
    uint256 public constant MAX_DISCOUNT = 100; // 100%
    uint256 public constant MIN_DISCOUNT = 0; // 0%
    uint256 public constant MAX_TWAP_SECONDS = 86400; // 2 days

    /// @dev Lock set to 2 years
    uint256 public constant FULL_LOCK = 2 * 365 * 86400; // 2 years

    /// -----------------------------------------------------------------------
    /// Roles
    /// -----------------------------------------------------------------------
    /// @dev The identifier of the role which maintains other roles and settings
    bytes32 public constant override ADMIN_ROLE = keccak256("ADMIN");

    /// @dev The identifier of the role which is allowed to mint options token
    bytes32 public constant override MINTER_ROLE = keccak256("MINTER");

    /// @dev The identifier of the role which allows accounts to pause exercising options
    /// in case of emergency
    bytes32 public constant override PAUSER_ROLE = keccak256("PAUSER");

    /// -----------------------------------------------------------------------
    /// Immutable parameters
    /// -----------------------------------------------------------------------

    /// @notice The token paid by the options token holder during redemption
    IERC20 public override paymentToken;

    /// @notice The underlying token purchased during redemption
    IERC20 public immutable UNDERLYING_TOKEN;

    /// @notice The voter contract
    address public voter;

    /// -----------------------------------------------------------------------
    /// Storage variables
    /// -----------------------------------------------------------------------

    /// @notice The router for adding liquidity
    address public router; // this should not be immutable

    /// @notice The pair contract used to deposit LP option
    IPair public pair;

    /// @notice The guage contract for the pair
    address public gauge;

    /// @notice The oracle contract that provides the current TWAP price to purchase
    /// the underlying token while exercising options (the strike price)
    IDynamicTwapOracle public twapOracle;

    /// @notice The contract that receives the payment tokens when options are exercised
    IOptionFeeDistributor public feeDistributor;

    /// @notice the discount given during exercising with locking to the LP
    uint256 public maxLPDiscount = 20; //  User pays 20%
    uint256 public minLPDiscount = 80; //  User pays 80%

    /// @notice the lock duration for max discount to create locked LP
    uint256 public lockDurationForMaxLpDiscount = FULL_LOCK; // 52 weeks

    // @notice the lock duration for max discount to create locked LP
    uint256 public lockDurationForMinLpDiscount = 7 * 86400; // 1 week

    // @notice the lock duration for min discount to create locked veToken
    uint256 public lockDurationForMinVeDiscount = 2 weeks; // 2 weeks

    /// @notice the discount given during exercising. 30 = user pays 30%
    uint256 public discount = 40;

    /// @notice the max discount for locking to vote escrow
    uint256 public veMaxDiscount = 0; // User pays 0%

    /// @notice controls the duration of the twap used to calculate the strike price
    uint32 public twapSeconds = 60 * 30 * 4;

    /// @notice Is exercising options currently paused
    bool public isPaused;

    /// @notice Is minting new options currently permissioned
    bool public permissionedMint = false;

    /// @notice allows to expand options with new contracts
    mapping(address => bool) optionTokens;

    /// -----------------------------------------------------------------------
    /// Events
    /// -----------------------------------------------------------------------

    event Exercise(address indexed sender, address indexed recipient, uint256 amount, uint256 paymentAmount);
    event ExerciseVe(
        address indexed sender,
        address indexed recipient,
        uint256 amount,
        uint256 paymentAmount,
        uint256 nftId
    );
    event ExerciseLp(
        address indexed sender,
        address indexed recipient,
        uint256 amount,
        uint256 paymentAmount,
        uint256 lpAmount
    );
    event SetPairAndPaymentToken(IPair indexed newPair, address indexed newPaymentToken);
    event SetGauge(address indexed newGauge);
    event SetRouter(address indexed router);
    event SetTwapOracleAndPaymentToken(IDynamicTwapOracle indexed _twapOracle, address indexed _paymentToken);
    event SetFeeDistributor(IOptionFeeDistributor indexed newFeeDistributor);
    event SetDiscount(uint256 discount);
    event SetVeDiscount(uint256 veDiscount);
    event SetMinLPDiscount(uint256 lpMinDiscount);
    event SetMaxLPDiscount(uint256 lpMaxDiscount);
    event SetLockDurationForMaxLpDiscount(uint256 lockDurationForMaxLpDiscount);
    event SetLockDurationForMinLpDiscount(uint256 lockDurationForMinLpDiscount);
    event SetLockDurationForMinVeDiscount(uint256 lockDurationForMinVeDiscount);
    event PauseStateChanged(bool isPaused);
    event SetTwapSeconds(uint32 twapSeconds);
    event ToggleOption(address option, bool enabled);

    /// -----------------------------------------------------------------------
    /// Errors
    /// -----------------------------------------------------------------------
    error OptionToken_PastDeadline();
    error OptionToken_NoAdminRole();
    error OptionToken_NoMinterRole();
    error OptionToken_NoPauserRole();
    error OptionToken_SlippageTooHigh();
    error OptionToken_InvalidDiscount();
    error OptionToken_Paused();
    error OptionToken_InvalidTwapSeconds();
    error OptionToken_IncorrectPairToken();
    error OptionToken_InvalidLockDuration();
    error OptionToken_InvalidOption();

    /// -----------------------------------------------------------------------
    /// Modifiers
    /// -----------------------------------------------------------------------
    /// @dev A modifier which checks that the caller has the admin role.
    modifier onlyAdmin() {
        if (!hasRole(ADMIN_ROLE, msg.sender)) revert OptionToken_NoAdminRole();
        _;
    }

    /// @dev A modifier which checks that the caller has the admin or minter role.
    modifier onlyMinter() {
        if (permissionedMint && !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(MINTER_ROLE, msg.sender))
            revert OptionToken_NoMinterRole();
        _;
    }

    /// @dev A modifier which checks that the caller has the pause role.
    modifier onlyPauser() {
        if (!hasRole(PAUSER_ROLE, msg.sender)) revert OptionToken_NoPauserRole();
        _;
    }

    /// -----------------------------------------------------------------------
    /// Constructor
    /// -----------------------------------------------------------------------

    constructor(
        string memory _name,
        string memory _symbol,
        address _admin,
        ERC20 _paymentToken,
        ERC20 _underlyingToken,
        IDynamicTwapOracle _twapOracle,
        IOptionFeeDistributor _feeDistributor,
        address _voter,
        IPair _pair,
        address _router
    ) ERC20(_name, _symbol) {
        _grantRole(DEFAULT_ADMIN_ROLE, _admin);
        _grantRole(ADMIN_ROLE, _admin);
        _grantRole(PAUSER_ROLE, _admin);
        _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
        _setRoleAdmin(MINTER_ROLE, ADMIN_ROLE);
        _setRoleAdmin(PAUSER_ROLE, ADMIN_ROLE);

        paymentToken = _paymentToken;
        UNDERLYING_TOKEN = _underlyingToken;
        twapOracle = _twapOracle;
        feeDistributor = _feeDistributor;
        pair = _pair;
        router = _router;
        voter = _voter;

        paymentToken.approve(address(_feeDistributor), type(uint256).max);

        emit SetTwapOracleAndPaymentToken(_twapOracle, address(_paymentToken));
        emit SetPairAndPaymentToken(_pair, address(paymentToken));
        emit SetRouter(router);
        emit SetFeeDistributor(_feeDistributor);
        emit SetDiscount(discount);
        emit SetVeDiscount(veMaxDiscount);
        emit SetMinLPDiscount(minLPDiscount);
        emit SetMaxLPDiscount(maxLPDiscount);
    }

    /// -----------------------------------------------------------------------
    /// External functions
    /// -----------------------------------------------------------------------

    /// @notice Exercises options tokens to purchase the underlying tokens.
    /// @dev The oracle may revert if it cannot give a secure result.
    /// @param _amount The amount of options tokens to exercise
    /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection.
    /// @param _recipient The recipient of the purchased underlying tokens
    /// @return The amount paid to the fee distributor to purchase the underlying tokens
    function exercise(uint256 _amount, uint256 _maxPaymentAmount, address _recipient) external returns (uint256) {
        return _exercise(_amount, _maxPaymentAmount, _recipient);
    }

    /// @notice Exercises options tokens to purchase the underlying tokens.
    /// @dev The oracle may revert if it cannot give a secure result.
    /// @param _amount The amount of options tokens to exercise
    /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection.
    /// @param _recipient The recipient of the purchased underlying tokens
    /// @param _deadline The Unix timestamp (in seconds) after which the call will revert
    /// @return The amount paid to the fee distributor to purchase the underlying tokens
    function exercise(
        uint256 _amount,
        uint256 _maxPaymentAmount,
        address _recipient,
        uint256 _deadline
    ) external returns (uint256) {
        if (block.timestamp > _deadline) revert OptionToken_PastDeadline();
        return _exercise(_amount, _maxPaymentAmount, _recipient);
    }

    /// @notice Exercises options tokens to purchase the underlying tokens.
    /// @dev The oracle may revert if it cannot give a secure result.
    /// @param _amount The amount of options tokens to exercise
    /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection.
    /// @param _recipient The recipient of the purchased underlying tokens
    /// @param _deadline The Unix timestamp (in seconds) after which the call will revert
    /// @return The amount paid to the fee distributor to purchase the underlying tokens
    function exerciseVe(
        uint256 _amount,
        uint256 _maxPaymentAmount,
        address _recipient,
        uint256 _discount,
        uint256 _deadline
    ) external returns (uint256, uint256) {
        if (block.timestamp > _deadline) revert OptionToken_PastDeadline();
        return _exerciseVe(_amount, _maxPaymentAmount, _discount, _recipient);
    }

    /// @notice Exercises options tokens to create LP and stake in gauges with lock.
    /// @dev The oracle may revert if it cannot give a secure result.
    /// @param _amount The amount of options tokens to exercise
    /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection.
    /// @param _discount The desired discount
    /// @param _deadline The Unix timestamp (in seconds) after which the call will revert
    /// @return The amount paid to the treasury to purchase the underlying tokens

    function exerciseLp(
        uint256 _amount,
        uint256 _maxPaymentAmount,
        uint256 _maxLPAmount,
        address _recipient,
        uint256 _discount,
        uint256 _deadline
    ) external returns (uint256, uint256) {
        if (block.timestamp > _deadline) revert OptionToken_PastDeadline();
        return _exerciseLp(_amount, _maxPaymentAmount, _maxLPAmount, _recipient, _discount);
    }

    function exerciseExternal(
        IOption _option,
        uint256 _amount,
        uint256 _deadline,
        bytes calldata _data
    ) external returns (uint256) {
        if (!optionTokens[address(_option)]) revert OptionToken_InvalidOption();
        if (block.timestamp > _deadline) revert OptionToken_PastDeadline();
        uint256 paymentAmount = _option.getPaymentAmount(_amount, _data);
        _burn(msg.sender, _amount);
        _option.paymentToken().safeTransferFrom(msg.sender, address(_option), paymentAmount);
        UNDERLYING_TOKEN.safeTransfer(address(_option), _amount);
        return _option.exercise(_amount, msg.sender, _data);
    }

    /// -----------------------------------------------------------------------
    /// Public functions
    /// -----------------------------------------------------------------------

    function getVotingEscrow() external view returns (address votingEscrow) {
        votingEscrow = IVoter(voter).ve();
    }

    /// @notice Returns the discounted price in paymentTokens for a given amount of options tokens
    /// @param _amount The amount of options tokens to exercise
    /// @return The amount of payment tokens to pay to purchase the underlying tokens
    function getDiscountedPrice(uint256 _amount) public view returns (uint256) {
        return getDiscountedPrice(_amount, discount);
    }

    /// @notice Returns the discounted price in paymentTokens for a given amount of options tokens redeemed to veToken
    /// @param _amount The amount of options tokens to exercise
    /// @param _discount The discount amount
    /// @return The amount of payment tokens to pay to purchase the underlying tokens
    function getDiscountedPrice(uint256 _amount, uint256 _discount) public view returns (uint256) {
        return (getTimeWeightedAveragePrice(_amount) * _discount) / 100;
    }

    /// @notice Returns the average price in payment tokens over period defined in twapSeconds for an amount of tokens
    /// @param _amount The amount of underlying tokens to purchase
    /// @return The amount of payment tokens
    function getTimeWeightedAveragePrice(uint256 _amount) public view returns (uint256) {
        return twapOracle.estimateAmountOut(address(UNDERLYING_TOKEN), uint128(_amount), twapSeconds);
    }

    /// @notice Returns the lock duration for a desired discount to create locked LP
    function getLockDurationForLpDiscount(uint256 _discount) public view returns (uint256 duration) {
        (int256 slope, int256 intercept) = getSlopeInterceptForLpDiscount();
        duration = Math.abs(slope * int256(_discount) + intercept);
    }

    /// @notice Returns the lock duration for a desired discount to create locked VE
    function getLockDurationForVeDiscount(uint256 _discount) public view returns (uint256 duration) {
        (int256 slope, int256 intercept) = getSlopeInterceptForVeDiscount();
        duration = Math.abs(slope * int256(_discount) + intercept);
    }

    /// @notice Returns the amount in paymentTokens for a given amount of options tokens required for the LP exercise lp
    /// @param _amount The amount of options tokens to exercise
    /// @param _discount The discount amount
    function getPaymentTokenAmountForExerciseLp(
        uint256 _amount,
        uint256 _discount
    ) public view returns (uint256 paymentAmount, uint256 paymentAmountToAddLiquidity) {
        paymentAmount = getDiscountedPrice(_amount, _discount);
        (uint256 underlyingReserve, uint256 paymentReserve) = IRouter(router).getReserves(
            address(UNDERLYING_TOKEN),
            address(paymentToken),
            false
        );
        paymentAmountToAddLiquidity = (_amount * paymentReserve) / underlyingReserve;
    }

    function getSlopeInterceptForLpDiscount() public view returns (int256 slope, int256 intercept) {
        slope =
            int256(lockDurationForMaxLpDiscount - lockDurationForMinLpDiscount) /
            (int256(maxLPDiscount) - int256(minLPDiscount));
        intercept = int256(lockDurationForMinLpDiscount) - (slope * int256(minLPDiscount));
    }

    function getSlopeInterceptForVeDiscount() public view returns (int256 slope, int256 intercept) {
        slope = int256(FULL_LOCK - lockDurationForMinVeDiscount) / (int256(veMaxDiscount) - int256(discount));
        intercept = int256(lockDurationForMinVeDiscount) - (slope * int256(discount));
    }

    /// -----------------------------------------------------------------------
    /// Admin functions
    /// -----------------------------------------------------------------------

    /// @notice Sets the twap oracle contract address.
    /// @param _twapOracle The new twap oracle contract address
    function setTwapOracleAndPaymentToken(IDynamicTwapOracle _twapOracle, address _paymentToken) external onlyAdmin {
        if (
            !((_twapOracle.token0() == _paymentToken && _twapOracle.token1() == address(UNDERLYING_TOKEN)) ||
                (_twapOracle.token0() == address(UNDERLYING_TOKEN) && _twapOracle.token1() == _paymentToken))
        ) revert OptionToken_IncorrectPairToken();
        twapOracle = _twapOracle;
        paymentToken = ERC20(_paymentToken);
        paymentToken.approve(address(feeDistributor), type(uint256).max);
        emit SetTwapOracleAndPaymentToken(_twapOracle, _paymentToken);
    }

    /// @notice Sets the fee distributor. Only callable by the admin.
    /// @param _feeDistributor The new fee distributor.
    function setFeeDistributor(IOptionFeeDistributor _feeDistributor) external onlyAdmin {
        paymentToken.approve(address(feeDistributor), 0);
        feeDistributor = _feeDistributor;
        paymentToken.approve(address(_feeDistributor), type(uint256).max);
        emit SetFeeDistributor(_feeDistributor);
    }

    /// @notice Sets the discount amount. Only callable by the admin.
    /// @param _discount The new discount amount.
    function setDiscount(uint256 _discount) external onlyAdmin {
        if (_discount > MAX_DISCOUNT || _discount == MIN_DISCOUNT) revert OptionToken_InvalidDiscount();
        discount = _discount;
        emit SetDiscount(_discount);
    }

    /// @notice Sets the further discount amount for locking. Only callable by the admin.
    /// @param _veDiscount The new discount amount.
    function setVeDiscount(uint256 _veDiscount) external onlyAdmin {
        if (_veDiscount > MAX_DISCOUNT || _veDiscount == MIN_DISCOUNT) revert OptionToken_InvalidDiscount();
        veMaxDiscount = _veDiscount;
        emit SetVeDiscount(_veDiscount);
    }

    /// @notice Sets the twap seconds to control the length of our twap
    /// @param _twapSeconds The new twap points.
    function setTwapSeconds(uint32 _twapSeconds) external onlyAdmin {
        if (_twapSeconds > MAX_TWAP_SECONDS || _twapSeconds == 0) revert OptionToken_InvalidTwapSeconds();
        twapSeconds = _twapSeconds;
        emit SetTwapSeconds(_twapSeconds);
    }

    /// @notice Sets the pair contract. Only callable by the admin.
    /// @param _pair The new pair contract
    function setPairAndPaymentToken(IPair _pair, address _paymentToken) external onlyAdmin {
        (address token0, address token1) = _pair.tokens();
        if (
            !((token0 == _paymentToken && token1 == address(UNDERLYING_TOKEN)) ||
                (token0 == address(UNDERLYING_TOKEN) && token1 == _paymentToken))
        ) revert OptionToken_IncorrectPairToken();
        pair = _pair;
        gauge = IVoter(voter).gauges(address(_pair));
        paymentToken = IERC20(_paymentToken);
        emit SetPairAndPaymentToken(_pair, _paymentToken);
    }

    /// @notice Update gauge address to match with Voter contract
    function updateGauge() external {
        address newGauge = IVoter(voter).gauges(address(pair));
        gauge = newGauge;
        emit SetGauge(newGauge);
    }

    /// @notice Sets the gauge address when the gauge is not listed in Voter. Only callable by the admin.
    /// @param _gauge The new treasury address
    function setGauge(address _gauge) external onlyAdmin {
        gauge = _gauge;
        emit SetGauge(_gauge);
    }

    /// @notice Sets the router address. Only callable by the admin.
    /// @param _router The new router address
    function setRouter(address _router) external onlyAdmin {
        router = _router;
        emit SetRouter(_router);
    }

    /// @notice Sets the discount amount for lp. Only callable by the admin.
    /// @param _lpMinDiscount The new discount amount.
    function setMinLPDiscount(uint256 _lpMinDiscount) external onlyAdmin {
        /// @dev Cannot be lower than MIN_DISCOUNT or gte maxLPDiscount
        if (_lpMinDiscount > MAX_DISCOUNT || _lpMinDiscount == MIN_DISCOUNT || maxLPDiscount > _lpMinDiscount)
            revert OptionToken_InvalidDiscount();
        minLPDiscount = _lpMinDiscount;
        emit SetMinLPDiscount(_lpMinDiscount);
    }

    /// @notice Sets the discount amount for lp. Only callable by the admin.
    /// @param _lpMaxDiscount The new discount amount.
    function setMaxLPDiscount(uint256 _lpMaxDiscount) external onlyAdmin {
        /// @dev Cannot be higher than MAX_DISCOUNT or lte minLPDiscount
        if (_lpMaxDiscount > MAX_DISCOUNT || _lpMaxDiscount == MIN_DISCOUNT || _lpMaxDiscount > minLPDiscount)
            revert OptionToken_InvalidDiscount();
        maxLPDiscount = _lpMaxDiscount;
        emit SetMaxLPDiscount(_lpMaxDiscount);
    }

    /// @notice Sets the lock duration for max discount amount to create LP and stake in gauge.
    /// @param _duration The new lock duration.
    function setLockDurationForMaxLpDiscount(uint256 _duration) external onlyAdmin {
        if (_duration <= lockDurationForMinLpDiscount) revert OptionToken_InvalidLockDuration();
        lockDurationForMaxLpDiscount = _duration;
        emit SetLockDurationForMaxLpDiscount(_duration);
    }

    /// @notice Sets the lock duration for min discount amount for locked veToken.
    /// @param _duration The new lock duration.
    function setLockDurationForMinVeDiscount(uint256 _duration) external onlyAdmin {
        if (_duration > lockDurationForMinVeDiscount) revert OptionToken_InvalidLockDuration();
        lockDurationForMinVeDiscount = _duration;
        emit SetLockDurationForMaxLpDiscount(_duration);
    }

    // @notice Sets the lock duration for min discount amount to create LP and stake in gauge.
    /// @param _duration The new lock duration.
    function setLockDurationForMinLpDiscount(uint256 _duration) external onlyAdmin {
        if (_duration > lockDurationForMaxLpDiscount) revert OptionToken_InvalidLockDuration();
        lockDurationForMinLpDiscount = _duration;
        emit SetLockDurationForMinLpDiscount(_duration);
    }

    /// @notice Called by the admin to burn options tokens and transfer underlying tokens to the caller.
    /// @param _amount The amount of options tokens that will be burned and underlying tokens transferred to the caller
    function burn(uint256 _amount) external onlyAdmin {
        // transfer underlying tokens to the caller
        UNDERLYING_TOKEN.safeTransfer(msg.sender, _amount);
        // burn option tokens
        _burn(msg.sender, _amount);
    }

    /// @notice called by the admin to re-enable option exercising from a paused state.
    function unPause() external onlyAdmin {
        if (!isPaused) return;
        isPaused = false;
        emit PauseStateChanged(false);
    }

    /// @notice called by the admin to re-enable option exercising from a paused state.
    function togglePermissionedMint() external onlyAdmin {
        permissionedMint = !permissionedMint;
    }

    function toggleOption(address option, bool enabled) external onlyAdmin {
        optionTokens[option] = enabled;
        emit ToggleOption(option, enabled);
    }

    /// -----------------------------------------------------------------------
    /// Minter functions
    /// -----------------------------------------------------------------------

    /// @notice Called by the minter to mint options tokens. Admin must grant token approval.
    /// @param _to The address that will receive the minted options tokens
    /// @param _amount The amount of options tokens that will be minted
    function mint(address _to, uint256 _amount) external onlyMinter {
        // transfer underlying tokens from the caller
        UNDERLYING_TOKEN.safeTransferFrom(msg.sender, address(this), _amount);
        // mint options tokens
        _mint(_to, _amount);
    }

    /// -----------------------------------------------------------------------
    /// Pauser functions
    /// -----------------------------------------------------------------------
    function pause() external onlyPauser {
        if (isPaused) return;
        isPaused = true;
        emit PauseStateChanged(true);
    }

    /// -----------------------------------------------------------------------
    /// Internal functions
    /// -----------------------------------------------------------------------

    function _exercise(
        uint256 _amount,
        uint256 _maxPaymentAmount,
        address _recipient
    ) internal returns (uint256 paymentAmount) {
        if (isPaused) revert OptionToken_Paused();

        // burn callers tokens
        _burn(msg.sender, _amount);
        paymentAmount = getDiscountedPrice(_amount);
        if (paymentAmount > _maxPaymentAmount) revert OptionToken_SlippageTooHigh();

        // transfer payment tokens from msg.sender to the fee distributor
        paymentToken.safeTransferFrom(msg.sender, address(this), paymentAmount);
        feeDistributor.distribute(address(paymentToken), paymentAmount);

        // send underlying tokens to recipient
        UNDERLYING_TOKEN.safeTransfer(_recipient, _amount); // will revert on failure

        emit Exercise(msg.sender, _recipient, _amount, paymentAmount);
    }

    function _exerciseVe(
        uint256 _amount,
        uint256 _maxPaymentAmount,
        uint256 _discount,
        address _recipient
    ) internal returns (uint256 paymentAmount, uint256 nftId) {
        if (isPaused) revert OptionToken_Paused();
        if (_discount > discount || _discount < veMaxDiscount) revert OptionToken_InvalidDiscount();


        // burn callers tokens
        _burn(msg.sender, _amount);
        paymentAmount = getDiscountedPrice(_amount, _discount);
        if (paymentAmount > _maxPaymentAmount) revert OptionToken_SlippageTooHigh();

        // transfer payment tokens from msg.sender to the fee distributor
        paymentToken.safeTransferFrom(msg.sender, address(this), paymentAmount);
        feeDistributor.distribute(address(paymentToken), paymentAmount);

        address votingEscrow = IVoter(voter).ve();

        // lock underlying tokens to vote escrow
        UNDERLYING_TOKEN.approve(votingEscrow, _amount);
        nftId = IVotingEscrowV2(votingEscrow).createLockFor(
            _amount,
            getLockDurationForVeDiscount(_discount),
            _recipient,
            false
        );

        emit ExerciseVe(msg.sender, _recipient, _amount, paymentAmount, nftId);
    }

    function _exerciseLp(
        uint256 _amount, // the oTOKEN amount the user wants to redeem with
        uint256 _maxPaymentAmount, // the
        uint256 _maxLPAmount, // the
        address _recipient,
        uint256 _discount
    ) internal returns (uint256 paymentAmount, uint256 lpAmount) {
        if (isPaused) revert OptionToken_Paused();
        if (_discount > minLPDiscount || _discount < maxLPDiscount) revert OptionToken_InvalidDiscount();

        // burn callers tokens
        _burn(msg.sender, _amount);
        (uint256 paymentAmounts, uint256 paymentAmountToAddLiquidity) = getPaymentTokenAmountForExerciseLp(
            _amount,
            _discount
        );
        paymentAmount = paymentAmounts;

        if (paymentAmount > _maxPaymentAmount || paymentAmountToAddLiquidity > _maxLPAmount) revert OptionToken_SlippageTooHigh();

        /// @notice user pays redeem amount + required payment for LP deposit
        paymentToken.safeTransferFrom(msg.sender, address(this), paymentAmount + paymentAmountToAddLiquidity);

        // transfer payment tokens to the fee distributor
        feeDistributor.distribute(address(paymentToken), paymentAmount);

        // Create Lp for users
        UNDERLYING_TOKEN.approve(router, _amount);
        paymentToken.approve(router, paymentAmountToAddLiquidity);
        (, , lpAmount) = IRouter(router).addLiquidity(
            address(UNDERLYING_TOKEN),
            address(paymentToken),
            false,
            _amount,
            paymentAmountToAddLiquidity,
            1,
            1,
            address(this),
            block.timestamp
        );

        IERC20(address(pair)).approve(gauge, lpAmount);

        IGauge(gauge).depositWithLock(_recipient, lpAmount, getLockDurationForLpDiscount(_discount));

        emit ExerciseLp(msg.sender, _recipient, _amount, paymentAmount, lpAmount);
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 34 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

File 4 of 34 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 5 of 34 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 6 of 34 : IVotes.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 *
 * _Available since v4.5._
 */
interface IVotes {
    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     */
    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}

File 7 of 34 : IERC5805.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)

pragma solidity ^0.8.0;

import "../governance/utils/IVotes.sol";
import "./IERC6372.sol";

interface IERC5805 is IERC6372, IVotes {}

File 8 of 34 : IERC6372.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)

pragma solidity ^0.8.0;

interface IERC6372 {
    /**
     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
     */
    function clock() external view returns (uint48);

    /**
     * @dev Description of the clock
     */
    // solhint-disable-next-line func-name-mixedcase
    function CLOCK_MODE() external view returns (string memory);
}

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

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 10 of 34 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 11 of 34 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== 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);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 13 of 34 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. 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.encodeWithSelector(token.approve.selector, spender, value);

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 17 of 34 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 23 of 34 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 24 of 34 : IGauge.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IGauge {
    function notifyRewardAmount(address token, uint amount) external;

    function getReward(address account, address[] memory tokens) external;

    function getReward(address account) external;

    function claimFees() external returns (uint claimed0, uint claimed1);

    function rewardRate(address _pair) external view returns (uint);

    function balanceOf(address _account) external view returns (uint);

    function isForPair() external view returns (bool);

    function totalSupply() external view returns (uint);

    function earned(address token, address account) external view returns (uint);

    function stakeToken() external view returns (address);

    function setDistribution(address _distro) external;

    function addRewardToken(address _rewardToken) external;

    function updateRewardToken() external;

    function activateEmergencyMode() external;

    function stopEmergencyMode() external;

    function setInternalBribe(address intbribe) external;

    function setGaugeRewarder(address _gr) external;

    function setFeeVault(address _feeVault) external;

    function depositWithLock(address account, uint256 amount, uint256 _lockDuration) external;
}

File 25 of 34 : IPair.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IPair {
    function metadata() external view returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);
    function claimFees() external returns (uint, uint);
    function tokens() external view returns (address, address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function transferFrom(address src, address dst, uint amount) external returns (bool);
    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function burn(address to) external returns (uint amount0, uint amount1);
    function mint(address to) external returns (uint liquidity);
    function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);
    function getAmountOut(uint, address) external view returns (uint);

    function name() external view returns(string memory);
    function symbol() external view returns(string memory);
    function totalSupply() external view returns (uint);
    function decimals() external view returns (uint8);

    function claimable0(address _user) external view returns (uint);
    function claimable1(address _user) external view returns (uint);

    function isStable() external view returns(bool);


}

File 26 of 34 : IRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IRouter {
    function pairFor(address tokenA, address tokenB, bool stable) external view returns (address pair);
    function addLiquidity(address tokenA,address tokenB,bool stable,uint amountADesired,uint amountBDesired,uint amountAMin,uint amountBMin,address to,uint deadline) external returns (uint amountA, uint amountB, uint liquidity);
    function getReserves(address tokenA, address tokenB, bool stable) external view returns (uint reserveA, uint reserveB);
}

File 27 of 34 : IVoter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVoter {
    function ve() external view returns (address);
    function gauges(address _pair) external view returns (address);
    function isGauge(address _gauge) external view returns (bool);
    function poolForGauge(address _gauge) external view returns (address);
    function factory() external view returns (address);
    function minter() external view returns(address);
    function isWhitelisted(address token) external view returns (bool);
    function notifyRewardAmount(uint amount) external;
    function distributeAll() external;
    function distributeFees(address[] memory _gauges) external;

    function internal_bribes(address _gauge) external view returns (address);
    function external_bribes(address _gauge) external view returns (address);

    function usedWeights(uint id) external view returns(uint);
    function lastVoted(uint id) external view returns(uint);
    function poolVote(uint id, uint _index) external view returns(address _pair);
    function votes(uint id, address _pool) external view returns(uint votes);
    function poolVoteLength(uint tokenId) external view returns(uint);
    
    function attachTokenToGauge(uint _tokenId, address account) external;
    function detachTokenFromGauge(uint _tokenId, address account) external;
}

File 28 of 34 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

library Math {
    function max(uint a, uint b) internal pure returns (uint) {
        return a >= b ? a : b;
    }
    function min(uint a, uint b) internal pure returns (uint) {
        return a < b ? a : b;
    }
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
    function cbrt(uint256 n) internal pure returns (uint256) { unchecked {
        uint256 x = 0;
        for (uint256 y = 1 << 255; y > 0; y >>= 3) {
            x <<= 1;
            uint256 z = 3 * x * (x + 1) + 1;
            if (n / y >= z) {
                n -= y * z;
                x += 1;
            }
        }
        return x;
    }}
    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'Math: Sub-underflow');
    }
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 29 of 34 : IDynamicTwapOracle.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.7.0;

interface IDynamicTwapOracle {
    /**
     * @notice Get the address of the pool
     * @return The address of the pool
     */
    function pool() external view returns (address);

    /**
     * @notice Get the address of the first token in the pool
     * @return The address of the first token
     */
    function token0() external view returns (address);
    
    /**
     * @notice Get the address of the second token in the pool
     * @return The address of the second token
     */
    function token1() external view returns (address);

    /**
     * @notice Estimate the output amount of a trade
     * @param tokenIn The address of the input token
     * @param amountIn The amount of the input token
     * @param secondsAgo The number of seconds ago to start the TWAP
     * @return amountOut The estimated output amount
     */
    function estimateAmountOut(
        address tokenIn,
        uint128 amountIn,
        uint32 secondsAgo
    ) external view returns (uint amountOut);
}

File 30 of 34 : IOption.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";

interface IOption is IAccessControl {
    function paymentToken() external view returns (IERC20);

    function getPaymentAmount(uint256 _amount, bytes calldata _data) external view returns (uint256);

    function exercise(uint256 _amount, address sender, bytes calldata _data) external returns (uint256);
}

File 31 of 34 : IOptionFeeDistributor.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

interface IOptionFeeDistributor {
    function distribute(address token, uint256 amount) external;
}

File 32 of 34 : IOptionTokenV3.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {IDynamicTwapOracle} from "./DynamicTwapOracle/IDynamicTwapOracle.sol";
import {IOptionFeeDistributor} from "./IOptionFeeDistributor.sol";
import {IPair} from "../interfaces/IPair.sol";

interface IOptionTokenV3 is IERC20, IAccessControl {
    function ADMIN_ROLE() external view returns (bytes32);

    function MINTER_ROLE() external view returns (bytes32);

    function PAUSER_ROLE() external view returns (bytes32);

    function paymentToken() external view returns (IERC20);

    function UNDERLYING_TOKEN() external view returns (IERC20);

    function voter() external view returns (address);

    function mint(address _to, uint256 _amount) external;

    function getDiscountedPrice(uint256 _amount) external view returns (uint256);

    function getDiscountedPrice(uint256 _amount, uint256 _discount) external view returns (uint256);

    function getLockDurationForLpDiscount(uint256 _amount) external view returns (uint256);

    function getPaymentTokenAmountForExerciseLp(
        uint256 _amount,
        uint256 _discount
    ) external view returns (uint256, uint256);

    function getSlopeInterceptForLpDiscount() external view returns (int256, int256);

    function getTimeWeightedAveragePrice(uint256 _amount) external view returns (uint256);

    function setTwapOracleAndPaymentToken(IDynamicTwapOracle _twapOracle, address _paymentToken) external;

    function setPairAndPaymentToken(IPair _pair, address _paymentToken) external;

    function setFeeDistributor(IOptionFeeDistributor _feeDistributor) external;

    function setDiscount(uint256 _discount) external;

    function setVeDiscount(uint256 _veDiscount) external;

    function setMinLPDiscount(uint256 _lpMinDiscount) external;

    function setMaxLPDiscount(uint256 _lpMaxDiscount) external;

    function setLockDurationForMaxLpDiscount(uint256 _duration) external;

    function setLockDurationForMinLpDiscount(uint256 _duration) external;

    function setTwapSeconds(uint32 _twapSeconds) external;

    function burn(uint256 _amount) external;

    function updateGauge() external;

    function setGauge(address _gauge) external;

    function setRouter(address _router) external;

    function unPause() external;

    function pause() external;
}

File 33 of 34 : IVotingEscrowV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import {IERC5805} from "@openzeppelin/contracts/interfaces/IERC5805.sol";
import {Checkpoints} from "../libraries/Checkpoints.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface IVotingEscrowV2 is IERC5805, IERC721Enumerable {
    struct LockDetails {
        uint256 amount; /// @dev amount of tokens locked
        uint256 startTime; /// @dev when locking started
        uint256 endTime; /// @dev when locking ends
        bool isPermanent; /// @dev if its a permanent lock
    }

    /// -----------------------------------------------------------------------
    /// Events
    /// -----------------------------------------------------------------------

    event SupplyUpdated(uint256 oldSupply, uint256 newSupply);
    /// @notice Lock events
    event LockCreated(uint256 indexed tokenId, address indexed to, uint256 value, uint256 unlockTime, bool isPermanent);
    event LockUpdated(uint256 indexed tokenId, uint256 value, uint256 unlockTime, bool isPermanent);
    event LockMerged(
        uint256 indexed fromTokenId,
        uint256 indexed toTokenId,
        uint256 totalValue,
        uint256 unlockTime,
        bool isPermanent
    );
    event LockSplit(uint256[] splitWeights, uint256 indexed _tokenId);
    event LockDurationExtended(uint256 indexed tokenId, uint256 newUnlockTime, bool isPermanent);
    event LockAmountIncreased(uint256 indexed tokenId, uint256 value);
    event UnlockPermanent(uint256 indexed tokenId, address indexed sender, uint256 unlockTime);
    /// @notice Delegate events
    event LockDelegateChanged(
        uint256 indexed tokenId,
        address indexed delegator,
        address fromDelegate,
        address indexed toDelegate
    );

    /// -----------------------------------------------------------------------
    /// Errors
    /// -----------------------------------------------------------------------

    error AlreadyVoted();
    error InvalidNonce();
    error InvalidDelegatee();
    error InvalidSignature();
    error InvalidSignatureS();
    error LockDurationNotInFuture();
    error LockDurationTooLong();
    error LockExpired();
    error LockNotExpired();
    error NoLockFound();
    error NotPermanentLock();
    error PermanentLock();
    error SameNFT();
    error SignatureExpired();
    error ZeroAmount();

    function supply() external view returns (uint);

    function token() external view returns (IERC20);

    function balanceOfNFT(uint256 _tokenId) external view returns (uint256);
    function balanceOfNFTAt(uint256 _tokenId, uint256 _timestamp) external view returns (uint256);

    function delegates(uint256 tokenId, uint48 timestamp) external view returns (address);

    function lockDetails(uint256 tokenId) external view returns (LockDetails calldata);

    function isApprovedOrOwner(address user, uint tokenId) external view returns (bool);

    function getPastEscrowPoint(
        uint256 _tokenId,
        uint256 _timePoint
    ) external view returns (Checkpoints.Point memory, uint48);

    function getFirstEscrowPoint(uint256 _tokenId) external view returns (Checkpoints.Point memory, uint48);

    function checkpoint() external;

    function increaseAmount(uint256 _tokenId, uint256 _value) external;

    function createLockFor(uint256 _value, uint256 _lockDuration, address _to, bool _permanent) external returns (uint256);
    function decimals() external view returns(uint8);
}

File 34 of 34 : Checkpoints.sol
// SPDX-License-Identifier: MIT
// This file was derived from OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/Checkpoints.sol)

pragma solidity 0.8.13;

import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

/**
 * @dev This library defines the `Trace*` struct, for checkpointing values as they change at different points in
 * time, and later looking up past values by block number. See {Votes} as an example.
 *
 * To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new
 * checkpoint for the current transaction block using the {push} function.
 */
library Checkpoints {
    struct Trace {
        Checkpoint[] _checkpoints;
    }

    /**
     * @dev Struct to keep track of the voting power over time.
     */
    struct Point {
        /// @dev The voting power at a specific time
        /// - MUST never be negative.
        int128 bias;
        /// @dev The rate at which the voting power decreases over time.
        int128 slope;
        /// @dev The value of tokens which do not decrease over time, representing permanent voting power
        /// - MUST never be negative.
        int128 permanent;
    }

    struct Checkpoint {
        uint48 _key;
        Point _value;
    }

    /**
     * @dev A value was attempted to be inserted on a past checkpoint.
     */
    error CheckpointUnorderedInsertions();

    /**
     * @dev Pushes a (`key`, `value`) pair into a Trace so that it is stored as the checkpoint.
     *
     * Returns previous value and new value.
     *
     * IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
     * library.
     */
    function push(Trace storage self, uint48 key, Point memory value) internal returns (Point memory, Point memory) {
        return _insert(self._checkpoints, key, value);
    }

    /**
     * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
     * there is none.
     */
    function lowerLookup(Trace storage self, uint48 key) internal view returns (Point memory) {
        uint256 len = self._checkpoints.length;
        uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);
        return pos == len ? blankPoint() : _unsafeAccess(self._checkpoints, pos)._value;
    }

    /**
     * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
     * if there is none.
     */
    function upperLookup(
        Trace storage self,
        uint48 key
    ) internal view returns (bool exists, uint48 _key, Point memory _value) {
        uint256 len = self._checkpoints.length;
        uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);

        exists = pos != 0;
        _value = exists ? _unsafeAccess(self._checkpoints, pos - 1)._value : blankPoint();
        _key = exists ? _unsafeAccess(self._checkpoints, pos - 1)._key : 0;
    }

    /**
     * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
     * if there is none.
     *
     * NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
     * keys).
     */
    function upperLookupRecent(
        Trace storage self,
        uint48 key
    ) internal view returns (bool exists, uint48 _key, Point memory _value) {
        uint256 len = self._checkpoints.length;

        uint256 low = 0;
        uint256 high = len;

        if (len > 5) {
            uint256 mid = len - Math.sqrt(len);
            if (key < _unsafeAccess(self._checkpoints, mid)._key) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);

        exists = pos != 0;
        _value = exists ? _unsafeAccess(self._checkpoints, pos - 1)._value : blankPoint();
        _key = exists ? _unsafeAccess(self._checkpoints, pos - 1)._key : 0;
    }

    /**
     * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
     */
    function latest(Trace storage self) internal view returns (Point memory) {
        uint256 pos = self._checkpoints.length;
        return pos == 0 ? blankPoint() : _unsafeAccess(self._checkpoints, pos - 1)._value;
    }

    /**
     * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
     * in the most recent checkpoint.
     */
    function latestCheckpoint(
        Trace storage self
    ) internal view returns (bool exists, uint48 _key, Point memory _value) {
        uint256 pos = self._checkpoints.length;
        if (pos == 0) {
            return (false, 0, blankPoint());
        } else {
            Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);
            return (true, ckpt._key, ckpt._value);
        }
    }

    /**
     * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
     * in the most recent checkpoint.
     */
    function firstCheckpoint(
        Trace storage self
    ) internal view returns (bool exists, uint48 _key, Point memory _value) {
        uint256 pos = self._checkpoints.length;
        if (pos == 0) {
            return (false, 0, blankPoint());
        } else {
            Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, 0);
            return (true, ckpt._key, ckpt._value);
        }
    }

    /**
     * @dev Returns the number of checkpoint.
     */
    function length(Trace storage self) internal view returns (uint256) {
        return self._checkpoints.length;
    }

    /**
     * @dev Returns checkpoint at given position.
     */
    function at(Trace storage self, uint48 pos) internal view returns (Checkpoint memory) {
        return self._checkpoints[pos];
    }

    /**
     * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,
     * or by updating the last one.
     */
    function _insert(
        Checkpoint[] storage self,
        uint48 key,
        Point memory value
    ) private returns (Point memory, Point memory) {
        uint256 pos = self.length;

        if (pos > 0) {
            // Copying to memory is important here.
            Checkpoint memory last = _unsafeAccess(self, pos - 1);

            // Checkpoint keys must be non-decreasing.
            if (last._key > key) {
                revert CheckpointUnorderedInsertions();
            }

            // Update or push new checkpoint
            if (last._key == key) {
                _unsafeAccess(self, pos - 1)._value = value;
            } else {
                self.push(Checkpoint({_key: key, _value: value}));
            }
            return (last._value, value);
        } else {
            self.push(Checkpoint({_key: key, _value: value}));
            return (blankPoint(), value);
        }
    }

    /**
     * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high`
     * if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
     * `high`.
     *
     * WARNING: `high` should not be greater than the array's length.
     */
    function _upperBinaryLookup(
        Checkpoint[] storage self,
        uint48 key,
        uint256 low,
        uint256 high
    ) private view returns (uint256) {
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (_unsafeAccess(self, mid)._key > key) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return high;
    }

    /**
     * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or
     * `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and
     * exclusive `high`.
     *
     * WARNING: `high` should not be greater than the array's length.
     */
    function _lowerBinaryLookup(
        Checkpoint[] storage self,
        uint48 key,
        uint256 low,
        uint256 high
    ) private view returns (uint256) {
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (_unsafeAccess(self, mid)._key < key) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return high;
    }

    /**
     * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
     */
    function _unsafeAccess(Checkpoint[] storage self, uint256 pos) private view returns (Checkpoint storage result) {
        return self[pos];
    }

    /**
     * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
     */
    function _realUnsafeAccess(
        Checkpoint[] storage self,
        uint256 pos
    ) private pure returns (Checkpoint storage result) {
        assembly {
            mstore(0, self.slot)
            result.slot := add(keccak256(0, 0x20), pos)
        }
    }

    function blankPoint() internal pure returns (Point memory) {
        return Point({bias: 0, slope: 0, permanent: 0});
    }

    struct TraceAddress {
        CheckpointAddress[] _checkpoints;
    }

    struct CheckpointAddress {
        uint48 _key;
        address _value;
    }

    /**
     * @dev Pushes a (`key`, `value`) pair into a TraceAddress so that it is stored as the checkpoint.
     *
     * Returns previous value and new value.
     *
     * IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
     * library.
     */
    function push(TraceAddress storage self, uint48 key, address value) internal returns (address, address) {
        return _insert(self._checkpoints, key, value);
    }

    /**
     * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
     * there is none.
     */
    function lowerLookup(TraceAddress storage self, uint48 key) internal view returns (address) {
        uint256 len = self._checkpoints.length;
        uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);
        return pos == len ? address(0) : _unsafeAccess(self._checkpoints, pos)._value;
    }

    /**
     * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
     * if there is none.
     */
    function upperLookup(TraceAddress storage self, uint48 key) internal view returns (address) {
        uint256 len = self._checkpoints.length;
        uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
        return pos == 0 ? address(0) : _unsafeAccess(self._checkpoints, pos - 1)._value;
    }

    /**
     * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
     * if there is none.
     *
     * NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high
     * keys).
     */
    function upperLookupRecent(TraceAddress storage self, uint48 key) internal view returns (address) {
        uint256 len = self._checkpoints.length;

        uint256 low = 0;
        uint256 high = len;

        if (len > 5) {
            uint256 mid = len - Math.sqrt(len);
            if (key < _unsafeAccess(self._checkpoints, mid)._key) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);

        return pos == 0 ? address(0) : _unsafeAccess(self._checkpoints, pos - 1)._value;
    }

    /**
     * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
     */
    function latest(TraceAddress storage self) internal view returns (address) {
        uint256 pos = self._checkpoints.length;
        return pos == 0 ? address(0) : _unsafeAccess(self._checkpoints, pos - 1)._value;
    }

    /**
     * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
     * in the most recent checkpoint.
     */
    function latestCheckpoint(
        TraceAddress storage self
    ) internal view returns (bool exists, uint48 _key, address _value) {
        uint256 pos = self._checkpoints.length;
        if (pos == 0) {
            return (false, 0, address(0));
        } else {
            CheckpointAddress memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);
            return (true, ckpt._key, ckpt._value);
        }
    }

    /**
     * @dev Returns the number of checkpoint.
     */
    function length(TraceAddress storage self) internal view returns (uint256) {
        return self._checkpoints.length;
    }

    /**
     * @dev Returns checkpoint at given position.
     */
    function at(TraceAddress storage self, uint48 pos) internal view returns (CheckpointAddress memory) {
        return self._checkpoints[pos];
    }

    /**
     * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,
     * or by updating the last one.
     */
    function _insert(CheckpointAddress[] storage self, uint48 key, address value) private returns (address, address) {
        uint256 pos = self.length;

        if (pos > 0) {
            // Copying to memory is important here.
            CheckpointAddress memory last = _unsafeAccess(self, pos - 1);

            // Checkpoint keys must be non-decreasing.
            if (last._key > key) {
                revert CheckpointUnorderedInsertions();
            }

            // Update or push new checkpoint
            if (last._key == key) {
                _unsafeAccess(self, pos - 1)._value = value;
            } else {
                self.push(CheckpointAddress({_key: key, _value: value}));
            }
            return (last._value, value);
        } else {
            self.push(CheckpointAddress({_key: key, _value: value}));
            return (address(0), value);
        }
    }

    /**
     * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high`
     * if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
     * `high`.
     *
     * WARNING: `high` should not be greater than the array's length.
     */
    function _upperBinaryLookup(
        CheckpointAddress[] storage self,
        uint48 key,
        uint256 low,
        uint256 high
    ) private view returns (uint256) {
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (_unsafeAccess(self, mid)._key > key) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return high;
    }

    /**
     * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or
     * `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and
     * exclusive `high`.
     *
     * WARNING: `high` should not be greater than the array's length.
     */
    function _lowerBinaryLookup(
        CheckpointAddress[] storage self,
        uint48 key,
        uint256 low,
        uint256 high
    ) private view returns (uint256) {
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (_unsafeAccess(self, mid)._key < key) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return high;
    }

    /**
     * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
     */
    function _unsafeAccess(
        CheckpointAddress[] storage self,
        uint256 pos
    ) private pure returns (CheckpointAddress storage result) {
        assembly {
            mstore(0, self.slot)
            result.slot := add(keccak256(0, 0x20), pos)
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"contract ERC20","name":"_paymentToken","type":"address"},{"internalType":"contract ERC20","name":"_underlyingToken","type":"address"},{"internalType":"contract IDynamicTwapOracle","name":"_twapOracle","type":"address"},{"internalType":"contract IOptionFeeDistributor","name":"_feeDistributor","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"contract IPair","name":"_pair","type":"address"},{"internalType":"address","name":"_router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"OptionToken_IncorrectPairToken","type":"error"},{"inputs":[],"name":"OptionToken_InvalidDiscount","type":"error"},{"inputs":[],"name":"OptionToken_InvalidLockDuration","type":"error"},{"inputs":[],"name":"OptionToken_InvalidOption","type":"error"},{"inputs":[],"name":"OptionToken_InvalidTwapSeconds","type":"error"},{"inputs":[],"name":"OptionToken_NoAdminRole","type":"error"},{"inputs":[],"name":"OptionToken_NoMinterRole","type":"error"},{"inputs":[],"name":"OptionToken_NoPauserRole","type":"error"},{"inputs":[],"name":"OptionToken_PastDeadline","type":"error"},{"inputs":[],"name":"OptionToken_Paused","type":"error"},{"inputs":[],"name":"OptionToken_SlippageTooHigh","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"name":"Exercise","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpAmount","type":"uint256"}],"name":"ExerciseLp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"ExerciseVe","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"discount","type":"uint256"}],"name":"SetDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOptionFeeDistributor","name":"newFeeDistributor","type":"address"}],"name":"SetFeeDistributor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newGauge","type":"address"}],"name":"SetGauge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockDurationForMaxLpDiscount","type":"uint256"}],"name":"SetLockDurationForMaxLpDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockDurationForMinLpDiscount","type":"uint256"}],"name":"SetLockDurationForMinLpDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockDurationForMinVeDiscount","type":"uint256"}],"name":"SetLockDurationForMinVeDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lpMaxDiscount","type":"uint256"}],"name":"SetMaxLPDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lpMinDiscount","type":"uint256"}],"name":"SetMinLPDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IPair","name":"newPair","type":"address"},{"indexed":true,"internalType":"address","name":"newPaymentToken","type":"address"}],"name":"SetPairAndPaymentToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"router","type":"address"}],"name":"SetRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDynamicTwapOracle","name":"_twapOracle","type":"address"},{"indexed":true,"internalType":"address","name":"_paymentToken","type":"address"}],"name":"SetTwapOracleAndPaymentToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"twapSeconds","type":"uint32"}],"name":"SetTwapSeconds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"veDiscount","type":"uint256"}],"name":"SetVeDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"option","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"ToggleOption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FULL_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DISCOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TWAP_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DISCOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNDERLYING_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"exercise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"exercise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOption","name":"_option","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"exerciseExternal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"uint256","name":"_maxLPAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_discount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"exerciseLp","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_discount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"exerciseVe","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"contract IOptionFeeDistributor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"getDiscountedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getDiscountedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"getLockDurationForLpDiscount","outputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"getLockDurationForVeDiscount","outputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"getPaymentTokenAmountForExerciseLp","outputs":[{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint256","name":"paymentAmountToAddLiquidity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSlopeInterceptForLpDiscount","outputs":[{"internalType":"int256","name":"slope","type":"int256"},{"internalType":"int256","name":"intercept","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSlopeInterceptForVeDiscount","outputs":[{"internalType":"int256","name":"slope","type":"int256"},{"internalType":"int256","name":"intercept","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getTimeWeightedAveragePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVotingEscrow","outputs":[{"internalType":"address","name":"votingEscrow","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDurationForMaxLpDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDurationForMinLpDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDurationForMinVeDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLPDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLPDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"contract IPair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permissionedMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"setDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOptionFeeDistributor","name":"_feeDistributor","type":"address"}],"name":"setFeeDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"setGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setLockDurationForMaxLpDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setLockDurationForMinLpDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setLockDurationForMinVeDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lpMaxDiscount","type":"uint256"}],"name":"setMaxLPDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lpMinDiscount","type":"uint256"}],"name":"setMinLPDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPair","name":"_pair","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"}],"name":"setPairAndPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicTwapOracle","name":"_twapOracle","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"}],"name":"setTwapOracleAndPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_twapSeconds","type":"uint32"}],"name":"setTwapSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_veDiscount","type":"uint256"}],"name":"setVeDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"option","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"toggleOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePermissionedMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapOracle","outputs":[{"internalType":"contract IDynamicTwapOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"twapSeconds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"veMaxDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040526014600e8190556050600f556303c2670060105562093a80601155621275006012556028601355600090556015805465ff00ffffffff1916611c201790553480156200004f57600080fd5b50604051620050dd380380620050dd833981016040819052620000729162000780565b89518a908a906200008b906003906020850190620005f0565b508051620000a1906004906020840190620005f0565b50620000b3915060009050896200044b565b620000ce600080516020620050bd833981519152896200044b565b620000fa7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c896200044b565b62000115600080516020620050bd833981519152806200048e565b620001507ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9600080516020620050bd8339815191526200048e565b6200018b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c600080516020620050bd8339815191526200048e565b600780546001600160a01b03199081166001600160a01b038a8116918217909355888316608052600c80548316898516179055600d80548316888516908117909155600a80548416878616179055600980548416868616179055600880549093169387169390931790915560405163095ea7b360e01b8152600481019290925260001960248301529063095ea7b3906044016020604051808303816000875af11580156200023d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000263919062000881565b50866001600160a01b0316856001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a36007546040516001600160a01b03918216918416907f8f7f94e208aee73a455947efb48867081ee05f8c16656f34f471c2fec95b8d6e90600090a36009546040516001600160a01b03909116907f6de4326a8b9054d72d9dbab97d27bc4edffadee7d966f5af9cc4eafdaf8e545590600090a26040516001600160a01b038516907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a27ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef8836013546040516200037f91815260200190565b60405180910390a17f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df601454604051620003bb91815260200190565b60405180910390a17feccba1be6a56ca0e2c089e59a99f130b3f0bbe23d7bb2d085c278d51b3842058600f54604051620003f791815260200190565b60405180910390a17f09734b71a2b91b11a979f46fe8751cc0a22e29af3006d1ba5196a7ace08798b4600e546040516200043391815260200190565b60405180910390a150505050505050505050620008e8565b620004628282620004d960201b6200271b1760201c565b600082815260066020908152604090912062000489918390620027bd6200057e821b17901c565b505050565b600082815260056020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166200057a5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620005393390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000595836001600160a01b0384166200059e565b90505b92915050565b6000818152600183016020526040812054620005e75750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000598565b50600062000598565b828054620005fe90620008ac565b90600052602060002090601f0160209004810192826200062257600085556200066d565b82601f106200063d57805160ff19168380011785556200066d565b828001600101855582156200066d579182015b828111156200066d57825182559160200191906001019062000650565b506200067b9291506200067f565b5090565b5b808211156200067b576000815560010162000680565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620006be57600080fd5b81516001600160401b0380821115620006db57620006db62000696565b604051601f8301601f19908116603f0116810190828211818310171562000706576200070662000696565b816040528381526020925086838588010111156200072357600080fd5b600091505b8382101562000747578582018301518183018401529082019062000728565b83821115620007595760008385830101525b9695505050505050565b80516001600160a01b03811681146200077b57600080fd5b919050565b6000806000806000806000806000806101408b8d031215620007a157600080fd5b8a516001600160401b0380821115620007b957600080fd5b620007c78e838f01620006ac565b9b5060208d0151915080821115620007de57600080fd5b50620007ed8d828e01620006ac565b995050620007fe60408c0162000763565b97506200080e60608c0162000763565b96506200081e60808c0162000763565b95506200082e60a08c0162000763565b94506200083e60c08c0162000763565b93506200084e60e08c0162000763565b92506200085f6101008c0162000763565b9150620008706101208c0162000763565b90509295989b9194979a5092959850565b6000602082840312156200089457600080fd5b81518015158114620008a557600080fd5b9392505050565b600181811c90821680620008c157607f821691505b602082108103620008e257634e487b7160e01b600052602260045260246000fd5b50919050565b60805161475e6200095f6000396000818161068b0152818161120a015281816112860152818161144c0152818161195401528181612016015281816120b3015281816122f50152818161258d015281816125c90152818161307c015281816132aa0152818161356f0152613691015261475e6000f3fe608060405234801561001057600080fd5b50600436106105655760003560e01c8063787dd9e4116102d7578063b342757611610186578063de87db2f116100e3578063f595c5ad11610097578063f887ea401161007c578063f887ea4014610b5e578063fb1d6bd914610b71578063fc54989014610b8457600080fd5b8063f595c5ad14610b43578063f7b188a514610b5657600080fd5b8063e3495569116100c8578063e349556914610b01578063e63ab1e914610b09578063e8772bb214610b3057600080fd5b8063de87db2f14610adb578063e1dbffb314610aee57600080fd5b8063d53913931161013a578063d6379b721161011f578063d6379b7214610a7c578063dabd271914610a8f578063dd62ed3e14610aa257600080fd5b8063d539139314610a42578063d547741f14610a6957600080fd5b8063ca15c8731161016b578063ca15c87314610a09578063ccfc2e8d14610a1c578063d126c9a914610a2f57600080fd5b8063b3427576146109ed578063c0d78655146109f657600080fd5b80639e66645b11610234578063a7f32719116101e8578063a9059cbb116101cd578063a9059cbb146109b2578063a9f6ee33146109c5578063b187bd26146109d857600080fd5b8063a7f3271914610997578063a8aa1b311461099f57600080fd5b8063a217fddf11610219578063a217fddf146106ad578063a457c2d714610971578063a6f19c841461098457600080fd5b80639e66645b1461094b578063a1d50c3a1461095e57600080fd5b80638d6d8b091161028b5780639043292a116102705780639043292a146108f757806391d148541461090a57806395d89b411461094357600080fd5b80638d6d8b09146108ce5780639010d07c146108e457600080fd5b80638447120b116102bc5780638447120b146108b35780638456cb59146108bd578063860ca9bb146108c557600080fd5b8063787dd9e41461089857806379c79707146108ab57600080fd5b8063313ce567116104335780634b85f96c1161039057806362f43dea116103445780636c2f972b116103295780636c2f972b1461083557806370a082311461084857806375b238fc1461087157600080fd5b806362f43dea146108245780636b6f4a9d1461082c57600080fd5b806350a566c51161037557806350a566c5146107f357806354cb03841461080657806355a68ed31461081157600080fd5b80634b85f96c146107bb5780634bbf453c146107e057600080fd5b806340452c4c116103e757806342966c68116103cc57806342966c681461078257806346c96aac1461079557806347d17ede146107a857600080fd5b806340452c4c1461076657806340c10f191461076f57600080fd5b806336568abe1161041857806336568abe1461072357806339509351146107365780633cdfed561461074957600080fd5b8063313ce56714610701578063339ccade1461071057600080fd5b80631adb040a116104e15780632ac8a92c116104955780632fc1b0571161047a5780632fc1b057146106c85780633013ce29146106db578063310be939146106ee57600080fd5b80632ac8a92c146106ad5780632f2ff15d146106b557600080fd5b8063248a9ca3116104c6578063248a9ca314610650578063293c5d431461067357806329db1be61461068657600080fd5b80631adb040a1461063457806323b872dd1461063d57600080fd5b806308b0308a116105385780630d43e8ad1161051d5780630d43e8ad14610606578063133f33401461061957806318160ddd1461062c57600080fd5b806308b0308a146105d3578063095ea7b3146105f357600080fd5b806301ffc9a71461056a578063062e5bbe146105925780630694d1f1146105a957806306fdde03146105be575b600080fd5b61057d610578366004613f00565b610b8d565b60405190151581526020015b60405180910390f35b61059b600e5481565b604051908152602001610589565b6105bc6105b7366004613f2a565b610bd1565b005b6105c6610c6c565b6040516105899190613f6f565b6105db610cfe565b6040516001600160a01b039091168152602001610589565b61057d610601366004613fb7565b610d8a565b600d546105db906001600160a01b031681565b6105bc610627366004613ff1565b610da2565b60025461059b565b61059b60105481565b61057d61064b36600461402a565b610e42565b61059b61065e366004613f2a565b60009081526005602052604090206001015490565b6105bc61068136600461406b565b610e66565b6105db7f000000000000000000000000000000000000000000000000000000000000000081565b61059b600081565b6105bc6106c3366004614091565b610f3d565b6105bc6106d6366004613f2a565b610f67565b6007546105db906001600160a01b031681565b61059b6106fc3660046140b6565b610ffc565b60405160128152602001610589565b61059b61071e366004613f2a565b611025565b6105bc610731366004614091565b611033565b61057d610744366004613fb7565b6110c4565b610751611103565b60408051928352602083019190915201610589565b61059b60145481565b6105bc61077d366004613fb7565b611153565b6105bc610790366004613f2a565b61123c565b6008546105db906001600160a01b031681565b61059b6107b63660046140d8565b6112ba565b6015546107cb9063ffffffff1681565b60405163ffffffff9091168152602001610589565b61059b6107ee366004613f2a565b61150c565b6105bc610801366004613f2a565b611543565b61059b6303c2670081565b6105bc61081f36600461416e565b6115ec565b610751611673565b61059b60135481565b6105bc610843366004613f2a565b6116be565b61059b61085636600461416e565b6001600160a01b031660009081526020819052604090205490565b61059b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b61059b6108a6366004613f2a565b611753565b6105bc611760565b61059b6201518081565b6105bc611823565b61059b600f5481565b60155461057d9065010000000000900460ff1681565b6105db6108f23660046140b6565b6118ea565b600c546105db906001600160a01b031681565b61057d610918366004614091565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6105c6611902565b6107516109593660046140b6565b611911565b61059b61096c36600461418b565b611a03565b61057d61097f366004613fb7565b611a3a565b600b546105db906001600160a01b031681565b6105bc611ae4565b600a546105db906001600160a01b031681565b61057d6109c0366004613fb7565b611b46565b6107516109d33660046141ca565b611b54565b60155461057d90640100000000900460ff1681565b61059b60115481565b6105bc610a0436600461416e565b611b92565b61059b610a17366004613f2a565b611c19565b6105bc610a2a36600461416e565b611c30565b610751610a3d366004614213565b611dae565b61059b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6105bc610a77366004614091565b611dee565b61059b610a8a366004614266565b611e13565b6105bc610a9d366004613f2a565b611e20565b61059b610ab036600461429f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6105bc610ae9366004613f2a565b611ebd565b6105bc610afc36600461429f565b611f5a565b61059b606481565b61059b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b61059b610b3e366004613f2a565b6122bf565b6105bc610b51366004613f2a565b612392565b6105bc61243b565b6009546105db906001600160a01b031681565b6105bc610b7f36600461429f565b6124ca565b61059b60125481565b60006001600160e01b031982167f5a05180f000000000000000000000000000000000000000000000000000000001480610bcb5750610bcb826127d2565b92915050565b336000908152600080516020614709833981519152602052604090205460ff16610c0e5760405163f982dd0f60e01b815260040160405180910390fd5b6011548111610c3057604051634dd99fe760e01b815260040160405180910390fd5b60108190556040518181527f9604eee1326ca00c5073dfa77c88157865a7db1ed7323c9b1e0bc2aa17fa2ea2906020015b60405180910390a150565b606060038054610c7b906142cd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca7906142cd565b8015610cf45780601f10610cc957610100808354040283529160200191610cf4565b820191906000526020600020905b815481529060010190602001808311610cd757829003601f168201915b5050505050905090565b600854604080517f1f85071600000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691631f8507169160048083019260209291908290030181865afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d859190614307565b905090565b600033610d98818585612839565b5060019392505050565b336000908152600080516020614709833981519152602052604090205460ff16610ddf5760405163f982dd0f60e01b815260040160405180910390fd5b6001600160a01b038216600081815260166020908152604091829020805460ff19168515159081179091558251938452908301527f4b72c8be4451ee7595586299b69ecc5d4e8598f3037bbbb79c93eff88fdd51fc910160405180910390a15050565b600033610e50858285612991565b610e5b858585612a23565b506001949350505050565b336000908152600080516020614709833981519152602052604090205460ff16610ea35760405163f982dd0f60e01b815260040160405180910390fd5b620151808163ffffffff161180610ebe575063ffffffff8116155b15610ef5576040517f4b3cbe9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6015805463ffffffff191663ffffffff83169081179091556040519081527f9e10c351c733c6502669ada15411f45b7ca0f96b4df8709801405cae172f56bf90602001610c61565b600082815260056020526040902060010154610f5881612c10565b610f628383612c1a565b505050565b336000908152600080516020614709833981519152602052604090205460ff16610fa45760405163f982dd0f60e01b815260040160405180910390fd5b601054811115610fc757604051634dd99fe760e01b815260040160405180910390fd5b60118190556040518181527f5de612882d01106e49434ea40eed209dc8ad1a1f752a3388f45824f19b07abbb90602001610c61565b600060648261100a856122bf565b611014919061433a565b61101e919061436f565b9392505050565b6000610bcb82601354610ffc565b6001600160a01b03811633146110b65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6110c08282612c3c565b5050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d9890829086906110fe908790614383565b612839565b600080600f54600e54611116919061439b565b60115460105461112691906143da565b61113091906143f1565b9150600f5482611140919061441f565b60115461114d919061439b565b90509091565b60155465010000000000900460ff16801561118b5750336000908152600080516020614709833981519152602052604090205460ff16155b80156111c657503360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604090205460ff16155b156111fd576040517f4fcb6d0100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112326001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333084612c5e565b6110c08282612cf7565b336000908152600080516020614709833981519152602052604090205460ff166112795760405163f982dd0f60e01b815260040160405180910390fd5b6112ad6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383612db6565b6112b73382612dff565b50565b6001600160a01b03851660009081526016602052604081205460ff1661130c576040517f6d0b645400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8342111561132d57604051632d56313160e11b815260040160405180910390fd5b6040517fb984a4f30000000000000000000000000000000000000000000000000000000081526000906001600160a01b0388169063b984a4f390611379908990889088906004016144cf565b602060405180830381865afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba91906144e9565b90506113c63387612dff565b61143f3388838a6001600160a01b0316633013ce296040518163ffffffff1660e01b8152600401602060405180830381865afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142e9190614307565b6001600160a01b0316929190612c5e565b6114736001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168888612db6565b6040517fbcf679400000000000000000000000000000000000000000000000000000000081526001600160a01b0388169063bcf67940906114be908990339089908990600401614502565b6020604051808303816000875af11580156114dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150191906144e9565b979650505050505050565b6000806000611519611673565b909250905061153b8161152c868561441f565b6115369190614535565b612f68565b949350505050565b336000908152600080516020614709833981519152602052604090205460ff166115805760405163f982dd0f60e01b815260040160405180910390fd5b606481118061158d575080155b80611599575080600e54115b156115b7576040516304a5f22d60e41b815260040160405180910390fd5b600f8190556040518181527feccba1be6a56ca0e2c089e59a99f130b3f0bbe23d7bb2d085c278d51b384205890602001610c61565b336000908152600080516020614709833981519152602052604090205460ff166116295760405163f982dd0f60e01b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040517f17228b08e4c958112a0827a6d8dc8475dba58dd068a3d400800a606794db02a690600090a250565b600080601354601454611686919061439b565b601254611697906303c267006143da565b6116a191906143f1565b9150601354826116b1919061441f565b60125461114d919061439b565b336000908152600080516020614709833981519152602052604090205460ff166116fb5760405163f982dd0f60e01b815260040160405180910390fd5b60125481111561171e57604051634dd99fe760e01b815260040160405180910390fd5b60128190556040518181527f9604eee1326ca00c5073dfa77c88157865a7db1ed7323c9b1e0bc2aa17fa2ea290602001610c61565b6000806000611519611103565b600854600a5460405163b9a09fd560e01b81526001600160a01b039182166004820152600092919091169063b9a09fd590602401602060405180830381865afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190614307565b600b80546001600160a01b0319166001600160a01b038316908117909155604051919250907f17228b08e4c958112a0827a6d8dc8475dba58dd068a3d400800a606794db02a690600090a250565b3360009081527f6d1313f54c6e85b8122281b762369ceaab354256c60189434b7be71b5b32a70f602052604090205460ff1661188b576040517fb1c851f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601554640100000000900460ff166118e8576015805464ff000000001916640100000000179055604051600181527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020015b60405180910390a15b565b600082815260066020526040812061101e9083612f7f565b606060048054610c7b906142cd565b60008061191e8484610ffc565b6009546007546040517f5e60dab50000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152918216602482015260006044820181905293955083929190911690635e60dab5906064016040805180830381865afa1580156119ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119de9190614574565b9092509050816119ee828861433a565b6119f8919061436f565b925050509250929050565b600081421115611a2657604051632d56313160e11b815260040160405180910390fd5b611a31858585612f8b565b95945050505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015611ad75760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016110ad565b610e5b8286868403612839565b336000908152600080516020614709833981519152602052604090205460ff16611b215760405163f982dd0f60e01b815260040160405180910390fd5b6015805465ff0000000000198116650100000000009182900460ff1615909102179055565b600033610d98818585612a23565b60008082421115611b7857604051632d56313160e11b815260040160405180910390fd5b611b84878786886130f2565b915091509550959350505050565b336000908152600080516020614709833981519152602052604090205460ff16611bcf5760405163f982dd0f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517f6de4326a8b9054d72d9dbab97d27bc4edffadee7d966f5af9cc4eafdaf8e545590600090a250565b6000818152600660205260408120610bcb9061340b565b336000908152600080516020614709833981519152602052604090205460ff16611c6d5760405163f982dd0f60e01b815260040160405180910390fd5b600754600d5460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b3906044016020604051808303816000875af1158015611cc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce69190614598565b50600d80546001600160a01b0319166001600160a01b0383811691821790925560075460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b3906044016020604051808303816000875af1158015611d52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d769190614598565b506040516001600160a01b038216907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a250565b60008082421115611dd257604051632d56313160e11b815260040160405180910390fd5b611ddf8888888888613415565b91509150965096945050505050565b600082815260056020526040902060010154611e0981612c10565b610f628383612c3c565b600061153b848484612f8b565b336000908152600080516020614709833981519152602052604090205460ff16611e5d5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180611e6a575080155b15611e88576040516304a5f22d60e41b815260040160405180910390fd5b60138190556040518181527ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef88390602001610c61565b336000908152600080516020614709833981519152602052604090205460ff16611efa5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180611f07575080155b15611f25576040516304a5f22d60e41b815260040160405180910390fd5b60148190556040518181527f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df90602001610c61565b336000908152600080516020614709833981519152602052604090205460ff16611f975760405163f982dd0f60e01b815260040160405180910390fd5b806001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fdf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120039190614307565b6001600160a01b03161480156120ab57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561207c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a09190614307565b6001600160a01b0316145b806121c557507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612119573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213d9190614307565b6001600160a01b03161480156121c55750806001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ba9190614307565b6001600160a01b0316145b6121e25760405163a818b0ad60e01b815260040160405180910390fd5b600c80546001600160a01b038481166001600160a01b03199283161790925560078054848416921682179055600d5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015612256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227a9190614598565b50806001600160a01b0316826001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a35050565b600c546015546040517f8f2e81990000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526fffffffffffffffffffffffffffffffff8516602483015263ffffffff90921660448201526000929190911690638f2e819990606401602060405180830381865afa15801561236e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb91906144e9565b336000908152600080516020614709833981519152602052604090205460ff166123cf5760405163f982dd0f60e01b815260040160405180910390fd5b60648111806123dc575080155b806123e85750600f5481115b15612406576040516304a5f22d60e41b815260040160405180910390fd5b600e8190556040518181527f09734b71a2b91b11a979f46fe8751cc0a22e29af3006d1ba5196a7ace08798b490602001610c61565b336000908152600080516020614709833981519152602052604090205460ff166124785760405163f982dd0f60e01b815260040160405180910390fd5b601554640100000000900460ff16156118e8576015805464ff0000000019169055604051600081527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020016118df565b336000908152600080516020614709833981519152602052604090205460ff166125075760405163f982dd0f60e01b815260040160405180910390fd5b600080836001600160a01b0316639d63848a6040518163ffffffff1660e01b81526004016040805180830381865afa158015612547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256b91906145b5565b91509150826001600160a01b0316826001600160a01b03161480156125c157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b8061261957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161480156126195750826001600160a01b0316816001600160a01b0316145b6126365760405163a818b0ad60e01b815260040160405180910390fd5b600a80546001600160a01b0319166001600160a01b0386811691821790925560085460405163b9a09fd560e01b815260048101929092529091169063b9a09fd590602401602060405180830381865afa158015612697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126bb9190614307565b600b80546001600160a01b039283166001600160a01b0319918216179091556007805486841692168217905560405190918616907f8f7f94e208aee73a455947efb48867081ee05f8c16656f34f471c2fec95b8d6e90600090a350505050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166110c05760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061101e836001600160a01b038416613899565b60006001600160e01b031982167f7965db0b000000000000000000000000000000000000000000000000000000001480610bcb57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610bcb565b6001600160a01b0383166128b45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0382166129305760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114612a1d5781811015612a105760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016110ad565b612a1d8484848403612839565b50505050565b6001600160a01b038316612a9f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b038216612b1b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03831660009081526020819052604090205481811015612baa5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3612a1d565b6112b781336138e8565b612c24828261271b565b6000828152600660205260409020610f6290826127bd565b612c46828261395d565b6000828152600660205260409020610f6290826139e0565b6040516001600160a01b0380851660248301528316604482015260648101829052612a1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526139f5565b6001600160a01b038216612d4d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016110ad565b8060026000828254612d5f9190614383565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6040516001600160a01b038316602482015260448101829052610f629084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612cab565b6001600160a01b038216612e7b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03821660009081526020819052604090205481811015612f0a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600080821215612f7b5781600003610bcb565b5090565b600061101e8383613add565b601554600090640100000000900460ff1615612fb95760405162b4aa3760e01b815260040160405180910390fd5b612fc33385612dff565b612fcc84611025565b905082811115612fef576040516323a4850d60e21b815260040160405180910390fd5b600754613007906001600160a01b0316333084612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810184905291169063fb93210890604401600060405180830381600087803b15801561305757600080fd5b505af115801561306b573d6000803e3d6000fd5b506130a59250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690508386612db6565b60408051858152602081018390526001600160a01b0384169133917fb1c971764663d561c0ec2baf395a55f33f0a79fabb35bbad580247ba2959523d910160405180910390a39392505050565b6015546000908190640100000000900460ff16156131225760405162b4aa3760e01b815260040160405180910390fd5b601354841180613133575060145484105b15613151576040516304a5f22d60e41b815260040160405180910390fd5b61315b3387612dff565b6131658685610ffc565b915084821115613188576040516323a4850d60e21b815260040160405180910390fd5b6007546131a0906001600160a01b0316333085612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810185905291169063fb93210890604401600060405180830381600087803b1580156131f057600080fd5b505af1158015613204573d6000803e3d6000fd5b505050506000600860009054906101000a90046001600160a01b03166001600160a01b0316631f8507166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561325d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132819190614307565b60405163095ea7b360e01b81526001600160a01b038083166004830152602482018a90529192507f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303816000875af11580156132f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133199190614598565b50806001600160a01b0316630a2abdb3886133338861150c565b6040516001600160e01b031960e085901b168152600481019290925260248201526001600160a01b0387166044820152600060648201526084016020604051808303816000875af115801561338c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b091906144e9565b60408051898152602081018690529081018290529092506001600160a01b0385169033907f74b7132649649ee4ac2519ff0bb963ce812aaa4c8a0ad0f73c9ac1149fa6e3f49060600160405180910390a35094509492505050565b6000610bcb825490565b6015546000908190640100000000900460ff16156134455760405162b4aa3760e01b815260040160405180910390fd5b600f548311806134565750600e5483105b15613474576040516304a5f22d60e41b815260040160405180910390fd5b61347e3388612dff565b60008061348b8986611911565b915091508193508784118061349f57508681115b156134bd576040516323a4850d60e21b815260040160405180910390fd5b6134e033306134cc8488614383565b6007546001600160a01b0316929190612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810187905291169063fb93210890604401600060405180830381600087803b15801561353057600080fd5b505af1158015613544573d6000803e3d6000fd5b505060095460405163095ea7b360e01b81526001600160a01b039182166004820152602481018d90527f0000000000000000000000000000000000000000000000000000000000000000909116925063095ea7b391506044016020604051808303816000875af11580156135bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135e09190614598565b5060075460095460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b3906044016020604051808303816000875af1158015613636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365a9190614598565b506009546007546040517f5a47ddc30000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152918216602482015260006044820152606481018c905260848101849052600160a4820181905260c48201523060e482015242610104820152911690635a47ddc390610124016060604051808303816000875af115801561371b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373f91906145e4565b600a54600b5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905292975016925063095ea7b391506044016020604051808303816000875af1158015613798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137bc9190614598565b50600b546001600160a01b0316631f933c2d87856137d989611753565b6040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561382757600080fd5b505af115801561383b573d6000803e3d6000fd5b5050604080518c8152602081018890529081018690526001600160a01b03891692503391507f49a80f92a21531b6bccc1cf51cb96a7f814282e7d6a69d0a4dea0167193cd3589060600160405180910390a350509550959350505050565b60008181526001830160205260408120546138e057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610bcb565b506000610bcb565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166110c05761391b81613b07565b613926836020613b19565b604051602001613937929190614612565b60408051601f198184030181529082905262461bcd60e51b82526110ad91600401613f6f565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16156110c05760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061101e836001600160a01b038416613cfa565b6000613a4a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613ded9092919063ffffffff16565b9050805160001480613a6b575080806020019051810190613a6b9190614598565b610f625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016110ad565b6000826000018281548110613af457613af4614693565b9060005260206000200154905092915050565b6060610bcb6001600160a01b03831660145b60606000613b2883600261433a565b613b33906002614383565b67ffffffffffffffff811115613b4b57613b4b6146a9565b6040519080825280601f01601f191660200182016040528015613b75576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613bac57613bac614693565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bf757613bf7614693565b60200101906001600160f81b031916908160001a9053506000613c1b84600261433a565b613c26906001614383565b90505b6001811115613cab577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c6757613c67614693565b1a60f81b828281518110613c7d57613c7d614693565b60200101906001600160f81b031916908160001a90535060049490941c93613ca4816146bf565b9050613c29565b50831561101e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016110ad565b60008181526001830160205260408120548015613de3576000613d1e6001836143da565b8554909150600090613d32906001906143da565b9050818114613d97576000866000018281548110613d5257613d52614693565b9060005260206000200154905080876000018481548110613d7557613d75614693565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613da857613da86146d6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610bcb565b6000915050610bcb565b606061153b848460008585600080866001600160a01b03168587604051613e1491906146ec565b60006040518083038185875af1925050503d8060008114613e51576040519150601f19603f3d011682016040523d82523d6000602084013e613e56565b606091505b50915091506115018783838760608315613ed1578251600003613eca576001600160a01b0385163b613eca5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110ad565b508161153b565b61153b8383815115613ee65781518083602001fd5b8060405162461bcd60e51b81526004016110ad9190613f6f565b600060208284031215613f1257600080fd5b81356001600160e01b03198116811461101e57600080fd5b600060208284031215613f3c57600080fd5b5035919050565b60005b83811015613f5e578181015183820152602001613f46565b83811115612a1d5750506000910152565b6020815260008251806020840152613f8e816040850160208701613f43565b601f01601f19169190910160400192915050565b6001600160a01b03811681146112b757600080fd5b60008060408385031215613fca57600080fd5b8235613fd581613fa2565b946020939093013593505050565b80151581146112b757600080fd5b6000806040838503121561400457600080fd5b823561400f81613fa2565b9150602083013561401f81613fe3565b809150509250929050565b60008060006060848603121561403f57600080fd5b833561404a81613fa2565b9250602084013561405a81613fa2565b929592945050506040919091013590565b60006020828403121561407d57600080fd5b813563ffffffff8116811461101e57600080fd5b600080604083850312156140a457600080fd5b82359150602083013561401f81613fa2565b600080604083850312156140c957600080fd5b50508035926020909101359150565b6000806000806000608086880312156140f057600080fd5b85356140fb81613fa2565b94506020860135935060408601359250606086013567ffffffffffffffff8082111561412657600080fd5b818801915088601f83011261413a57600080fd5b81358181111561414957600080fd5b89602082850101111561415b57600080fd5b9699959850939650602001949392505050565b60006020828403121561418057600080fd5b813561101e81613fa2565b600080600080608085870312156141a157600080fd5b843593506020850135925060408501356141ba81613fa2565b9396929550929360600135925050565b600080600080600060a086880312156141e257600080fd5b853594506020860135935060408601356141fb81613fa2565b94979396509394606081013594506080013592915050565b60008060008060008060c0878903121561422c57600080fd5b863595506020870135945060408701359350606087013561424c81613fa2565b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561427b57600080fd5b8335925060208401359150604084013561429481613fa2565b809150509250925092565b600080604083850312156142b257600080fd5b82356142bd81613fa2565b9150602083013561401f81613fa2565b600181811c908216806142e157607f821691505b60208210810361430157634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561431957600080fd5b815161101e81613fa2565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561435457614354614324565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261437e5761437e614359565b500490565b6000821982111561439657614396614324565b500190565b600080831283600160ff1b018312811516156143b9576143b9614324565b836001600160ff1b030183138116156143d4576143d4614324565b50500390565b6000828210156143ec576143ec614324565b500390565b60008261440057614400614359565b600160ff1b82146000198414161561441a5761441a614324565b500590565b60006001600160ff1b0360008413600084138583048511828216161561444757614447614324565b600160ff1b600087128682058812818416161561446657614466614324565b6000871292508782058712848416161561448257614482614324565b8785058712818416161561449857614498614324565b505050929093029392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000611a316040830184866144a6565b6000602082840312156144fb57600080fd5b5051919050565b8481526001600160a01b038416602082015260606040820152600061452b6060830184866144a6565b9695505050505050565b6000808212826001600160ff1b030384138115161561455657614556614324565b82600160ff1b03841281161561456e5761456e614324565b50500190565b6000806040838503121561458757600080fd5b505080516020909101519092909150565b6000602082840312156145aa57600080fd5b815161101e81613fe3565b600080604083850312156145c857600080fd5b82516145d381613fa2565b602084015190925061401f81613fa2565b6000806000606084860312156145f957600080fd5b8351925060208401519150604084015190509250925092565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161464a816017850160208801613f43565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614687816028840160208801613f43565b01602801949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000816146ce576146ce614324565b506000190190565b634e487b7160e01b600052603160045260246000fd5b600082516146fe818460208701613f43565b919091019291505056fe09f04f5809d5be59813a33617d16f069caae874a6b34f03139f63d934daddae6a264697066735822122073ea3a8bfd60684a91058ef197473222139256d12634cae5ebf5e8bc4d2ceaca64736f6c634300080d0033df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec420000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000096794beb1b2e679546019be93fbdbc2623087f31000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af000000000000000000000000db28d27a556c16a333f6420ec0512bb1e64c21fd0000000000000000000000009cf90ff10c6716627a5560364e8fecda78828b380000000000000000000000000b2c83b6e39e32f694a86633b4d1fe69d13b63c50000000000000000000000003e78c1f766d7fe2c3dcef6afe6609966540b6391000000000000000000000000610d2f07b7edc67565160f587f37636194c34e7400000000000000000000000000000000000000000000000000000000000000114f7074696f6e204c594e5820546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000056f4c594e58000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106105655760003560e01c8063787dd9e4116102d7578063b342757611610186578063de87db2f116100e3578063f595c5ad11610097578063f887ea401161007c578063f887ea4014610b5e578063fb1d6bd914610b71578063fc54989014610b8457600080fd5b8063f595c5ad14610b43578063f7b188a514610b5657600080fd5b8063e3495569116100c8578063e349556914610b01578063e63ab1e914610b09578063e8772bb214610b3057600080fd5b8063de87db2f14610adb578063e1dbffb314610aee57600080fd5b8063d53913931161013a578063d6379b721161011f578063d6379b7214610a7c578063dabd271914610a8f578063dd62ed3e14610aa257600080fd5b8063d539139314610a42578063d547741f14610a6957600080fd5b8063ca15c8731161016b578063ca15c87314610a09578063ccfc2e8d14610a1c578063d126c9a914610a2f57600080fd5b8063b3427576146109ed578063c0d78655146109f657600080fd5b80639e66645b11610234578063a7f32719116101e8578063a9059cbb116101cd578063a9059cbb146109b2578063a9f6ee33146109c5578063b187bd26146109d857600080fd5b8063a7f3271914610997578063a8aa1b311461099f57600080fd5b8063a217fddf11610219578063a217fddf146106ad578063a457c2d714610971578063a6f19c841461098457600080fd5b80639e66645b1461094b578063a1d50c3a1461095e57600080fd5b80638d6d8b091161028b5780639043292a116102705780639043292a146108f757806391d148541461090a57806395d89b411461094357600080fd5b80638d6d8b09146108ce5780639010d07c146108e457600080fd5b80638447120b116102bc5780638447120b146108b35780638456cb59146108bd578063860ca9bb146108c557600080fd5b8063787dd9e41461089857806379c79707146108ab57600080fd5b8063313ce567116104335780634b85f96c1161039057806362f43dea116103445780636c2f972b116103295780636c2f972b1461083557806370a082311461084857806375b238fc1461087157600080fd5b806362f43dea146108245780636b6f4a9d1461082c57600080fd5b806350a566c51161037557806350a566c5146107f357806354cb03841461080657806355a68ed31461081157600080fd5b80634b85f96c146107bb5780634bbf453c146107e057600080fd5b806340452c4c116103e757806342966c68116103cc57806342966c681461078257806346c96aac1461079557806347d17ede146107a857600080fd5b806340452c4c1461076657806340c10f191461076f57600080fd5b806336568abe1161041857806336568abe1461072357806339509351146107365780633cdfed561461074957600080fd5b8063313ce56714610701578063339ccade1461071057600080fd5b80631adb040a116104e15780632ac8a92c116104955780632fc1b0571161047a5780632fc1b057146106c85780633013ce29146106db578063310be939146106ee57600080fd5b80632ac8a92c146106ad5780632f2ff15d146106b557600080fd5b8063248a9ca3116104c6578063248a9ca314610650578063293c5d431461067357806329db1be61461068657600080fd5b80631adb040a1461063457806323b872dd1461063d57600080fd5b806308b0308a116105385780630d43e8ad1161051d5780630d43e8ad14610606578063133f33401461061957806318160ddd1461062c57600080fd5b806308b0308a146105d3578063095ea7b3146105f357600080fd5b806301ffc9a71461056a578063062e5bbe146105925780630694d1f1146105a957806306fdde03146105be575b600080fd5b61057d610578366004613f00565b610b8d565b60405190151581526020015b60405180910390f35b61059b600e5481565b604051908152602001610589565b6105bc6105b7366004613f2a565b610bd1565b005b6105c6610c6c565b6040516105899190613f6f565b6105db610cfe565b6040516001600160a01b039091168152602001610589565b61057d610601366004613fb7565b610d8a565b600d546105db906001600160a01b031681565b6105bc610627366004613ff1565b610da2565b60025461059b565b61059b60105481565b61057d61064b36600461402a565b610e42565b61059b61065e366004613f2a565b60009081526005602052604090206001015490565b6105bc61068136600461406b565b610e66565b6105db7f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af81565b61059b600081565b6105bc6106c3366004614091565b610f3d565b6105bc6106d6366004613f2a565b610f67565b6007546105db906001600160a01b031681565b61059b6106fc3660046140b6565b610ffc565b60405160128152602001610589565b61059b61071e366004613f2a565b611025565b6105bc610731366004614091565b611033565b61057d610744366004613fb7565b6110c4565b610751611103565b60408051928352602083019190915201610589565b61059b60145481565b6105bc61077d366004613fb7565b611153565b6105bc610790366004613f2a565b61123c565b6008546105db906001600160a01b031681565b61059b6107b63660046140d8565b6112ba565b6015546107cb9063ffffffff1681565b60405163ffffffff9091168152602001610589565b61059b6107ee366004613f2a565b61150c565b6105bc610801366004613f2a565b611543565b61059b6303c2670081565b6105bc61081f36600461416e565b6115ec565b610751611673565b61059b60135481565b6105bc610843366004613f2a565b6116be565b61059b61085636600461416e565b6001600160a01b031660009081526020819052604090205490565b61059b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b61059b6108a6366004613f2a565b611753565b6105bc611760565b61059b6201518081565b6105bc611823565b61059b600f5481565b60155461057d9065010000000000900460ff1681565b6105db6108f23660046140b6565b6118ea565b600c546105db906001600160a01b031681565b61057d610918366004614091565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6105c6611902565b6107516109593660046140b6565b611911565b61059b61096c36600461418b565b611a03565b61057d61097f366004613fb7565b611a3a565b600b546105db906001600160a01b031681565b6105bc611ae4565b600a546105db906001600160a01b031681565b61057d6109c0366004613fb7565b611b46565b6107516109d33660046141ca565b611b54565b60155461057d90640100000000900460ff1681565b61059b60115481565b6105bc610a0436600461416e565b611b92565b61059b610a17366004613f2a565b611c19565b6105bc610a2a36600461416e565b611c30565b610751610a3d366004614213565b611dae565b61059b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6105bc610a77366004614091565b611dee565b61059b610a8a366004614266565b611e13565b6105bc610a9d366004613f2a565b611e20565b61059b610ab036600461429f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6105bc610ae9366004613f2a565b611ebd565b6105bc610afc36600461429f565b611f5a565b61059b606481565b61059b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b61059b610b3e366004613f2a565b6122bf565b6105bc610b51366004613f2a565b612392565b6105bc61243b565b6009546105db906001600160a01b031681565b6105bc610b7f36600461429f565b6124ca565b61059b60125481565b60006001600160e01b031982167f5a05180f000000000000000000000000000000000000000000000000000000001480610bcb5750610bcb826127d2565b92915050565b336000908152600080516020614709833981519152602052604090205460ff16610c0e5760405163f982dd0f60e01b815260040160405180910390fd5b6011548111610c3057604051634dd99fe760e01b815260040160405180910390fd5b60108190556040518181527f9604eee1326ca00c5073dfa77c88157865a7db1ed7323c9b1e0bc2aa17fa2ea2906020015b60405180910390a150565b606060038054610c7b906142cd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca7906142cd565b8015610cf45780601f10610cc957610100808354040283529160200191610cf4565b820191906000526020600020905b815481529060010190602001808311610cd757829003601f168201915b5050505050905090565b600854604080517f1f85071600000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691631f8507169160048083019260209291908290030181865afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d859190614307565b905090565b600033610d98818585612839565b5060019392505050565b336000908152600080516020614709833981519152602052604090205460ff16610ddf5760405163f982dd0f60e01b815260040160405180910390fd5b6001600160a01b038216600081815260166020908152604091829020805460ff19168515159081179091558251938452908301527f4b72c8be4451ee7595586299b69ecc5d4e8598f3037bbbb79c93eff88fdd51fc910160405180910390a15050565b600033610e50858285612991565b610e5b858585612a23565b506001949350505050565b336000908152600080516020614709833981519152602052604090205460ff16610ea35760405163f982dd0f60e01b815260040160405180910390fd5b620151808163ffffffff161180610ebe575063ffffffff8116155b15610ef5576040517f4b3cbe9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6015805463ffffffff191663ffffffff83169081179091556040519081527f9e10c351c733c6502669ada15411f45b7ca0f96b4df8709801405cae172f56bf90602001610c61565b600082815260056020526040902060010154610f5881612c10565b610f628383612c1a565b505050565b336000908152600080516020614709833981519152602052604090205460ff16610fa45760405163f982dd0f60e01b815260040160405180910390fd5b601054811115610fc757604051634dd99fe760e01b815260040160405180910390fd5b60118190556040518181527f5de612882d01106e49434ea40eed209dc8ad1a1f752a3388f45824f19b07abbb90602001610c61565b600060648261100a856122bf565b611014919061433a565b61101e919061436f565b9392505050565b6000610bcb82601354610ffc565b6001600160a01b03811633146110b65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6110c08282612c3c565b5050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d9890829086906110fe908790614383565b612839565b600080600f54600e54611116919061439b565b60115460105461112691906143da565b61113091906143f1565b9150600f5482611140919061441f565b60115461114d919061439b565b90509091565b60155465010000000000900460ff16801561118b5750336000908152600080516020614709833981519152602052604090205460ff16155b80156111c657503360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604090205460ff16155b156111fd576040517f4fcb6d0100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112326001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af16333084612c5e565b6110c08282612cf7565b336000908152600080516020614709833981519152602052604090205460ff166112795760405163f982dd0f60e01b815260040160405180910390fd5b6112ad6001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af163383612db6565b6112b73382612dff565b50565b6001600160a01b03851660009081526016602052604081205460ff1661130c576040517f6d0b645400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8342111561132d57604051632d56313160e11b815260040160405180910390fd5b6040517fb984a4f30000000000000000000000000000000000000000000000000000000081526000906001600160a01b0388169063b984a4f390611379908990889088906004016144cf565b602060405180830381865afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba91906144e9565b90506113c63387612dff565b61143f3388838a6001600160a01b0316633013ce296040518163ffffffff1660e01b8152600401602060405180830381865afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142e9190614307565b6001600160a01b0316929190612c5e565b6114736001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af168888612db6565b6040517fbcf679400000000000000000000000000000000000000000000000000000000081526001600160a01b0388169063bcf67940906114be908990339089908990600401614502565b6020604051808303816000875af11580156114dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150191906144e9565b979650505050505050565b6000806000611519611673565b909250905061153b8161152c868561441f565b6115369190614535565b612f68565b949350505050565b336000908152600080516020614709833981519152602052604090205460ff166115805760405163f982dd0f60e01b815260040160405180910390fd5b606481118061158d575080155b80611599575080600e54115b156115b7576040516304a5f22d60e41b815260040160405180910390fd5b600f8190556040518181527feccba1be6a56ca0e2c089e59a99f130b3f0bbe23d7bb2d085c278d51b384205890602001610c61565b336000908152600080516020614709833981519152602052604090205460ff166116295760405163f982dd0f60e01b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040517f17228b08e4c958112a0827a6d8dc8475dba58dd068a3d400800a606794db02a690600090a250565b600080601354601454611686919061439b565b601254611697906303c267006143da565b6116a191906143f1565b9150601354826116b1919061441f565b60125461114d919061439b565b336000908152600080516020614709833981519152602052604090205460ff166116fb5760405163f982dd0f60e01b815260040160405180910390fd5b60125481111561171e57604051634dd99fe760e01b815260040160405180910390fd5b60128190556040518181527f9604eee1326ca00c5073dfa77c88157865a7db1ed7323c9b1e0bc2aa17fa2ea290602001610c61565b6000806000611519611103565b600854600a5460405163b9a09fd560e01b81526001600160a01b039182166004820152600092919091169063b9a09fd590602401602060405180830381865afa1580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d59190614307565b600b80546001600160a01b0319166001600160a01b038316908117909155604051919250907f17228b08e4c958112a0827a6d8dc8475dba58dd068a3d400800a606794db02a690600090a250565b3360009081527f6d1313f54c6e85b8122281b762369ceaab354256c60189434b7be71b5b32a70f602052604090205460ff1661188b576040517fb1c851f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601554640100000000900460ff166118e8576015805464ff000000001916640100000000179055604051600181527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020015b60405180910390a15b565b600082815260066020526040812061101e9083612f7f565b606060048054610c7b906142cd565b60008061191e8484610ffc565b6009546007546040517f5e60dab50000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af81166004830152918216602482015260006044820181905293955083929190911690635e60dab5906064016040805180830381865afa1580156119ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119de9190614574565b9092509050816119ee828861433a565b6119f8919061436f565b925050509250929050565b600081421115611a2657604051632d56313160e11b815260040160405180910390fd5b611a31858585612f8b565b95945050505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015611ad75760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016110ad565b610e5b8286868403612839565b336000908152600080516020614709833981519152602052604090205460ff16611b215760405163f982dd0f60e01b815260040160405180910390fd5b6015805465ff0000000000198116650100000000009182900460ff1615909102179055565b600033610d98818585612a23565b60008082421115611b7857604051632d56313160e11b815260040160405180910390fd5b611b84878786886130f2565b915091509550959350505050565b336000908152600080516020614709833981519152602052604090205460ff16611bcf5760405163f982dd0f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517f6de4326a8b9054d72d9dbab97d27bc4edffadee7d966f5af9cc4eafdaf8e545590600090a250565b6000818152600660205260408120610bcb9061340b565b336000908152600080516020614709833981519152602052604090205460ff16611c6d5760405163f982dd0f60e01b815260040160405180910390fd5b600754600d5460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291169063095ea7b3906044016020604051808303816000875af1158015611cc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce69190614598565b50600d80546001600160a01b0319166001600160a01b0383811691821790925560075460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b3906044016020604051808303816000875af1158015611d52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d769190614598565b506040516001600160a01b038216907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a250565b60008082421115611dd257604051632d56313160e11b815260040160405180910390fd5b611ddf8888888888613415565b91509150965096945050505050565b600082815260056020526040902060010154611e0981612c10565b610f628383612c3c565b600061153b848484612f8b565b336000908152600080516020614709833981519152602052604090205460ff16611e5d5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180611e6a575080155b15611e88576040516304a5f22d60e41b815260040160405180910390fd5b60138190556040518181527ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef88390602001610c61565b336000908152600080516020614709833981519152602052604090205460ff16611efa5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180611f07575080155b15611f25576040516304a5f22d60e41b815260040160405180910390fd5b60148190556040518181527f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df90602001610c61565b336000908152600080516020614709833981519152602052604090205460ff16611f975760405163f982dd0f60e01b815260040160405180910390fd5b806001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fdf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120039190614307565b6001600160a01b03161480156120ab57507f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af6001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561207c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a09190614307565b6001600160a01b0316145b806121c557507f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af6001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612119573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213d9190614307565b6001600160a01b03161480156121c55750806001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ba9190614307565b6001600160a01b0316145b6121e25760405163a818b0ad60e01b815260040160405180910390fd5b600c80546001600160a01b038481166001600160a01b03199283161790925560078054848416921682179055600d5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015612256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227a9190614598565b50806001600160a01b0316826001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a35050565b600c546015546040517f8f2e81990000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af811660048301526fffffffffffffffffffffffffffffffff8516602483015263ffffffff90921660448201526000929190911690638f2e819990606401602060405180830381865afa15801561236e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb91906144e9565b336000908152600080516020614709833981519152602052604090205460ff166123cf5760405163f982dd0f60e01b815260040160405180910390fd5b60648111806123dc575080155b806123e85750600f5481115b15612406576040516304a5f22d60e41b815260040160405180910390fd5b600e8190556040518181527f09734b71a2b91b11a979f46fe8751cc0a22e29af3006d1ba5196a7ace08798b490602001610c61565b336000908152600080516020614709833981519152602052604090205460ff166124785760405163f982dd0f60e01b815260040160405180910390fd5b601554640100000000900460ff16156118e8576015805464ff0000000019169055604051600081527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020016118df565b336000908152600080516020614709833981519152602052604090205460ff166125075760405163f982dd0f60e01b815260040160405180910390fd5b600080836001600160a01b0316639d63848a6040518163ffffffff1660e01b81526004016040805180830381865afa158015612547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256b91906145b5565b91509150826001600160a01b0316826001600160a01b03161480156125c157507f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af6001600160a01b0316816001600160a01b0316145b8061261957507f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af6001600160a01b0316826001600160a01b03161480156126195750826001600160a01b0316816001600160a01b0316145b6126365760405163a818b0ad60e01b815260040160405180910390fd5b600a80546001600160a01b0319166001600160a01b0386811691821790925560085460405163b9a09fd560e01b815260048101929092529091169063b9a09fd590602401602060405180830381865afa158015612697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126bb9190614307565b600b80546001600160a01b039283166001600160a01b0319918216179091556007805486841692168217905560405190918616907f8f7f94e208aee73a455947efb48867081ee05f8c16656f34f471c2fec95b8d6e90600090a350505050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166110c05760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061101e836001600160a01b038416613899565b60006001600160e01b031982167f7965db0b000000000000000000000000000000000000000000000000000000001480610bcb57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610bcb565b6001600160a01b0383166128b45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0382166129305760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114612a1d5781811015612a105760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016110ad565b612a1d8484848403612839565b50505050565b6001600160a01b038316612a9f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b038216612b1b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03831660009081526020819052604090205481811015612baa5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3612a1d565b6112b781336138e8565b612c24828261271b565b6000828152600660205260409020610f6290826127bd565b612c46828261395d565b6000828152600660205260409020610f6290826139e0565b6040516001600160a01b0380851660248301528316604482015260648101829052612a1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526139f5565b6001600160a01b038216612d4d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016110ad565b8060026000828254612d5f9190614383565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6040516001600160a01b038316602482015260448101829052610f629084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612cab565b6001600160a01b038216612e7b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b03821660009081526020819052604090205481811015612f0a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016110ad565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600080821215612f7b5781600003610bcb565b5090565b600061101e8383613add565b601554600090640100000000900460ff1615612fb95760405162b4aa3760e01b815260040160405180910390fd5b612fc33385612dff565b612fcc84611025565b905082811115612fef576040516323a4850d60e21b815260040160405180910390fd5b600754613007906001600160a01b0316333084612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810184905291169063fb93210890604401600060405180830381600087803b15801561305757600080fd5b505af115801561306b573d6000803e3d6000fd5b506130a59250506001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af1690508386612db6565b60408051858152602081018390526001600160a01b0384169133917fb1c971764663d561c0ec2baf395a55f33f0a79fabb35bbad580247ba2959523d910160405180910390a39392505050565b6015546000908190640100000000900460ff16156131225760405162b4aa3760e01b815260040160405180910390fd5b601354841180613133575060145484105b15613151576040516304a5f22d60e41b815260040160405180910390fd5b61315b3387612dff565b6131658685610ffc565b915084821115613188576040516323a4850d60e21b815260040160405180910390fd5b6007546131a0906001600160a01b0316333085612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810185905291169063fb93210890604401600060405180830381600087803b1580156131f057600080fd5b505af1158015613204573d6000803e3d6000fd5b505050506000600860009054906101000a90046001600160a01b03166001600160a01b0316631f8507166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561325d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132819190614307565b60405163095ea7b360e01b81526001600160a01b038083166004830152602482018a90529192507f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af9091169063095ea7b3906044016020604051808303816000875af11580156132f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133199190614598565b50806001600160a01b0316630a2abdb3886133338861150c565b6040516001600160e01b031960e085901b168152600481019290925260248201526001600160a01b0387166044820152600060648201526084016020604051808303816000875af115801561338c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b091906144e9565b60408051898152602081018690529081018290529092506001600160a01b0385169033907f74b7132649649ee4ac2519ff0bb963ce812aaa4c8a0ad0f73c9ac1149fa6e3f49060600160405180910390a35094509492505050565b6000610bcb825490565b6015546000908190640100000000900460ff16156134455760405162b4aa3760e01b815260040160405180910390fd5b600f548311806134565750600e5483105b15613474576040516304a5f22d60e41b815260040160405180910390fd5b61347e3388612dff565b60008061348b8986611911565b915091508193508784118061349f57508681115b156134bd576040516323a4850d60e21b815260040160405180910390fd5b6134e033306134cc8488614383565b6007546001600160a01b0316929190612c5e565b600d54600754604051631f72642160e31b81526001600160a01b0391821660048201526024810187905291169063fb93210890604401600060405180830381600087803b15801561353057600080fd5b505af1158015613544573d6000803e3d6000fd5b505060095460405163095ea7b360e01b81526001600160a01b039182166004820152602481018d90527f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af909116925063095ea7b391506044016020604051808303816000875af11580156135bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135e09190614598565b5060075460095460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b3906044016020604051808303816000875af1158015613636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365a9190614598565b506009546007546040517f5a47ddc30000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af81166004830152918216602482015260006044820152606481018c905260848101849052600160a4820181905260c48201523060e482015242610104820152911690635a47ddc390610124016060604051808303816000875af115801561371b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373f91906145e4565b600a54600b5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905292975016925063095ea7b391506044016020604051808303816000875af1158015613798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137bc9190614598565b50600b546001600160a01b0316631f933c2d87856137d989611753565b6040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561382757600080fd5b505af115801561383b573d6000803e3d6000fd5b5050604080518c8152602081018890529081018690526001600160a01b03891692503391507f49a80f92a21531b6bccc1cf51cb96a7f814282e7d6a69d0a4dea0167193cd3589060600160405180910390a350509550959350505050565b60008181526001830160205260408120546138e057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610bcb565b506000610bcb565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff166110c05761391b81613b07565b613926836020613b19565b604051602001613937929190614612565b60408051601f198184030181529082905262461bcd60e51b82526110ad91600401613f6f565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16156110c05760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061101e836001600160a01b038416613cfa565b6000613a4a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613ded9092919063ffffffff16565b9050805160001480613a6b575080806020019051810190613a6b9190614598565b610f625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016110ad565b6000826000018281548110613af457613af4614693565b9060005260206000200154905092915050565b6060610bcb6001600160a01b03831660145b60606000613b2883600261433a565b613b33906002614383565b67ffffffffffffffff811115613b4b57613b4b6146a9565b6040519080825280601f01601f191660200182016040528015613b75576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613bac57613bac614693565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bf757613bf7614693565b60200101906001600160f81b031916908160001a9053506000613c1b84600261433a565b613c26906001614383565b90505b6001811115613cab577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c6757613c67614693565b1a60f81b828281518110613c7d57613c7d614693565b60200101906001600160f81b031916908160001a90535060049490941c93613ca4816146bf565b9050613c29565b50831561101e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016110ad565b60008181526001830160205260408120548015613de3576000613d1e6001836143da565b8554909150600090613d32906001906143da565b9050818114613d97576000866000018281548110613d5257613d52614693565b9060005260206000200154905080876000018481548110613d7557613d75614693565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613da857613da86146d6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610bcb565b6000915050610bcb565b606061153b848460008585600080866001600160a01b03168587604051613e1491906146ec565b60006040518083038185875af1925050503d8060008114613e51576040519150601f19603f3d011682016040523d82523d6000602084013e613e56565b606091505b50915091506115018783838760608315613ed1578251600003613eca576001600160a01b0385163b613eca5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110ad565b508161153b565b61153b8383815115613ee65781518083602001fd5b8060405162461bcd60e51b81526004016110ad9190613f6f565b600060208284031215613f1257600080fd5b81356001600160e01b03198116811461101e57600080fd5b600060208284031215613f3c57600080fd5b5035919050565b60005b83811015613f5e578181015183820152602001613f46565b83811115612a1d5750506000910152565b6020815260008251806020840152613f8e816040850160208701613f43565b601f01601f19169190910160400192915050565b6001600160a01b03811681146112b757600080fd5b60008060408385031215613fca57600080fd5b8235613fd581613fa2565b946020939093013593505050565b80151581146112b757600080fd5b6000806040838503121561400457600080fd5b823561400f81613fa2565b9150602083013561401f81613fe3565b809150509250929050565b60008060006060848603121561403f57600080fd5b833561404a81613fa2565b9250602084013561405a81613fa2565b929592945050506040919091013590565b60006020828403121561407d57600080fd5b813563ffffffff8116811461101e57600080fd5b600080604083850312156140a457600080fd5b82359150602083013561401f81613fa2565b600080604083850312156140c957600080fd5b50508035926020909101359150565b6000806000806000608086880312156140f057600080fd5b85356140fb81613fa2565b94506020860135935060408601359250606086013567ffffffffffffffff8082111561412657600080fd5b818801915088601f83011261413a57600080fd5b81358181111561414957600080fd5b89602082850101111561415b57600080fd5b9699959850939650602001949392505050565b60006020828403121561418057600080fd5b813561101e81613fa2565b600080600080608085870312156141a157600080fd5b843593506020850135925060408501356141ba81613fa2565b9396929550929360600135925050565b600080600080600060a086880312156141e257600080fd5b853594506020860135935060408601356141fb81613fa2565b94979396509394606081013594506080013592915050565b60008060008060008060c0878903121561422c57600080fd5b863595506020870135945060408701359350606087013561424c81613fa2565b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561427b57600080fd5b8335925060208401359150604084013561429481613fa2565b809150509250925092565b600080604083850312156142b257600080fd5b82356142bd81613fa2565b9150602083013561401f81613fa2565b600181811c908216806142e157607f821691505b60208210810361430157634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561431957600080fd5b815161101e81613fa2565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561435457614354614324565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261437e5761437e614359565b500490565b6000821982111561439657614396614324565b500190565b600080831283600160ff1b018312811516156143b9576143b9614324565b836001600160ff1b030183138116156143d4576143d4614324565b50500390565b6000828210156143ec576143ec614324565b500390565b60008261440057614400614359565b600160ff1b82146000198414161561441a5761441a614324565b500590565b60006001600160ff1b0360008413600084138583048511828216161561444757614447614324565b600160ff1b600087128682058812818416161561446657614466614324565b6000871292508782058712848416161561448257614482614324565b8785058712818416161561449857614498614324565b505050929093029392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000611a316040830184866144a6565b6000602082840312156144fb57600080fd5b5051919050565b8481526001600160a01b038416602082015260606040820152600061452b6060830184866144a6565b9695505050505050565b6000808212826001600160ff1b030384138115161561455657614556614324565b82600160ff1b03841281161561456e5761456e614324565b50500190565b6000806040838503121561458757600080fd5b505080516020909101519092909150565b6000602082840312156145aa57600080fd5b815161101e81613fe3565b600080604083850312156145c857600080fd5b82516145d381613fa2565b602084015190925061401f81613fa2565b6000806000606084860312156145f957600080fd5b8351925060208401519150604084015190509250925092565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161464a816017850160208801613f43565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614687816028840160208801613f43565b01602801949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000816146ce576146ce614324565b506000190190565b634e487b7160e01b600052603160045260246000fd5b600082516146fe818460208701613f43565b919091019291505056fe09f04f5809d5be59813a33617d16f069caae874a6b34f03139f63d934daddae6a264697066735822122073ea3a8bfd60684a91058ef197473222139256d12634cae5ebf5e8bc4d2ceaca64736f6c634300080d0033

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

0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000096794beb1b2e679546019be93fbdbc2623087f31000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af000000000000000000000000db28d27a556c16a333f6420ec0512bb1e64c21fd0000000000000000000000009cf90ff10c6716627a5560364e8fecda78828b380000000000000000000000000b2c83b6e39e32f694a86633b4d1fe69d13b63c50000000000000000000000003e78c1f766d7fe2c3dcef6afe6609966540b6391000000000000000000000000610d2f07b7edc67565160f587f37636194c34e7400000000000000000000000000000000000000000000000000000000000000114f7074696f6e204c594e5820546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000056f4c594e58000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Option LYNX Token
Arg [1] : _symbol (string): oLYNX
Arg [2] : _admin (address): 0x96794bEb1b2E679546019Be93fBdbc2623087F31
Arg [3] : _paymentToken (address): 0x176211869cA2b568f2A7D4EE941E073a821EE1ff
Arg [4] : _underlyingToken (address): 0x1a51b19CE03dbE0Cb44C1528E34a7EDD7771E9Af
Arg [5] : _twapOracle (address): 0xDB28D27a556C16a333F6420EC0512BB1e64C21Fd
Arg [6] : _feeDistributor (address): 0x9Cf90ff10c6716627A5560364e8FECDA78828b38
Arg [7] : _voter (address): 0x0B2c83B6e39E32f694a86633B4d1Fe69d13b63c5
Arg [8] : _pair (address): 0x3E78c1F766D7FE2c3dceF6aFe6609966540B6391
Arg [9] : _router (address): 0x610D2f07b7EdC67565160F587F37636194C34E74

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [2] : 00000000000000000000000096794beb1b2e679546019be93fbdbc2623087f31
Arg [3] : 000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff
Arg [4] : 0000000000000000000000001a51b19ce03dbe0cb44c1528e34a7edd7771e9af
Arg [5] : 000000000000000000000000db28d27a556c16a333f6420ec0512bb1e64c21fd
Arg [6] : 0000000000000000000000009cf90ff10c6716627a5560364e8fecda78828b38
Arg [7] : 0000000000000000000000000b2c83b6e39e32f694a86633b4d1fe69d13b63c5
Arg [8] : 0000000000000000000000003e78c1f766d7fe2c3dcef6afe6609966540b6391
Arg [9] : 000000000000000000000000610d2f07b7edc67565160f587f37636194c34e74
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [11] : 4f7074696f6e204c594e5820546f6b656e000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [13] : 6f4c594e58000000000000000000000000000000000000000000000000000000


[ Download: CSV Export  ]
[ Download: CSV Export  ]

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