GLMR Price: $0.020149 (-2.05%)

Contract

0x6f65f544005b6A7c7018fEc56eE976bBd32DD75d

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Harvest41871242023-08-11 0:09:24902 days ago1691712564IN
0x6f65f544...Bd32DD75d
0 GLMR0.32742625125
Harvest41742682023-08-09 4:52:00904 days ago1691556720IN
0x6f65f544...Bd32DD75d
0 GLMR0.33661021128.5061212
Harvest41641192023-08-07 18:45:30905 days ago1691433930IN
0x6f65f544...Bd32DD75d
0 GLMR0.32742625125
Harvest41550422023-08-06 12:12:36906 days ago1691323956IN
0x6f65f544...Bd32DD75d
0 GLMR0.32801861125.22614419
Harvest41450182023-08-05 2:30:36908 days ago1691202636IN
0x6f65f544...Bd32DD75d
0 GLMR0.36707452140.13633693
Harvest41365782023-08-03 22:09:18909 days ago1691100558IN
0x6f65f544...Bd32DD75d
0 GLMR0.33004874126.00117893
Harvest41261742023-08-02 11:00:12910 days ago1690974012IN
0x6f65f544...Bd32DD75d
0 GLMR0.33138041126.50956457
Harvest41145022023-07-31 19:48:48912 days ago1690832928IN
0x6f65f544...Bd32DD75d
0 GLMR0.33402717127.52000527
Harvest41034992023-07-30 6:48:18914 days ago1690699698IN
0x6f65f544...Bd32DD75d
0 GLMR0.38092861145.42534821
Harvest40888292023-07-28 5:33:36916 days ago1690522416IN
0x6f65f544...Bd32DD75d
0 GLMR0.32760424125.06795085
Harvest40762902023-07-26 11:18:36917 days ago1690370316IN
0x6f65f544...Bd32DD75d
0 GLMR0.32812322125.26608136
Harvest40642722023-07-24 18:54:42919 days ago1690224882IN
0x6f65f544...Bd32DD75d
0 GLMR0.3416786130.44105355
Harvest40515532023-07-22 23:54:36921 days ago1690070076IN
0x6f65f544...Bd32DD75d
0 GLMR0.33619963128.34937445
Harvest40393622023-07-21 6:45:54923 days ago1689921954IN
0x6f65f544...Bd32DD75d
0 GLMR0.3378732128.98828686
Harvest40260612023-07-19 9:45:42924 days ago1689759942IN
0x6f65f544...Bd32DD75d
0 GLMR0.36191784138.16769446
Harvest40118652023-07-17 9:18:54926 days ago1689585534IN
0x6f65f544...Bd32DD75d
0 GLMR0.32959524125.82804677
Harvest39988952023-07-15 13:22:18928 days ago1689427338IN
0x6f65f544...Bd32DD75d
0 GLMR0.3298517125.92595632
Harvest39857042023-07-13 16:39:36930 days ago1689266376IN
0x6f65f544...Bd32DD75d
0 GLMR0.32742625125
Harvest39730072023-07-11 21:51:36932 days ago1689112296IN
0x6f65f544...Bd32DD75d
0 GLMR0.32616335125.00023145
Harvest39595232023-07-10 0:15:42934 days ago1688948142IN
0x6f65f544...Bd32DD75d
0 GLMR0.32616399125.0004768
Harvest39462962023-07-08 3:36:42936 days ago1688787402IN
0x6f65f544...Bd32DD75d
0 GLMR0.33626536128.8717693
Harvest39328632023-07-06 6:21:42938 days ago1688624502IN
0x6f65f544...Bd32DD75d
0 GLMR0.32616275125
Harvest39193782023-07-04 9:00:42939 days ago1688461242IN
0x6f65f544...Bd32DD75d
0 GLMR0.33125019126.94973543
Harvest39057932023-07-02 11:09:36941 days ago1688296176IN
0x6f65f544...Bd32DD75d
0 GLMR0.33369108127.88518949
Harvest38921232023-06-30 13:09:36943 days ago1688130576IN
0x6f65f544...Bd32DD75d
0 GLMR0.32634978125.07167847
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
42135692023-08-14 17:17:42898 days ago1692033462
0x6f65f544...Bd32DD75d
5.50087124 GLMR
42135692023-08-14 17:17:42898 days ago1692033462
0x6f65f544...Bd32DD75d
5.50087124 GLMR
42135692023-08-14 17:17:42898 days ago1692033462
0x6f65f544...Bd32DD75d
148 wei
41871242023-08-11 0:09:24902 days ago1691712564
0x6f65f544...Bd32DD75d
2.65527331 GLMR
41871242023-08-11 0:09:24902 days ago1691712564
0x6f65f544...Bd32DD75d
2.65527331 GLMR
41871242023-08-11 0:09:24902 days ago1691712564
0x6f65f544...Bd32DD75d
72 wei
41742682023-08-09 4:52:00904 days ago1691556720
0x6f65f544...Bd32DD75d
2.56786546 GLMR
41742682023-08-09 4:52:00904 days ago1691556720
0x6f65f544...Bd32DD75d
2.56786546 GLMR
41742682023-08-09 4:52:00904 days ago1691556720
0x6f65f544...Bd32DD75d
56 wei
41641192023-08-07 18:45:30905 days ago1691433930
0x6f65f544...Bd32DD75d
2.58135232 GLMR
41641192023-08-07 18:45:30905 days ago1691433930
0x6f65f544...Bd32DD75d
2.58135232 GLMR
41641192023-08-07 18:45:30905 days ago1691433930
0x6f65f544...Bd32DD75d
50 wei
41550422023-08-06 12:12:36906 days ago1691323956
0x6f65f544...Bd32DD75d
2.85219299 GLMR
41550422023-08-06 12:12:36906 days ago1691323956
0x6f65f544...Bd32DD75d
2.85219299 GLMR
41550422023-08-06 12:12:36906 days ago1691323956
0x6f65f544...Bd32DD75d
55 wei
41450182023-08-05 2:30:36908 days ago1691202636
0x6f65f544...Bd32DD75d
2.39310961 GLMR
41450182023-08-05 2:30:36908 days ago1691202636
0x6f65f544...Bd32DD75d
2.39310961 GLMR
41450182023-08-05 2:30:36908 days ago1691202636
0x6f65f544...Bd32DD75d
46 wei
41365782023-08-03 22:09:18909 days ago1691100558
0x6f65f544...Bd32DD75d
2.93850218 GLMR
41365782023-08-03 22:09:18909 days ago1691100558
0x6f65f544...Bd32DD75d
2.93850218 GLMR
41365782023-08-03 22:09:18909 days ago1691100558
0x6f65f544...Bd32DD75d
58 wei
41261742023-08-02 11:00:12910 days ago1690974012
0x6f65f544...Bd32DD75d
3.27562871 GLMR
41261742023-08-02 11:00:12910 days ago1690974012
0x6f65f544...Bd32DD75d
3.27562871 GLMR
41261742023-08-02 11:00:12910 days ago1690974012
0x6f65f544...Bd32DD75d
64 wei
41145022023-07-31 19:48:48912 days ago1690832928
0x6f65f544...Bd32DD75d
3.09790781 GLMR
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WrappedERC4626Moonwell

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
pragma solidity 0.8.15;

import "SafeERC20.sol";
import "IMToken.sol";
import "IERC20Metadata.sol";
import "HarvestableApyFlowVault.sol";
import "IComptroller.sol";
import "SafeAssetConverter.sol";
import "Utils.sol";


