ETH Price: $3,709.26 (+3.21%)

Token

Pendle Market (PENDLE-LPT)
 

Overview

Max Total Supply

0.008005553588380515 PENDLE-LPT

Holders

675 ( 4.296%)

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
matate.eth
Balance
0.000000032482061254 PENDLE-LPT

Value
$0.00
0x10103d79ac194eb0c4cc75742bda65c18dff335b
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Pendle is essentially a protocol for tokenizing yield and an AMM for trading tokenized yield and other time-decaying assets.

# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x40789E85...aC3EB8F32
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PendleMarketV3

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
File 1 of 34 : PendleMarketV3.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import "../../../interfaces/IPMarketV3.sol";
import "../../../interfaces/IPMarketFactoryV3.sol";
import "../../../interfaces/IPMarketSwapCallback.sol";

import "../../erc20/PendleERC20.sol";
import "../PendleGauge.sol";
import "../OracleLib.sol";

/**
Invariance to maintain:
- Internal balances totalPt & totalSy not interfered by people transferring tokens in directly
- address(0) & address(this) should never have any rewards & activeBalance accounting done. This is
    guaranteed by address(0) & address(this) check in each updateForTwo function
*/
contract PendleMarketV3 is PendleERC20, PendleGauge, IPMarketV3 {
    using PMath for uint256;
    using PMath for int256;
    using MarketMathCore for MarketState;
    using SafeERC20 for IERC20;
    using PYIndexLib for IPYieldToken;
    using OracleLib for OracleLib.Observation[65535];

    struct MarketStorage {
        int128 totalPt;
        int128 totalSy;
        // 1 SLOT = 256 bits
        uint96 lastLnImpliedRate;
        uint16 observationIndex;
        uint16 observationCardinality;
        uint16 observationCardinalityNext;
        // 1 SLOT = 144 bits
    }

    string private constant NAME = "Pendle Market";
    string private constant SYMBOL = "PENDLE-LPT";

    IPPrincipalToken internal immutable PT;
    IStandardizedYield internal immutable SY;
    IPYieldToken internal immutable YT;

    address public immutable factory;
    uint256 public immutable expiry;

    int256 internal immutable scalarRoot;
    int256 internal immutable initialAnchor;
    uint80 internal immutable lnFeeRateRoot;

    MarketStorage public _storage;

    OracleLib.Observation[65535] public observations;

    modifier notExpired() {
        if (isExpired()) revert Errors.MarketExpired();
        _;
    }

    constructor(
        address _PT,
        int256 _scalarRoot,
        int256 _initialAnchor,
        uint80 _lnFeeRateRoot,
        address _vePendle,
        address _gaugeController
    ) PendleERC20(NAME, SYMBOL, 18) PendleGauge(IPPrincipalToken(_PT).SY(), _vePendle, _gaugeController) {
        PT = IPPrincipalToken(_PT);
        SY = IStandardizedYield(PT.SY());
        YT = IPYieldToken(PT.YT());

        (_storage.observationCardinality, _storage.observationCardinalityNext) = observations.initialize(
            uint32(block.timestamp)
        );

        if (_scalarRoot <= 0) revert Errors.MarketScalarRootBelowZero(_scalarRoot);

        scalarRoot = _scalarRoot;
        initialAnchor = _initialAnchor;
        lnFeeRateRoot = _lnFeeRateRoot;
        expiry = IPPrincipalToken(_PT).expiry();
        factory = msg.sender;
    }

    /**
     * @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
     * will grant LP holders more exchange fee over time
     * @dev will mint as much LP as possible such that the corresponding SY and PT used do
     * not exceed `netSyDesired` and `netPtDesired`, respectively
     * @dev PT and SY should be transferred to this contract prior to calling
     * @dev will revert if PT is expired
     */
    function mint(
        address receiver,
        uint256 netSyDesired,
        uint256 netPtDesired
    ) external nonReentrant notExpired returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed) {
        MarketState memory market = readState(msg.sender);
        PYIndex index = YT.newIndex();

        uint256 lpToReserve;

        (lpToReserve, netLpOut, netSyUsed, netPtUsed) = market.addLiquidity(
            netSyDesired,
            netPtDesired,
            block.timestamp
        );

        // initializing the market
        if (lpToReserve != 0) {
            market.setInitialLnImpliedRate(index, initialAnchor, block.timestamp);
            _mint(address(1), lpToReserve);
        }

        _mint(receiver, netLpOut);

        _writeState(market);

        if (_selfBalance(SY) < market.totalSy.Uint())
            revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
        if (_selfBalance(PT) < market.totalPt.Uint())
            revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());

        emit Mint(receiver, netLpOut, netSyUsed, netPtUsed);
    }

    /**
     * @notice LP Holders can burn their LP to receive back SY & PT proportionally
     * to their share of the market
     */
    function burn(
        address receiverSy,
        address receiverPt,
        uint256 netLpToBurn
    ) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
        MarketState memory market = readState(msg.sender);

        _burn(address(this), netLpToBurn);

        (netSyOut, netPtOut) = market.removeLiquidity(netLpToBurn);

        if (receiverSy != address(this)) IERC20(SY).safeTransfer(receiverSy, netSyOut);
        if (receiverPt != address(this)) IERC20(PT).safeTransfer(receiverPt, netPtOut);

        _writeState(market);

        emit Burn(receiverSy, receiverPt, netLpToBurn, netSyOut, netPtOut);
    }

    /**
     * @notice Pendle Market allows swaps between PT & SY it is holding. This function
     * aims to swap an exact amount of PT to SY.
     * @dev steps working of this contract
       - The outcome amount of SY will be precomputed by MarketMathLib
       - Release the calculated amount of SY to receiver
       - Callback to msg.sender if data.length > 0
       - Ensure exactPtIn amount of PT has been transferred to this address
     * @dev will revert if PT is expired
     * @param data bytes data to be sent in the callback (if any)
     */
    function swapExactPtForSy(
        address receiver,
        uint256 exactPtIn,
        bytes calldata data
    ) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee) {
        MarketState memory market = readState(msg.sender);

        uint256 netSyToReserve;
        (netSyOut, netSyFee, netSyToReserve) = market.swapExactPtForSy(YT.newIndex(), exactPtIn, block.timestamp);

        if (receiver != address(this)) IERC20(SY).safeTransfer(receiver, netSyOut);
        IERC20(SY).safeTransfer(market.treasury, netSyToReserve);

        _writeState(market);

        if (data.length > 0) {
            IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(), netSyOut.Int(), data);
        }

        if (_selfBalance(PT) < market.totalPt.Uint())
            revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());

        emit Swap(msg.sender, receiver, exactPtIn.neg(), netSyOut.Int(), netSyFee, netSyToReserve);
    }

    /**
     * @notice Pendle Market allows swaps between PT & SY it is holding. This function
     * aims to swap SY for an exact amount of PT.
     * @dev steps working of this function
       - The exact outcome amount of PT will be transferred to receiver
       - Callback to msg.sender if data.length > 0
       - Ensure the calculated required amount of SY is transferred to this address
     * @dev will revert if PT is expired
     * @param data bytes data to be sent in the callback (if any)
     */
    function swapSyForExactPt(
        address receiver,
        uint256 exactPtOut,
        bytes calldata data
    ) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyFee) {
        MarketState memory market = readState(msg.sender);

        uint256 netSyToReserve;
        (netSyIn, netSyFee, netSyToReserve) = market.swapSyForExactPt(YT.newIndex(), exactPtOut, block.timestamp);

        if (receiver != address(this)) IERC20(PT).safeTransfer(receiver, exactPtOut);
        IERC20(SY).safeTransfer(market.treasury, netSyToReserve);

        _writeState(market);

        if (data.length > 0) {
            IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(), netSyIn.neg(), data);
        }

        // have received enough SY
        if (_selfBalance(SY) < market.totalSy.Uint())
            revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());

        emit Swap(msg.sender, receiver, exactPtOut.Int(), netSyIn.neg(), netSyFee, netSyToReserve);
    }

    /// @notice forces balances to match reserves
    function skim() external nonReentrant {
        MarketState memory market = readState(msg.sender);
        uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
        uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
        if (excessPt != 0) IERC20(PT).safeTransfer(market.treasury, excessPt);
        if (excessSy != 0) IERC20(SY).safeTransfer(market.treasury, excessSy);
    }

    /**
     * @notice redeems the user's reward
     * @return amount of reward token redeemed, in the same order as `getRewardTokens()`
     */
    function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
        return _redeemRewards(user);
    }

    /// @notice returns the list of reward tokens
    function getRewardTokens() external view returns (address[] memory) {
        return _getRewardTokens();
    }

    /*///////////////////////////////////////////////////////////////
                                ORACLE
    //////////////////////////////////////////////////////////////*/

    function observe(uint32[] memory secondsAgos) external view returns (uint216[] memory lnImpliedRateCumulative) {
        return
            observations.observe(
                uint32(block.timestamp),
                secondsAgos,
                _storage.lastLnImpliedRate,
                _storage.observationIndex,
                _storage.observationCardinality
            );
    }

    function increaseObservationsCardinalityNext(uint16 cardinalityNext) external nonReentrant {
        uint16 cardinalityNextOld = _storage.observationCardinalityNext;
        uint16 cardinalityNextNew = observations.grow(cardinalityNextOld, cardinalityNext);
        if (cardinalityNextOld != cardinalityNextNew) {
            _storage.observationCardinalityNext = cardinalityNextNew;
            emit IncreaseObservationCardinalityNext(cardinalityNextOld, cardinalityNextNew);
        }
    }

    /*///////////////////////////////////////////////////////////////
                                READ/WRITE STATES
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice read the state of the market from storage into memory for gas-efficient manipulation
     */
    function readState(address router) public view returns (MarketState memory market) {
        market.totalPt = _storage.totalPt;
        market.totalSy = _storage.totalSy;
        market.totalLp = totalSupply().Int();

        uint80 overriddenFee;

        (market.treasury, overriddenFee, market.reserveFeePercent) = IPMarketFactoryV3(factory).getMarketConfig(
            address(this),
            router
        );

        market.lnFeeRateRoot = overriddenFee == 0 ? lnFeeRateRoot : overriddenFee;
        market.scalarRoot = scalarRoot;
        market.expiry = expiry;

        market.lastLnImpliedRate = _storage.lastLnImpliedRate;
    }

    /// @notice write back the state of the market from memory to storage
    function _writeState(MarketState memory market) internal {
        uint96 lastLnImpliedRate96 = market.lastLnImpliedRate.Uint96();
        int128 totalPt128 = market.totalPt.Int128();
        int128 totalSy128 = market.totalSy.Int128();

        (uint16 observationIndex, uint16 observationCardinality) = observations.write(
            _storage.observationIndex,
            uint32(block.timestamp),
            _storage.lastLnImpliedRate,
            _storage.observationCardinality,
            _storage.observationCardinalityNext
        );

        _storage.totalPt = totalPt128;
        _storage.totalSy = totalSy128;
        _storage.lastLnImpliedRate = lastLnImpliedRate96;
        _storage.observationIndex = observationIndex;
        _storage.observationCardinality = observationCardinality;

        emit UpdateImpliedRate(block.timestamp, market.lastLnImpliedRate);
    }

    function getNonOverrideLnFeeRateRoot() external view returns (uint80) {
        return lnFeeRateRoot;
    }

    /*///////////////////////////////////////////////////////////////
                            TRIVIAL FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function readTokens() external view returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT) {
        _SY = SY;
        _PT = PT;
        _YT = YT;
    }

    function isExpired() public view returns (bool) {
        return MiniHelpers.isCurrentlyExpired(expiry);
    }

    /*///////////////////////////////////////////////////////////////
                    PENDLE GAUGE - RELATED
    //////////////////////////////////////////////////////////////*/

    function _stakedBalance(address user) internal view override returns (uint256) {
        return balanceOf(user);
    }

    function _totalStaked() internal view override returns (uint256) {
        return totalSupply();
    }

    // solhint-disable-next-line ordering
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override(PendleERC20, PendleGauge) {
        PendleGauge._beforeTokenTransfer(from, to, amount);
    }

    // solhint-disable-next-line ordering
    function _afterTokenTransfer(address from, address to, uint256 amount) internal override(PendleERC20, PendleGauge) {
        PendleGauge._afterTokenTransfer(from, to, amount);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

File 4 of 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 5 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 6 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 7 of 34 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 8 of 34 : PendleERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";

/**
 * @dev Pendle's ERC20 implementation, modified from @openzeppelin implementation
 * Changes are:
 * - comes with built-in reentrancy protection, storage-packed with totalSupply variable
 * - delete increaseAllowance / decreaseAllowance
 * - add nonReentrancy protection to transfer / transferFrom functions
 * - allow decimals to be passed in
 * - block self-transfer by default
 */
// solhint-disable
contract PendleERC20 is Context, IERC20, IERC20Metadata {
    uint8 private constant _NOT_ENTERED = 1;
    uint8 private constant _ENTERED = 2;

    mapping(address => uint256) private _balances;

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

    uint248 private _totalSupply;
    uint8 private _status;

    string private _name;
    string private _symbol;
    uint8 public immutable decimals;

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

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

    /**
     * @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 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) external virtual override nonReentrant 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) external 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
    ) external virtual override nonReentrant returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * 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");
        require(from != to, "ERC20: transfer to self");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _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 += toUint248(amount);
        _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;
        }
        _totalSupply -= toUint248(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 {}

    function toUint248(uint256 x) internal virtual returns (uint248) {
        require(x <= type(uint248).max); // signed, lim = bit-1
        return uint248(x);
    }
}

File 9 of 34 : ArrayLib.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

library ArrayLib {
    function sum(uint256[] memory input) internal pure returns (uint256) {
        uint256 value = 0;
        for (uint256 i = 0; i < input.length; ) {
            value += input[i];
            unchecked {
                i++;
            }
        }
        return value;
    }

    /// @notice return index of the element if found, else return uint256.max
    function find(address[] memory array, address element) internal pure returns (uint256 index) {
        uint256 length = array.length;
        for (uint256 i = 0; i < length; ) {
            if (array[i] == element) return i;
            unchecked {
                i++;
            }
        }
        return type(uint256).max;
    }

    function append(address[] memory inp, address element) internal pure returns (address[] memory out) {
        uint256 length = inp.length;
        out = new address[](length + 1);
        for (uint256 i = 0; i < length; ) {
            out[i] = inp[i];
            unchecked {
                i++;
            }
        }
        out[length] = element;
    }

    function appendHead(address[] memory inp, address element) internal pure returns (address[] memory out) {
        uint256 length = inp.length;
        out = new address[](length + 1);
        out[0] = element;
        for (uint256 i = 1; i <= length; ) {
            out[i] = inp[i - 1];
            unchecked {
                i++;
            }
        }
    }

    /**
     * @dev This function assumes a and b each contains unidentical elements
     * @param a array of addresses a
     * @param b array of addresses b
     * @return out Concatenation of a and b containing unidentical elements
     */
    function merge(address[] memory a, address[] memory b) internal pure returns (address[] memory out) {
        unchecked {
            uint256 countUnidenticalB = 0;
            bool[] memory isUnidentical = new bool[](b.length);
            for (uint256 i = 0; i < b.length; ++i) {
                if (!contains(a, b[i])) {
                    countUnidenticalB++;
                    isUnidentical[i] = true;
                }
            }

            out = new address[](a.length + countUnidenticalB);
            for (uint256 i = 0; i < a.length; ++i) {
                out[i] = a[i];
            }
            uint256 id = a.length;
            for (uint256 i = 0; i < b.length; ++i) {
                if (isUnidentical[i]) {
                    out[id++] = b[i];
                }
            }
        }
    }

    // various version of contains
    function contains(address[] memory array, address element) internal pure returns (bool) {
        uint256 length = array.length;
        for (uint256 i = 0; i < length; ) {
            if (array[i] == element) return true;
            unchecked {
                i++;
            }
        }
        return false;
    }

    function contains(bytes4[] memory array, bytes4 element) internal pure returns (bool) {
        uint256 length = array.length;
        for (uint256 i = 0; i < length; ) {
            if (array[i] == element) return true;
            unchecked {
                i++;
            }
        }
        return false;
    }

    function create(address a) internal pure returns (address[] memory res) {
        res = new address[](1);
        res[0] = a;
    }

    function create(address a, address b) internal pure returns (address[] memory res) {
        res = new address[](2);
        res[0] = a;
        res[1] = b;
    }

    function create(address a, address b, address c) internal pure returns (address[] memory res) {
        res = new address[](3);
        res[0] = a;
        res[1] = b;
        res[2] = c;
    }

    function create(address a, address b, address c, address d) internal pure returns (address[] memory res) {
        res = new address[](4);
        res[0] = a;
        res[1] = b;
        res[2] = c;
        res[3] = d;
    }

    function create(
        address a,
        address b,
        address c,
        address d,
        address e
    ) internal pure returns (address[] memory res) {
        res = new address[](5);
        res[0] = a;
        res[1] = b;
        res[2] = c;
        res[3] = d;
        res[4] = e;
    }

    function create(uint256 a) internal pure returns (uint256[] memory res) {
        res = new uint256[](1);
        res[0] = a;
    }
}

File 10 of 34 : Errors.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

library Errors {
    // BulkSeller
    error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount);
    error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount);
    error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
    error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
    error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
    error BulkNotMaintainer();
    error BulkNotAdmin();
    error BulkSellerAlreadyExisted(address token, address SY, address bulk);
    error BulkSellerInvalidToken(address token, address SY);
    error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps);
    error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps);

    // APPROX
    error ApproxFail();
    error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps);
    error ApproxBinarySearchInputInvalid(
        uint256 approxGuessMin,
        uint256 approxGuessMax,
        uint256 minGuessMin,
        uint256 maxGuessMax
    );

    // MARKET + MARKET MATH CORE
    error MarketExpired();
    error MarketZeroAmountsInput();
    error MarketZeroAmountsOutput();
    error MarketZeroLnImpliedRate();
    error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount);
    error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance);
    error MarketInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
    error MarketZeroTotalPtOrTotalAsset(int256 totalPt, int256 totalAsset);
    error MarketExchangeRateBelowOne(int256 exchangeRate);
    error MarketProportionMustNotEqualOne();
    error MarketRateScalarBelowZero(int256 rateScalar);
    error MarketScalarRootBelowZero(int256 scalarRoot);
    error MarketProportionTooHigh(int256 proportion, int256 maxProportion);

    error OracleUninitialized();
    error OracleTargetTooOld(uint32 target, uint32 oldest);
    error OracleZeroCardinality();

    error MarketFactoryExpiredPt();
    error MarketFactoryInvalidPt();
    error MarketFactoryMarketExists();

    error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
    error MarketFactoryOverriddenFeeTooHigh(uint80 overriddenFee, uint256 marketLnFeeRateRoot);
    error MarketFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent);
    error MarketFactoryZeroTreasury();
    error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor);
    error MFNotPendleMarket(address addr);

    // ROUTER
    error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
    error RouterInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
    error RouterInsufficientPtOut(uint256 actualPtOut, uint256 requiredPtOut);
    error RouterInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut);
    error RouterInsufficientPYOut(uint256 actualPYOut, uint256 requiredPYOut);
    error RouterInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
    error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay);
    error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay);
    error RouterNotAllSyUsed(uint256 netSyDesired, uint256 netSyUsed);

    error RouterTimeRangeZero();
    error RouterCallbackNotPendleMarket(address caller);
    error RouterInvalidAction(bytes4 selector);
    error RouterInvalidFacet(address facet);

    error RouterKyberSwapDataZero();

    error SimulationResults(bool success, bytes res);

    // YIELD CONTRACT
    error YCExpired();
    error YCNotExpired();
    error YieldContractInsufficientSy(uint256 actualSy, uint256 requiredSy);
    error YCNothingToRedeem();
    error YCPostExpiryDataNotSet();
    error YCNoFloatingSy();

    // YieldFactory
    error YCFactoryInvalidExpiry();
    error YCFactoryYieldContractExisted();
    error YCFactoryZeroExpiryDivisor();
    error YCFactoryZeroTreasury();
    error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate);
    error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate);

    // SY
    error SYInvalidTokenIn(address token);
    error SYInvalidTokenOut(address token);
    error SYZeroDeposit();
    error SYZeroRedeem();
    error SYInsufficientSharesOut(uint256 actualSharesOut, uint256 requiredSharesOut);
    error SYInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);

    // SY-specific
    error SYQiTokenMintFailed(uint256 errCode);
    error SYQiTokenRedeemFailed(uint256 errCode);
    error SYQiTokenRedeemRewardsFailed(uint256 rewardAccruedType0, uint256 rewardAccruedType1);
    error SYQiTokenBorrowRateTooHigh(uint256 borrowRate, uint256 borrowRateMax);

    error SYCurveInvalidPid();
    error SYCurve3crvPoolNotFound();

    error SYApeDepositAmountTooSmall(uint256 amountDeposited);
    error SYBalancerInvalidPid();
    error SYInvalidRewardToken(address token);

    error SYStargateRedeemCapExceeded(uint256 amountLpDesired, uint256 amountLpRedeemable);

    error SYBalancerReentrancy();

    error NotFromTrustedRemote(uint16 srcChainId, bytes path);

    error ApxETHNotEnoughBuffer();

    // Liquidity Mining
    error VCInactivePool(address pool);
    error VCPoolAlreadyActive(address pool);
    error VCZeroVePendle(address user);
    error VCExceededMaxWeight(uint256 totalWeight, uint256 maxWeight);
    error VCEpochNotFinalized(uint256 wTime);
    error VCPoolAlreadyAddAndRemoved(address pool);

    error VEInvalidNewExpiry(uint256 newExpiry);
    error VEExceededMaxLockTime();
    error VEInsufficientLockTime();
    error VENotAllowedReduceExpiry();
    error VEZeroAmountLocked();
    error VEPositionNotExpired();
    error VEZeroPosition();
    error VEZeroSlope(uint128 bias, uint128 slope);
    error VEReceiveOldSupply(uint256 msgTime);

    error GCNotPendleMarket(address caller);
    error GCNotVotingController(address caller);

    error InvalidWTime(uint256 wTime);
    error ExpiryInThePast(uint256 expiry);
    error ChainNotSupported(uint256 chainId);

    error FDTotalAmountFundedNotMatch(uint256 actualTotalAmount, uint256 expectedTotalAmount);
    error FDEpochLengthMismatch();
    error FDInvalidPool(address pool);
    error FDPoolAlreadyExists(address pool);
    error FDInvalidNewFinishedEpoch(uint256 oldFinishedEpoch, uint256 newFinishedEpoch);
    error FDInvalidStartEpoch(uint256 startEpoch);
    error FDInvalidWTimeFund(uint256 lastFunded, uint256 wTime);
    error FDFutureFunding(uint256 lastFunded, uint256 currentWTime);

    error BDInvalidEpoch(uint256 epoch, uint256 startTime);

    // Cross-Chain
    error MsgNotFromSendEndpoint(uint16 srcChainId, bytes path);
    error MsgNotFromReceiveEndpoint(address sender);
    error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee);
    error ApproxDstExecutionGasNotSet();
    error InvalidRetryData();

    // GENERIC MSG
    error ArrayLengthMismatch();
    error ArrayEmpty();
    error ArrayOutOfBounds();
    error ZeroAddress();
    error FailedToSendEther();
    error InvalidMerkleProof();

    error OnlyLayerZeroEndpoint();
    error OnlyYT();
    error OnlyYCFactory();
    error OnlyWhitelisted();

    // Swap Aggregator
    error SAInsufficientTokenIn(address tokenIn, uint256 amountExpected, uint256 amountActual);
    error UnsupportedSelector(uint256 aggregatorType, bytes4 selector);
}

