ETH Price: $3,480.34 (+2.10%)

Contract

0xFb06bCb508c06Cc2ff1C53F8E864ca27eEb708eA
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 100 runs

Other Settings:
cancun EvmVersion
File 1 of 35 : Vault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol";
import "../../interfaces/IRedeemOperator.sol";
import "../../interfaces/IStrategy.sol";
import "../../interfaces/IVault.sol";
import "../../interfaces/renzo/IRestakeManager.sol";
import "../libraries/StorageSlot.sol";
import "../libraries/Errors.sol";
import "../common/Constants.sol";
import "./StrategyFactory.sol";

/**
 * @title Vault contract
 * @author Naturelab
 * @dev This contract is the logical implementation of the vault,
 * and its main purpose is to provide users with a gateway for depositing
 * and withdrawing funds and to manage user shares.
 */
contract Vault is
    Constants,
    IVault,
    StrategyFactory,
    ERC4626Upgradeable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable
{
    using SafeERC20 for IERC20;
    using StorageSlot for *;

    // The version of the contract
    string public constant VERSION = "1.0";

    // Use EIP-1153 to temporarily store prices for calculation.
    bytes32 internal constant EXCHANGE_PRICE_CACHE = keccak256("EXCHANGE_PRICE_CACHE");

    // Define a constant variable representing the fee denominator, 10000 (used for percentage calculations)
    uint256 internal constant FEE_DENOMINATOR = 1e4;

    // The minimum market capacity is 100 units (scaled by 1e18)
    uint256 internal constant MIN_MARKET_CAPACITY = 100e18;

    // Up to 0.04% can be charged as a management fee in each cycle (4 / 10000)
    uint256 internal constant MAX_MANAGEMENT_FEE_RATE = 4;

    // The shortest cycle for charging the management fee is 7 days
    uint256 internal constant MIN_MANAGEMENT_FEE_CLAIM_PERIOD = 7 days;

    // The maximum interval for price updates. If prices are not updated for a long time,
    // deposits will be temporarily unavailable.
    uint256 internal constant MAX_PRICE_UPDATED_PERIOD = 3 days;

    // The maximum fee for withdrawing from the idle treasury is 1.2% (120 / 10000)
    uint256 internal constant MAX_EXIT_FEE_RATE = 120;

    // The maximum revenue fee rate is 15% (1500 / 10000)
    uint256 internal constant MAX_REVENUE_FEE_RATE = 1500;

    // Initial exchange price set to 1e18 (used as a scaling factor)
    uint256 internal constant INIT_EXCHANGE_PRICE = 1e18;

    address internal constant RENZO_RESTAKE_MANAGER = 0x74a09653A083691711cF8215a6ab074BB4e99ef5;

    // Vault parameters, encapsulating the configuration of the vault
    VaultParams internal vaultParams;

    // Vault state, encapsulating the state of the vault
    VaultState internal vaultState;

    /**
     * @dev  Ensure that this method is only called by authorized portfolio managers.
     */
    modifier onlyRebalancer() {
        if (msg.sender != vaultParams.rebalancer) revert Errors.CallerNotRebalancer();
        _;
    }

    /**
     * @dev Initialize various parameters of the Vault contract.
     * @param _initBytes The encoded initialization parameters.
     */
    function initialize(bytes calldata _initBytes) external initializer {
        VaultParams memory params_ = abi.decode(_initBytes, (IVault.VaultParams));

        __Pausable_init();
        __ReentrancyGuard_init();
        __ERC20_init(params_.name, params_.symbol);

        if (params_.underlyingToken == address(0)) revert Errors.InvalidUnderlyingToken();
        if (params_.rebalancer == address(0)) revert Errors.InvalidRebalancer();
        if (params_.admin == address(0)) revert Errors.InvalidAdmin();
        if (params_.feeReceiver == address(0)) revert Errors.InvalidFeeReceiver();
        if (params_.marketCapacity < MIN_MARKET_CAPACITY) revert Errors.MarketCapacityTooLow();
        if (params_.managementFeeRate > MAX_MANAGEMENT_FEE_RATE) revert Errors.ManagementFeeRateTooHigh();
        if (params_.managementFeeClaimPeriod < MIN_MANAGEMENT_FEE_CLAIM_PERIOD) {
            revert Errors.ManagementFeeClaimPeriodTooShort();
        }
        if (params_.maxPriceUpdatePeriod > MAX_PRICE_UPDATED_PERIOD) revert Errors.PriceUpdatePeriodTooLong();
        if (params_.revenueRate > MAX_REVENUE_FEE_RATE) revert Errors.RevenueFeeRateTooHigh();
        if (params_.exitFeeRate > MAX_EXIT_FEE_RATE) revert Errors.ExitFeeRateTooHigh();
        __Ownable_init(params_.admin);
        __ERC4626_init(IERC20(params_.underlyingToken));
        vaultState.lastClaimMngFeeTime = block.timestamp;
        vaultState.lastUpdatePriceTime = block.timestamp;
        vaultState.exchangePrice = INIT_EXCHANGE_PRICE;
        vaultParams = params_;
    }

    /**
     * @dev Returns the vault parameters.
     * @return A struct containing the vault parameters.
     */
    function getVaultParams() public view returns (VaultParams memory) {
        return vaultParams;
    }

    /**
     * @dev Returns the vault state.
     * @return A struct containing the vault state.
     */
    function getVaultState() public view returns (VaultState memory) {
        return vaultState;
    }

    /**
     * @dev Update the size of the pool's capacity.
     * @param _newCapacityLimit The new size of the capacity.
     */
    function updateMarketCapacity(uint256 _newCapacityLimit) external onlyOwner {
        if (_newCapacityLimit <= vaultParams.marketCapacity) revert Errors.UnSupportedOperation();
        emit UpdateMarketCapacity(vaultParams.marketCapacity, _newCapacityLimit);
        vaultParams.marketCapacity = _newCapacityLimit;
    }

    /**
     * @dev Update the management fee rate.
     * @param _newManagementFeeRate The new rate.
     */
    function updateManagementFee(uint256 _newManagementFeeRate) external onlyOwner {
        if (_newManagementFeeRate > MAX_MANAGEMENT_FEE_RATE) revert Errors.ManagementFeeRateTooHigh();
        emit UpdateManagementFee(vaultParams.managementFeeRate, _newManagementFeeRate);
        vaultParams.managementFeeRate = _newManagementFeeRate;
    }

    /**
     * @dev Update the collection cycle of management fees.
     * @param _newmanagementFeeClaimPeriod The new management fee claim period.
     */
    function updateManagementFeeClaimPeriod(uint256 _newmanagementFeeClaimPeriod) external onlyOwner {
        if (_newmanagementFeeClaimPeriod < MIN_MANAGEMENT_FEE_CLAIM_PERIOD) {
            revert Errors.ManagementFeeClaimPeriodTooShort();
        }
        emit UpdateManagementFeeClaimPeriod(vaultParams.managementFeeClaimPeriod, _newmanagementFeeClaimPeriod);
        vaultParams.managementFeeClaimPeriod = _newmanagementFeeClaimPeriod;
    }

    /**
     * @dev Update the maximum allowed price update period.
     * @param _newMaxPriceUpdatePeriod The new period.
     */
    function updateMaxPriceUpdatePeriod(uint256 _newMaxPriceUpdatePeriod) external onlyOwner {
        if (_newMaxPriceUpdatePeriod > MAX_PRICE_UPDATED_PERIOD) revert Errors.PriceUpdatePeriodTooLong();
        emit UpdateMaxPriceUpdatePeriod(vaultParams.maxPriceUpdatePeriod, _newMaxPriceUpdatePeriod);
        vaultParams.maxPriceUpdatePeriod = _newMaxPriceUpdatePeriod;
    }

    /**
     * @dev Update the revenue fee rate.
     * @param _newRevenueRate The new rate.
     */
    function updateRevenueRate(uint256 _newRevenueRate) external onlyOwner {
        if (_newRevenueRate > MAX_REVENUE_FEE_RATE) revert Errors.RevenueFeeRateTooHigh();
        emit UpdateRevenueRate(vaultParams.revenueRate, _newRevenueRate);
        vaultParams.revenueRate = _newRevenueRate;
    }

    /**
     * @dev Update the exit fee rate.
     * @param _newExitFeeRate The new rate.
     */
    function updateExitFeeRate(uint256 _newExitFeeRate) external onlyOwner {
        if (_newExitFeeRate > MAX_EXIT_FEE_RATE) revert Errors.ExitFeeRateTooHigh();
        emit UpdateExitFeeRate(vaultParams.exitFeeRate, _newExitFeeRate);
        vaultParams.exitFeeRate = _newExitFeeRate;
    }

    /**
     * @dev Add a new address to the position adjustment whitelist.
     * @param _newRebalancer The new address to be added.
     */
    function updateRebalancer(address _newRebalancer) external onlyOwner {
        if (_newRebalancer == address(0)) revert Errors.InvalidRebalancer();
        emit UpdateRebalancer(vaultParams.rebalancer, _newRebalancer);
        vaultParams.rebalancer = _newRebalancer;
    }

    /**
     * @dev Update the address of the recipient for management fees.
     * @param _newFeeReceiver The new address of the recipient for management fees.
     */
    function updateFeeReceiver(address _newFeeReceiver) external onlyOwner {
        if (_newFeeReceiver == address(0)) revert Errors.InvalidFeeReceiver();
        emit UpdateFeeReceiver(vaultParams.feeReceiver, _newFeeReceiver);
        vaultParams.feeReceiver = _newFeeReceiver;
    }

    /**
     * @dev Update the temporary address of shares when users redeem.
     * @param _newRedeemOperator The new redeem operator address.
     */
    function updateRedeemOperator(address _newRedeemOperator) external onlyOwner {
        if (_newRedeemOperator == address(0)) revert Errors.InvalidRedeemOperator();
        emit UpdateRedeemOperator(vaultParams.redeemOperator, _newRedeemOperator);
        vaultParams.redeemOperator = _newRedeemOperator;
    }

    /*
     * @return newExchangePrice The new exercise price
     * @return newRevenue The new realized profit.
     */
    function updateExchangePrice() external onlyRebalancer returns (uint256 newExchangePrice, uint256 newRevenue) {
        EXCHANGE_PRICE_CACHE.asUint256().tstore(vaultState.exchangePrice);
        vaultState.lastUpdatePriceTime = block.timestamp;
        uint256 totalSupply_ = totalSupply();
        if (totalSupply_ == 0) {
            return (vaultState.exchangePrice, vaultState.revenue);
        }
        uint256 currentNetAssets_ = underlyingTvl();
        newExchangePrice = currentNetAssets_ * PRECISION / totalSupply_;
        if (newExchangePrice > vaultState.revenueExchangePrice) {
            if (vaultState.revenueExchangePrice == 0) {
                vaultState.revenueExchangePrice = newExchangePrice;
                vaultState.exchangePrice = newExchangePrice;
                return (vaultState.exchangePrice, vaultState.revenue);
            }
            uint256 newProfit_ = currentNetAssets_ - ((vaultState.revenueExchangePrice * totalSupply_) / PRECISION);
            newRevenue = (newProfit_ * vaultParams.revenueRate) / FEE_DENOMINATOR;
            vaultState.revenue += newRevenue;
            vaultState.exchangePrice = ((currentNetAssets_ - newRevenue) * PRECISION) / totalSupply_;
            vaultState.revenueExchangePrice = vaultState.exchangePrice;

            emit UpdateExchangePrice(vaultState.exchangePrice, newRevenue);
        } else {
            vaultState.exchangePrice = newExchangePrice;

            emit UpdateExchangePrice(newExchangePrice, 0);
        }
    }

    /**
     * @dev Transfer tokens to a strategy.
     * @param _token The address of the token to transfer.
     * @param _amount The amount of tokens to transfer.
     * @param _strategyIndex The index of the strategy to transfer to.
     */
    function transferToStrategy(address _token, uint256 _amount, uint256 _strategyIndex) external onlyOwner {
        address strategyAddress_ = strategyAddress(_strategyIndex);
        uint256 positionLimit_ = positionLimit[strategyAddress_];
        uint256 nowAssets_ = IStrategy(strategyAddress_).getNetAssets();
        if ((nowAssets_ + _amount) > (totalAssets() * positionLimit_ / 1e4)) revert Errors.InvalidLimit();
        IERC20(_token).safeIncreaseAllowance(strategyAddress_, _amount);
        if (!IStrategy(strategyAddress_).onTransferIn(_token, _amount)) revert Errors.IncorrectState();

        emit TransferToStrategy(_token, _amount, _strategyIndex);
    }

    /**
     * @dev Retrieve the amount of the exit fee.
     * @param _assetAmount The amount of asset to be withdrawn.
     * @return withdrawFee_ The exit fee to be deducted.
     */
    function getWithdrawFee(uint256 _assetAmount) public view returns (uint256 withdrawFee_) {
        withdrawFee_ = _assetAmount * vaultParams.exitFeeRate / FEE_DENOMINATOR;
    }

    /**
     * @dev Retrieve the total value locked (TVL) in underlying assets.
     * @return The total value locked in underlying assets.
     */
    function underlyingTvl() public returns (uint256) {
        uint256 rsethBal_ = IERC20(EZETH).balanceOf(address(this));
        uint256 totalStrategy_ = totalStrategiesAssets();
        return totalStrategy_ + rsethBal_ - vaultState.revenue;
    }

    /**
     * @dev Retrieve the amount of assets in the strategy pool.
     * @return The total assets in the strategy pool.
     */
    function totalAssets() public view override returns (uint256) {
        if (block.timestamp - vaultState.lastUpdatePriceTime > vaultParams.maxPriceUpdatePeriod) {
            revert Errors.PriceNotUpdated();
        }
        return vaultState.exchangePrice * totalSupply() / PRECISION;
    }

    /**
     * @return Actual LP price during the user's deposit phase.
     */
    function exchangePrice() public view override returns (uint256) {
        return vaultState.exchangePrice;
    }

    /**
     * @dev When the actual LP price exceeds this price, performance fee settlement can be conducted.
     * @return LP price for settling performance fees.
     */
    function revenueExchangePrice() public view override returns (uint256) {
        return vaultState.revenueExchangePrice;
    }

    /**
     * @return Currently accumulated performance fees.
     */
    function revenue() public view override returns (uint256) {
        return vaultState.revenue;
    }

    /**
     * @return The remaining time. If it is 0, deposits and withdrawals are currently not allowed.
     * @dev If it is not 0, the admin needs to update the price within this period.
     */
    function remainingUpdateTime() public view returns (uint256) {
        uint256 timeDiff_ = block.timestamp - vaultState.lastUpdatePriceTime;
        return vaultParams.maxPriceUpdatePeriod > timeDiff_ ? (vaultParams.maxPriceUpdatePeriod - timeDiff_) : 0;
    }

    /**
     * @dev Retrieve the maximum amount that can be deposited by an address.
     * @return maxAssets_ The maximum deposit amount.
     */
    function maxDeposit(address) public view override returns (uint256 maxAssets_) {
        maxAssets_ = vaultParams.marketCapacity - totalAssets();
    }

    /**
     * @return The actual LP price before the last update.
     * @dev If it is lower than current price, there might be a withdrawal rebalancing loss,
     * which the user needs to bear. This usually does not happen.
     */
    function lastExchangePrice() public view override returns (uint256) {
        return EXCHANGE_PRICE_CACHE.asUint256().tload();
    }

    /**
     * @dev Optional deposit function allowing deposits in different token types.
     * @param _token The address of the token to deposit.
     * @param _assets The amount of assets to deposit.
     * @param _receiver The address of the receiver of the shares.
     * @param _referral  Address of the referrer.
     * @return shares_ The amount of shares issued.
     */
    function optionalDeposit(address _token, uint256 _assets, address _receiver, address _referral)
        public
        payable
        nonReentrant
        whenNotPaused
        returns (uint256 shares_)
    {
        if (_token == EZETH) {
            shares_ = optionalDepositDeal(_assets, _receiver);
            IERC20(_token).safeTransferFrom(msg.sender, address(this), _assets);
        } else if (_token == STETH) {
            IERC20(STETH).safeTransferFrom(msg.sender, address(this), _assets);
            uint256 ezEthBefore_ = IERC20(EZETH).balanceOf(address(this));
            IERC20(STETH).safeIncreaseAllowance(RENZO_RESTAKE_MANAGER, _assets);
            IRestakeManager(RENZO_RESTAKE_MANAGER).deposit(STETH, _assets);
            uint256 ezETHGet_ = IERC20(EZETH).balanceOf(address(this)) - ezEthBefore_;
            shares_ = optionalDepositDeal(ezETHGet_, _receiver);
        } else if (_token == ETH) {
            uint256 ezEthBefore_ = IERC20(EZETH).balanceOf(address(this));
            IRestakeManager(RENZO_RESTAKE_MANAGER).depositETH{value: msg.value}();
            uint256 ezETHGet_ = IERC20(EZETH).balanceOf(address(this)) - ezEthBefore_;
            shares_ = optionalDepositDeal(ezETHGet_, _receiver);
        } else {
            revert Errors.UnsupportedToken();
        }
        _mint(_receiver, shares_);

        emit OptionalDeposit(msg.sender, _token, _assets, _receiver, _referral);
    }

    /**
     * @dev Internal function to calculate the shares issued for a deposit.
     * @param _assets The amount of assets to deposit.
     * @param _receiver The address of the receiver of the shares.
     * @return shares_ The amount of shares issued.
     */
    function optionalDepositDeal(uint256 _assets, address _receiver) internal returns (uint256 shares_) {
        uint256 maxAssets = maxDeposit(_receiver);
        if (_assets > maxAssets) {
            revert ERC4626ExceededMaxDeposit(_receiver, _assets, maxAssets);
        }
        shares_ = previewDeposit(_assets);

        emit Deposit(msg.sender, _receiver, _assets, shares_);
    }

    /**
     * @dev Redemption operation executed by the redeemOperator. Currently, only EZETH redemptions are supported.
     * @param _token The address of the token to deposit.
     * @param _shares The amount of share tokens to be redeemed.
     * @param _cutPercentage The percentage of the rebalancing loss incurred.
     * @param _receiver The address of the receiver of the assets.
     * @param _owner The owner address of the shares.
     * @return assetsAfterFee_ The amount of assets obtained.
     */
    function optionalRedeem(address _token, uint256 _shares, uint256 _cutPercentage, address _receiver, address _owner)
        public
        override
        nonReentrant
        whenNotPaused
        returns (uint256 assetsAfterFee_)
    {
        if (msg.sender != vaultParams.redeemOperator) revert Errors.UnSupportedOperation();
        if (vaultState.lastUpdatePriceTime != block.timestamp) revert Errors.PriceNotUpdated();

        if (_shares == type(uint256).max) {
            _shares = maxRedeem(_owner);
        } else {
            require(_shares <= maxRedeem(_owner), "ERC4626: redeem more than max");
        }

        if (msg.sender != _owner) {
            _spendAllowance(_owner, msg.sender, _shares);
        }

        uint256 assets_ = previewRedeem(_shares * (PRECISION - _cutPercentage) / PRECISION);
        _burn(_owner, _shares);
        assetsAfterFee_ = assets_ - getWithdrawFee(assets_);
        if (_token == EZETH) {
            IERC20(EZETH).safeTransfer(_receiver, assetsAfterFee_);
        } else {
            revert Errors.UnsupportedToken();
        }

        emit OptionalRedeem(_token, _shares, _receiver, _owner);
    }

    /**
     * @dev The deposit method of ERC4626, with the parameter being the amount of assets.
     * @param _assets The amount of asset being deposited.
     * @param _receiver The recipient of the share tokens.
     * @return shares_ The amount of share tokens obtained.
     */
    function deposit(uint256 _assets, address _receiver)
        public
        override
        nonReentrant
        whenNotPaused
        returns (uint256 shares_)
    {
        if (_assets == type(uint256).max) {
            _assets = IERC20(asset()).balanceOf(msg.sender);
        }
        shares_ = super.deposit(_assets, _receiver);
    }

    /**
     * @dev The deposit method of ERC4626, with the parameter being the amount of share tokens.
     * @param _shares The amount of share tokens to be minted.
     * @param _receiver The recipient of the share tokens.
     * @return assets_ The amount of assets consumed.
     */
    function mint(uint256 _shares, address _receiver)
        public
        override
        nonReentrant
        whenNotPaused
        returns (uint256 assets_)
    {
        assets_ = super.mint(_shares, _receiver);
    }

    function withdraw(uint256, address, address) public override returns (uint256) {
        // Only delayed withdrawals are supported
        revert Errors.NotSupportedYet();
    }

    function redeem(uint256, address, address) public override returns (uint256) {
        // Only delayed withdrawals are supported
        revert Errors.NotSupportedYet();
    }

    /**
     * @dev When a user applies for redemption, his share will be
     * transferred to the RedeemOperator address.
     * @param _shares The amount of share tokens to be redeemed.
     */
    function requestRedeem(uint256 _shares) external nonReentrant whenNotPaused {
        if (_shares == 0) revert Errors.WithdrawZero();
        _transfer(msg.sender, vaultParams.redeemOperator, _shares);
        IRedeemOperator(vaultParams.redeemOperator).registerWithdrawal(msg.sender, _shares);

        emit RequestRedeem(msg.sender, _shares, asset());
    }

    /**
     * @dev Used when some users migrating from other vaults.
     * @param _users The amount of share tokens to be redeemed.
     * @param _assets The address of the token to redeem.
     */
    function migrateMint(address[] calldata _users, uint256[] calldata _assets) external onlyOwner {
        if (_users.length != _assets.length) revert Errors.InvalidLength();
        uint256 shares_;
        for (uint256 i = 0; i < _users.length; ++i) {
            shares_ = previewDeposit(_assets[i]);
            _mint(_users[i], shares_);
        }

        emit MigrateMint(_users, _assets);
    }

    /**
     * @dev Collect management fee.
     */
    function collectManagementFee() external {
        if (msg.sender != vaultParams.feeReceiver) revert Errors.InvalidFeeReceiver();
        uint256 nowTime_ = block.timestamp;
        if (nowTime_ - vaultState.lastClaimMngFeeTime < vaultParams.managementFeeClaimPeriod) {
            revert Errors.InvalidClaimTime();
        }
        vaultState.lastClaimMngFeeTime = nowTime_;
        uint256 assets_ = totalAssets() * vaultParams.managementFeeRate / FEE_DENOMINATOR;
        IERC20(asset()).safeTransfer(vaultParams.feeReceiver, assets_);

        emit CollectManagementFee(assets_);
    }

    /**
     * @dev Collect performance fees to the recipient address.
     */
    function collectRevenue() external {
        if (msg.sender != vaultParams.feeReceiver) revert Errors.InvalidFeeReceiver();
        IERC20(asset()).safeTransfer(vaultParams.feeReceiver, vaultState.revenue);
        emit CollectRevenue(vaultState.revenue);
        vaultState.revenue = 0;
    }

    /**
     * @dev Handle when someone else accidentally transfers assets to this contract.
     * @param _token The address of the token to transfer out.
     */
    function sweep(address _token) external onlyOwner {
        if (_token == asset()) revert Errors.UnsupportedToken();
        uint256 amount_ = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransfer(msg.sender, amount_);
        uint256 ethBalance_ = address(this).balance;
        if (ethBalance_ > 0) {
            Address.sendValue(payable(msg.sender), ethBalance_);
        }

        emit Sweep(_token);
    }

    function pause() external {
        if (msg.sender != owner() && msg.sender != vaultParams.rebalancer) revert Errors.UnSupportedOperation();
        _pause();
    }

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

    receive() external payable {}
}