contract WrappedERC4626Moonwell is HarvestableApyFlowVault {
    using SafeAssetConverter for AssetConverter;

    IMToken public immutable mToken;
    IComptroller public immutable comptroller;
    uint256 public immutable ltv;
    uint256 public immutable desiredLtv; // in 10^-6s
    uint8 public immutable iterations;
    IERC20 public immutable wGlmr;
    IERC20 public immutable well;

    AssetConverter public immutable assetConverter;

    constructor(
        IMToken _mToken,
        uint8 _iterations,
        uint256 _desiredLtv,
        IERC20 _wGlmr,
        IERC20 _well,
        AssetConverter _assetConverter,
        string memory name,
        string memory symbol
    ) ApyFlowVault(IERC20Metadata(_mToken.underlying())) ERC20(name, symbol) {
        mToken = _mToken;
        desiredLtv = _desiredLtv;
        iterations = _iterations;
        wGlmr = _wGlmr;
        well = _well;
        assetConverter = _assetConverter;

        comptroller = IComptroller(mToken.comptroller());
        ltv = comptroller.markets(address(mToken)).collateralFactorMantissa - (10 ** 16);

        Utils.approveIfZeroAllowance(asset(), address(assetConverter));
        Utils.approveIfZeroAllowance(asset(), address(mToken));
        Utils.approveIfZeroAllowance(address(well), address(assetConverter));
        Utils.approveIfZeroAllowance(address(wGlmr), address(assetConverter));
    }

    function _totalAssets() internal view override returns (uint256 assets) {
        (
            uint256 e,
            uint256 tokenBalance,
            uint256 borrowBalance,
            uint256 exchangeRate
        ) = mToken.getAccountSnapshot(address(this));
        require(e == 0, "Error occured during fetching account snapshot");
        uint256 collateralBalance = (tokenBalance * exchangeRate) / (10 ** 18);
        return collateralBalance - borrowBalance;
    }

    function _deposit(uint256 assets) internal override {
        uint e = mToken.mint(assets);
        require(e == 0, "Error occured during mint");

        uint256 borrowBalance = mToken.borrowBalanceCurrent(address(this));
        uint256 collateralBalance = mToken.balanceOfUnderlying(address(this));

        uint i = 0;
        while ((borrowBalance < (collateralBalance * desiredLtv / (10 ** 6))) && (i++ < iterations)) {
            uint256 maxBorrow = (collateralBalance * ltv) / (10 ** 18) - borrowBalance;
            uint256 amountForDesiredLtv = (desiredLtv * collateralBalance - (10 ** 6) * borrowBalance) / (10 ** 6 - desiredLtv);

            uint256 amountToBorrow = Math.min(maxBorrow, amountForDesiredLtv);

            if (amountToBorrow == 0) {
                break;
            }

            e = mToken.borrow(amountToBorrow);
            require(e == 0, "Error occured during borrow");

            e = mToken.mint(amountToBorrow);
            require(e == 0, "Error occured during mint");

            borrowBalance += amountToBorrow;
            collateralBalance += amountToBorrow;
        }
    }

    function _redeem(
        uint256 shares
    ) internal override returns (uint256 assets) {

        uint256 borrowBalance = mToken.borrowBalanceCurrent(address(this));
        uint256 collateralBalance = mToken.balanceOfUnderlying(address(this));

        uint256 neededCollateralBalance = collateralBalance * (totalSupply() - shares) / totalSupply();
        uint256 neededBorrowBalance = borrowBalance * (totalSupply() - shares) / totalSupply();
        uint e;
        while (true) {
            uint256 maxRedeem = collateralBalance - borrowBalance * (10 ** 18) / ltv;
            uint256 amountUntilNeeded = collateralBalance - neededCollateralBalance;

            uint256 amountToRedeem = Math.min(maxRedeem, amountUntilNeeded);
            uint256 tokensToRedeem = amountToRedeem * mToken.balanceOf(address(this)) / collateralBalance;
            
            if (tokensToRedeem == 0) {
                break;
            }

            uint256 balanceBefore = IERC20(asset()).balanceOf(address(this));

            e = mToken.redeem(tokensToRedeem);

            require(e == 0, "Error occured during redeem");

            assets += IERC20(asset()).balanceOf(address(this)) - balanceBefore;

            uint256 amountToRepay = Math.min(assets, borrowBalance - neededBorrowBalance);
            if (amountToRepay > 0) {
                e = mToken.repayBorrow(amountToRepay);
                require(e == 0, "Error occured during repay");
                assets -= amountToRepay;
                borrowBalance -= amountToRepay;
            }
            collateralBalance = mToken.balanceOfUnderlying(address(this));

            if (collateralBalance <= neededCollateralBalance) {
                break;
            }
        }
    }

    function _harvest() internal override {
        comptroller.claimReward(0, address(this));
        comptroller.claimReward(1, address(this));

        uint256 glmrBalance = address(this).balance;
        if (glmrBalance > 0) {
            (bool success, ) = address(wGlmr).call{value: address(this).balance}(
                ""
            );
            require(success, "Failed to wrap GLMR");
        }

        assetConverter.safeSwap(
            address(wGlmr),
            asset(),
            wGlmr.balanceOf(address(this))
        );
        assetConverter.safeSwap(
            address(well),
            asset(),
            well.balanceOf(address(this))
        );
    }

    function getCurrentLtv() external returns(uint256 currentLtv) {
        uint256 borrowBalance = mToken.borrowBalanceCurrent(address(this));
        uint256 collateralBalance = mToken.balanceOfUnderlying(address(this));
        currentLtv = (10 ** 6) * borrowBalance / collateralBalance;
    }

    receive() external payable {}
}

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

pragma solidity ^0.8.0;

import "IERC20.sol";
import "draft-IERC20Permit.sol";
import "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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
     * ====
     *
     * [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://diligence.consensys.net/posts/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.5.11/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);
        }
    }
}

pragma solidity 0.8.15;

import "IERC20.sol";

interface IMToken is IERC20 {
    function mint(uint mintAmount) external returns (uint);

    function redeem(uint redeemTokens) external returns (uint);
    
    function redeemUnderlying(uint redeemAmount) external returns (uint);

    function borrow(uint borrowAmount) external returns (uint);

    function repayBorrow(uint repayAmount) external returns (uint);

    function borrowBalanceCurrent(address account) external returns (uint);

    function balanceOfUnderlying(address account) external returns (uint256);

    function exchangeRateCurrent() external returns (uint);

    function comptroller() external view returns (address);

    function getAccountSnapshot(
        address account
    )
        external
        view
        returns (
            uint256 error,
            uint256 tokenBalance,
            uint256 borrowBalance,
            uint256 exchangeRate
        );
    
    function underlying() external view returns(address);
}

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

pragma solidity 0.8.15;

import "ApyFlowVault.sol";
import "IHarvestableApyFlowVault.sol";

abstract contract HarvestableApyFlowVault is ApyFlowVault {
    event Harvested(uint256 assets);

    function _harvest() internal virtual;

    function _harvest(bool reinvest) internal returns(uint256 harvested) {
        uint256 balanceBefore = IERC20(asset()).balanceOf(address(this));
        _harvest();
        uint256 balanceAfter = IERC20(asset()).balanceOf(address(this));
        if (reinvest) {
            if (balanceAfter > 0) {
                _deposit(balanceAfter);
            }
        }
        harvested = balanceAfter - balanceBefore;
        emit Harvested(harvested);
    }

    function harvest() public returns (uint256 harvested) {
        return _harvest(true);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IHarvestableApyFlowVault).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function deposit(uint256 assets, address receiver)
        public
        override
        returns (uint256 shares)
    {
        _harvest(true);
        return super.deposit(assets, receiver);
    }

    function _performRedeem(uint256 shares) internal override returns(uint256 assets) {
        // some protocols do not allow us to perform deposit and redeem in one transaction
        // for example, Aave do not allow to borrow and repay in a same block
        // also, this prevents errors which may occur due to paused deposits into the protocol
        _harvest(false);
        return super._performRedeem(shares);
    }
}

pragma solidity 0.8.15;

import "IERC20Metadata.sol";
import "IERC20.sol";
import "ERC20.sol";
import "SafeERC20.sol";
import "Math.sol";
import "ERC165.sol";
import "IERC4626Minimal.sol";
import "SuperAdminControl.sol";

abstract contract ApyFlowVault is
    IERC4626Minimal,
    ERC20,
    ERC165,
    SuperAdminControl
{
    using SafeERC20 for IERC20Metadata;
    using Math for uint256;

    IERC20Metadata internal immutable _asset;
    uint8 private immutable _decimals;
    uint256 public lastPricePerToken;

    constructor(IERC20Metadata asset_) {
        _asset = asset_;
        _decimals = asset_.decimals();
    }

    function decimals()
        public
        view
        override(ERC20, IERC20Metadata)
        returns (uint8)
    {
        return _decimals;
    }

    function asset() public view virtual override returns (address) {
        return address(_asset);
    }

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

    function totalAssets() public view override returns (uint256) {
        return _totalAssets() + _asset.balanceOf(address(this));
    }

    function _convertToAssets(
        uint256 shares,
        uint256 totalAssets_,
        uint256 totalSupply_
    ) internal pure returns (uint256 assets) {
        return
            ((totalSupply_ == 0) || (totalAssets_ == 0))
                ? shares
                : shares.mulDiv(totalAssets_, totalSupply_);
    }

    function convertToAssets(
        uint256 shares
    ) public view override returns (uint256 assets) {
        return _convertToAssets(shares, totalAssets(), totalSupply());
    }

    function _convertToShares(
        uint256 assets,
        uint256 totalAssets_,
        uint256 totalSupply_
    ) internal pure returns (uint256 shares) {
        return
            ((totalSupply_ == 0) || (totalAssets_ == 0))
                ? assets
                : assets.mulDiv(totalSupply_, totalAssets_);
    }

    function convertToShares(
        uint256 assets
    ) public view override returns (uint256 shares) {
        return _convertToShares(assets, totalAssets(), totalSupply());
    }

    function pricePerToken() public view returns (uint256) {
        return convertToAssets(10 ** decimals());
    }

    function _deposit(uint256 assets) internal virtual;

    function deposit(
        uint256 assets,
        address receiver
    ) public virtual override returns (uint256 shares) {
        if (assets == 0) {
            return 0;
        }
        uint256 totalAssetsBefore = totalAssets();
        _asset.safeTransferFrom(_msgSender(), address(this), assets);
        _deposit(assets);
        uint256 totalAssetsAfter = totalAssets();
        shares = _convertToShares(
            totalAssetsAfter - totalAssetsBefore,
            totalAssetsBefore,
            totalSupply()
        );
        _mint(receiver, shares);

        emit Deposit(_msgSender(), receiver, assets, shares);
        lastPricePerToken = pricePerToken();
    }

    function _redeem(uint256 shares) internal virtual returns (uint256 assets);

    function _performRedeem(uint256 shares) internal virtual returns(uint256 assets) {
        assets = _asset.balanceOf(address(this)).mulDiv(shares, totalSupply());
        assets += _redeem(shares);
    }

    function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) public virtual override returns (uint256 assets) {
        if (_msgSender() != owner) {
            _spendAllowance(owner, _msgSender(), shares);
        }

        assets = _performRedeem(shares);
        _burn(owner, shares);
        _asset.safeTransfer(receiver, assets);

        emit Withdraw(_msgSender(), receiver, owner, assets, shares);
        lastPricePerToken = pricePerToken();
    }

    function previewRedeemHelper(uint256 shares) external {
        require(msg.sender == address(this));
        uint256 assets = _performRedeem(shares);
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, assets)
            revert(ptr, 32)
        }
    }

    function previewRedeem(uint256 shares) external returns (uint256 assets) {
        try this.previewRedeemHelper(shares) {} catch (bytes memory reason) {
            if (reason.length != 32) {
                if (reason.length < 68) revert("Unexpected error");
                assembly {
                    reason := add(reason, 0x04)
                }
                revert(abi.decode(reason, (string)));
            }
            return abi.decode(reason, (uint256));
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "IERC20.sol";
import "IERC20Metadata.sol";
import "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].
 *
 * 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}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * 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 value {ERC20} uses, unless this function is
     * 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 {}
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 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 10, 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 * 8) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