File 11 of 34 : LogExpMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
// Software.

// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pragma solidity ^0.8.0;

/* solhint-disable */

/**
 * @dev Exponentiation and logarithm functions for 18 decimal fixed point numbers (both base and exponent/argument).
 *
 * Exponentiation and logarithm with arbitrary bases (x^y and log_x(y)) are implemented by conversion to natural
 * exponentiation and logarithm (where the base is Euler's number).
 *
 * @author Fernando Martinelli - @fernandomartinelli
 * @author Sergio Yuhjtman - @sergioyuhjtman
 * @author Daniel Fernandez - @dmf7z
 */
library LogExpMath {
    // All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying
    // two numbers, and multiply by ONE when dividing them.

    // All arguments and return values are 18 decimal fixed point numbers.
    int256 constant ONE_18 = 1e18;

    // Internally, intermediate values are computed with higher precision as 20 decimal fixed point numbers, and in the
    // case of ln36, 36 decimals.
    int256 constant ONE_20 = 1e20;
    int256 constant ONE_36 = 1e36;

    // The domain of natural exponentiation is bound by the word size and number of decimals used.
    //
    // Because internally the result will be stored using 20 decimals, the largest possible result is
    // (2^255 - 1) / 10^20, which makes the largest exponent ln((2^255 - 1) / 10^20) = 130.700829182905140221.
    // The smallest possible result is 10^(-18), which makes largest negative argument
    // ln(10^(-18)) = -41.446531673892822312.
    // We use 130.0 and -41.0 to have some safety margin.
    int256 constant MAX_NATURAL_EXPONENT = 130e18;
    int256 constant MIN_NATURAL_EXPONENT = -41e18;

    // Bounds for ln_36's argument. Both ln(0.9) and ln(1.1) can be represented with 36 decimal places in a fixed point
    // 256 bit integer.
    int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17;
    int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17;

    uint256 constant MILD_EXPONENT_BOUND = 2 ** 254 / uint256(ONE_20);

    // 18 decimal constants
    int256 constant x0 = 128000000000000000000; // 2ˆ7
    int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)
    int256 constant x1 = 64000000000000000000; // 2ˆ6
    int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)

    // 20 decimal constants
    int256 constant x2 = 3200000000000000000000; // 2ˆ5
    int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2)
    int256 constant x3 = 1600000000000000000000; // 2ˆ4
    int256 constant a3 = 888611052050787263676000000; // eˆ(x3)
    int256 constant x4 = 800000000000000000000; // 2ˆ3
    int256 constant a4 = 298095798704172827474000; // eˆ(x4)
    int256 constant x5 = 400000000000000000000; // 2ˆ2
    int256 constant a5 = 5459815003314423907810; // eˆ(x5)
    int256 constant x6 = 200000000000000000000; // 2ˆ1
    int256 constant a6 = 738905609893065022723; // eˆ(x6)
    int256 constant x7 = 100000000000000000000; // 2ˆ0
    int256 constant a7 = 271828182845904523536; // eˆ(x7)
    int256 constant x8 = 50000000000000000000; // 2ˆ-1
    int256 constant a8 = 164872127070012814685; // eˆ(x8)
    int256 constant x9 = 25000000000000000000; // 2ˆ-2
    int256 constant a9 = 128402541668774148407; // eˆ(x9)
    int256 constant x10 = 12500000000000000000; // 2ˆ-3
    int256 constant a10 = 113314845306682631683; // eˆ(x10)
    int256 constant x11 = 6250000000000000000; // 2ˆ-4
    int256 constant a11 = 106449445891785942956; // eˆ(x11)

    /**
     * @dev Natural exponentiation (e^x) with signed 18 decimal fixed point exponent.
     *
     * Reverts if `x` is smaller than MIN_NATURAL_EXPONENT, or larger than `MAX_NATURAL_EXPONENT`.
     */
    function exp(int256 x) internal pure returns (int256) {
        unchecked {
            require(x >= MIN_NATURAL_EXPONENT && x <= MAX_NATURAL_EXPONENT, "Invalid exponent");

            if (x < 0) {
                // We only handle positive exponents: e^(-x) is computed as 1 / e^x. We can safely make x positive since it
                // fits in the signed 256 bit range (as it is larger than MIN_NATURAL_EXPONENT).
                // Fixed point division requires multiplying by ONE_18.
                return ((ONE_18 * ONE_18) / exp(-x));
            }

            // First, we use the fact that e^(x+y) = e^x * e^y to decompose x into a sum of powers of two, which we call x_n,
            // where x_n == 2^(7 - n), and e^x_n = a_n has been precomputed. We choose the first x_n, x0, to equal 2^7
            // because all larger powers are larger than MAX_NATURAL_EXPONENT, and therefore not present in the
            // decomposition.
            // At the end of this process we will have the product of all e^x_n = a_n that apply, and the remainder of this
            // decomposition, which will be lower than the smallest x_n.
            // exp(x) = k_0 * a_0 * k_1 * a_1 * ... + k_n * a_n * exp(remainder), where each k_n equals either 0 or 1.
            // We mutate x by subtracting x_n, making it the remainder of the decomposition.

            // The first two a_n (e^(2^7) and e^(2^6)) are too large if stored as 18 decimal numbers, and could cause
            // intermediate overflows. Instead we store them as plain integers, with 0 decimals.
            // Additionally, x0 + x1 is larger than MAX_NATURAL_EXPONENT, which means they will not both be present in the
            // decomposition.

            // For each x_n, we test if that term is present in the decomposition (if x is larger than it), and if so deduct
            // it and compute the accumulated product.

            int256 firstAN;
            if (x >= x0) {
                x -= x0;
                firstAN = a0;
            } else if (x >= x1) {
                x -= x1;
                firstAN = a1;
            } else {
                firstAN = 1; // One with no decimal places
            }

            // We now transform x into a 20 decimal fixed point number, to have enhanced precision when computing the
            // smaller terms.
            x *= 100;

            // `product` is the accumulated product of all a_n (except a0 and a1), which starts at 20 decimal fixed point
            // one. Recall that fixed point multiplication requires dividing by ONE_20.
            int256 product = ONE_20;

            if (x >= x2) {
                x -= x2;
                product = (product * a2) / ONE_20;
            }
            if (x >= x3) {
                x -= x3;
                product = (product * a3) / ONE_20;
            }
            if (x >= x4) {
                x -= x4;
                product = (product * a4) / ONE_20;
            }
            if (x >= x5) {
                x -= x5;
                product = (product * a5) / ONE_20;
            }
            if (x >= x6) {
                x -= x6;
                product = (product * a6) / ONE_20;
            }
            if (x >= x7) {
                x -= x7;
                product = (product * a7) / ONE_20;
            }
            if (x >= x8) {
                x -= x8;
                product = (product * a8) / ONE_20;
            }
            if (x >= x9) {
                x -= x9;
                product = (product * a9) / ONE_20;
            }

            // x10 and x11 are unnecessary here since we have high enough precision already.

            // Now we need to compute e^x, where x is small (in particular, it is smaller than x9). We use the Taylor series
            // expansion for e^x: 1 + x + (x^2 / 2!) + (x^3 / 3!) + ... + (x^n / n!).

            int256 seriesSum = ONE_20; // The initial one in the sum, with 20 decimal places.
            int256 term; // Each term in the sum, where the nth term is (x^n / n!).

            // The first term is simply x.
            term = x;
            seriesSum += term;

            // Each term (x^n / n!) equals the previous one times x, divided by n. Since x is a fixed point number,
            // multiplying by it requires dividing by ONE_20, but dividing by the non-fixed point n values does not.

            term = ((term * x) / ONE_20) / 2;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 3;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 4;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 5;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 6;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 7;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 8;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 9;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 10;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 11;
            seriesSum += term;

            term = ((term * x) / ONE_20) / 12;
            seriesSum += term;

            // 12 Taylor terms are sufficient for 18 decimal precision.

            // We now have the first a_n (with no decimals), and the product of all other a_n present, and the Taylor
            // approximation of the exponentiation of the remainder (both with 20 decimals). All that remains is to multiply
            // all three (one 20 decimal fixed point multiplication, dividing by ONE_20, and one integer multiplication),
            // and then drop two digits to return an 18 decimal value.

            return (((product * seriesSum) / ONE_20) * firstAN) / 100;
        }
    }

    /**
     * @dev Natural logarithm (ln(a)) with signed 18 decimal fixed point argument.
     */
    function ln(int256 a) internal pure returns (int256) {
        unchecked {
            // The real natural logarithm is not defined for negative numbers or zero.
            require(a > 0, "out of bounds");
            if (LN_36_LOWER_BOUND < a && a < LN_36_UPPER_BOUND) {
                return _ln_36(a) / ONE_18;
            } else {
                return _ln(a);
            }
        }
    }

    /**
     * @dev Exponentiation (x^y) with unsigned 18 decimal fixed point base and exponent.
     *
     * Reverts if ln(x) * y is smaller than `MIN_NATURAL_EXPONENT`, or larger than `MAX_NATURAL_EXPONENT`.
     */
    function pow(uint256 x, uint256 y) internal pure returns (uint256) {
        unchecked {
            if (y == 0) {
                // We solve the 0^0 indetermination by making it equal one.
                return uint256(ONE_18);
            }

            if (x == 0) {
                return 0;
            }

            // Instead of computing x^y directly, we instead rely on the properties of logarithms and exponentiation to
            // arrive at that r`esult. In particular, exp(ln(x)) = x, and ln(x^y) = y * ln(x). This means
            // x^y = exp(y * ln(x)).

            // The ln function takes a signed value, so we need to make sure x fits in the signed 256 bit range.
            require(x < 2 ** 255, "x out of bounds");
            int256 x_int256 = int256(x);

            // We will compute y * ln(x) in a single step. Depending on the value of x, we can either use ln or ln_36. In
            // both cases, we leave the division by ONE_18 (due to fixed point multiplication) to the end.

            // This prevents y * ln(x) from overflowing, and at the same time guarantees y fits in the signed 256 bit range.
            require(y < MILD_EXPONENT_BOUND, "y out of bounds");
            int256 y_int256 = int256(y);

            int256 logx_times_y;
            if (LN_36_LOWER_BOUND < x_int256 && x_int256 < LN_36_UPPER_BOUND) {
                int256 ln_36_x = _ln_36(x_int256);

                // ln_36_x has 36 decimal places, so multiplying by y_int256 isn't as straightforward, since we can't just
                // bring y_int256 to 36 decimal places, as it might overflow. Instead, we perform two 18 decimal
                // multiplications and add the results: one with the first 18 decimals of ln_36_x, and one with the
                // (downscaled) last 18 decimals.
                logx_times_y = ((ln_36_x / ONE_18) * y_int256 + ((ln_36_x % ONE_18) * y_int256) / ONE_18);
            } else {
                logx_times_y = _ln(x_int256) * y_int256;
            }
            logx_times_y /= ONE_18;

            // Finally, we compute exp(y * ln(x)) to arrive at x^y
            require(
                MIN_NATURAL_EXPONENT <= logx_times_y && logx_times_y <= MAX_NATURAL_EXPONENT,
                "product out of bounds"
            );

            return uint256(exp(logx_times_y));
        }
    }

    /**
     * @dev Internal natural logarithm (ln(a)) with signed 18 decimal fixed point argument.
     */
    function _ln(int256 a) private pure returns (int256) {
        unchecked {
            if (a < ONE_18) {
                // Since ln(a^k) = k * ln(a), we can compute ln(a) as ln(a) = ln((1/a)^(-1)) = - ln((1/a)). If a is less
                // than one, 1/a will be greater than one, and this if statement will not be entered in the recursive call.
                // Fixed point division requires multiplying by ONE_18.
                return (-_ln((ONE_18 * ONE_18) / a));
            }

            // First, we use the fact that ln^(a * b) = ln(a) + ln(b) to decompose ln(a) into a sum of powers of two, which
            // we call x_n, where x_n == 2^(7 - n), which are the natural logarithm of precomputed quantities a_n (that is,
            // ln(a_n) = x_n). We choose the first x_n, x0, to equal 2^7 because the exponential of all larger powers cannot
            // be represented as 18 fixed point decimal numbers in 256 bits, and are therefore larger than a.
            // At the end of this process we will have the sum of all x_n = ln(a_n) that apply, and the remainder of this
            // decomposition, which will be lower than the smallest a_n.
            // ln(a) = k_0 * x_0 + k_1 * x_1 + ... + k_n * x_n + ln(remainder), where each k_n equals either 0 or 1.
            // We mutate a by subtracting a_n, making it the remainder of the decomposition.

            // For reasons related to how `exp` works, the first two a_n (e^(2^7) and e^(2^6)) are not stored as fixed point
            // numbers with 18 decimals, but instead as plain integers with 0 decimals, so we need to multiply them by
            // ONE_18 to convert them to fixed point.
            // For each a_n, we test if that term is present in the decomposition (if a is larger than it), and if so divide
            // by it and compute the accumulated sum.

            int256 sum = 0;
            if (a >= a0 * ONE_18) {
                a /= a0; // Integer, not fixed point division
                sum += x0;
            }

            if (a >= a1 * ONE_18) {
                a /= a1; // Integer, not fixed point division
                sum += x1;
            }

            // All other a_n and x_n are stored as 20 digit fixed point numbers, so we convert the sum and a to this format.
            sum *= 100;
            a *= 100;

            // Because further a_n are  20 digit fixed point numbers, we multiply by ONE_20 when dividing by them.

            if (a >= a2) {
                a = (a * ONE_20) / a2;
                sum += x2;
            }

            if (a >= a3) {
                a = (a * ONE_20) / a3;
                sum += x3;
            }

            if (a >= a4) {
                a = (a * ONE_20) / a4;
                sum += x4;
            }

            if (a >= a5) {
                a = (a * ONE_20) / a5;
                sum += x5;
            }

            if (a >= a6) {
                a = (a * ONE_20) / a6;
                sum += x6;
            }

            if (a >= a7) {
                a = (a * ONE_20) / a7;
                sum += x7;
            }

            if (a >= a8) {
                a = (a * ONE_20) / a8;
                sum += x8;
            }

            if (a >= a9) {
                a = (a * ONE_20) / a9;
                sum += x9;
            }

            if (a >= a10) {
                a = (a * ONE_20) / a10;
                sum += x10;
            }

            if (a >= a11) {
                a = (a * ONE_20) / a11;
                sum += x11;
            }

            // a is now a small number (smaller than a_11, which roughly equals 1.06). This means we can use a Taylor series
            // that converges rapidly for values of `a` close to one - the same one used in ln_36.
            // Let z = (a - 1) / (a + 1).
            // ln(a) = 2 * (z + z^3 / 3 + z^5 / 5 + z^7 / 7 + ... + z^(2 * n + 1) / (2 * n + 1))

            // Recall that 20 digit fixed point division requires multiplying by ONE_20, and multiplication requires
            // division by ONE_20.
            int256 z = ((a - ONE_20) * ONE_20) / (a + ONE_20);
            int256 z_squared = (z * z) / ONE_20;

            // num is the numerator of the series: the z^(2 * n + 1) term
            int256 num = z;

            // seriesSum holds the accumulated sum of each term in the series, starting with the initial z
            int256 seriesSum = num;

            // In each step, the numerator is multiplied by z^2
            num = (num * z_squared) / ONE_20;
            seriesSum += num / 3;

            num = (num * z_squared) / ONE_20;
            seriesSum += num / 5;

            num = (num * z_squared) / ONE_20;
            seriesSum += num / 7;

            num = (num * z_squared) / ONE_20;
            seriesSum += num / 9;

            num = (num * z_squared) / ONE_20;
            seriesSum += num / 11;

            // 6 Taylor terms are sufficient for 36 decimal precision.

            // Finally, we multiply by 2 (non fixed point) to compute ln(remainder)
            seriesSum *= 2;

            // We now have the sum of all x_n present, and the Taylor approximation of the logarithm of the remainder (both
            // with 20 decimals). All that remains is to sum these two, and then drop two digits to return a 18 decimal
            // value.

            return (sum + seriesSum) / 100;
        }
    }

    /**
     * @dev Intrnal high precision (36 decimal places) natural logarithm (ln(x)) with signed 18 decimal fixed point argument,
     * for x close to one.
     *
     * Should only be used if x is between LN_36_LOWER_BOUND and LN_36_UPPER_BOUND.
     */
    function _ln_36(int256 x) private pure returns (int256) {
        unchecked {
            // Since ln(1) = 0, a value of x close to one will yield a very small result, which makes using 36 digits
            // worthwhile.

            // First, we transform x to a 36 digit fixed point value.
            x *= ONE_18;

            // We will use the following Taylor expansion, which converges very rapidly. Let z = (x - 1) / (x + 1).
            // ln(x) = 2 * (z + z^3 / 3 + z^5 / 5 + z^7 / 7 + ... + z^(2 * n + 1) / (2 * n + 1))

            // Recall that 36 digit fixed point division requires multiplying by ONE_36, and multiplication requires
            // division by ONE_36.
            int256 z = ((x - ONE_36) * ONE_36) / (x + ONE_36);
            int256 z_squared = (z * z) / ONE_36;

            // num is the numerator of the series: the z^(2 * n + 1) term
            int256 num = z;

            // seriesSum holds the accumulated sum of each term in the series, starting with the initial z
            int256 seriesSum = num;

            // In each step, the numerator is multiplied by z^2
            num = (num * z_squared) / ONE_36;
            seriesSum += num / 3;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 5;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 7;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 9;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 11;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 13;

            num = (num * z_squared) / ONE_36;
            seriesSum += num / 15;

            // 8 Taylor terms are sufficient for 36 decimal precision.

            // All that remains is multiplying by 2 (non fixed point).
            return seriesSum * 2;
        }
    }
}

File 12 of 34 : PMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

/* solhint-disable private-vars-leading-underscore, reason-string */

library PMath {
    uint256 internal constant ONE = 1e18; // 18 decimal places
    int256 internal constant IONE = 1e18; // 18 decimal places

    function subMax0(uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            return (a >= b ? a - b : 0);
        }
    }

    function subNoNeg(int256 a, int256 b) internal pure returns (int256) {
        require(a >= b, "negative");
        return a - b; // no unchecked since if b is very negative, a - b might overflow
    }

    function mulDown(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 product = a * b;
        unchecked {
            return product / ONE;
        }
    }

    function mulDown(int256 a, int256 b) internal pure returns (int256) {
        int256 product = a * b;
        unchecked {
            return product / IONE;
        }
    }

    function divDown(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 aInflated = a * ONE;
        unchecked {
            return aInflated / b;
        }
    }

    function divDown(int256 a, int256 b) internal pure returns (int256) {
        int256 aInflated = a * IONE;
        unchecked {
            return aInflated / b;
        }
    }

    function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) {
        return (a + b - 1) / b;
    }

    function rawDivUp(int256 a, int256 b) internal pure returns (int256) {
        return (a + b - 1) / b;
    }

    function slipUp(uint256 a, uint256 factor) internal pure returns (uint256) {
        return mulDown(a, ONE + factor);
    }

    function slipDown(uint256 a, uint256 factor) internal pure returns (uint256) {
        return mulDown(a, ONE - factor);
    }

    // @author Uniswap
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    function square(uint256 x) internal pure returns (uint256) {
        return x * x;
    }

    function squareDown(uint256 x) internal pure returns (uint256) {
        return mulDown(x, x);
    }

    function abs(int256 x) internal pure returns (uint256) {
        return uint256(x > 0 ? x : -x);
    }

    function neg(int256 x) internal pure returns (int256) {
        return x * (-1);
    }

    function neg(uint256 x) internal pure returns (int256) {
        return Int(x) * (-1);
    }

    function max(uint256 x, uint256 y) internal pure returns (uint256) {
        return (x > y ? x : y);
    }

    function max(int256 x, int256 y) internal pure returns (int256) {
        return (x > y ? x : y);
    }

    function min(uint256 x, uint256 y) internal pure returns (uint256) {
        return (x < y ? x : y);
    }

    function min(int256 x, int256 y) internal pure returns (int256) {
        return (x < y ? x : y);
    }

    /*///////////////////////////////////////////////////////////////
                               SIGNED CASTS
    //////////////////////////////////////////////////////////////*/

    function Int(uint256 x) internal pure returns (int256) {
        require(x <= uint256(type(int256).max));
        return int256(x);
    }

    function Int128(int256 x) internal pure returns (int128) {
        require(type(int128).min <= x && x <= type(int128).max);
        return int128(x);
    }

    function Int128(uint256 x) internal pure returns (int128) {
        return Int128(Int(x));
    }

    /*///////////////////////////////////////////////////////////////
                               UNSIGNED CASTS
    //////////////////////////////////////////////////////////////*/

    function Uint(int256 x) internal pure returns (uint256) {
        require(x >= 0);
        return uint256(x);
    }

    function Uint32(uint256 x) internal pure returns (uint32) {
        require(x <= type(uint32).max);
        return uint32(x);
    }

    function Uint64(uint256 x) internal pure returns (uint64) {
        require(x <= type(uint64).max);
        return uint64(x);
    }

    function Uint112(uint256 x) internal pure returns (uint112) {
        require(x <= type(uint112).max);
        return uint112(x);
    }

    function Uint96(uint256 x) internal pure returns (uint96) {
        require(x <= type(uint96).max);
        return uint96(x);
    }

    function Uint128(uint256 x) internal pure returns (uint128) {
        require(x <= type(uint128).max);
        return uint128(x);
    }

    function Uint192(uint256 x) internal pure returns (uint192) {
        require(x <= type(uint192).max);
        return uint192(x);
    }

    function isAApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps);
    }

    function isAGreaterApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return a >= b && a <= mulDown(b, ONE + eps);
    }

    function isASmallerApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return a <= b && a >= mulDown(b, ONE - eps);
    }
}