File 2 of 35 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

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

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

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

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

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

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

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

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

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

File 3 of 35 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

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

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 4 of 35 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.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}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {
    /// @custom:storage-location erc7201:openzeppelin.storage.ERC20
    struct ERC20Storage {
        mapping(address account => uint256) _balances;

        mapping(address account => mapping(address spender => uint256)) _allowances;

        uint256 _totalSupply;

        string _name;
        string _symbol;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;

    function _getERC20Storage() private pure returns (ERC20Storage storage $) {
        assembly {
            $.slot := ERC20StorageLocation
        }
    }

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

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC20Storage storage $ = _getERC20Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

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

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

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

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._totalSupply;
    }

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` 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 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        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 `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` 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.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            $._totalSupply += value;
        } else {
            uint256 fromBalance = $._balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                $._balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                $._totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                $._balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` 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.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        $._allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

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

File 5 of 35 : ERC4626Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC4626.sol)

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ERC20Upgradeable} from "../ERC20Upgradeable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].
 *
 * This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for
 * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
 * the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this
 * contract and not the "assets" token which is an independent contract.
 *
 * [CAUTION]
 * ====
 * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning
 * with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation
 * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial
 * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may
 * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by
 * verifying the amount received is as expected, using a wrapper that performs these checks such as
 * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].
 *
 * Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()`
 * corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault
 * decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself
 * determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset
 * (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's
 * donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more
 * expensive than it is profitable. More details about the underlying math can be found
 * xref:erc4626.adoc#inflation-attack[here].
 *
 * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued
 * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets
 * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience
 * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the
 * `_convertToShares` and `_convertToAssets` functions.
 *
 * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide].
 * ====
 */
abstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626 {
    using Math for uint256;

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC4626
    struct ERC4626Storage {
        IERC20 _asset;
        uint8 _underlyingDecimals;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC4626")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC4626StorageLocation = 0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00;

    function _getERC4626Storage() private pure returns (ERC4626Storage storage $) {
        assembly {
            $.slot := ERC4626StorageLocation
        }
    }

    /**
     * @dev Attempted to deposit more assets than the max amount for `receiver`.
     */
    error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);

    /**
     * @dev Attempted to mint more shares than the max amount for `receiver`.
     */
    error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max);

    /**
     * @dev Attempted to withdraw more assets than the max amount for `receiver`.
     */
    error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);

    /**
     * @dev Attempted to redeem more shares than the max amount for `receiver`.
     */
    error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max);

    /**
     * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).
     */
    function __ERC4626_init(IERC20 asset_) internal onlyInitializing {
        __ERC4626_init_unchained(asset_);
    }

    function __ERC4626_init_unchained(IERC20 asset_) internal onlyInitializing {
        ERC4626Storage storage $ = _getERC4626Storage();
        (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);
        $._underlyingDecimals = success ? assetDecimals : 18;
        $._asset = asset_;
    }

    /**
     * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.
     */
    function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool, uint8) {
        (bool success, bytes memory encodedDecimals) = address(asset_).staticcall(
            abi.encodeCall(IERC20Metadata.decimals, ())
        );
        if (success && encodedDecimals.length >= 32) {
            uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));
            if (returnedDecimals <= type(uint8).max) {
                return (true, uint8(returnedDecimals));
            }
        }
        return (false, 0);
    }

    /**
     * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This
     * "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the
     * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals.
     *
     * See {IERC20Metadata-decimals}.
     */
    function decimals() public view virtual override(IERC20Metadata, ERC20Upgradeable) returns (uint8) {
        ERC4626Storage storage $ = _getERC4626Storage();
        return $._underlyingDecimals + _decimalsOffset();
    }

    /** @dev See {IERC4626-asset}. */
    function asset() public view virtual returns (address) {
        ERC4626Storage storage $ = _getERC4626Storage();
        return address($._asset);
    }

    /** @dev See {IERC4626-totalAssets}. */
    function totalAssets() public view virtual returns (uint256) {
        ERC4626Storage storage $ = _getERC4626Storage();
        return $._asset.balanceOf(address(this));
    }

    /** @dev See {IERC4626-convertToShares}. */
    function convertToShares(uint256 assets) public view virtual returns (uint256) {
        return _convertToShares(assets, Math.Rounding.Floor);
    }

    /** @dev See {IERC4626-convertToAssets}. */
    function convertToAssets(uint256 shares) public view virtual returns (uint256) {
        return _convertToAssets(shares, Math.Rounding.Floor);
    }

    /** @dev See {IERC4626-maxDeposit}. */
    function maxDeposit(address) public view virtual returns (uint256) {
        return type(uint256).max;
    }

    /** @dev See {IERC4626-maxMint}. */
    function maxMint(address) public view virtual returns (uint256) {
        return type(uint256).max;
    }

    /** @dev See {IERC4626-maxWithdraw}. */
    function maxWithdraw(address owner) public view virtual returns (uint256) {
        return _convertToAssets(balanceOf(owner), Math.Rounding.Floor);
    }

    /** @dev See {IERC4626-maxRedeem}. */
    function maxRedeem(address owner) public view virtual returns (uint256) {
        return balanceOf(owner);
    }

    /** @dev See {IERC4626-previewDeposit}. */
    function previewDeposit(uint256 assets) public view virtual returns (uint256) {
        return _convertToShares(assets, Math.Rounding.Floor);
    }

    /** @dev See {IERC4626-previewMint}. */
    function previewMint(uint256 shares) public view virtual returns (uint256) {
        return _convertToAssets(shares, Math.Rounding.Ceil);
    }

    /** @dev See {IERC4626-previewWithdraw}. */
    function previewWithdraw(uint256 assets) public view virtual returns (uint256) {
        return _convertToShares(assets, Math.Rounding.Ceil);
    }

    /** @dev See {IERC4626-previewRedeem}. */
    function previewRedeem(uint256 shares) public view virtual returns (uint256) {
        return _convertToAssets(shares, Math.Rounding.Floor);
    }

    /** @dev See {IERC4626-deposit}. */
    function deposit(uint256 assets, address receiver) public virtual returns (uint256) {
        uint256 maxAssets = maxDeposit(receiver);
        if (assets > maxAssets) {
            revert ERC4626ExceededMaxDeposit(receiver, assets, maxAssets);
        }

        uint256 shares = previewDeposit(assets);
        _deposit(_msgSender(), receiver, assets, shares);

        return shares;
    }

    /** @dev See {IERC4626-mint}.
     *
     * As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero.
     * In this case, the shares will be minted without requiring any assets to be deposited.
     */
    function mint(uint256 shares, address receiver) public virtual returns (uint256) {
        uint256 maxShares = maxMint(receiver);
        if (shares > maxShares) {
            revert ERC4626ExceededMaxMint(receiver, shares, maxShares);
        }

        uint256 assets = previewMint(shares);
        _deposit(_msgSender(), receiver, assets, shares);

        return assets;
    }

    /** @dev See {IERC4626-withdraw}. */
    function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256) {
        uint256 maxAssets = maxWithdraw(owner);
        if (assets > maxAssets) {
            revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets);
        }

        uint256 shares = previewWithdraw(assets);
        _withdraw(_msgSender(), receiver, owner, assets, shares);

        return shares;
    }

    /** @dev See {IERC4626-redeem}. */
    function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256) {
        uint256 maxShares = maxRedeem(owner);
        if (shares > maxShares) {
            revert ERC4626ExceededMaxRedeem(owner, shares, maxShares);
        }

        uint256 assets = previewRedeem(shares);
        _withdraw(_msgSender(), receiver, owner, assets, shares);

        return assets;
    }

    /**
     * @dev Internal conversion function (from assets to shares) with support for rounding direction.
     */
    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) {
        return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding);
    }

    /**
     * @dev Internal conversion function (from shares to assets) with support for rounding direction.
     */
    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) {
        return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding);
    }

    /**
     * @dev Deposit/mint common workflow.
     */
    function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual {
        ERC4626Storage storage $ = _getERC4626Storage();
        // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
        // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
        // calls the vault, which is assumed not malicious.
        //
        // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
        // assets are transferred and before the shares are minted, which is a valid state.
        // slither-disable-next-line reentrancy-no-eth
        SafeERC20.safeTransferFrom($._asset, caller, address(this), assets);
        _mint(receiver, shares);

        emit Deposit(caller, receiver, assets, shares);
    }

    /**
     * @dev Withdraw/redeem common workflow.
     */
    function _withdraw(
        address caller,
        address receiver,
        address owner,
        uint256 assets,
        uint256 shares
    ) internal virtual {
        ERC4626Storage storage $ = _getERC4626Storage();
        if (caller != owner) {
            _spendAllowance(owner, caller, shares);
        }

        // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
        // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
        // calls the vault, which is assumed not malicious.
        //
        // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
        // shares are burned and after the assets are transferred, which is a valid state.
        _burn(owner, shares);
        SafeERC20.safeTransfer($._asset, receiver, assets);

        emit Withdraw(caller, receiver, owner, assets, shares);
    }

    function _decimalsOffset() internal view virtual returns (uint8) {
        return 0;
    }
}

File 6 of 35 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

File 7 of 35 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

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

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

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

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

File 8 of 35 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

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

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

    function _nonReentrantAfter() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        return $._status == ENTERED;
    }
}

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 35 : IERC1967.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

File 12 of 35 : IERC4626.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";

/**
 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 */
interface IERC4626 is IERC20, 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 Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
     * through a deposit call.
     *
     * - MUST return a limited value if receiver is subject to some deposit limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
     * - MUST NOT revert.
     */
    function maxDeposit(address receiver) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
     *   in the same transaction.
     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewDeposit(uint256 assets) external view returns (uint256 shares);

    /**
     * @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 Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
     * - MUST return a limited value if receiver is subject to some mint limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
     * - MUST NOT revert.
     */
    function maxMint(address receiver) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
     *   same transaction.
     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
     *   would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by minting.
     */
    function previewMint(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Mints exactly shares Vault shares to receiver by depositing 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 mint
     *   execution, and are accounted for during mint.
     * - MUST revert if all of shares cannot be minted (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 mint(uint256 shares, address receiver) external returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
     * Vault, through a withdraw call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxWithdraw(address owner) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
     *   called
     *   in the same transaction.
     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewWithdraw(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Burns shares from owner and sends exactly 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
     *   withdraw execution, and are accounted for during withdraw.
     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
     * through a redeem call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxRedeem(address owner) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
     *   same transaction.
     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
     *   redemption would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
     */
    function previewRedeem(uint256 shares) external view returns (uint256 assets);

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

File 13 of 35 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 14 of 35 : ERC1967Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)

pragma solidity ^0.8.20;

import {Proxy} from "../Proxy.sol";
import {ERC1967Utils} from "./ERC1967Utils.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 */
contract ERC1967Proxy is Proxy {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
     *
     * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
     * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
     *
     * Requirements:
     *
     * - If `data` is empty, `msg.value` must be zero.
     */
    constructor(address implementation, bytes memory _data) payable {
        ERC1967Utils.upgradeToAndCall(implementation, _data);
    }

    /**
     * @dev Returns the current implementation address.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function _implementation() internal view virtual override returns (address) {
        return ERC1967Utils.getImplementation();
    }
}

File 15 of 35 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 16 of 35 : Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)

pragma solidity ^0.8.20;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
     * function and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }
}

File 17 of 35 : ProxyAdmin.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/ProxyAdmin.sol)

pragma solidity ^0.8.20;

import {ITransparentUpgradeableProxy} from "./TransparentUpgradeableProxy.sol";
import {Ownable} from "../../access/Ownable.sol";

/**
 * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
 * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
 */
contract ProxyAdmin is Ownable {
    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address)`
     * and `upgradeAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev Sets the initial owner who can perform upgrades.
     */
    constructor(address initialOwner) Ownable(initialOwner) {}

    /**
     * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation.
     * See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     * - If `data` is empty, `msg.value` must be zero.
     */
    function upgradeAndCall(
        ITransparentUpgradeableProxy proxy,
        address implementation,
        bytes memory data
    ) public payable virtual onlyOwner {
        proxy.upgradeToAndCall{value: msg.value}(implementation, data);
    }
}

File 18 of 35 : TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/TransparentUpgradeableProxy.sol)

pragma solidity ^0.8.20;

import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
import {ERC1967Proxy} from "../ERC1967/ERC1967Proxy.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {ProxyAdmin} from "./ProxyAdmin.sol";

/**
 * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}
 * does not implement this interface directly, and its upgradeability mechanism is implemented by an internal dispatch
 * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not
 * include them in the ABI so this interface must be used to interact with it.
 */
interface ITransparentUpgradeableProxy is IERC1967 {
    function upgradeToAndCall(address, bytes calldata) external payable;
}

/**
 * @dev This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.
 *
 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
 * clashing], which can potentially be used in an attack, this contract uses the
 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
 * things that go hand in hand:
 *
 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
 * that call matches the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.
 * 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to
 * the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating
 * the proxy admin cannot fallback to the target implementation.
 *
 * These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a
 * dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to
 * call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and
 * allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative
 * interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.
 *
 * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not
 * inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch
 * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to
 * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the
 * implementation.
 *
 * NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a
 * meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.
 *
 * IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an
 * immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be
 * overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an
 * undesirable state where the admin slot is different from the actual admin.
 *
 * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the
 * compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new
 * function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This
 * could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.
 */
contract TransparentUpgradeableProxy is ERC1967Proxy {
    // An immutable address for the admin to avoid unnecessary SLOADs before each call
    // at the expense of removing the ability to change the admin once it's set.
    // This is acceptable if the admin is always a ProxyAdmin instance or similar contract
    // with its own ability to transfer the permissions to another account.
    address private immutable _admin;

    /**
     * @dev The proxy caller is the current admin, and can't fallback to the proxy target.
     */
    error ProxyDeniedAdminAccess();

    /**
     * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,
     * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in
     * {ERC1967Proxy-constructor}.
     */
    constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
        _admin = address(new ProxyAdmin(initialOwner));
        // Set the storage value and emit an event for ERC-1967 compatibility
        ERC1967Utils.changeAdmin(_proxyAdmin());
    }

    /**
     * @dev Returns the admin of this proxy.
     */
    function _proxyAdmin() internal virtual returns (address) {
        return _admin;
    }

    /**
     * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
     */
    function _fallback() internal virtual override {
        if (msg.sender == _proxyAdmin()) {
            if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) {
                revert ProxyDeniedAdminAccess();
            } else {
                _dispatchUpgradeToAndCall();
            }
        } else {
            super._fallback();
        }
    }

    /**
     * @dev Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}.
     *
     * Requirements:
     *
     * - If `data` is empty, `msg.value` must be zero.
     */
    function _dispatchUpgradeToAndCall() private {
        (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));
        ERC1967Utils.upgradeToAndCall(newImplementation, data);
    }
}

File 19 of 35 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

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

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

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

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 26 of 35 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

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

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

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

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

File 27 of 35 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

File 28 of 35 : IRedeemOperator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

interface IRedeemOperator {
    // Events for logging actions
    event RegisterWithdrawal(address indexed user, uint256 shares);
    event ConfirmWithdrawal(address[] users);
    event UpdateOperator(address oldOperator, address newOperator);
    event UpdateFeeReceiver(address oldFeeReceiver, address newFeeReceiver);
    event Sweep(address token);

    function registerWithdrawal(address _user, uint256 _shares) external;

    function pendingWithdrawersCount() external view returns (uint256);

    function pendingWithdrawers(uint256 _limit, uint256 _offset) external view returns (address[] memory result_);

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

    function confirmWithdrawal(address[] calldata _Users, uint256 _totalGasLimit) external;
}

File 29 of 35 : IStrategy.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

interface IStrategy {
    function getNetAssets() external returns (uint256);

    function onTransferIn(address token, uint256 amount) external returns (bool);
}

File 30 of 35 : IVault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

interface IVault {
    event UpdateMarketCapacity(uint256 oldCapacityLimit, uint256 newCapacityLimit);
    event UpdateManagementFee(uint256 oldManagementFee, uint256 newManagementFee);
    event UpdateManagementFeeClaimPeriod(uint256 oldManagementFeeClaimPeriod, uint256 newManagementFeeClaimPeriod);
    event UpdateMaxPriceUpdatePeriod(uint256 oldMaxPriceUpdatePeriod, uint256 newMaxPriceUpdatePeriod);
    event UpdateRevenueRate(uint256 oldRevenueRate, uint256 newRevenueRate);
    event UpdateExitFeeRate(uint256 oldExitFeeRate, uint256 newExitFeeRate);
    event UpdateRebalancer(address oldRebalancer, address newRebalancer);
    event UpdateFeeReceiver(address oldFeeReceiver, address newFeeReceiver);
    event UpdateRedeemOperator(address oldRedeemOperator, address newRedeemOperator);
    event UpdateExchangePrice(uint256 newExchangePrice, uint256 newRevenue);
    event TransferToStrategy(address token, uint256 amount, uint256 strategyIndex);
    event OptionalDeposit(address caller, address token, uint256 assets, address receiver, address referral);
    event OptionalRedeem(address token, uint256 shares, address receiver, address owner);
    event RequestRedeem(address user, uint256 shares, address token);
    event CollectManagementFee(uint256 assets);
    event CollectRevenue(uint256 revenue);
    event Sweep(address token);
    event MigrateMint(address[] users, uint256[] assets);

    /**
     * @dev Parameters for initializing the vault contract.
     * @param underlyingToken The address of the underlying token for the vault.
     * @param name The name of the vault token.
     * @param symbol The symbol of the vault token.
     * @param marketCapacity The maximum market capacity of the vault.
     * @param managementFeeRate The rate of the management fee.
     * @param managementFeeClaimPeriod The period for claiming the management fee.
     * @param maxPriceUpdatePeriod The maximum allowed price update period.
     * @param revenueRate The rate of the revenue fee.
     * @param exitFeeRate The rate of the exit fee.
     * @param admin The address of the administrator.
     * @param rebalancer The address responsible for rebalancing the vault.
     * @param feeReceiver The address that will receive the fees.
     * @param redeemOperator The address of the operator responsible for redeeming shares
     */
    struct VaultParams {
        address underlyingToken;
        string name;
        string symbol;
        uint256 marketCapacity;
        uint256 managementFeeRate;
        uint256 managementFeeClaimPeriod;
        uint256 maxPriceUpdatePeriod;
        uint256 revenueRate;
        uint256 exitFeeRate;
        address admin;
        address rebalancer;
        address feeReceiver;
        address redeemOperator;
    }

    /**
     * @dev
     * @param exchangePrice The exchange rate used during user deposit and withdrawal operations.
     * @param revenueExchangePrice The exchange rate used when calculating performance fees,Performance fees will be recorded when the real exchange rate exceeds this rate.
     * @param revenue Collected revenue, stored in pegged ETH.
     * @param lastClaimMngFeeTime The last time the management fees were charged.
     * @param lastUpdatePriceTime The last time the exchange price was updated.
     */
    struct VaultState {
        uint256 exchangePrice;
        uint256 revenueExchangePrice;
        uint256 revenue;
        uint256 lastClaimMngFeeTime;
        uint256 lastUpdatePriceTime;
    }

    function optionalRedeem(address _token, uint256 _shares, uint256 _cutPercentage, address _receiver, address _owner)
        external
        returns (uint256 assetsAfterFee_);

    function getWithdrawFee(uint256 _amount) external view returns (uint256 amount_);

    function exchangePrice() external view returns (uint256);

    function revenueExchangePrice() external view returns (uint256);

    function revenue() external view returns (uint256);

    function lastExchangePrice() external view returns (uint256);
}

File 31 of 35 : IRestakeManager.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

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

    function depositETH() external payable;

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

File 32 of 35 : Constants.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

abstract contract Constants {
    address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address public constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;
    address public constant EZETH = 0xbf5495Efe5DB9ce00f80364C8B423567e58d2110;
    address public constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;

    // Define a constant for precision, typically used for scaling up values to 1e18 for precise arithmetic operations.
    uint256 public constant PRECISION = 1e18;
}

File 33 of 35 : Errors.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

library Errors {
    // Revert Errors:
    error CallerNotOperator(); // 0xa5523ee5
    error CallerNotRebalancer(); // 0xbd72e291
    error CallerNotVault(); // 0xedd7338f
    error ExitFeeRateTooHigh(); // 0xf4d1caab
    error FlashloanInProgress(); // 0x772ac4e8
    error IncorrectState(); // 0x508c9390
    error InfoExpired(); // 0x4ddf4a65
    error InvalidAccount(); // 0x6d187b28
    error InvalidAdapter(); // 0xfbf66df1
    error InvalidAdmin(); // 0xb5eba9f0
    error InvalidAsset(); // 0xc891add2
    error InvalidCaller(); // 0x48f5c3ed
    error InvalidClaimTime(); // 0x1221b97b
    error InvalidFeeReceiver(); // 0xd200485c
    error InvalidFlashloanCall(); // 0xd2208d52
    error InvalidFlashloanHelper(); // 0x8690f016
    error InvalidFlashloanProvider(); // 0xb6b48551
    error InvalidGasLimit(); // 0x98bdb2e0
    error InvalidInitiator(); // 0xbfda1f28
    error InvalidLength(); // 0x947d5a84
    error InvalidLimit(); // 0xe55fb509
    error InvalidManagementFeeClaimPeriod(); // 0x4022e4f6
    error InvalidManagementFeeRate(); // 0x09aa66eb
    error InvalidMarketCapacity(); // 0xc9034604
    error InvalidNetAssets(); // 0x6da79d69
    error InvalidNewOperator(); // 0xba0cdec5
    error InvalidOperator(); // 0xccea9e6f
    error InvalidRebalancer(); // 0xff288a8e
    error InvalidRedeemOperator(); // 0xd214a597
    error InvalidSafeProtocolRatio(); // 0x7c6b23d6
    error InvalidShares(); // 0x6edcc523
    error InvalidTarget(); // 0x82d5d76a
    error InvalidToken(); // 0xc1ab6dc1
    error InvalidTokenId(); // 0x3f6cc768
    error InvalidUnderlyingToken(); // 0x2fb86f96
    error InvalidVault(); // 0xd03a6320
    error InvalidWithdrawalUser(); // 0x36c17319
    error ManagementFeeRateTooHigh(); // 0x09aa66eb
    error ManagementFeeClaimPeriodTooShort(); // 0x4022e4f6
    error MarketCapacityTooLow(); // 0xc9034604
    error NotSupportedYet(); // 0xfb89ba2a
    error PriceNotUpdated(); // 0x1f4bcb2b
    error PriceUpdatePeriodTooLong(); // 0xe88d3ecb
    error RatioOutOfRange(); // 0x9179cbfa
    error RevenueFeeRateTooHigh(); // 0x0674143f
    error UnSupportedOperation(); // 0xe9ec8129
    error UnsupportedToken(); // 0x6a172882
    error WithdrawZero(); // 0x7ea773a9

    // for 1inch swap
    error OneInchInvalidReceiver(); // 0xd540519e
    error OneInchInvalidToken(); // 0x8e7ad912
    error OneInchInvalidInputAmount(); // 0x672b500f
    error OneInchInvalidFunctionSignature(); // 0x247f51aa
    error OneInchUnexpectedSpentAmount(); // 0x295ada05
    error OneInchUnexpectedReturnAmount(); // 0x05e64ca8
    error OneInchNotSupported(); // 0x04b2de78
}

File 34 of 35 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.25;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * Since version 5.1, this library also support writing and reading value types to and from transient storage.
 *
 *  * Example using transient storage:
 * ```solidity
 * contract Lock {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
 *
 *     modifier locked() {
 *         require(!_LOCK_SLOT.asBoolean().tload());
 *
 *         _LOCK_SLOT.asBoolean().tstore(true);
 *         _;
 *         _LOCK_SLOT.asBoolean().tstore(false);
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

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

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

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

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

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

    /**
     * @dev UDVT that represent a slot holding a address.
     */
    type AddressSlotType is bytes32;

    /**
     * @dev Cast an arbitrary slot to a AddressSlotType.
     */
    function asAddress(bytes32 slot) internal pure returns (AddressSlotType) {
        return AddressSlotType.wrap(slot);
    }

    /**
     * @dev UDVT that represent a slot holding a bool.
     */
    type BooleanSlotType is bytes32;

    /**
     * @dev Cast an arbitrary slot to a BooleanSlotType.
     */
    function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) {
        return BooleanSlotType.wrap(slot);
    }

    /**
     * @dev UDVT that represent a slot holding a bytes32.
     */
    type Bytes32SlotType is bytes32;

    /**
     * @dev Cast an arbitrary slot to a Bytes32SlotType.
     */
    function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) {
        return Bytes32SlotType.wrap(slot);
    }

    /**
     * @dev UDVT that represent a slot holding a uint256.
     */
    type Uint256SlotType is bytes32;

    /**
     * @dev Cast an arbitrary slot to a Uint256SlotType.
     */
    function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) {
        return Uint256SlotType.wrap(slot);
    }

    /**
     * @dev UDVT that represent a slot holding a int256.
     */
    type Int256SlotType is bytes32;

    /**
     * @dev Cast an arbitrary slot to a Int256SlotType.
     */
    function asInt256(bytes32 slot) internal pure returns (Int256SlotType) {
        return Int256SlotType.wrap(slot);
    }

    /**
     * @dev Load the value held at location `slot` in transient storage.
     */
    function tload(AddressSlotType slot) internal view returns (address value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := tload(slot)
        }
    }

    /**
     * @dev Store `value` at location `slot` in transient storage.
     */
    function tstore(AddressSlotType slot, address value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            tstore(slot, value)
        }
    }

    /**
     * @dev Load the value held at location `slot` in transient storage.
     */
    function tload(BooleanSlotType slot) internal view returns (bool value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := tload(slot)
        }
    }

    /**
     * @dev Store `value` at location `slot` in transient storage.
     */
    function tstore(BooleanSlotType slot, bool value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            tstore(slot, value)
        }
    }

    /**
     * @dev Load the value held at location `slot` in transient storage.
     */
    function tload(Bytes32SlotType slot) internal view returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := tload(slot)
        }
    }

    /**
     * @dev Store `value` at location `slot` in transient storage.
     */
    function tstore(Bytes32SlotType slot, bytes32 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            tstore(slot, value)
        }
    }

    /**
     * @dev Load the value held at location `slot` in transient storage.
     */
    function tload(Uint256SlotType slot) internal view returns (uint256 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := tload(slot)
        }
    }

    /**
     * @dev Store `value` at location `slot` in transient storage.
     */
    function tstore(Uint256SlotType slot, uint256 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            tstore(slot, value)
        }
    }

    /**
     * @dev Load the value held at location `slot` in transient storage.
     */
    function tload(Int256SlotType slot) internal view returns (int256 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := tload(slot)
        }
    }

    /**
     * @dev Store `value` at location `slot` in transient storage.
     */
    function tstore(Int256SlotType slot, int256 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            tstore(slot, value)
        }
    }
}

