ETH Price: $3,445.57 (+1.40%)
Gas: 9 Gwei

Contract

0x22E12A50e3ca49FB183074235cB1db84Fe4C716D
 
Transaction Hash
Method
Block
From
To
0x1c962de9ed80f5db522f788f05fb545877910a25c960b24bfe18b1d98a73c155 Approve(pending)2024-07-14 3:20:153 days ago1720927215IN
Pendle: SY-ezETH Token
0 ETH(Pending)(Pending)
Approve203260852024-07-17 11:55:351 hr ago1721217335IN
Pendle: SY-ezETH Token
0 ETH0.000365287.93262005
Approve203260212024-07-17 11:42:471 hr ago1721216567IN
Pendle: SY-ezETH Token
0 ETH0.00045569.89423238
Approve203248362024-07-17 7:44:475 hrs ago1721202287IN
Pendle: SY-ezETH Token
0 ETH0.000400338.69156725
Approve203244092024-07-17 6:19:117 hrs ago1721197151IN
Pendle: SY-ezETH Token
0 ETH0.0005389811.70481234
Approve203223112024-07-16 23:18:1114 hrs ago1721171891IN
Pendle: SY-ezETH Token
0 ETH0.000336487.30729045
Approve203217192024-07-16 21:19:4716 hrs ago1721164787IN
Pendle: SY-ezETH Token
0 ETH0.0007223115.68607019
Approve203215822024-07-16 20:52:2316 hrs ago1721163143IN
Pendle: SY-ezETH Token
0 ETH0.000165866.89272263
Approve203201852024-07-16 16:11:5921 hrs ago1721146319IN
Pendle: SY-ezETH Token
0 ETH0.0008754919.01259635
Approve203197842024-07-16 14:51:3522 hrs ago1721141495IN
Pendle: SY-ezETH Token
0 ETH0.000215698.96359642
Approve203197772024-07-16 14:50:1122 hrs ago1721141411IN
Pendle: SY-ezETH Token
0 ETH0.000219279.11211101
Approve203197742024-07-16 14:49:3522 hrs ago1721141375IN
Pendle: SY-ezETH Token
0 ETH0.0002434310.1414999
Approve203196902024-07-16 14:32:4723 hrs ago1721140367IN
Pendle: SY-ezETH Token
0 ETH0.0002980212.41575022
Approve203196682024-07-16 14:28:2323 hrs ago1721140103IN
Pendle: SY-ezETH Token
0 ETH0.0002941912.22562341
Approve203196632024-07-16 14:27:2323 hrs ago1721140043IN
Pendle: SY-ezETH Token
0 ETH0.0002852611.88411094
Approve203194002024-07-16 13:34:1123 hrs ago1721136851IN
Pendle: SY-ezETH Token
0 ETH0.000212158.83812161
Approve203193412024-07-16 13:22:2324 hrs ago1721136143IN
Pendle: SY-ezETH Token
0 ETH0.000228149.50445207
Approve203192992024-07-16 13:13:5924 hrs ago1721135639IN
Pendle: SY-ezETH Token
0 ETH0.0001988.22832683
Approve203191052024-07-16 12:35:1124 hrs ago1721133311IN
Pendle: SY-ezETH Token
0 ETH0.000322427
Approve203176212024-07-16 7:36:5929 hrs ago1721115419IN
Pendle: SY-ezETH Token
0 ETH0.000275585.98316569
Approve203175322024-07-16 7:18:5930 hrs ago1721114339IN
Pendle: SY-ezETH Token
0 ETH0.000342247.43043468
Approve203172172024-07-16 6:15:4731 hrs ago1721110547IN
Pendle: SY-ezETH Token
0 ETH0.000208664.5315391
Approve203167352024-07-16 4:38:5932 hrs ago1721104739IN
Pendle: SY-ezETH Token
0 ETH0.000119174.95259703
Approve203166182024-07-16 4:15:2333 hrs ago1721103323IN
Pendle: SY-ezETH Token
0 ETH0.000110114.57583972
Approve203162162024-07-16 2:54:5934 hrs ago1721098499IN
Pendle: SY-ezETH Token
0 ETH0.000088473.67666353
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
203180242024-07-16 8:57:4728 hrs ago1721120267
Pendle: SY-ezETH Token
0.00903015 ETH
203180242024-07-16 8:57:4728 hrs ago1721120267
Pendle: SY-ezETH Token
0.00903015 ETH
203095212024-07-15 4:27:352 days ago1721017655
Pendle: SY-ezETH Token
24.68752641 ETH
203095212024-07-15 4:27:352 days ago1721017655
Pendle: SY-ezETH Token
24.68752641 ETH
202980372024-07-13 13:59:473 days ago1720879187
Pendle: SY-ezETH Token
0.1820148 ETH
202980372024-07-13 13:59:473 days ago1720879187
Pendle: SY-ezETH Token
0.1820148 ETH
202913202024-07-12 15:28:354 days ago1720798115
Pendle: SY-ezETH Token
19.8236637 ETH
202913202024-07-12 15:28:354 days ago1720798115
Pendle: SY-ezETH Token
19.8236637 ETH
202812392024-07-11 5:41:596 days ago1720676519
Pendle: SY-ezETH Token
0.11838102 ETH
202812392024-07-11 5:41:596 days ago1720676519
Pendle: SY-ezETH Token
0.11838102 ETH
202789452024-07-10 21:59:596 days ago1720648799
Pendle: SY-ezETH Token
0.04058157 ETH
202789452024-07-10 21:59:596 days ago1720648799
Pendle: SY-ezETH Token
0.04058157 ETH
202789422024-07-10 21:59:116 days ago1720648751
Pendle: SY-ezETH Token
0.04058147 ETH
202789422024-07-10 21:59:116 days ago1720648751
Pendle: SY-ezETH Token
0.04058147 ETH
202593382024-07-08 4:14:359 days ago1720412075
Pendle: SY-ezETH Token
0.00607862 ETH
202593382024-07-08 4:14:359 days ago1720412075
Pendle: SY-ezETH Token
0.00607862 ETH
202468962024-07-06 10:33:3511 days ago1720262015
Pendle: SY-ezETH Token
0.00140982 ETH
202468962024-07-06 10:33:3511 days ago1720262015
Pendle: SY-ezETH Token
0.00140982 ETH
202313292024-07-04 6:22:2313 days ago1720074143
Pendle: SY-ezETH Token
0.12924457 ETH
202313292024-07-04 6:22:2313 days ago1720074143
Pendle: SY-ezETH Token
0.12924457 ETH
202309142024-07-04 4:58:5913 days ago1720069139
Pendle: SY-ezETH Token
242.02050595 ETH
202309142024-07-04 4:58:5913 days ago1720069139
Pendle: SY-ezETH Token
242.02050595 ETH
202308432024-07-04 4:44:4713 days ago1720068287
Pendle: SY-ezETH Token
0.64432381 ETH
202308432024-07-04 4:44:4713 days ago1720068287
Pendle: SY-ezETH Token
0.64432381 ETH
202308022024-07-04 4:36:2313 days ago1720067783
Pendle: SY-ezETH Token
242.58474258 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PendleEzETHSY

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
berlin EvmVersion
File 1 of 36 : PendleEzETHSY.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../../SYBase.sol";
import "../../../../interfaces/IPExchangeRateOracle.sol";
import "../../../../interfaces/Renzo/IRenzoRestakeManager.sol";
import "../../../../interfaces/Renzo/IRenzoOracle.sol";