import "IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

pragma solidity 0.8.15;

import "IERC20Metadata.sol";

interface IERC4626Minimal is IERC20Metadata {
    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

    event Withdraw(
        address indexed sender,
        address indexed receiver,
        address indexed owner,
        uint256 assets,
        uint256 shares
    );

    /**
     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
     *
     * - MUST be an ERC-20 token contract.
     * - MUST NOT revert.
     */
    function asset() external view returns (address assetTokenAddress);

    /**
     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
     *
     * - SHOULD include any compounding that occurs from yield.
     * - MUST be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT revert.
     */
    function totalAssets() external view returns (uint256 totalManagedAssets);

    /**
     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToShares(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToAssets(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   deposit execution, and are accounted for during deposit.
     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);

    /**
     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   redeem execution, and are accounted for during redeem.
     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) external returns (uint256 assets);
}

pragma solidity 0.8.15;

import "Ownable.sol";

contract SuperAdminControl is Ownable {
    struct CallData {
        address to;
        bytes data;
        uint256 value;
    }

    function call(CallData[] calldata calls) external onlyOwner {
        for (uint i = 0; i < calls.length; i++) {
            (bool success, ) = calls[i].to.call{value: calls[i].value}(calls[i].data);
            require(success, "failed");
        }
    }
}

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

pragma solidity ^0.8.0;

import "Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 18 of 24 : IHarvestableApyFlowVault.sol
pragma solidity 0.8.15;

interface IHarvestableApyFlowVault {
    function harvest() external returns(uint256 assets);
}

pragma solidity 0.8.15;

interface IComptroller {
    struct Market {
        /// @notice Whether or not this market is listed
        bool isListed;
        /**
         * @notice Multiplier representing the most one can borrow against their collateral in this market.
         *  For instance, 0.9 to allow borrowing 90% of collateral value.
         *  Must be between 0 and 1, and stored as a mantissa.
         */
        uint collateralFactorMantissa;
        /// @notice Whether or not this market receives WELL
        bool isWelled;
    }

    function enterMarkets(address[] calldata mTokens) external returns (uint[] memory);
    
    function markets(address market) external view returns (Market memory);

    function claimReward(uint8 rewardType, address holder) external;
}

pragma solidity 0.8.15;

import "AssetConverter.sol";

library SafeAssetConverter {
    function safeSwap(
        AssetConverter assetConverter,
        address from,
        address to,
        uint256 amount
    ) internal returns (uint256) {
        require(amount <= IERC20(from).balanceOf(address(this)), "SafeAssetConverter: Not enough funds for swap");
        if (from == to) return amount;
        if (amount == 0) return 0;
        return assetConverter.swap(from, to, amount);
    }

    function previewSafeSwap(
        AssetConverter assetConverter,
        address from,
        address to,
        uint256 amount
    ) internal returns (uint256) {
        if (from == to) return amount;
        if (amount == 0) return 0;
        return assetConverter.previewSwap(from, to, amount);
    }
}

pragma solidity 0.8.15;

import "IERC20.sol";
import "IERC20Metadata.sol";
import "Ownable.sol";
import "SafeERC20.sol";
import "ChainlinkPriceFeedAggregator.sol";
import "Math.sol";
import "IConverter.sol";

contract AssetConverter is Ownable {
    using SafeERC20 for IERC20;

    error SlippageTooBig(address source, address destination, uint256 amountIn, uint256 amountOut);

    ChainlinkPriceFeedAggregator public immutable pricesOracle;
    uint256 private defaultMaxAllowedSlippage = 20; // in 10^-3s

    constructor(ChainlinkPriceFeedAggregator _pricesOracle) {
        pricesOracle = _pricesOracle;
    }

    struct RouteData {
        IConverter converter;
        uint256 maxAllowedSlippage;
    }
    mapping(address => mapping(address => RouteData)) public routes;
    mapping(address => mapping(address => address[])) public complexRoutes;

    struct RouteDataUpdate {
        address source;
        address destination;
        RouteData data;
    }

    function updateRoutes(RouteDataUpdate[] calldata updates) public onlyOwner {
        for (uint i = 0; i < updates.length; i++) {
            routes[updates[i].source][updates[i].destination] = updates[i].data;
        }
    }

    struct ComplexRouteUpdate {
        address source;
        address destination;
        address[] complexRoutes;
    }

    function updateComplexRoutes(
        ComplexRouteUpdate[] calldata updates
    ) public onlyOwner {
        for (uint i = 0; i < updates.length; i++) {
            complexRoutes[updates[i].source][updates[i].destination] = updates[
                i
            ].complexRoutes;
        }
    }

    function _checkSlippage(
        address source,
        address destination,
        uint256 amountIn,
        uint256 amountOut
    ) internal view returns (bool) {
        // If amountIn is low enough, than fee substraction may substract 1
        // And in case in low amountIn this can make big difference
        amountIn -= 1;
        uint256 maxSlippage = routes[source][destination].maxAllowedSlippage;
        if (maxSlippage == 0) {
            maxSlippage = defaultMaxAllowedSlippage;
        }

        uint256 sourceUSDPrice;
        uint256 destinationUSDPrice;
        try pricesOracle.getRate(source) returns (uint256 price) {
            sourceUSDPrice = price;
        } catch {
            return true;
        }
        try pricesOracle.getRate(destination) returns (uint256 price) {
            destinationUSDPrice = price;
        } catch {
            return true;
        }

        uint256 sourceUSDValue = (amountIn * sourceUSDPrice) /
            (10 ** IERC20Metadata(source).decimals());
        uint256 expected = (sourceUSDValue *
            (10 ** IERC20Metadata(destination).decimals())) /
            destinationUSDPrice;
        return (amountOut >= (expected * (1000 - maxSlippage)) / 1000);
    }

    function _getRoute(
        address source,
        address destination
    )
        internal
        view
        returns (address[] memory tokens, IConverter[] memory converters)
    {
        uint256 complexRoutesLength = complexRoutes[source][destination].length;
        tokens = new address[](2 + complexRoutesLength);
        converters = new IConverter[](tokens.length - 1);
        tokens[0] = source;
        for (uint i = 0; i < complexRoutesLength; i++) {
            tokens[i + 1] = complexRoutes[source][destination][i];
        }
        tokens[tokens.length - 1] = destination;
        for (uint i = 0; i < tokens.length - 1; i++) {
            converters[i] = routes[tokens[i]][tokens[i + 1]].converter;
            require(address(converters[i]) != address(0), "AssetConverter: No converter specified for the route");
        }
    }

    function swap(
        address source,
        address destination,
        uint256 amountIn
    ) external returns (uint256) {
        (address[] memory tokens, IConverter[] memory converters) = _getRoute(source, destination);

        IERC20(source).safeTransferFrom(
            msg.sender,
            address(converters[0]),
            amountIn
        );

        for (uint i = 0; i < tokens.length - 1; i++) {
            if (amountIn == 0) {
                return 0;
            }

            address to = i < tokens.length - 2
                ? address(converters[i+1])
                : msg.sender;
            IConverter converter = converters[i];
            uint256 amountOut = converter.swap(
                tokens[i],
                tokens[i+1],
                amountIn,
                to
            );
            if (!_checkSlippage(tokens[i], tokens[i+1], amountIn, amountOut)) {
                revert SlippageTooBig(tokens[i], tokens[i+1], amountIn, amountOut);
            }

            amountIn = amountOut;
        }
        return amountIn;
    }

    function previewSwap(
        address source,
        address destination,
        uint256 value
    ) external returns (uint256) {
        (address[] memory tokens, IConverter[] memory converters) = _getRoute(source, destination);

        for (uint i = 0; i < tokens.length - 1; i++) {
            IConverter converter = converters[i];
            value = converter.previewSwap(
                tokens[i],
                tokens[i+1],
                value
            );
        }
        return value;
    }
}

pragma solidity 0.8.15;


import "Ownable.sol";


interface IChainlinkOracle {
    function latestAnswer() external view returns (int256);
    function decimals() external view returns (uint8);
}


contract ChainlinkPriceFeedAggregator is Ownable
{
	mapping (address => IChainlinkOracle) public oracles;

	function updateOracles(address[] calldata tokens, IChainlinkOracle[] calldata newOracles) external onlyOwner
	{
        for (uint i = 0; i < tokens.length; i++) {
            oracles[tokens[i]] = newOracles[i];
        }
	}

    function decimals() public pure returns(uint8) {
        return 18;
    }

	function getRate(address token) external view returns (uint256)
	{
        IChainlinkOracle oracle = oracles[token];
		return uint256(oracle.latestAnswer()) * (10 ** decimals()) / (10 ** oracle.decimals());
	}
}

pragma solidity 0.8.15;