File 35 of 35 : StrategyFactory.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "../../interfaces/IRedeemOperator.sol";
import "../../interfaces/IStrategy.sol";
import "../libraries/Errors.sol";

/**
 * @title StrategyFactory contract
 * @author Naturelab
 * @dev This contract is responsible for managing strategies in a vault.
 * It allows the owner to create, remove, and interact with different strategies.
 */
abstract contract StrategyFactory is OwnableUpgradeable {
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    uint256 public constant MAX_POSITION_LIMIT = 10000; // 10000/10000 = 100%

    // Set to keep track of the addresses of strategies
    EnumerableSet.AddressSet private _strategies;
    // This mapping is used to set position limits for various strategies.
    // The key is the strategy ID, and the value is the maximum percentage of the entire position
    // that the strategy is allowed to occupy. 1000 = 10%
    mapping(address => uint256) public positionLimit;

    // Events for logging actions
    event CreateStrategy(address strategy, address impl);
    event RemoveStrategy(address strategy);
    event UpdateOperator(address oldOperator, address newOperator);
    event UpdateStrategyLimit(uint256 oldLimit, uint256 newLimit);

    /**
     * @dev Returns the number of strategies in the set.
     * @return The number of strategies.
     */
    function strategiesCount() public view returns (uint256) {
        return _strategies.length();
    }

    /**
     * @dev Returns an array of all strategy addresses.
     * @return An array of strategy addresses.
     */
    function strategies() public view returns (address[] memory) {
        return _strategies.values();
    }

    /**
     * @dev Returns the address of a strategy at a specific index.
     * @param _offset The index of the strategy.
     * @return The address of the strategy.
     */
    function strategyAddress(uint256 _offset) public view returns (address) {
        return _strategies.at(_offset);
    }

    /**
     * @dev Returns the total assets managed by a specific strategy.
     * @param _offset The index of the strategy.
     * @return totalAssets_ The total assets managed by the strategy.
     */
    function strategyAssets(uint256 _offset) public returns (uint256 totalAssets_) {
        totalAssets_ = IStrategy(_strategies.at(_offset)).getNetAssets();
    }

    /**
     * @dev Returns the total assets managed by all strategies combined.
     * @return totalAssets_ The total assets managed by all strategies.
     */
    function totalStrategiesAssets() public returns (uint256 totalAssets_) {
        uint256 length_ = strategiesCount();
        address[] memory strategies_ = strategies();
        for (uint256 i = 0; i < length_; ++i) {
            totalAssets_ += IStrategy(strategies_[i]).getNetAssets();
        }
    }

    /**
     * @dev Allows the owner to create a new strategy.
     * @param _impl The implementation address of the strategy.
     * @param _initBytes The initialization parameters for the strategy.
     */
    function createStrategy(address _impl, bytes calldata _initBytes, uint256 _positionLimit) external onlyOwner {
        if (_positionLimit == 0 || _positionLimit > MAX_POSITION_LIMIT) revert Errors.InvalidLimit();
        address newStrategy_ = address(new TransparentUpgradeableProxy(_impl, msg.sender, _initBytes));
        positionLimit[newStrategy_] = _positionLimit;
        _strategies.add(newStrategy_);

        emit CreateStrategy(newStrategy_, _impl);
    }

    /**
     * @dev Allows the owner to remove a strategy from the set.
     * @param _strategy The address of the strategy to be removed.
     */
    function removeStrategy(address _strategy) external onlyOwner {
        if (IStrategy(_strategy).getNetAssets() > 0) revert Errors.UnSupportedOperation();
        _strategies.remove(_strategy);
        positionLimit[_strategy] = 0;

        emit RemoveStrategy(_strategy);
    }

    /**
     * @dev Update the temporary address of shares when users redeem.
     * @param _newPositionLimit The new redeem operator address.
     */
    function updateStrategyLimit(uint256 _offset, uint256 _newPositionLimit) external onlyOwner {
        if (_newPositionLimit == 0 || _newPositionLimit > MAX_POSITION_LIMIT) revert Errors.InvalidLimit();
        address strategyAddress_ = _strategies.at(_offset);
        emit UpdateStrategyLimit(positionLimit[strategyAddress_], _newPositionLimit);
        positionLimit[strategyAddress_] = _newPositionLimit;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CallerNotRebalancer","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxWithdraw","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExitFeeRateTooHigh","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IncorrectState","type":"error"},{"inputs":[],"name":"InvalidAdmin","type":"error"},{"inputs":[],"name":"InvalidClaimTime","type":"error"},{"inputs":[],"name":"InvalidFeeReceiver","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"InvalidLimit","type":"error"},{"inputs":[],"name":"InvalidRebalancer","type":"error"},{"inputs":[],"name":"InvalidRedeemOperator","type":"error"},{"inputs":[],"name":"InvalidUnderlyingToken","type":"error"},{"inputs":[],"name":"ManagementFeeClaimPeriodTooShort","type":"error"},{"inputs":[],"name":"ManagementFeeRateTooHigh","type":"error"},{"inputs":[],"name":"MarketCapacityTooLow","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotSupportedYet","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PriceNotUpdated","type":"error"},{"inputs":[],"name":"PriceUpdatePeriodTooLong","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RevenueFeeRateTooHigh","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UnSupportedOperation","type":"error"},{"inputs":[],"name":"UnsupportedToken","type":"error"},{"inputs":[],"name":"WithdrawZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"CollectManagementFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"revenue","type":"uint256"}],"name":"CollectRevenue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"address","name":"impl","type":"address"}],"name":"CreateStrategy","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":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"assets","type":"uint256[]"}],"name":"MigrateMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"referral","type":"address"}],"name":"OptionalDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"OptionalRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"RemoveStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RequestRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"Sweep","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strategyIndex","type":"uint256"}],"name":"TransferToStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newExchangePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRevenue","type":"uint256"}],"name":"UpdateExchangePrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldExitFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExitFeeRate","type":"uint256"}],"name":"UpdateExitFeeRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldFeeReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"newFeeReceiver","type":"address"}],"name":"UpdateFeeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldManagementFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newManagementFee","type":"uint256"}],"name":"UpdateManagementFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldManagementFeeClaimPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newManagementFeeClaimPeriod","type":"uint256"}],"name":"UpdateManagementFeeClaimPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCapacityLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCapacityLimit","type":"uint256"}],"name":"UpdateMarketCapacity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxPriceUpdatePeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxPriceUpdatePeriod","type":"uint256"}],"name":"UpdateMaxPriceUpdatePeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOperator","type":"address"},{"indexed":false,"internalType":"address","name":"newOperator","type":"address"}],"name":"UpdateOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRebalancer","type":"address"},{"indexed":false,"internalType":"address","name":"newRebalancer","type":"address"}],"name":"UpdateRebalancer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRedeemOperator","type":"address"},{"indexed":false,"internalType":"address","name":"newRedeemOperator","type":"address"}],"name":"UpdateRedeemOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRevenueRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRevenueRate","type":"uint256"}],"name":"UpdateRevenueRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"UpdateStrategyLimit","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":[],"name":"ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EZETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_POSITION_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WSTETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","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":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_impl","type":"address"},{"internalType":"bytes","name":"_initBytes","type":"bytes"},{"internalType":"uint256","name":"_positionLimit","type":"uint256"}],"name":"createStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","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":"exchangePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultParams","outputs":[{"components":[{"internalType":"address","name":"underlyingToken","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"marketCapacity","type":"uint256"},{"internalType":"uint256","name":"managementFeeRate","type":"uint256"},{"internalType":"uint256","name":"managementFeeClaimPeriod","type":"uint256"},{"internalType":"uint256","name":"maxPriceUpdatePeriod","type":"uint256"},{"internalType":"uint256","name":"revenueRate","type":"uint256"},{"internalType":"uint256","name":"exitFeeRate","type":"uint256"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"rebalancer","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"address","name":"redeemOperator","type":"address"}],"internalType":"struct IVault.VaultParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultState","outputs":[{"components":[{"internalType":"uint256","name":"exchangePrice","type":"uint256"},{"internalType":"uint256","name":"revenueExchangePrice","type":"uint256"},{"internalType":"uint256","name":"revenue","type":"uint256"},{"internalType":"uint256","name":"lastClaimMngFeeTime","type":"uint256"},{"internalType":"uint256","name":"lastUpdatePriceTime","type":"uint256"}],"internalType":"struct IVault.VaultState","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assetAmount","type":"uint256"}],"name":"getWithdrawFee","outputs":[{"internalType":"uint256","name":"withdrawFee_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_initBytes","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastExchangePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"maxAssets_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"},{"internalType":"uint256[]","name":"_assets","type":"uint256[]"}],"name":"migrateMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_referral","type":"address"}],"name":"optionalDeposit","outputs":[{"internalType":"uint256","name":"shares_","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"uint256","name":"_cutPercentage","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"optionalRedeem","outputs":[{"internalType":"uint256","name":"assetsAfterFee_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"positionLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"removeStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"requestRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revenueExchangePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"strategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"strategiesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"}],"name":"strategyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"}],"name":"strategyAssets","outputs":[{"internalType":"uint256","name":"totalAssets_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","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":"totalStrategiesAssets","outputs":[{"internalType":"uint256","name":"totalAssets_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","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":"value","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":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_strategyIndex","type":"uint256"}],"name":"transferToStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingTvl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateExchangePrice","outputs":[{"internalType":"uint256","name":"newExchangePrice","type":"uint256"},{"internalType":"uint256","name":"newRevenue","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newExitFeeRate","type":"uint256"}],"name":"updateExitFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeReceiver","type":"address"}],"name":"updateFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newManagementFeeRate","type":"uint256"}],"name":"updateManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newmanagementFeeClaimPeriod","type":"uint256"}],"name":"updateManagementFeeClaimPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCapacityLimit","type":"uint256"}],"name":"updateMarketCapacity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMaxPriceUpdatePeriod","type":"uint256"}],"name":"updateMaxPriceUpdatePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newRebalancer","type":"address"}],"name":"updateRebalancer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newRedeemOperator","type":"address"}],"name":"updateRedeemOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRevenueRate","type":"uint256"}],"name":"updateRevenueRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_newPositionLimit","type":"uint256"}],"name":"updateStrategyLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052348015600e575f80fd5b506159a88061001c5f395ff3fe6080604052600436106103fe575f3560e01c80638322fff21161020d578063b460af941161011a578063d905777e116100b3578063ed14d17e11610078578063ed14d17e14610c61578063ef8b30f714610b76578063f2fde38b14610c75578063f4ad878814610c94578063ffa1ad7414610ca9575f80fd5b8063d905777e14610bb4578063d9f9027f14610bd3578063d9fb643a14610bf4578063dd62ed3e14610c1b578063e00bfe5014610c3a575f80fd5b8063b460af9414610ab2578063ba08765214610ab2578063ba8bfa2a14610ad1578063bf6590a414610af0578063c0587a9514610b04578063c63d75b614610b37578063c69bebe414610b57578063c6e6f59214610b76578063ce96cb7714610b95575f80fd5b8063a7b73254116101a6578063ad5c46481161016b578063ad5c464814610a03578063b046a44914610a2a578063b0caa89114610a49578063b2db983a14610a74578063b3d7f6b914610a93575f80fd5b8063a7b732541461096c578063a9059cbb1461098b578063aa2f892d146109aa578063aaf5eb68146109c9578063ad35530b146109e4575f80fd5b80638322fff21461088d5780638456cb59146108b457806388bb4f60146108c85780638da5cb5b146108e957806394bf804d146108fd57806395d89b411461091c57806398e1862c146109305780639c016ffd146109445780639e65741e14610958575f80fd5b80633b0426db1161030b5780634cdad506116102a457806370a082311161026957806370a08231146107fd578063715018a61461081c5780637a825e07146108305780637f6c81b71461084f5780638152cd181461086e575f80fd5b80634cdad506146104a557806358fe922d146107845780635c975abb146107ab5780636d725a79146107bf5780636e553f65146107de575f80fd5b80633b0426db1461064e5780633bfaa7e3146106625780633c5280e41461068b5780633e9491a2146106aa5780633f4ba83a146106be578063402d267d146106d2578063439fab91146106f15780634a8c110a146107105780634b59b82e14610765575f80fd5b806318160ddd1161039757806329c23e4a1161035c57806329c23e4a146105b6578063313ce567146105d557806332507a5f146105fb578063340691571461060e57806338d52e0f1461062d575f80fd5b806318160ddd1461053157806323b872dd146105455780632489f7f71461056457806325bd414214610578578063266f8dc914610597575f80fd5b806301681a621461040957806301e1d1141461042a578063030d624a1461045157806306fdde0314610470578063079c3b881461049157806307a2d13a146104a5578063095ea7b3146104c45780630a28a477146104f3578063175188e814610512575f80fd5b3661040557005b5f80fd5b348015610414575f80fd5b50610428610423366004613fff565b610cd7565b005b348015610435575f80fd5b5061043e610de8565b6040519081526020015b60405180910390f35b34801561045c575f80fd5b5061042861046b366004614018565b610e47565b34801561047b575f80fd5b50610484610eb2565b604051610448919061405d565b34801561049c575f80fd5b5061043e610f50565b3480156104b0575f80fd5b5061043e6104bf366004614018565b610ff6565b3480156104cf575f80fd5b506104e36104de36600461406f565b611007565b6040519015158152602001610448565b3480156104fe575f80fd5b5061043e61050d366004614018565b61101e565b34801561051d575f80fd5b5061042861052c366004613fff565b61102a565b34801561053c575f80fd5b5061043e611113565b348015610550575f80fd5b506104e361055f366004614097565b611127565b34801561056f575f80fd5b5061043e61114c565b348015610583575f80fd5b50610428610592366004614018565b611156565b3480156105a2575f80fd5b506104286105b1366004614018565b6111c1565b3480156105c1575f80fd5b5061043e6105d0366004614018565b61122d565b3480156105e0575f80fd5b506105e961124a565b60405160ff9091168152602001610448565b61043e6106093660046140d0565b611273565b348015610619575f80fd5b50610428610628366004614018565b61169d565b348015610638575f80fd5b5061064161170a565b604051610448919061411a565b348015610659575f80fd5b5061043e611724565b34801561066d575f80fd5b50610676611757565b60408051928352602083019190915201610448565b348015610696575f80fd5b506104286106a5366004614018565b611949565b3480156106b5575f80fd5b5060125461043e565b3480156106c9575f80fd5b506104286119b6565b3480156106dd575f80fd5b5061043e6106ec366004613fff565b6119c8565b3480156106fc575f80fd5b5061042861070b366004614172565b6119de565b34801561071b575f80fd5b50610724611dd7565b60405161044891905f60a082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015292915050565b348015610770575f80fd5b5061064161077f366004614018565b611e39565b34801561078f575f80fd5b5061064173bf5495efe5db9ce00f80364c8b423567e58d211081565b3480156107b6575f80fd5b506104e3611e44565b3480156107ca575f80fd5b506104286107d93660046141f0565b611e58565b3480156107e9575f80fd5b5061043e6107f8366004614256565b611f2b565b348015610808575f80fd5b5061043e610817366004613fff565b611fcd565b348015610827575f80fd5b50610428611ff6565b34801561083b575f80fd5b5061042861084a366004613fff565b612007565b34801561085a575f80fd5b50610428610869366004614018565b61209f565b348015610879575f80fd5b50610428610888366004614280565b61210a565b348015610898575f80fd5b5061064173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156108bf575f80fd5b506104286121b8565b3480156108d3575f80fd5b506108dc612212565b60405161044891906142a0565b3480156108f4575f80fd5b5061064161245c565b348015610908575f80fd5b5061043e610917366004614256565b612484565b348015610927575f80fd5b5061048461249f565b34801561093b575f80fd5b5060115461043e565b34801561094f575f80fd5b506104286124bb565b348015610963575f80fd5b5060105461043e565b348015610977575f80fd5b5061043e6109863660046143aa565b6125a5565b348015610996575f80fd5b506104e36109a536600461406f565b612787565b3480156109b5575f80fd5b506104286109c4366004614018565b612794565b3480156109d4575f80fd5b5061043e670de0b6b3a764000081565b3480156109ef575f80fd5b506104286109fe3660046143fd565b61289b565b348015610a0e575f80fd5b5061064173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610a35575f80fd5b50610428610a44366004613fff565b612960565b348015610a54575f80fd5b5061043e610a63366004613fff565b60026020525f908152604090205481565b348015610a7f575f80fd5b5061043e610a8e366004614018565b6129fb565b348015610a9e575f80fd5b5061043e610aad366004614018565b612a66565b348015610abd575f80fd5b5061043e610acc366004614452565b612a72565b348015610adc575f80fd5b50610428610aeb36600461448b565b612a8c565b348015610afb575f80fd5b5061043e612c45565b348015610b0f575f80fd5b507f4995646f72fa9a270ffc094641ab616ce576b2e3eab25eaf05c15caa4f0e595d5c61043e565b348015610b42575f80fd5b5061043e610b51366004613fff565b505f1990565b348015610b62575f80fd5b50610428610b71366004613fff565b612cfa565b348015610b81575f80fd5b5061043e610b90366004614018565b612d92565b348015610ba0575f80fd5b5061043e610baf366004613fff565b612d9d565b348015610bbf575f80fd5b5061043e610bce366004613fff565b612db0565b348015610bde575f80fd5b50610be7612dba565b60405161044891906144bb565b348015610bff575f80fd5b50610641737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b348015610c26575f80fd5b5061043e610c35366004614507565b612dc5565b348015610c45575f80fd5b5061064173ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b348015610c6c575f80fd5b50610428612dff565b348015610c80575f80fd5b50610428610c8f366004613fff565b612e82565b348015610c9f575f80fd5b5061043e61271081565b348015610cb4575f80fd5b50610484604051806040016040528060038152602001620312e360ec1b81525081565b610cdf612ebc565b610ce761170a565b6001600160a01b0316816001600160a01b031603610d185760405163350b944160e11b815260040160405180910390fd5b6040516370a0823160e01b81525f906001600160a01b038316906370a0823190610d4690309060040161411a565b602060405180830381865afa158015610d61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d85919061452f565b9050610d9b6001600160a01b0383163383612eee565b478015610dac57610dac3382612f4b565b7f807273efecfbeb7ae7d3a2189d1ed5a7db80074eed86e7d80b10bb925cd1db7383604051610ddb919061411a565b60405180910390a1505050565b6009546014545f9190610dfb904261455a565b1115610e1a57604051631f4bcb2b60e01b815260040160405180910390fd5b670de0b6b3a7640000610e2b611113565b601054610e38919061456d565b610e429190614598565b905090565b610e4f612ebc565b6004811115610e71576040516309aa66eb60e01b815260040160405180910390fd5b60075460408051918252602082018390527f29b9d7a7d8a7a3ac22c295e4517723bc4e386eea60173e59e6da1dbd460cb409910160405180910390a1600755565b60605f610ebd612fde565b9050806003018054610ece906145ab565b80601f0160208091040260200160405190810160405280929190818152602001828054610efa906145ab565b8015610f455780601f10610f1c57610100808354040283529160200191610f45565b820191905f5260205f20905b815481529060010190602001808311610f2857829003601f168201915b505050505091505090565b6040516370a0823160e01b81525f90819073bf5495efe5db9ce00f80364c8b423567e58d2110906370a0823190610f8b90309060040161411a565b602060405180830381865afa158015610fa6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fca919061452f565b90505f610fd5612c45565b601254909150610fe583836145e3565b610fef919061455a565b9250505090565b5f611001825f613002565b92915050565b5f3361101481858561303f565b5060019392505050565b5f61100182600161304c565b611032612ebc565b5f816001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015611070573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611094919061452f565b11156110b35760405163e9ec812960e01b815260040160405180910390fd5b6110bd5f82613080565b506001600160a01b0381165f9081526002602052604080822091909155517fd3281a40d50ae838fe77dc627744037b8f0fc6a5711d66119a9b670c5cde41af9061110890839061411a565b60405180910390a150565b5f8061111d612fde565b6002015492915050565b5f33611134858285613094565b61113f8585856130e4565b60019150505b9392505050565b5f610e425f613141565b61115e612ebc565b60788111156111805760405163f4d1caab60e01b815260040160405180910390fd5b600b5460408051918252602082018390527f394967f6fe403cda0905b23e81b928c5ca79107000b1404c6b3185442f05213c910160405180910390a1600b55565b6111c9612ebc565b6105dc8111156111ec57604051630674143f60e01b815260040160405180910390fd5b600a5460408051918252602082018390527f63058ed61801434ac6bfe39e74400bed7f3ba09b7cb6294092974450727eb753910160405180910390a1600a55565b600b545f9061271090611240908461456d565b6110019190614598565b5f8061125461314a565b90505f815461126d9190600160a01b900460ff166145f6565b91505090565b5f61127c61316e565b6112846131b8565b73bf5495efe5db9ce00f80364c8b423567e58d210f196001600160a01b038616016112cf576112b384846131de565b90506112ca6001600160a01b03861633308761326b565b61162b565b73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b038616016114d45761131473ae7ab96520de3a18e5e111b5eaab095312d7fe8433308761326b565b6040516370a0823160e01b81525f9073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061134d90309060040161411a565b602060405180830381865afa158015611368573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c919061452f565b90506113c173ae7ab96520de3a18e5e111b5eaab095312d7fe847374a09653a083691711cf8215a6ab074bb4e99ef5876132a4565b6040516311f9fbc960e21b81527374a09653a083691711cf8215a6ab074bb4e99ef5906347e7ef249061140e9073ae7ab96520de3a18e5e111b5eaab095312d7fe8490899060040161460f565b5f604051808303815f87803b158015611425575f80fd5b505af1158015611437573d5f803e3d5ffd5b50506040516370a0823160e01b81525f925083915073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061147690309060040161411a565b602060405180830381865afa158015611491573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114b5919061452f565b6114bf919061455a565b90506114cb81866131de565b9250505061162b565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03861601611612576040516370a0823160e01b81525f9073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061153290309060040161411a565b602060405180830381865afa15801561154d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611571919061452f565b90507374a09653a083691711cf8215a6ab074bb4e99ef56001600160a01b031663f6326fb3346040518263ffffffff1660e01b81526004015f604051808303818588803b1580156115c0575f80fd5b505af11580156115d2573d5f803e3d5ffd5b50506040516370a0823160e01b81525f935084925073bf5495efe5db9ce00f80364c8b423567e58d211091506370a082319061147690309060040161411a565b60405163350b944160e11b815260040160405180910390fd5b6116358382613329565b604080513381526001600160a01b03878116602083015281830187905285811660608301528416608082015290517f308d36d8f61bd4393536b6557142f55554c34d4ea2a3dbf54fe782b98889dfb29181900360a00190a1611695613361565b949350505050565b6116a5612ebc565b6203f4808111156116c95760405163e88d3ecb60e01b815260040160405180910390fd5b60095460408051918252602082018390527fcc5a4a7c466fc20af4119a7a26048791fdb55cbd401aff36ef2bfc639662b2e2910160405180910390a1600955565b5f8061171461314a565b546001600160a01b031692915050565b6014545f908190611735904261455a565b90508060036006015411611749575f61126d565b60095461126d90829061455a565b600d545f9081906001600160a01b031633146117865760405163bd72e29160e01b815260040160405180910390fd5b6010546117b4907f4995646f72fa9a270ffc094641ab616ce576b2e3eab25eaf05c15caa4f0e595d90613387565b426014555f6117c1611113565b9050805f036117d95750506010546012549091509091565b5f6117e2610f50565b9050816117f7670de0b6b3a76400008361456d565b6118019190614598565b601154909450841115611905576011545f0361182b57505050601181905560108190556012549091565b5f670de0b6b3a764000083601060010154611846919061456d565b6118509190614598565b61185a908361455a565b600a549091506127109061186e908361456d565b6118789190614598565b93508360106002015f82825461188e91906145e3565b90915550839050670de0b6b3a76400006118a8868561455a565b6118b2919061456d565b6118bc9190614598565b6010819055601181905560408051918252602082018690527f83d2ad38a3d31bbc70811535dd8943b0140df344c23e6e167ee1ca32f9a1a459910160405180910390a150611943565b6010849055604080518581525f60208201527f83d2ad38a3d31bbc70811535dd8943b0140df344c23e6e167ee1ca32f9a1a459910160405180910390a15b50509091565b611951612ebc565b62093a8081101561197557604051632011727b60e11b815260040160405180910390fd5b60085460408051918252602082018390527fcdbf56e2a82365307f9691ad933e9762726485d202543fe224f47447d79feaf0910160405180910390a1600855565b6119be612ebc565b6119c661338e565b565b5f6119d1610de8565b600654611001919061455a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015611a225750825b90505f826001600160401b03166001148015611a3d5750303b155b905081158015611a4b575080155b15611a695760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a9357845460ff60401b1916600160401b1785555b5f611aa0878901896146ed565b9050611aaa6133d9565b611ab26133e9565b611ac4816020015182604001516133f9565b80516001600160a01b0316611aec576040516317dc37cb60e11b815260040160405180910390fd5b6101408101516001600160a01b0316611b1b576040516001626bbab960e11b0319815260040160405180910390fd5b6101208101516001600160a01b0316611b4757604051630b5eba9f60e41b815260040160405180910390fd5b6101608101516001600160a01b0316611b7357604051633480121760e21b815260040160405180910390fd5b68056bc75e2d6310000081606001511015611ba157604051633240d18160e21b815260040160405180910390fd5b600481608001511115611bc7576040516309aa66eb60e01b815260040160405180910390fd5b62093a808160a001511015611bef57604051632011727b60e11b815260040160405180910390fd5b6203f4808160c001511115611c175760405163e88d3ecb60e01b815260040160405180910390fd5b6105dc8160e001511115611c3e57604051630674143f60e01b815260040160405180910390fd5b60788161010001511115611c655760405163f4d1caab60e01b815260040160405180910390fd5b611c7381610120015161340b565b8051611c7e9061341c565b426013819055601455670de0b6b3a76400006010558051600380546001600160a01b0319166001600160a01b039092169190911781556020820151829190600490611cc9908261485e565b5060408201516002820190611cde908261485e565b50606082015160038201556080820151600482015560a0820151600582015560c0820151600682015560e0820151600782015561010082015160088201556101208201516009820180546001600160a01b03199081166001600160a01b0393841617909155610140840151600a840180548316918416919091179055610160840151600b84018054831691841691909117905561018090930151600c90920180549093169116179055508315611dce57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b611e046040518060a001604052805f81526020015f81526020015f81526020015f81526020015f81525090565b506040805160a08101825260105481526011546020820152601254918101919091526013546060820152601454608082015290565b5f611001818361342d565b5f80611e4e613438565b5460ff1692915050565b611e60612ebc565b828114611e805760405163251f56a160e21b815260040160405180910390fd5b5f805b84811015611ee657611eac848483818110611ea057611ea061491d565b90506020020135612d92565b9150611ede868683818110611ec357611ec361491d565b9050602002016020810190611ed89190613fff565b83613329565b600101611e83565b507ff248243b9aa9396c0ffe65aea2b7e81e374fdf007d3059f0fdeba8441b5d2e0f85858585604051611f1c9493929190614931565b60405180910390a15050505050565b5f611f3461316e565b611f3c6131b8565b5f198303611fb957611f4c61170a565b6001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401611f77919061411a565b602060405180830381865afa158015611f92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fb6919061452f565b92505b611fc3838361345c565b9050611001613361565b5f80611fd7612fde565b6001600160a01b039093165f9081526020939093525050604090205490565b611ffe612ebc565b6119c65f6134a8565b61200f612ebc565b6001600160a01b0381166120365760405163d214a59760e01b815260040160405180910390fd5b600f546040517fe74dd8b1f5f3d5328df682e649c08b085f09c2ce77b68e54329e8d30e2642f7891612075916001600160a01b039091169084906149ab565b60405180910390a1600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6120a7612ebc565b60065481116120c95760405163e9ec812960e01b815260040160405180910390fd5b60065460408051918252602082018390527f7f3306669f28a6aa13d0f709be2bd4f3e21d2f37aee9358846a50e1988ee4832910160405180910390a1600655565b612112612ebc565b801580612120575061271081115b1561213e5760405163e55fb50960e01b815260040160405180910390fd5b5f612149818461342d565b6001600160a01b0381165f908152600260209081526040918290205482519081529081018590529192507f7cd01dd3533c6dc08821cd303814de60aba1901f1531c3cbcd95d26ed924e9cf910160405180910390a16001600160a01b03165f9081526002602052604090205550565b6121c061245c565b6001600160a01b0316336001600160a01b0316141580156121ec5750600d546001600160a01b03163314155b1561220a5760405163e9ec812960e01b815260040160405180910390fd5b6119c6613518565b61229f604051806101a001604052805f6001600160a01b0316815260200160608152602001606081526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681525090565b604080516101a08101909152600380546001600160a01b03168252600480546020840191906122cd906145ab565b80601f01602080910402602001604051908101604052809291908181526020018280546122f9906145ab565b80156123445780601f1061231b57610100808354040283529160200191612344565b820191905f5260205f20905b81548152906001019060200180831161232757829003601f168201915b5050505050815260200160028201805461235d906145ab565b80601f0160208091040260200160405190810160405280929190818152602001828054612389906145ab565b80156123d45780601f106123ab576101008083540402835291602001916123d4565b820191905f5260205f20905b8154815290600101906020018083116123b757829003601f168201915b505050918352505060038201546020820152600482015460408201526005820154606082015260068201546080820152600782015460a0820152600882015460c082015260098201546001600160a01b0390811660e0830152600a8301548116610100830152600b8301548116610120830152600c9092015490911661014090910152919050565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300611714565b5f61248d61316e565b6124956131b8565b611fc3838361355e565b60605f6124aa612fde565b9050806004018054610ece906145ab565b600e546001600160a01b031633146124e657604051633480121760e21b815260040160405180910390fd5b6008546013544291906124f9908361455a565b101561251857604051631221b97b60e01b815260040160405180910390fd5b60138190556007545f906127109061252e610de8565b612538919061456d565b6125429190614598565b600e5490915061256e906001600160a01b03168261255e61170a565b6001600160a01b03169190612eee565b6040518181527f55ce6141cc7099e5baac44c64543a6d7fc4e37ebba0fcaa65fa1f2a9996ec5a59060200160405180910390a15050565b5f6125ae61316e565b6125b66131b8565b600f546001600160a01b031633146125e15760405163e9ec812960e01b815260040160405180910390fd5b601454421461260357604051631f4bcb2b60e01b815260040160405180910390fd5b5f19850361261b5761261482612db0565b9450612678565b61262482612db0565b8511156126785760405162461bcd60e51b815260206004820152601d60248201527f455243343632363a2072656465656d206d6f7265207468616e206d617800000060448201526064015b60405180910390fd5b336001600160a01b0383161461269357612693823387613094565b5f6126be670de0b6b3a76400006126aa878261455a565b6126b4908961456d565b6104bf9190614598565b90506126ca8387613579565b6126d38161122d565b6126dd908261455a565b915073bf5495efe5db9ce00f80364c8b423567e58d210f196001600160a01b038816016116125761272373bf5495efe5db9ce00f80364c8b423567e58d21108584612eee565b604080516001600160a01b03898116825260208201899052868116828401528516606082015290517f4e19afb1df46d77083cc4e520735afa0cdc2d763d6bc5d710661c3dbb35f4c4d9181900360800190a15061277e613361565b95945050505050565b5f336110148185856130e4565b61279c61316e565b6127a46131b8565b805f036127c457604051637ea773a960e01b815260040160405180910390fd5b600f546127dc9033906001600160a01b0316836130e4565b600f546040516336c69b5d60e11b81526001600160a01b0390911690636d8d36ba9061280e903390859060040161460f565b5f604051808303815f87803b158015612825575f80fd5b505af1158015612837573d5f803e3d5ffd5b505050507ff9fd31dd1a61b95c600dd5aa1a6330f6c5cbe70a39a660edc081daf217db3cfb338261286661170a565b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a1612898613361565b50565b6128a3612ebc565b8015806128b1575061271081115b156128cf5760405163e55fb50960e01b815260040160405180910390fd5b5f843385856040516128e090613fd7565b6128ed94939291906149c5565b604051809103905ff080158015612906573d5f803e3d5ffd5b506001600160a01b0381165f90815260026020526040812084905590915061292e90826135ad565b507f0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb8186604051611f1c9291906149ab565b612968612ebc565b6001600160a01b038116612992576040516001626bbab960e11b0319815260040160405180910390fd5b600d546040517fe2eeab472f89ac267be30e463da684fb96f56cc8e947839361fdf45bf6a3458e916129d1916001600160a01b039091169084906149ab565b60405180910390a1600d80546001600160a01b0319166001600160a01b0392909216919091179055565b5f612a06818361342d565b6001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015612a42573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611001919061452f565b5f611001826001613002565b5f604051637dc4dd1560e11b815260040160405180910390fd5b612a94612ebc565b5f612a9e82611e39565b6001600160a01b0381165f818152600260209081526040808320548151628bb5fb60e41b81529151959650949293926308bb5fb092600480840193919291829003018187875af1158015612af4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b18919061452f565b905061271082612b26610de8565b612b30919061456d565b612b3a9190614598565b612b4486836145e3565b1115612b635760405163e55fb50960e01b815260040160405180910390fd5b612b776001600160a01b03871684876132a4565b6040516356f4edaf60e01b81526001600160a01b038416906356f4edaf90612ba5908990899060040161460f565b6020604051808303815f875af1158015612bc1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612be59190614a0f565b612c0257604051630508c93960e41b815260040160405180910390fd5b7f921f9e77ef648025190d46d8b7f3d22a5546367ff7aaa883b1f39ffd2a2d325d868686604051612c3593929190614a2e565b60405180910390a1505050505050565b5f80612c4f61114c565b90505f612c5a612dba565b90505f5b82811015612cf457818181518110612c7857612c7861491d565b60200260200101516001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015612cbc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ce0919061452f565b612cea90856145e3565b9350600101612c5e565b50505090565b612d02612ebc565b6001600160a01b038116612d2957604051633480121760e21b815260040160405180910390fd5b600e546040517f2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc653066691612d68916001600160a01b039091169084906149ab565b60405180910390a1600e80546001600160a01b0319166001600160a01b0392909216919091179055565b5f611001825f61304c565b5f611001612daa83611fcd565b5f613002565b5f61100182611fcd565b6060610e425f6135c1565b5f80612dcf612fde565b6001600160a01b039485165f90815260019190910160209081526040808320959096168252939093525050205490565b600e546001600160a01b03163314612e2a57604051633480121760e21b815260040160405180910390fd5b600e54601254612e46916001600160a01b03169061255e61170a565b6012546040519081527f8a2034f45f83800eed1750a670ad845ceee6add62106ca5326598842cfbd6ea79060200160405180910390a15f601255565b612e8a612ebc565b6001600160a01b038116612eb3575f604051631e4fbdf760e01b815260040161266f919061411a565b612898816134a8565b33612ec561245c565b6001600160a01b0316146119c6573360405163118cdaa760e01b815260040161266f919061411a565b612f4683846001600160a01b031663a9059cbb8585604051602401612f1492919061460f565b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506135cd565b505050565b80471015612f6e573060405163cd78605960e01b815260040161266f919061411a565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612fb7576040519150601f19603f3d011682016040523d82523d5f602084013e612fbc565b606091505b5050905080612f4657604051630a12f52160e11b815260040160405180910390fd5b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0090565b5f61114561300e610de8565b6130199060016145e3565b6130245f600a614b2f565b61302c611113565b61303691906145e3565b85919085613625565b612f468383836001613672565b5f61114561305b82600a614b2f565b613063611113565b61306d91906145e3565b613075610de8565b6130369060016145e3565b5f611145836001600160a01b038416613753565b5f61309f8484612dc5565b90505f1981146130de57818110156130d057828183604051637dc7a0d960e11b815260040161266f93929190614a2e565b6130de84848484035f613672565b50505050565b6001600160a01b03831661310d575f604051634b637e8f60e11b815260040161266f919061411a565b6001600160a01b038216613136575f60405163ec442f0560e01b815260040161266f919061411a565b612f46838383613836565b5f611001825490565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e0090565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008054600119016131b257604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6131c0611e44565b156119c65760405163d93c066560e01b815260040160405180910390fd5b5f806131e9836119c8565b90508084111561321257828482604051633c8097d960e11b815260040161266f93929190614a2e565b61321b84612d92565b60408051868152602081018390529193506001600160a01b0385169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35092915050565b6040516001600160a01b0384811660248301528381166044830152606482018390526130de9186918216906323b872dd90608401612f14565b604051636eb1769f60e11b81525f906001600160a01b0385169063dd62ed3e906132d490309087906004016149ab565b602060405180830381865afa1580156132ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613313919061452f565b90506130de848461332485856145e3565b613959565b6001600160a01b038216613352575f60405163ec442f0560e01b815260040161266f919061411a565b61335d5f8383613836565b5050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b80825d5050565b6133966139e9565b5f61339f613438565b805460ff1916815590507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611108919061411a565b6133e1613a0e565b6119c6613a57565b6133f1613a0e565b6119c6613a73565b613401613a0e565b61335d8282613a7b565b613413613a0e565b61289881613aab565b613424613a0e565b61289881613ab3565b5f6111458383613b20565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330090565b5f80613467836119c8565b90508084111561349057828482604051633c8097d960e11b815260040161266f93929190614a2e565b5f61349a85612d92565b905061169533858784613b46565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b6135206131b8565b5f613529613438565b805460ff1916600117815590507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586133cc3390565b5f5f195f61356b85612a66565b905061169533858388613b46565b6001600160a01b0382166135a2575f604051634b637e8f60e11b815260040161266f919061411a565b61335d825f83613836565b5f611145836001600160a01b038416613bc1565b60605f61114583613c0d565b5f6135e16001600160a01b03841683613c66565b905080515f141580156136055750808060200190518101906136039190614a0f565b155b15612f465782604051635274afe760e01b815260040161266f919061411a565b5f80613632868686613c73565b905061363d83613d32565b801561365857505f848061365357613653614584565b868809115b1561277e576136686001826145e3565b9695505050505050565b5f61367b612fde565b90506001600160a01b0385166136a6575f60405163e602df0560e01b815260040161266f919061411a565b6001600160a01b0384166136cf575f604051634a1406b160e11b815260040161266f919061411a565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561374c57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161374391815260200190565b60405180910390a35b5050505050565b5f818152600183016020526040812054801561382d575f61377560018361455a565b85549091505f906137889060019061455a565b90508082146137e7575f865f0182815481106137a6576137a661491d565b905f5260205f200154905080875f0184815481106137c6576137c661491d565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806137f8576137f8614b3d565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050611001565b5f915050611001565b5f61383f612fde565b90506001600160a01b03841661386d5781816002015f82825461386291906145e3565b909155506138ca9050565b6001600160a01b0384165f90815260208290526040902054828110156138ac5784818460405163391434e360e21b815260040161266f93929190614a2e565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b0383166138e8576002810180548390039055613906565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161394b91815260200190565b60405180910390a350505050565b5f836001600160a01b031663095ea7b3848460405160240161397c92919061460f565b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505090506139b58482613d5e565b6130de576139df84856001600160a01b031663095ea7b3865f604051602401612f1492919061460f565b6130de84826135cd565b6139f1611e44565b6119c657604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166119c657604051631afcd79f60e31b815260040160405180910390fd5b613a5f613a0e565b5f613a68613438565b805460ff1916905550565b613361613a0e565b613a83613a0e565b5f613a8c612fde565b905060038101613a9c848261485e565b50600481016130de838261485e565b612e8a613a0e565b613abb613a0e565b5f613ac461314a565b90505f80613ad184613dfb565b9150915081613ae1576012613ae3565b805b83546001600160a81b031916600160a01b60ff92909216919091026001600160a01b031916176001600160a01b0394909416939093179091555050565b5f825f018281548110613b3557613b3561491d565b905f5260205f200154905092915050565b5f613b4f61314a565b8054909150613b69906001600160a01b031686308661326b565b613b738483613329565b836001600160a01b0316856001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78585604051613743929190918252602082015260400190565b5f818152600183016020526040812054613c0657508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155611001565b505f611001565b6060815f01805480602002602001604051908101604052809291908181526020018280548015613c5a57602002820191905f5260205f20905b815481526020019060010190808311613c46575b50505050509050919050565b606061114583835f613ed1565b5f838302815f1985870982811083820303915050805f03613ca757838281613c9d57613c9d614584565b0492505050611145565b808411613cc75760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f6002826003811115613d4757613d47614b51565b613d519190614b65565b60ff166001149050919050565b5f805f846001600160a01b031684604051613d799190614b86565b5f604051808303815f865af19150503d805f8114613db2576040519150601f19603f3d011682016040523d82523d5f602084013e613db7565b606091505b5091509150818015613de1575080511580613de1575080806020019051810190613de19190614a0f565b801561277e5750505050506001600160a01b03163b151590565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290515f918291829182916001600160a01b03871691613e4191614b86565b5f60405180830381855afa9150503d805f8114613e79576040519150601f19603f3d011682016040523d82523d5f602084013e613e7e565b606091505b5091509150818015613e9257506020815110155b15613ec5575f81806020019051810190613eac919061452f565b905060ff8111613ec3576001969095509350505050565b505b505f9485945092505050565b606081471015613ef6573060405163cd78605960e01b815260040161266f919061411a565b5f80856001600160a01b03168486604051613f119190614b86565b5f6040518083038185875af1925050503d805f8114613f4b576040519150601f19603f3d011682016040523d82523d5f602084013e613f50565b606091505b5091509150613668868383606082613f7057613f6b82613fae565b611145565b8151158015613f8757506001600160a01b0384163b155b15613fa75783604051639996b31560e01b815260040161266f919061411a565b5080611145565b805115613fbe5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b610dd680614b9d83390190565b80356001600160a01b0381168114613ffa575f80fd5b919050565b5f6020828403121561400f575f80fd5b61114582613fe4565b5f60208284031215614028575f80fd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611145602083018461402f565b5f8060408385031215614080575f80fd5b61408983613fe4565b946020939093013593505050565b5f805f606084860312156140a9575f80fd5b6140b284613fe4565b92506140c060208501613fe4565b9150604084013590509250925092565b5f805f80608085870312156140e3575f80fd5b6140ec85613fe4565b93506020850135925061410160408601613fe4565b915061410f60608601613fe4565b905092959194509250565b6001600160a01b0391909116815260200190565b5f8083601f84011261413e575f80fd5b5081356001600160401b03811115614154575f80fd5b60208301915083602082850101111561416b575f80fd5b9250929050565b5f8060208385031215614183575f80fd5b82356001600160401b03811115614198575f80fd5b6141a48582860161412e565b90969095509350505050565b5f8083601f8401126141c0575f80fd5b5081356001600160401b038111156141d6575f80fd5b6020830191508360208260051b850101111561416b575f80fd5b5f805f8060408587031215614203575f80fd5b84356001600160401b0380821115614219575f80fd5b614225888389016141b0565b9096509450602087013591508082111561423d575f80fd5b5061424a878288016141b0565b95989497509550505050565b5f8060408385031215614267575f80fd5b8235915061427760208401613fe4565b90509250929050565b5f8060408385031215614291575f80fd5b50508035926020909101359150565b602081526142ba6020820183516001600160a01b03169052565b5f60208301516101a08060408501526142d76101c085018361402f565b91506040850151601f198584030160608601526142f4838261402f565b92505060608501516080850152608085015160a085015260a085015160c085015260c085015160e085015260e0850151610100818187015280870151915050610120818187015280870151915050610140614359818701836001600160a01b03169052565b8601519050610160614375868201836001600160a01b03169052565b8601519050610180614391868201836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b5f805f805f60a086880312156143be575f80fd5b6143c786613fe4565b945060208601359350604086013592506143e360608701613fe4565b91506143f160808701613fe4565b90509295509295909350565b5f805f8060608587031215614410575f80fd5b61441985613fe4565b935060208501356001600160401b03811115614433575f80fd5b61443f8782880161412e565b9598909750949560400135949350505050565b5f805f60608486031215614464575f80fd5b8335925061447460208501613fe4565b915061448260408501613fe4565b90509250925092565b5f805f6060848603121561449d575f80fd5b6144a684613fe4565b95602085013595506040909401359392505050565b602080825282518282018190525f9190848201906040850190845b818110156144fb5783516001600160a01b0316835292840192918401916001016144d6565b50909695505050505050565b5f8060408385031215614518575f80fd5b61452183613fe4565b915061427760208401613fe4565b5f6020828403121561453f575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561100157611001614546565b808202811582820484141761100157611001614546565b634e487b7160e01b5f52601260045260245ffd5b5f826145a6576145a6614584565b500490565b600181811c908216806145bf57607f821691505b6020821081036145dd57634e487b7160e01b5f52602260045260245ffd5b50919050565b8082018082111561100157611001614546565b60ff818116838216019081111561100157611001614546565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b5f52604160045260245ffd5b6040516101a081016001600160401b038111828210171561465f5761465f614628565b60405290565b5f82601f830112614674575f80fd5b81356001600160401b038082111561468e5761468e614628565b604051601f8301601f19908116603f011681019082821181831017156146b6576146b6614628565b816040528381528660208588010111156146ce575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f602082840312156146fd575f80fd5b81356001600160401b0380821115614713575f80fd5b908301906101a08286031215614727575f80fd5b61472f61463c565b61473883613fe4565b815260208301358281111561474b575f80fd5b61475787828601614665565b60208301525060408301358281111561476e575f80fd5b61477a87828601614665565b604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101009150818301358282015261012091506147cf828401613fe4565b8282015261014091506147e3828401613fe4565b8282015261016091506147f7828401613fe4565b82820152610180915061480b828401613fe4565b91810191909152949350505050565b601f821115612f4657805f5260205f20601f840160051c8101602085101561483f5750805b601f840160051c820191505b8181101561374c575f815560010161484b565b81516001600160401b0381111561487757614877614628565b61488b8161488584546145ab565b8461481a565b602080601f8311600181146148be575f84156148a75750858301515b5f19600386901b1c1916600185901b178555614915565b5f85815260208120601f198616915b828110156148ec578886015182559484019460019091019084016148cd565b508582101561490957878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52603260045260245ffd5b604080825281018490525f8560608301825b87811015614971576001600160a01b0361495c84613fe4565b16825260209283019290910190600101614943565b5083810360208501528481526001600160fb1b03851115614990575f80fd5b8460051b915081866020830137016020019695505050505050565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0385811682528416602082015260606040820181905281018290525f828460808401375f608084840101526080601f19601f850116830101905095945050505050565b5f60208284031215614a1f575f80fd5b81518015158114611145575f80fd5b6001600160a01b039390931683526020830191909152604082015260600190565b600181815b80851115614a8957815f1904821115614a6f57614a6f614546565b80851615614a7c57918102915b93841c9390800290614a54565b509250929050565b5f82614a9f57506001611001565b81614aab57505f611001565b8160018114614ac15760028114614acb57614ae7565b6001915050611001565b60ff841115614adc57614adc614546565b50506001821b611001565b5060208310610133831016604e8410600b8410161715614b0a575081810a611001565b614b148383614a4f565b805f1904821115614b2757614b27614546565b029392505050565b5f61114560ff841683614a91565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f60ff831680614b7757614b77614584565b8060ff84160691505092915050565b5f82518060208501845e5f92019182525091905056fe60a0604052604051610dd6380380610dd68339810160408190526100229161036a565b828161002e828261008c565b50508160405161003d9061032e565b6001600160a01b039091168152602001604051809103905ff080158015610066573d5f803e3d5ffd5b506001600160a01b031660805261008461007f60805190565b6100ea565b50505061044b565b61009582610157565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156100de576100d982826101d5565b505050565b6100e6610248565b5050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6101295f80516020610db6833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a161015481610269565b50565b806001600160a01b03163b5f0361019157604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b60605f80846001600160a01b0316846040516101f19190610435565b5f60405180830381855af49150503d805f8114610229576040519150601f19603f3d011682016040523d82523d5f602084013e61022e565b606091505b50909250905061023f8583836102a6565b95945050505050565b34156102675760405163b398979f60e01b815260040160405180910390fd5b565b6001600160a01b03811661029257604051633173bdd160e11b81525f6004820152602401610188565b805f80516020610db68339815191526101b4565b6060826102bb576102b682610305565b6102fe565b81511580156102d257506001600160a01b0384163b155b156102fb57604051639996b31560e01b81526001600160a01b0385166004820152602401610188565b50805b9392505050565b8051156103155780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b610501806108b583390190565b80516001600160a01b0381168114610351575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561037c575f80fd5b6103858461033b565b92506103936020850161033b565b60408501519092506001600160401b03808211156103af575f80fd5b818601915086601f8301126103c2575f80fd5b8151818111156103d4576103d4610356565b604051601f8201601f19908116603f011681019083821181831017156103fc576103fc610356565b81604052828152896020848701011115610414575f80fd5b8260208601602083015e5f6020848301015280955050505050509250925092565b5f82518060208501845e5f920191825250919050565b6080516104536104625f395f601001526104535ff3fe608060405261000c61000e565b005b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361007a575f356001600160e01b03191663278f794360e11b14610070576040516334ad5dbb60e21b815260040160405180910390fd5b610078610082565b565b6100786100b0565b5f806100913660048184610303565b81019061009e919061033e565b915091506100ac82826100c0565b5050565b6100786100bb61011a565b610151565b6100c98261016f565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156101125761010d82826101ea565b505050565b6100ac61025c565b5f61014c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b365f80375f80365f845af43d5f803e80801561016b573d5ff35b3d5ffd5b806001600160a01b03163b5f036101a957604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102069190610407565b5f60405180830381855af49150503d805f811461023e576040519150601f19603f3d011682016040523d82523d5f602084013e610243565b606091505b509150915061025385838361027b565b95945050505050565b34156100785760405163b398979f60e01b815260040160405180910390fd5b6060826102905761028b826102da565b6102d3565b81511580156102a757506001600160a01b0384163b155b156102d057604051639996b31560e01b81526001600160a01b03851660048201526024016101a0565b50805b9392505050565b8051156102ea5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610311575f80fd5b8386111561031d575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561034f575f80fd5b82356001600160a01b0381168114610365575f80fd5b9150602083013567ffffffffffffffff80821115610381575f80fd5b818501915085601f830112610394575f80fd5b8135818111156103a6576103a661032a565b604051601f8201601f19908116603f011681019083821181831017156103ce576103ce61032a565b816040528281528860208487010111156103e6575f80fd5b826020860160208301375f6020848301015280955050505050509250929050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220117f216494c9098d12bbff87c8d584f4d545471f7a95c3c910c20d7f0d1a105964736f6c63430008190033608060405234801561000f575f80fd5b5060405161050138038061050183398101604081905261002e916100bb565b806001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100658161006c565b50506100e8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156100cb575f80fd5b81516001600160a01b03811681146100e1575f80fd5b9392505050565b61040c806100f55f395ff3fe608060405260043610610049575f3560e01c8063715018a61461004d5780638da5cb5b146100635780639623609d14610090578063ad3cb1cc146100a3578063f2fde38b146100e0575b5f80fd5b348015610058575f80fd5b506100616100ff565b005b34801561006e575f80fd5b505f546001600160a01b0316604051610087919061023e565b60405180910390f35b61006161009e36600461027a565b610112565b3480156100ae575f80fd5b506100d3604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100879190610377565b3480156100eb575f80fd5b506100616100fa366004610390565b61017d565b6101076101c3565b6101105f6101ef565b565b61011a6101c3565b60405163278f794360e11b81526001600160a01b03841690634f1ef28690349061014a90869086906004016103ab565b5f604051808303818588803b158015610161575f80fd5b505af1158015610173573d5f803e3d5ffd5b5050505050505050565b6101856101c3565b6001600160a01b0381166101b7575f604051631e4fbdf760e01b81526004016101ae919061023e565b60405180910390fd5b6101c0816101ef565b50565b5f546001600160a01b03163314610110573360405163118cdaa760e01b81526004016101ae919061023e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0391909116815260200190565b6001600160a01b03811681146101c0575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561028c575f80fd5b833561029781610252565b925060208401356102a781610252565b9150604084013567ffffffffffffffff808211156102c3575f80fd5b818601915086601f8301126102d6575f80fd5b8135818111156102e8576102e8610266565b604051601f8201601f19908116603f0116810190838211818310171561031057610310610266565b81604052828152896020848701011115610328575f80fd5b826020860160208301375f6020848301015280955050505050509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6103896020830184610349565b9392505050565b5f602082840312156103a0575f80fd5b813561038981610252565b6001600160a01b03831681526040602082018190525f906103ce90830184610349565b94935050505056fea2646970667358221220497e1225d21503b2c0e72feef0d5216fe1525afb4c43c9fa065eef75c65856e264736f6c63430008190033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103a2646970667358221220bf4cf7c299a2ba4ec1f7f72dc91e0a28b88017f2d3cab1b58ba355fb30165fb464736f6c63430008190033

Deployed Bytecode

0x6080604052600436106103fe575f3560e01c80638322fff21161020d578063b460af941161011a578063d905777e116100b3578063ed14d17e11610078578063ed14d17e14610c61578063ef8b30f714610b76578063f2fde38b14610c75578063f4ad878814610c94578063ffa1ad7414610ca9575f80fd5b8063d905777e14610bb4578063d9f9027f14610bd3578063d9fb643a14610bf4578063dd62ed3e14610c1b578063e00bfe5014610c3a575f80fd5b8063b460af9414610ab2578063ba08765214610ab2578063ba8bfa2a14610ad1578063bf6590a414610af0578063c0587a9514610b04578063c63d75b614610b37578063c69bebe414610b57578063c6e6f59214610b76578063ce96cb7714610b95575f80fd5b8063a7b73254116101a6578063ad5c46481161016b578063ad5c464814610a03578063b046a44914610a2a578063b0caa89114610a49578063b2db983a14610a74578063b3d7f6b914610a93575f80fd5b8063a7b732541461096c578063a9059cbb1461098b578063aa2f892d146109aa578063aaf5eb68146109c9578063ad35530b146109e4575f80fd5b80638322fff21461088d5780638456cb59146108b457806388bb4f60146108c85780638da5cb5b146108e957806394bf804d146108fd57806395d89b411461091c57806398e1862c146109305780639c016ffd146109445780639e65741e14610958575f80fd5b80633b0426db1161030b5780634cdad506116102a457806370a082311161026957806370a08231146107fd578063715018a61461081c5780637a825e07146108305780637f6c81b71461084f5780638152cd181461086e575f80fd5b80634cdad506146104a557806358fe922d146107845780635c975abb146107ab5780636d725a79146107bf5780636e553f65146107de575f80fd5b80633b0426db1461064e5780633bfaa7e3146106625780633c5280e41461068b5780633e9491a2146106aa5780633f4ba83a146106be578063402d267d146106d2578063439fab91146106f15780634a8c110a146107105780634b59b82e14610765575f80fd5b806318160ddd1161039757806329c23e4a1161035c57806329c23e4a146105b6578063313ce567146105d557806332507a5f146105fb578063340691571461060e57806338d52e0f1461062d575f80fd5b806318160ddd1461053157806323b872dd146105455780632489f7f71461056457806325bd414214610578578063266f8dc914610597575f80fd5b806301681a621461040957806301e1d1141461042a578063030d624a1461045157806306fdde0314610470578063079c3b881461049157806307a2d13a146104a5578063095ea7b3146104c45780630a28a477146104f3578063175188e814610512575f80fd5b3661040557005b5f80fd5b348015610414575f80fd5b50610428610423366004613fff565b610cd7565b005b348015610435575f80fd5b5061043e610de8565b6040519081526020015b60405180910390f35b34801561045c575f80fd5b5061042861046b366004614018565b610e47565b34801561047b575f80fd5b50610484610eb2565b604051610448919061405d565b34801561049c575f80fd5b5061043e610f50565b3480156104b0575f80fd5b5061043e6104bf366004614018565b610ff6565b3480156104cf575f80fd5b506104e36104de36600461406f565b611007565b6040519015158152602001610448565b3480156104fe575f80fd5b5061043e61050d366004614018565b61101e565b34801561051d575f80fd5b5061042861052c366004613fff565b61102a565b34801561053c575f80fd5b5061043e611113565b348015610550575f80fd5b506104e361055f366004614097565b611127565b34801561056f575f80fd5b5061043e61114c565b348015610583575f80fd5b50610428610592366004614018565b611156565b3480156105a2575f80fd5b506104286105b1366004614018565b6111c1565b3480156105c1575f80fd5b5061043e6105d0366004614018565b61122d565b3480156105e0575f80fd5b506105e961124a565b60405160ff9091168152602001610448565b61043e6106093660046140d0565b611273565b348015610619575f80fd5b50610428610628366004614018565b61169d565b348015610638575f80fd5b5061064161170a565b604051610448919061411a565b348015610659575f80fd5b5061043e611724565b34801561066d575f80fd5b50610676611757565b60408051928352602083019190915201610448565b348015610696575f80fd5b506104286106a5366004614018565b611949565b3480156106b5575f80fd5b5060125461043e565b3480156106c9575f80fd5b506104286119b6565b3480156106dd575f80fd5b5061043e6106ec366004613fff565b6119c8565b3480156106fc575f80fd5b5061042861070b366004614172565b6119de565b34801561071b575f80fd5b50610724611dd7565b60405161044891905f60a082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015292915050565b348015610770575f80fd5b5061064161077f366004614018565b611e39565b34801561078f575f80fd5b5061064173bf5495efe5db9ce00f80364c8b423567e58d211081565b3480156107b6575f80fd5b506104e3611e44565b3480156107ca575f80fd5b506104286107d93660046141f0565b611e58565b3480156107e9575f80fd5b5061043e6107f8366004614256565b611f2b565b348015610808575f80fd5b5061043e610817366004613fff565b611fcd565b348015610827575f80fd5b50610428611ff6565b34801561083b575f80fd5b5061042861084a366004613fff565b612007565b34801561085a575f80fd5b50610428610869366004614018565b61209f565b348015610879575f80fd5b50610428610888366004614280565b61210a565b348015610898575f80fd5b5061064173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156108bf575f80fd5b506104286121b8565b3480156108d3575f80fd5b506108dc612212565b60405161044891906142a0565b3480156108f4575f80fd5b5061064161245c565b348015610908575f80fd5b5061043e610917366004614256565b612484565b348015610927575f80fd5b5061048461249f565b34801561093b575f80fd5b5060115461043e565b34801561094f575f80fd5b506104286124bb565b348015610963575f80fd5b5060105461043e565b348015610977575f80fd5b5061043e6109863660046143aa565b6125a5565b348015610996575f80fd5b506104e36109a536600461406f565b612787565b3480156109b5575f80fd5b506104286109c4366004614018565b612794565b3480156109d4575f80fd5b5061043e670de0b6b3a764000081565b3480156109ef575f80fd5b506104286109fe3660046143fd565b61289b565b348015610a0e575f80fd5b5061064173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610a35575f80fd5b50610428610a44366004613fff565b612960565b348015610a54575f80fd5b5061043e610a63366004613fff565b60026020525f908152604090205481565b348015610a7f575f80fd5b5061043e610a8e366004614018565b6129fb565b348015610a9e575f80fd5b5061043e610aad366004614018565b612a66565b348015610abd575f80fd5b5061043e610acc366004614452565b612a72565b348015610adc575f80fd5b50610428610aeb36600461448b565b612a8c565b348015610afb575f80fd5b5061043e612c45565b348015610b0f575f80fd5b507f4995646f72fa9a270ffc094641ab616ce576b2e3eab25eaf05c15caa4f0e595d5c61043e565b348015610b42575f80fd5b5061043e610b51366004613fff565b505f1990565b348015610b62575f80fd5b50610428610b71366004613fff565b612cfa565b348015610b81575f80fd5b5061043e610b90366004614018565b612d92565b348015610ba0575f80fd5b5061043e610baf366004613fff565b612d9d565b348015610bbf575f80fd5b5061043e610bce366004613fff565b612db0565b348015610bde575f80fd5b50610be7612dba565b60405161044891906144bb565b348015610bff575f80fd5b50610641737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b348015610c26575f80fd5b5061043e610c35366004614507565b612dc5565b348015610c45575f80fd5b5061064173ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b348015610c6c575f80fd5b50610428612dff565b348015610c80575f80fd5b50610428610c8f366004613fff565b612e82565b348015610c9f575f80fd5b5061043e61271081565b348015610cb4575f80fd5b50610484604051806040016040528060038152602001620312e360ec1b81525081565b610cdf612ebc565b610ce761170a565b6001600160a01b0316816001600160a01b031603610d185760405163350b944160e11b815260040160405180910390fd5b6040516370a0823160e01b81525f906001600160a01b038316906370a0823190610d4690309060040161411a565b602060405180830381865afa158015610d61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d85919061452f565b9050610d9b6001600160a01b0383163383612eee565b478015610dac57610dac3382612f4b565b7f807273efecfbeb7ae7d3a2189d1ed5a7db80074eed86e7d80b10bb925cd1db7383604051610ddb919061411a565b60405180910390a1505050565b6009546014545f9190610dfb904261455a565b1115610e1a57604051631f4bcb2b60e01b815260040160405180910390fd5b670de0b6b3a7640000610e2b611113565b601054610e38919061456d565b610e429190614598565b905090565b610e4f612ebc565b6004811115610e71576040516309aa66eb60e01b815260040160405180910390fd5b60075460408051918252602082018390527f29b9d7a7d8a7a3ac22c295e4517723bc4e386eea60173e59e6da1dbd460cb409910160405180910390a1600755565b60605f610ebd612fde565b9050806003018054610ece906145ab565b80601f0160208091040260200160405190810160405280929190818152602001828054610efa906145ab565b8015610f455780601f10610f1c57610100808354040283529160200191610f45565b820191905f5260205f20905b815481529060010190602001808311610f2857829003601f168201915b505050505091505090565b6040516370a0823160e01b81525f90819073bf5495efe5db9ce00f80364c8b423567e58d2110906370a0823190610f8b90309060040161411a565b602060405180830381865afa158015610fa6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fca919061452f565b90505f610fd5612c45565b601254909150610fe583836145e3565b610fef919061455a565b9250505090565b5f611001825f613002565b92915050565b5f3361101481858561303f565b5060019392505050565b5f61100182600161304c565b611032612ebc565b5f816001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015611070573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611094919061452f565b11156110b35760405163e9ec812960e01b815260040160405180910390fd5b6110bd5f82613080565b506001600160a01b0381165f9081526002602052604080822091909155517fd3281a40d50ae838fe77dc627744037b8f0fc6a5711d66119a9b670c5cde41af9061110890839061411a565b60405180910390a150565b5f8061111d612fde565b6002015492915050565b5f33611134858285613094565b61113f8585856130e4565b60019150505b9392505050565b5f610e425f613141565b61115e612ebc565b60788111156111805760405163f4d1caab60e01b815260040160405180910390fd5b600b5460408051918252602082018390527f394967f6fe403cda0905b23e81b928c5ca79107000b1404c6b3185442f05213c910160405180910390a1600b55565b6111c9612ebc565b6105dc8111156111ec57604051630674143f60e01b815260040160405180910390fd5b600a5460408051918252602082018390527f63058ed61801434ac6bfe39e74400bed7f3ba09b7cb6294092974450727eb753910160405180910390a1600a55565b600b545f9061271090611240908461456d565b6110019190614598565b5f8061125461314a565b90505f815461126d9190600160a01b900460ff166145f6565b91505090565b5f61127c61316e565b6112846131b8565b73bf5495efe5db9ce00f80364c8b423567e58d210f196001600160a01b038616016112cf576112b384846131de565b90506112ca6001600160a01b03861633308761326b565b61162b565b73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b038616016114d45761131473ae7ab96520de3a18e5e111b5eaab095312d7fe8433308761326b565b6040516370a0823160e01b81525f9073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061134d90309060040161411a565b602060405180830381865afa158015611368573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c919061452f565b90506113c173ae7ab96520de3a18e5e111b5eaab095312d7fe847374a09653a083691711cf8215a6ab074bb4e99ef5876132a4565b6040516311f9fbc960e21b81527374a09653a083691711cf8215a6ab074bb4e99ef5906347e7ef249061140e9073ae7ab96520de3a18e5e111b5eaab095312d7fe8490899060040161460f565b5f604051808303815f87803b158015611425575f80fd5b505af1158015611437573d5f803e3d5ffd5b50506040516370a0823160e01b81525f925083915073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061147690309060040161411a565b602060405180830381865afa158015611491573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114b5919061452f565b6114bf919061455a565b90506114cb81866131de565b9250505061162b565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03861601611612576040516370a0823160e01b81525f9073bf5495efe5db9ce00f80364c8b423567e58d2110906370a082319061153290309060040161411a565b602060405180830381865afa15801561154d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611571919061452f565b90507374a09653a083691711cf8215a6ab074bb4e99ef56001600160a01b031663f6326fb3346040518263ffffffff1660e01b81526004015f604051808303818588803b1580156115c0575f80fd5b505af11580156115d2573d5f803e3d5ffd5b50506040516370a0823160e01b81525f935084925073bf5495efe5db9ce00f80364c8b423567e58d211091506370a082319061147690309060040161411a565b60405163350b944160e11b815260040160405180910390fd5b6116358382613329565b604080513381526001600160a01b03878116602083015281830187905285811660608301528416608082015290517f308d36d8f61bd4393536b6557142f55554c34d4ea2a3dbf54fe782b98889dfb29181900360a00190a1611695613361565b949350505050565b6116a5612ebc565b6203f4808111156116c95760405163e88d3ecb60e01b815260040160405180910390fd5b60095460408051918252602082018390527fcc5a4a7c466fc20af4119a7a26048791fdb55cbd401aff36ef2bfc639662b2e2910160405180910390a1600955565b5f8061171461314a565b546001600160a01b031692915050565b6014545f908190611735904261455a565b90508060036006015411611749575f61126d565b60095461126d90829061455a565b600d545f9081906001600160a01b031633146117865760405163bd72e29160e01b815260040160405180910390fd5b6010546117b4907f4995646f72fa9a270ffc094641ab616ce576b2e3eab25eaf05c15caa4f0e595d90613387565b426014555f6117c1611113565b9050805f036117d95750506010546012549091509091565b5f6117e2610f50565b9050816117f7670de0b6b3a76400008361456d565b6118019190614598565b601154909450841115611905576011545f0361182b57505050601181905560108190556012549091565b5f670de0b6b3a764000083601060010154611846919061456d565b6118509190614598565b61185a908361455a565b600a549091506127109061186e908361456d565b6118789190614598565b93508360106002015f82825461188e91906145e3565b90915550839050670de0b6b3a76400006118a8868561455a565b6118b2919061456d565b6118bc9190614598565b6010819055601181905560408051918252602082018690527f83d2ad38a3d31bbc70811535dd8943b0140df344c23e6e167ee1ca32f9a1a459910160405180910390a150611943565b6010849055604080518581525f60208201527f83d2ad38a3d31bbc70811535dd8943b0140df344c23e6e167ee1ca32f9a1a459910160405180910390a15b50509091565b611951612ebc565b62093a8081101561197557604051632011727b60e11b815260040160405180910390fd5b60085460408051918252602082018390527fcdbf56e2a82365307f9691ad933e9762726485d202543fe224f47447d79feaf0910160405180910390a1600855565b6119be612ebc565b6119c661338e565b565b5f6119d1610de8565b600654611001919061455a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015611a225750825b90505f826001600160401b03166001148015611a3d5750303b155b905081158015611a4b575080155b15611a695760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611a9357845460ff60401b1916600160401b1785555b5f611aa0878901896146ed565b9050611aaa6133d9565b611ab26133e9565b611ac4816020015182604001516133f9565b80516001600160a01b0316611aec576040516317dc37cb60e11b815260040160405180910390fd5b6101408101516001600160a01b0316611b1b576040516001626bbab960e11b0319815260040160405180910390fd5b6101208101516001600160a01b0316611b4757604051630b5eba9f60e41b815260040160405180910390fd5b6101608101516001600160a01b0316611b7357604051633480121760e21b815260040160405180910390fd5b68056bc75e2d6310000081606001511015611ba157604051633240d18160e21b815260040160405180910390fd5b600481608001511115611bc7576040516309aa66eb60e01b815260040160405180910390fd5b62093a808160a001511015611bef57604051632011727b60e11b815260040160405180910390fd5b6203f4808160c001511115611c175760405163e88d3ecb60e01b815260040160405180910390fd5b6105dc8160e001511115611c3e57604051630674143f60e01b815260040160405180910390fd5b60788161010001511115611c655760405163f4d1caab60e01b815260040160405180910390fd5b611c7381610120015161340b565b8051611c7e9061341c565b426013819055601455670de0b6b3a76400006010558051600380546001600160a01b0319166001600160a01b039092169190911781556020820151829190600490611cc9908261485e565b5060408201516002820190611cde908261485e565b50606082015160038201556080820151600482015560a0820151600582015560c0820151600682015560e0820151600782015561010082015160088201556101208201516009820180546001600160a01b03199081166001600160a01b0393841617909155610140840151600a840180548316918416919091179055610160840151600b84018054831691841691909117905561018090930151600c90920180549093169116179055508315611dce57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b611e046040518060a001604052805f81526020015f81526020015f81526020015f81526020015f81525090565b506040805160a08101825260105481526011546020820152601254918101919091526013546060820152601454608082015290565b5f611001818361342d565b5f80611e4e613438565b5460ff1692915050565b611e60612ebc565b828114611e805760405163251f56a160e21b815260040160405180910390fd5b5f805b84811015611ee657611eac848483818110611ea057611ea061491d565b90506020020135612d92565b9150611ede868683818110611ec357611ec361491d565b9050602002016020810190611ed89190613fff565b83613329565b600101611e83565b507ff248243b9aa9396c0ffe65aea2b7e81e374fdf007d3059f0fdeba8441b5d2e0f85858585604051611f1c9493929190614931565b60405180910390a15050505050565b5f611f3461316e565b611f3c6131b8565b5f198303611fb957611f4c61170a565b6001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401611f77919061411a565b602060405180830381865afa158015611f92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fb6919061452f565b92505b611fc3838361345c565b9050611001613361565b5f80611fd7612fde565b6001600160a01b039093165f9081526020939093525050604090205490565b611ffe612ebc565b6119c65f6134a8565b61200f612ebc565b6001600160a01b0381166120365760405163d214a59760e01b815260040160405180910390fd5b600f546040517fe74dd8b1f5f3d5328df682e649c08b085f09c2ce77b68e54329e8d30e2642f7891612075916001600160a01b039091169084906149ab565b60405180910390a1600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6120a7612ebc565b60065481116120c95760405163e9ec812960e01b815260040160405180910390fd5b60065460408051918252602082018390527f7f3306669f28a6aa13d0f709be2bd4f3e21d2f37aee9358846a50e1988ee4832910160405180910390a1600655565b612112612ebc565b801580612120575061271081115b1561213e5760405163e55fb50960e01b815260040160405180910390fd5b5f612149818461342d565b6001600160a01b0381165f908152600260209081526040918290205482519081529081018590529192507f7cd01dd3533c6dc08821cd303814de60aba1901f1531c3cbcd95d26ed924e9cf910160405180910390a16001600160a01b03165f9081526002602052604090205550565b6121c061245c565b6001600160a01b0316336001600160a01b0316141580156121ec5750600d546001600160a01b03163314155b1561220a5760405163e9ec812960e01b815260040160405180910390fd5b6119c6613518565b61229f604051806101a001604052805f6001600160a01b0316815260200160608152602001606081526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681525090565b604080516101a08101909152600380546001600160a01b03168252600480546020840191906122cd906145ab565b80601f01602080910402602001604051908101604052809291908181526020018280546122f9906145ab565b80156123445780601f1061231b57610100808354040283529160200191612344565b820191905f5260205f20905b81548152906001019060200180831161232757829003601f168201915b5050505050815260200160028201805461235d906145ab565b80601f0160208091040260200160405190810160405280929190818152602001828054612389906145ab565b80156123d45780601f106123ab576101008083540402835291602001916123d4565b820191905f5260205f20905b8154815290600101906020018083116123b757829003601f168201915b505050918352505060038201546020820152600482015460408201526005820154606082015260068201546080820152600782015460a0820152600882015460c082015260098201546001600160a01b0390811660e0830152600a8301548116610100830152600b8301548116610120830152600c9092015490911661014090910152919050565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300611714565b5f61248d61316e565b6124956131b8565b611fc3838361355e565b60605f6124aa612fde565b9050806004018054610ece906145ab565b600e546001600160a01b031633146124e657604051633480121760e21b815260040160405180910390fd5b6008546013544291906124f9908361455a565b101561251857604051631221b97b60e01b815260040160405180910390fd5b60138190556007545f906127109061252e610de8565b612538919061456d565b6125429190614598565b600e5490915061256e906001600160a01b03168261255e61170a565b6001600160a01b03169190612eee565b6040518181527f55ce6141cc7099e5baac44c64543a6d7fc4e37ebba0fcaa65fa1f2a9996ec5a59060200160405180910390a15050565b5f6125ae61316e565b6125b66131b8565b600f546001600160a01b031633146125e15760405163e9ec812960e01b815260040160405180910390fd5b601454421461260357604051631f4bcb2b60e01b815260040160405180910390fd5b5f19850361261b5761261482612db0565b9450612678565b61262482612db0565b8511156126785760405162461bcd60e51b815260206004820152601d60248201527f455243343632363a2072656465656d206d6f7265207468616e206d617800000060448201526064015b60405180910390fd5b336001600160a01b0383161461269357612693823387613094565b5f6126be670de0b6b3a76400006126aa878261455a565b6126b4908961456d565b6104bf9190614598565b90506126ca8387613579565b6126d38161122d565b6126dd908261455a565b915073bf5495efe5db9ce00f80364c8b423567e58d210f196001600160a01b038816016116125761272373bf5495efe5db9ce00f80364c8b423567e58d21108584612eee565b604080516001600160a01b03898116825260208201899052868116828401528516606082015290517f4e19afb1df46d77083cc4e520735afa0cdc2d763d6bc5d710661c3dbb35f4c4d9181900360800190a15061277e613361565b95945050505050565b5f336110148185856130e4565b61279c61316e565b6127a46131b8565b805f036127c457604051637ea773a960e01b815260040160405180910390fd5b600f546127dc9033906001600160a01b0316836130e4565b600f546040516336c69b5d60e11b81526001600160a01b0390911690636d8d36ba9061280e903390859060040161460f565b5f604051808303815f87803b158015612825575f80fd5b505af1158015612837573d5f803e3d5ffd5b505050507ff9fd31dd1a61b95c600dd5aa1a6330f6c5cbe70a39a660edc081daf217db3cfb338261286661170a565b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a1612898613361565b50565b6128a3612ebc565b8015806128b1575061271081115b156128cf5760405163e55fb50960e01b815260040160405180910390fd5b5f843385856040516128e090613fd7565b6128ed94939291906149c5565b604051809103905ff080158015612906573d5f803e3d5ffd5b506001600160a01b0381165f90815260026020526040812084905590915061292e90826135ad565b507f0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb8186604051611f1c9291906149ab565b612968612ebc565b6001600160a01b038116612992576040516001626bbab960e11b0319815260040160405180910390fd5b600d546040517fe2eeab472f89ac267be30e463da684fb96f56cc8e947839361fdf45bf6a3458e916129d1916001600160a01b039091169084906149ab565b60405180910390a1600d80546001600160a01b0319166001600160a01b0392909216919091179055565b5f612a06818361342d565b6001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015612a42573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611001919061452f565b5f611001826001613002565b5f604051637dc4dd1560e11b815260040160405180910390fd5b612a94612ebc565b5f612a9e82611e39565b6001600160a01b0381165f818152600260209081526040808320548151628bb5fb60e41b81529151959650949293926308bb5fb092600480840193919291829003018187875af1158015612af4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b18919061452f565b905061271082612b26610de8565b612b30919061456d565b612b3a9190614598565b612b4486836145e3565b1115612b635760405163e55fb50960e01b815260040160405180910390fd5b612b776001600160a01b03871684876132a4565b6040516356f4edaf60e01b81526001600160a01b038416906356f4edaf90612ba5908990899060040161460f565b6020604051808303815f875af1158015612bc1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612be59190614a0f565b612c0257604051630508c93960e41b815260040160405180910390fd5b7f921f9e77ef648025190d46d8b7f3d22a5546367ff7aaa883b1f39ffd2a2d325d868686604051612c3593929190614a2e565b60405180910390a1505050505050565b5f80612c4f61114c565b90505f612c5a612dba565b90505f5b82811015612cf457818181518110612c7857612c7861491d565b60200260200101516001600160a01b03166308bb5fb06040518163ffffffff1660e01b81526004016020604051808303815f875af1158015612cbc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ce0919061452f565b612cea90856145e3565b9350600101612c5e565b50505090565b612d02612ebc565b6001600160a01b038116612d2957604051633480121760e21b815260040160405180910390fd5b600e546040517f2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc653066691612d68916001600160a01b039091169084906149ab565b60405180910390a1600e80546001600160a01b0319166001600160a01b0392909216919091179055565b5f611001825f61304c565b5f611001612daa83611fcd565b5f613002565b5f61100182611fcd565b6060610e425f6135c1565b5f80612dcf612fde565b6001600160a01b039485165f90815260019190910160209081526040808320959096168252939093525050205490565b600e546001600160a01b03163314612e2a57604051633480121760e21b815260040160405180910390fd5b600e54601254612e46916001600160a01b03169061255e61170a565b6012546040519081527f8a2034f45f83800eed1750a670ad845ceee6add62106ca5326598842cfbd6ea79060200160405180910390a15f601255565b612e8a612ebc565b6001600160a01b038116612eb3575f604051631e4fbdf760e01b815260040161266f919061411a565b612898816134a8565b33612ec561245c565b6001600160a01b0316146119c6573360405163118cdaa760e01b815260040161266f919061411a565b612f4683846001600160a01b031663a9059cbb8585604051602401612f1492919061460f565b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506135cd565b505050565b80471015612f6e573060405163cd78605960e01b815260040161266f919061411a565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612fb7576040519150601f19603f3d011682016040523d82523d5f602084013e612fbc565b606091505b5050905080612f4657604051630a12f52160e11b815260040160405180910390fd5b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0090565b5f61114561300e610de8565b6130199060016145e3565b6130245f600a614b2f565b61302c611113565b61303691906145e3565b85919085613625565b612f468383836001613672565b5f61114561305b82600a614b2f565b613063611113565b61306d91906145e3565b613075610de8565b6130369060016145e3565b5f611145836001600160a01b038416613753565b5f61309f8484612dc5565b90505f1981146130de57818110156130d057828183604051637dc7a0d960e11b815260040161266f93929190614a2e565b6130de84848484035f613672565b50505050565b6001600160a01b03831661310d575f604051634b637e8f60e11b815260040161266f919061411a565b6001600160a01b038216613136575f60405163ec442f0560e01b815260040161266f919061411a565b612f46838383613836565b5f611001825490565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e0090565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008054600119016131b257604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6131c0611e44565b156119c65760405163d93c066560e01b815260040160405180910390fd5b5f806131e9836119c8565b90508084111561321257828482604051633c8097d960e11b815260040161266f93929190614a2e565b61321b84612d92565b60408051868152602081018390529193506001600160a01b0385169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35092915050565b6040516001600160a01b0384811660248301528381166044830152606482018390526130de9186918216906323b872dd90608401612f14565b604051636eb1769f60e11b81525f906001600160a01b0385169063dd62ed3e906132d490309087906004016149ab565b602060405180830381865afa1580156132ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613313919061452f565b90506130de848461332485856145e3565b613959565b6001600160a01b038216613352575f60405163ec442f0560e01b815260040161266f919061411a565b61335d5f8383613836565b5050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b80825d5050565b6133966139e9565b5f61339f613438565b805460ff1916815590507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611108919061411a565b6133e1613a0e565b6119c6613a57565b6133f1613a0e565b6119c6613a73565b613401613a0e565b61335d8282613a7b565b613413613a0e565b61289881613aab565b613424613a0e565b61289881613ab3565b5f6111458383613b20565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330090565b5f80613467836119c8565b90508084111561349057828482604051633c8097d960e11b815260040161266f93929190614a2e565b5f61349a85612d92565b905061169533858784613b46565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b6135206131b8565b5f613529613438565b805460ff1916600117815590507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586133cc3390565b5f5f195f61356b85612a66565b905061169533858388613b46565b6001600160a01b0382166135a2575f604051634b637e8f60e11b815260040161266f919061411a565b61335d825f83613836565b5f611145836001600160a01b038416613bc1565b60605f61114583613c0d565b5f6135e16001600160a01b03841683613c66565b905080515f141580156136055750808060200190518101906136039190614a0f565b155b15612f465782604051635274afe760e01b815260040161266f919061411a565b5f80613632868686613c73565b905061363d83613d32565b801561365857505f848061365357613653614584565b868809115b1561277e576136686001826145e3565b9695505050505050565b5f61367b612fde565b90506001600160a01b0385166136a6575f60405163e602df0560e01b815260040161266f919061411a565b6001600160a01b0384166136cf575f604051634a1406b160e11b815260040161266f919061411a565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561374c57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161374391815260200190565b60405180910390a35b5050505050565b5f818152600183016020526040812054801561382d575f61377560018361455a565b85549091505f906137889060019061455a565b90508082146137e7575f865f0182815481106137a6576137a661491d565b905f5260205f200154905080875f0184815481106137c6576137c661491d565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806137f8576137f8614b3d565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050611001565b5f915050611001565b5f61383f612fde565b90506001600160a01b03841661386d5781816002015f82825461386291906145e3565b909155506138ca9050565b6001600160a01b0384165f90815260208290526040902054828110156138ac5784818460405163391434e360e21b815260040161266f93929190614a2e565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b0383166138e8576002810180548390039055613906565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161394b91815260200190565b60405180910390a350505050565b5f836001600160a01b031663095ea7b3848460405160240161397c92919061460f565b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505090506139b58482613d5e565b6130de576139df84856001600160a01b031663095ea7b3865f604051602401612f1492919061460f565b6130de84826135cd565b6139f1611e44565b6119c657604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166119c657604051631afcd79f60e31b815260040160405180910390fd5b613a5f613a0e565b5f613a68613438565b805460ff1916905550565b613361613a0e565b613a83613a0e565b5f613a8c612fde565b905060038101613a9c848261485e565b50600481016130de838261485e565b612e8a613a0e565b613abb613a0e565b5f613ac461314a565b90505f80613ad184613dfb565b9150915081613ae1576012613ae3565b805b83546001600160a81b031916600160a01b60ff92909216919091026001600160a01b031916176001600160a01b0394909416939093179091555050565b5f825f018281548110613b3557613b3561491d565b905f5260205f200154905092915050565b5f613b4f61314a565b8054909150613b69906001600160a01b031686308661326b565b613b738483613329565b836001600160a01b0316856001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78585604051613743929190918252602082015260400190565b5f818152600183016020526040812054613c0657508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155611001565b505f611001565b6060815f01805480602002602001604051908101604052809291908181526020018280548015613c5a57602002820191905f5260205f20905b815481526020019060010190808311613c46575b50505050509050919050565b606061114583835f613ed1565b5f838302815f1985870982811083820303915050805f03613ca757838281613c9d57613c9d614584565b0492505050611145565b808411613cc75760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f6002826003811115613d4757613d47614b51565b613d519190614b65565b60ff166001149050919050565b5f805f846001600160a01b031684604051613d799190614b86565b5f604051808303815f865af19150503d805f8114613db2576040519150601f19603f3d011682016040523d82523d5f602084013e613db7565b606091505b5091509150818015613de1575080511580613de1575080806020019051810190613de19190614a0f565b801561277e5750505050506001600160a01b03163b151590565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290515f918291829182916001600160a01b03871691613e4191614b86565b5f60405180830381855afa9150503d805f8114613e79576040519150601f19603f3d011682016040523d82523d5f602084013e613e7e565b606091505b5091509150818015613e9257506020815110155b15613ec5575f81806020019051810190613eac919061452f565b905060ff8111613ec3576001969095509350505050565b505b505f9485945092505050565b606081471015613ef6573060405163cd78605960e01b815260040161266f919061411a565b5f80856001600160a01b03168486604051613f119190614b86565b5f6040518083038185875af1925050503d805f8114613f4b576040519150601f19603f3d011682016040523d82523d5f602084013e613f50565b606091505b5091509150613668868383606082613f7057613f6b82613fae565b611145565b8151158015613f8757506001600160a01b0384163b155b15613fa75783604051639996b31560e01b815260040161266f919061411a565b5080611145565b805115613fbe5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b610dd680614b9d83390190565b80356001600160a01b0381168114613ffa575f80fd5b919050565b5f6020828403121561400f575f80fd5b61114582613fe4565b5f60208284031215614028575f80fd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611145602083018461402f565b5f8060408385031215614080575f80fd5b61408983613fe4565b946020939093013593505050565b5f805f606084860312156140a9575f80fd5b6140b284613fe4565b92506140c060208501613fe4565b9150604084013590509250925092565b5f805f80608085870312156140e3575f80fd5b6140ec85613fe4565b93506020850135925061410160408601613fe4565b915061410f60608601613fe4565b905092959194509250565b6001600160a01b0391909116815260200190565b5f8083601f84011261413e575f80fd5b5081356001600160401b03811115614154575f80fd5b60208301915083602082850101111561416b575f80fd5b9250929050565b5f8060208385031215614183575f80fd5b82356001600160401b03811115614198575f80fd5b6141a48582860161412e565b90969095509350505050565b5f8083601f8401126141c0575f80fd5b5081356001600160401b038111156141d6575f80fd5b6020830191508360208260051b850101111561416b575f80fd5b5f805f8060408587031215614203575f80fd5b84356001600160401b0380821115614219575f80fd5b614225888389016141b0565b9096509450602087013591508082111561423d575f80fd5b5061424a878288016141b0565b95989497509550505050565b5f8060408385031215614267575f80fd5b8235915061427760208401613fe4565b90509250929050565b5f8060408385031215614291575f80fd5b50508035926020909101359150565b602081526142ba6020820183516001600160a01b03169052565b5f60208301516101a08060408501526142d76101c085018361402f565b91506040850151601f198584030160608601526142f4838261402f565b92505060608501516080850152608085015160a085015260a085015160c085015260c085015160e085015260e0850151610100818187015280870151915050610120818187015280870151915050610140614359818701836001600160a01b03169052565b8601519050610160614375868201836001600160a01b03169052565b8601519050610180614391868201836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b5f805f805f60a086880312156143be575f80fd5b6143c786613fe4565b945060208601359350604086013592506143e360608701613fe4565b91506143f160808701613fe4565b90509295509295909350565b5f805f8060608587031215614410575f80fd5b61441985613fe4565b935060208501356001600160401b03811115614433575f80fd5b61443f8782880161412e565b9598909750949560400135949350505050565b5f805f60608486031215614464575f80fd5b8335925061447460208501613fe4565b915061448260408501613fe4565b90509250925092565b5f805f6060848603121561449d575f80fd5b6144a684613fe4565b95602085013595506040909401359392505050565b602080825282518282018190525f9190848201906040850190845b818110156144fb5783516001600160a01b0316835292840192918401916001016144d6565b50909695505050505050565b5f8060408385031215614518575f80fd5b61452183613fe4565b915061427760208401613fe4565b5f6020828403121561453f575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561100157611001614546565b808202811582820484141761100157611001614546565b634e487b7160e01b5f52601260045260245ffd5b5f826145a6576145a6614584565b500490565b600181811c908216806145bf57607f821691505b6020821081036145dd57634e487b7160e01b5f52602260045260245ffd5b50919050565b8082018082111561100157611001614546565b60ff818116838216019081111561100157611001614546565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b5f52604160045260245ffd5b6040516101a081016001600160401b038111828210171561465f5761465f614628565b60405290565b5f82601f830112614674575f80fd5b81356001600160401b038082111561468e5761468e614628565b604051601f8301601f19908116603f011681019082821181831017156146b6576146b6614628565b816040528381528660208588010111156146ce575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f602082840312156146fd575f80fd5b81356001600160401b0380821115614713575f80fd5b908301906101a08286031215614727575f80fd5b61472f61463c565b61473883613fe4565b815260208301358281111561474b575f80fd5b61475787828601614665565b60208301525060408301358281111561476e575f80fd5b61477a87828601614665565b604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101009150818301358282015261012091506147cf828401613fe4565b8282015261014091506147e3828401613fe4565b8282015261016091506147f7828401613fe4565b82820152610180915061480b828401613fe4565b91810191909152949350505050565b601f821115612f4657805f5260205f20601f840160051c8101602085101561483f5750805b601f840160051c820191505b8181101561374c575f815560010161484b565b81516001600160401b0381111561487757614877614628565b61488b8161488584546145ab565b8461481a565b602080601f8311600181146148be575f84156148a75750858301515b5f19600386901b1c1916600185901b178555614915565b5f85815260208120601f198616915b828110156148ec578886015182559484019460019091019084016148cd565b508582101561490957878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52603260045260245ffd5b604080825281018490525f8560608301825b87811015614971576001600160a01b0361495c84613fe4565b16825260209283019290910190600101614943565b5083810360208501528481526001600160fb1b03851115614990575f80fd5b8460051b915081866020830137016020019695505050505050565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0385811682528416602082015260606040820181905281018290525f828460808401375f608084840101526080601f19601f850116830101905095945050505050565b5f60208284031215614a1f575f80fd5b81518015158114611145575f80fd5b6001600160a01b039390931683526020830191909152604082015260600190565b600181815b80851115614a8957815f1904821115614a6f57614a6f614546565b80851615614a7c57918102915b93841c9390800290614a54565b509250929050565b5f82614a9f57506001611001565b81614aab57505f611001565b8160018114614ac15760028114614acb57614ae7565b6001915050611001565b60ff841115614adc57614adc614546565b50506001821b611001565b5060208310610133831016604e8410600b8410161715614b0a575081810a611001565b614b148383614a4f565b805f1904821115614b2757614b27614546565b029392505050565b5f61114560ff841683614a91565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f60ff831680614b7757614b77614584565b8060ff84160691505092915050565b5f82518060208501845e5f92019182525091905056fe60a0604052604051610dd6380380610dd68339810160408190526100229161036a565b828161002e828261008c565b50508160405161003d9061032e565b6001600160a01b039091168152602001604051809103905ff080158015610066573d5f803e3d5ffd5b506001600160a01b031660805261008461007f60805190565b6100ea565b50505061044b565b61009582610157565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156100de576100d982826101d5565b505050565b6100e6610248565b5050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6101295f80516020610db6833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a161015481610269565b50565b806001600160a01b03163b5f0361019157604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b60605f80846001600160a01b0316846040516101f19190610435565b5f60405180830381855af49150503d805f8114610229576040519150601f19603f3d011682016040523d82523d5f602084013e61022e565b606091505b50909250905061023f8583836102a6565b95945050505050565b34156102675760405163b398979f60e01b815260040160405180910390fd5b565b6001600160a01b03811661029257604051633173bdd160e11b81525f6004820152602401610188565b805f80516020610db68339815191526101b4565b6060826102bb576102b682610305565b6102fe565b81511580156102d257506001600160a01b0384163b155b156102fb57604051639996b31560e01b81526001600160a01b0385166004820152602401610188565b50805b9392505050565b8051156103155780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b610501806108b583390190565b80516001600160a01b0381168114610351575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561037c575f80fd5b6103858461033b565b92506103936020850161033b565b60408501519092506001600160401b03808211156103af575f80fd5b818601915086601f8301126103c2575f80fd5b8151818111156103d4576103d4610356565b604051601f8201601f19908116603f011681019083821181831017156103fc576103fc610356565b81604052828152896020848701011115610414575f80fd5b8260208601602083015e5f6020848301015280955050505050509250925092565b5f82518060208501845e5f920191825250919050565b6080516104536104625f395f601001526104535ff3fe608060405261000c61000e565b005b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361007a575f356001600160e01b03191663278f794360e11b14610070576040516334ad5dbb60e21b815260040160405180910390fd5b610078610082565b565b6100786100b0565b5f806100913660048184610303565b81019061009e919061033e565b915091506100ac82826100c0565b5050565b6100786100bb61011a565b610151565b6100c98261016f565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156101125761010d82826101ea565b505050565b6100ac61025c565b5f61014c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b365f80375f80365f845af43d5f803e80801561016b573d5ff35b3d5ffd5b806001600160a01b03163b5f036101a957604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102069190610407565b5f60405180830381855af49150503d805f811461023e576040519150601f19603f3d011682016040523d82523d5f602084013e610243565b606091505b509150915061025385838361027b565b95945050505050565b34156100785760405163b398979f60e01b815260040160405180910390fd5b6060826102905761028b826102da565b6102d3565b81511580156102a757506001600160a01b0384163b155b156102d057604051639996b31560e01b81526001600160a01b03851660048201526024016101a0565b50805b9392505050565b8051156102ea5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610311575f80fd5b8386111561031d575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561034f575f80fd5b82356001600160a01b0381168114610365575f80fd5b9150602083013567ffffffffffffffff80821115610381575f80fd5b818501915085601f830112610394575f80fd5b8135818111156103a6576103a661032a565b604051601f8201601f19908116603f011681019083821181831017156103ce576103ce61032a565b816040528281528860208487010111156103e6575f80fd5b826020860160208301375f6020848301015280955050505050509250929050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220117f216494c9098d12bbff87c8d584f4d545471f7a95c3c910c20d7f0d1a105964736f6c63430008190033608060405234801561000f575f80fd5b5060405161050138038061050183398101604081905261002e916100bb565b806001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100658161006c565b50506100e8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156100cb575f80fd5b81516001600160a01b03811681146100e1575f80fd5b9392505050565b61040c806100f55f395ff3fe608060405260043610610049575f3560e01c8063715018a61461004d5780638da5cb5b146100635780639623609d14610090578063ad3cb1cc146100a3578063f2fde38b146100e0575b5f80fd5b348015610058575f80fd5b506100616100ff565b005b34801561006e575f80fd5b505f546001600160a01b0316604051610087919061023e565b60405180910390f35b61006161009e36600461027a565b610112565b3480156100ae575f80fd5b506100d3604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100879190610377565b3480156100eb575f80fd5b506100616100fa366004610390565b61017d565b6101076101c3565b6101105f6101ef565b565b61011a6101c3565b60405163278f794360e11b81526001600160a01b03841690634f1ef28690349061014a90869086906004016103ab565b5f604051808303818588803b158015610161575f80fd5b505af1158015610173573d5f803e3d5ffd5b5050505050505050565b6101856101c3565b6001600160a01b0381166101b7575f604051631e4fbdf760e01b81526004016101ae919061023e565b60405180910390fd5b6101c0816101ef565b50565b5f546001600160a01b03163314610110573360405163118cdaa760e01b81526004016101ae919061023e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0391909116815260200190565b6001600160a01b03811681146101c0575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561028c575f80fd5b833561029781610252565b925060208401356102a781610252565b9150604084013567ffffffffffffffff808211156102c3575f80fd5b818601915086601f8301126102d6575f80fd5b8135818111156102e8576102e8610266565b604051601f8201601f19908116603f0116810190838211818310171561031057610310610266565b81604052828152896020848701011115610328575f80fd5b826020860160208301375f6020848301015280955050505050509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6103896020830184610349565b9392505050565b5f602082840312156103a0575f80fd5b813561038981610252565b6001600160a01b03831681526040602082018190525f906103ce90830184610349565b94935050505056fea2646970667358221220497e1225d21503b2c0e72feef0d5216fe1525afb4c43c9fa065eef75c65856e264736f6c63430008190033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103a2646970667358221220bf4cf7c299a2ba4ec1f7f72dc91e0a28b88017f2d3cab1b58ba355fb30165fb464736f6c63430008190033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.