File 13 of 34 : MiniHelpers.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

library MiniHelpers {
    function isCurrentlyExpired(uint256 expiry) internal view returns (bool) {
        return (expiry <= block.timestamp);
    }

    function isExpired(uint256 expiry, uint256 blockTime) internal pure returns (bool) {
        return (expiry <= blockTime);
    }

    function isTimeInThePast(uint256 timestamp) internal view returns (bool) {
        return (timestamp <= block.timestamp); // same definition as isCurrentlyExpired
    }
}

File 14 of 34 : TokenHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../interfaces/IWETH.sol";

abstract contract TokenHelper {
    using SafeERC20 for IERC20;

    address internal constant NATIVE = address(0);
    uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval

    function _transferIn(address token, address from, uint256 amount) internal {
        if (token == NATIVE) require(msg.value == amount, "eth mismatch");
        else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount);
    }

    function _transferFrom(IERC20 token, address from, address to, uint256 amount) internal {
        if (amount != 0) token.safeTransferFrom(from, to, amount);
    }

    function _transferOut(address token, address to, uint256 amount) internal {
        if (amount == 0) return;
        if (token == NATIVE) {
            (bool success, ) = to.call{value: amount}("");
            require(success, "eth send failed");
        } else {
            IERC20(token).safeTransfer(to, amount);
        }
    }

    function _transferOut(address[] memory tokens, address to, uint256[] memory amounts) internal {
        uint256 numTokens = tokens.length;
        require(numTokens == amounts.length, "length mismatch");
        for (uint256 i = 0; i < numTokens; ) {
            _transferOut(tokens[i], to, amounts[i]);
            unchecked {
                i++;
            }
        }
    }

    function _selfBalance(address token) internal view returns (uint256) {
        return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this));
    }

    function _selfBalance(IERC20 token) internal view returns (uint256) {
        return token.balanceOf(address(this));
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it
    function _safeApprove(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "Safe Approve");
    }

    function _safeApproveInf(address token, address to) internal {
        if (token == NATIVE) return;
        if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) {
            _safeApprove(token, to, 0);
            _safeApprove(token, to, type(uint256).max);
        }
    }

    function _wrap_unwrap_ETH(address tokenIn, address tokenOut, uint256 netTokenIn) internal {
        if (tokenIn == NATIVE) IWETH(tokenOut).deposit{value: netTokenIn}();
        else IWETH(tokenIn).withdraw(netTokenIn);
    }
}

File 15 of 34 : MarketMathCore.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "../libraries/math/PMath.sol";
import "../libraries/math/LogExpMath.sol";

import "../StandardizedYield/PYIndex.sol";
import "../libraries/MiniHelpers.sol";
import "../libraries/Errors.sol";

struct MarketState {
    int256 totalPt;
    int256 totalSy;
    int256 totalLp;
    address treasury;
    /// immutable variables ///
    int256 scalarRoot;
    uint256 expiry;
    /// fee data ///
    uint256 lnFeeRateRoot;
    uint256 reserveFeePercent; // base 100
    /// last trade data ///
    uint256 lastLnImpliedRate;
}

// params that are expensive to compute, therefore we pre-compute them
struct MarketPreCompute {
    int256 rateScalar;
    int256 totalAsset;
    int256 rateAnchor;
    int256 feeRate;
}

// solhint-disable ordering
library MarketMathCore {
    using PMath for uint256;
    using PMath for int256;
    using LogExpMath for int256;
    using PYIndexLib for PYIndex;

    int256 internal constant MINIMUM_LIQUIDITY = 10 ** 3;
    int256 internal constant PERCENTAGE_DECIMALS = 100;
    uint256 internal constant DAY = 86400;
    uint256 internal constant IMPLIED_RATE_TIME = 365 * DAY;

    int256 internal constant MAX_MARKET_PROPORTION = (1e18 * 96) / 100;

    using PMath for uint256;
    using PMath for int256;

    /*///////////////////////////////////////////////////////////////
                UINT FUNCTIONS TO PROXY TO CORE FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function addLiquidity(
        MarketState memory market,
        uint256 syDesired,
        uint256 ptDesired,
        uint256 blockTime
    ) internal pure returns (uint256 lpToReserve, uint256 lpToAccount, uint256 syUsed, uint256 ptUsed) {
        (int256 _lpToReserve, int256 _lpToAccount, int256 _syUsed, int256 _ptUsed) = addLiquidityCore(
            market,
            syDesired.Int(),
            ptDesired.Int(),
            blockTime
        );

        lpToReserve = _lpToReserve.Uint();
        lpToAccount = _lpToAccount.Uint();
        syUsed = _syUsed.Uint();
        ptUsed = _ptUsed.Uint();
    }

    function removeLiquidity(
        MarketState memory market,
        uint256 lpToRemove
    ) internal pure returns (uint256 netSyToAccount, uint256 netPtToAccount) {
        (int256 _syToAccount, int256 _ptToAccount) = removeLiquidityCore(market, lpToRemove.Int());

        netSyToAccount = _syToAccount.Uint();
        netPtToAccount = _ptToAccount.Uint();
    }

    function swapExactPtForSy(
        MarketState memory market,
        PYIndex index,
        uint256 exactPtToMarket,
        uint256 blockTime
    ) internal pure returns (uint256 netSyToAccount, uint256 netSyFee, uint256 netSyToReserve) {
        (int256 _netSyToAccount, int256 _netSyFee, int256 _netSyToReserve) = executeTradeCore(
            market,
            index,
            exactPtToMarket.neg(),
            blockTime
        );

        netSyToAccount = _netSyToAccount.Uint();
        netSyFee = _netSyFee.Uint();
        netSyToReserve = _netSyToReserve.Uint();
    }

    function swapSyForExactPt(
        MarketState memory market,
        PYIndex index,
        uint256 exactPtToAccount,
        uint256 blockTime
    ) internal pure returns (uint256 netSyToMarket, uint256 netSyFee, uint256 netSyToReserve) {
        (int256 _netSyToAccount, int256 _netSyFee, int256 _netSyToReserve) = executeTradeCore(
            market,
            index,
            exactPtToAccount.Int(),
            blockTime
        );

        netSyToMarket = _netSyToAccount.neg().Uint();
        netSyFee = _netSyFee.Uint();
        netSyToReserve = _netSyToReserve.Uint();
    }

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

    function addLiquidityCore(
        MarketState memory market,
        int256 syDesired,
        int256 ptDesired,
        uint256 blockTime
    ) internal pure returns (int256 lpToReserve, int256 lpToAccount, int256 syUsed, int256 ptUsed) {
        /// ------------------------------------------------------------
        /// CHECKS
        /// ------------------------------------------------------------
        if (syDesired == 0 || ptDesired == 0) revert Errors.MarketZeroAmountsInput();
        if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();

        /// ------------------------------------------------------------
        /// MATH
        /// ------------------------------------------------------------
        if (market.totalLp == 0) {
            lpToAccount = PMath.sqrt((syDesired * ptDesired).Uint()).Int() - MINIMUM_LIQUIDITY;
            lpToReserve = MINIMUM_LIQUIDITY;
            syUsed = syDesired;
            ptUsed = ptDesired;
        } else {
            int256 netLpByPt = (ptDesired * market.totalLp) / market.totalPt;
            int256 netLpBySy = (syDesired * market.totalLp) / market.totalSy;
            if (netLpByPt < netLpBySy) {
                lpToAccount = netLpByPt;
                ptUsed = ptDesired;
                syUsed = (market.totalSy * lpToAccount).rawDivUp(market.totalLp);
            } else {
                lpToAccount = netLpBySy;
                syUsed = syDesired;
                ptUsed = (market.totalPt * lpToAccount).rawDivUp(market.totalLp);
            }
        }

        if (lpToAccount <= 0 || syUsed <= 0 || ptUsed <= 0) revert Errors.MarketZeroAmountsOutput();

        /// ------------------------------------------------------------
        /// WRITE
        /// ------------------------------------------------------------
        market.totalSy += syUsed;
        market.totalPt += ptUsed;
        market.totalLp += lpToAccount + lpToReserve;
    }

    function removeLiquidityCore(
        MarketState memory market,
        int256 lpToRemove
    ) internal pure returns (int256 netSyToAccount, int256 netPtToAccount) {
        /// ------------------------------------------------------------
        /// CHECKS
        /// ------------------------------------------------------------
        if (lpToRemove == 0) revert Errors.MarketZeroAmountsInput();

        /// ------------------------------------------------------------
        /// MATH
        /// ------------------------------------------------------------
        netSyToAccount = (lpToRemove * market.totalSy) / market.totalLp;
        netPtToAccount = (lpToRemove * market.totalPt) / market.totalLp;

        if (netSyToAccount == 0 && netPtToAccount == 0) revert Errors.MarketZeroAmountsOutput();

        /// ------------------------------------------------------------
        /// WRITE
        /// ------------------------------------------------------------
        market.totalLp = market.totalLp.subNoNeg(lpToRemove);
        market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
        market.totalSy = market.totalSy.subNoNeg(netSyToAccount);
    }

    function executeTradeCore(
        MarketState memory market,
        PYIndex index,
        int256 netPtToAccount,
        uint256 blockTime
    ) internal pure returns (int256 netSyToAccount, int256 netSyFee, int256 netSyToReserve) {
        /// ------------------------------------------------------------
        /// CHECKS
        /// ------------------------------------------------------------
        if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
        if (market.totalPt <= netPtToAccount)
            revert Errors.MarketInsufficientPtForTrade(market.totalPt, netPtToAccount);

        /// ------------------------------------------------------------
        /// MATH
        /// ------------------------------------------------------------
        MarketPreCompute memory comp = getMarketPreCompute(market, index, blockTime);

        (netSyToAccount, netSyFee, netSyToReserve) = calcTrade(market, comp, index, netPtToAccount);

        /// ------------------------------------------------------------
        /// WRITE
        /// ------------------------------------------------------------
        _setNewMarketStateTrade(market, comp, index, netPtToAccount, netSyToAccount, netSyToReserve, blockTime);
    }

    function getMarketPreCompute(
        MarketState memory market,
        PYIndex index,
        uint256 blockTime
    ) internal pure returns (MarketPreCompute memory res) {
        if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();

        uint256 timeToExpiry = market.expiry - blockTime;

        res.rateScalar = _getRateScalar(market, timeToExpiry);
        res.totalAsset = index.syToAsset(market.totalSy);

        if (market.totalPt == 0 || res.totalAsset == 0)
            revert Errors.MarketZeroTotalPtOrTotalAsset(market.totalPt, res.totalAsset);

        res.rateAnchor = _getRateAnchor(
            market.totalPt,
            market.lastLnImpliedRate,
            res.totalAsset,
            res.rateScalar,
            timeToExpiry
        );
        res.feeRate = _getExchangeRateFromImpliedRate(market.lnFeeRateRoot, timeToExpiry);
    }

    function calcTrade(
        MarketState memory market,
        MarketPreCompute memory comp,
        PYIndex index,
        int256 netPtToAccount
    ) internal pure returns (int256 netSyToAccount, int256 netSyFee, int256 netSyToReserve) {
        int256 preFeeExchangeRate = _getExchangeRate(
            market.totalPt,
            comp.totalAsset,
            comp.rateScalar,
            comp.rateAnchor,
            netPtToAccount
        );

        int256 preFeeAssetToAccount = netPtToAccount.divDown(preFeeExchangeRate).neg();
        int256 fee = comp.feeRate;

        if (netPtToAccount > 0) {
            int256 postFeeExchangeRate = preFeeExchangeRate.divDown(fee);
            if (postFeeExchangeRate < PMath.IONE) revert Errors.MarketExchangeRateBelowOne(postFeeExchangeRate);

            fee = preFeeAssetToAccount.mulDown(PMath.IONE - fee);
        } else {
            fee = ((preFeeAssetToAccount * (PMath.IONE - fee)) / fee).neg();
        }

        int256 netAssetToReserve = (fee * market.reserveFeePercent.Int()) / PERCENTAGE_DECIMALS;
        int256 netAssetToAccount = preFeeAssetToAccount - fee;

        netSyToAccount = netAssetToAccount < 0
            ? index.assetToSyUp(netAssetToAccount)
            : index.assetToSy(netAssetToAccount);
        netSyFee = index.assetToSy(fee);
        netSyToReserve = index.assetToSy(netAssetToReserve);
    }

    function _setNewMarketStateTrade(
        MarketState memory market,
        MarketPreCompute memory comp,
        PYIndex index,
        int256 netPtToAccount,
        int256 netSyToAccount,
        int256 netSyToReserve,
        uint256 blockTime
    ) internal pure {
        uint256 timeToExpiry = market.expiry - blockTime;

        market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
        market.totalSy = market.totalSy.subNoNeg(netSyToAccount + netSyToReserve);

        market.lastLnImpliedRate = _getLnImpliedRate(
            market.totalPt,
            index.syToAsset(market.totalSy),
            comp.rateScalar,
            comp.rateAnchor,
            timeToExpiry
        );

        if (market.lastLnImpliedRate == 0) revert Errors.MarketZeroLnImpliedRate();
    }

    function _getRateAnchor(
        int256 totalPt,
        uint256 lastLnImpliedRate,
        int256 totalAsset,
        int256 rateScalar,
        uint256 timeToExpiry
    ) internal pure returns (int256 rateAnchor) {
        int256 newExchangeRate = _getExchangeRateFromImpliedRate(lastLnImpliedRate, timeToExpiry);

        if (newExchangeRate < PMath.IONE) revert Errors.MarketExchangeRateBelowOne(newExchangeRate);

        {
            int256 proportion = totalPt.divDown(totalPt + totalAsset);

            int256 lnProportion = _logProportion(proportion);

            rateAnchor = newExchangeRate - lnProportion.divDown(rateScalar);
        }
    }

    /// @notice Calculates the current market implied rate.
    /// @return lnImpliedRate the implied rate
    function _getLnImpliedRate(
        int256 totalPt,
        int256 totalAsset,
        int256 rateScalar,
        int256 rateAnchor,
        uint256 timeToExpiry
    ) internal pure returns (uint256 lnImpliedRate) {
        // This will check for exchange rates < PMath.IONE
        int256 exchangeRate = _getExchangeRate(totalPt, totalAsset, rateScalar, rateAnchor, 0);

        // exchangeRate >= 1 so its ln >= 0
        uint256 lnRate = exchangeRate.ln().Uint();

        lnImpliedRate = (lnRate * IMPLIED_RATE_TIME) / timeToExpiry;
    }

    /// @notice Converts an implied rate to an exchange rate given a time to expiry. The
    /// formula is E = e^rt
    function _getExchangeRateFromImpliedRate(
        uint256 lnImpliedRate,
        uint256 timeToExpiry
    ) internal pure returns (int256 exchangeRate) {
        uint256 rt = (lnImpliedRate * timeToExpiry) / IMPLIED_RATE_TIME;

        exchangeRate = LogExpMath.exp(rt.Int());
    }

    function _getExchangeRate(
        int256 totalPt,
        int256 totalAsset,
        int256 rateScalar,
        int256 rateAnchor,
        int256 netPtToAccount
    ) internal pure returns (int256 exchangeRate) {
        int256 numerator = totalPt.subNoNeg(netPtToAccount);

        int256 proportion = (numerator.divDown(totalPt + totalAsset));

        if (proportion > MAX_MARKET_PROPORTION)
            revert Errors.MarketProportionTooHigh(proportion, MAX_MARKET_PROPORTION);

        int256 lnProportion = _logProportion(proportion);

        exchangeRate = lnProportion.divDown(rateScalar) + rateAnchor;

        if (exchangeRate < PMath.IONE) revert Errors.MarketExchangeRateBelowOne(exchangeRate);
    }

    function _logProportion(int256 proportion) internal pure returns (int256 res) {
        if (proportion == PMath.IONE) revert Errors.MarketProportionMustNotEqualOne();

        int256 logitP = proportion.divDown(PMath.IONE - proportion);

        res = logitP.ln();
    }

    function _getRateScalar(MarketState memory market, uint256 timeToExpiry) internal pure returns (int256 rateScalar) {
        rateScalar = (market.scalarRoot * IMPLIED_RATE_TIME.Int()) / timeToExpiry.Int();
        if (rateScalar <= 0) revert Errors.MarketRateScalarBelowZero(rateScalar);
    }

    function setInitialLnImpliedRate(
        MarketState memory market,
        PYIndex index,
        int256 initialAnchor,
        uint256 blockTime
    ) internal pure {
        /// ------------------------------------------------------------
        /// CHECKS
        /// ------------------------------------------------------------
        if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();

        /// ------------------------------------------------------------
        /// MATH
        /// ------------------------------------------------------------
        int256 totalAsset = index.syToAsset(market.totalSy);
        uint256 timeToExpiry = market.expiry - blockTime;
        int256 rateScalar = _getRateScalar(market, timeToExpiry);

        /// ------------------------------------------------------------
        /// WRITE
        /// ------------------------------------------------------------
        market.lastLnImpliedRate = _getLnImpliedRate(
            market.totalPt,
            totalAsset,
            rateScalar,
            initialAnchor,
            timeToExpiry
        );
    }
}

File 16 of 34 : OracleLib.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "../libraries/Errors.sol";

/// Adapted from UniswapV3's Oracle

library OracleLib {
    struct Observation {
        uint32 blockTimestamp;
        uint216 lnImpliedRateCumulative;
        bool initialized;
        // 1 SLOT = 256 bits
    }

    function transform(
        Observation memory last,
        uint32 blockTimestamp,
        uint96 lnImpliedRate
    ) public pure returns (Observation memory) {
        return
            Observation({
                blockTimestamp: blockTimestamp,
                lnImpliedRateCumulative: last.lnImpliedRateCumulative +
                    uint216(lnImpliedRate) *
                    (blockTimestamp - last.blockTimestamp),
                initialized: true
            });
    }

    function initialize(
        Observation[65535] storage self,
        uint32 time
    ) public returns (uint16 cardinality, uint16 cardinalityNext) {
        self[0] = Observation({blockTimestamp: time, lnImpliedRateCumulative: 0, initialized: true});
        return (1, 1);
    }

    function write(
        Observation[65535] storage self,
        uint16 index,
        uint32 blockTimestamp,
        uint96 lnImpliedRate,
        uint16 cardinality,
        uint16 cardinalityNext
    ) public returns (uint16 indexUpdated, uint16 cardinalityUpdated) {
        Observation memory last = self[index];

        // early return if we've already written an observation this block
        if (last.blockTimestamp == blockTimestamp) return (index, cardinality);

        // if the conditions are right, we can bump the cardinality
        if (cardinalityNext > cardinality && index == (cardinality - 1)) {
            cardinalityUpdated = cardinalityNext;
        } else {
            cardinalityUpdated = cardinality;
        }

        indexUpdated = (index + 1) % cardinalityUpdated;
        self[indexUpdated] = transform(last, blockTimestamp, lnImpliedRate);
    }

    function grow(Observation[65535] storage self, uint16 current, uint16 next) public returns (uint16) {
        if (current == 0) revert Errors.OracleUninitialized();
        // no-op if the passed next value isn't greater than the current next value
        if (next <= current) return current;
        // store in each slot to prevent fresh SSTOREs in swaps
        // this data will not be used because the initialized boolean is still false
        for (uint16 i = current; i != next; ) {
            self[i].blockTimestamp = 1;
            unchecked {
                ++i;
            }
        }
        return next;
    }

    function binarySearch(
        Observation[65535] storage self,
        uint32 target,
        uint16 index,
        uint16 cardinality
    ) public view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {
        uint256 l = (index + 1) % cardinality; // oldest observation
        uint256 r = l + cardinality - 1; // newest observation
        uint256 i;
        while (true) {
            i = (l + r) / 2;

            beforeOrAt = self[i % cardinality];

            // we've landed on an uninitialized observation, keep searching higher (more recently)
            if (!beforeOrAt.initialized) {
                l = i + 1;
                continue;
            }

            atOrAfter = self[(i + 1) % cardinality];

            bool targetAtOrAfter = beforeOrAt.blockTimestamp <= target;

            // check if we've found the answer!
            if (targetAtOrAfter && target <= atOrAfter.blockTimestamp) break;

            if (!targetAtOrAfter) r = i - 1;
            else l = i + 1;
        }
    }

    function getSurroundingObservations(
        Observation[65535] storage self,
        uint32 target,
        uint96 lnImpliedRate,
        uint16 index,
        uint16 cardinality
    ) public view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {
        // optimistically set before to the newest observation
        beforeOrAt = self[index];

        // if the target is chronologically at or after the newest observation, we can early return
        if (beforeOrAt.blockTimestamp <= target) {
            if (beforeOrAt.blockTimestamp == target) {
                // if newest observation equals target, we're in the same block, so we can ignore atOrAfter
                return (beforeOrAt, atOrAfter);
            } else {
                // otherwise, we need to transform
                return (beforeOrAt, transform(beforeOrAt, target, lnImpliedRate));
            }
        }

        // now, set beforeOrAt to the oldest observation
        beforeOrAt = self[(index + 1) % cardinality];
        if (!beforeOrAt.initialized) beforeOrAt = self[0];

        // ensure that the target is chronologically at or after the oldest observation
        if (target < beforeOrAt.blockTimestamp) revert Errors.OracleTargetTooOld(target, beforeOrAt.blockTimestamp);

        // if we've reached this point, we have to binary search
        return binarySearch(self, target, index, cardinality);
    }

    function observeSingle(
        Observation[65535] storage self,
        uint32 time,
        uint32 secondsAgo,
        uint96 lnImpliedRate,
        uint16 index,
        uint16 cardinality
    ) public view returns (uint216 lnImpliedRateCumulative) {
        if (secondsAgo == 0) {
            Observation memory last = self[index];
            if (last.blockTimestamp != time) {
                return transform(last, time, lnImpliedRate).lnImpliedRateCumulative;
            }
            return last.lnImpliedRateCumulative;
        }

        uint32 target = time - secondsAgo;

        (Observation memory beforeOrAt, Observation memory atOrAfter) = getSurroundingObservations(
            self,
            target,
            lnImpliedRate,
            index,
            cardinality
        );

        if (target == beforeOrAt.blockTimestamp) {
            // we're at the left boundary
            return beforeOrAt.lnImpliedRateCumulative;
        } else if (target == atOrAfter.blockTimestamp) {
            // we're at the right boundary
            return atOrAfter.lnImpliedRateCumulative;
        } else {
            // we're in the middle
            return (beforeOrAt.lnImpliedRateCumulative +
                uint216(
                    (uint256(atOrAfter.lnImpliedRateCumulative - beforeOrAt.lnImpliedRateCumulative) *
                        (target - beforeOrAt.blockTimestamp)) / (atOrAfter.blockTimestamp - beforeOrAt.blockTimestamp)
                ));
        }
    }

    function observe(
        Observation[65535] storage self,
        uint32 time,
        uint32[] memory secondsAgos,
        uint96 lnImpliedRate,
        uint16 index,
        uint16 cardinality
    ) public view returns (uint216[] memory lnImpliedRateCumulative) {
        if (cardinality == 0) revert Errors.OracleZeroCardinality();

        lnImpliedRateCumulative = new uint216[](secondsAgos.length);
        for (uint256 i = 0; i < lnImpliedRateCumulative.length; ++i) {
            lnImpliedRateCumulative[i] = observeSingle(self, time, secondsAgos[i], lnImpliedRate, index, cardinality);
        }
    }
}

File 17 of 34 : PendleGauge.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "../../interfaces/IPGauge.sol";
import "../../interfaces/IPVeToken.sol";
import "../../interfaces/IPGaugeController.sol";
import "../../interfaces/IStandardizedYield.sol";

import "../RewardManager/RewardManager.sol";

/**
Invariants to maintain:
- before any changes to active balance, updateAndDistributeRewards() must be called
 */
abstract contract PendleGauge is RewardManager, IPGauge {
    using PMath for uint256;
    using SafeERC20 for IERC20;
    using ArrayLib for address[];

    address private immutable SY;

    uint256 internal constant TOKENLESS_PRODUCTION = 40;

    address internal immutable PENDLE;
    IPVeToken internal immutable vePENDLE;
    address internal immutable gaugeController;

    uint256 public totalActiveSupply;
    mapping(address => uint256) public activeBalance;

    constructor(address _SY, address _vePendle, address _gaugeController) {
        SY = _SY;
        vePENDLE = IPVeToken(_vePendle);
        gaugeController = _gaugeController;
        PENDLE = IPGaugeController(gaugeController).pendle();
    }

    /**
     * @dev Since rewardShares is based on activeBalance, user's activeBalance must be updated AFTER
        rewards is updated
     * @dev It's intended to have user's activeBalance updated when rewards is redeemed
     */
    function _redeemRewards(address user) internal virtual returns (uint256[] memory rewardsOut) {
        _updateAndDistributeRewards(user);
        _updateUserActiveBalance(user);
        rewardsOut = _doTransferOutRewards(user, user);
        emit RedeemRewards(user, rewardsOut);
    }

    function _updateUserActiveBalance(address user) internal virtual {
        _updateUserActiveBalanceForTwo(user, address(0));
    }

    function _updateUserActiveBalanceForTwo(address user1, address user2) internal virtual {
        if (user1 != address(0) && user1 != address(this)) _updateUserActiveBalancePrivate(user1);
        if (user2 != address(0) && user2 != address(this)) _updateUserActiveBalancePrivate(user2);
    }

    /**
     * @dev should only be callable from `_updateUserActiveBalanceForTwo` to guarantee user != address(0) && user != address(this)
     */
    function _updateUserActiveBalancePrivate(address user) private {
        assert(user != address(0) && user != address(this));

        uint256 lpBalance = _stakedBalance(user);
        uint256 veBoostedLpBalance = _calcVeBoostedLpBalance(user, lpBalance);

        uint256 newActiveBalance = PMath.min(veBoostedLpBalance, lpBalance);

        totalActiveSupply = totalActiveSupply - activeBalance[user] + newActiveBalance;
        activeBalance[user] = newActiveBalance;
    }

    function _calcVeBoostedLpBalance(address user, uint256 lpBalance) internal virtual returns (uint256) {
        (uint256 vePendleSupply, uint256 vePendleBalance) = vePENDLE.totalSupplyAndBalanceCurrent(user);
        // Inspired by Curve's Gauge
        uint256 veBoostedLpBalance = (lpBalance * TOKENLESS_PRODUCTION) / 100;
        if (vePendleSupply > 0) {
            veBoostedLpBalance +=
                (((_totalStaked() * vePendleBalance) / vePendleSupply) * (100 - TOKENLESS_PRODUCTION)) /
                100;
        }
        return veBoostedLpBalance;
    }

    function _redeemExternalReward() internal virtual override {
        IStandardizedYield(SY).claimRewards(address(this));
        IPGaugeController(gaugeController).redeemMarketReward();
    }

    function _stakedBalance(address user) internal view virtual returns (uint256);

    function _totalStaked() internal view virtual returns (uint256);

    function _rewardSharesTotal() internal view virtual override returns (uint256) {
        return totalActiveSupply;
    }

    function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
        return activeBalance[user];
    }

    function _getRewardTokens() internal view virtual override returns (address[] memory) {
        address[] memory SYRewards = IStandardizedYield(SY).getRewardTokens();
        if (SYRewards.contains(PENDLE)) return SYRewards;
        return SYRewards.append(PENDLE);
    }

    function _beforeTokenTransfer(address from, address to, uint256) internal virtual {
        _updateAndDistributeRewardsForTwo(from, to);
    }

    function _afterTokenTransfer(address from, address to, uint256) internal virtual {
        _updateUserActiveBalanceForTwo(from, to);
    }
}