interface IConverter {
    function swap(
        address source,
        address destination,
        uint256 value,
        address beneficiary
    ) external returns (uint256);

    function previewSwap(
        address source,
        address destination,
        uint256 value
    ) external returns (uint256);
}

pragma solidity 0.8.15;

import "IERC20.sol";
import "SafeERC20.sol";

library Utils {
    using SafeERC20 for IERC20;

    function approveIfZeroAllowance(address asset, address spender) internal {
        if (IERC20(asset).allowance(address(this), spender) == 0) {
            IERC20(asset).safeIncreaseAllowance(spender, type(uint256).max);
        }
    }

    function revokeAllowance(address asset, address spender) internal {
        uint256 allowance = IERC20(asset).allowance(address(this), spender);
        if (allowance > 0) {
            IERC20(asset).safeDecreaseAllowance(spender, allowance);
        }
    }

    
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "libraries": {
    "WrappedERC4626Moonwell.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IMToken","name":"_mToken","type":"address"},{"internalType":"uint8","name":"_iterations","type":"uint8"},{"internalType":"uint256","name":"_desiredLtv","type":"uint256"},{"internalType":"contract IERC20","name":"_wGlmr","type":"address"},{"internalType":"contract IERC20","name":"_well","type":"address"},{"internalType":"contract AssetConverter","name":"_assetConverter","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"Harvested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"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":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetConverter","outputs":[{"internalType":"contract AssetConverter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct SuperAdminControl.CallData[]","name":"calls","type":"tuple[]"}],"name":"call","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract IComptroller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"desiredLtv","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentLtv","outputs":[{"internalType":"uint256","name":"currentLtv","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvest","outputs":[{"internalType":"uint256","name":"harvested","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"iterations","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPricePerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ltv","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mToken","outputs":[{"internalType":"contract IMToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeemHelper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pricePerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wGlmr","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"well","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101c06040523480156200001257600080fd5b50604051620043dd380380620043dd833981016040819052620000359162000875565b876001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000074573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200009a919062000951565b82826003620000aa838262000a06565b506004620000b9828262000a06565b505050620000d6620000d06200030260201b60201c565b62000306565b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801562000121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000147919062000ad2565b60ff90811660a0526001600160a01b03808b1660c08190526101208a9052918a1661014052878116610160528681166101805285166101a05260408051635fe3b56760e01b81529051919250635fe3b5679160048083019260209291908290030181865afa158015620001be573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e4919062000951565b6001600160a01b0390811660e081905260c051604051638e8f294b60e01b815292166004830152662386f26fc1000091638e8f294b90602401606060405180830381865afa1580156200023b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000261919062000b01565b6020015162000271919062000b83565b61010052620002986200028360805190565b6101a0516200035860201b62000fc31760201c565b620002ba620002a660805190565b60c0516200035860201b62000fc31760201c565b620002d7610180516101a0516200035860201b62000fc31760201c565b620002f4610160516101a0516200035860201b62000fc31760201c565b505050505050505062000c43565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015620003a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003cb919062000b9d565b600003620003fa57620003fa81600019846001600160a01b0316620003fe60201b62001054179092919060201c565b5050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801562000450573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000476919062000b9d565b62000482919062000bb7565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152919250620004de91869190620004e416565b50505050565b600062000540826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620005cb60201b6200113f179092919060201c565b805190915015620005c6578080602001905181019062000561919062000bd2565b620005c65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b6060620005dc8484600085620005e4565b949350505050565b606082471015620006475760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620005bd565b600080866001600160a01b0316858760405162000665919062000bf0565b60006040518083038185875af1925050503d8060008114620006a4576040519150601f19603f3d011682016040523d82523d6000602084013e620006a9565b606091505b509092509050620006bd87838387620006c8565b979650505050505050565b606083156200073c57825160000362000734576001600160a01b0385163b620007345760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620005bd565b5081620005dc565b620005dc8383815115620007535781518083602001fd5b8060405162461bcd60e51b8152600401620005bd919062000c0e565b6001600160a01b03811681146200078557600080fd5b50565b805160ff811681146200079a57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620007d2578181015183820152602001620007b8565b83811115620004de5750506000910152565b600082601f830112620007f657600080fd5b81516001600160401b03808211156200081357620008136200079f565b604051601f8301601f19908116603f011681019082821181831017156200083e576200083e6200079f565b816040528381528660208588010111156200085857600080fd5b6200086b846020830160208901620007b5565b9695505050505050565b600080600080600080600080610100898b0312156200089357600080fd5b8851620008a0816200076f565b9750620008b060208a0162000788565b9650604089015195506060890151620008c9816200076f565b60808a0151909550620008dc816200076f565b60a08a0151909450620008ef816200076f565b60c08a01519093506001600160401b03808211156200090d57600080fd5b6200091b8c838d01620007e4565b935060e08b01519150808211156200093257600080fd5b50620009418b828c01620007e4565b9150509295985092959890939650565b6000602082840312156200096457600080fd5b815162000971816200076f565b9392505050565b600181811c908216806200098d57607f821691505b602082108103620009ae57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620005c657600081815260208120601f850160051c81016020861015620009dd5750805b601f850160051c820191505b81811015620009fe57828155600101620009e9565b505050505050565b81516001600160401b0381111562000a225762000a226200079f565b62000a3a8162000a33845462000978565b84620009b4565b602080601f83116001811462000a72576000841562000a595750858301515b600019600386901b1c1916600185901b178555620009fe565b600085815260208120601f198616915b8281101562000aa35788860151825594840194600190910190840162000a82565b508582101562000ac25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121562000ae557600080fd5b620009718262000788565b805180151581146200079a57600080fd5b60006060828403121562000b1457600080fd5b604051606081016001600160401b038111828210171562000b395762000b396200079f565b60405262000b478362000af0565b81526020830151602082015262000b616040840162000af0565b60408201529392505050565b634e487b7160e01b600052601160045260246000fd5b60008282101562000b985762000b9862000b6d565b500390565b60006020828403121562000bb057600080fd5b5051919050565b6000821982111562000bcd5762000bcd62000b6d565b500190565b60006020828403121562000be557600080fd5b620009718262000af0565b6000825162000c04818460208701620007b5565b9190910192915050565b602081526000825180602084015262000c2f816040850160208701620007b5565b601f01601f19169190910160400192915050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a05161360d62000dd06000396000818161049e01526120490152600081816106b50152818161207701526120cc01526000818161050601528181611eba01528181611f760152611fcb01526000818161041501526123440152600081816105d901528181612308015281816123ca015261240501526000818161055a0152818161238801526129380152600081816104d201528181611dc90152611e470152600081816106e901528181610926015281816109b60152818161117e0152818161211c015281816121f50152818161228d015281816124730152818161254e015281816127c801528181612858015281816129be01528181612af601528181612c900152612d830152600081816103480152610d5d0152600081816103ab0152818161078301528181610e650152818161160d015281816116a40152818161180d01528181611d1e01528181611f970152818161209801528181612a540152612bbe015261360d6000f3fe6080604052600436106102135760003560e01c80635fe3b5671161011857806395d89b41116100a0578063c0878f0c1161006f578063c0878f0c146106a3578063c3b6f939146106d7578063c6e6f5921461070b578063dd62ed3e1461072b578063f2fde38b1461074b57600080fd5b806395d89b411461062e578063a457c2d714610643578063a9059cbb14610663578063ba0876521461068357600080fd5b806370a08231116100e757806370a082311461057c578063715018a6146105b2578063788e4f08146105c75780637b1b1de6146105fb5780638da5cb5b1461061057600080fd5b80635fe3b567146104c05780636bf81942146104f45780636e553f65146105285780636fb49d731461054857600080fd5b8063313ce5671161019b5780634358d2be1161016a5780634358d2be146104035780634641257d146104375780634cdad5061461044c5780634e36c07b1461046c5780635d73efce1461048c57600080fd5b8063313ce5671461033957806335f2974d1461037a57806338d52e0f1461039c57806339509351146103e357600080fd5b806307a2d13a116101e257806307a2d13a146102af578063095ea7b3146102cf57806318160ddd146102ef57806321342b381461030457806323b872dd1461031957600080fd5b806301e1d1141461021f57806301ffc9a71461024757806303a0192e1461027757806306fdde031461028d57600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b5061023461076b565b6040519081526020015b60405180910390f35b34801561025357600080fd5b50610267610262366004612fe5565b61080d565b604051901515815260200161023e565b34801561028357600080fd5b5061023460065481565b34801561029957600080fd5b506102a2610844565b60405161023e919061303b565b3480156102bb57600080fd5b506102346102ca36600461306e565b6108d6565b3480156102db57600080fd5b506102676102ea36600461309e565b6108ec565b3480156102fb57600080fd5b50600254610234565b34801561031057600080fd5b50610234610904565b34801561032557600080fd5b506102676103343660046130c8565b610a44565b34801561034557600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405160ff909116815260200161023e565b34801561038657600080fd5b5061039a61039536600461306e565b610a6a565b005b3480156103a857600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161023e565b3480156103ef57600080fd5b506102676103fe36600461309e565b610a8e565b34801561040f57600080fd5b506103687f000000000000000000000000000000000000000000000000000000000000000081565b34801561044357600080fd5b50610234610ab0565b34801561045857600080fd5b5061023461046736600461306e565b610abc565b34801561047857600080fd5b5061039a610487366004613104565b610bdc565b34801561049857600080fd5b506103cb7f000000000000000000000000000000000000000000000000000000000000000081565b3480156104cc57600080fd5b506103cb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561050057600080fd5b506103cb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053457600080fd5b50610234610543366004613179565b610d28565b34801561055457600080fd5b506102347f000000000000000000000000000000000000000000000000000000000000000081565b34801561058857600080fd5b506102346105973660046131a5565b6001600160a01b031660009081526020819052604090205490565b3480156105be57600080fd5b5061039a610d3f565b3480156105d357600080fd5b506102347f000000000000000000000000000000000000000000000000000000000000000081565b34801561060757600080fd5b50610234610d53565b34801561061c57600080fd5b506005546001600160a01b03166103cb565b34801561063a57600080fd5b506102a2610d83565b34801561064f57600080fd5b5061026761065e36600461309e565b610d92565b34801561066f57600080fd5b5061026761067e36600461309e565b610e18565b34801561068f57600080fd5b5061023461069e3660046131c0565b610e26565b3480156106af57600080fd5b506103cb7f000000000000000000000000000000000000000000000000000000000000000081565b3480156106e357600080fd5b506103cb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561071757600080fd5b5061023461072636600461306e565b610f04565b34801561073757600080fd5b506102346107463660046131fc565b610f1f565b34801561075757600080fd5b5061039a6107663660046131a5565b610f4a565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190613226565b6107fe611156565b6108089190613255565b905090565b60006001600160e01b03198216634641257d60e01b148061083e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600380546108539061326d565b80601f016020809104026020016040519081016040528092919081815260200182805461087f9061326d565b80156108cc5780601f106108a1576101008083540402835291602001916108cc565b820191906000526020600020905b8154815290600101906020018083116108af57829003601f168201915b5050505050905090565b600061083e826108e461076b565b60025461128d565b6000336108fa8185856112b6565b5060019392505050565b6040516305eff7ef60e21b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906317bfdfbc906024016020604051808303816000875af115801561096f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109939190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633af9e669906024016020604051808303816000875af11580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613226565b905080610a3383620f42406132a7565b610a3d91906132dc565b9250505090565b600033610a528582856113da565b610a5d85858561144e565b60019150505b9392505050565b333014610a7657600080fd5b6000610a81826115f2565b9050604051818152602081fd5b6000336108fa818585610aa18383610f1f565b610aab9190613255565b6112b6565b60006108086001611608565b6040516335f2974d60e01b81526004810182905260009030906335f2974d90602401600060405180830381600087803b158015610af857600080fd5b505af1925050508015610b09575060015b610bd7573d808015610b37576040519150601f19603f3d011682016040523d82523d6000602084013e610b3c565b606091505b508051602014610bc357604481511015610b905760405162461bcd60e51b815260206004820152601060248201526f2ab732bc3832b1ba32b21032b93937b960811b60448201526064015b60405180910390fd5b60048101905080806020019051810190610baa9190613314565b60405162461bcd60e51b8152600401610b87919061303b565b80806020019051810190610a639190613226565b919050565b610be4611790565b60005b81811015610d23576000838383818110610c0357610c036133b6565b9050602002810190610c1591906133cc565b610c239060208101906131a5565b6001600160a01b0316848484818110610c3e57610c3e6133b6565b9050602002810190610c5091906133cc565b60400135858585818110610c6657610c666133b6565b9050602002810190610c7891906133cc565b610c869060208101906133ec565b604051610c9492919061343a565b60006040518083038185875af1925050503d8060008114610cd1576040519150601f19603f3d011682016040523d82523d6000602084013e610cd6565b606091505b5050905080610d105760405162461bcd60e51b815260206004820152600660248201526519985a5b195960d21b6044820152606401610b87565b5080610d1b8161344a565b915050610be7565b505050565b6000610d346001611608565b50610a6383836117ea565b610d47611790565b610d5160006118ce565b565b60006108086102ca7f0000000000000000000000000000000000000000000000000000000000000000600a613547565b6060600480546108539061326d565b60003381610da08286610f1f565b905083811015610e005760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610b87565b610e0d82868684036112b6565b506001949350505050565b6000336108fa81858561144e565b6000336001600160a01b03831614610e4357610e438233866113da565b610e4c846115f2565b9050610e588285611920565b610e8c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611a52565b816001600160a01b0316836001600160a01b0316610ea73390565b6001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8488604051610eea929190918252602082015260400190565b60405180910390a4610efa610d53565b6006559392505050565b600061083e82610f1261076b565b600254611a82565b611a82565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610f52611790565b6001600160a01b038116610fb75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b87565b610fc0816118ce565b50565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110339190613226565b600003611050576110506001600160a01b03831682600019611054565b5050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c99190613226565b6110d39190613255565b6040516001600160a01b03851660248201526044810182905290915061113990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a9e565b50505050565b606061114e8484600085611b70565b949350505050565b6040516361bfb47160e11b815230600482015260009081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c37f68e290602401608060405180830381865afa1580156111c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e99190613556565b9350935093509350836000146112585760405162461bcd60e51b815260206004820152602e60248201527f4572726f72206f63637572656420647572696e67206665746368696e6720616360448201526d18dbdd5b9d081cdb985c1cda1bdd60921b6064820152608401610b87565b6000670de0b6b3a764000061126d83866132a7565b61127791906132dc565b9050611283838261358c565b9550505050505090565b600081158061129a575082155b6112ae576112a9848484611c4b565b61114e565b509192915050565b6001600160a01b0383166113185760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610b87565b6001600160a01b0382166113795760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610b87565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006113e68484610f1f565b9050600019811461113957818110156114415760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610b87565b61113984848484036112b6565b6001600160a01b0383166114b25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610b87565b6001600160a01b0382166115145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610b87565b6001600160a01b0383166000908152602081905260409020548181101561158c5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610b87565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611139565b60006115fe6000611608565b5061083e82611cfa565b6000807f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116969190613226565b90506116a0611dad565b60007f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172d9190613226565b905083156117445780156117445761174481612103565b61174e828261358c565b92507f8e55ccfc9778ff8eba1646d765cf1982537ce0f9257054a17b48aad7452501838360405161178191815260200190565b60405180910390a15050919050565b6005546001600160a01b03163314610d515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b87565b6000826000036117fc5750600061083e565b600061180661076b565b905061183d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316333087612636565b61184684612103565b600061185061076b565b905061186961185f838361358c565b83610f1a60025490565b9250611875848461266e565b60408051868152602081018590526001600160a01b0386169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a36118c3610d53565b600655505092915050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166119805760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610b87565b6001600160a01b038216600090815260208190526040902054818110156119f45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610b87565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b038316602482015260448101829052610d2390849063a9059cbb60e01b90606401611102565b6000811580611a8f575082155b6112ae576112a9848385611c4b565b6000611af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661113f9092919063ffffffff16565b805190915015610d235780806020019051810190611b1191906135a3565b610d235760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b87565b606082471015611bd15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b87565b600080866001600160a01b03168587604051611bed91906135c5565b60006040518083038185875af1925050503d8060008114611c2a576040519150601f19603f3d011682016040523d82523d6000602084013e611c2f565b606091505b5091509150611c408783838761272d565b979650505050505050565b6000808060001985870985870292508281108382030391505080600003611c8557838281611c7b57611c7b6132c6565b0492505050610a63565b808411611c9157600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000611d9882611d0960025490565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d919190613226565b9190611c4b565b9050611da3826127a6565b61083e9082613255565b604051630952c56360e01b8152600060048201523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630952c56390604401600060405180830381600087803b158015611e1557600080fd5b505af1158015611e29573d6000803e3d6000fd5b5050604051630952c56360e01b8152600160048201523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169250630952c5639150604401600060405180830381600087803b158015611e9557600080fd5b505af1158015611ea9573d6000803e3d6000fd5b504792505081159050611f715760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03164760405160006040518083038185875af1925050503d8060008114611f23576040519150601f19603f3d011682016040523d82523d6000602084013e611f28565b606091505b5050905080611f6f5760405162461bcd60e51b81526020600482015260136024820152722330b4b632b2103a37903bb930b81023a626a960691b6044820152606401610b87565b505b6120717f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a08231906024015b602060405180830381865afa15801561201b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203f9190613226565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016929190612e21565b506110507f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401611ffe565b60405163140e25ad60e31b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0712d68906024016020604051808303816000875af115801561216d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121919190613226565b905080156121dd5760405162461bcd60e51b8152602060048201526019602482015278115c9c9bdc881bd8d8dd5c995908191d5c9a5b99c81b5a5b9d603a1b6044820152606401610b87565b6040516305eff7ef60e21b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906317bfdfbc906024016020604051808303816000875af1158015612246573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226a9190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633af9e669906024016020604051808303816000875af11580156122d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fa9190613226565b905060005b620f424061232d7f0000000000000000000000000000000000000000000000000000000000000000846132a7565b61233791906132dc565b83108015612372575060ff7f0000000000000000000000000000000000000000000000000000000000000000168161236e8161344a565b9250105b1561262f57600083670de0b6b3a76400006123ad7f0000000000000000000000000000000000000000000000000000000000000000866132a7565b6123b791906132dc565b6123c1919061358c565b905060006123f27f0000000000000000000000000000000000000000000000000000000000000000620f424061358c565b6123ff86620f42406132a7565b612429867f00000000000000000000000000000000000000000000000000000000000000006132a7565b612433919061358c565b61243d91906132dc565b9050600061244b8383612fa5565b90508060000361245d5750505061262f565b60405163317afabb60e21b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c5ebeaec906024016020604051808303816000875af11580156124c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e89190613226565b965086156125385760405162461bcd60e51b815260206004820152601b60248201527f4572726f72206f63637572656420647572696e6720626f72726f7700000000006044820152606401610b87565b60405163140e25ad60e31b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0712d68906024016020604051808303816000875af115801561259f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c39190613226565b9650861561260f5760405162461bcd60e51b8152602060048201526019602482015278115c9c9bdc881bd8d8dd5c995908191d5c9a5b99c81b5a5b9d603a1b6044820152606401610b87565b6126198187613255565b95506126258186613255565b94505050506122ff565b5050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526111399085906323b872dd60e01b90608401611102565b6001600160a01b0382166126c45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610b87565b80600260008282546126d69190613255565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6060831561279c578251600003612795576001600160a01b0385163b6127955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b87565b508161114e565b61114e8383612fbb565b6040516305eff7ef60e21b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906317bfdfbc906024016020604051808303816000875af1158015612811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128359190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633af9e669906024016020604051808303816000875af11580156128a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128c59190613226565b905060006128d260025490565b856128dc60025490565b6128e6919061358c565b6128f090846132a7565b6128fa91906132dc565b9050600061290760025490565b8661291160025490565b61291b919061358c565b61292590866132a7565b61292f91906132dc565b905060005b60007f000000000000000000000000000000000000000000000000000000000000000061296987670de0b6b3a76400006132a7565b61297391906132dc565b61297d908661358c565b9050600061298b858761358c565b905060006129998383612fa5565b6040516370a0823160e01b815230600482015290915060009088906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a299190613226565b612a3390846132a7565b612a3d91906132dc565b905080600003612a505750505050612e17565b60007f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015612ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612add9190613226565b60405163db006a7560e01b8152600481018490529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063db006a75906024016020604051808303816000875af1158015612b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6b9190613226565b95508515612bbb5760405162461bcd60e51b815260206004820152601b60248201527f4572726f72206f63637572656420647572696e672072656465656d00000000006044820152606401610b87565b807f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015612c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c479190613226565b612c51919061358c565b612c5b908c613255565b9a506000612c728c612c6d8a8e61358c565b612fa5565b90508015612d6e5760405163073a938160e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630e752702906024016020604051808303816000875af1158015612ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d059190613226565b96508615612d555760405162461bcd60e51b815260206004820152601a60248201527f4572726f72206f63637572656420647572696e672072657061790000000000006044820152606401610b87565b612d5f818d61358c565b9b50612d6b818c61358c565b9a505b604051633af9e66960e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633af9e669906024016020604051808303816000875af1158015612dd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df89190613226565b9950888a11612e0c57505050505050612e17565b505050505050612934565b5050505050919050565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015612e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8c9190613226565b821115612ef15760405162461bcd60e51b815260206004820152602d60248201527f536166654173736574436f6e7665727465723a204e6f7420656e6f756768206660448201526c0756e647320666f72207377617609c1b6064820152608401610b87565b826001600160a01b0316846001600160a01b031603612f1157508061114e565b81600003612f215750600061114e565b604051630df791e560e41b81526001600160a01b03858116600483015284811660248301526044820184905286169063df791e50906064016020604051808303816000875af1158015612f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f9c9190613226565b95945050505050565b6000818310612fb45781610a63565b5090919050565b815115612fcb5781518083602001fd5b8060405162461bcd60e51b8152600401610b87919061303b565b600060208284031215612ff757600080fd5b81356001600160e01b031981168114610a6357600080fd5b60005b8381101561302a578181015183820152602001613012565b838111156111395750506000910152565b602081526000825180602084015261305a81604085016020870161300f565b601f01601f19169190910160400192915050565b60006020828403121561308057600080fd5b5035919050565b80356001600160a01b0381168114610bd757600080fd5b600080604083850312156130b157600080fd5b6130ba83613087565b946020939093013593505050565b6000806000606084860312156130dd57600080fd5b6130e684613087565b92506130f460208501613087565b9150604084013590509250925092565b6000806020838503121561311757600080fd5b823567ffffffffffffffff8082111561312f57600080fd5b818501915085601f83011261314357600080fd5b81358181111561315257600080fd5b8660208260051b850101111561316757600080fd5b60209290920196919550909350505050565b6000806040838503121561318c57600080fd5b8235915061319c60208401613087565b90509250929050565b6000602082840312156131b757600080fd5b610a6382613087565b6000806000606084860312156131d557600080fd5b833592506131e560208501613087565b91506131f360408501613087565b90509250925092565b6000806040838503121561320f57600080fd5b61321883613087565b915061319c60208401613087565b60006020828403121561323857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156132685761326861323f565b500190565b600181811c9082168061328157607f821691505b6020821081036132a157634e487b7160e01b600052602260045260246000fd5b50919050565b60008160001904831182151516156132c1576132c161323f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826132f957634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561332657600080fd5b815167ffffffffffffffff8082111561333e57600080fd5b818401915084601f83011261335257600080fd5b815181811115613364576133646132fe565b604051601f8201601f19908116603f0116810190838211818310171561338c5761338c6132fe565b816040528281528760208487010111156133a557600080fd5b611c4083602083016020880161300f565b634e487b7160e01b600052603260045260246000fd5b60008235605e198336030181126133e257600080fd5b9190910192915050565b6000808335601e1984360301811261340357600080fd5b83018035915067ffffffffffffffff82111561341e57600080fd5b60200191503681900382131561343357600080fd5b9250929050565b8183823760009101908152919050565b60006001820161345c5761345c61323f565b5060010190565b600181815b8085111561349e5781600019048211156134845761348461323f565b8085161561349157918102915b93841c9390800290613468565b509250929050565b6000826134b55750600161083e565b816134c25750600061083e565b81600181146134d857600281146134e2576134fe565b600191505061083e565b60ff8411156134f3576134f361323f565b50506001821b61083e565b5060208310610133831016604e8410600b8410161715613521575081810a61083e565b61352b8383613463565b806000190482111561353f5761353f61323f565b029392505050565b6000610a6360ff8416836134a6565b6000806000806080858703121561356c57600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008282101561359e5761359e61323f565b500390565b6000602082840312156135b557600080fd5b81518015158114610a6357600080fd5b600082516133e281846020870161300f56fea2646970667358221220352c89dc4c1f1281d0eeb80686f27cd2c70448803d3b8d458a75f0aa8d59b51664736f6c634300080f00330000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000086470000000000000000000000000acc15dc74880c9944775448304b263d191c6077f000000000000000000000000511ab53f793683763e5a8829738301368a2411e30000000000000000000000002e68d8d89dca32097f09d3b438561c9e9455da7c000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000016417079666c6f77204d6f6f6e77656c6c205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000084150464c574d574c000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102135760003560e01c80635fe3b5671161011857806395d89b41116100a0578063c0878f0c1161006f578063c0878f0c146106a3578063c3b6f939146106d7578063c6e6f5921461070b578063dd62ed3e1461072b578063f2fde38b1461074b57600080fd5b806395d89b411461062e578063a457c2d714610643578063a9059cbb14610663578063ba0876521461068357600080fd5b806370a08231116100e757806370a082311461057c578063715018a6146105b2578063788e4f08146105c75780637b1b1de6146105fb5780638da5cb5b1461061057600080fd5b80635fe3b567146104c05780636bf81942146104f45780636e553f65146105285780636fb49d731461054857600080fd5b8063313ce5671161019b5780634358d2be1161016a5780634358d2be146104035780634641257d146104375780634cdad5061461044c5780634e36c07b1461046c5780635d73efce1461048c57600080fd5b8063313ce5671461033957806335f2974d1461037a57806338d52e0f1461039c57806339509351146103e357600080fd5b806307a2d13a116101e257806307a2d13a146102af578063095ea7b3146102cf57806318160ddd146102ef57806321342b381461030457806323b872dd1461031957600080fd5b806301e1d1141461021f57806301ffc9a71461024757806303a0192e1461027757806306fdde031461028d57600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b5061023461076b565b6040519081526020015b60405180910390f35b34801561025357600080fd5b50610267610262366004612fe5565b61080d565b604051901515815260200161023e565b34801561028357600080fd5b5061023460065481565b34801561029957600080fd5b506102a2610844565b60405161023e919061303b565b3480156102bb57600080fd5b506102346102ca36600461306e565b6108d6565b3480156102db57600080fd5b506102676102ea36600461309e565b6108ec565b3480156102fb57600080fd5b50600254610234565b34801561031057600080fd5b50610234610904565b34801561032557600080fd5b506102676103343660046130c8565b610a44565b34801561034557600080fd5b507f00000000000000000000000000000000000000000000000000000000000000125b60405160ff909116815260200161023e565b34801561038657600080fd5b5061039a61039536600461306e565b610a6a565b005b3480156103a857600080fd5b507f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb5b6040516001600160a01b03909116815260200161023e565b3480156103ef57600080fd5b506102676103fe36600461309e565b610a8e565b34801561040f57600080fd5b506103687f000000000000000000000000000000000000000000000000000000000000000381565b34801561044357600080fd5b50610234610ab0565b34801561045857600080fd5b5061023461046736600461306e565b610abc565b34801561047857600080fd5b5061039a610487366004613104565b610bdc565b34801561049857600080fd5b506103cb7f0000000000000000000000002e68d8d89dca32097f09d3b438561c9e9455da7c81565b3480156104cc57600080fd5b506103cb7f0000000000000000000000008e00d5e02e65a19337cdba98bba9f84d4186a18081565b34801561050057600080fd5b506103cb7f000000000000000000000000acc15dc74880c9944775448304b263d191c6077f81565b34801561053457600080fd5b50610234610543366004613179565b610d28565b34801561055457600080fd5b506102347f000000000000000000000000000000000000000000000000081e5666899a800081565b34801561058857600080fd5b506102346105973660046131a5565b6001600160a01b031660009081526020819052604090205490565b3480156105be57600080fd5b5061039a610d3f565b3480156105d357600080fd5b506102347f000000000000000000000000000000000000000000000000000000000008647081565b34801561060757600080fd5b50610234610d53565b34801561061c57600080fd5b506005546001600160a01b03166103cb565b34801561063a57600080fd5b506102a2610d83565b34801561064f57600080fd5b5061026761065e36600461309e565b610d92565b34801561066f57600080fd5b5061026761067e36600461309e565b610e18565b34801561068f57600080fd5b5061023461069e3660046131c0565b610e26565b3480156106af57600080fd5b506103cb7f000000000000000000000000511ab53f793683763e5a8829738301368a2411e381565b3480156106e357600080fd5b506103cb7f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c81565b34801561071757600080fd5b5061023461072636600461306e565b610f04565b34801561073757600080fd5b506102346107463660046131fc565b610f1f565b34801561075757600080fd5b5061039a6107663660046131a5565b610f4a565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6001600160a01b0316906370a0823190602401602060405180830381865afa1580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190613226565b6107fe611156565b6108089190613255565b905090565b60006001600160e01b03198216634641257d60e01b148061083e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600380546108539061326d565b80601f016020809104026020016040519081016040528092919081815260200182805461087f9061326d565b80156108cc5780601f106108a1576101008083540402835291602001916108cc565b820191906000526020600020905b8154815290600101906020018083116108af57829003601f168201915b5050505050905090565b600061083e826108e461076b565b60025461128d565b6000336108fa8185856112b6565b5060019392505050565b6040516305eff7ef60e21b815230600482015260009081906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c16906317bfdfbc906024016020604051808303816000875af115801561096f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109939190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c1690633af9e669906024016020604051808303816000875af11580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613226565b905080610a3383620f42406132a7565b610a3d91906132dc565b9250505090565b600033610a528582856113da565b610a5d85858561144e565b60019150505b9392505050565b333014610a7657600080fd5b6000610a81826115f2565b9050604051818152602081fd5b6000336108fa818585610aa18383610f1f565b610aab9190613255565b6112b6565b60006108086001611608565b6040516335f2974d60e01b81526004810182905260009030906335f2974d90602401600060405180830381600087803b158015610af857600080fd5b505af1925050508015610b09575060015b610bd7573d808015610b37576040519150601f19603f3d011682016040523d82523d6000602084013e610b3c565b606091505b508051602014610bc357604481511015610b905760405162461bcd60e51b815260206004820152601060248201526f2ab732bc3832b1ba32b21032b93937b960811b60448201526064015b60405180910390fd5b60048101905080806020019051810190610baa9190613314565b60405162461bcd60e51b8152600401610b87919061303b565b80806020019051810190610a639190613226565b919050565b610be4611790565b60005b81811015610d23576000838383818110610c0357610c036133b6565b9050602002810190610c1591906133cc565b610c239060208101906131a5565b6001600160a01b0316848484818110610c3e57610c3e6133b6565b9050602002810190610c5091906133cc565b60400135858585818110610c6657610c666133b6565b9050602002810190610c7891906133cc565b610c869060208101906133ec565b604051610c9492919061343a565b60006040518083038185875af1925050503d8060008114610cd1576040519150601f19603f3d011682016040523d82523d6000602084013e610cd6565b606091505b5050905080610d105760405162461bcd60e51b815260206004820152600660248201526519985a5b195960d21b6044820152606401610b87565b5080610d1b8161344a565b915050610be7565b505050565b6000610d346001611608565b50610a6383836117ea565b610d47611790565b610d5160006118ce565b565b60006108086102ca7f0000000000000000000000000000000000000000000000000000000000000012600a613547565b6060600480546108539061326d565b60003381610da08286610f1f565b905083811015610e005760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610b87565b610e0d82868684036112b6565b506001949350505050565b6000336108fa81858561144e565b6000336001600160a01b03831614610e4357610e438233866113da565b610e4c846115f2565b9050610e588285611920565b610e8c6001600160a01b037f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb168483611a52565b816001600160a01b0316836001600160a01b0316610ea73390565b6001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8488604051610eea929190918252602082015260400190565b60405180910390a4610efa610d53565b6006559392505050565b600061083e82610f1261076b565b600254611a82565b611a82565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610f52611790565b6001600160a01b038116610fb75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b87565b610fc0816118ce565b50565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110339190613226565b600003611050576110506001600160a01b03831682600019611054565b5050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c99190613226565b6110d39190613255565b6040516001600160a01b03851660248201526044810182905290915061113990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a9e565b50505050565b606061114e8484600085611b70565b949350505050565b6040516361bfb47160e11b815230600482015260009081908190819081906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c169063c37f68e290602401608060405180830381865afa1580156111c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e99190613556565b9350935093509350836000146112585760405162461bcd60e51b815260206004820152602e60248201527f4572726f72206f63637572656420647572696e67206665746368696e6720616360448201526d18dbdd5b9d081cdb985c1cda1bdd60921b6064820152608401610b87565b6000670de0b6b3a764000061126d83866132a7565b61127791906132dc565b9050611283838261358c565b9550505050505090565b600081158061129a575082155b6112ae576112a9848484611c4b565b61114e565b509192915050565b6001600160a01b0383166113185760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610b87565b6001600160a01b0382166113795760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610b87565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006113e68484610f1f565b9050600019811461113957818110156114415760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610b87565b61113984848484036112b6565b6001600160a01b0383166114b25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610b87565b6001600160a01b0382166115145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610b87565b6001600160a01b0383166000908152602081905260409020548181101561158c5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610b87565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611139565b60006115fe6000611608565b5061083e82611cfa565b6000807f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116969190613226565b90506116a0611dad565b60007f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172d9190613226565b905083156117445780156117445761174481612103565b61174e828261358c565b92507f8e55ccfc9778ff8eba1646d765cf1982537ce0f9257054a17b48aad7452501838360405161178191815260200190565b60405180910390a15050919050565b6005546001600160a01b03163314610d515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b87565b6000826000036117fc5750600061083e565b600061180661076b565b905061183d7f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6001600160a01b0316333087612636565b61184684612103565b600061185061076b565b905061186961185f838361358c565b83610f1a60025490565b9250611875848461266e565b60408051868152602081018590526001600160a01b0386169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a36118c3610d53565b600655505092915050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166119805760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610b87565b6001600160a01b038216600090815260208190526040902054818110156119f45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610b87565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b038316602482015260448101829052610d2390849063a9059cbb60e01b90606401611102565b6000811580611a8f575082155b6112ae576112a9848385611c4b565b6000611af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661113f9092919063ffffffff16565b805190915015610d235780806020019051810190611b1191906135a3565b610d235760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b87565b606082471015611bd15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b87565b600080866001600160a01b03168587604051611bed91906135c5565b60006040518083038185875af1925050503d8060008114611c2a576040519150601f19603f3d011682016040523d82523d6000602084013e611c2f565b606091505b5091509150611c408783838761272d565b979650505050505050565b6000808060001985870985870292508281108382030391505080600003611c8557838281611c7b57611c7b6132c6565b0492505050610a63565b808411611c9157600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000611d9882611d0960025490565b6040516370a0823160e01b81523060048201527f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6001600160a01b0316906370a0823190602401602060405180830381865afa158015611d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d919190613226565b9190611c4b565b9050611da3826127a6565b61083e9082613255565b604051630952c56360e01b8152600060048201523060248201527f0000000000000000000000008e00d5e02e65a19337cdba98bba9f84d4186a1806001600160a01b031690630952c56390604401600060405180830381600087803b158015611e1557600080fd5b505af1158015611e29573d6000803e3d6000fd5b5050604051630952c56360e01b8152600160048201523060248201527f0000000000000000000000008e00d5e02e65a19337cdba98bba9f84d4186a1806001600160a01b03169250630952c5639150604401600060405180830381600087803b158015611e9557600080fd5b505af1158015611ea9573d6000803e3d6000fd5b504792505081159050611f715760007f000000000000000000000000acc15dc74880c9944775448304b263d191c6077f6001600160a01b03164760405160006040518083038185875af1925050503d8060008114611f23576040519150601f19603f3d011682016040523d82523d6000602084013e611f28565b606091505b5050905080611f6f5760405162461bcd60e51b81526020600482015260136024820152722330b4b632b2103a37903bb930b81023a626a960691b6044820152606401610b87565b505b6120717f000000000000000000000000acc15dc74880c9944775448304b263d191c6077f7f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201527f000000000000000000000000acc15dc74880c9944775448304b263d191c6077f6001600160a01b0316906370a08231906024015b602060405180830381865afa15801561201b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203f9190613226565b6001600160a01b037f0000000000000000000000002e68d8d89dca32097f09d3b438561c9e9455da7c16929190612e21565b506110507f000000000000000000000000511ab53f793683763e5a8829738301368a2411e37f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201527f000000000000000000000000511ab53f793683763e5a8829738301368a2411e36001600160a01b0316906370a0823190602401611ffe565b60405163140e25ad60e31b8152600481018290526000907f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b03169063a0712d68906024016020604051808303816000875af115801561216d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121919190613226565b905080156121dd5760405162461bcd60e51b8152602060048201526019602482015278115c9c9bdc881bd8d8dd5c995908191d5c9a5b99c81b5a5b9d603a1b6044820152606401610b87565b6040516305eff7ef60e21b81523060048201526000907f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b0316906317bfdfbc906024016020604051808303816000875af1158015612246573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226a9190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c1690633af9e669906024016020604051808303816000875af11580156122d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fa9190613226565b905060005b620f424061232d7f0000000000000000000000000000000000000000000000000000000000086470846132a7565b61233791906132dc565b83108015612372575060ff7f0000000000000000000000000000000000000000000000000000000000000003168161236e8161344a565b9250105b1561262f57600083670de0b6b3a76400006123ad7f000000000000000000000000000000000000000000000000081e5666899a8000866132a7565b6123b791906132dc565b6123c1919061358c565b905060006123f27f0000000000000000000000000000000000000000000000000000000000086470620f424061358c565b6123ff86620f42406132a7565b612429867f00000000000000000000000000000000000000000000000000000000000864706132a7565b612433919061358c565b61243d91906132dc565b9050600061244b8383612fa5565b90508060000361245d5750505061262f565b60405163317afabb60e21b8152600481018290527f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b03169063c5ebeaec906024016020604051808303816000875af11580156124c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e89190613226565b965086156125385760405162461bcd60e51b815260206004820152601b60248201527f4572726f72206f63637572656420647572696e6720626f72726f7700000000006044820152606401610b87565b60405163140e25ad60e31b8152600481018290527f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b03169063a0712d68906024016020604051808303816000875af115801561259f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c39190613226565b9650861561260f5760405162461bcd60e51b8152602060048201526019602482015278115c9c9bdc881bd8d8dd5c995908191d5c9a5b99c81b5a5b9d603a1b6044820152606401610b87565b6126198187613255565b95506126258186613255565b94505050506122ff565b5050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526111399085906323b872dd60e01b90608401611102565b6001600160a01b0382166126c45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610b87565b80600260008282546126d69190613255565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6060831561279c578251600003612795576001600160a01b0385163b6127955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b87565b508161114e565b61114e8383612fbb565b6040516305eff7ef60e21b815230600482015260009081906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c16906317bfdfbc906024016020604051808303816000875af1158015612811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128359190613226565b604051633af9e66960e01b81523060048201529091506000906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c1690633af9e669906024016020604051808303816000875af11580156128a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128c59190613226565b905060006128d260025490565b856128dc60025490565b6128e6919061358c565b6128f090846132a7565b6128fa91906132dc565b9050600061290760025490565b8661291160025490565b61291b919061358c565b61292590866132a7565b61292f91906132dc565b905060005b60007f000000000000000000000000000000000000000000000000081e5666899a800061296987670de0b6b3a76400006132a7565b61297391906132dc565b61297d908661358c565b9050600061298b858761358c565b905060006129998383612fa5565b6040516370a0823160e01b815230600482015290915060009088906001600160a01b037f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c16906370a0823190602401602060405180830381865afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a299190613226565b612a3390846132a7565b612a3d91906132dc565b905080600003612a505750505050612e17565b60007f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015612ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612add9190613226565b60405163db006a7560e01b8152600481018490529091507f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b03169063db006a75906024016020604051808303816000875af1158015612b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6b9190613226565b95508515612bbb5760405162461bcd60e51b815260206004820152601b60248201527f4572726f72206f63637572656420647572696e672072656465656d00000000006044820152606401610b87565b807f000000000000000000000000322e86852e492a7ee17f28a78c663da38fb33bfb6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015612c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c479190613226565b612c51919061358c565b612c5b908c613255565b9a506000612c728c612c6d8a8e61358c565b612fa5565b90508015612d6e5760405163073a938160e11b8152600481018290527f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b031690630e752702906024016020604051808303816000875af1158015612ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d059190613226565b96508615612d555760405162461bcd60e51b815260206004820152601a60248201527f4572726f72206f63637572656420647572696e672072657061790000000000006044820152606401610b87565b612d5f818d61358c565b9b50612d6b818c61358c565b9a505b604051633af9e66960e01b81523060048201527f0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c6001600160a01b031690633af9e669906024016020604051808303816000875af1158015612dd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df89190613226565b9950888a11612e0c57505050505050612e17565b505050505050612934565b5050505050919050565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015612e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8c9190613226565b821115612ef15760405162461bcd60e51b815260206004820152602d60248201527f536166654173736574436f6e7665727465723a204e6f7420656e6f756768206660448201526c0756e647320666f72207377617609c1b6064820152608401610b87565b826001600160a01b0316846001600160a01b031603612f1157508061114e565b81600003612f215750600061114e565b604051630df791e560e41b81526001600160a01b03858116600483015284811660248301526044820184905286169063df791e50906064016020604051808303816000875af1158015612f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f9c9190613226565b95945050505050565b6000818310612fb45781610a63565b5090919050565b815115612fcb5781518083602001fd5b8060405162461bcd60e51b8152600401610b87919061303b565b600060208284031215612ff757600080fd5b81356001600160e01b031981168114610a6357600080fd5b60005b8381101561302a578181015183820152602001613012565b838111156111395750506000910152565b602081526000825180602084015261305a81604085016020870161300f565b601f01601f19169190910160400192915050565b60006020828403121561308057600080fd5b5035919050565b80356001600160a01b0381168114610bd757600080fd5b600080604083850312156130b157600080fd5b6130ba83613087565b946020939093013593505050565b6000806000606084860312156130dd57600080fd5b6130e684613087565b92506130f460208501613087565b9150604084013590509250925092565b6000806020838503121561311757600080fd5b823567ffffffffffffffff8082111561312f57600080fd5b818501915085601f83011261314357600080fd5b81358181111561315257600080fd5b8660208260051b850101111561316757600080fd5b60209290920196919550909350505050565b6000806040838503121561318c57600080fd5b8235915061319c60208401613087565b90509250929050565b6000602082840312156131b757600080fd5b610a6382613087565b6000806000606084860312156131d557600080fd5b833592506131e560208501613087565b91506131f360408501613087565b90509250925092565b6000806040838503121561320f57600080fd5b61321883613087565b915061319c60208401613087565b60006020828403121561323857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156132685761326861323f565b500190565b600181811c9082168061328157607f821691505b6020821081036132a157634e487b7160e01b600052602260045260246000fd5b50919050565b60008160001904831182151516156132c1576132c161323f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826132f957634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561332657600080fd5b815167ffffffffffffffff8082111561333e57600080fd5b818401915084601f83011261335257600080fd5b815181811115613364576133646132fe565b604051601f8201601f19908116603f0116810190838211818310171561338c5761338c6132fe565b816040528281528760208487010111156133a557600080fd5b611c4083602083016020880161300f565b634e487b7160e01b600052603260045260246000fd5b60008235605e198336030181126133e257600080fd5b9190910192915050565b6000808335601e1984360301811261340357600080fd5b83018035915067ffffffffffffffff82111561341e57600080fd5b60200191503681900382131561343357600080fd5b9250929050565b8183823760009101908152919050565b60006001820161345c5761345c61323f565b5060010190565b600181815b8085111561349e5781600019048211156134845761348461323f565b8085161561349157918102915b93841c9390800290613468565b509250929050565b6000826134b55750600161083e565b816134c25750600061083e565b81600181146134d857600281146134e2576134fe565b600191505061083e565b60ff8411156134f3576134f361323f565b50506001821b61083e565b5060208310610133831016604e8410600b8410161715613521575081810a61083e565b61352b8383613463565b806000190482111561353f5761353f61323f565b029392505050565b6000610a6360ff8416836134a6565b6000806000806080858703121561356c57600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008282101561359e5761359e61323f565b500390565b6000602082840312156135b557600080fd5b81518015158114610a6357600080fd5b600082516133e281846020870161300f56fea2646970667358221220352c89dc4c1f1281d0eeb80686f27cd2c70448803d3b8d458a75f0aa8d59b51664736f6c634300080f0033

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

0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000086470000000000000000000000000acc15dc74880c9944775448304b263d191c6077f000000000000000000000000511ab53f793683763e5a8829738301368a2411e30000000000000000000000002e68d8d89dca32097f09d3b438561c9e9455da7c000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000016417079666c6f77204d6f6f6e77656c6c205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000084150464c574d574c000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _mToken (address): 0x1C55649f73CDA2f72CEf3DD6C5CA3d49EFcF484C
Arg [1] : _iterations (uint8): 3
Arg [2] : _desiredLtv (uint256): 550000
Arg [3] : _wGlmr (address): 0xAcc15dC74880C9944775448304B263D191c6077F
Arg [4] : _well (address): 0x511aB53F793683763E5a8829738301368a2411E3
Arg [5] : _assetConverter (address): 0x2E68d8D89DcA32097f09d3b438561c9E9455Da7c
Arg [6] : name (string): Apyflow Moonwell Vault
Arg [7] : symbol (string): APFLWMWL

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 0000000000000000000000001c55649f73cda2f72cef3dd6c5ca3d49efcf484c
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [2] : 0000000000000000000000000000000000000000000000000000000000086470
Arg [3] : 000000000000000000000000acc15dc74880c9944775448304b263d191c6077f
Arg [4] : 000000000000000000000000511ab53f793683763e5a8829738301368a2411e3
Arg [5] : 0000000000000000000000002e68d8d89dca32097f09d3b438561c9e9455da7c
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [9] : 417079666c6f77204d6f6f6e77656c6c205661756c7400000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [11] : 4150464c574d574c000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks collator

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.