contract PendleEzETHSY is SYBase {
    using ArrayLib for address[];

    address public immutable ezETH;
    address public immutable restakeManager;
    address public immutable renzoOracle;
    uint256 public immutable referralId;

    address public exchangeRateOracle;
    address[] public supportedCollateralTokens;

    event SetNewExchangeRateOracle(address oracle);

    constructor(
        address _ezETH,
        address _stakeManager,
        address _exchangeRateOracle,
        uint256 _referralId
    ) SYBase("SY Renzo ezETH", "SY-ezETH", _ezETH) {
        ezETH = _ezETH;
        restakeManager = _stakeManager;
        exchangeRateOracle = _exchangeRateOracle;
        renzoOracle = IRenzoRestakeManager(restakeManager).renzoOracle();
        referralId = _referralId;
    }

    // this way we dont have to check if length is accurate
    function refetchCollateralTokens(uint256 length) external onlyOwner {
        address[] memory newCollateralTokens = new address[](length);
        for (uint256 i = 0; i < length; ++i) {
            newCollateralTokens[i] = IRenzoRestakeManager(restakeManager).collateralTokens(i);

            // just a safety check, preventing human mistake from underlying protocol
            require(newCollateralTokens[i] != ezETH, "refetchCollateralTokens: should not approve ezETH");
            _safeApproveInf(newCollateralTokens[i], restakeManager);
        }
        supportedCollateralTokens = newCollateralTokens;
    }

    /*///////////////////////////////////////////////////////////////
                    DEPOSIT/REDEEM USING BASE TOKENS
    //////////////////////////////////////////////////////////////*/

    function _deposit(address tokenIn, uint256 amountDeposited) internal virtual override returns (uint256) {
        if (tokenIn == ezETH) {
            return amountDeposited;
        }

        uint256 preBalance = _selfBalance(ezETH);
        if (tokenIn == NATIVE) {
            IRenzoRestakeManager(restakeManager).depositETH{value: amountDeposited}(referralId);
        } else {
            IRenzoRestakeManager(restakeManager).deposit(tokenIn, amountDeposited, referralId);
        }
        return _selfBalance(ezETH) - preBalance;
    }

    function _redeem(
        address receiver,
        address /*tokenOut*/,
        uint256 amountSharesToRedeem
    ) internal virtual override returns (uint256) {
        _transferOut(ezETH, receiver, amountSharesToRedeem);
        return amountSharesToRedeem;
    }

    /*///////////////////////////////////////////////////////////////
                               EXCHANGE-RATE
    //////////////////////////////////////////////////////////////*/

    function exchangeRate() public view virtual override returns (uint256) {
        return IPExchangeRateOracle(exchangeRateOracle).getExchangeRate();
    }

    function setExchangeRateOracle(address newOracle) external onlyOwner {
        exchangeRateOracle = newOracle;
        emit SetNewExchangeRateOracle(newOracle);
    }

    /*///////////////////////////////////////////////////////////////
                MISC FUNCTIONS FOR METADATA
    //////////////////////////////////////////////////////////////*/

    function _previewDeposit(
        address tokenIn,
        uint256 amountTokenToDeposit
    ) internal view override returns (uint256 amountSharesOut) {
        if (tokenIn == ezETH) {
            return amountTokenToDeposit;
        }

        uint256 supply = IERC20(ezETH).totalSupply();
        (, , uint256 tvl) = IRenzoRestakeManager(restakeManager).calculateTVLs();

        uint256 value;
        if (tokenIn == NATIVE) {
            value = amountTokenToDeposit;
        } else {
            value = IRenzoOracle(renzoOracle).lookupTokenValue(tokenIn, amountTokenToDeposit);
        }

        return IRenzoOracle(renzoOracle).calculateMintAmount(tvl, value, supply);
    }

    function _previewRedeem(
        address /*tokenOut*/,
        uint256 amountSharesToRedeem
    ) internal pure override returns (uint256 amountTokenOut) {
        return amountSharesToRedeem;
    }

    function getTokensIn() public view virtual override returns (address[] memory) {
        return ArrayLib.create(ezETH, NATIVE).merge(supportedCollateralTokens);
    }

    function getTokensOut() public view virtual override returns (address[] memory) {
        return ArrayLib.create(ezETH);
    }

    function isValidTokenIn(address token) public view virtual override returns (bool) {
        return token == NATIVE || token == ezETH || supportedCollateralTokens.contains(token);
    }

    function isValidTokenOut(address token) public view virtual override returns (bool) {
        return token == ezETH;
    }

    function assetInfo() external pure returns (AssetType assetType, address assetAddress, uint8 assetDecimals) {
        return (AssetType.TOKEN, NATIVE, 18);
    }
}

File 2 of 36 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 3 of 36 : AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 4 of 36 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 5 of 36 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 36 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;

// EIP-2612 is Final as of 2022-11-01. This file is deprecated.

import "./ERC20Permit.sol";

File 8 of 36 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

File 16 of 36 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

// EIP-712 is Final as of 2022-08-11. This file is deprecated.

import "./EIP712.sol";

File 17 of 36 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 18 of 36 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

File 21 of 36 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 24 of 36 : 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 25 of 36 : PendleERC20Permit.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 "./PendleERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

/// @dev forked from OZ's ERC20Permit
contract PendleERC20Permit is PendleERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_
    ) PendleERC20(name_, symbol_, decimals_) EIP712(name_, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 26 of 36 : 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(uint256 a) internal pure returns (uint256[] memory res) {
        res = new uint256[](1);
        res[0] = a;
    }
}

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

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract BoringOwnableUpgradeableData {
    address public owner;
    address public pendingOwner;
}

abstract contract BoringOwnableUpgradeable is BoringOwnableUpgradeableData, Initializable {
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function __BoringOwnable_init() internal onlyInitializing {
        owner = msg.sender;
    }

    /// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
    /// Can only be invoked by the current `owner`.
    /// @param newOwner Address of the new owner.
    /// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
    /// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
    function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner {
        if (direct) {
            // Checks
            require(newOwner != address(0) || renounce, "Ownable: zero address");

            // Effects
            emit OwnershipTransferred(owner, newOwner);
            owner = newOwner;
            pendingOwner = address(0);
        } else {
            // Effects
            pendingOwner = newOwner;
        }
    }

    /// @notice Needs to be called by `pendingOwner` to claim ownership.
    function claimOwnership() public {
        address _pendingOwner = pendingOwner;

        // Checks
        require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");

        // Effects
        emit OwnershipTransferred(owner, _pendingOwner);
        owner = _pendingOwner;
        pendingOwner = address(0);
    }

    /// @notice Only allows the `owner` to execute the function.
    modifier onlyOwner() {
        require(msg.sender == owner, "Ownable: caller is not the owner");
        _;
    }

    uint256[48] private __gap;
}

File 28 of 36 : 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);

    // 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 29 of 36 : 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;
    }

    // @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 30 of 36 : 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 31 of 36 : SYBase.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../interfaces/IStandardizedYield.sol";

import "../erc20/PendleERC20Permit.sol";