File 18 of 34 : RewardManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "./RewardManagerAbstract.sol";

/// NOTE: This RewardManager is used with SY & YTv2 & PendleMarket. For YTv1, it will use RewardManagerAbstract
/// NOTE: RewardManager must not have duplicated rewardTokens
abstract contract RewardManager is RewardManagerAbstract {
    using PMath for uint256;
    using ArrayLib for uint256[];

    uint256 public lastRewardBlock;

    mapping(address => RewardState) public rewardState;

    function _updateRewardIndex()
        internal
        virtual
        override
        returns (address[] memory tokens, uint256[] memory indexes)
    {
        tokens = _getRewardTokens();
        indexes = new uint256[](tokens.length);

        if (tokens.length == 0) return (tokens, indexes);

        if (lastRewardBlock != block.number) {
            // if we have not yet update the index for this block
            lastRewardBlock = block.number;

            uint256 totalShares = _rewardSharesTotal();

            _redeemExternalReward();

            for (uint256 i = 0; i < tokens.length; ++i) {
                address token = tokens[i];

                // the entire token balance of the contract must be the rewards of the contract

                RewardState memory _state = rewardState[token];
                (uint256 lastBalance, uint256 index) = (_state.lastBalance, _state.index);

                uint256 accrued = _selfBalance(tokens[i]) - lastBalance;

                if (index == 0) index = INITIAL_REWARD_INDEX;
                if (totalShares != 0) index += accrued.divDown(totalShares);

                rewardState[token] = RewardState({
                    index: index.Uint128(),
                    lastBalance: (lastBalance + accrued).Uint128()
                });
                indexes[i] = index;
            }
        } else {
            for (uint256 i = 0; i < tokens.length; i++) {
                indexes[i] = rewardState[tokens[i]].index;
            }
        }
    }

    /// @dev this function doesn't need redeemExternal since redeemExternal is bundled in updateRewardIndex
    /// @dev this function also has to update rewardState.lastBalance
    function _doTransferOutRewards(
        address user,
        address receiver
    ) internal virtual override returns (uint256[] memory rewardAmounts) {
        address[] memory tokens = _getRewardTokens();
        rewardAmounts = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            rewardAmounts[i] = userReward[tokens[i]][user].accrued;
            if (rewardAmounts[i] != 0) {
                userReward[tokens[i]][user].accrued = 0;
                rewardState[tokens[i]].lastBalance -= rewardAmounts[i].Uint128();
                _transferOut(tokens[i], receiver, rewardAmounts[i]);
            }
        }
    }

    function _getRewardTokens() internal view virtual returns (address[] memory);

    function _rewardSharesTotal() internal view virtual returns (uint256);
}

File 19 of 34 : RewardManagerAbstract.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "../../interfaces/IRewardManager.sol";

import "../libraries/ArrayLib.sol";
import "../libraries/TokenHelper.sol";
import "../libraries/math/PMath.sol";

import "./RewardManagerAbstract.sol";

/// NOTE: RewardManager must not have duplicated rewardTokens
abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
    using PMath for uint256;

    uint256 internal constant INITIAL_REWARD_INDEX = 1;

    struct RewardState {
        uint128 index;
        uint128 lastBalance;
    }

    struct UserReward {
        uint128 index;
        uint128 accrued;
    }

    // [token] => [user] => (index,accrued)
    mapping(address => mapping(address => UserReward)) public userReward;

    function _updateAndDistributeRewards(address user) internal virtual {
        _updateAndDistributeRewardsForTwo(user, address(0));
    }

    function _updateAndDistributeRewardsForTwo(address user1, address user2) internal virtual {
        (address[] memory tokens, uint256[] memory indexes) = _updateRewardIndex();
        if (tokens.length == 0) return;

        if (user1 != address(0) && user1 != address(this)) _distributeRewardsPrivate(user1, tokens, indexes);
        if (user2 != address(0) && user2 != address(this)) _distributeRewardsPrivate(user2, tokens, indexes);
    }

    // should only be callable from `_updateAndDistributeRewardsForTwo` to guarantee user != address(0) && user != address(this)
    function _distributeRewardsPrivate(address user, address[] memory tokens, uint256[] memory indexes) private {
        assert(user != address(0) && user != address(this));

        uint256 userShares = _rewardSharesUser(user);

        for (uint256 i = 0; i < tokens.length; ++i) {
            address token = tokens[i];
            uint256 index = indexes[i];
            uint256 userIndex = userReward[token][user].index;

            if (userIndex == 0) {
                userIndex = INITIAL_REWARD_INDEX.Uint128();
            }

            if (userIndex == index || index == 0) continue;

            uint256 deltaIndex = index - userIndex;
            uint256 rewardDelta = userShares.mulDown(deltaIndex);
            uint256 rewardAccrued = userReward[token][user].accrued + rewardDelta;

            userReward[token][user] = UserReward({index: index.Uint128(), accrued: rewardAccrued.Uint128()});
        }
    }

    function _updateRewardIndex() internal virtual returns (address[] memory tokens, uint256[] memory indexes);

    function _redeemExternalReward() internal virtual;

    function _doTransferOutRewards(
        address user,
        address receiver
    ) internal virtual returns (uint256[] memory rewardAmounts);

    function _rewardSharesUser(address user) internal view virtual returns (uint256);
}

File 20 of 34 : PYIndex.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../interfaces/IPYieldToken.sol";
import "../../interfaces/IPPrincipalToken.sol";

import "./SYUtils.sol";
import "../libraries/math/PMath.sol";

type PYIndex is uint256;

library PYIndexLib {
    using PMath for uint256;
    using PMath for int256;

    function newIndex(IPYieldToken YT) internal returns (PYIndex) {
        return PYIndex.wrap(YT.pyIndexCurrent());
    }

    function syToAsset(PYIndex index, uint256 syAmount) internal pure returns (uint256) {
        return SYUtils.syToAsset(PYIndex.unwrap(index), syAmount);
    }

    function assetToSy(PYIndex index, uint256 assetAmount) internal pure returns (uint256) {
        return SYUtils.assetToSy(PYIndex.unwrap(index), assetAmount);
    }

    function assetToSyUp(PYIndex index, uint256 assetAmount) internal pure returns (uint256) {
        return SYUtils.assetToSyUp(PYIndex.unwrap(index), assetAmount);
    }

    function syToAssetUp(PYIndex index, uint256 syAmount) internal pure returns (uint256) {
        uint256 _index = PYIndex.unwrap(index);
        return SYUtils.syToAssetUp(_index, syAmount);
    }

    function syToAsset(PYIndex index, int256 syAmount) internal pure returns (int256) {
        int256 sign = syAmount < 0 ? int256(-1) : int256(1);
        return sign * (SYUtils.syToAsset(PYIndex.unwrap(index), syAmount.abs())).Int();
    }

    function assetToSy(PYIndex index, int256 assetAmount) internal pure returns (int256) {
        int256 sign = assetAmount < 0 ? int256(-1) : int256(1);
        return sign * (SYUtils.assetToSy(PYIndex.unwrap(index), assetAmount.abs())).Int();
    }

    function assetToSyUp(PYIndex index, int256 assetAmount) internal pure returns (int256) {
        int256 sign = assetAmount < 0 ? int256(-1) : int256(1);
        return sign * (SYUtils.assetToSyUp(PYIndex.unwrap(index), assetAmount.abs())).Int();
    }
}

File 21 of 34 : SYUtils.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

library SYUtils {
    uint256 internal constant ONE = 1e18;

    function syToAsset(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) {
        return (syAmount * exchangeRate) / ONE;
    }

    function syToAssetUp(uint256 exchangeRate, uint256 syAmount) internal pure returns (uint256) {
        return (syAmount * exchangeRate + ONE - 1) / ONE;
    }

    function assetToSy(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) {
        return (assetAmount * ONE) / exchangeRate;
    }

    function assetToSyUp(uint256 exchangeRate, uint256 assetAmount) internal pure returns (uint256) {
        return (assetAmount * ONE + exchangeRate - 1) / exchangeRate;
    }
}

File 22 of 34 : IPGauge.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IPGauge {
    function totalActiveSupply() external view returns (uint256);

    function activeBalance(address user) external view returns (uint256);

    // only available for newer factories. please check the verified contracts
    event RedeemRewards(address indexed user, uint256[] rewardsOut);
}

File 23 of 34 : IPGaugeController.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IPGaugeController {
    event MarketClaimReward(address indexed market, uint256 amount);

    event ReceiveVotingResults(uint128 indexed wTime, address[] markets, uint256[] pendleAmounts);

    event UpdateMarketReward(address indexed market, uint256 pendlePerSec, uint256 incentiveEndsAt);

    function fundPendle(uint256 amount) external;

    function withdrawPendle(uint256 amount) external;

    function pendle() external returns (address);

    function redeemMarketReward() external;

    function rewardData(address pool) external view returns (uint128 pendlePerSec, uint128, uint128, uint128);
}

File 24 of 34 : IPInterestManagerYT.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IPInterestManagerYT {
    event CollectInterestFee(uint256 amountInterestFee);

    function userInterest(address user) external view returns (uint128 lastPYIndex, uint128 accruedInterest);
}

File 25 of 34 : IPMarket.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./IPPrincipalToken.sol";
import "./IPYieldToken.sol";
import "./IStandardizedYield.sol";
import "./IPGauge.sol";
import "../core/Market/MarketMathCore.sol";

interface IPMarket is IERC20Metadata, IPGauge {
    event Mint(address indexed receiver, uint256 netLpMinted, uint256 netSyUsed, uint256 netPtUsed);

    event Burn(
        address indexed receiverSy,
        address indexed receiverPt,
        uint256 netLpBurned,
        uint256 netSyOut,
        uint256 netPtOut
    );

    event Swap(
        address indexed caller,
        address indexed receiver,
        int256 netPtOut,
        int256 netSyOut,
        uint256 netSyFee,
        uint256 netSyToReserve
    );

    event UpdateImpliedRate(uint256 indexed timestamp, uint256 lnLastImpliedRate);

    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    function mint(
        address receiver,
        uint256 netSyDesired,
        uint256 netPtDesired
    ) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed);

    function burn(
        address receiverSy,
        address receiverPt,
        uint256 netLpToBurn
    ) external returns (uint256 netSyOut, uint256 netPtOut);

    function swapExactPtForSy(
        address receiver,
        uint256 exactPtIn,
        bytes calldata data
    ) external returns (uint256 netSyOut, uint256 netSyFee);

    function swapSyForExactPt(
        address receiver,
        uint256 exactPtOut,
        bytes calldata data
    ) external returns (uint256 netSyIn, uint256 netSyFee);

    function redeemRewards(address user) external returns (uint256[] memory);

    function readState(address router) external view returns (MarketState memory market);

    function observe(uint32[] memory secondsAgos) external view returns (uint216[] memory lnImpliedRateCumulative);

    function increaseObservationsCardinalityNext(uint16 cardinalityNext) external;

    function readTokens() external view returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT);

    function getRewardTokens() external view returns (address[] memory);

    function isExpired() external view returns (bool);

    function expiry() external view returns (uint256);

    function observations(
        uint256 index
    ) external view returns (uint32 blockTimestamp, uint216 lnImpliedRateCumulative, bool initialized);

    function _storage()
        external
        view
        returns (
            int128 totalPt,
            int128 totalSy,
            uint96 lastLnImpliedRate,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext
        );
}

File 26 of 34 : IPMarketFactoryV3.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IPMarketFactoryV3 {
    event SetOverriddenFee(address indexed router, address indexed market, uint80 lnFeeRateRoot);

    event CreateNewMarket(
        address indexed market,
        address indexed PT,
        int256 scalarRoot,
        int256 initialAnchor,
        uint256 lnFeeRateRoot
    );

    event NewTreasuryAndFeeReserve(address indexed treasury, uint8 reserveFeePercent);

    function isValidMarket(address market) external view returns (bool);

    // If this is changed, change the readState function in market as well
    function getMarketConfig(
        address market,
        address router
    ) external view returns (address treasury, uint80 overriddenFee, uint8 reserveFeePercent);

    function createNewMarket(
        address PT,
        int256 scalarRoot,
        int256 initialAnchor,
        uint80 lnFeeRateRoot
    ) external returns (address market);
}

File 27 of 34 : IPMarketSwapCallback.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IPMarketSwapCallback {
    function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external;
}

File 28 of 34 : IPMarketV3.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import "./IPMarket.sol";

interface IPMarketV3 is IPMarket {
    function getNonOverrideLnFeeRateRoot() external view returns (uint80);
}

File 29 of 34 : IPPrincipalToken.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

interface IPPrincipalToken is IERC20Metadata {
    function burnByYT(address user, uint256 amount) external;

    function mintByYT(address user, uint256 amount) external;

    function initialize(address _YT) external;

    function SY() external view returns (address);

    function YT() external view returns (address);

    function factory() external view returns (address);

    function expiry() external view returns (uint256);

    function isExpired() external view returns (bool);
}

File 30 of 34 : IPVeToken.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity ^0.8.0;

interface IPVeToken {
    // ============= USER INFO =============

    function balanceOf(address user) external view returns (uint128);

    function positionData(address user) external view returns (uint128 amount, uint128 expiry);

    // ============= META DATA =============

    function totalSupplyStored() external view returns (uint128);

    function totalSupplyCurrent() external returns (uint128);

    function totalSupplyAndBalanceCurrent(address user) external returns (uint128, uint128);
}

File 31 of 34 : IPYieldToken.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./IRewardManager.sol";
import "./IPInterestManagerYT.sol";

interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {
    event NewInterestIndex(uint256 indexed newIndex);

    event Mint(
        address indexed caller,
        address indexed receiverPT,
        address indexed receiverYT,
        uint256 amountSyToMint,
        uint256 amountPYOut
    );

    event Burn(address indexed caller, address indexed receiver, uint256 amountPYToRedeem, uint256 amountSyOut);

    event RedeemRewards(address indexed user, uint256[] amountRewardsOut);

    event RedeemInterest(address indexed user, uint256 interestOut);

    event CollectRewardFee(address indexed rewardToken, uint256 amountRewardFee);

    function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut);

    function redeemPY(address receiver) external returns (uint256 amountSyOut);

    function redeemPYMulti(
        address[] calldata receivers,
        uint256[] calldata amountPYToRedeems
    ) external returns (uint256[] memory amountSyOuts);

    function redeemDueInterestAndRewards(
        address user,
        bool redeemInterest,
        bool redeemRewards
    ) external returns (uint256 interestOut, uint256[] memory rewardsOut);

    function rewardIndexesCurrent() external returns (uint256[] memory);

    function pyIndexCurrent() external returns (uint256);

    function pyIndexStored() external view returns (uint256);

    function getRewardTokens() external view returns (address[] memory);

    function SY() external view returns (address);

    function PT() external view returns (address);

    function factory() external view returns (address);

    function expiry() external view returns (uint256);

    function isExpired() external view returns (bool);

    function doCacheIndexSameBlock() external view returns (bool);

    function pyIndexLastUpdatedBlock() external view returns (uint128);
}

File 32 of 34 : IRewardManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IRewardManager {
    function userReward(address token, address user) external view returns (uint128 index, uint128 accrued);
}

File 33 of 34 : IStandardizedYield.sol
// SPDX-License-Identifier: GPL-3.0-or-later
/*
 * MIT License
 * ===========
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 */

pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

interface IStandardizedYield is IERC20Metadata {
    /// @dev Emitted when any base tokens is deposited to mint shares
    event Deposit(
        address indexed caller,
        address indexed receiver,
        address indexed tokenIn,
        uint256 amountDeposited,
        uint256 amountSyOut
    );

    /// @dev Emitted when any shares are redeemed for base tokens
    event Redeem(
        address indexed caller,
        address indexed receiver,
        address indexed tokenOut,
        uint256 amountSyToRedeem,
        uint256 amountTokenOut
    );

    /// @dev check `assetInfo()` for more information
    enum AssetType {
        TOKEN,
        LIQUIDITY
    }

    /// @dev Emitted when (`user`) claims their rewards
    event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts);

    /**
     * @notice mints an amount of shares by depositing a base token.
     * @param receiver shares recipient address
     * @param tokenIn address of the base tokens to mint shares
     * @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`)
     * @param minSharesOut reverts if amount of shares minted is lower than this
     * @return amountSharesOut amount of shares minted
     * @dev Emits a {Deposit} event
     *
     * Requirements:
     * - (`tokenIn`) must be a valid base token.
     */
    function deposit(
        address receiver,
        address tokenIn,
        uint256 amountTokenToDeposit,
        uint256 minSharesOut
    ) external payable returns (uint256 amountSharesOut);

    /**
     * @notice redeems an amount of base tokens by burning some shares
     * @param receiver recipient address
     * @param amountSharesToRedeem amount of shares to be burned
     * @param tokenOut address of the base token to be redeemed
     * @param minTokenOut reverts if amount of base token redeemed is lower than this
     * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender`
     * @return amountTokenOut amount of base tokens redeemed
     * @dev Emits a {Redeem} event
     *
     * Requirements:
     * - (`tokenOut`) must be a valid base token.
     */
    function redeem(
        address receiver,
        uint256 amountSharesToRedeem,
        address tokenOut,
        uint256 minTokenOut,
        bool burnFromInternalBalance
    ) external returns (uint256 amountTokenOut);

    /**
     * @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account
     * @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy
     he can mint must be X * exchangeRate / 1e18
     * @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication
     & division
     */
    function exchangeRate() external view returns (uint256 res);

    /**
     * @notice claims reward for (`user`)
     * @param user the user receiving their rewards
     * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
     * @dev
     * Emits a `ClaimRewards` event
     * See {getRewardTokens} for list of reward tokens
     */
    function claimRewards(address user) external returns (uint256[] memory rewardAmounts);

    /**
     * @notice get the amount of unclaimed rewards for (`user`)
     * @param user the user to check for
     * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
     */
    function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);

    function rewardIndexesCurrent() external returns (uint256[] memory indexes);

    function rewardIndexesStored() external view returns (uint256[] memory indexes);

    /**
     * @notice returns the list of reward token addresses
     */
    function getRewardTokens() external view returns (address[] memory);

    /**
     * @notice returns the address of the underlying yield token
     */
    function yieldToken() external view returns (address);

    /**
     * @notice returns all tokens that can mint this SY
     */
    function getTokensIn() external view returns (address[] memory res);

    /**
     * @notice returns all tokens that can be redeemed by this SY
     */
    function getTokensOut() external view returns (address[] memory res);

    function isValidTokenIn(address token) external view returns (bool);

    function isValidTokenOut(address token) external view returns (bool);

    function previewDeposit(
        address tokenIn,
        uint256 amountTokenToDeposit
    ) external view returns (uint256 amountSharesOut);

    function previewRedeem(
        address tokenOut,
        uint256 amountSharesToRedeem
    ) external view returns (uint256 amountTokenOut);

    /**
     * @notice This function contains information to interpret what the asset is
     * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens,
        2 for bridged yield bearing tokens like wstETH, rETH on Arbi whose the underlying asset doesn't exist on the chain)
     * @return assetAddress the address of the asset
     * @return assetDecimals the decimals of the asset
     */
    function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals);
}

File 34 of 34 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0-or-later
/*
 * MIT License
 * ===========
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 */
pragma solidity ^0.8.0;

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

interface IWETH is IERC20 {
    event Deposit(address indexed dst, uint256 wad);
    event Withdrawal(address indexed src, uint256 wad);

    function deposit() external payable;