import "../libraries/math/PMath.sol";
import "../libraries/TokenHelper.sol";
import "../libraries/ArrayLib.sol";
import "../libraries/Errors.sol";
import "../libraries/BoringOwnableUpgradeable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper, BoringOwnableUpgradeable, Pausable {
    using PMath for uint256;

    address public immutable yieldToken;

    constructor(
        string memory _name,
        string memory _symbol,
        address _yieldToken
    ) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) initializer {
        yieldToken = _yieldToken;
        __BoringOwnable_init();
    }

    // solhint-disable no-empty-blocks
    receive() external payable {}

    /*///////////////////////////////////////////////////////////////
                    DEPOSIT/REDEEM USING BASE TOKENS
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev See {IStandardizedYield-deposit}
     */
    function deposit(
        address receiver,
        address tokenIn,
        uint256 amountTokenToDeposit,
        uint256 minSharesOut
    ) external payable nonReentrant returns (uint256 amountSharesOut) {
        if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn);
        if (amountTokenToDeposit == 0) revert Errors.SYZeroDeposit();

        _transferIn(tokenIn, msg.sender, amountTokenToDeposit);

        amountSharesOut = _deposit(tokenIn, amountTokenToDeposit);
        if (amountSharesOut < minSharesOut) revert Errors.SYInsufficientSharesOut(amountSharesOut, minSharesOut);

        _mint(receiver, amountSharesOut);
        emit Deposit(msg.sender, receiver, tokenIn, amountTokenToDeposit, amountSharesOut);
    }

    /**
     * @dev See {IStandardizedYield-redeem}
     */
    function redeem(
        address receiver,
        uint256 amountSharesToRedeem,
        address tokenOut,
        uint256 minTokenOut,
        bool burnFromInternalBalance
    ) external nonReentrant returns (uint256 amountTokenOut) {
        if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut);
        if (amountSharesToRedeem == 0) revert Errors.SYZeroRedeem();

        if (burnFromInternalBalance) {
            _burn(address(this), amountSharesToRedeem);
        } else {
            _burn(msg.sender, amountSharesToRedeem);
        }

        amountTokenOut = _redeem(receiver, tokenOut, amountSharesToRedeem);
        if (amountTokenOut < minTokenOut) revert Errors.SYInsufficientTokenOut(amountTokenOut, minTokenOut);
        emit Redeem(msg.sender, receiver, tokenOut, amountSharesToRedeem, amountTokenOut);
    }

    /**
     * @notice mint shares based on the deposited base tokens
     * @param tokenIn base token address used to mint shares
     * @param amountDeposited amount of base tokens deposited
     * @return amountSharesOut amount of shares minted
     */
    function _deposit(address tokenIn, uint256 amountDeposited) internal virtual returns (uint256 amountSharesOut);

    /**
     * @notice redeems base tokens based on amount of shares to be burned
     * @param tokenOut address of the base token to be redeemed
     * @param amountSharesToRedeem amount of shares to be burned
     * @return amountTokenOut amount of base tokens redeemed
     */
    function _redeem(
        address receiver,
        address tokenOut,
        uint256 amountSharesToRedeem
    ) internal virtual returns (uint256 amountTokenOut);

    /*///////////////////////////////////////////////////////////////
                               EXCHANGE-RATE
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev See {IStandardizedYield-exchangeRate}
     */
    function exchangeRate() external view virtual override returns (uint256 res);

    /*///////////////////////////////////////////////////////////////
                               REWARDS-RELATED
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev See {IStandardizedYield-claimRewards}
     */
    function claimRewards(address /*user*/) external virtual override returns (uint256[] memory rewardAmounts) {
        rewardAmounts = new uint256[](0);
    }

    /**
     * @dev See {IStandardizedYield-getRewardTokens}
     */
    function getRewardTokens() external view virtual override returns (address[] memory rewardTokens) {
        rewardTokens = new address[](0);
    }

    /**
     * @dev See {IStandardizedYield-accruedRewards}
     */
    function accruedRewards(address /*user*/) external view virtual override returns (uint256[] memory rewardAmounts) {
        rewardAmounts = new uint256[](0);
    }

    function rewardIndexesCurrent() external virtual override returns (uint256[] memory indexes) {
        indexes = new uint256[](0);
    }

    function rewardIndexesStored() external view virtual override returns (uint256[] memory indexes) {
        indexes = new uint256[](0);
    }

    /*///////////////////////////////////////////////////////////////
                MISC METADATA FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function previewDeposit(
        address tokenIn,
        uint256 amountTokenToDeposit
    ) external view virtual returns (uint256 amountSharesOut) {
        if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn);
        return _previewDeposit(tokenIn, amountTokenToDeposit);
    }

    function previewRedeem(
        address tokenOut,
        uint256 amountSharesToRedeem
    ) external view virtual returns (uint256 amountTokenOut) {
        if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut);
        return _previewRedeem(tokenOut, amountSharesToRedeem);
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function _beforeTokenTransfer(address, address, uint256) internal virtual override whenNotPaused {}

    function _previewDeposit(
        address tokenIn,
        uint256 amountTokenToDeposit
    ) internal view virtual returns (uint256 amountSharesOut);

    function _previewRedeem(
        address tokenOut,
        uint256 amountSharesToRedeem
    ) internal view virtual returns (uint256 amountTokenOut);

    function getTokensIn() public view virtual returns (address[] memory res);

    function getTokensOut() public view virtual returns (address[] memory res);

    function isValidTokenIn(address token) public view virtual returns (bool);

    function isValidTokenOut(address token) public view virtual returns (bool);
}

File 32 of 36 : IPExchangeRateOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IPExchangeRateOracle {
    function getExchangeRate() external view returns (uint256);
}

File 33 of 36 : 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 36 : 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;
}

File 35 of 36 : IRenzoOracle.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IRenzoOracle {
    function lookupTokenValue(address token, uint256 amount) external view returns (uint256);

    function calculateMintAmount(uint256 tvl, uint256 value, uint256 supply) external view returns (uint256);
}

File 36 of 36 : IRenzoRestakeManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

interface IRenzoRestakeManager {
    function depositETH(uint256 _referralId) external payable;

    function deposit(address _collateralToken, uint256 _amount, uint256 _referralId) external;

    function collateralTokens(uint256 i) external view returns (address);

    function calculateTVLs() external view returns (uint256[][] memory, uint256[] memory, uint256);

    function renzoOracle() external view returns (address);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_ezETH","type":"address"},{"internalType":"address","name":"_stakeManager","type":"address"},{"internalType":"address","name":"_exchangeRateOracle","type":"address"},{"internalType":"uint256","name":"_referralId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualSharesOut","type":"uint256"},{"internalType":"uint256","name":"requiredSharesOut","type":"uint256"}],"name":"SYInsufficientSharesOut","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualTokenOut","type":"uint256"},{"internalType":"uint256","name":"requiredTokenOut","type":"uint256"}],"name":"SYInsufficientTokenOut","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenIn","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenOut","type":"error"},{"inputs":[],"name":"SYZeroDeposit","type":"error"},{"inputs":[],"name":"SYZeroRedeem","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","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":"user","type":"address"},{"indexed":false,"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDeposited","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSyOut","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSyToRedeem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"SetNewExchangeRateOracle","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accruedRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","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":[],"name":"assetInfo","outputs":[{"internalType":"enum IStandardizedYield.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint8","name":"assetDecimals","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRateOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ezETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensIn","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensOut","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenIn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenOut","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"minTokenOut","type":"uint256"},{"internalType":"bool","name":"burnFromInternalBalance","type":"bool"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"referralId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"refetchCollateralTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renzoOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"restakeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardIndexesCurrent","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesStored","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOracle","type":"address"}],"name":"setExchangeRateOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supportedCollateralTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"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":"newOwner","type":"address"},{"internalType":"bool","name":"direct","type":"bool"},{"internalType":"bool","name":"renounce","type":"bool"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6102208060405234620004a457608081620051068038038091620000248285620008af565b833981010312620004a4576200003a81620008d3565b6200004860208301620008d3565b9160606200005960408301620008d3565b91015190604051906200006c8262000893565b600e82526d0a6b240a4cadcf4de40caf48aa8960931b6020830152604051620000958162000893565b60088152670a6b25acaf48aa8960c31b60208083019190915260405163313ce56760e01b81529390846004816001600160a01b038a165afa938415620004b25760009462000845575b5060405193620000ee8562000893565b60018552603160f81b6020860190815282519093906001600160401b038111620005fa57600354600181811c911680156200083a575b60208210146200071d57601f8111620007d4575b50806020601f82116001146200074a576000916200073e575b508160011b916000199060031b1c1916176003555b8051906001600160401b038211620005fa5760045490600182811c9216801562000733575b60208310146200071d5781601f849311620006ab575b50602090601f83116001146200061c5760009262000610575b50508160011b916000199060031b1c1916176004555b608052600280546001600160f81b0316600160f81b179055620001f381620008e8565b61014052620002028462000aac565b610160526020815191012092836101005251902080610120524660c052604051927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020850152604084015260608301524660808301523060a083015260a082528160c081011060018060401b0360c084011117620005fa5760c082016040528151602083012060a0523060e052603a549160095460ff8160a81c161591828093620005e9575b8015620005cd575b156200056d575060ff60a01b198116600160a01b176009558162000554575b50610180958587526009549360ff8560a81c1615620004fb57600880546001600160a01b03191633179055600494602093620004be575b506101a09687526101c08281526001600160a81b031990911660089490941b610100600160a81b031693909317603a5560405163224a19a960e21b815293849182906001600160a01b03165afa918215620004b25760009262000469575b506101e0918252610200928352604051936144a1958662000c658739608051866118cb015260a051866131cf015260c0518661329b015260e051866131a00152610100518661321e0152610120518661324401526101405186610e7f01526101605186610eac015251856111a501525184818161069901528181610bd7015281816111330152818161129b01528181611b3b01528181612252015281816124bd01528181612b2201528181612cc401526139fc0152518381816102b801528181610bb501528181612d1a01528181612e0e0152613a9b015251828181610b2b01528181613b1b0152613bd70152518181816108f801528181612d710152612e730152f35b9091506020813d602011620004a9575b816200048860209383620008af565b81010312620004a4576200049c90620008d3565b903862000365565b600080fd5b3d915062000479565b6040513d6000823e3d90fd5b60ff60a81b1916600955604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498908490a13862000307565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61ffff60a01b191661010160a01b1760095538620002d0565b60c060849162461bcd60e51b82820152602060c4820152602e60e48201527f496e697469616c697a61626c653a20636f6e747261637420697320616c7265616101048201526d191e481a5b9a5d1a585b1a5e995960921b61012482015201fd5b50303b158015620002b15750600160ff8360a01c1614620002b1565b50600160ff8360a01c1610620002a9565b634e487b7160e01b600052604160045260246000fd5b015190503880620001ba565b6004600090815293507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b91905b601f19841685106200068f576001945083601f1981161062000675575b505050811b01600455620001d0565b015160001960f88460031b161c1916905538808062000666565b8181015183556020948501946001909301929091019062000649565b60046000529091507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81016020851062000715575b90849392915b601f830160051c8201811062000705575050620001a1565b60008155859450600101620006ed565b5080620006e7565b634e487b7160e01b600052602260045260246000fd5b91607f16916200018b565b90508401513862000151565b6003600090815292507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b905b601f1983168410620007bb576001935082601f19811610620007a1575b5050811b0160035562000166565b86015160001960f88460031b161c19169055388062000793565b8681015182556020938401936001909201910162000776565b60036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c81016020841062000832575b601f830160051c820181106200082557505062000138565b600081556001016200080d565b50806200080d565b90607f169062000124565b6020949194813d6020116200088a575b816200086460209383620008af565b810103126200088657519060ff821682036200088357509238620000de565b80fd5b5080fd5b3d915062000855565b604081019081106001600160401b03821117620005fa57604052565b601f909101601f19168101906001600160401b03821190821017620005fa57604052565b51906001600160a01b0382168203620004a457565b8051602091908281101562000987575090601f8251116200092657808251920151908083106200091757501790565b82600019910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b8285106200096d575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000949565b6001600160401b038111620005fa576005928354926001938481811c9116801562000aa1575b838210146200071d57601f811162000a6a575b5081601f841160011462000a005750928293918392600094620009f4575b50501b916000199060031b1c191617905560ff90565b015192503880620009de565b919083601f1981168760005284600020946000905b8883831062000a4f575050501062000a35575b505050811b01905560ff90565b015160001960f88460031b161c1916905538808062000a28565b85870151885590960195948501948793509081019062000a15565b8560005284601f846000209201871c820191601f8601881c015b82811062000a94575050620009c0565b6000815501859062000a84565b90607f1690620009ad565b80516020908181101562000b3a5750601f82511162000ad957808251920151908083106200091757501790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b82851062000b20575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000afc565b906001600160401b038211620005fa57600654926001938481811c9116801562000c59575b838210146200071d57601f811162000c1f575b5081601f841160011462000bb3575092829391839260009462000ba7575b50501b916000199060031b1c19161760065560ff90565b01519250388062000b90565b919083601f198116600660005284600020946000905b8883831062000c04575050501062000bea575b505050811b0160065560ff90565b015160001960f88460031b161c1916905538808062000bdc565b85870151885590960195948501948793509081019062000bc9565b600660005284601f84600020920160051c820191601f860160051c015b82811062000c4c57505062000b72565b6000815501859062000c3c565b90607f169062000b5f56fe6080604081815260049182361015610022575b505050361561002057600080fd5b005b600092833560e01c91826306fdde03146124e957508163071bc3c914612453578163078dfbe7146122c5578163095ea7b314612276578163128fced11461032d57816313a73c781461220757816318160ddd146121a957816320e8c56514611da0578163213cae6314611abf57816323b872dd146118ef578163313ce567146118935781633644e515146118585781633ba0b9a9146117845781633f4ba83a1461167457816341d8bc5f146115a35781634e71e0c8146114945781635c975abb1461145257816370a08231146113f1578163769f8e5d146111c957816376d5de851461115a578163784367d6146110dc5781637ecebe001461107a57816382c876e314610ff75781638456cb5914610f4557816384b0196e14610e4357816387a016f814610b4f578163892866a414610ae05781638da5cb5b14610a8d57816395d89b4114610961578163a40bee501461091b578163a456365d146108c2578163a9059cbb146107ee578163b8f82b261461074b578163c4f59f9b146106fa578163cbe52ae314610644578163d505accf146103f757508063da88ecb414610328578063dd62ed3e14610384578063e30c397814610332578063ef5cfb8c1461032d578063f8b2f99114610328578063fa5a4f06146102dc578063ff0996b51461026e5763ffffce47146102165780610012565b3461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff603a5460081c169051908152f35b5080fd5b503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209061031f61031a6126ad565b612a75565b90519015158152f35b61278b565b61272c565b503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff600954169051908152f35b503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57806020926103bf6126ad565b6103c76126d5565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b8391503461026a5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576104316126ad565b6104396126d5565b906044359260643560843560ff81168103610640578142116105e35773ffffffffffffffffffffffffffffffffffffffff90818516928389526007602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff8211176105b7578b525190206105459161053d916104fc613189565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220614046565b9190916140e2565b160361055a5750610557939450612b4c565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b905082346106f757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f7575061067e6126ad565b73ffffffffffffffffffffffffffffffffffffffff809116907f00000000000000000000000000000000000000000000000000000000000000001681036106ca57602083516024358152f35b60249251917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b80fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57908161074792519161073b8361287b565b8252519182918261265b565b0390f35b905082346106f757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f757506107856126ad565b9061078f82612a75565b156107aa576020836107a3602435856139e1565b9051908152f35b73ffffffffffffffffffffffffffffffffffffffff60249351927faeabe7180000000000000000000000000000000000000000000000000000000084521690820152fd5b50503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020907f010000000000000000000000000000000000000000000000000000000000000061084a6126ad565b6108b36002549161086160028460f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033612f06565b60025416176002555160018152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a579060128260609351928084526020840152820152f35b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a895780518381949084546109a3816127c9565b9182855260209660019288600182169182600014610a415750506001146109e6575b8588610747896109d7848a03856128b3565b519282849384528301906125fd565b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610a2957505050820101816109d7610747386109c5565b8054848a018601528895508794909301928101610a0f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168882015294151560051b870190940194508593506109d7925061074791503890506109c5565b8280fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff600854169051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b91905034610a89576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610e3f57823573ffffffffffffffffffffffffffffffffffffffff92610ba9846008541633146128f4565b610bb2826129d6565b917f0000000000000000000000000000000000000000000000000000000000000000917f00000000000000000000000000000000000000000000000000000000000000008616868416895b848110610cf55750505050505080519367ffffffffffffffff8511610cc957680100000000000000008511610cc957508190603b5485603b55808610610c86575b500191603b8552845b848110610c52578580f35b835182167fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d82015592820192600101610c47565b857fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d91820191015b818110610cbb5750610c3e565b878155849350600101610cae565b8560416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b83517f172c48c7000000000000000000000000000000000000000000000000000000008152818b82015260249089818381875afa908115610e35578d91610dfb575b508a610d43848b612a61565b91169052838a610d53848b612a61565b511614610d7a575080610d74878b610d6d6001958c612a61565b51166136c8565b01610bfd565b8a60316084928b8851937f08c379a00000000000000000000000000000000000000000000000000000000085528401528201527f72656665746368436f6c6c61746572616c546f6b656e733a2073686f756c642060448201527f6e6f7420617070726f766520657a4554480000000000000000000000000000006064820152fd5b90508981813d8311610e2e575b610e1281836128b3565b81010312610e2a57518a81168103610e2a5738610d37565b8c80fd5b503d610e08565b86513d8f823e3d90fd5b8380fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57610747610f1992610ea37f00000000000000000000000000000000000000000000000000000000000000006134d0565b92610f26610ed07f0000000000000000000000000000000000000000000000000000000000000000613608565b91805192610edd8461287b565b84845281519788977f0f00000000000000000000000000000000000000000000000000000000000000895260e060208a015260e08901906125fd565b91878303908801526125fd565b9146606086015230608086015260a085015283820360c08501526126f8565b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760207f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891610fbc73ffffffffffffffffffffffffffffffffffffffff6008541633146128f4565b610fc4613fc4565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00603a541617603a5551338152a180f35b905034610a895760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a895735603b54811015610a895773ffffffffffffffffffffffffffffffffffffffff90603b602094527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d0154169051908152f35b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578060209273ffffffffffffffffffffffffffffffffffffffff6110cc6126ad565b1681526007845220549051908152f35b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906111186126ad565b73ffffffffffffffffffffffffffffffffffffffff915191807f0000000000000000000000000000000000000000000000000000000000000000169116148152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b905082346106f75760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f7576112036126ad565b91602435926044359173ffffffffffffffffffffffffffffffffffffffff908184168094036113ed576064356084359586151587036106f757506002549561125160028860f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809816176002557f00000000000000000000000000000000000000000000000000000000000000009084821687036113be57881561139657856112e7928a9260001461138c576112e283306132c1565b613ebd565b80871061135757602087897f010000000000000000000000000000000000000000000000000000000000000089898989855191878352878984015216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c863392a4600254161760025551908152f35b60449250868851927fbfee4ca00000000000000000000000000000000000000000000000000000000084528301526024820152fd5b6112e283336132c1565b838a517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b602484888c51917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b8480fd5b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578060209273ffffffffffffffffffffffffffffffffffffffff6114436126ad565b16815280845220549051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209060ff603a541690519015158152f35b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576009549073ffffffffffffffffffffffffffffffffffffffff9283831691823303611546575050806008549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176008551660095580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760207f97f0b7a8b22ce6b1d8cd80fd30e159ba09a73df70fd026076c317f099bf50a8d916116006126ad565b9073ffffffffffffffffffffffffffffffffffffffff90611626826008541633146128f4565b603a547fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff008560081b16911617603a555191168152a180f35b905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576116c773ffffffffffffffffffffffffffffffffffffffff6008541633146128f4565b603a549060ff82161561172757507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060209216603a5551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a8957602073ffffffffffffffffffffffffffffffffffffffff603a5460081c168251938480927fe6aa216c0000000000000000000000000000000000000000000000000000000082525afa91821561184e578392611816575b6020838351908152f35b9091506020813d602011611846575b81611832602093836128b3565b81010312610a89576020925051903861180c565b3d9150611825565b81513d85823e3d90fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906107a3613189565b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8391503461026a5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576119296126ad565b6119316126d5565b9060443592856002549561194b60028860f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8098161760025573ffffffffffffffffffffffffffffffffffffffff8416815260016020528181203382526020522054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611a15575b6020877f0100000000000000000000000000000000000000000000000000000000000000886108b3898989612f06565b848210611a6257509260209594926108b392611a55837f010000000000000000000000000000000000000000000000000000000000000097033383612b4c565b92509294958194506119e5565b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b83833461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578051916060830183811067ffffffffffffffff821117611d7457825260028352602082366020860137611b2184612a25565b9073ffffffffffffffffffffffffffffffffffffffff91827f0000000000000000000000000000000000000000000000000000000000000000169052845195600196871015611d485750828486015283518681926020603b54938481520192603b87527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d9187905b828210611d3157505050505081611bc19103826128b3565b805186847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611c07611bf285612959565b94611bff8a5196876128b3565b808652612959565b0136602085013785825b611cd4575b50611c23908851016129d6565b9685825b611c93575b505194905b611c43575b855180610747898261265b565b8251811015611c8e57908782611c5d829796959484612a61565b51611c6e575b019091929394611c31565b84611c798286612a61565b5116611c88838801978b612a61565b52611c63565b611c36565b918096959493928251811015611cc9578086611cb0849386612a61565b5116611cbc828d612a61565b5201909293949596611c27565b509192939495611c2c565b918493928197969551811015611d2657611cfa86611cf28388612a61565b51168b613d63565b15611d0d575b8101909293949596611c11565b91818091019281611d1e8287612a61565b529050611d00565b509192939495611c16565b835488168652948501949284019290840190611ba9565b8360326024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024826041877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b91905060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a8957611dd56126ad565b92611dde6126d5565b6044359360643594600293845497611dfb868a60f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809a16178655611e4b85612a75565b1561216457821561213c5773ffffffffffffffffffffffffffffffffffffffff908186169586156000146120a4578434036120475784611e8a91612cc1565b98808a10612012575016928315611fb557611ea3613fc4565b88881161026a578554908989168a831601908a8211611f8957509380927f01000000000000000000000000000000000000000000000000000000000000009694927fff000000000000000000000000000000000000000000000000000000000000008c60209d98169116178855818152808b52888120611f248b8254612eca565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b8a518c8152a3865190815287898201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d59873392a482541617905551908152f35b8360116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b856044918b8b51927fbc71f2ba0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b60648660208b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600c60248201527f657468206d69736d6174636800000000000000000000000000000000000000006044820152fd5b88517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528560648201526064815260a0810181811067ffffffffffffffff821117612110579161210b8792611e8a948d528a61427b565b612cc1565b60248660418a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8387517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b86517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861681860152602490fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600254169051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906122be6122b46126ad565b6024359033612b4c565b5160018152f35b91905034610a895760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576122ff6126ad565b916024359182151583036113ed5760443592831515840361244f5773ffffffffffffffffffffffffffffffffffffffff948591612341836008541633146128f4565b1561241d571692831590811591612415575b50156123b8575050806008549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176008556009541660095580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b905038612353565b9350505050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600954161760095580f35b8580fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578051610747916124928261285f565b60018252602036818401376124a682612a25565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169052519182918261265b565b84843461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578282600354612527816127c9565b90818452602095600191876001821691826000146125b857505060011461255c575b50505061074792916109d79103856128b3565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106125a057505050820101816109d7610747612549565b8054848a018601528895508794909301928101612587565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b860190930193508492506109d791506107479050612549565b919082519283825260005b8481106126475750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201612608565b602090602060408183019282815285518094520193019160005b828110612683575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612675565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036126d057565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036126d057565b90815180825260208080930193019160005b828110612718575050505090565b83518552938101939281019260010161270a565b346126d05760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126126d0576127636126ad565b506107476040516127738161287b565b600081526040519182916020835260208301906126f8565b346126d05760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126126d0576107476040516127738161287b565b90600182811c92168015612812575b60208310146127e357565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f16916127d8565b67ffffffffffffffff811161283057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761283057604052565b6020810190811067ffffffffffffffff82111761283057604052565b6080810190811067ffffffffffffffff82111761283057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761283057604052565b156128fb57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff81116128305760051b60200190565b1561297857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b906129e082612959565b6129ed60405191826128b3565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612a1b8294612959565b0190602036910137565b805115612a325760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051821015612a325760209160051b010190565b73ffffffffffffffffffffffffffffffffffffffff808216918215928315612b20575b508215612aa457505090565b9092915060405180603b54808252602080920195603b6000527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d926000915b838310612b07575050505050612aff81612b04949503826128b3565b613d63565b90565b8454811689529781019760019485019490920191612ae3565b7f0000000000000000000000000000000000000000000000000000000000000000831614925038612a98565b73ffffffffffffffffffffffffffffffffffffffff809116918215612c3e5716918215612bba5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff809316918382168314612ec357612d0e82613db5565b9360009380612e0a57507f000000000000000000000000000000000000000000000000000000000000000016803b15610e3f5783906024604051809481937f5358fbda0000000000000000000000000000000000000000000000000000000083527f000000000000000000000000000000000000000000000000000000000000000060048401525af18015612dff57908391612deb575b5050612db090613db5565b918203918211612dbe575090565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b612df49061281c565b61026a578138612da5565b6040513d85823e3d90fd5b91907f00000000000000000000000000000000000000000000000000000000000000001691823b156113ed5790606485928360405195869485937f0efe6a8b000000000000000000000000000000000000000000000000000000008552600485015260248401527f000000000000000000000000000000000000000000000000000000000000000060448401525af18015612dff57612eae575b50612db090613db5565b91612ebc612db0929361281c565b9190612ea4565b9250505090565b91908201809211612ed757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561310557169182156130815782821461302357612f3c613fc4565b600082815280602052604081205491808310612f9f57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220612f94828254612eca565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480613298575b156131f1577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176128305760405251902090565b507f000000000000000000000000000000000000000000000000000000000000000046146131c8565b73ffffffffffffffffffffffffffffffffffffffff16801561344c576132e5613fc4565b6000918183528260205260408320548181106133c8578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808211610e3f57600254908083168183160381811161339b57917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b60ff81146135265760ff811690601f82116134fc57604051916134f28361285f565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000613539836127c9565b808352926020906001908181169081156135c55750600114613564575b5050612b04925003826128b3565b91509260056000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0936000925b8284106135ad5750612b049450505081016020013880613556565b85548785018301529485019486945092810192613592565b905060209350612b049592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880613556565b60ff811461362a5760ff811690601f82116134fc57604051916134f28361285f565b5060405160065481600061363d836127c9565b808352926020906001908181169081156135c55750600114613667575050612b04925003826128b3565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b8284106136b05750612b049450505081016020013880613556565b85548785018301529485019486945092810192613695565b9073ffffffffffffffffffffffffffffffffffffffff9182811690811561397a576040918251809581957fdd62ed3e0000000000000000000000000000000000000000000000000000000083523060048401521691826024830152602096879160449788915afa801561396f57600090613936575b6b7fffffffffffffffffffffff915010613759575b5050505050565b8251906000808784017f095ea7b30000000000000000000000000000000000000000000000000000000094858252846024820152828982015288815261379e81612897565b519082875af16137ac613e5f565b81613906575b50156138aa57916000929183809386519089820193845260248201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff888201528781526137ff81612897565b51925af161380b613e5f565b8161387a575b501561381e578080613752565b606492917f5361666520417070726f766500000000000000000000000000000000000000009151927f08c379a00000000000000000000000000000000000000000000000000000000084526004840152600c6024840152820152fd5b80518015925085908315613892575b50505038613811565b6138a2935082018101910161402e565b388481613889565b6064867f5361666520417070726f76650000000000000000000000000000000000000000878751927f08c379a00000000000000000000000000000000000000000000000000000000084526004840152600c6024840152820152fd5b8051801592508890831561391e575b505050386137b2565b61392e935082018101910161402e565b388781613915565b508581813d8311613968575b61394c81836128b3565b810103126126d0576b7fffffffffffffffffffffff905161373d565b503d613942565b84513d6000823e3d90fd5b50505050565b9080601f830112156126d05781519060209161399b81612959565b936139a960405195866128b3565b81855260208086019260051b8201019283116126d057602001905b8282106139d2575050505090565b815181529083019083016139c4565b91909173ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000000000000000000000000000000000000168183169181831461397a5760409384519384937f18160ddd00000000000000000000000000000000000000000000000000000000855284600460209687935afa948515613d5857600095613d29575b508551917fff9969cd000000000000000000000000000000000000000000000000000000008352600083600481877f0000000000000000000000000000000000000000000000000000000000000000165afa928315613d1e57600093613c59575b50600091613b855750506064908394959697925b875196879485937f8f686e6a0000000000000000000000000000000000000000000000000000000085526004850152602484015260448301527f0000000000000000000000000000000000000000000000000000000000000000165afa928315613b7b5750600092613b5157505090565b90809250813d8311613b74575b613b6881836128b3565b810103126126d0575190565b503d613b5e565b513d6000823e3d90fd5b86517e52e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91909116600482015260248101989098529683816044817f000000000000000000000000000000000000000000000000000000000000000087165afa908115613c4f5788859697989992613c19575b50509060649192613ae0565b915091929382813d8311613c48575b613c3281836128b3565b810103126106f757505183929190606438613c0d565b503d613c28565b86513d8a823e3d90fd5b90923d8082843e613c6a81846128b3565b8201906060838303126106f75782519067ffffffffffffffff9182811161026a57840183601f8201121561026a57805189808d613cb2613ca985612959565b915191826128b3565b838152019160051b83010191858311610e3f578a8101915b838310613cf95750505050878401519182116106f757508291613cef918a9401613980565b5001519138613acc565b825186811161244f578c91613d1389848094870101613980565b815201920191613cca565b87513d6000823e3d90fd5b9094508381813d8311613d51575b613d4181836128b3565b810103126126d057519338613a6b565b503d613d37565b86513d6000823e3d90fd5b9081519160005b838110613d7a5750505050600090565b73ffffffffffffffffffffffffffffffffffffffff80613d9a8385612a61565b511690841614613dac57600101613d6a565b50505050600190565b60009073ffffffffffffffffffffffffffffffffffffffff1680613dd95750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215613e53578092613e2257505090565b9091506020823d602011613e4b575b81613e3e602093836128b3565b810103126106f757505190565b3d9150613e31565b604051903d90823e3d90fd5b3d15613eb8573d9067ffffffffffffffff82116128305760405191613eac60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846128b3565b82523d6000602084013e565b606090565b8215613fbf5773ffffffffffffffffffffffffffffffffffffffff1680613f565750600080809381935af1613ef0613e5f565b5015613ef857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff929092166024830152604480830193909352918152613fbd91613fb86064836128b3565b61427b565b565b505050565b60ff603a5416613fd057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b908160209103126126d0575180151581036126d05790565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116140d65791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156140c957815173ffffffffffffffffffffffffffffffffffffffff8116156140c3579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b600581101561424c57806140f35750565b600181036141595760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036141bf5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b6003146141c857565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6040516142e69173ffffffffffffffffffffffffffffffffffffffff166142a18261285f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16142e0613e5f565b9161439b565b805190828215928315614383575b505050156142ff5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b614393935082018101910161402e565b3882816142f4565b9192901561441657508151156143af575090565b3b156143b85790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156144295750805190602001fd5b614467906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906125fd565b0390fdfea2646970667358221220bd9cc7cf441f2df6526aaa0a5bd04bdfd2e8437e33a1853369134b6221b0955964736f6c63430008170033000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d211000000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef500000000000000000000000078d686134aaf149aa767dce1ad0cd2799a3cd7a00000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee1

Deployed Bytecode

0x6080604081815260049182361015610022575b505050361561002057600080fd5b005b600092833560e01c91826306fdde03146124e957508163071bc3c914612453578163078dfbe7146122c5578163095ea7b314612276578163128fced11461032d57816313a73c781461220757816318160ddd146121a957816320e8c56514611da0578163213cae6314611abf57816323b872dd146118ef578163313ce567146118935781633644e515146118585781633ba0b9a9146117845781633f4ba83a1461167457816341d8bc5f146115a35781634e71e0c8146114945781635c975abb1461145257816370a08231146113f1578163769f8e5d146111c957816376d5de851461115a578163784367d6146110dc5781637ecebe001461107a57816382c876e314610ff75781638456cb5914610f4557816384b0196e14610e4357816387a016f814610b4f578163892866a414610ae05781638da5cb5b14610a8d57816395d89b4114610961578163a40bee501461091b578163a456365d146108c2578163a9059cbb146107ee578163b8f82b261461074b578163c4f59f9b146106fa578163cbe52ae314610644578163d505accf146103f757508063da88ecb414610328578063dd62ed3e14610384578063e30c397814610332578063ef5cfb8c1461032d578063f8b2f99114610328578063fa5a4f06146102dc578063ff0996b51461026e5763ffffce47146102165780610012565b3461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff603a5460081c169051908152f35b5080fd5b503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef5168152f35b503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209061031f61031a6126ad565b612a75565b90519015158152f35b61278b565b61272c565b503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff600954169051908152f35b503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57806020926103bf6126ad565b6103c76126d5565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b8391503461026a5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576104316126ad565b6104396126d5565b906044359260643560843560ff81168103610640578142116105e35773ffffffffffffffffffffffffffffffffffffffff90818516928389526007602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff8211176105b7578b525190206105459161053d916104fc613189565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220614046565b9190916140e2565b160361055a5750610557939450612b4c565b80f35b60649060208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b905082346106f757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f7575061067e6126ad565b73ffffffffffffffffffffffffffffffffffffffff809116907f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d21101681036106ca57602083516024358152f35b60249251917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b80fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57908161074792519161073b8361287b565b8252519182918261265b565b0390f35b905082346106f757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f757506107856126ad565b9061078f82612a75565b156107aa576020836107a3602435856139e1565b9051908152f35b73ffffffffffffffffffffffffffffffffffffffff60249351927faeabe7180000000000000000000000000000000000000000000000000000000084521690820152fd5b50503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020907f010000000000000000000000000000000000000000000000000000000000000061084a6126ad565b6108b36002549161086160028460f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033612f06565b60025416176002555160018152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57602090517f0000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee18152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a579060128260609351928084526020840152820152f35b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a895780518381949084546109a3816127c9565b9182855260209660019288600182169182600014610a415750506001146109e6575b8588610747896109d7848a03856128b3565b519282849384528301906125fd565b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610a2957505050820101816109d7610747386109c5565b8054848a018601528895508794909301928101610a0f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168882015294151560051b870190940194508593506109d7925061074791503890506109c5565b8280fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209073ffffffffffffffffffffffffffffffffffffffff600854169051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000005a12796f7e7ebbbc8a402667d266d2e65a814042168152f35b91905034610a89576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610e3f57823573ffffffffffffffffffffffffffffffffffffffff92610ba9846008541633146128f4565b610bb2826129d6565b917f00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef5917f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d21108616868416895b848110610cf55750505050505080519367ffffffffffffffff8511610cc957680100000000000000008511610cc957508190603b5485603b55808610610c86575b500191603b8552845b848110610c52578580f35b835182167fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d82015592820192600101610c47565b857fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d91820191015b818110610cbb5750610c3e565b878155849350600101610cae565b8560416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b83517f172c48c7000000000000000000000000000000000000000000000000000000008152818b82015260249089818381875afa908115610e35578d91610dfb575b508a610d43848b612a61565b91169052838a610d53848b612a61565b511614610d7a575080610d74878b610d6d6001958c612a61565b51166136c8565b01610bfd565b8a60316084928b8851937f08c379a00000000000000000000000000000000000000000000000000000000085528401528201527f72656665746368436f6c6c61746572616c546f6b656e733a2073686f756c642060448201527f6e6f7420617070726f766520657a4554480000000000000000000000000000006064820152fd5b90508981813d8311610e2e575b610e1281836128b3565b81010312610e2a57518a81168103610e2a5738610d37565b8c80fd5b503d610e08565b86513d8f823e3d90fd5b8380fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a57610747610f1992610ea37f53592052656e7a6f20657a45544800000000000000000000000000000000000e6134d0565b92610f26610ed07f3100000000000000000000000000000000000000000000000000000000000001613608565b91805192610edd8461287b565b84845281519788977f0f00000000000000000000000000000000000000000000000000000000000000895260e060208a015260e08901906125fd565b91878303908801526125fd565b9146606086015230608086015260a085015283820360c08501526126f8565b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760207f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891610fbc73ffffffffffffffffffffffffffffffffffffffff6008541633146128f4565b610fc4613fc4565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00603a541617603a5551338152a180f35b905034610a895760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a895735603b54811015610a895773ffffffffffffffffffffffffffffffffffffffff90603b602094527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d0154169051908152f35b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578060209273ffffffffffffffffffffffffffffffffffffffff6110cc6126ad565b1681526007845220549051908152f35b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906111186126ad565b73ffffffffffffffffffffffffffffffffffffffff915191807f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110169116148152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110168152f35b905082346106f75760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106f7576112036126ad565b91602435926044359173ffffffffffffffffffffffffffffffffffffffff908184168094036113ed576064356084359586151587036106f757506002549561125160028860f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809816176002557f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d21109084821687036113be57881561139657856112e7928a9260001461138c576112e283306132c1565b613ebd565b80871061135757602087897f010000000000000000000000000000000000000000000000000000000000000089898989855191878352878984015216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c863392a4600254161760025551908152f35b60449250868851927fbfee4ca00000000000000000000000000000000000000000000000000000000084528301526024820152fd5b6112e283336132c1565b838a517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b602484888c51917f88a50561000000000000000000000000000000000000000000000000000000008352820152fd5b8480fd5b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578060209273ffffffffffffffffffffffffffffffffffffffff6114436126ad565b16815280845220549051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760209060ff603a541690519015158152f35b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576009549073ffffffffffffffffffffffffffffffffffffffff9283831691823303611546575050806008549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176008551660095580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b50503461026a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a5760207f97f0b7a8b22ce6b1d8cd80fd30e159ba09a73df70fd026076c317f099bf50a8d916116006126ad565b9073ffffffffffffffffffffffffffffffffffffffff90611626826008541633146128f4565b603a547fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff008560081b16911617603a555191168152a180f35b905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576116c773ffffffffffffffffffffffffffffffffffffffff6008541633146128f4565b603a549060ff82161561172757507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060209216603a5551338152a180f35b60649060208451917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b91905034610a8957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a8957602073ffffffffffffffffffffffffffffffffffffffff603a5460081c168251938480927fe6aa216c0000000000000000000000000000000000000000000000000000000082525afa91821561184e578392611816575b6020838351908152f35b9091506020813d602011611846575b81611832602093836128b3565b81010312610a89576020925051903861180c565b3d9150611825565b81513d85823e3d90fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906107a3613189565b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905160ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b8391503461026a5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576119296126ad565b6119316126d5565b9060443592856002549561194b60028860f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8098161760025573ffffffffffffffffffffffffffffffffffffffff8416815260016020528181203382526020522054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611a15575b6020877f0100000000000000000000000000000000000000000000000000000000000000886108b3898989612f06565b848210611a6257509260209594926108b392611a55837f010000000000000000000000000000000000000000000000000000000000000097033383612b4c565b92509294958194506119e5565b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b83833461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578051916060830183811067ffffffffffffffff821117611d7457825260028352602082366020860137611b2184612a25565b9073ffffffffffffffffffffffffffffffffffffffff91827f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110169052845195600196871015611d485750828486015283518681926020603b54938481520192603b87527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d9187905b828210611d3157505050505081611bc19103826128b3565b805186847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611c07611bf285612959565b94611bff8a5196876128b3565b808652612959565b0136602085013785825b611cd4575b50611c23908851016129d6565b9685825b611c93575b505194905b611c43575b855180610747898261265b565b8251811015611c8e57908782611c5d829796959484612a61565b51611c6e575b019091929394611c31565b84611c798286612a61565b5116611c88838801978b612a61565b52611c63565b611c36565b918096959493928251811015611cc9578086611cb0849386612a61565b5116611cbc828d612a61565b5201909293949596611c27565b509192939495611c2c565b918493928197969551811015611d2657611cfa86611cf28388612a61565b51168b613d63565b15611d0d575b8101909293949596611c11565b91818091019281611d1e8287612a61565b529050611d00565b509192939495611c16565b835488168652948501949284019290840190611ba9565b8360326024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024826041877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b91905060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a8957611dd56126ad565b92611dde6126d5565b6044359360643594600293845497611dfb868a60f81c1415612971565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809a16178655611e4b85612a75565b1561216457821561213c5773ffffffffffffffffffffffffffffffffffffffff908186169586156000146120a4578434036120475784611e8a91612cc1565b98808a10612012575016928315611fb557611ea3613fc4565b88881161026a578554908989168a831601908a8211611f8957509380927f01000000000000000000000000000000000000000000000000000000000000009694927fff000000000000000000000000000000000000000000000000000000000000008c60209d98169116178855818152808b52888120611f248b8254612eca565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b8a518c8152a3865190815287898201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d59873392a482541617905551908152f35b8360116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60649060208851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b856044918b8b51927fbc71f2ba0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b60648660208b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600c60248201527f657468206d69736d6174636800000000000000000000000000000000000000006044820152fd5b88517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528560648201526064815260a0810181811067ffffffffffffffff821117612110579161210b8792611e8a948d528a61427b565b612cc1565b60248660418a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8387517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b86517faeabe71800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861681860152602490fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600254169051908152f35b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110168152f35b50503461026a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a576020906122be6122b46126ad565b6024359033612b4c565b5160018152f35b91905034610a895760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610a89576122ff6126ad565b916024359182151583036113ed5760443592831515840361244f5773ffffffffffffffffffffffffffffffffffffffff948591612341836008541633146128f4565b1561241d571692831590811591612415575b50156123b8575050806008549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176008556009541660095580f35b90602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b905038612353565b9350505050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600954161760095580f35b8580fd5b50503461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578051610747916124928261285f565b60018252602036818401376124a682612a25565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110169052519182918261265b565b84843461026a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026a578282600354612527816127c9565b90818452602095600191876001821691826000146125b857505060011461255c575b50505061074792916109d79103856128b3565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106125a057505050820101816109d7610747612549565b8054848a018601528895508794909301928101612587565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b860190930193508492506109d791506107479050612549565b919082519283825260005b8481106126475750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201612608565b602090602060408183019282815285518094520193019160005b828110612683575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612675565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036126d057565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036126d057565b90815180825260208080930193019160005b828110612718575050505090565b83518552938101939281019260010161270a565b346126d05760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126126d0576127636126ad565b506107476040516127738161287b565b600081526040519182916020835260208301906126f8565b346126d05760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126126d0576107476040516127738161287b565b90600182811c92168015612812575b60208310146127e357565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f16916127d8565b67ffffffffffffffff811161283057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761283057604052565b6020810190811067ffffffffffffffff82111761283057604052565b6080810190811067ffffffffffffffff82111761283057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761283057604052565b156128fb57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff81116128305760051b60200190565b1561297857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b906129e082612959565b6129ed60405191826128b3565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612a1b8294612959565b0190602036910137565b805115612a325760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051821015612a325760209160051b010190565b73ffffffffffffffffffffffffffffffffffffffff808216918215928315612b20575b508215612aa457505090565b9092915060405180603b54808252602080920195603b6000527fbbe3212124853f8b0084a66a2d057c2966e251e132af3691db153ab65f0d1a4d926000915b838310612b07575050505050612aff81612b04949503826128b3565b613d63565b90565b8454811689529781019760019485019490920191612ae3565b7f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110831614925038612a98565b73ffffffffffffffffffffffffffffffffffffffff809116918215612c3e5716918215612bba5760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b907f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d211073ffffffffffffffffffffffffffffffffffffffff809316918382168314612ec357612d0e82613db5565b9360009380612e0a57507f00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef516803b15610e3f5783906024604051809481937f5358fbda0000000000000000000000000000000000000000000000000000000083527f0000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee160048401525af18015612dff57908391612deb575b5050612db090613db5565b918203918211612dbe575090565b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b612df49061281c565b61026a578138612da5565b6040513d85823e3d90fd5b91907f00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef51691823b156113ed5790606485928360405195869485937f0efe6a8b000000000000000000000000000000000000000000000000000000008552600485015260248401527f0000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee160448401525af18015612dff57612eae575b50612db090613db5565b91612ebc612db0929361281c565b9190612ea4565b9250505090565b91908201809211612ed757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561310557169182156130815782821461302357612f3c613fc4565b600082815280602052604081205491808310612f9f57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220612f94828254612eca565b9055604051908152a3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000022e12a50e3ca49fb183074235cb1db84fe4c716d16301480613298575b156131f1577f5d0586932171ae961d7338aeb08f0cbf30424eeb63cf9d78a2c0dac8bdc5fc1190565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f2e030380fe3971e5f1af00637b99c0c601da4e618f9ea8145141c83c36eb32cf60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176128305760405251902090565b507f000000000000000000000000000000000000000000000000000000000000000146146131c8565b73ffffffffffffffffffffffffffffffffffffffff16801561344c576132e5613fc4565b6000918183528260205260408320548181106133c8578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808211610e3f57600254908083168183160381811161339b57917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b60ff81146135265760ff811690601f82116134fc57604051916134f28361285f565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600554816000613539836127c9565b808352926020906001908181169081156135c55750600114613564575b5050612b04925003826128b3565b91509260056000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0936000925b8284106135ad5750612b049450505081016020013880613556565b85548785018301529485019486945092810192613592565b905060209350612b049592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880613556565b60ff811461362a5760ff811690601f82116134fc57604051916134f28361285f565b5060405160065481600061363d836127c9565b808352926020906001908181169081156135c55750600114613667575050612b04925003826128b3565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b8284106136b05750612b049450505081016020013880613556565b85548785018301529485019486945092810192613695565b9073ffffffffffffffffffffffffffffffffffffffff9182811690811561397a576040918251809581957fdd62ed3e0000000000000000000000000000000000000000000000000000000083523060048401521691826024830152602096879160449788915afa801561396f57600090613936575b6b7fffffffffffffffffffffff915010613759575b5050505050565b8251906000808784017f095ea7b30000000000000000000000000000000000000000000000000000000094858252846024820152828982015288815261379e81612897565b519082875af16137ac613e5f565b81613906575b50156138aa57916000929183809386519089820193845260248201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff888201528781526137ff81612897565b51925af161380b613e5f565b8161387a575b501561381e578080613752565b606492917f5361666520417070726f766500000000000000000000000000000000000000009151927f08c379a00000000000000000000000000000000000000000000000000000000084526004840152600c6024840152820152fd5b80518015925085908315613892575b50505038613811565b6138a2935082018101910161402e565b388481613889565b6064867f5361666520417070726f76650000000000000000000000000000000000000000878751927f08c379a00000000000000000000000000000000000000000000000000000000084526004840152600c6024840152820152fd5b8051801592508890831561391e575b505050386137b2565b61392e935082018101910161402e565b388781613915565b508581813d8311613968575b61394c81836128b3565b810103126126d0576b7fffffffffffffffffffffff905161373d565b503d613942565b84513d6000823e3d90fd5b50505050565b9080601f830112156126d05781519060209161399b81612959565b936139a960405195866128b3565b81855260208086019260051b8201019283116126d057602001905b8282106139d2575050505090565b815181529083019083016139c4565b91909173ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110168183169181831461397a5760409384519384937f18160ddd00000000000000000000000000000000000000000000000000000000855284600460209687935afa948515613d5857600095613d29575b508551917fff9969cd000000000000000000000000000000000000000000000000000000008352600083600481877f00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef5165afa928315613d1e57600093613c59575b50600091613b855750506064908394959697925b875196879485937f8f686e6a0000000000000000000000000000000000000000000000000000000085526004850152602484015260448301527f0000000000000000000000005a12796f7e7ebbbc8a402667d266d2e65a814042165afa928315613b7b5750600092613b5157505090565b90809250813d8311613b74575b613b6881836128b3565b810103126126d0575190565b503d613b5e565b513d6000823e3d90fd5b86517e52e3fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91909116600482015260248101989098529683816044817f0000000000000000000000005a12796f7e7ebbbc8a402667d266d2e65a81404287165afa908115613c4f5788859697989992613c19575b50509060649192613ae0565b915091929382813d8311613c48575b613c3281836128b3565b810103126106f757505183929190606438613c0d565b503d613c28565b86513d8a823e3d90fd5b90923d8082843e613c6a81846128b3565b8201906060838303126106f75782519067ffffffffffffffff9182811161026a57840183601f8201121561026a57805189808d613cb2613ca985612959565b915191826128b3565b838152019160051b83010191858311610e3f578a8101915b838310613cf95750505050878401519182116106f757508291613cef918a9401613980565b5001519138613acc565b825186811161244f578c91613d1389848094870101613980565b815201920191613cca565b87513d6000823e3d90fd5b9094508381813d8311613d51575b613d4181836128b3565b810103126126d057519338613a6b565b503d613d37565b86513d6000823e3d90fd5b9081519160005b838110613d7a5750505050600090565b73ffffffffffffffffffffffffffffffffffffffff80613d9a8385612a61565b511690841614613dac57600101613d6a565b50505050600190565b60009073ffffffffffffffffffffffffffffffffffffffff1680613dd95750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215613e53578092613e2257505090565b9091506020823d602011613e4b575b81613e3e602093836128b3565b810103126106f757505190565b3d9150613e31565b604051903d90823e3d90fd5b3d15613eb8573d9067ffffffffffffffff82116128305760405191613eac60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846128b3565b82523d6000602084013e565b606090565b8215613fbf5773ffffffffffffffffffffffffffffffffffffffff1680613f565750600080809381935af1613ef0613e5f565b5015613ef857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff929092166024830152604480830193909352918152613fbd91613fb86064836128b3565b61427b565b565b505050565b60ff603a5416613fd057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b908160209103126126d0575180151581036126d05790565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116140d65791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156140c957815173ffffffffffffffffffffffffffffffffffffffff8116156140c3579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b600581101561424c57806140f35750565b600181036141595760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036141bf5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b6003146141c857565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6040516142e69173ffffffffffffffffffffffffffffffffffffffff166142a18261285f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16142e0613e5f565b9161439b565b805190828215928315614383575b505050156142ff5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b614393935082018101910161402e565b3882816142f4565b9192901561441657508151156143af575090565b3b156143b85790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156144295750805190602001fd5b614467906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906125fd565b0390fdfea2646970667358221220bd9cc7cf441f2df6526aaa0a5bd04bdfd2e8437e33a1853369134b6221b0955964736f6c63430008170033

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

000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d211000000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef500000000000000000000000078d686134aaf149aa767dce1ad0cd2799a3cd7a00000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee1

-----Decoded View---------------
Arg [0] : _ezETH (address): 0xbf5495Efe5DB9ce00f80364C8B423567e58d2110
Arg [1] : _stakeManager (address): 0x74a09653A083691711cF8215a6ab074BB4e99ef5
Arg [2] : _exchangeRateOracle (address): 0x78D686134aaF149Aa767DcE1ad0cd2799a3cd7A0
Arg [3] : _referralId (uint256): 737037894371398187317609410437093179040060501729

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000bf5495efe5db9ce00f80364c8b423567e58d2110
Arg [1] : 00000000000000000000000074a09653a083691711cf8215a6ab074bb4e99ef5
Arg [2] : 00000000000000000000000078d686134aaf149aa767dce1ad0cd2799a3cd7a0
Arg [3] : 0000000000000000000000008119ec16f0573b7dac7c0cb94eb504fb32456ee1


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

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

Validator Index Block Amount
View All Withdrawals

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

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