    function withdraw(uint256 wad) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/pendle/contracts/core/Market/OracleLib.sol": {
      "OracleLib": "0x83d6fa7f8904299f4a9499fe83b6ae3f21ffba57"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_PT","type":"address"},{"internalType":"int256","name":"_scalarRoot","type":"int256"},{"internalType":"int256","name":"_initialAnchor","type":"int256"},{"internalType":"uint80","name":"_lnFeeRateRoot","type":"uint80"},{"internalType":"address","name":"_vePendle","type":"address"},{"internalType":"address","name":"_gaugeController","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"int256","name":"exchangeRate","type":"int256"}],"name":"MarketExchangeRateBelowOne","type":"error"},{"inputs":[],"name":"MarketExpired","type":"error"},{"inputs":[{"internalType":"int256","name":"currentAmount","type":"int256"},{"internalType":"int256","name":"requiredAmount","type":"int256"}],"name":"MarketInsufficientPtForTrade","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualBalance","type":"uint256"},{"internalType":"uint256","name":"requiredBalance","type":"uint256"}],"name":"MarketInsufficientPtReceived","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualBalance","type":"uint256"},{"internalType":"uint256","name":"requiredBalance","type":"uint256"}],"name":"MarketInsufficientSyReceived","type":"error"},{"inputs":[],"name":"MarketProportionMustNotEqualOne","type":"error"},{"inputs":[{"internalType":"int256","name":"proportion","type":"int256"},{"internalType":"int256","name":"maxProportion","type":"int256"}],"name":"MarketProportionTooHigh","type":"error"},{"inputs":[{"internalType":"int256","name":"rateScalar","type":"int256"}],"name":"MarketRateScalarBelowZero","type":"error"},{"inputs":[{"internalType":"int256","name":"scalarRoot","type":"int256"}],"name":"MarketScalarRootBelowZero","type":"error"},{"inputs":[],"name":"MarketZeroAmountsInput","type":"error"},{"inputs":[],"name":"MarketZeroAmountsOutput","type":"error"},{"inputs":[],"name":"MarketZeroLnImpliedRate","type":"error"},{"inputs":[{"internalType":"int256","name":"totalPt","type":"int256"},{"internalType":"int256","name":"totalAsset","type":"int256"}],"name":"MarketZeroTotalPtOrTotalAsset","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":"receiverSy","type":"address"},{"indexed":true,"internalType":"address","name":"receiverPt","type":"address"},{"indexed":false,"internalType":"uint256","name":"netLpBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netSyOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netPtOut","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"netLpMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netSyUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netPtUsed","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"rewardsOut","type":"uint256[]"}],"name":"RedeemRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"int256","name":"netPtOut","type":"int256"},{"indexed":false,"internalType":"int256","name":"netSyOut","type":"int256"},{"indexed":false,"internalType":"uint256","name":"netSyFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netSyToReserve","type":"uint256"}],"name":"Swap","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lnLastImpliedRate","type":"uint256"}],"name":"UpdateImpliedRate","type":"event"},{"inputs":[],"name":"_storage","outputs":[{"internalType":"int128","name":"totalPt","type":"int128"},{"internalType":"int128","name":"totalSy","type":"int128"},{"internalType":"uint96","name":"lastLnImpliedRate","type":"uint96"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"activeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"receiverSy","type":"address"},{"internalType":"address","name":"receiverPt","type":"address"},{"internalType":"uint256","name":"netLpToBurn","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"netSyOut","type":"uint256"},{"internalType":"uint256","name":"netPtOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expiry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNonOverrideLnFeeRateRoot","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"cardinalityNext","type":"uint16"}],"name":"increaseObservationsCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"netSyDesired","type":"uint256"},{"internalType":"uint256","name":"netPtDesired","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"netLpOut","type":"uint256"},{"internalType":"uint256","name":"netSyUsed","type":"uint256"},{"internalType":"uint256","name":"netPtUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"uint216","name":"lnImpliedRateCumulative","type":"uint216"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"uint216[]","name":"lnImpliedRateCumulative","type":"uint216[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"readState","outputs":[{"components":[{"internalType":"int256","name":"totalPt","type":"int256"},{"internalType":"int256","name":"totalSy","type":"int256"},{"internalType":"int256","name":"totalLp","type":"int256"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"int256","name":"scalarRoot","type":"int256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"lnFeeRateRoot","type":"uint256"},{"internalType":"uint256","name":"reserveFeePercent","type":"uint256"},{"internalType":"uint256","name":"lastLnImpliedRate","type":"uint256"}],"internalType":"struct MarketState","name":"market","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"readTokens","outputs":[{"internalType":"contract IStandardizedYield","name":"_SY","type":"address"},{"internalType":"contract IPPrincipalToken","name":"_PT","type":"address"},{"internalType":"contract IPYieldToken","name":"_YT","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"redeemRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardState","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"lastBalance","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"skim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"exactPtIn","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapExactPtForSy","outputs":[{"internalType":"uint256","name":"netSyOut","type":"uint256"},{"internalType":"uint256","name":"netSyFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"exactPtOut","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapSyForExactPt","outputs":[{"internalType":"uint256","name":"netSyIn","type":"uint256"},{"internalType":"uint256","name":"netSyFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalActiveSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userReward","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"accrued","type":"uint128"}],"stateMutability":"view","type":"function"}]

6102208060405234620004ec5760c081620068ac8038038091620000248285620008f6565b833981010312620004ec576200003a816200091a565b602082015160408301516060840151916001600160501b0383168303620004ec576200007760a06200006f608088016200091a565b96016200091a565b60405163afd27bf560e01b81529095906020816004816001600160a01b038a165afa908115620004fa5760009162000898575b50604051620000b981620008da565b600d81526c14195b991b194813585c9ad95d609a1b602082015260405190620000e282620008da565b600a8252691411539113114b53141560b21b60208301528051906001600160401b0382116200076b5760035490600182811c921680156200088d575b60208310146200074a5781601f84931162000818575b50602090601f83116001146200078d5760009262000781575b50508160011b916000199060031b1c1916176003555b8051906001600160401b0382116200076b5760045490600182811c9216801562000760575b60208310146200074a5781601f849311620006d8575b50602090601f831160011462000649576000926200063d575b50508160011b916000199060031b1c1916176004555b6012608052600280546001600160f81b0316600160f81b17905560a0526001600160a01b0390811660e052610100868152604051635162986d60e11b81529096909160209183916004918391600091165af1908115620004fa57600091620005fb575b5060c0526001600160a01b03841661012081815260405163afd27bf560e01b815290959091602090839060049082905afa918215620004fa57600092620005b5575b506001600160a01b03918216610140908152865160405163781c18db60e01b8152919391929160209184916004918391165afa918215620004fa5760009262000571575b506101609160018060a01b0316825260405163329f6acb60e21b8152600c600482015263ffffffff421660248201526040816044817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af4908115620004fa576000906000926200051f575b50600b805463ffffffff60701b191660809390931b61ffff60801b169290921760709190911b61ffff60701b16179055600084131562000506576101c09384526101e09485526102009586526040516370c264df60e11b8152929190602090849060049082906001600160a01b03165afa928315620004fa57600093620004bb575b506101a09283526101809133835260405197615f6c998a620009408b396080518a61186e015260a0518a8181613be101526151f7015260c0518a613c14015260e0518a81816128ae015261588a0152518961523c0152518881816103ee015281816115ce0152818161195f01528181611b3e01528181611fb901526125010152518781816104220152818161140b0152818161193a01528181611b0601528181611ccc01528181611ffa01526124ad01525186818161135c0152818161198601528181611a5001526121d0015251858181610888015261313601525184818161070b01528181611328015281816118c901528181611a1c0152818161219c01526131d2015251836131af015251826126d20152518181816106b1015261318a0152f35b9092506020813d602011620004f1575b81620004da60209383620008f6565b81010312620004ec5751913862000398565b600080fd5b3d9150620004cb565b6040513d6000823e3d90fd5b60405163483512b160e11b815260048101859052602490fd5b9150506040813d60401162000568575b816200053e60409383620008f6565b81010312620004ec5762000560602062000558836200092f565b92016200092f565b903862000316565b3d91506200052f565b9091506020813d602011620005ac575b816200059060209383620008f6565b81010312620004ec57620005a4906200091a565b9038620002b6565b3d915062000581565b9091506020813d602011620005f2575b81620005d460209383620008f6565b81010312620004ec57620005ea6004916200091a565b919062000272565b3d9150620005c5565b90506020813d60201162000634575b816200061960209383620008f6565b81010312620004ec576200062d906200091a565b3862000230565b3d91506200060a565b015190503880620001b7565b6004600090815293507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b91905b601f1984168510620006bc576001945083601f19811610620006a2575b505050811b01600455620001cd565b015160001960f88460031b161c1916905538808062000693565b8181015183556020948501946001909301929091019062000676565b60046000529091507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81016020851062000742575b90849392915b601f830160051c82018110620007325750506200019e565b600081558594506001016200071a565b508062000714565b634e487b7160e01b600052602260045260246000fd5b91607f169162000188565b634e487b7160e01b600052604160045260246000fd5b0151905038806200014d565b600360009081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9350601f198516905b818110620007ff5750908460019594939210620007e5575b505050811b0160035562000163565b015160001960f88460031b161c19169055388080620007d6565b92936020600181928786015181550195019301620007be565b60036000529091507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f840160051c8101916020851062000882575b90601f859493920160051c01905b81811062000872575062000134565b6000815584935060010162000863565b909150819062000855565b91607f16916200011e565b90506020813d602011620008d1575b81620008b660209383620008f6565b81010312620004ec57620008ca906200091a565b38620000aa565b3d9150620008a7565b604081019081106001600160401b038211176200076b57604052565b601f909101601f19168101906001600160401b038211908210176200076b57604052565b51906001600160a01b0382168203620004ec57565b519061ffff82168203620004ec5756fe608080604052600436101561001357600080fd5b60003560e01c90816306fdde0314612bd2575080630892cd8b14612b6d578063095ea7b314612b1e578063156e29f61461210557806318160ddd146120a85780631dd19cb414611f0c57806323b872dd14611d7a578063252c09d714611cf857806329910b11146119ad5780632c8ce6bc146118ee5780632f13b60c14611892578063313ce5671461183657806337d45e3a146116245780635b709f17146112b95780635cbadbe41461121e57806370a08231146111b35780637206926414611177578063794052f3146110c4578063883bdbfd14610e215780639262187b14610b9957806395d89b4114610a41578063a9059cbb1461096d578063a9f8d18114610931578063c3fb90d6146108ac578063c45a01551461083d578063c4f59f9b146107ab578063dd62ed3e1461072e578063e184c9be146106d5578063e4f8b2e914610670578063ea64a820146105e65763f6b911bc1461017457600080fd5b3461044e5761018236612d59565b916002805490610197818360f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8093161781556101e73361302e565b3015610562576101f630614b3e565b30600052602092600084526040600020548781106104de57879030600052600086520360406000205580871161044e578254818816828216038281116104af57827fff000000000000000000000000000000000000000000000000000000000000009116911617835560006040518881527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef863092a361029530614c01565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff871161044e57861561048557838201956102d1875189613b5c565b956102e26040850197885190613db8565b976102f96102f186518c613b5c565b895190613db8565b9789158061047d575b610453576103118b8251614d3a565b905261031e888651614d3a565b855261032b898251614d3a565b90526000881261044e576000871261044e577f4cf25bc1d991c17529c25213d3cc0cda295eeaad5f13f361969b12ea48015f908860409a6103c07f01000000000000000000000000000000000000000000000000000000000000009773ffffffffffffffffffffffffffffffffffffffff808716968530890361041b575b50508c81891698308a036103e8575b505050613498565b8b51908152602081019190915260408101899052606090a38254161790558351928352820152f35b610413927f0000000000000000000000000000000000000000000000000000000000000000166136ca565b388c816103b8565b61044791837f0000000000000000000000000000000000000000000000000000000000000000166136ca565b38856103a9565b600080fd5b60046040517fccbf5468000000000000000000000000000000000000000000000000000000008152fd5b508815610302565b60046040517f25daaec3000000000000000000000000000000000000000000000000000000008152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b608485604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5773ffffffffffffffffffffffffffffffffffffffff610632612d13565b166000908152600760209081526040918290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b0390f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405169ffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610765612d13565b61076d612d36565b9073ffffffffffffffffffffffffffffffffffffffff8091166000526001602052604060002091166000526020526020604060002054604051908152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576107e2613b9b565b6040518091602080830160208452825180915260206040850193019160005b82811061081057505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610801565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760c0600a54600b5461ffff906040519280600f0b845260801d600f0b60208401526bffffffffffffffffffffffff81166040840152818160601c166060840152818160701c16608084015260801c1660a0820152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020600654604051908152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e577f01000000000000000000000000000000000000000000000000000000000000006109c5612d13565b610a2e600254916109dc60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613855565b6002541617600255602060405160018152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760405160009060045460018160011c9060018316928315610b8f575b6020938484108114610b6057838652908115610b225750600114610ac7575b61066c84610abb81880382612ea5565b60405191829182612cad565b600460009081529294507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610b0f575050508161066c93610abb9282010193610aab565b8054858501870152928501928101610af3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016858501525050151560051b8201019150610abb8161066c610aab565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691610a8c565b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610bd1612d13565b9060025490610be660028360f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80931617600255610c3783614b3e565b610c4083614c01565b610c48613b9b565b92610c5384516146f7565b90600073ffffffffffffffffffffffffffffffffffffffff95868316915b8151811015610db45787610c858284614746565b5116600052600590818752604060002084600052875260406000205491608092831c610cb18389614746565b52610cbc8288614746565b51610ccd575b506001915001610c71565b89610cd88386614746565b5116600052875260406000208460005287526040600020916fffffffffffffffffffffffffffffffff92838154169055610d128288614746565b519083821161044e578a610d268487614746565b5116600052600789528360406000209216908254901c039283116104af57600192610d8c91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b610dae89610d9a8386614746565b511686610da7848a614746565b5191614c93565b89610cc2565b61066c857f010000000000000000000000000000000000000000000000000000000000000089867f78d61a0c27b13f43911095f9f356f14daa3cd8b125eea1aa22421245e90e813d60405180610e0a8782612efe565b0390a2600254161760025560405191829182612efe565b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5767ffffffffffffffff60043581811161044e573660238201121561044e578060040135610e7d81612ee6565b91610e8b6040519384612ea5565b8183528483016024819360051b8301019136831161044e57602401905b8282106110a85750505063ffffffff91600b5461ffff906040519485937f1dd421ce00000000000000000000000000000000000000000000000000000000855260c4850190600c6004870152824216602487015260c060448701525180915260e4850195916000905b8a83831061108b578a88600081808d8c8c6bffffffffffffffffffffffff81166064850152818160601c16608485015260701c1660a483015203817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af491821561107f57600092610fd4575b5050906040519181839283018184528251809152816040850193019160005b828110610fa057505050500390f35b83517affffffffffffffffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610f91565b9091503d806000843e610fe78184612ea5565b820191838184031261044e57805191821161044e57019080601f8301121561044e57815161101481612ee6565b926110226040519485612ea5565b818452848085019260051b82010192831161044e578401905b82821061104c575050508280610f72565b81517affffffffffffffffffffffffffffffffffffffffffffffffffffff8116810361044e57815290840190840161103b565b6040513d6000823e3d90fd5b845182168952978801978997509093019260019190910190610f11565b813563ffffffff8116810361044e578152908601908601610ea8565b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610120611106611101612d13565b61302e565b6040519080518252602081015160208301526040810151604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008091015190820152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020600854604051908152f35b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760206112166111ef612d13565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b604051908152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57611255612d13565b61125d612d36565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526005602090815260408083209390941682529182528290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b3461044e576112c736612db9565b9192906002546112dd60028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f000000000000000000000000000000000000000000000000000000000000000011156115fa576113563361302e565b926113807f0000000000000000000000000000000000000000000000000000000000000000613400565b937f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818811908161044e576113bc6113c6978a4291846141ce565b9791989098613b0a565b9860008a1261044e576000891261044e576000881261044e5773ffffffffffffffffffffffffffffffffffffffff91828716968c3089036115c7575b505061143889847f00000000000000000000000000000000000000000000000000000000000000001694606087015116856136ca565b61144184613498565b8161154a575b505060206114548261366b565b9201918251906000821261044e571061150057505061044e57851161044e576040957f829000a5bc6a12d46e30cdcecd7c56b1efd88f6d7d059da6734a04f3764557c4857f0100000000000000000000000000000000000000000000000000000000000000956114e96114c68a613b0a565b8b5195865260208601526040850192909252606084015233929081906080820190565b0390a3600254161760025582519182526020820152f35b6115099061366b565b9051906000821261044e57604491604051917ff62951c700000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b6000945090858b1161044e5761155f8b613b0a565b333b1561044e578c6115a160009360405195869485947ffa483e7200000000000000000000000000000000000000000000000000000000865260048601612fac565b038183335af1801561107f576115b8575b80611447565b6115c190612e46565b8a6115b2565b6115f391857f0000000000000000000000000000000000000000000000000000000000000000166136ca565b8c8c611402565b60046040517fb2094b59000000000000000000000000000000000000000000000000000000008152fd5b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576004359061ffff9081831680930361044e576002549161167a60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025580600b5460801c16604051947f587cdc06000000000000000000000000000000000000000000000000000000008652600c6004870152816024870152604486015282856064817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af491821561107f576000926117e0575b7f010000000000000000000000000000000000000000000000000000000000000095508216808203611767575b60028054861687179055005b7fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a936040937fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff71ffff00000000000000000000000000000000600b549260801b16911617600b558351928352820152a18280808061175b565b91508285813d831161182f575b6117f78183612ea5565b8101031261044e576118297f010000000000000000000000000000000000000000000000000000000000000095612ffe565b9161172e565b503d6117ed565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020604051427f000000000000000000000000000000000000000000000000000000000000000011158152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57606060405173ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000000000000000000000000000000000000168252807f00000000000000000000000000000000000000000000000000000000000000001660208301527f0000000000000000000000000000000000000000000000000000000000000000166040820152f35b3461044e576119bb36612db9565b9091926002546119d160028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f000000000000000000000000000000000000000000000000000000000000000011156115fa57611a4a3361302e565b91611a747f0000000000000000000000000000000000000000000000000000000000000000613400565b957f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96878211908161044e57611ab6904290611aaf85613b0a565b90886141ce565b969198909760008a1261044e576000891261044e576000881261044e5773ffffffffffffffffffffffffffffffffffffffff91828716968b308903611cc5575b5050611b2b8984606087015116857f0000000000000000000000000000000000000000000000000000000000000000166136ca565b611b3484613498565b81611c46575b50507f000000000000000000000000000000000000000000000000000000000000000016611b678161366b565b8251906000821261044e5710611bfc57505061044e57611b8690613b0a565b95851161044e576040957f829000a5bc6a12d46e30cdcecd7c56b1efd88f6d7d059da6734a04f3764557c46114e97f0100000000000000000000000000000000000000000000000000000000000000958951918291898b3397859094939260609260808301968352602083015260408201520152565b611c059061366b565b9051906000821261044e57604491604051917f2c49ea0f00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b6000945090611c5486613b0a565b908c8c1161044e57333b1561044e57600091611c9f8d9260405195869485947ffa483e7200000000000000000000000000000000000000000000000000000000865260048601612fac565b038183335af1801561107f57611cb6575b80611b3a565b611cbf90612e46565b8a611cb0565b611cf191857f0000000000000000000000000000000000000000000000000000000000000000166136ca565b8c8b611af6565b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760043561ffff81101561044e57606090600c01546040519063ffffffff811682527affffffffffffffffffffffffffffffffffffffffffffffffffffff8160201c16602083015260f81c15156040820152f35b3461044e57611d8836612d59565b60025491611d9c60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025573ffffffffffffffffffffffffffffffffffffffff841660005260016020526040600020336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103611e6a575b5090610a2e917f010000000000000000000000000000000000000000000000000000000000000094613855565b9190818310611eae577f010000000000000000000000000000000000000000000000000000000000000094611ea583610a2e9503338361328b565b94509091611e3d565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57600254611f4e60028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255611f9f3361302e565b9073ffffffffffffffffffffffffffffffffffffffff91827f00000000000000000000000000000000000000000000000000000000000000001692611fe38461366b565b82516000811261044e57611ff691612f9f565b90807f000000000000000000000000000000000000000000000000000000000000000016906120248261366b565b956020850151966000881261044e577f01000000000000000000000000000000000000000000000000000000000000009761205e91612f9f565b9380612090575b5050826120785760028054861687179055005b606061208794015116906136ca565b8280808061175b565b6120a19183606088015116906136ca565b8680612065565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b3461044e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5761213c612d13565b602435907f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025461219460028260f81c1415612f3a565b1617600255427f000000000000000000000000000000000000000000000000000000000000000011156115fa576121ca3361302e565b906121f47f0000000000000000000000000000000000000000000000000000000000000000613400565b907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80851161044e57806044351161044e57600085158015612b14575b610485574260a086015111156115fa57604085015180612a7d57505061225960443586613b5c565b906000821261044e5760006003831115612a6e5750816001908060011c600181018091116104af5791905b848310612a53575050505b811161044e577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1881019081136001166104af57926103e8604435935b60008613801590612a48575b8015612a3d575b610453576122f0876020850151613ea8565b6020840152612300858451613ea8565b835261231961230f8388613ea8565b6040850151613ea8565b60408401526000821261044e576000861261044e576000871261044e576000851261044e57816126a3575b505073ffffffffffffffffffffffffffffffffffffffff8216156126455761236b82614b3e565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841161044e576002547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80861681831601116104af577fff000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808716818416011691161760025573ffffffffffffffffffffffffffffffffffffffff82166000526000602052604060002061243e85825461348b565b905560405184815260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602073ffffffffffffffffffffffffffffffffffffffff861693a361248d82614c01565b61249681613498565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166124d68161366b565b6020830151906000821261044e57106125f8575073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001661252a8161366b565b8251906000821261044e5710611bfc575050604080518481526020810186905290810183905261066c929173ffffffffffffffffffffffffffffffffffffffff16907fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb90606090a27f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541617600255604051938493846040919493926060820195825260208201520152565b61260360209161366b565b910151906000821261044e57604491604051917ff62951c700000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b4260a084015111156115fa576126c161270491602085015190613ec4565b6126cf4260a0860151612f9f565b907f0000000000000000000000000000000000000000000000000000000000000000906126fc8387613f5d565b908651613fef565b610100830152612712614979565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57600254907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831601917effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116104af5760206000927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef927fff000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600197169116176002558484528382526040842061282f82825461348b565b9055604051908152a3306001141580612849575b80612344565b61285290615650565b600160005260006020526040600020546040517fe268b3a400000000000000000000000000000000000000000000000000000000815260016004820152604081602481600073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1801561107f576000916000916129f6575b50826028810204602814831517156104af5760646028840204916fffffffffffffffffffffffffffffffff8116612983575b50509080821060001461297c57505b612947816129426008546001600052600960205260406000205490612f9f565b61348b565b600855600160005260096020527f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a365585612843565b9050612922565b906129c96fffffffffffffffffffffffffffffffff806129ce941692167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416613f4a565b613fe5565b90603c820291808304603c14901517156104af5760646129ef92049061348b565b8780612913565b9150506040813d604011612a35575b81612a1260409383612ea5565b8101031261044e57612a2f6020612a2883615f19565b9201615f19565b886128e1565b3d9150612a05565b5060008513156122de565b5060008713156122d7565b90919350612a65846129428184613fe5565b821c9190612284565b911561228f576001915061228f565b612a9b91959250612a9390604497959735613b5c565b825190613db8565b93612aaa604083015185613b5c565b93612abb6020840195865190613db8565b9081871215612af9575050612af3612ad7866044359651613b5c565b612aee612ae960408601518093613ea8565b613e3c565b613db8565b956122cb565b9550959350612b0e612ad78796978451613b5c565b936122cb565b5060443515612231565b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57612b62612b58612d13565b602435903361328b565b602060405160018152f35b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5773ffffffffffffffffffffffffffffffffffffffff612bb9612d13565b1660005260096020526020604060002054604051908152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760009060035460018160011c9060018316928315612ca3575b6020938484108114610b6057838652908115610b225750600114612c485761066c84610abb81880382612ea5565b600360009081529294507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410612c90575050508161066c93610abb9282010193610aab565b8054858501870152928501928101612c74565b91607f1691612c1a565b60208082528251818301819052939260005b858110612cff575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006040809697860101520116010190565b818101830151848201604001528201612cbf565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc606091011261044e5773ffffffffffffffffffffffffffffffffffffffff90600435828116810361044e5791602435908116810361044e579060443590565b9060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261044e5760043573ffffffffffffffffffffffffffffffffffffffff8116810361044e57916024359160443567ffffffffffffffff9283821161044e578060238301121561044e57816004013593841161044e576024848301011161044e576024019190565b67ffffffffffffffff8111612e5a57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff821117612e5a57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612e5a57604052565b67ffffffffffffffff8111612e5a5760051b60200190565b602090602060408183019282815285518094520193019160005b828110612f26575050505090565b835185529381019392810192600101612f18565b15612f4157565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b919082039182116104af57565b9293806080957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe094601f9487526020870152606060408701528160608701528686013760008582860101520116010190565b519061ffff8216820361044e57565b519073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b906040805192610120840184811067ffffffffffffffff821117612e5a57825260608401600090818152608086019180835260a087019381855260c088019282845260e089018381526101008a01978489528a600a5480600f0b825260801d600f0b60208201527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821161326d5782015273ffffffffffffffffffffffffffffffffffffffff91828251957f5c098c11000000000000000000000000000000000000000000000000000000008752306004880152166024860152606085604481867f0000000000000000000000000000000000000000000000000000000000000000165afa80156132815786928796889261320d575b505060ff16905216905269ffffffffffffffffffff915080821661320857507f00000000000000000000000000000000000000000000000000000000000000005b1690527f000000000000000000000000000000000000000000000000000000000000000090527f000000000000000000000000000000000000000000000000000000000000000090526bffffffffffffffffffffffff600b54169052565b6131aa565b93509550506060823d606011613279575b8161322b60609383612ea5565b810103126132755761323c8261300d565b9460208301519269ffffffffffffffffffff841684036132715701519460ff8616860361326d57919460ff38613169565b8680fd5b8780fd5b8580fd5b3d915061321e565b82513d88823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561337d57169182156132f95760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b602073ffffffffffffffffffffffffffffffffffffffff600460009360405194859384927f1d52edc4000000000000000000000000000000000000000000000000000000008452165af190811561107f5760009161345c575090565b90506020813d602011613483575b8161347760209383612ea5565b8101031261044e575190565b3d915061346a565b919082018092116104af57565b610100810180516bffffffffffffffffffffffff80821161044e576134ca60206134c2865161417f565b95015161417f565b93600b549161ffff956040968751947f4af74b68000000000000000000000000000000000000000000000000000000008652600c6004870152818160601c16602487015263ffffffff421660448701528381166064870152818160701c16608487015260801c1660a4850152868460c4817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af49182156136605760009360009361360a575b6dffff0000000000000000000000009495507fffffffffffffffffffffffffffffffff00000000000000000000000000000000809360801b16906fffffffffffffffffffffffffffffffff1617600a556fffff0000000000000000000000000000600b549360701b1695169116179160601b161717600b555190519081527f5c0e21d57bb4cf91d8fe238d6f92e2685a695371b19209afcce6217b478f83e160204292a2565b925092508684813d8311613659575b6136238183612ea5565b8101031261044e576dffff00000000000000000000000092613650602061364987612ffe565b9601612ffe565b92859450613564565b503d613619565b87513d6000823e3d90fd5b602073ffffffffffffffffffffffffffffffffffffffff916024604051809481937f70a08231000000000000000000000000000000000000000000000000000000008352306004840152165afa90811561107f5760009161345c575090565b9060405160208101937fa9059cbb00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff8093166024830152604482015260448152608081019181831067ffffffffffffffff841117612e5a5761378b9383604052169061374783612e89565b602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460a0820152600080958192519082855af1613785614c35565b91615a10565b908151918215928315613827575b505050156137a357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b819293509060209181010312613851576020015190811515820361384e5750388080613799565b80fd5b5080fd5b91909173ffffffffffffffffffffffffffffffffffffffff808216908115613a86578416928315613a02578382146139a4576138918584614b92565b6000908282528160205260408220548181106139205760208260408587957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95878c99528286520382822055868152206138ec82825461348b565b9055604051908152a33003613911575b5030036139065750565b61390f90615822565b565b61391a90615822565b386138fc565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b9081600003918083057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14901517156104af57565b90670de0b6b3a7640000918281029281840514901517156104af57565b8181029291600082127f80000000000000000000000000000000000000000000000000000000000000008214166104af5781840514901517156104af57565b73ffffffffffffffffffffffffffffffffffffffff6040517fc4f59f9b0000000000000000000000000000000000000000000000000000000081526000918282600481847f0000000000000000000000000000000000000000000000000000000000000000165afa918215613dad578392613d0e575b507f000000000000000000000000000000000000000000000000000000000000000091613c3e8382614789565b613d07578051906001906001830195868411613cda577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0613c97613c8189612ee6565b98613c8f6040519a8b612ea5565b808a52612ee6565b013660208901375b838110613cba57505050613cb39084614746565b9116905290565b8085613cc7859385614746565b5116613cd3828a614746565b5201613c9f565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b9250505090565b9091503d8084833e613d208183612ea5565b8101906020908181840312613da95780519067ffffffffffffffff821161327557019180601f84011215613da9578251613d5981612ee6565b93613d676040519586612ea5565b818552838086019260051b82010192831161326d578301905b828210613d9257505050509038613c11565b838091613d9e8461300d565b815201910190613d80565b8480fd5b6040513d85823e3d90fd5b8115613e0d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f80000000000000000000000000000000000000000000000000000000000000008214166104af570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182136001166104af57565b90670de0b6b3a7640000600083820393128184128116918413901516176104af57565b818103929160001380158285131691841216176104af57565b919091600083820193841291129080158216911516176104af57565b613f0b670de0b6b3a76400009160008412600014613f3f57613f067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff946147db565b613f4a565b047f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613f3c91613b5c565b90565b613f066001946147db565b818102929181159184041417156104af57565b60800151906301e13380918281029281840514901517156104af577f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613fa891613db8565b906000821315613fb457565b602482604051907f1ca418760000000000000000000000000000000000000000000000000000000082526004820152fd5b8115613e0d570490565b94939291906000958681126141215761401461400e6140199383613ea8565b91613b3f565b61482e565b670d529ae9e86000008082136140ea5750614048929161401461403e61404393614d4b565b613b3f565b613ea8565b670de0b6b3a764000081126140b95761406090614838565b8381126140b5576301e133809081810291818304149015171561408857613f3c929350613fe5565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8380fd5b602490604051907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b60449250604051917ffc68d09e00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f6e656761746976650000000000000000000000000000000000000000000000006044820152fd5b807fffffffffffffffffffffffffffffffff800000000000000000000000000000001315806141b4575b1561044e57600f0b90565b506f7fffffffffffffffffffffffffffffff8113156141a9565b93909360a081019484865111156115fa578151848113156146c057506040918251946080860186811067ffffffffffffffff821117612e5a57845260009586815260208101938785528582019088825260608301948986528a8c5111156146975761423a8b8d51612f9f565b956142458783613f5d565b85526020820196614257885185613ec4565b808a528351908115801561468f575b61465957505082516101008401998a5192808251938a519561428e6301e13380948592613f4a565b04957f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96878111614652576142c290615b3d565b91670de0b6b3a76400009687841261461f576143029261401461403e6142f78561401461400e6142fc9761430e9c9b99613ea8565b614d4b565b90613e8f565b8a5260c0880151613f4a565b0483811161461b57906143218a92615b3d565b8552614346865191519161401461400e8c51946143408d519785614d3a565b93613ea8565b670d529ae9e86000008082136145e5575061436b929161401461403e61404393614d4b565b8181126145b5578d90614389614384826140148d613b3f565b613b0a565b9451918a131561459557816140146143a092613b3f565b82811261456557506143bb6143b58392613e6c565b85613b5c565b059c5b60e0850151838111613851578e60646143da6143e19383613b5c565b0595613e8f565b91818312801561454d57156145425761441a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff936147db565b81810291818304149015171561451557866144349161348b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111614515578661446891613fe5565b92831161384e57506144859161447d91613b5c565b9b5b846150e8565b9061449090846150e8565b9a8b919c819e51906144a191612f9f565b968351906144ae91614d3a565b83528751916144bc91613ea8565b6144c591614d3a565b80965251946144d391613ec4565b91519051916144e194613fef565b809152156144ec5750565b600490517faa69ae1e000000000000000000000000000000000000000000000000000000008152fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b61441a6001936147db565b505050614485915061455f90856150e8565b9b61447f565b6024908d51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b5061438481612aee6145a96145af94613e6c565b87613b5c565b9c6143be565b6024908c51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b604492508e51917ffc68d09e00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b8e80fd5b5050506024908f51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b5050508f80fd5b604492508b51917fb1c4aefb00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b508015614266565b600488517fb2094b59000000000000000000000000000000000000000000000000000000008152fd5b60449085604051917f8615426c00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b9061470182612ee6565b61470e6040519182612ea5565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061473c8294612ee6565b0190602036910137565b805182101561475a5760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9081519160005b8381106147a05750505050600090565b73ffffffffffffffffffffffffffffffffffffffff806147c08385614746565b5116908416146147d257600101614790565b50505050600190565b6000808213156147e9575090565b7f80000000000000000000000000000000000000000000000000000000000000008214613cda570390565b8015613e0d576ec097ce7bc90715b34b9f10000000000590565b8115613e0d570590565b600081131561491b5780670c7d713b49da0000128061490a575b1561490157670de0b6b3a7640000906ec097ce7bc90715b34b9f1000000000906148a5908302828101907fffffffffffffffffffffffffffffffffff3f68318436f8ea4cb460f00000000001830261482e565b9080828002059181838202058284820205838582020591848684020593858786020595808888020597880205600f900596600d900595600b900594600990059360079005926005900591600390050101010101010160011b0590565b613f3c90614d9c565b50670f43fc2c04ee00008112614852565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6f7574206f6620626f756e6473000000000000000000000000000000000000006044820152fd5b61498161517a565b815115614b3a5760019030821415908161499c575b50505050565b6149a98395949392615650565b600082815260209060098252604091828220549582985b6149d1575b50505050839450614996565b8051891015614b355773ffffffffffffffffffffffffffffffffffffffff6149f98a83614746565b511698614a068187614746565b519980855260059081855286862089875285526fffffffffffffffffffffffffffffffff8088882054168015614b2e575b8d81148015614b26575b614b165781614a848f92614a688f614a62670de0b6b3a76400009387612f9f565b90613f4a565b04858b52868a528d8c8c20908c528a528b8b205460801c61348b565b9111613271578181116132715792614b0d92828c9d9e9f93958d97968c5195614aac87612e89565b1685521688840152885286528787208488528652878720815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b019897966149c0565b5050505086979899508690614b0d565b508d15614a41565b5089614a37565b6149c5565b5050565b614b4661517a565b90805115614b8d5773ffffffffffffffffffffffffffffffffffffffff83168015159081614b82575b50614b7957505050565b61390f92615686565b905030141538614b6f565b505050565b614b9a61517a565b918151156149965773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081614bf6575b50614be5575b50505083168015159081614b825750614b7957505050565b614bee92615686565b388383614bcd565b905030141538614bc7565b73ffffffffffffffffffffffffffffffffffffffff81168015159081614c2a575b506139065750565b905030141538614c22565b3d15614c8e573d9067ffffffffffffffff8211612e5a5760405191614c8260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184612ea5565b82523d6000602084013e565b606090565b9190918115614b8d5773ffffffffffffffffffffffffffffffffffffffff169182614d31576000809350809281925af1614ccb614c35565b5015614cd357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b61390f926136ca565b9080821261412157613f3c91613e8f565b670de0b6b3a76400008114614d7257614d6d8161401461400e613f3c94613e6c565b614838565b60046040517fa9c8b14d000000000000000000000000000000000000000000000000000000008152fd5b670de0b6b3a764000081126150d15760649060007e1600ef3172e58d2e933ec884fde10064c63b5372d805e203c00000000000008212156150a6575b73011798004d755d3c8bc8e03204cf44619e000000821215615085575b820290808302906e01855144814a7ff805980ff00840009081831215615062575b50506b02df0ab5a80a22c61ab5a70080821215615042575b50693f1fce3da636ea5cf85080821215615022575b50690127fa27722cc06cc5e280821215615002575b5068280e60114edb805d0380821215614fe2575b50680ebc5fb4174612111080821215614fcb575b506808f00f760a4b2db55d80821215614fab575b506806f5f177578893793780821215614f8b575b506806248f33704b28660380821215614f6c575b506805c548670b9510e7ac80821215614f4d575b50614f0c68056bc75e2d6310000091827ffffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf0000081830192010261482e565b9080828002059181838202058284820205916003600560076009600b888a89020598808b8b02059a8b0205059805960594059205010101010160011b010590565b68056bc75e2d631000006756bc75e2d631000092020591019038614ed0565b68056bc75e2d6310000067ad78ebc5ac62000092020591019038614ebc565b68056bc75e2d6310000068015af1d78b58c4000092020591019038614ea8565b68056bc75e2d631000006802b5e3af16b188000092020591019038614e94565b68056bc75e2d631000008092020591019038614e80565b68056bc75e2d63100000680ad78ebc5ac620000092020591019038614e6c565b68056bc75e2d631000006815af1d78b58c40000092020591019038614e58565b68056bc75e2d63100000682b5e3af16b1880000092020591019038614e43565b68056bc75e2d631000006856bc75e2d63100000092020591019038614e2e565b68ad78ebc5ac62000000925069021e19e0c9bab240000002059101903880614e16565b906b1425982cf597cd205cef73806803782dace9d900000091059101614df5565b50770195e54c5dd42177f53a27172fa9ec63026282700000000090056806f05b59d3b2000000614dd8565b6150dd6150e291614814565b614d9c565b60000390565b600082121561516f5761511b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff926147db565b90670de0b6b3a7640000918281029281840414901517156104af5761513f91613fe5565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613f3c91613b5c565b61511b6001926147db565b615182613b9b565b9061518d82516146f7565b918051926000931561564a5760065443146155e5574360065560085490604051947fef5cfb8c00000000000000000000000000000000000000000000000000000000865260049530600482015281816024818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af180156155505761555b575b5073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b15613851578180916004604051809481937f58f3d1630000000000000000000000000000000000000000000000000000000083525af1801561555057615541575b5090815b84518110156155385773ffffffffffffffffffffffffffffffffffffffff6152cb8287614746565b511690818452600791826020526040852090604051916152ea83612e89565b54916fffffffffffffffffffffffffffffffff8316815260208360801c9101526fffffffffffffffffffffffffffffffff82169173ffffffffffffffffffffffffffffffffffffffff61533d858b614746565b5116806154ac5750615354475b8260801c90612f9f565b6fffffffffffffffffffffffffffffffff8216156154a3575b88615441575b6fffffffffffffffffffffffffffffffff841161044e576153969160801c61348b565b6fffffffffffffffffffffffffffffffff811161044e57600194615430926fffffffffffffffffffffffffffffffff604051936153d285612e89565b8187168552166020840152885260205260408720815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b61543a8285614746565b52016152a3565b92670de0b6b3a764000080850290858204148515171561547557906154698a61546f93613fe5565b9061348b565b92615373565b60118d7f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b6001935061536d565b60208c6024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835230908301525afa801561552d5788906154f9575b615354915061534a565b506020813d602011615525575b8161551360209383612ea5565b8101031261044e5761535490516154ef565b3d9150615506565b6040513d8a823e3d90fd5b50939294505050565b61554a90612e46565b3861529f565b6040513d84823e3d90fd5b3d8083833e61556a8183612ea5565b810160209182818303126140b55780519067ffffffffffffffff8211613da9570181601f820112156140b55780519083806155a484612ee6565b6155b16040519182612ea5565b848152019260051b820101928311613da9578301905b8282106155d657505050615224565b815181529083019083016155c7565b9092805b8451811015615645578073ffffffffffffffffffffffffffffffffffffffff61561460019388614746565b5116835260076020526fffffffffffffffffffffffffffffffff60408420541661563e8286614746565b52016155e9565b505090565b92509190565b1561565757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b9291909273ffffffffffffffffffffffffffffffffffffffff80911680151580615818575b6156b490615650565b600094818652602090600982526040938488205491885b815181101561580c57826156df8284614746565b5116908a6156ed828b614746565b5183825260058089528a83208a845289526fffffffffffffffffffffffffffffffff94858c852054168015615804575b83811480156157fc575b6157ee57670de0b6b3a764000061574a6157446157659387612f9f565b8c613f4a565b04828652838c528d86208d87528c528d86205460801c61348b565b9386841161384e5786851161384e57866157e8956001988f519661578888612e89565b168652168b850152528852898d20898e528852898d20815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b016156cb565b5050505050600191506157e8565b508315615727565b50600161571d565b50505050505050509050565b50308114156156ab565b73ffffffffffffffffffffffffffffffffffffffff6158508183169283151580615a06575b6111ef90615650565b9060409182517fe268b3a40000000000000000000000000000000000000000000000000000000081528460048201528381602481600080977f0000000000000000000000000000000000000000000000000000000000000000165af19081156159fc57839084926159bb575b506fffffffffffffffffffffffffffffffff80911690602884028481046028148515171561598e57606490049282615932575b5050509080821060001461592a5750925b61591c8461294260085484865260096020528686205490612f9f565b600855815260096020522055565b905092615900565b61596592916129c991167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416613f4a565b603c810290808204603c14901517156140885790606461598692049061348b565b3880806158ef565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b809250858092503d83116159f5575b6159d48183612ea5565b810103126159f1576159ea6020612a2883615f19565b90386158bc565b8280fd5b503d6159ca565b84513d85823e3d90fd5b5030841415615847565b91929015615a8b5750815115615a24575090565b3b15615a2d5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015615a9e5750805190602001fd5b615ad4906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301612cad565b0390fd5b15615adf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c6964206578706f6e656e74000000000000000000000000000000006044820152fd5b7ffffffffffffffffffffffffffffffffffffffffffffffffdc702bd3a30fc000081121580615f06575b615b7090615ad8565b60008112615ef1576064906806f05b59d3b20000008112615e8e577ffffffffffffffffffffffffffffffffffffffffffffffff90fa4a62c4e0000000168056bc75e2d6310000082770195e54c5dd42177f53a27172fa9ec630262827000000000925b02819068ad78ebc5ac62000000811215615e55575b6856bc75e2d631000000811215615e1b575b682b5e3af16b18800000811215615de3575b6815af1d78b58c400000811215615dab575b680ad78ebc5ac6200000811215615d74575b82811215615d3d575b6802b5e3af16b1880000811215615d06575b68015af1d78b58c40000811215615ccf575b60028382800205058360038184840205056004828583020505600583868302050560068487830205056007858883020505906008868984020505926009878a8602050594600a888b8802050596600b898c8a02050599600c8a8d8d0205059b0101010101010101010101010205020590565b6806f5f17757889379377ffffffffffffffffffffffffffffffffffffffffffffffffea50e2874a73c000084920192020590615c5d565b6808f00f760a4b2db55d7ffffffffffffffffffffffffffffffffffffffffffffffffd4a1c50e94e78000084920192020590615c4b565b680ebc5fb417461211107ffffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf0000084920192020590615c39565b68280e60114edb805d037ffffffffffffffffffffffffffffffffffffffffffffffff5287143a539e0000084920192020590615c30565b690127fa27722cc06cc5e27fffffffffffffffffffffffffffffffffffffffffffffffea50e2874a73c0000084920192020590615c1e565b693f1fce3da636ea5cf8507fffffffffffffffffffffffffffffffffffffffffffffffd4a1c50e94e780000084920192020590615c0c565b6b02df0ab5a80a22c61ab5a7007fffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf00000084920192020590615bfa565b6e01855144814a7ff805980ff008400091507fffffffffffffffffffffffffffffffffffffffffffffff5287143a539e00000001615be8565b6803782dace9d90000008112615ede577ffffffffffffffffffffffffffffffffffffffffffffffffc87d25316270000000168056bc75e2d63100000826b1425982cf597cd205cef738092615bd3565b68056bc75e2d6310000082600192615bd3565b615efd90600003615b3d565b613f3c90614814565b5068070c1cc73b00c80000811315615b67565b51906fffffffffffffffffffffffffffffffff8216820361044e5756fea26469706673582212207ec7e7d930e2768556c3909bdd35af9d576990d49834c46738e318ce656bfdfd64736f6c634300081800330000000000000000000000001d27254125246873a19580b7364bff322c5def0f00000000000000000000000000000000000000000000000142eee7db5c295c000000000000000000000000000000000000000000000000000e61623969d2b80000000000000000000000000000000000000000000000000000038d0a4e4d25400000000000000000000000004f30a9d41b80ecc5b94306ab4364951ae317021000000000000000000000000047d74516b33ed5d70dde7119a40839f6fcc24e57

Deployed Bytecode

0x608080604052600436101561001357600080fd5b60003560e01c90816306fdde0314612bd2575080630892cd8b14612b6d578063095ea7b314612b1e578063156e29f61461210557806318160ddd146120a85780631dd19cb414611f0c57806323b872dd14611d7a578063252c09d714611cf857806329910b11146119ad5780632c8ce6bc146118ee5780632f13b60c14611892578063313ce5671461183657806337d45e3a146116245780635b709f17146112b95780635cbadbe41461121e57806370a08231146111b35780637206926414611177578063794052f3146110c4578063883bdbfd14610e215780639262187b14610b9957806395d89b4114610a41578063a9059cbb1461096d578063a9f8d18114610931578063c3fb90d6146108ac578063c45a01551461083d578063c4f59f9b146107ab578063dd62ed3e1461072e578063e184c9be146106d5578063e4f8b2e914610670578063ea64a820146105e65763f6b911bc1461017457600080fd5b3461044e5761018236612d59565b916002805490610197818360f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8093161781556101e73361302e565b3015610562576101f630614b3e565b30600052602092600084526040600020548781106104de57879030600052600086520360406000205580871161044e578254818816828216038281116104af57827fff000000000000000000000000000000000000000000000000000000000000009116911617835560006040518881527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef863092a361029530614c01565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff871161044e57861561048557838201956102d1875189613b5c565b956102e26040850197885190613db8565b976102f96102f186518c613b5c565b895190613db8565b9789158061047d575b610453576103118b8251614d3a565b905261031e888651614d3a565b855261032b898251614d3a565b90526000881261044e576000871261044e577f4cf25bc1d991c17529c25213d3cc0cda295eeaad5f13f361969b12ea48015f908860409a6103c07f01000000000000000000000000000000000000000000000000000000000000009773ffffffffffffffffffffffffffffffffffffffff808716968530890361041b575b50508c81891698308a036103e8575b505050613498565b8b51908152602081019190915260408101899052606090a38254161790558351928352820152f35b610413927f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f166136ca565b388c816103b8565b61044791837f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9166136ca565b38856103a9565b600080fd5b60046040517fccbf5468000000000000000000000000000000000000000000000000000000008152fd5b508815610302565b60046040517f25daaec3000000000000000000000000000000000000000000000000000000008152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b608485604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5773ffffffffffffffffffffffffffffffffffffffff610632612d13565b166000908152600760209081526040918290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b0390f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405169ffffffffffffffffffff7f00000000000000000000000000000000000000000000000000038d0a4e4d2540168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760206040517f00000000000000000000000000000000000000000000000000000000676c9c808152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610765612d13565b61076d612d36565b9073ffffffffffffffffffffffffffffffffffffffff8091166000526001602052604060002091166000526020526020604060002054604051908152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576107e2613b9b565b6040518091602080830160208452825180915260206040850193019160005b82811061081057505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610801565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006fcf753f2c67b83f7b09746bbc4fa0047b35d050168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760c0600a54600b5461ffff906040519280600f0b845260801d600f0b60208401526bffffffffffffffffffffffff81166040840152818160601c166060840152818160701c16608084015260801c1660a0820152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020600654604051908152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e577f01000000000000000000000000000000000000000000000000000000000000006109c5612d13565b610a2e600254916109dc60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033613855565b6002541617600255602060405160018152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760405160009060045460018160011c9060018316928315610b8f575b6020938484108114610b6057838652908115610b225750600114610ac7575b61066c84610abb81880382612ea5565b60405191829182612cad565b600460009081529294507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610b0f575050508161066c93610abb9282010193610aab565b8054858501870152928501928101610af3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016858501525050151560051b8201019150610abb8161066c610aab565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691610a8c565b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610bd1612d13565b9060025490610be660028360f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80931617600255610c3783614b3e565b610c4083614c01565b610c48613b9b565b92610c5384516146f7565b90600073ffffffffffffffffffffffffffffffffffffffff95868316915b8151811015610db45787610c858284614746565b5116600052600590818752604060002084600052875260406000205491608092831c610cb18389614746565b52610cbc8288614746565b51610ccd575b506001915001610c71565b89610cd88386614746565b5116600052875260406000208460005287526040600020916fffffffffffffffffffffffffffffffff92838154169055610d128288614746565b519083821161044e578a610d268487614746565b5116600052600789528360406000209216908254901c039283116104af57600192610d8c91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b610dae89610d9a8386614746565b511686610da7848a614746565b5191614c93565b89610cc2565b61066c857f010000000000000000000000000000000000000000000000000000000000000089867f78d61a0c27b13f43911095f9f356f14daa3cd8b125eea1aa22421245e90e813d60405180610e0a8782612efe565b0390a2600254161760025560405191829182612efe565b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5767ffffffffffffffff60043581811161044e573660238201121561044e578060040135610e7d81612ee6565b91610e8b6040519384612ea5565b8183528483016024819360051b8301019136831161044e57602401905b8282106110a85750505063ffffffff91600b5461ffff906040519485937f1dd421ce00000000000000000000000000000000000000000000000000000000855260c4850190600c6004870152824216602487015260c060448701525180915260e4850195916000905b8a83831061108b578a88600081808d8c8c6bffffffffffffffffffffffff81166064850152818160601c16608485015260701c1660a483015203817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af491821561107f57600092610fd4575b5050906040519181839283018184528251809152816040850193019160005b828110610fa057505050500390f35b83517affffffffffffffffffffffffffffffffffffffffffffffffffffff1685528695509381019392810192600101610f91565b9091503d806000843e610fe78184612ea5565b820191838184031261044e57805191821161044e57019080601f8301121561044e57815161101481612ee6565b926110226040519485612ea5565b818452848085019260051b82010192831161044e578401905b82821061104c575050508280610f72565b81517affffffffffffffffffffffffffffffffffffffffffffffffffffff8116810361044e57815290840190840161103b565b6040513d6000823e3d90fd5b845182168952978801978997509093019260019190910190610f11565b813563ffffffff8116810361044e578152908601908601610ea8565b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57610120611106611101612d13565b61302e565b6040519080518252602081015160208301526040810151604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301526101008091015190820152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020600854604051908152f35b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760206112166111ef612d13565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b604051908152f35b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57611255612d13565b61125d612d36565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526005602090815260408083209390941682529182528290205482516fffffffffffffffffffffffffffffffff8216815260809190911c91810191909152f35b3461044e576112c736612db9565b9192906002546112dd60028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000676c9c8011156115fa576113563361302e565b926113807f000000000000000000000000719b51dd92b7809a80a2e8c91d89367bf58f1d7a613400565b937f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818811908161044e576113bc6113c6978a4291846141ce565b9791989098613b0a565b9860008a1261044e576000891261044e576000881261044e5773ffffffffffffffffffffffffffffffffffffffff91828716968c3089036115c7575b505061143889847f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a91694606087015116856136ca565b61144184613498565b8161154a575b505060206114548261366b565b9201918251906000821261044e571061150057505061044e57851161044e576040957f829000a5bc6a12d46e30cdcecd7c56b1efd88f6d7d059da6734a04f3764557c4857f0100000000000000000000000000000000000000000000000000000000000000956114e96114c68a613b0a565b8b5195865260208601526040850192909252606084015233929081906080820190565b0390a3600254161760025582519182526020820152f35b6115099061366b565b9051906000821261044e57604491604051917ff62951c700000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b6000945090858b1161044e5761155f8b613b0a565b333b1561044e578c6115a160009360405195869485947ffa483e7200000000000000000000000000000000000000000000000000000000865260048601612fac565b038183335af1801561107f576115b8575b80611447565b6115c190612e46565b8a6115b2565b6115f391857f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f166136ca565b8c8c611402565b60046040517fb2094b59000000000000000000000000000000000000000000000000000000008152fd5b3461044e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576004359061ffff9081831680930361044e576002549161167a60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025580600b5460801c16604051947f587cdc06000000000000000000000000000000000000000000000000000000008652600c6004870152816024870152604486015282856064817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af491821561107f576000926117e0575b7f010000000000000000000000000000000000000000000000000000000000000095508216808203611767575b60028054861687179055005b7fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a936040937fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff71ffff00000000000000000000000000000000600b549260801b16911617600b558351928352820152a18280808061175b565b91508285813d831161182f575b6117f78183612ea5565b8101031261044e576118297f010000000000000000000000000000000000000000000000000000000000000095612ffe565b9161172e565b503d6117ed565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57602060405160ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e576020604051427f00000000000000000000000000000000000000000000000000000000676c9c8011158152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57606060405173ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9168252807f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f1660208301527f000000000000000000000000719b51dd92b7809a80a2e8c91d89367bf58f1d7a166040820152f35b3461044e576119bb36612db9565b9091926002546119d160028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255427f00000000000000000000000000000000000000000000000000000000676c9c8011156115fa57611a4a3361302e565b91611a747f000000000000000000000000719b51dd92b7809a80a2e8c91d89367bf58f1d7a613400565b957f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96878211908161044e57611ab6904290611aaf85613b0a565b90886141ce565b969198909760008a1261044e576000891261044e576000881261044e5773ffffffffffffffffffffffffffffffffffffffff91828716968b308903611cc5575b5050611b2b8984606087015116857f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9166136ca565b611b3484613498565b81611c46575b50507f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f16611b678161366b565b8251906000821261044e5710611bfc57505061044e57611b8690613b0a565b95851161044e576040957f829000a5bc6a12d46e30cdcecd7c56b1efd88f6d7d059da6734a04f3764557c46114e97f0100000000000000000000000000000000000000000000000000000000000000958951918291898b3397859094939260609260808301968352602083015260408201520152565b611c059061366b565b9051906000821261044e57604491604051917f2c49ea0f00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b6000945090611c5486613b0a565b908c8c1161044e57333b1561044e57600091611c9f8d9260405195869485947ffa483e7200000000000000000000000000000000000000000000000000000000865260048601612fac565b038183335af1801561107f57611cb6575b80611b3a565b611cbf90612e46565b8a611cb0565b611cf191857f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9166136ca565b8c8b611af6565b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760043561ffff81101561044e57606090600c01546040519063ffffffff811682527affffffffffffffffffffffffffffffffffffffffffffffffffffff8160201c16602083015260f81c15156040820152f35b3461044e57611d8836612d59565b60025491611d9c60028460f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094161760025573ffffffffffffffffffffffffffffffffffffffff841660005260016020526040600020336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103611e6a575b5090610a2e917f010000000000000000000000000000000000000000000000000000000000000094613855565b9190818310611eae577f010000000000000000000000000000000000000000000000000000000000000094611ea583610a2e9503338361328b565b94509091611e3d565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57600254611f4e60028260f81c1415612f3a565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80921617600255611f9f3361302e565b9073ffffffffffffffffffffffffffffffffffffffff91827f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f1692611fe38461366b565b82516000811261044e57611ff691612f9f565b90807f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a916906120248261366b565b956020850151966000881261044e577f01000000000000000000000000000000000000000000000000000000000000009761205e91612f9f565b9380612090575b5050826120785760028054861687179055005b606061208794015116906136ca565b8280808061175b565b6120a19183606088015116906136ca565b8680612065565b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b3461044e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5761213c612d13565b602435907f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025461219460028260f81c1415612f3a565b1617600255427f00000000000000000000000000000000000000000000000000000000676c9c8011156115fa576121ca3361302e565b906121f47f000000000000000000000000719b51dd92b7809a80a2e8c91d89367bf58f1d7a613400565b907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80851161044e57806044351161044e57600085158015612b14575b610485574260a086015111156115fa57604085015180612a7d57505061225960443586613b5c565b906000821261044e5760006003831115612a6e5750816001908060011c600181018091116104af5791905b848310612a53575050505b811161044e577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1881019081136001166104af57926103e8604435935b60008613801590612a48575b8015612a3d575b610453576122f0876020850151613ea8565b6020840152612300858451613ea8565b835261231961230f8388613ea8565b6040850151613ea8565b60408401526000821261044e576000861261044e576000871261044e576000851261044e57816126a3575b505073ffffffffffffffffffffffffffffffffffffffff8216156126455761236b82614b3e565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841161044e576002547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80861681831601116104af577fff000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808716818416011691161760025573ffffffffffffffffffffffffffffffffffffffff82166000526000602052604060002061243e85825461348b565b905560405184815260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602073ffffffffffffffffffffffffffffffffffffffff861693a361248d82614c01565b61249681613498565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9166124d68161366b565b6020830151906000821261044e57106125f8575073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001d27254125246873a19580b7364bff322c5def0f1661252a8161366b565b8251906000821261044e5710611bfc575050604080518481526020810186905290810183905261066c929173ffffffffffffffffffffffffffffffffffffffff16907fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb90606090a27f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541617600255604051938493846040919493926060820195825260208201520152565b61260360209161366b565b910151906000821261044e57604491604051917ff62951c700000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b4260a084015111156115fa576126c161270491602085015190613ec4565b6126cf4260a0860151612f9f565b907f0000000000000000000000000000000000000000000000000e61623969d2b800906126fc8387613f5d565b908651613fef565b610100830152612712614979565b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57600254907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831601917effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116104af5760206000927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef927fff000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600197169116176002558484528382526040842061282f82825461348b565b9055604051908152a3306001141580612849575b80612344565b61285290615650565b600160005260006020526040600020546040517fe268b3a400000000000000000000000000000000000000000000000000000000815260016004820152604081602481600073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004f30a9d41b80ecc5b94306ab4364951ae3170210165af1801561107f576000916000916129f6575b50826028810204602814831517156104af5760646028840204916fffffffffffffffffffffffffffffffff8116612983575b50509080821060001461297c57505b612947816129426008546001600052600960205260406000205490612f9f565b61348b565b600855600160005260096020527f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a365585612843565b9050612922565b906129c96fffffffffffffffffffffffffffffffff806129ce941692167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416613f4a565b613fe5565b90603c820291808304603c14901517156104af5760646129ef92049061348b565b8780612913565b9150506040813d604011612a35575b81612a1260409383612ea5565b8101031261044e57612a2f6020612a2883615f19565b9201615f19565b886128e1565b3d9150612a05565b5060008513156122de565b5060008713156122d7565b90919350612a65846129428184613fe5565b821c9190612284565b911561228f576001915061228f565b612a9b91959250612a9390604497959735613b5c565b825190613db8565b93612aaa604083015185613b5c565b93612abb6020840195865190613db8565b9081871215612af9575050612af3612ad7866044359651613b5c565b612aee612ae960408601518093613ea8565b613e3c565b613db8565b956122cb565b9550959350612b0e612ad78796978451613b5c565b936122cb565b5060443515612231565b3461044e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e57612b62612b58612d13565b602435903361328b565b602060405160018152f35b3461044e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5773ffffffffffffffffffffffffffffffffffffffff612bb9612d13565b1660005260096020526020604060002054604051908152f35b3461044e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261044e5760009060035460018160011c9060018316928315612ca3575b6020938484108114610b6057838652908115610b225750600114612c485761066c84610abb81880382612ea5565b600360009081529294507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410612c90575050508161066c93610abb9282010193610aab565b8054858501870152928501928101612c74565b91607f1691612c1a565b60208082528251818301819052939260005b858110612cff575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006040809697860101520116010190565b818101830151848201604001528201612cbf565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc606091011261044e5773ffffffffffffffffffffffffffffffffffffffff90600435828116810361044e5791602435908116810361044e579060443590565b9060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261044e5760043573ffffffffffffffffffffffffffffffffffffffff8116810361044e57916024359160443567ffffffffffffffff9283821161044e578060238301121561044e57816004013593841161044e576024848301011161044e576024019190565b67ffffffffffffffff8111612e5a57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff821117612e5a57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612e5a57604052565b67ffffffffffffffff8111612e5a5760051b60200190565b602090602060408183019282815285518094520193019160005b828110612f26575050505090565b835185529381019392810192600101612f18565b15612f4157565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b919082039182116104af57565b9293806080957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe094601f9487526020870152606060408701528160608701528686013760008582860101520116010190565b519061ffff8216820361044e57565b519073ffffffffffffffffffffffffffffffffffffffff8216820361044e57565b906040805192610120840184811067ffffffffffffffff821117612e5a57825260608401600090818152608086019180835260a087019381855260c088019282845260e089018381526101008a01978489528a600a5480600f0b825260801d600f0b60208201527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821161326d5782015273ffffffffffffffffffffffffffffffffffffffff91828251957f5c098c11000000000000000000000000000000000000000000000000000000008752306004880152166024860152606085604481867f0000000000000000000000006fcf753f2c67b83f7b09746bbc4fa0047b35d050165afa80156132815786928796889261320d575b505060ff16905216905269ffffffffffffffffffff915080821661320857507f00000000000000000000000000000000000000000000000000038d0a4e4d25405b1690527f00000000000000000000000000000000000000000000000142eee7db5c295c0090527f00000000000000000000000000000000000000000000000000000000676c9c8090526bffffffffffffffffffffffff600b54169052565b6131aa565b93509550506060823d606011613279575b8161322b60609383612ea5565b810103126132755761323c8261300d565b9460208301519269ffffffffffffffffffff841684036132715701519460ff8616860361326d57919460ff38613169565b8680fd5b8780fd5b8580fd5b3d915061321e565b82513d88823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561337d57169182156132f95760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b602073ffffffffffffffffffffffffffffffffffffffff600460009360405194859384927f1d52edc4000000000000000000000000000000000000000000000000000000008452165af190811561107f5760009161345c575090565b90506020813d602011613483575b8161347760209383612ea5565b8101031261044e575190565b3d915061346a565b919082018092116104af57565b610100810180516bffffffffffffffffffffffff80821161044e576134ca60206134c2865161417f565b95015161417f565b93600b549161ffff956040968751947f4af74b68000000000000000000000000000000000000000000000000000000008652600c6004870152818160601c16602487015263ffffffff421660448701528381166064870152818160701c16608487015260801c1660a4850152868460c4817383d6fa7f8904299f4a9499fe83b6ae3f21ffba575af49182156136605760009360009361360a575b6dffff0000000000000000000000009495507fffffffffffffffffffffffffffffffff00000000000000000000000000000000809360801b16906fffffffffffffffffffffffffffffffff1617600a556fffff0000000000000000000000000000600b549360701b1695169116179160601b161717600b555190519081527f5c0e21d57bb4cf91d8fe238d6f92e2685a695371b19209afcce6217b478f83e160204292a2565b925092508684813d8311613659575b6136238183612ea5565b8101031261044e576dffff00000000000000000000000092613650602061364987612ffe565b9601612ffe565b92859450613564565b503d613619565b87513d6000823e3d90fd5b602073ffffffffffffffffffffffffffffffffffffffff916024604051809481937f70a08231000000000000000000000000000000000000000000000000000000008352306004840152165afa90811561107f5760009161345c575090565b9060405160208101937fa9059cbb00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff8093166024830152604482015260448152608081019181831067ffffffffffffffff841117612e5a5761378b9383604052169061374783612e89565b602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460a0820152600080958192519082855af1613785614c35565b91615a10565b908151918215928315613827575b505050156137a357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b819293509060209181010312613851576020015190811515820361384e5750388080613799565b80fd5b5080fd5b91909173ffffffffffffffffffffffffffffffffffffffff808216908115613a86578416928315613a02578382146139a4576138918584614b92565b6000908282528160205260408220548181106139205760208260408587957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95878c99528286520382822055868152206138ec82825461348b565b9055604051908152a33003613911575b5030036139065750565b61390f90615822565b565b61391a90615822565b386138fc565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b9081600003918083057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14901517156104af57565b90670de0b6b3a7640000918281029281840514901517156104af57565b8181029291600082127f80000000000000000000000000000000000000000000000000000000000000008214166104af5781840514901517156104af57565b73ffffffffffffffffffffffffffffffffffffffff6040517fc4f59f9b0000000000000000000000000000000000000000000000000000000081526000918282600481847f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9165afa918215613dad578392613d0e575b507f000000000000000000000000808507121b80c02388fad14726482e061b8da82791613c3e8382614789565b613d07578051906001906001830195868411613cda577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0613c97613c8189612ee6565b98613c8f6040519a8b612ea5565b808a52612ee6565b013660208901375b838110613cba57505050613cb39084614746565b9116905290565b8085613cc7859385614746565b5116613cd3828a614746565b5201613c9f565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b9250505090565b9091503d8084833e613d208183612ea5565b8101906020908181840312613da95780519067ffffffffffffffff821161327557019180601f84011215613da9578251613d5981612ee6565b93613d676040519586612ea5565b818552838086019260051b82010192831161326d578301905b828210613d9257505050509038613c11565b838091613d9e8461300d565b815201910190613d80565b8480fd5b6040513d85823e3d90fd5b8115613e0d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f80000000000000000000000000000000000000000000000000000000000000008214166104af570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182136001166104af57565b90670de0b6b3a7640000600083820393128184128116918413901516176104af57565b818103929160001380158285131691841216176104af57565b919091600083820193841291129080158216911516176104af57565b613f0b670de0b6b3a76400009160008412600014613f3f57613f067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff946147db565b613f4a565b047f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613f3c91613b5c565b90565b613f066001946147db565b818102929181159184041417156104af57565b60800151906301e13380918281029281840514901517156104af577f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613fa891613db8565b906000821315613fb457565b602482604051907f1ca418760000000000000000000000000000000000000000000000000000000082526004820152fd5b8115613e0d570490565b94939291906000958681126141215761401461400e6140199383613ea8565b91613b3f565b61482e565b670d529ae9e86000008082136140ea5750614048929161401461403e61404393614d4b565b613b3f565b613ea8565b670de0b6b3a764000081126140b95761406090614838565b8381126140b5576301e133809081810291818304149015171561408857613f3c929350613fe5565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8380fd5b602490604051907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b60449250604051917ffc68d09e00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f6e656761746976650000000000000000000000000000000000000000000000006044820152fd5b807fffffffffffffffffffffffffffffffff800000000000000000000000000000001315806141b4575b1561044e57600f0b90565b506f7fffffffffffffffffffffffffffffff8113156141a9565b93909360a081019484865111156115fa578151848113156146c057506040918251946080860186811067ffffffffffffffff821117612e5a57845260009586815260208101938785528582019088825260608301948986528a8c5111156146975761423a8b8d51612f9f565b956142458783613f5d565b85526020820196614257885185613ec4565b808a528351908115801561468f575b61465957505082516101008401998a5192808251938a519561428e6301e13380948592613f4a565b04957f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96878111614652576142c290615b3d565b91670de0b6b3a76400009687841261461f576143029261401461403e6142f78561401461400e6142fc9761430e9c9b99613ea8565b614d4b565b90613e8f565b8a5260c0880151613f4a565b0483811161461b57906143218a92615b3d565b8552614346865191519161401461400e8c51946143408d519785614d3a565b93613ea8565b670d529ae9e86000008082136145e5575061436b929161401461403e61404393614d4b565b8181126145b5578d90614389614384826140148d613b3f565b613b0a565b9451918a131561459557816140146143a092613b3f565b82811261456557506143bb6143b58392613e6c565b85613b5c565b059c5b60e0850151838111613851578e60646143da6143e19383613b5c565b0595613e8f565b91818312801561454d57156145425761441a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff936147db565b81810291818304149015171561451557866144349161348b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111614515578661446891613fe5565b92831161384e57506144859161447d91613b5c565b9b5b846150e8565b9061449090846150e8565b9a8b919c819e51906144a191612f9f565b968351906144ae91614d3a565b83528751916144bc91613ea8565b6144c591614d3a565b80965251946144d391613ec4565b91519051916144e194613fef565b809152156144ec5750565b600490517faa69ae1e000000000000000000000000000000000000000000000000000000008152fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b61441a6001936147db565b505050614485915061455f90856150e8565b9b61447f565b6024908d51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b5061438481612aee6145a96145af94613e6c565b87613b5c565b9c6143be565b6024908c51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b604492508e51917ffc68d09e00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b8e80fd5b5050506024908f51907fca78c8a40000000000000000000000000000000000000000000000000000000082526004820152fd5b5050508f80fd5b604492508b51917fb1c4aefb00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b508015614266565b600488517fb2094b59000000000000000000000000000000000000000000000000000000008152fd5b60449085604051917f8615426c00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b9061470182612ee6565b61470e6040519182612ea5565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061473c8294612ee6565b0190602036910137565b805182101561475a5760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9081519160005b8381106147a05750505050600090565b73ffffffffffffffffffffffffffffffffffffffff806147c08385614746565b5116908416146147d257600101614790565b50505050600190565b6000808213156147e9575090565b7f80000000000000000000000000000000000000000000000000000000000000008214613cda570390565b8015613e0d576ec097ce7bc90715b34b9f10000000000590565b8115613e0d570590565b600081131561491b5780670c7d713b49da0000128061490a575b1561490157670de0b6b3a7640000906ec097ce7bc90715b34b9f1000000000906148a5908302828101907fffffffffffffffffffffffffffffffffff3f68318436f8ea4cb460f00000000001830261482e565b9080828002059181838202058284820205838582020591848684020593858786020595808888020597880205600f900596600d900595600b900594600990059360079005926005900591600390050101010101010160011b0590565b613f3c90614d9c565b50670f43fc2c04ee00008112614852565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6f7574206f6620626f756e6473000000000000000000000000000000000000006044820152fd5b61498161517a565b815115614b3a5760019030821415908161499c575b50505050565b6149a98395949392615650565b600082815260209060098252604091828220549582985b6149d1575b50505050839450614996565b8051891015614b355773ffffffffffffffffffffffffffffffffffffffff6149f98a83614746565b511698614a068187614746565b519980855260059081855286862089875285526fffffffffffffffffffffffffffffffff8088882054168015614b2e575b8d81148015614b26575b614b165781614a848f92614a688f614a62670de0b6b3a76400009387612f9f565b90613f4a565b04858b52868a528d8c8c20908c528a528b8b205460801c61348b565b9111613271578181116132715792614b0d92828c9d9e9f93958d97968c5195614aac87612e89565b1685521688840152885286528787208488528652878720815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b019897966149c0565b5050505086979899508690614b0d565b508d15614a41565b5089614a37565b6149c5565b5050565b614b4661517a565b90805115614b8d5773ffffffffffffffffffffffffffffffffffffffff83168015159081614b82575b50614b7957505050565b61390f92615686565b905030141538614b6f565b505050565b614b9a61517a565b918151156149965773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081614bf6575b50614be5575b50505083168015159081614b825750614b7957505050565b614bee92615686565b388383614bcd565b905030141538614bc7565b73ffffffffffffffffffffffffffffffffffffffff81168015159081614c2a575b506139065750565b905030141538614c22565b3d15614c8e573d9067ffffffffffffffff8211612e5a5760405191614c8260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184612ea5565b82523d6000602084013e565b606090565b9190918115614b8d5773ffffffffffffffffffffffffffffffffffffffff169182614d31576000809350809281925af1614ccb614c35565b5015614cd357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b61390f926136ca565b9080821261412157613f3c91613e8f565b670de0b6b3a76400008114614d7257614d6d8161401461400e613f3c94613e6c565b614838565b60046040517fa9c8b14d000000000000000000000000000000000000000000000000000000008152fd5b670de0b6b3a764000081126150d15760649060007e1600ef3172e58d2e933ec884fde10064c63b5372d805e203c00000000000008212156150a6575b73011798004d755d3c8bc8e03204cf44619e000000821215615085575b820290808302906e01855144814a7ff805980ff00840009081831215615062575b50506b02df0ab5a80a22c61ab5a70080821215615042575b50693f1fce3da636ea5cf85080821215615022575b50690127fa27722cc06cc5e280821215615002575b5068280e60114edb805d0380821215614fe2575b50680ebc5fb4174612111080821215614fcb575b506808f00f760a4b2db55d80821215614fab575b506806f5f177578893793780821215614f8b575b506806248f33704b28660380821215614f6c575b506805c548670b9510e7ac80821215614f4d575b50614f0c68056bc75e2d6310000091827ffffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf0000081830192010261482e565b9080828002059181838202058284820205916003600560076009600b888a89020598808b8b02059a8b0205059805960594059205010101010160011b010590565b68056bc75e2d631000006756bc75e2d631000092020591019038614ed0565b68056bc75e2d6310000067ad78ebc5ac62000092020591019038614ebc565b68056bc75e2d6310000068015af1d78b58c4000092020591019038614ea8565b68056bc75e2d631000006802b5e3af16b188000092020591019038614e94565b68056bc75e2d631000008092020591019038614e80565b68056bc75e2d63100000680ad78ebc5ac620000092020591019038614e6c565b68056bc75e2d631000006815af1d78b58c40000092020591019038614e58565b68056bc75e2d63100000682b5e3af16b1880000092020591019038614e43565b68056bc75e2d631000006856bc75e2d63100000092020591019038614e2e565b68ad78ebc5ac62000000925069021e19e0c9bab240000002059101903880614e16565b906b1425982cf597cd205cef73806803782dace9d900000091059101614df5565b50770195e54c5dd42177f53a27172fa9ec63026282700000000090056806f05b59d3b2000000614dd8565b6150dd6150e291614814565b614d9c565b60000390565b600082121561516f5761511b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff926147db565b90670de0b6b3a7640000918281029281840414901517156104af5761513f91613fe5565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044e57613f3c91613b5c565b61511b6001926147db565b615182613b9b565b9061518d82516146f7565b918051926000931561564a5760065443146155e5574360065560085490604051947fef5cfb8c00000000000000000000000000000000000000000000000000000000865260049530600482015281816024818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009e8f10574acc2c62c6e5d19500ced39163da37a9165af180156155505761555b575b5073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000047d74516b33ed5d70dde7119a40839f6fcc24e5716803b15613851578180916004604051809481937f58f3d1630000000000000000000000000000000000000000000000000000000083525af1801561555057615541575b5090815b84518110156155385773ffffffffffffffffffffffffffffffffffffffff6152cb8287614746565b511690818452600791826020526040852090604051916152ea83612e89565b54916fffffffffffffffffffffffffffffffff8316815260208360801c9101526fffffffffffffffffffffffffffffffff82169173ffffffffffffffffffffffffffffffffffffffff61533d858b614746565b5116806154ac5750615354475b8260801c90612f9f565b6fffffffffffffffffffffffffffffffff8216156154a3575b88615441575b6fffffffffffffffffffffffffffffffff841161044e576153969160801c61348b565b6fffffffffffffffffffffffffffffffff811161044e57600194615430926fffffffffffffffffffffffffffffffff604051936153d285612e89565b8187168552166020840152885260205260408720815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b61543a8285614746565b52016152a3565b92670de0b6b3a764000080850290858204148515171561547557906154698a61546f93613fe5565b9061348b565b92615373565b60118d7f4e487b71000000000000000000000000000000000000000000000000000000006000525260246000fd5b6001935061536d565b60208c6024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835230908301525afa801561552d5788906154f9575b615354915061534a565b506020813d602011615525575b8161551360209383612ea5565b8101031261044e5761535490516154ef565b3d9150615506565b6040513d8a823e3d90fd5b50939294505050565b61554a90612e46565b3861529f565b6040513d84823e3d90fd5b3d8083833e61556a8183612ea5565b810160209182818303126140b55780519067ffffffffffffffff8211613da9570181601f820112156140b55780519083806155a484612ee6565b6155b16040519182612ea5565b848152019260051b820101928311613da9578301905b8282106155d657505050615224565b815181529083019083016155c7565b9092805b8451811015615645578073ffffffffffffffffffffffffffffffffffffffff61561460019388614746565b5116835260076020526fffffffffffffffffffffffffffffffff60408420541661563e8286614746565b52016155e9565b505090565b92509190565b1561565757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b9291909273ffffffffffffffffffffffffffffffffffffffff80911680151580615818575b6156b490615650565b600094818652602090600982526040938488205491885b815181101561580c57826156df8284614746565b5116908a6156ed828b614746565b5183825260058089528a83208a845289526fffffffffffffffffffffffffffffffff94858c852054168015615804575b83811480156157fc575b6157ee57670de0b6b3a764000061574a6157446157659387612f9f565b8c613f4a565b04828652838c528d86208d87528c528d86205460801c61348b565b9386841161384e5786851161384e57866157e8956001988f519661578888612e89565b168652168b850152528852898d20898e528852898d20815160209092015160801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b016156cb565b5050505050600191506157e8565b508315615727565b50600161571d565b50505050505050509050565b50308114156156ab565b73ffffffffffffffffffffffffffffffffffffffff6158508183169283151580615a06575b6111ef90615650565b9060409182517fe268b3a40000000000000000000000000000000000000000000000000000000081528460048201528381602481600080977f0000000000000000000000004f30a9d41b80ecc5b94306ab4364951ae3170210165af19081156159fc57839084926159bb575b506fffffffffffffffffffffffffffffffff80911690602884028481046028148515171561598e57606490049282615932575b5050509080821060001461592a5750925b61591c8461294260085484865260096020528686205490612f9f565b600855815260096020522055565b905092615900565b61596592916129c991167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416613f4a565b603c810290808204603c14901517156140885790606461598692049061348b565b3880806158ef565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b809250858092503d83116159f5575b6159d48183612ea5565b810103126159f1576159ea6020612a2883615f19565b90386158bc565b8280fd5b503d6159ca565b84513d85823e3d90fd5b5030841415615847565b91929015615a8b5750815115615a24575090565b3b15615a2d5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015615a9e5750805190602001fd5b615ad4906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301612cad565b0390fd5b15615adf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c6964206578706f6e656e74000000000000000000000000000000006044820152fd5b7ffffffffffffffffffffffffffffffffffffffffffffffffdc702bd3a30fc000081121580615f06575b615b7090615ad8565b60008112615ef1576064906806f05b59d3b20000008112615e8e577ffffffffffffffffffffffffffffffffffffffffffffffff90fa4a62c4e0000000168056bc75e2d6310000082770195e54c5dd42177f53a27172fa9ec630262827000000000925b02819068ad78ebc5ac62000000811215615e55575b6856bc75e2d631000000811215615e1b575b682b5e3af16b18800000811215615de3575b6815af1d78b58c400000811215615dab575b680ad78ebc5ac6200000811215615d74575b82811215615d3d575b6802b5e3af16b1880000811215615d06575b68015af1d78b58c40000811215615ccf575b60028382800205058360038184840205056004828583020505600583868302050560068487830205056007858883020505906008868984020505926009878a8602050594600a888b8802050596600b898c8a02050599600c8a8d8d0205059b0101010101010101010101010205020590565b6806f5f17757889379377ffffffffffffffffffffffffffffffffffffffffffffffffea50e2874a73c000084920192020590615c5d565b6808f00f760a4b2db55d7ffffffffffffffffffffffffffffffffffffffffffffffffd4a1c50e94e78000084920192020590615c4b565b680ebc5fb417461211107ffffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf0000084920192020590615c39565b68280e60114edb805d037ffffffffffffffffffffffffffffffffffffffffffffffff5287143a539e0000084920192020590615c30565b690127fa27722cc06cc5e27fffffffffffffffffffffffffffffffffffffffffffffffea50e2874a73c0000084920192020590615c1e565b693f1fce3da636ea5cf8507fffffffffffffffffffffffffffffffffffffffffffffffd4a1c50e94e780000084920192020590615c0c565b6b02df0ab5a80a22c61ab5a7007fffffffffffffffffffffffffffffffffffffffffffffffa9438a1d29cf00000084920192020590615bfa565b6e01855144814a7ff805980ff008400091507fffffffffffffffffffffffffffffffffffffffffffffff5287143a539e00000001615be8565b6803782dace9d90000008112615ede577ffffffffffffffffffffffffffffffffffffffffffffffffc87d25316270000000168056bc75e2d63100000826b1425982cf597cd205cef738092615bd3565b68056bc75e2d6310000082600192615bd3565b615efd90600003615b3d565b613f3c90614814565b5068070c1cc73b00c80000811315615b67565b51906fffffffffffffffffffffffffffffffff8216820361044e5756fea26469706673582212207ec7e7d930e2768556c3909bdd35af9d576990d49834c46738e318ce656bfdfd64736f6c63430008180033

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

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