MON Price: $0.022014 (-5.24%)

Contract

0x4C09558A0d000240726679fC3805c3918922d6C6

Overview

MON Balance

Monad Chain LogoMonad Chain LogoMonad Chain Logo0 MON

MON Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unpause Deposits485961322026-01-14 5:54:1441 hrs ago1768370054IN
0x4C09558A...18922d6C6
0 MON0.00954077102
Update Settle Qu...388244272025-11-29 19:40:1347 days ago1764445213IN
0x4C09558A...18922d6C6
0 MON0.01836775102
Pause Deposits388243992025-11-29 19:40:0247 days ago1764445202IN
0x4C09558A...18922d6C6
0 MON0.01357354102
Redeem388228492025-11-29 19:29:3247 days ago1764444572IN
0x4C09558A...18922d6C6
0 MON0.10692751101.94
Update Settle Qu...381216602025-11-26 13:04:0750 days ago1764162247IN
0x4C09558A...18922d6C6
0 MON0.01462778150.4885
Redeem381213912025-11-26 13:02:1950 days ago1764162139IN
0x4C09558A...18922d6C6
0 MON0.13235142148.95750107
Deposit381129282025-11-26 12:05:4350 days ago1764158743IN
0x4C09558A...18922d6C6
0 MON0.10277449157.49529306
Deposit380973342025-11-26 10:21:2850 days ago1764152488IN
0x4C09558A...18922d6C6
0 MON0.08939079150.94747963
Set Virtualizati...380807502025-11-26 8:30:3950 days ago1764145839IN
0x4C09558A...18922d6C6
0 MON0.01190883101.94
Set Price Oracle380806372025-11-26 8:29:5350 days ago1764145793IN
0x4C09558A...18922d6C6
0 MON0.00922077101.94
Add Adapter380804192025-11-26 8:28:2650 days ago1764145706IN
0x4C09558A...18922d6C6
0 MON0.01373382102.8227

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BaseVault

Compiler Version
v0.8.30+commit.73712a01

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : BaseVault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.20;

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

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {OwnableDelayModule} from "./OwnableDelayModule.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./interfaces/IStrategyAdapter.sol";
import {AggregatorV3Interface} from "./interfaces/AggregatorV3Interface.sol";

/**
 * @title BaseVault
 * @author atars
 * @notice A simplified multi-adapter ERC-4626 vault that aggregates TVL from strategy adapters
 */
contract BaseVault is ERC4626, OwnableDelayModule, ReentrancyGuard, Pausable {
    using SafeERC20 for IERC20;

    // --- State Variables ---

    address[] public adapters;

    /// @notice Maximum number of adapters to prevent DoS
    uint256 public maxAdapters;

    /// @notice Emergency withdraw flag
    bool public emergencyMode;

    /// @notice Safe wallet address where assets are transferred upon deposit
    address public safeWallet;

    /// @notice Safe wallet address in queue (still to be accepted)
    address public safeWalletQueued;

    /// @notice Controller address for operational functions
    address public controller;

    uint256 public minWithdraw;
    uint256 public minDeposit;

    /// @notice priceOracles address for chainlink oracles
    mapping(address => address) internal priceOracles;

    /// @notice Mapping of stale window (max age in seconds) per Chainlink oracle
    mapping(address => uint256) public staleWindow;

    mapping(address => mapping(uint256 => uint256))
        public userActiveRequestCount;
    uint256 public maxReqPerUser;

    // --- Withdrawal Queue System ---

    /// @notice Struct to track withdrawal requests
    struct WithdrawalRequest {
        address user; // User who requested withdrawal
        address receiver; // Address to receive USDC
        uint256 shares; // Amount of shares to withdraw
        uint256 timestamp; // When the request was made
        uint256 settleCounter; // Settlement counter when request was made
        bool settled; // Whether this request has been settled
    }

    /// @notice Counter for withdrawal request IDs
    uint256 public withdrawalRequestCounter;
    uint256 public latestWithdrawRequests;

    /// @notice Mapping from request ID to withdrawal request
    mapping(uint256 => WithdrawalRequest) public withdrawalRequests;

    mapping(address => bool) public isAdapter;

    /// @notice Array of active (unsettled) request IDs for processing
    uint256[] public activeRequestIds;

    /// @notice Mapping to track if a request ID is active (for O(1) lookups)
    mapping(uint256 => bool) public isActiveRequest;

    /// @notice Total shares currently queued for withdrawal
    uint256 public totalQueuedShares;

    /// @notice Current settlement queue counter for batch processing
    uint256 public settleQueueCounter;
    uint256 public defaultSettleQueueLimit;

    /// @notice Maximum allowed NAV deviation during settlement (in basis points, default 500 = 5%)
    uint256 public maxSettlementSlippage = 500;

    // --- Virtualization parameters ---
    // These are *scaled dynamically* based on asset decimals
    uint256 public virtualAssetsBase; // 1e3 is equivalent to 0.001 units of the asset
    uint256 public virtualSharesBase; // 1e15 is 0.001 shares (assuming 18 decimals)
    bool private virtualizationConfigured; // prevents reconfiguration

    mapping(uint256 => uint256) public settleQueueLimit;

    /// @notice Mapping from settle counter to total queued shares for that batch
    mapping(uint256 => uint256) public queuedSharesByCounter;

    /// @notice Mapping to track which settlement counters have been settled
    mapping(uint256 => bool) public isCounterSettled;

    /// @notice Flag to pause new withdrawal requests during settlement
    bool public withdrawalsPaused;

    /// @notice Flag to pause deposits/mints when adapters fail
    bool public depositsQuarantined;

    bool internal internalTransfer;

    /// @notice Flag to pause deposits controlled by controller
    bool public depositPauseStatus;

    /// @notice Minimum requests required before allowing counter increment
    uint256 public constant MIN_REQUESTS_FOR_COUNTER_UPDATE = 1;

    /// @notice Mapping to track quarantined (failed) adapters
    mapping(address => bool) public quarantinedAdapters;

    // --- INITIAL_NAV = 1 Constants ---

    /// @notice Initial NAV when totalSupply is 0 (1 USD per share in 18 decimals)
    uint256 private constant INITIAL_NAV = 1 * 1e18;

    // --- Events ---

    event AdapterAdded(address indexed adapter);
    event AdapterRemoved(address indexed adapter);
    event MaxAdaptersUpdated(uint256 oldMax, uint256 newMax);
    event SafeWalletUpdated(
        address indexed oldSafeWallet,
        address indexed newSafeWallet
    );
    event SafeWalletQueued(address indexed newSafeWallet);
    event ControllerUpdated(
        address indexed oldController,
        address indexed newController
    );
    event FundsDeployed(
        address indexed adapter,
        uint256 amount,
        uint256 deployed
    );
    event EmergencyModeToggled(bool enabled);
    event WithdrawalRequested(
        address indexed owner,
        address indexed receiver,
        uint256 shares,
        uint256 requestId,
        uint256 currentNAV
    );
    event WithdrawalsPaused();
    event WithdrawalsUnpaused();
    event QueueSettled(
        uint256 totalUSDCPaid,
        uint256 totalSharesSettled,
        uint256 settlementNAV,
        uint256 requestsSettled
    );
    event WithdrawalSettled(
        uint256 indexed requestId,
        address indexed user,
        address indexed receiver,
        uint256 shares,
        uint256 usdcReceived,
        uint256 settlementNAV
    );
    event AdapterQuarantined(address indexed adapter);
    event AdapterUnquarantined(address indexed adapter);
    event DepositsQuarantined();
    event DepositsUnquarantined();
    event DepositsPaused();
    event DepositsUnpaused();
    event SettleQueueCounterUpdated(
        uint256 oldCounter,
        uint256 newCounter,
        uint256 counterLimit
    );
    event DepositWithNAV(
        address indexed user,
        address indexed receiver,
        uint256 assets,
        uint256 shares,
        uint256 navAtDeposit
    );
    event DefaultQueueLimitUpdated(uint256 _defaultDueueLimit);
    event SettleQueueCounterLimitUpdated(
        uint256 indexed settleQueueCounter,
        uint256 _queueLimit
    );
    event WithdrawCancelled(
        address indexed user,
        uint256 indexed _requestId,
        uint256 shares
    );
    event VirtualizationConfigured(
        uint256 virtualAssetsBase,
        uint256 virtualSharesBase
    );
    event ExtraUnderlyingSwept(
        address indexed safeWallet,
        uint256 actualBal,
        uint256 timestamp
    );
    event MaxSettlementSlippageUpdated(uint256 oldSlippage, uint256 _bps);
    event SetMinWithdraw(uint256 oldMinWithdraw, uint256 minWithdraw);
    event SetMinDeposit(uint256 oldMinDeposit, uint256 minDeposit);
    event SetMaxRequest(uint256 oldMaxReq, uint256 maxReqPerUser);

    // --- Errors ---
    error TooManyAdapters();
    error InvalidMaxAdapters();
    error EmergencyModeEnabled();
    error ZeroAddress();
    error ZeroShares();
    error ZeroAmount();
    error AdapterNotFound();
    error AdapterAlreadyExists();
    error InvalidSafeWallet();
    error ControllerCannotBeOwner();
    error CannotTransferToVault();
    error InvalidController();
    error OnlyController();
    error OnlySafe();
    error InsufficientLiquidity();
    error OnlyEmergencyWithdrawals();
    error WithdrawalsArePaused();
    error NoActiveRequests();
    error InsufficientUSDC();
    error InsufficientAllowance();
    error RequestNotFound();
    error RequestAlreadySettled();
    error InsufficientShares();
    error NotInEmergencyMode();
    error AdapterTVLCallFailed(address adapter);
    error DepositsAreQuarantined();
    error DepositsArePaused();
    error CounterAlreadySettled();
    error EmptyCounterCannotSettle();
    error InvalidOraclePrice();
    error StaleOraclePrice();
    error ArrayLengthMismatch();
    error BelowMinWithdraw();
    error TooManyActiveRequests();
    error PriceOutOfBound();
    error MinDepositViolated();
    error CannotUseSettledCounter();

    // --- Constructor ---

    /**
     * @param _asset The underlying asset token contract (e.g., USDC).
     * @param _name The name of the vault token.
     * @param _symbol The symbol of the vault token.
     * @param _initialAdapters An array of strategy adapter contracts to add on deployment.
     * @param _maxAdapters Maximum number of adapters allowed.
     * @param _safeWallet The safe wallet address where deposited assets will be transferred.
     * @param _controller The controller address for operational functions.
     */
    constructor(
        IERC20 _asset,
        string memory _name,
        string memory _symbol,
        address[] memory _initialAdapters,
        uint256 _maxAdapters,
        address _safeWallet,
        address _controller,
        uint256 _firstQueueLimit,
        uint256 _defaultSettleQueueLimit
    ) ERC4626(_asset) ERC20(_name, _symbol) {
        if (address(_asset) == address(0)) revert ZeroAddress();
        if (_maxAdapters == 0) revert InvalidMaxAdapters();
        if (_safeWallet == address(0)) revert InvalidSafeWallet();
        if (_safeWallet == address(this)) revert InvalidSafeWallet();
        if (_controller == address(0)) revert InvalidController();
        if (_initialAdapters.length > _maxAdapters) revert TooManyAdapters();
        if (_controller == msg.sender) revert ControllerCannotBeOwner();

        // Set configuration values
        maxAdapters = _maxAdapters;
        safeWallet = _safeWallet;
        controller = _controller;
        emergencyMode = false;

        // Initialize withdrawal request counter
        withdrawalRequestCounter = 0;
        settleQueueCounter = 0;
        settleQueueLimit[settleQueueCounter] = _firstQueueLimit;
        defaultSettleQueueLimit = _defaultSettleQueueLimit;

        for (uint i = 0; i < _initialAdapters.length; i++) {
            _addAdapter(_initialAdapters[i]);
        }

        maxReqPerUser = 1;
    }

    // --- Modifiers ---

    modifier onlyController() {
        if (msg.sender != controller) revert OnlyController();
        _;
    }

    modifier onlySafe() {
        if (msg.sender != safeWallet) revert OnlySafe();
        _;
    }

    // --- View Functions ---

    /**
     * @notice Get current Net Asset Value (NAV) per share
     * @return Current NAV per share (18 decimals), starts at 100 for first deposit
     */
    function getCurrentNAV() public view returns (uint256) {
        uint256 totalSupply_ = totalSupply();

        // If no shares exist, return initial NAV of 100
        if (totalSupply_ == 0) {
            return INITIAL_NAV;
        }
        // totalAssets_ USD value of the total assets
        uint256 totalAssets_ = getTotalAssetsInUSD();

        // Calculate NAV: totalAssets / totalSupply * 1e18 (for 18 decimal precision)
        return
            Math.mulDiv(totalAssets_, 1e18, totalSupply_, Math.Rounding.Floor);
    }

    /**
     * @notice Get current Total Value Locked (TVL)
     * @return Current TVL in 18 decimal precision
     */
    function getCurrentTVL() public view returns (uint256) {
        return getTotalAssetsInUSD();
    }

    /**
     * @notice Get comprehensive vault data including NAV, adapters, and configuration
     * @return nav Current NAV per share (18 decimals)
     * @return totalAssets_ Total assets under management (18 decimals)
     * @return totalSupply_ Total shares in circulation (18 decimals)
     * @return adapters_ Array of adapter addresses
     * @return adapterCount Number of active adapters
     * @return maxAdapters_ Maximum adapters allowed
     * @return safeWallet_ Safe wallet address
     * @return controller_ Controller address
     * @return emergencyMode_ Current emergency mode status
     * @return withdrawalRequestCounter_ Current withdrawal request counter
     * @return depositsQuarantined_ Current deposits quarantine status
     */
    function getVaultData()
        external
        view
        returns (
            uint256 nav,
            uint256 totalAssets_,
            uint256 totalSupply_,
            address[] memory adapters_,
            uint256 adapterCount,
            uint256 maxAdapters_,
            address safeWallet_,
            address controller_,
            bool emergencyMode_,
            uint256 withdrawalRequestCounter_,
            bool depositsQuarantined_
        )
    {
        totalSupply_ = totalSupply();
        totalAssets_ = getCurrentTVL();
        nav = getCurrentNAV();

        return (
            nav,
            totalAssets_,
            totalSupply_,
            adapters,
            adapters.length,
            maxAdapters,
            safeWallet,
            controller,
            emergencyMode,
            withdrawalRequestCounter,
            depositsQuarantined
        );
    }

    /**
     * @notice Get the pause status for deposits and withdrawals
     * @return pauseStatuses Array of length 2 where:
     *         - Index 0: deposit pause status (true = paused, false = not paused)
     *         - Index 1: withdrawal pause status (true = paused, false = not paused)
     */
    function isPaused() external view returns (bool[2] memory pauseStatuses) {
        pauseStatuses[0] = depositPauseStatus;
        pauseStatuses[1] = withdrawalsPaused;
        return pauseStatuses;
    }

    // --- Management Functions ---

    function setMinWithdraw(uint256 _minWithdraw) external onlyOwner {
        uint256 oldMinWithdraw = minWithdraw;
        minWithdraw = _minWithdraw;
        emit SetMinWithdraw(oldMinWithdraw, minWithdraw);
    }

    function setMinDeposit(uint256 _minDeposit) external onlyOwner {
        uint256 oldMinDeposit = minDeposit;
        minDeposit = _minDeposit;
        emit SetMinDeposit(oldMinDeposit, minDeposit);
    }

    function setMaxRequestPerUser(uint256 _maxReq) external onlyOwner {
        uint256 oldMaxReq = maxReqPerUser;
        maxReqPerUser = _maxReq;
        emit SetMaxRequest(oldMaxReq, maxReqPerUser);
    }

    function setPriceOracle(
        address[] memory token,
        address[] memory oracle,
        uint256[] calldata _staleWindow
    ) external onlyOwner {
        if (
            token.length != oracle.length ||
            oracle.length != _staleWindow.length
        ) revert ArrayLengthMismatch();

        for (uint256 i = 0; i < token.length; i++) {
            require(
                _staleWindow[i] > 0 && _staleWindow[i] <= 1 days,
                "Invalid staleWindow"
            );
            priceOracles[token[i]] = oracle[i];
            staleWindow[oracle[i]] = _staleWindow[i];
        }
    }

    function addAdapter(address _adapter) external onlyOwner whenNotPaused {
        _addAdapter(_adapter);
    }

    function removeAdapter(address _adapter) external onlyOwner {
        require(
            IStrategyAdapter(_adapter).getTVL() == 0,
            "Adapter has active positions"
        );
        if (!isAdapter[_adapter]) revert AdapterNotFound();

        bool found = false;

        for (uint i = 0; i < adapters.length; i++) {
            if (adapters[i] == _adapter) {
                adapters[i] = adapters[adapters.length - 1];
                adapters.pop();
                found = true;
                break;
            }
        }

        if (!found) revert AdapterNotFound();
        isAdapter[_adapter] = false;
        emit AdapterRemoved(_adapter);
    }

    /**
    * @notice Update safe wallet address with comprehensive validation
    * @dev Requires delay module execution and validates old wallet is empty
    * @param _safeWallet New safe wallet address
    */
    function updateSafeWallet(address _safeWallet) external nonReentrant {
        require(msg.sender == delayModule, "Only delay module");
        if (_safeWallet == address(0)) revert ZeroAddress();
        if (_safeWallet == address(this)) revert InvalidSafeWallet();
        if (_safeWallet == safeWallet) return; // No-op if same address
        
 
        // 1. Check old safe wallet has zero USDC balance
        uint256 oldWalletBalance = IERC20(asset()).balanceOf(safeWallet);
        require(
            oldWalletBalance == 0,
            "Old safe wallet has USDC - migrate assets first"
        );
        
        // 2. Check all adapters report zero TVL
        // This ensures no PT tokens or other positions remain in old wallet
        uint256 totalAdapterTVL = 0;
        for (uint256 i = 0; i < adapters.length; i++) {
            address adapter = adapters[i];
            
            // Skip quarantined adapters (they're already excluded from TVL)
            if (quarantinedAdapters[adapter]) continue;
            
            try IStrategyAdapter(adapter).getTVL() returns (uint256 tvl) {
                totalAdapterTVL += tvl;
            } catch {
                // If adapter call fails, we cannot safely proceed
                revert AdapterTVLCallFailed(adapter);
            }
        }
        
        require(
            totalAdapterTVL == 0,
            "Adapters have active positions - migrate before changing wallet"
        );
        
        // 3. Additional safety: Ensure no active withdrawal queue
        require(
            totalQueuedShares == 0,
            "Active withdrawal queue - settle before changing wallet"
        );
    
        address oldWallet = safeWallet;
        safeWallet = _safeWallet;
        
        // Clear queue (if it was set)
        if (safeWalletQueued != address(0)) {
            delete safeWalletQueued;
        }
        
        emit SafeWalletUpdated(oldWallet, _safeWallet);
    }


    /**
     * @notice Comprehensive configuration update function
     * @dev Only callable when emergency mode is enabled for security
     * @param _maxAdapters New maximum number of adapters (0 = no change)
     * @param _pauseState True to pause, false to unpause, current state for no change
     * @param _emergencyMode True to enable emergency mode, false to disable
     */
    function updateVaultConfig(
        uint256 _maxAdapters,
        bool _pauseState,
        bool _emergencyMode
    ) external onlyOwner {
        // Allow enabling emergency mode for the first time, but require emergency mode for other changes
        if (!emergencyMode && !_emergencyMode) {
            revert NotInEmergencyMode();
        }

        // If not in emergency mode but trying to enable it, only allow emergency mode change
        if (!emergencyMode && _emergencyMode) {
            // Only allow emergency mode toggle, no other changes
            if (_maxAdapters > 0 || _pauseState != paused()) {
                revert NotInEmergencyMode();
            }
            emergencyMode = _emergencyMode;
            emit EmergencyModeToggled(_emergencyMode);
            return;
        }

        // Regular emergency mode logic - all changes allowed
        // Update max adapters if provided
        if (_maxAdapters > 0) {
            if (adapters.length > _maxAdapters) revert TooManyAdapters();
            uint256 oldMax = maxAdapters;
            maxAdapters = _maxAdapters;
            emit MaxAdaptersUpdated(oldMax, _maxAdapters);
        }

        // Update pause state
        if (_pauseState != paused()) {
            if (_pauseState) {
                _pause();
            } else {
                _unpause();
            }
        }

        // Update emergency mode
        if (_emergencyMode != emergencyMode) {
            emergencyMode = _emergencyMode;
            emit EmergencyModeToggled(_emergencyMode);
        }
    }

    /**
     * @notice Update maximum settlement slippage tolerance
     * @dev Allows adjusting based on market volatility or operational needs
     * @param _bps New slippage in basis points (e.g., 500 = 5%, 1000 = 10%)
     */
    function setMaxSettlementSlippage(uint256 _bps) external onlyOwner {
        require(_bps <= 2000, "Maximum 20% slippage"); // Safety cap
        require(_bps >= 100, "Minimum 1% slippage"); // Prevent too strict

        uint256 oldSlippage = maxSettlementSlippage;
        maxSettlementSlippage = _bps;

        emit MaxSettlementSlippageUpdated(oldSlippage, _bps);
    }

    /**
     * @notice Update controller address (owner only)
     * @param _controller New controller address
     */
    function updateController(address _controller) external onlyOwner {
        if (_controller == address(0)) revert InvalidController();
        address oldController = controller;
        controller = _controller;
        emit ControllerUpdated(oldController, _controller);
    }

    /**
     * @notice Quarantine an adapter that's failing TVL calls
     * @param adapter The adapter to quarantine
     */
    function quarantineAdapter(address adapter) external onlyOwner {
        quarantinedAdapters[adapter] = true;
        emit AdapterQuarantined(adapter);
    }

    /**
     * @notice Unquarantine an adapter after fixing issues
     * @param adapter The adapter to unquarantine
     */
    function unquarantineAdapter(address adapter) external onlyOwner {
        quarantinedAdapters[adapter] = false;
        emit AdapterUnquarantined(adapter);
    }

    /**
     * @notice Toggle emergency mode (owner only)
     * @param _emergencyMode True to enable emergency mode, false to disable
     */
    function toggleEmergencyMode(bool _emergencyMode) external onlyOwner {
        emergencyMode = _emergencyMode;
        emit EmergencyModeToggled(_emergencyMode);
    }

    /**
     * @notice Quarantine deposits when adapters are failing
     */
    function quarantineDeposits() external onlyOwner {
        depositsQuarantined = true;
        emit DepositsQuarantined();
    }

    /**
     * @notice Unquarantine deposits after resolving adapter issues
     */
    function unquarantineDeposits() external onlyOwner {
        depositsQuarantined = false;
        emit DepositsUnquarantined();
    }

    /**
     * @notice Pause deposits (controller only)
     */
    function pauseDeposits() external onlyController {
        depositPauseStatus = true;
        emit DepositsPaused();
    }

    /**
     * @notice Unpause deposits (controller only)
     */
    function unpauseDeposits() external onlyController {
        depositPauseStatus = false;
        emit DepositsUnpaused();
    }

    /**
     * @notice Update settle queue counter to create new settlement batch (controller only)
     * @dev Requires existing counter to have pending requests to prevent empty counter creation
     */
    function updateSettleQueueCounter(
        uint256 _queueLimit
    ) external onlyController {
        // Ensure current counter has pending requests before incrementing
        if (
            queuedSharesByCounter[settleQueueCounter] <
            MIN_REQUESTS_FOR_COUNTER_UPDATE
        ) {
            revert NoActiveRequests();
        }

        uint256 oldCounter = settleQueueCounter;
        settleQueueCounter++;
        settleQueueLimit[settleQueueCounter] = _queueLimit;
        emit SettleQueueCounterUpdated(
            oldCounter,
            settleQueueCounter,
            _queueLimit
        );
    }

    function updateSettleQueueCounterLimit(
        uint256 _settleQueueCounter,
        uint256 _queueLimit
    ) external onlyController {
        require(
            _settleQueueCounter >= settleQueueCounter,
            "can't update old counter limit"
        );
        if (_settleQueueCounter == settleQueueCounter) {
            require(
                _queueLimit >= latestWithdrawRequests,
                "Withdrawals already registered"
            );
        }
        settleQueueLimit[_settleQueueCounter] = _queueLimit;
        emit SettleQueueCounterLimitUpdated(settleQueueCounter, _queueLimit);
    }

    function updateDefaultQueueLimit(
        uint256 _defaultDueueLimit
    ) external onlyController {
        defaultSettleQueueLimit = _defaultDueueLimit;
        emit DefaultQueueLimitUpdated(_defaultDueueLimit);
    }

    // --- Request Withdrawal Function ---

    /**
     * @notice ERC4626 compliant redeem function that burns shares for assets
     * @dev Initiates a withdrawal by burning vault shares and queuing the request
     * @param shares The amount of vault shares to burn for withdrawal
     * @param receiver The address that will receive the USDC payout
     * @param owner The owner of the shares (must be msg.sender or have allowance)
     * @return assets The amount of underlying assets to be received
     */
    function redeem(
        uint256 shares,
        address receiver,
        address owner
    )
        public
        virtual
        override
        nonReentrant
        whenNotPaused
        returns (uint256 assets)
    {
        if (emergencyMode) revert EmergencyModeEnabled();
        if (shares == 0) revert ZeroShares();
        if (receiver == address(0)) revert ZeroAddress();
        if (withdrawalsPaused) revert WithdrawalsArePaused();
        if (shares <= minWithdraw) revert BelowMinWithdraw();
        if (
            userActiveRequestCount[owner][settleQueueCounter] >= maxReqPerUser
        ) {
            revert TooManyActiveRequests();
        }
        if (isCounterSettled[settleQueueCounter]) revert CannotUseSettledCounter();
        // Calculate assets to be redeemed
        assets = previewRedeem(shares);

        // Check allowance if owner is not msg.sender
        if (owner != msg.sender) {
            uint256 currentAllowance = allowance(owner, msg.sender);
            if (currentAllowance < shares) {
                revert InsufficientShares();
            }
            // Decrease allowance
            _spendAllowance(owner, msg.sender, shares);
        }

        // Check that owner has sufficient vault token balance
        if (balanceOf(owner) < shares) revert InsufficientShares();

        // Transfer shares to vault instead of burning
        internalTransfer = true;
        _transfer(owner, address(this), shares);
        internalTransfer = false;

        // Increment counter to get a new unique ID
        uint256 requestId = ++withdrawalRequestCounter;
        latestWithdrawRequests++;

        if (latestWithdrawRequests > settleQueueLimit[settleQueueCounter]) {
            settleQueueCounter++;
            settleQueueLimit[settleQueueCounter] = defaultSettleQueueLimit;
            latestWithdrawRequests = 1;
        }

        userActiveRequestCount[owner][settleQueueCounter]++;

        // Create withdrawal request
        withdrawalRequests[requestId] = WithdrawalRequest({
            user: owner,
            receiver: receiver,
            shares: shares,
            timestamp: block.timestamp,
            settleCounter: settleQueueCounter,
            settled: false
        });

        // Add to active requests queue
        activeRequestIds.push(requestId);
        isActiveRequest[requestId] = true;
        totalQueuedShares += shares;
        queuedSharesByCounter[settleQueueCounter] += shares;

        emit WithdrawalRequested(
            owner,
            receiver,
            shares,
            requestId,
            getCurrentNAV()
        );

        return assets;
    }

    /**
     * @notice ERC4626 compliant withdraw function that burns shares for specific asset amount
     * @dev Converts assets to shares and queues the withdrawal request
     * @param assets The amount of assets (USDC) to withdraw
     * @param receiver The address that will receive the USDC payout
     * @param owner The owner of the shares (must be msg.sender or have allowance)
     * @return shares The amount of shares burned for the withdrawal
     */
    function withdraw(
        uint256 assets,
        address receiver,
        address owner
    )
        public
        virtual
        override
        nonReentrant
        whenNotPaused
        returns (uint256 shares)
    {
        if (emergencyMode) revert EmergencyModeEnabled();
        if (assets == 0) revert ZeroAmount();
        if (receiver == address(0)) revert ZeroAddress();
        if (withdrawalsPaused) revert WithdrawalsArePaused();
        if (
            userActiveRequestCount[owner][settleQueueCounter] >= maxReqPerUser
        ) {
            revert TooManyActiveRequests();
        }
        if (isCounterSettled[settleQueueCounter]) revert CannotUseSettledCounter();
        // Convert assets to shares using current conversion rate
        shares = previewWithdraw(assets);
        if (shares <= minWithdraw) revert BelowMinWithdraw();

        // Check allowance if owner is not msg.sender
        if (owner != msg.sender) {
            uint256 currentAllowance = allowance(owner, msg.sender);
            if (currentAllowance < shares) {
                revert InsufficientShares();
            }
            // Decrease allowance
            _spendAllowance(owner, msg.sender, shares);
        }

        // Check that owner has sufficient vault token balance
        if (balanceOf(owner) < shares) revert InsufficientShares();

        // Transfer shares to vault instead of burning
        internalTransfer = true;
        _transfer(owner, address(this), shares);
        internalTransfer = false;

        // Increment counter to get a new unique ID
        uint256 requestId = ++withdrawalRequestCounter;
        latestWithdrawRequests++;

        if (latestWithdrawRequests > settleQueueLimit[settleQueueCounter]) {
            settleQueueCounter++;
            settleQueueLimit[settleQueueCounter] = defaultSettleQueueLimit;
            latestWithdrawRequests = 1;
        }

        userActiveRequestCount[owner][settleQueueCounter]++;

        // Create withdrawal request
        withdrawalRequests[requestId] = WithdrawalRequest({
            user: owner,
            receiver: receiver,
            shares: shares,
            timestamp: block.timestamp,
            settleCounter: settleQueueCounter,
            settled: false
        });

        // Add to active requests queue
        activeRequestIds.push(requestId);
        isActiveRequest[requestId] = true;
        totalQueuedShares += shares;
        queuedSharesByCounter[settleQueueCounter] += shares;

        emit WithdrawalRequested(
            owner,
            receiver,
            shares,
            requestId,
            getCurrentNAV()
        );

        return shares;
    }

    function cancelWithdraw(uint256 requestId) external {
        WithdrawalRequest storage req = withdrawalRequests[requestId];

        require(msg.sender == req.user, "Not the owner");
        require(isActiveRequest[requestId], "Request inactive");
        require(
            req.settleCounter == settleQueueCounter,
            "Cannot cancel settled counter"
        );

        uint256 shares = req.shares;
        uint256 counter = req.settleCounter;

        userActiveRequestCount[msg.sender][req.settleCounter] -= 1;

        require(shares > 0, "Nothing to cancel");

        // Transfer shares back to user
        _transfer(address(this), msg.sender, shares);

        // Update global accounting BEFORE zeroing out
        totalQueuedShares -= shares;
        queuedSharesByCounter[counter] -= shares;

        // Mark inactive
        req.shares = 0;
        isActiveRequest[requestId] = false;

        emit WithdrawCancelled(msg.sender, requestId, shares);
    }

    /**
     * @notice Get all queued withdrawal requests
     * @return requestIds Array of active request IDs
     * @return users Array of users who made the requests
     * @return shares Array of shares amounts for each request
     */
    function getQueuedUsers()
        external
        view
        returns (
            uint256[] memory requestIds,
            address[] memory users,
            uint256[] memory shares
        )
    {
        uint256 activeCount = activeRequestIds.length;
        requestIds = new uint256[](activeCount);
        users = new address[](activeCount);
        shares = new uint256[](activeCount);

        for (uint256 i = 0; i < activeCount; i++) {
            uint256 requestId = activeRequestIds[i];
            WithdrawalRequest memory request = withdrawalRequests[requestId];
            requestIds[i] = requestId;
            users[i] = request.user;
            shares[i] = request.shares;
        }
    }

    /**
     * @notice Get queued shares amount for a specific settlement counter
     * @param counter The settlement counter to check
     * @return shares Total shares queued for this counter
     */
    function getQueuedSharesByCounter(
        uint256 counter
    ) external view returns (uint256 shares) {
        return queuedSharesByCounter[counter];
    }

    /**
     * @notice Check if a specific settlement counter has been settled
     * @param counter The settlement counter to check
     * @return settled True if the counter has been settled, false otherwise
     */
    function isSettlementCounterSettled(
        uint256 counter
    ) external view returns (bool settled) {
        return isCounterSettled[counter];
    }

    /**
     * @notice Pause withdrawal requests (controller only)
     */
    function pauseWithdrawals() external onlyController {
        withdrawalsPaused = true;
        emit WithdrawalsPaused();
    }

    /**
     * @notice Unpause withdrawal requests (controller only)
     */
    function unpauseWithdrawals() external onlyController {
        withdrawalsPaused = false;
        emit WithdrawalsUnpaused();
    }

    /**
     * @notice Settle the withdrawal queue for a specific counter by distributing USDC proportionally
     * @dev USDC is transferred from the safe wallet where PT token sale proceeds are kept
     * @param totalUSDCToPayout Total USDC amount to distribute to queued withdrawals for this counter
     * @param counterToSettle The settlement counter batch to process
     */
    function settleQueue(
        uint256 totalUSDCToPayout,
        uint256 counterToSettle
    ) external nonReentrant onlySafe {
        if (isCounterSettled[counterToSettle]) revert CounterAlreadySettled();
        if (queuedSharesByCounter[counterToSettle] == 0)
            revert EmptyCounterCannotSettle();
        if (totalUSDCToPayout == 0) revert InsufficientUSDC();

        // Check safe wallet has enough USDC
        if (IERC20(asset()).balanceOf(safeWallet) < totalUSDCToPayout)
            revert InsufficientUSDC();

        // Check safe wallet has given sufficient allowance to vault
        if (
            IERC20(asset()).allowance(safeWallet, address(this)) <
            totalUSDCToPayout
        ) {
            revert InsufficientAllowance();
        }

        uint256 currentNAV = getCurrentNAV();

        // Transfer USDC from safe wallet to vault for distribution
        IERC20(asset()).safeTransferFrom(
            safeWallet,
            address(this),
            totalUSDCToPayout
        );

        // Calculate settlement NAV (in 18 decimals)
        uint256 settlementNAV = Math.mulDiv(
            totalUSDCToPayout,
            1e18 * 1e12, // Convert from 6 decimals (USDC) to 18 decimals
            queuedSharesByCounter[counterToSettle]
        );

        {
            // maxSettlementSlippage is in basis points (e.g., 500 = 5%)
            uint256 minAcceptableNAV = (currentNAV *
                (10000 - maxSettlementSlippage)) / 10000;
            uint256 maxAcceptableNAV = (currentNAV *
                (10000 + maxSettlementSlippage)) / 10000;

            // Validate settlement NAV is within configured bounds
            require(
                settlementNAV >= minAcceptableNAV,
                "Settlement NAV below minimum threshold"
            );
            require(
                settlementNAV <= maxAcceptableNAV,
                "Settlement NAV above maximum threshold"
            );
        }

        // Process requests for this specific counter only
        uint256[] memory requestsToProcess = new uint256[](
            activeRequestIds.length
        );
        uint256 requestsToProcessCount = 0;
        uint256 totalSharesSettledForCounter = 0;

        // First pass: identify requests for this counter
        for (uint256 i = 0; i < activeRequestIds.length; i++) {
            uint256 requestId = activeRequestIds[i];
            WithdrawalRequest storage request = withdrawalRequests[requestId];

            if (!request.settled && request.settleCounter == counterToSettle) {
                requestsToProcess[requestsToProcessCount] = requestId;
                requestsToProcessCount++;
            }
        }

        // Second pass: process identified requests
        for (uint256 i = 0; i < requestsToProcessCount; i++) {
            uint256 requestId = requestsToProcess[i];
            WithdrawalRequest storage request = withdrawalRequests[requestId];

            // Calculate USDC amount for this request
            uint256 usdcAmount = Math.mulDiv(
                request.shares,
                totalUSDCToPayout,
                queuedSharesByCounter[counterToSettle]
            );

            // Mark as settled
            request.settled = true;
            totalSharesSettledForCounter += request.shares;

            // Remove from active tracking
            isActiveRequest[requestId] = false;

            // Burn the shares from vault
            _burn(address(this), request.shares);

            // Transfer USDC to receiver
            IERC20(asset()).safeTransfer(request.receiver, usdcAmount);

            emit WithdrawalSettled(
                requestId,
                request.user,
                request.receiver,
                request.shares,
                usdcAmount,
                settlementNAV
            );
        }

        // Update counters
        totalQueuedShares -= totalSharesSettledForCounter;
        queuedSharesByCounter[counterToSettle] = 0;
        isCounterSettled[counterToSettle] = true;

        // Gas-efficient cleanup: batch remove settled requests
        uint256 originalLength = activeRequestIds.length;
        uint256 writeIndex = 0;

        // Single pass: compact active requests
        for (uint256 i = 0; i < originalLength; i++) {
            if (isActiveRequest[activeRequestIds[i]]) {
                if (writeIndex != i) {
                    activeRequestIds[writeIndex] = activeRequestIds[i];
                }
                writeIndex++;
            }
        }

        // Batch resize array (more gas efficient than individual pops)
        uint256 itemsToRemove = originalLength - writeIndex;
        for (uint256 i = 0; i < itemsToRemove; i++) {
            activeRequestIds.pop();
        }

        emit QueueSettled(
            totalUSDCToPayout,
            totalSharesSettledForCounter,
            settlementNAV,
            requestsToProcessCount
        );

        // Transfer any leftover USDC back to safe wallet
        uint256 remainingUSDC = IERC20(asset()).balanceOf(address(this));
        if (remainingUSDC > 0) {
            IERC20(asset()).safeTransfer(safeWallet, remainingUSDC);

            emit ExtraUnderlyingSwept(
                safeWallet,
                remainingUSDC,
                block.timestamp
            );
        }
    }

    // --- Core ERC4626 Logic ---

    function totalAssets() public view virtual override returns (uint256) {
        // --- Emergency mode: only idle assets ---
        if (emergencyMode) {
            uint256 _totalIdleAssets = IERC20(asset()).balanceOf(safeWallet);

            // Include virtual assets in emergency mode too
            return (_totalIdleAssets) + virtualAssetsBase;
        }

        // --- Normal mode ---
        uint256 totalManagedAssets = 0;
        uint256 adapterCount = adapters.length;

        unchecked {
            for (uint256 i = 0; i < adapterCount && i < maxAdapters; i++) {
                address adapter = adapters[i];

                // Skip quarantined adapters
                if (quarantinedAdapters[adapter]) continue;

                // getTotalAssets() must return value in asset
                try IStrategyAdapter(adapter).getTotalAssets() returns (
                    uint256 tvl
                ) {
                    totalManagedAssets += tvl;
                } catch {
                    // Fail hard to prevent NAV manipulation
                    revert AdapterTVLCallFailed(adapter);
                }
            }
        }

        // Include idle assets from safeWallet (Exclude Vault balance)
        uint256 totalIdleAssets = IERC20(asset()).balanceOf(safeWallet);
        totalManagedAssets += totalIdleAssets;

        return totalManagedAssets + virtualAssetsBase;
    }

    function getTotalAssetsInUSD() public view returns (uint256) {
        address underlying = asset();
        uint256 assetDecimals = IERC20Metadata(underlying).decimals();
        uint256 precisionOffset = 18 > assetDecimals ? 18 - assetDecimals : 0;

        // ---------------------------------------------
        // 1. Load USD oracle (18 decimals)
        // ---------------------------------------------
        address assetOracle = priceOracles[underlying];
        require(assetOracle != address(0), "Price oracle not set for asset");

        (uint256 usdPrice18, ) = _getValidatedOraclePrice(assetOracle);
        // usdPrice18 = price per 1 token (18 decimals)

        // ---------------------------------------------
        // EMERGENCY MODE:
        // Only idle assets + virtual assets, all in USD
        // ---------------------------------------------
        if (emergencyMode) {
            uint256 idleAssets = IERC20(underlying).balanceOf(safeWallet);

            // Convert idle assets -> 18-decimal USD
            uint256 idleUSD = Math.mulDiv(
                idleAssets * (10 ** precisionOffset), // normalize to 18 decimals
                usdPrice18,
                1e18
            );

            // Virtual assets -> normalize → USD
            uint256 virtAssetUnits18s = virtualAssetsBase *
                (10 ** precisionOffset);
            uint256 virtUSDs = Math.mulDiv(virtAssetUnits18s, usdPrice18, 1e18);

            return idleUSD + virtUSDs;
        }

        // ---------------------------------------------
        // 2. Normal mode: Start with adapter TVL (already USD, 18 decimals)
        // ---------------------------------------------
        uint256 totalUSD = 0;
        uint256 adapterCount = adapters.length;

        unchecked {
            for (uint256 i = 0; i < adapterCount && i < maxAdapters; i++) {
                address adapter = adapters[i];
                if (quarantinedAdapters[adapter]) continue;

                // getTVL() already returns USD, 18 decimals
                try IStrategyAdapter(adapter).getTVL() returns (
                    uint256 tvlUSD
                ) {
                    totalUSD += tvlUSD;
                } catch {
                    revert AdapterTVLCallFailed(adapter);
                }
            }
        }

        // ---------------------------------------------
        // 3. Idle asset USD valuation (Include idle assets from safeWallet (Exclude Vault balance))
        // ---------------------------------------------
        uint256 idleAsset = IERC20(underlying).balanceOf(safeWallet);

        // Normalize idle assets → 18-decimal asset units → USD
        uint256 idleUSDs = Math.mulDiv(
            idleAsset * (10 ** precisionOffset),
            usdPrice18,
            1e18
        );

        totalUSD += idleUSDs;

        // ---------------------------------------------
        // 4. Virtual assets -> USD
        // ---------------------------------------------
        uint256 virtAssetUnits18 = virtualAssetsBase * (10 ** precisionOffset);
        uint256 virtUSD = Math.mulDiv(virtAssetUnits18, usdPrice18, 1e18);

        totalUSD += virtUSD;

        return totalUSD;
    }

    /**
     * @notice Internal helper to fetch Chainlink price and validate freshness/staleness
     * @param oracle The Chainlink oracle address
     * @return price18 Price normalized to 18 decimals
     * @return oracleDecimals The original decimals of the Chainlink feed
     *
     * Requirements:
     *  - answer > 0
     *  - answeredInRound >= roundId
     *  - if staleWindow[oracle] > 0 then (block.timestamp - updatedAt) <= staleWindow[oracle]
     */
    function _getValidatedOraclePrice(
        address oracle
    ) internal view returns (uint256 price18, uint8 oracleDecimals) {
        if (oracle == address(0)) revert ZeroAddress();

        // latestRoundData(): (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
        (
            uint80 roundID,
            int256 answer,
            ,
            uint256 updatedAt,
            uint80 answeredInRound
        ) = AggregatorV3Interface(oracle).latestRoundData();

        if (answer <= 0) revert InvalidOraclePrice();
        if (answeredInRound < roundID) revert StaleOraclePrice();

        require(
            uint16(roundID >> 64) == uint16(answeredInRound >> 64),
            "Phase mismatch"
        );

        // prevent future timestamps ---
        require(
            updatedAt > 0 && updatedAt <= block.timestamp,
            "Invalid timestamp"
        );

        // Check freshness/stale window
        uint256 maxAge = staleWindow[oracle];

        oracleDecimals = AggregatorV3Interface(oracle).decimals();

        uint256 raw = uint256(answer);
        if (oracleDecimals < 18) {
            price18 = raw * (10 ** (18 - oracleDecimals));
        } else if (oracleDecimals > 18) {
            price18 = raw / (10 ** (oracleDecimals - 18));
        } else {
            price18 = raw;
        }

        address currentPhaseAggregator = AggregatorV3Interface(oracle).aggregator();
        uint256 minPrice = AggregatorV3Interface(currentPhaseAggregator).minAnswer();
        uint256 maxPrice = AggregatorV3Interface(currentPhaseAggregator).maxAnswer();

        if (uint(raw) >= maxPrice || uint(raw) <= minPrice) revert PriceOutOfBound();

        if (maxAge > 0) {
            // if updatedAt is 0 (feed never updated), treat as stale
            if (updatedAt == 0) revert StaleOraclePrice();
            if (block.timestamp - updatedAt > maxAge) revert StaleOraclePrice();
        }
    }

    /**
     * @notice Override deposit to automatically deploy funds to strategies
     */
    function deposit(
        uint256 assets,
        address receiver
    )
        public
        virtual
        override
        nonReentrant
        whenNotPaused
        returns (uint256 shares)
    {
        if (emergencyMode) revert EmergencyModeEnabled();
        if (depositsQuarantined) revert DepositsAreQuarantined();
        if (depositPauseStatus) revert DepositsArePaused();
        if (minDeposit > assets) revert MinDepositViolated();

        // Execute standard ERC4626 deposit
        shares = super.deposit(assets, receiver);
        // Transfer deposited assets to safe wallet
        IERC20(asset()).safeTransfer(safeWallet, assets);

        // Emit Deposit event along with current NAV
        emit DepositWithNAV(
            msg.sender,
            receiver,
            assets,
            shares,
            getCurrentNAV()
        );

        return shares;
    }

    // --- Helper Functions ---

    function _addAdapter(address _adapter) private {
        if (_adapter == address(0)) revert ZeroAddress();
        if (isAdapter[_adapter]) revert AdapterAlreadyExists();
        if (adapters.length >= maxAdapters) revert TooManyAdapters();

        // Check if adapter already exists
        for (uint i = 0; i < adapters.length; i++) {
            if (adapters[i] == _adapter) revert AdapterAlreadyExists();
        }

        adapters.push(_adapter);
        isAdapter[_adapter] = true;
        emit AdapterAdded(_adapter);
    }

    // --- Overrides ---
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    function totalSupply()
        public
        view
        override(ERC20, IERC20)
        returns (uint256)
    {
        return super.totalSupply() + virtualSharesBase;
    }

    function _convertToShares(
        uint256 assets,
        Math.Rounding rounding
    ) internal view virtual override returns (uint256) {
        uint256 assetDecimals = IERC20Metadata(asset()).decimals();
        uint256 precisionOffset = 18 > assetDecimals ? 18 - assetDecimals : 0;

        // Scale asset → 18 decimals
        uint256 scaledAssets = assets * (10 ** precisionOffset);

        address assetOracle = priceOracles[asset()];
        require(assetOracle != address(0), "Price oracle not set");
        (uint256 usdPrice18, ) = _getValidatedOraclePrice(assetOracle);

        // Convert scaled asset amount → USD value (18 decimals)
        uint256 usdValue18 = Math.mulDiv(scaledAssets, usdPrice18, 1e18, rounding);

        uint256 supply = totalSupply();

        // First mint → use INITIAL_NAV pricing
        if (supply == 0) {
            return Math.mulDiv(usdValue18, 1e18, INITIAL_NAV, rounding);
        }

        uint256 totalAssetsUSD = getTotalAssetsInUSD();

        // No NAV → no shares
        if (totalAssetsUSD == 0) {
            return 0;
        }

        // shares = (assetUSD * totalSupply) / totalAssetsUSD
        return Math.mulDiv(usdValue18, supply, totalAssetsUSD, rounding);
    }

    function _convertToAssets(
        uint256 shares,
        Math.Rounding rounding
    ) internal view virtual override returns (uint256) {
        uint256 supply = totalSupply();
        uint256 assetDecimals = IERC20Metadata(asset()).decimals();
        uint256 precisionOffset = 18 > assetDecimals ? 18 - assetDecimals : 0;

        address oracle = priceOracles[asset()];
        require(oracle != address(0), "Price oracle not set");
        (uint256 usdPrice18, ) = _getValidatedOraclePrice(oracle);

        uint256 usdValue18;

        if (supply == 0) {
            // usdValue = shares * NAV
            usdValue18 = Math.mulDiv(shares, INITIAL_NAV, 1e18, rounding);
        } else {
            uint256 totalAssetsUSD = getTotalAssetsInUSD();
            if (totalAssetsUSD == 0) return 0;

            // usdValue = shares * totalAssetsUSD / supply
            usdValue18 = Math.mulDiv(shares, totalAssetsUSD, supply, rounding);
        }

        // Convert USD → 18-decimal asset amount:
        // asset18 = (usdValue * 1e18) / price
        uint256 assetAmount18 = Math.mulDiv(usdValue18, 1e18, usdPrice18, rounding);

        // Convert 18-decimal asset → actual asset decimals
        return assetAmount18 / (10 ** precisionOffset);
    }

    function _update(
        address from,
        address to,
        uint256 value
    ) internal virtual override {
        // allow internal transfers into the vault when internalTransfer flag is set
        if (to == address(this) && !internalTransfer)
            revert CannotTransferToVault();
        super._update(from, to, value);
    }

    function setVirtualizationParams(
        uint256 _virtAssetsBase,
        uint256 _virtSharesBase
    ) external onlyOwner {
        require(!virtualizationConfigured, "Already configured");
        require(_virtAssetsBase > 0 && _virtSharesBase > 0, "Invalid params");

        virtualAssetsBase = _virtAssetsBase;
        virtualSharesBase = _virtSharesBase;
        virtualizationConfigured = true;

        emit VirtualizationConfigured(_virtAssetsBase, _virtSharesBase);
    }

    function sweepExtraUnderlyingToSafeWallet() external onlyOwner {
        IERC20 underlying = IERC20(asset());

        // 1) What is actually inside the vault?
        uint256 actualBal = underlying.balanceOf(address(this));

        // 2) Transfer surplus to safeWallet
        underlying.safeTransfer(safeWallet, actualBal);

        emit ExtraUnderlyingSwept(safeWallet, actualBal, block.timestamp);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


interface AggregatorInterface {
  function latestAnswer() external view returns (int256);
  function latestTimestamp() external view returns (uint256);
  function latestRound() external view returns (uint256);
  function getAnswer(uint256 roundId) external view returns (int256);
  function getTimestamp(uint256 roundId) external view returns (uint256);

  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
  event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}

interface AggregatorV2V3Interface is AggregatorInterface
{
}


interface AggregatorV3Interface {

  struct Phase {
    uint16 id;
    AggregatorV2V3Interface aggregator;
  }

  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
  
  /**
   * @notice returns the current phase's aggregator address.
   */
  function aggregator()
    external
    view
    returns (address);

  function minAnswer() external view returns(uint);

  function maxAnswer() external view returns(uint);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IStrategyAdapter
 * @notice A generic interface for strategy adapters that report the
 * total value of assets they are tracking and can execute deposits.
 */
interface IStrategyAdapter {
    /**
     * @notice Returns the Total Value Locked (TVL) tracked by this adapter.
     * @return The total value, scaled to 18 decimals of precision.
     */
    function getTVL() external view returns (uint256);

    /**
     * @notice Returns the Total Assets tracked by this adapter.
     * @return The total value, scaled to 18 decimals of precision.
     */
    function getTotalAssets() external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        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 {
        _paused = true;
        emit Paused(_msgSender());
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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 ReentrancyGuard {
    // 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;

    uint256 private _status;

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

    constructor() {
        _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 {
        // 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 {
        // 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) {
        return _status == ENTERED;
    }
}

File 6 of 23 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Return the 512-bit addition of two uint256.
     *
     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
     */
    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
        assembly ("memory-safe") {
            low := add(a, b)
            high := lt(low, a)
        }
    }

    /**
     * @dev Return the 512-bit multiplication of two uint256.
     *
     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
     */
    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
        // variables such that product = high * 2²⁵⁶ + low.
        assembly ("memory-safe") {
            let mm := mulmod(a, b, not(0))
            low := mul(a, b)
            high := sub(sub(mm, low), lt(mm, low))
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            uint256 c = a + b;
            success = c >= a;
            result = c * SafeCast.toUint(success);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            uint256 c = a - b;
            success = c <= a;
            result = c * SafeCast.toUint(success);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            uint256 c = a * b;
            assembly ("memory-safe") {
                // Only true when the multiplication doesn't overflow
                // (c / a == b) || (a == 0)
                success := or(eq(div(c, a), b), iszero(a))
            }
            // equivalent to: success ? c : 0
            result = c * SafeCast.toUint(success);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            success = b > 0;
            assembly ("memory-safe") {
                // The `DIV` opcode returns zero when the denominator is 0.
                result := div(a, b)
            }
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            success = b > 0;
            assembly ("memory-safe") {
                // The `MOD` opcode returns zero when the denominator is 0.
                result := mod(a, b)
            }
        }
    }

    /**
     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
     */
    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
        (bool success, uint256 result) = tryAdd(a, b);
        return ternary(success, result, type(uint256).max);
    }

    /**
     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
     */
    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
        (, uint256 result) = trySub(a, b);
        return result;
    }

    /**
     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
     */
    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
        (bool success, uint256 result) = tryMul(a, b);
        return ternary(success, result, type(uint256).max);
    }

    /**
     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
     *
     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
     * one branch when needed, making this function more expensive.
     */
    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            // branchless ternary works because:
            // b ^ (a ^ b) == a
            // b ^ 0 == b
            return b ^ ((a ^ b) * SafeCast.toUint(condition));
        }
    }

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

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return ternary(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.
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }

        // The following calculation ensures accurate ceiling division without overflow.
        // Since a is non-zero, (a - 1) / b will not overflow.
        // The largest possible result occurs when (a - 1) / b is type(uint256).max,
        // but the largest value we can obtain is type(uint256).max - 1, which happens
        // when a = type(uint256).max and b = 1.
        unchecked {
            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
        }
    }

    /**
     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     *
     * 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 {
            (uint256 high, uint256 low) = mul512(x, y);

            // Handle non-overflow cases, 256 by 256 division.
            if (high == 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 low / denominator;
            }

            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
            if (denominator <= high) {
                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
            }

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

            // Make division exact by subtracting the remainder from [high low].
            uint256 remainder;
            assembly ("memory-safe") {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                high := sub(high, gt(remainder, low))
                low := sub(low, 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 ("memory-safe") {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [high low] by twos.
                low := div(low, twos)

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

            // Shift in bits from high into low.
            low |= high * twos;

            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.
            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⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
            inverse *= 2 - denominator * inverse; // inverse mod 2³²
            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶

            // 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²⁵⁶. Since the preconditions guarantee that the outcome is
            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
            // is no longer required.
            result = low * inverse;
            return result;
        }
    }

    /**
     * @dev 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) {
        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
    }

    /**
     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
     */
    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
        unchecked {
            (uint256 high, uint256 low) = mul512(x, y);
            if (high >= 1 << n) {
                Panic.panic(Panic.UNDER_OVERFLOW);
            }
            return (high << (256 - n)) | (low >> n);
        }
    }

    /**
     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.
     */
    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
    }

    /**
     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
     *
     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
     *
     * If the input value is not inversible, 0 is returned.
     *
     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
     */
    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
        unchecked {
            if (n == 0) return 0;

            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
            // Used to compute integers x and y such that: ax + ny = gcd(a, n).
            // When the gcd is 1, then the inverse of a modulo n exists and it's x.
            // ax + ny = 1
            // ax = 1 + (-y)n
            // ax ≡ 1 (mod n) # x is the inverse of a modulo n

            // If the remainder is 0 the gcd is n right away.
            uint256 remainder = a % n;
            uint256 gcd = n;

            // Therefore the initial coefficients are:
            // ax + ny = gcd(a, n) = n
            // 0a + 1n = n
            int256 x = 0;
            int256 y = 1;

            while (remainder != 0) {
                uint256 quotient = gcd / remainder;

                (gcd, remainder) = (
                    // The old remainder is the next gcd to try.
                    remainder,
                    // Compute the next remainder.
                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
                    // where gcd is at most n (capped to type(uint256).max)
                    gcd - remainder * quotient
                );

                (x, y) = (
                    // Increment the coefficient of a.
                    y,
                    // Decrement the coefficient of n.
                    // Can overflow, but the result is casted to uint256 so that the
                    // next value of y is "wrapped around" to a value between 0 and n - 1.
                    x - y * int256(quotient)
                );
            }

            if (gcd != 1) return 0; // No inverse exists.
            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
        }
    }

    /**
     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
     *
     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.
     *
     * NOTE: this function does NOT check that `p` is a prime greater than `2`.
     */
    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
        unchecked {
            return Math.modExp(a, p - 2, p);
        }
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
     *
     * Requirements:
     * - modulus can't be zero
     * - underlying staticcall to precompile must succeed
     *
     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
     * sure the chain you're using it on supports the precompiled contract for modular exponentiation
     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly
     * interpreted as 0.
     */
    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
        (bool success, uint256 result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
     * to operate modulo 0 or if the underlying precompile reverted.
     *
     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
     * of a revert, but the result may be incorrectly interpreted as 0.
     */
    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
        if (m == 0) return (false, 0);
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            // | Offset    | Content    | Content (Hex)                                                      |
            // |-----------|------------|--------------------------------------------------------------------|
            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x60:0x7f | value of b | 0x<.............................................................b> |
            // | 0x80:0x9f | value of e | 0x<.............................................................e> |
            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |
            mstore(ptr, 0x20)
            mstore(add(ptr, 0x20), 0x20)
            mstore(add(ptr, 0x40), 0x20)
            mstore(add(ptr, 0x60), b)
            mstore(add(ptr, 0x80), e)
            mstore(add(ptr, 0xa0), m)

            // Given the result < m, it's guaranteed to fit in 32 bytes,
            // so we can use the memory scratch space located at offset 0.
            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
            result := mload(0x00)
        }
    }

    /**
     * @dev Variant of {modExp} that supports inputs of arbitrary length.
     */
    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
        (bool success, bytes memory result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.
     */
    function tryModExp(
        bytes memory b,
        bytes memory e,
        bytes memory m
    ) internal view returns (bool success, bytes memory result) {
        if (_zeroBytes(m)) return (false, new bytes(0));

        uint256 mLen = m.length;

        // Encode call args in result and move the free memory pointer
        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);

        assembly ("memory-safe") {
            let dataPtr := add(result, 0x20)
            // Write result on top of args to avoid allocating extra memory.
            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
            // Overwrite the length.
            // result.length > returndatasize() is guaranteed because returndatasize() == m.length
            mstore(result, mLen)
            // Set the memory pointer after the returned data.
            mstore(0x40, add(dataPtr, mLen))
        }
    }

    /**
     * @dev Returns whether the provided byte array is zero.
     */
    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
        for (uint256 i = 0; i < byteArray.length; ++i) {
            if (byteArray[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only
     * using integer operations.
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        unchecked {
            // Take care of easy edge cases when a == 0 or a == 1
            if (a <= 1) {
                return a;
            }

            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
            // the current value as `ε_n = | x_n - sqrt(a) |`.
            //
            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
            // bigger than any uint256.
            //
            // By noticing that
            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
            // to the msb function.
            uint256 aa = a;
            uint256 xn = 1;

            if (aa >= (1 << 128)) {
                aa >>= 128;
                xn <<= 64;
            }
            if (aa >= (1 << 64)) {
                aa >>= 64;
                xn <<= 32;
            }
            if (aa >= (1 << 32)) {
                aa >>= 32;
                xn <<= 16;
            }
            if (aa >= (1 << 16)) {
                aa >>= 16;
                xn <<= 8;
            }
            if (aa >= (1 << 8)) {
                aa >>= 8;
                xn <<= 4;
            }
            if (aa >= (1 << 4)) {
                aa >>= 4;
                xn <<= 2;
            }
            if (aa >= (1 << 2)) {
                xn <<= 1;
            }

            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
            //
            // We can refine our estimation by noticing that the middle of that interval minimizes the error.
            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
            // This is going to be our x_0 (and ε_0)
            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)

            // From here, Newton's method give us:
            // x_{n+1} = (x_n + a / x_n) / 2
            //
            // One should note that:
            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
            //              = ((x_n² + a) / (2 * x_n))² - a
            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
            //              = (x_n² - a)² / (2 * x_n)²
            //              = ((x_n² - a) / (2 * x_n))²
            //              ≥ 0
            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
            //
            // This gives us the proof of quadratic convergence of the sequence:
            // ε_{n+1} = | x_{n+1} - sqrt(a) |
            //         = | (x_n + a / x_n) / 2 - sqrt(a) |
            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
            //         = | (x_n - sqrt(a))² / (2 * x_n) |
            //         = | ε_n² / (2 * x_n) |
            //         = ε_n² / | (2 * x_n) |
            //
            // For the first iteration, we have a special case where x_0 is known:
            // ε_1 = ε_0² / | (2 * x_0) |
            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))
            //     ≤ 2**(e-3) / 3
            //     ≤ 2**(e-3-log2(3))
            //     ≤ 2**(e-4.5)
            //
            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
            // ε_{n+1} = ε_n² / | (2 * x_n) |
            //         ≤ (2**(e-k))² / (2 * 2**(e-1))
            //         ≤ 2**(2*e-2*k) / 2**e
            //         ≤ 2**(e-2*k)
            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above
            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5
            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9
            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18
            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36
            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72

            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
            // sqrt(a) or sqrt(a) + 1.
            return xn - SafeCast.toUint(xn > a / xn);
        }
    }

    /**
     * @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 x) internal pure returns (uint256 r) {
        // If value has upper 128 bits set, log2 result is at least 128
        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
        // If upper 64 bits of 128-bit half set, add 64 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
        // If upper 32 bits of 64-bit half set, add 32 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
        // If upper 16 bits of 32-bit half set, add 16 to result
        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
        // If upper 8 bits of 16-bit half set, add 8 to result
        r |= SafeCast.toUint((x >> r) > 0xff) << 3;
        // If upper 4 bits of 8-bit half set, add 4 to result
        r |= SafeCast.toUint((x >> r) > 0xf) << 2;

        // Shifts value right by the current result and use it as an index into this lookup table:
        //
        // | x (4 bits) |  index  | table[index] = MSB position |
        // |------------|---------|-----------------------------|
        // |    0000    |    0    |        table[0] = 0         |
        // |    0001    |    1    |        table[1] = 0         |
        // |    0010    |    2    |        table[2] = 1         |
        // |    0011    |    3    |        table[3] = 1         |
        // |    0100    |    4    |        table[4] = 2         |
        // |    0101    |    5    |        table[5] = 2         |
        // |    0110    |    6    |        table[6] = 2         |
        // |    0111    |    7    |        table[7] = 2         |
        // |    1000    |    8    |        table[8] = 3         |
        // |    1001    |    9    |        table[9] = 3         |
        // |    1010    |   10    |        table[10] = 3        |
        // |    1011    |   11    |        table[11] = 3        |
        // |    1100    |   12    |        table[12] = 3        |
        // |    1101    |   13    |        table[13] = 3        |
        // |    1110    |   14    |        table[14] = 3        |
        // |    1111    |   15    |        table[15] = 3        |
        //
        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
        assembly ("memory-safe") {
            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
        }
    }

    /**
     * @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
        }
    }

    /**
     * @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
        }
    }

    /**
     * @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 x) internal pure returns (uint256 r) {
        // If value has upper 128 bits set, log2 result is at least 128
        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
        // If upper 64 bits of 128-bit half set, add 64 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
        // If upper 32 bits of 64-bit half set, add 32 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
        // If upper 16 bits of 32-bit half set, add 16 to result
        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
    }

    /**
     * @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
        }
    }

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Ownable2Step.sol";

contract OwnableDelayModule is Ownable2Step {
  address internal delayModule;

  constructor() {
    delayModule = msg.sender;
  }

  function isDelayModule() internal view {
    require(msg.sender == delayModule, "NA");
  }

  function setDelayModule(address _delayModule) external {
    isDelayModule();
    require(_delayModule != address(0), "ODZ");
    delayModule = _delayModule;
  }

  function getDelayModule() external view returns (address) {
    return delayModule;
  }

  /**
   * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
   * Can only be called by the current owner.
   */
  function transferOwnership(address newOwner) public override {
    isDelayModule();
    _pendingOwner = newOwner;
    emit OwnershipTransferStarted(owner(), newOwner);
  }
}

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

pragma solidity ^0.8.20;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity >=0.6.2;

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

/**
 * @dev Interface for the optional metadata functions from the ERC-20 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC4626.sol)

pragma solidity ^0.8.20;

import {IERC20, IERC20Metadata, ERC20} from "../ERC20.sol";
import {SafeERC20} from "../utils/SafeERC20.sol";
import {IERC4626} from "../../../interfaces/IERC4626.sol";
import {Math} from "../../../utils/math/Math.sol";

/**
 * @dev Implementation of the ERC-4626 "Tokenized Vault Standard" as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 *
 * This extension allows the minting and burning of "shares" (represented using the ERC-20 inheritance) in exchange for
 * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
 * the ERC-20 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 introduces configurable virtual assets and shares to help developers 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 even if an attacker is able to capture value from multiple user deposits, 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:ROOT: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 ERC4626 is ERC20, IERC4626 {
    using Math for uint256;

    IERC20 private immutable _asset;
    uint8 private immutable _underlyingDecimals;

    /**
     * @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 (ERC-20 or ERC-777).
     */
    constructor(IERC20 asset_) {
        (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 ok, uint8 assetDecimals) {
        (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, ERC20) returns (uint8) {
        return _underlyingDecimals + _decimalsOffset();
    }

    /// @inheritdoc IERC4626
    function asset() public view virtual returns (address) {
        return address(_asset);
    }

    /// @inheritdoc IERC4626
    function totalAssets() public view virtual returns (uint256) {
        return IERC20(asset()).balanceOf(address(this));
    }

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

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

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

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

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

    /// @inheritdoc IERC4626
    function maxRedeem(address owner) public view virtual returns (uint256) {
        return balanceOf(owner);
    }

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

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

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

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

    /// @inheritdoc IERC4626
    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;
    }

    /// @inheritdoc IERC4626
    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;
    }

    /// @inheritdoc IERC4626
    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;
    }

    /// @inheritdoc IERC4626
    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 {
        // If asset() is ERC-777, `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(IERC20(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 {
        if (caller != owner) {
            _spendAllowance(owner, caller, shares);
        }

        // If asset() is ERC-777, `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(IERC20(asset()), receiver, assets);

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

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

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

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address internal _pendingOwner;

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

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

    // /**
    //  * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
    //  * Can only be called by the current owner.
    //  */
    // function transferOwnership(address newOwner) public virtual override onlyOwner {
    //     _pendingOwner = newOwner;
    //     emit OwnershipTransferStarted(owner(), newOwner);
    // }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() external {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 13 of 23 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }

    /**
     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
     */
    function toUint(bool b) internal pure returns (uint256 u) {
        assembly ("memory-safe") {
            u := iszero(iszero(b))
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)

pragma solidity ^0.8.20;

/**
 * @dev Helper library for emitting standardized panic codes.
 *
 * ```solidity
 * contract Example {
 *      using Panic for uint256;
 *
 *      // Use any of the declared internal constants
 *      function foo() { Panic.GENERIC.panic(); }
 *
 *      // Alternatively
 *      function foo() { Panic.panic(Panic.GENERIC); }
 * }
 * ```
 *
 * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
 *
 * _Available since v5.1._
 */
// slither-disable-next-line unused-state
library Panic {
    /// @dev generic / unspecified error
    uint256 internal constant GENERIC = 0x00;
    /// @dev used by the assert() builtin
    uint256 internal constant ASSERT = 0x01;
    /// @dev arithmetic underflow or overflow
    uint256 internal constant UNDER_OVERFLOW = 0x11;
    /// @dev division or modulo by zero
    uint256 internal constant DIVISION_BY_ZERO = 0x12;
    /// @dev enum conversion error
    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
    /// @dev invalid encoding in storage
    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
    /// @dev empty array pop
    uint256 internal constant EMPTY_ARRAY_POP = 0x31;
    /// @dev array out of bounds access
    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
    /// @dev resource error (too large allocation or too large array)
    uint256 internal constant RESOURCE_ERROR = 0x41;
    /// @dev calling invalid internal function
    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;

    /// @dev Reverts with a panic code. Recommended to use with
    /// the internal constants with predefined codes.
    function panic(uint256 code) internal pure {
        assembly ("memory-safe") {
            mstore(0x00, 0x4e487b71)
            mstore(0x20, code)
            revert(0x1c, 0x24)
        }
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

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

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4626.sol)

pragma solidity >=0.6.2;

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

/**
 * @dev Interface of the ERC-4626 "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 redemption 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);
}

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

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.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 ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /// @inheritdoc IERC20
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

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

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        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}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * 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 {
        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:
     *
     * ```solidity
     * 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 {
        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);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 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 ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-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 ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 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 21 of 23 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 22 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IERC20","name":"_asset","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address[]","name":"_initialAdapters","type":"address[]"},{"internalType":"uint256","name":"_maxAdapters","type":"uint256"},{"internalType":"address","name":"_safeWallet","type":"address"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"uint256","name":"_firstQueueLimit","type":"uint256"},{"internalType":"uint256","name":"_defaultSettleQueueLimit","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AdapterAlreadyExists","type":"error"},{"inputs":[],"name":"AdapterNotFound","type":"error"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterTVLCallFailed","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"BelowMinWithdraw","type":"error"},{"inputs":[],"name":"CannotTransferToVault","type":"error"},{"inputs":[],"name":"CannotUseSettledCounter","type":"error"},{"inputs":[],"name":"ControllerCannotBeOwner","type":"error"},{"inputs":[],"name":"CounterAlreadySettled","type":"error"},{"inputs":[],"name":"DepositsArePaused","type":"error"},{"inputs":[],"name":"DepositsAreQuarantined","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":"EmergencyModeEnabled","type":"error"},{"inputs":[],"name":"EmptyCounterCannotSettle","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientLiquidity","type":"error"},{"inputs":[],"name":"InsufficientShares","type":"error"},{"inputs":[],"name":"InsufficientUSDC","type":"error"},{"inputs":[],"name":"InvalidController","type":"error"},{"inputs":[],"name":"InvalidMaxAdapters","type":"error"},{"inputs":[],"name":"InvalidOraclePrice","type":"error"},{"inputs":[],"name":"InvalidSafeWallet","type":"error"},{"inputs":[],"name":"MinDepositViolated","type":"error"},{"inputs":[],"name":"NoActiveRequests","type":"error"},{"inputs":[],"name":"NotInEmergencyMode","type":"error"},{"inputs":[],"name":"OnlyController","type":"error"},{"inputs":[],"name":"OnlyEmergencyWithdrawals","type":"error"},{"inputs":[],"name":"OnlySafe","type":"error"},{"inputs":[],"name":"PriceOutOfBound","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RequestAlreadySettled","type":"error"},{"inputs":[],"name":"RequestNotFound","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StaleOraclePrice","type":"error"},{"inputs":[],"name":"TooManyActiveRequests","type":"error"},{"inputs":[],"name":"TooManyAdapters","type":"error"},{"inputs":[],"name":"WithdrawalsArePaused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroShares","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterQuarantined","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterUnquarantined","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldController","type":"address"},{"indexed":true,"internalType":"address","name":"newController","type":"address"}],"name":"ControllerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_defaultDueueLimit","type":"uint256"}],"name":"DefaultQueueLimitUpdated","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"navAtDeposit","type":"uint256"}],"name":"DepositWithNAV","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsQuarantined","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsUnpaused","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsUnquarantined","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"EmergencyModeToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"safeWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"actualBal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ExtraUnderlyingSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deployed","type":"uint256"}],"name":"FundsDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMax","type":"uint256"}],"name":"MaxAdaptersUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldSlippage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"MaxSettlementSlippageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":"uint256","name":"totalUSDCPaid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSharesSettled","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementNAV","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestsSettled","type":"uint256"}],"name":"QueueSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newSafeWallet","type":"address"}],"name":"SafeWalletQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldSafeWallet","type":"address"},{"indexed":true,"internalType":"address","name":"newSafeWallet","type":"address"}],"name":"SafeWalletUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxReq","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxReqPerUser","type":"uint256"}],"name":"SetMaxRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMinDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minDeposit","type":"uint256"}],"name":"SetMinDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMinWithdraw","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minWithdraw","type":"uint256"}],"name":"SetMinWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"settleQueueCounter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_queueLimit","type":"uint256"}],"name":"SettleQueueCounterLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCounter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCounter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"counterLimit","type":"uint256"}],"name":"SettleQueueCounterUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"virtualAssetsBase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"virtualSharesBase","type":"uint256"}],"name":"VirtualizationConfigured","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"WithdrawCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentNAV","type":"uint256"}],"name":"WithdrawalRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdcReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementNAV","type":"uint256"}],"name":"WithdrawalSettled","type":"event"},{"anonymous":false,"inputs":[],"name":"WithdrawalsPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"WithdrawalsUnpaused","type":"event"},{"inputs":[],"name":"MIN_REQUESTS_FOR_COUNTER_UPDATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activeRequestIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"adapters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_adapter","type":"address"}],"name":"addAdapter","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"cancelWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultSettleQueueLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"depositPauseStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositsQuarantined","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentNAV","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTVL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDelayModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"counter","type":"uint256"}],"name":"getQueuedSharesByCounter","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getQueuedUsers","outputs":[{"internalType":"uint256[]","name":"requestIds","type":"uint256[]"},{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalAssetsInUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultData","outputs":[{"internalType":"uint256","name":"nav","type":"uint256"},{"internalType":"uint256","name":"totalAssets_","type":"uint256"},{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"address[]","name":"adapters_","type":"address[]"},{"internalType":"uint256","name":"adapterCount","type":"uint256"},{"internalType":"uint256","name":"maxAdapters_","type":"uint256"},{"internalType":"address","name":"safeWallet_","type":"address"},{"internalType":"address","name":"controller_","type":"address"},{"internalType":"bool","name":"emergencyMode_","type":"bool"},{"internalType":"uint256","name":"withdrawalRequestCounter_","type":"uint256"},{"internalType":"bool","name":"depositsQuarantined_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isActiveRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAdapter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isCounterSettled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool[2]","name":"pauseStatuses","type":"bool[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"counter","type":"uint256"}],"name":"isSettlementCounterSettled","outputs":[{"internalType":"bool","name":"settled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestWithdrawRequests","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAdapters","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","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":[],"name":"maxReqPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSettlementSlippage","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":[],"name":"minDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"address","name":"adapter","type":"address"}],"name":"quarantineAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"quarantineDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"quarantinedAdapters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"queuedSharesByCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_adapter","type":"address"}],"name":"removeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"safeWalletQueued","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_delayModule","type":"address"}],"name":"setDelayModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxReq","type":"uint256"}],"name":"setMaxRequestPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setMaxSettlementSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minDeposit","type":"uint256"}],"name":"setMinDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minWithdraw","type":"uint256"}],"name":"setMinWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"token","type":"address[]"},{"internalType":"address[]","name":"oracle","type":"address[]"},{"internalType":"uint256[]","name":"_staleWindow","type":"uint256[]"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_virtAssetsBase","type":"uint256"},{"internalType":"uint256","name":"_virtSharesBase","type":"uint256"}],"name":"setVirtualizationParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalUSDCToPayout","type":"uint256"},{"internalType":"uint256","name":"counterToSettle","type":"uint256"}],"name":"settleQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleQueueCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"settleQueueLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"staleWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sweepExtraUnderlyingToSafeWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_emergencyMode","type":"bool"}],"name":"toggleEmergencyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalQueuedShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"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":[],"name":"unpauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"}],"name":"unquarantineAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unquarantineDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"updateController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultDueueLimit","type":"uint256"}],"name":"updateDefaultQueueLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_safeWallet","type":"address"}],"name":"updateSafeWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queueLimit","type":"uint256"}],"name":"updateSettleQueueCounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_settleQueueCounter","type":"uint256"},{"internalType":"uint256","name":"_queueLimit","type":"uint256"}],"name":"updateSettleQueueCounterLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAdapters","type":"uint256"},{"internalType":"bool","name":"_pauseState","type":"bool"},{"internalType":"bool","name":"_emergencyMode","type":"bool"}],"name":"updateVaultConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userActiveRequestCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualAssetsBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualSharesBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalRequestCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawalRequests","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"settleCounter","type":"uint256"},{"internalType":"bool","name":"settled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60c06040526101f4601e55348015610015575f5ffd5b5060405161625738038061625783398101604081905261003491610697565b888888600361004383826107fe565b50600461005082826107fe565b5050505f5f6100648361028360201b60201c565b9150915081610074576012610076565b805b60ff1660a05250506001600160a01b031660805261009333610359565b600780546001600160a01b0319163317905560016008556001600160a01b0389166100d15760405163d92e233d60e01b815260040160405180910390fd5b845f036100f157604051630c5c20c160e01b815260040160405180910390fd5b6001600160a01b0384166101185760405163628a43fd60e01b815260040160405180910390fd5b306001600160a01b038516036101415760405163628a43fd60e01b815260040160405180910390fd5b6001600160a01b038316610168576040516336abb4df60e11b815260040160405180910390fd5b848651111561018a5760405163016f784b60e61b815260040160405180910390fd5b336001600160a01b038416036101b3576040516399bba97d60e01b815260040160405180910390fd5b600b859055600c8054600e80546001600160a01b038781166001600160a01b03199092169190911790915560ff1990871661010002166001600160a81b03199091161790555f6015819055601c81905580805260226020527fb84cf808d0d5b1ad44962c9bfddd3cfce67763c49ab557cfd0e9f6804faade99839055601d8290555b865181101561026e57610266878281518110610253576102536108b8565b602002602001015161037560201b60201c565b600101610235565b50506001601455506108f99650505050505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290515f918291829182916001600160a01b038716916102c9916108cc565b5f60405180830381855afa9150503d805f8114610301576040519150601f19603f3d011682016040523d82523d5f602084013e610306565b606091505b509150915081801561031a57506020815110155b1561034d575f8180602001905181019061033491906108e2565b905060ff811161034b576001969095509350505050565b505b505f9485945092505050565b600680546001600160a01b0319169055610372816104eb565b50565b6001600160a01b03811661039c5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0381165f9081526018602052604090205460ff16156103d557604051633cb3e7d960e21b815260040160405180910390fd5b600b54600a54106103f95760405163016f784b60e61b815260040160405180910390fd5b5f5b600a5481101561045c57816001600160a01b0316600a8281548110610422576104226108b8565b5f918252602090912001546001600160a01b03160361045457604051633cb3e7d960e21b815260040160405180910390fd5b6001016103fb565b50600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091555f81815260186020526040808220805460ff1916909417909355915190917fcf9c2c7f9adbb156bd76affb04df84595f8f5e69cab2e61221b05b05a902fa2691a250565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0381168114610372575f5ffd5b805161055b8161053c565b919050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561059c5761059c610560565b604052919050565b5f82601f8301126105b3575f5ffd5b81516001600160401b038111156105cc576105cc610560565b6105df601f8201601f1916602001610574565b8181528460208386010111156105f3575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b5f82601f83011261061e575f5ffd5b81516001600160401b0381111561063757610637610560565b8060051b61064760208201610574565b91825260208185018101929081019086841115610662575f5ffd5b6020860192505b8383101561068d57825161067c8161053c565b825260209283019290910190610669565b9695505050505050565b5f5f5f5f5f5f5f5f5f6101208a8c0312156106b0575f5ffd5b6106b98a610550565b60208b01519099506001600160401b038111156106d4575f5ffd5b6106e08c828d016105a4565b60408c015190995090506001600160401b038111156106fd575f5ffd5b6107098c828d016105a4565b60608c015190985090506001600160401b03811115610726575f5ffd5b6107328c828d0161060f565b60808c0151909750955061074a905060a08b01610550565b935061075860c08b01610550565b60e08b0151610100909b0151999c989b50969995989497939695949392505050565b600181811c9082168061078e57607f821691505b6020821081036107ac57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156107f957805f5260205f20601f840160051c810160208510156107d75750805b601f840160051c820191505b818110156107f6575f81556001016107e3565b50505b505050565b81516001600160401b0381111561081757610817610560565b61082b81610825845461077a565b846107b2565b6020601f82116001811461085d575f83156108465750848201515b5f19600385901b1c1916600184901b1784556107f6565b5f84815260208120601f198516915b8281101561088c578785015182556020948501946001909201910161086c565b50848210156108a957868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52603260045260245ffd5b5f82518060208501845e5f920191825250919050565b5f602082840312156108f2575f5ffd5b5051919050565b60805160a0516159406109175f395f50505f61156601526159405ff3fe608060405234801561000f575f5ffd5b5060043610610553575f3560e01c80638129d90a116102bf578063c6e6f59211610186578063e30c3978116100ef578063ec8f0d4d116100a9578063f77c479111610084578063f77c479114610c2e578063f9ab132514610c41578063fbfcae6814610c49578063fef840ff14610c6b575f5ffd5b8063ec8f0d4d14610c08578063ef8b30f714610aee578063f2fde38b14610c1b575f5ffd5b8063e30c397814610ba8578063e4c4be5814610bb9578063e6929a0a14610bc1578063e9f2838e14610bc9578063eb37b53614610bd6578063ec4142f014610bf5575f5ffd5b8063d88150ea11610140578063d88150ea14610b4a578063d905777e14610b53578063dc20c8ff14610b66578063dd62ed3e14610b6f578063dd7694ee14610b82578063e1c99d1b14610b95575f5ffd5b8063c6e6f59214610aee578063c88af39214610b01578063cb1d63d514610b14578063cc3d272114610b1d578063ce96cb7714610b26578063d7f5870314610b39575f5ffd5b8063b2505eed11610228578063bb318d5c116101e2578063bb318d5c14610aa4578063bbde86ec14610aac578063bc85177c14610abf578063c0b8a37214610ac8578063c4aa09d314610adb578063c63d75b61461071c575f5ffd5b8063b2505eed14610a3c578063b3d7f6b914610a4f578063b460af9414610a62578063b88de06314610a75578063ba08765214610a88578063bab6199814610a9b575f5ffd5b806394bf804d1161027957806394bf804d146109de57806395d89b41146109f15780639f01f7ba146109f9578063a16e663514610a0c578063a9059cbb14610a14578063b187bd2614610a27575f5ffd5b80638129d90a146108fa57806388cfce561461090d5780638da5cb5b146109255780638f752c14146109365780638fcc9cfb1461093f578063937b258114610952575f5ffd5b80634cdad5061161041d57806363d8882a116103865780637060b44011610340578063755fe5b81161031b578063755fe5b8146108b757806376686eab146108d657806378ef63ac146108e957806379ba5097146108f2575f5ffd5b80637060b4401461087f57806370a0823114610887578063715018a6146108af575f5ffd5b806363d8882a1461080f57806368c18beb14610817578063693de592146108395780636ab16feb146108415780636e553f65146108635780636fa0d85d14610876575f5ffd5b80635a593024116103d75780635a593024146107a25780635a9b6ac1146107b65780635b8b7c27146107be5780635c975abb146107c757806360d54d41146107d2578063621fd0fa146107e5575f5ffd5b80634cdad506146105c35780634d3b367a146107585780634dfde616146107615780634ef501ac1461077457806356bb54a714610787578063585cd34b1461078f575f5ffd5b806321d1fc60116104bf57806337ffd3471161047957806337ffd347146106ee57806338743b591461070157806338d52e0f14610714578063402d267d1461071c57806340fb9b4d1461073057806341b3d1851461074f575f5ffd5b806321d1fc601461066357806323b872dd14610675578063284e02de14610688578063313ce567146106aa57806334f0a8d9146106b957806335aa134a146106db575f5ffd5b80630905f560116105105780630905f560146105d6578063095ea7b3146105f35780630a28a4771461060657806312c385781461061957806318160ddd146106445780631ffcd7ed1461064c575f5ffd5b806301e1d11414610557578063021919801461057257806303bd6dcd1461057c57806306cb5b661461059b57806306fdde03146105ae57806307a2d13a146105c3575b5f5ffd5b61055f610c8a565b6040519081526020015b60405180910390f35b61057a610ebf565b005b61055f61058a366004615139565b60236020525f908152604090205481565b61057a6105a9366004615174565b610f27565b6105b6610fa7565b604051610569919061518f565b61055f6105d1366004615139565b611037565b600c546105e39060ff1681565b6040519015158152602001610569565b6105e36106013660046151c4565b611048565b61055f610614366004615139565b61105f565b600d5461062c906001600160a01b031681565b6040516001600160a01b039091168152602001610569565b61055f61106b565b610654611087565b60405161056993929190615261565b6025546105e390610100900460ff1681565b6105e36106833660046152a3565b61127b565b6105e3610696366004615139565b5f9081526024602052604090205460ff1690565b60405160128152602001610569565b6105e36106c7366004615174565b60266020525f908152604090205460ff1681565b61057a6106e9366004615139565b6112a0565b61057a6106fc366004615139565b6112ee565b61057a61070f366004615398565b6113c4565b61062c611564565b61055f61072a366004615174565b505f1990565b61055f61073e366004615174565b60126020525f908152604090205481565b61055f60105481565b61055f601c5481565b61057a61076f366004615139565b611588565b61062c610782366004615139565b6115ef565b61057a611617565b61057a61079d366004615174565b611679565b6025546105e3906301000000900460ff1681565b61057a6118c9565b61055f601d5481565b60095460ff166105e3565b61057a6107e0366004615174565b6119b7565b61055f6107f33660046151c4565b601360209081525f928352604080842090915290825290205481565b61057a6119d3565b6105e3610825366004615174565b60186020525f908152604090205460ff1681565b61055f611a35565b6105e361084f366004615139565b601a6020525f908152604090205460ff1681565b61055f610871366004615459565b611a7d565b61055f60165481565b61055f611bc2565b61055f610895366004615174565b6001600160a01b03165f9081526020819052604090205490565b61057a611bcb565b61055f6108c5366004615139565b5f9081526023602052604090205490565b61057a6108e4366004615496565b611bde565b61055f60145481565b61057a611c27565b61057a610908366004615139565b611c9e565b600c5461062c9061010090046001600160a01b031681565b6005546001600160a01b031661062c565b61055f601e5481565b61057a61094d366004615139565b611ce4565b6109a4610960366004615139565b60176020525f90815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039485169593909416939192909160ff1686565b604080516001600160a01b0397881681529690951660208701529385019290925260608401526080830152151560a082015260c001610569565b61055f6109ec366004615459565b611d2a565b6105b6611d4d565b61057a610a07366004615139565b611d5c565b61055f600181565b6105e3610a223660046151c4565b611f74565b610a2f611f81565b60405161056991906154af565b61057a610a4a366004615174565b611fa6565b61055f610a5d366004615139565b611ff6565b61055f610a703660046154e1565b612002565b61057a610a83366004615174565b612423565b61055f610a963660046154e1565b612831565b61055f601f5481565b61055f612c29565b61057a610aba366004615520565b61300b565b61055f60205481565b61057a610ad6366004615174565b6130f2565b61057a610ae9366004615174565b613145565b61055f610afc366004615139565b6131ab565b61057a610b0f366004615540565b6131b6565b61055f600b5481565b61055f600f5481565b61055f610b34366004615174565b613371565b6007546001600160a01b031661062c565b61055f60155481565b61055f610b61366004615174565b613393565b61055f601b5481565b61055f610b7d366004615579565b6133b0565b61057a610b90366004615520565b6133da565b61055f610ba3366004615139565b613ba9565b6006546001600160a01b031661062c565b61057a613bc8565b61057a613c27565b6025546105e39060ff1681565b61055f610be4366004615139565b60226020525f908152604090205481565b61057a610c03366004615139565b613c68565b61057a610c16366004615520565b613d2d565b61057a610c29366004615174565b613e49565b600e5461062c906001600160a01b031681565b61057a613eba565b6105e3610c57366004615139565b60246020525f908152604090205460ff1681565b610c73613ef7565b6040516105699b9a999897969594939291906155a5565b600c545f9060ff1615610d26575f610ca0611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015610cec573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d109190615617565b9050601f5481610d209190615642565b91505090565b600a545f90815b8181108015610d3d5750600b5481105b15610e21575f600a8281548110610d5657610d56615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff1615610d8b5750610e19565b806001600160a01b0316636e07302b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610de5575060408051601f3d908101601f19168201909252610de291810190615617565b60015b610e1257604051635bc417b160e11b81526001600160a01b03821660048201526024015b60405180910390fd5b9390930192505b600101610d2d565b505f610e2b611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015610e77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e9b9190615617565b9050610ea78184615642565b9250601f5483610eb79190615642565b935050505090565b600e546001600160a01b03163314610eea57604051635990781360e01b815260040160405180910390fd5b6025805463ff000000191663010000001790556040517fdeeb69430b7153361c25d630947115165636e6a723fa8daea4b0de34b3247459905f90a1565b610f2f613ff8565b6001600160a01b038116610f56576040516336abb4df60e11b815260040160405180910390fd5b600e80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1c87e2bbc4e5fa5d7f6f8c44d66cb241dff224b8602eb5435ca2076d2a5c6fc2905f90a35050565b606060038054610fb690615669565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe290615669565b801561102d5780601f106110045761010080835404028352916020019161102d565b820191905f5260205f20905b81548152906001019060200180831161101057829003601f168201915b5050505050905090565b5f611042825f614052565b92915050565b5f336110558185856141f0565b5060019392505050565b5f6110428260016141fd565b5f60205461107860025490565b6110829190615642565b905090565b601954606090819081908067ffffffffffffffff8111156110aa576110aa6152e1565b6040519080825280602002602001820160405280156110d3578160200160208202803683370190505b5093508067ffffffffffffffff8111156110ef576110ef6152e1565b604051908082528060200260200182016040528015611118578160200160208202803683370190505b5092508067ffffffffffffffff811115611134576111346152e1565b60405190808252806020026020018201604052801561115d578160200160208202803683370190505b5091505f5b81811015611274575f6019828154811061117e5761117e615655565b5f91825260208083209091015480835260178252604092839020835160c08101855281546001600160a01b03908116825260018301541693810193909352600281015493830193909352600383015460608301526004830154608083015260059092015460ff16151560a0820152875191925090829088908590811061120657611206615655565b602002602001018181525050805f015186848151811061122857611228615655565b60200260200101906001600160a01b031690816001600160a01b031681525050806040015185848151811061125f5761125f615655565b60209081029190910101525050600101611162565b5050909192565b5f336112888582856143a2565b611293858585614406565b60019150505b9392505050565b6112a8613ff8565b600f80549082905560408051828152602081018490527f26fc4e16c739648a3cabd49425a14877b9a014cfd363be9f35c6feb6c3fdc27791015b60405180910390a15050565b6112f6613ff8565b6107d081111561133f5760405162461bcd60e51b81526020600482015260146024820152734d6178696d756d2032302520736c69707061676560601b6044820152606401610e09565b60648110156113865760405162461bcd60e51b81526020600482015260136024820152724d696e696d756d20312520736c69707061676560681b6044820152606401610e09565b601e80549082905560408051828152602081018490527f48906d6b1d9e74a39fd9d9289e75ee5bc5856fe98800c1d3ce67a18b63880c2091016112e2565b6113cc613ff8565b825184511415806113de575082518114155b156113fc5760405163512509d360e11b815260040160405180910390fd5b5f5b845181101561155d575f83838381811061141a5761141a615655565b9050602002013511801561144957506201518083838381811061143f5761143f615655565b9050602002013511155b61148b5760405162461bcd60e51b8152602060048201526013602482015272496e76616c6964207374616c6557696e646f7760681b6044820152606401610e09565b83818151811061149d5761149d615655565b602002602001015160115f8784815181106114ba576114ba615655565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082828281811061151657611516615655565b9050602002013560125f86848151811061153257611532615655565b6020908102919091018101516001600160a01b031682528101919091526040015f20556001016113fe565b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000090565b600e546001600160a01b031633146115b357604051635990781360e01b815260040160405180910390fd5b601d8190556040518181527f7868b49a4010376b5c0d2aa4c7eec0e84e1fa9a7f82667bd5bea9a9de5d383ea906020015b60405180910390a150565b600a81815481106115fe575f80fd5b5f918252602090912001546001600160a01b0316905081565b600e546001600160a01b0316331461164257604051635990781360e01b815260040160405180910390fd5b6025805460ff191660011790556040517f6022a9e759c95aad593773b7a47586ff34cddc74d34ea6361f64c5bac98cf294905f90a1565b611681613ff8565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116bd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116e19190615617565b1561172e5760405162461bcd60e51b815260206004820152601c60248201527f41646170746572206861732061637469766520706f736974696f6e73000000006044820152606401610e09565b6001600160a01b0381165f9081526018602052604090205460ff1661176657604051637bd8dfc760e11b815260040160405180910390fd5b5f805b600a5481101561186157826001600160a01b0316600a828154811061179057611790615655565b5f918252602090912001546001600160a01b03160361185957600a80546117b9906001906156a1565b815481106117c9576117c9615655565b5f91825260209091200154600a80546001600160a01b0390921691839081106117f4576117f4615655565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a805480611830576118306156b4565b5f8281526020902081015f1990810180546001600160a01b031916905501905560019150611861565b600101611769565b508061188057604051637bd8dfc760e11b815260040160405180910390fd5b6001600160a01b0382165f81815260186020526040808220805460ff19169055517fdf980d21d8c7bb34800e668dbe003299093bac8e693614151d3c57f73f98a93d9190a25050565b6118d1613ff8565b5f6118da611564565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611921573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119459190615617565b600c54909150611967906001600160a01b038481169161010090041683614463565b600c54604080518381524260208201526101009092046001600160a01b0316917f2a29498f8624cccc0d482ba111f45eea856619e7197449687c96635b84c5a11491015b60405180910390a25050565b6119bf613ff8565b6119c76144c2565b6119d0816144e6565b50565b600e546001600160a01b031633146119fe57604051635990781360e01b815260040160405180910390fd5b6025805463ff000000191690556040517f823084e804e36d8971e8b86749b6b0ace7b9f87ed272bef910c1e72d123eeb48905f90a1565b5f5f611a3f61106b565b9050805f03611a5757670de0b6b3a764000091505090565b5f611a60612c29565b9050611a7681670de0b6b3a7640000845f61465c565b9250505090565b5f611a866146a7565b611a8e6144c2565b600c5460ff1615611ab2576040516310326a8d60e11b815260040160405180910390fd5b602554610100900460ff1615611adb5760405163efaf4e0960e01b815260040160405180910390fd5b6025546301000000900460ff1615611b0657604051630b4cba3160e31b815260040160405180910390fd5b826010541115611b295760405163478bb70f60e01b815260040160405180910390fd5b611b3383836146d1565b600c54909150611b649061010090046001600160a01b031684611b54611564565b6001600160a01b03169190614463565b6001600160a01b038216337f04012be6878140390e13a3d11b44fe235daeff975b9278396470cc65515bc36d8584611b9a611a35565b6040805193845260208401929092529082015260600160405180910390a36110426001600855565b5f611082612c29565b611bd3613ff8565b611bdc5f6146ec565b565b611be6613ff8565b600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c840906020016115e4565b60065433906001600160a01b03168114611c955760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610e09565b6119d0816146ec565b611ca6613ff8565b601480549082905560408051828152602081018490527f11389fc971218d4b251d5b0e38a98af9b8a9947ad9bc77d850121d4a76290aed91016112e2565b611cec613ff8565b601080549082905560408051828152602081018490527f1dbbe91e11267d8261b171010af0890734a6f9a4d6ec75ea2fdc17dabb7905e591016112e2565b5f5f195f611d3785611ff6565b9050611d4533858388614705565b949350505050565b606060048054610fb690615669565b5f81815260176020526040902080546001600160a01b03163314611db25760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b6044820152606401610e09565b5f828152601a602052604090205460ff16611e025760405162461bcd60e51b815260206004820152601060248201526f5265717565737420696e61637469766560801b6044820152606401610e09565b601c54816004015414611e575760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742063616e63656c20736574746c656420636f756e7465720000006044820152606401610e09565b60028101546004820154335f9081526013602090815260408083208484529091528120805460019290611e8b9084906156a1565b909155505081611ed15760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81d1bc818d85b98d95b607a1b6044820152606401610e09565b611edc303384614406565b81601b5f828254611eed91906156a1565b90915550505f8181526023602052604081208054849290611f0f9084906156a1565b90915550505f60028401819055848152601a602052604090819020805460ff1916905551849033907f1575adcdc526a67d3f6e771cd9123208ea6b3f48534cbc0ceec405608cc5860590611f669086815260200190565b60405180910390a350505050565b5f33611055818585614406565b611f8961511b565b60255460ff63010000008204811615158352161515602082015290565b611fae613ff8565b6001600160a01b0381165f81815260266020526040808220805460ff19169055517f2cd0112e7d04167fb90200723b45a6020b6f216132674ad9a6afad9f8b409cc99190a250565b5f611042826001614052565b5f61200b6146a7565b6120136144c2565b600c5460ff1615612037576040516310326a8d60e11b815260040160405180910390fd5b835f0361205757604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03831661207e5760405163d92e233d60e01b815260040160405180910390fd5b60255460ff16156120a2576040516370a7336d60e11b815260040160405180910390fd5b6014546001600160a01b0383165f908152601360209081526040808320601c548452909152902054106120e8576040516353c034cf60e01b815260040160405180910390fd5b601c545f9081526024602052604090205460ff161561211a576040516391d1173960e01b815260040160405180910390fd5b6121238461105f565b9050600f548111612147576040516336633d3760e01b815260040160405180910390fd5b6001600160a01b0382163314612192575f61216283336133b0565b90508181101561218557604051633999656760e01b815260040160405180910390fd5b6121908333846143a2565b505b806121b1836001600160a01b03165f9081526020819052604090205490565b10156121d057604051633999656760e01b815260040160405180910390fd5b6025805462ff00001916620100001790556121ec823083614406565b6025805462ff000019169055601580545f9190829061220a906156c8565b9182905550601680549192505f612220836156c8565b9091555050601c545f90815260226020526040902054601654111561226d57601c8054905f61224e836156c8565b9091555050601d54601c545f9081526022602052604090205560016016555b6001600160a01b0383165f908152601360209081526040808320601c548452909152812080549161229d836156c8565b90915550506040805160c0810182526001600160a01b03808616825286811660208084019182528385018781524260608601908152601c54608087019081525f60a088018181528a825260178652898220985189549089166001600160a01b0319918216178a55965160018a8101805492909a169190981617909755925160028801559051600387015551600486015592516005909401805494151560ff19958616179055601980548084019091557f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501869055858352601a905292812080549092169092179055601b8054849290612397908490615642565b9091555050601c545f90815260236020526040812080548492906123bc908490615642565b90915550506001600160a01b038085169084167f3aeb15af61588a39bcfafb19ed853140d195c2a924537afbf9a6d04348e76a6984846123fa611a35565b6040805193845260208401929092529082015260600160405180910390a3506112996001600855565b61242b6146a7565b6007546001600160a01b031633146124795760405162461bcd60e51b81526020600482015260116024820152704f6e6c792064656c6179206d6f64756c6560781b6044820152606401610e09565b6001600160a01b0381166124a05760405163d92e233d60e01b815260040160405180910390fd5b306001600160a01b038216036124c95760405163628a43fd60e01b815260040160405180910390fd5b600c546001600160a01b038281166101009092041614612827575f6124ec611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015612538573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061255c9190615617565b905080156125c45760405162461bcd60e51b815260206004820152602f60248201527f4f6c6420736166652077616c6c6574206861732055534443202d206d6967726160448201526e1d1948185cdcd95d1cc8199a5c9cdd608a1b6064820152608401610e09565b5f805b600a548110156126b3575f600a82815481106125e5576125e5615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff161561261a57506126ab565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612674575060408051601f3d908101601f1916820190925261267191810190615617565b60015b61269c57604051635bc417b160e11b81526001600160a01b0382166004820152602401610e09565b6126a68185615642565b935050505b6001016125c7565b5080156127285760405162461bcd60e51b815260206004820152603f60248201527f416461707465727320686176652061637469766520706f736974696f6e73202d60448201527f206d696772617465206265666f7265206368616e67696e672077616c6c6574006064820152608401610e09565b601b541561279e5760405162461bcd60e51b815260206004820152603760248201527f416374697665207769746864726177616c207175657565202d20736574746c6560448201527f206265666f7265206368616e67696e672077616c6c65740000000000000000006064820152608401610e09565b600c80546001600160a01b03858116610100908102610100600160a81b0319841617909355600d549290910481169116156127e457600d80546001600160a01b03191690555b836001600160a01b0316816001600160a01b03167e5cd7e3d6890000c92693f661e9926eecc4ef7d749ebcf2a7f3fb2a6867883060405160405180910390a35050505b6119d06001600855565b5f61283a6146a7565b6128426144c2565b600c5460ff1615612866576040516310326a8d60e11b815260040160405180910390fd5b835f0361288657604051639811e0c760e01b815260040160405180910390fd5b6001600160a01b0383166128ad5760405163d92e233d60e01b815260040160405180910390fd5b60255460ff16156128d1576040516370a7336d60e11b815260040160405180910390fd5b600f5484116128f3576040516336633d3760e01b815260040160405180910390fd5b6014546001600160a01b0383165f908152601360209081526040808320601c54845290915290205410612939576040516353c034cf60e01b815260040160405180910390fd5b601c545f9081526024602052604090205460ff161561296b576040516391d1173960e01b815260040160405180910390fd5b61297484611037565b90506001600160a01b03821633146129c1575f61299183336133b0565b9050848110156129b457604051633999656760e01b815260040160405180910390fd5b6129bf8333876143a2565b505b836129e0836001600160a01b03165f9081526020819052604090205490565b10156129ff57604051633999656760e01b815260040160405180910390fd5b6025805462ff0000191662010000179055612a1b823086614406565b6025805462ff000019169055601580545f91908290612a39906156c8565b9182905550601680549192505f612a4f836156c8565b9091555050601c545f908152602260205260409020546016541115612a9c57601c8054905f612a7d836156c8565b9091555050601d54601c545f9081526022602052604090205560016016555b6001600160a01b0383165f908152601360209081526040808320601c5484529091528120805491612acc836156c8565b90915550506040805160c0810182526001600160a01b03808616825286811660208084019182528385018a81524260608601908152601c54608087019081525f60a088018181528a825260178652898220985189549089166001600160a01b0319918216178a55965160018a8101805492909a169190981617909755925160028801559051600387015551600486015592516005909401805494151560ff19958616179055601980548084019091557f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501869055858352601a905292812080549092169092179055601b8054879290612bc6908490615642565b9091555050601c545f9081526023602052604081208054879290612beb908490615642565b90915550506001600160a01b038085169084167f3aeb15af61588a39bcfafb19ed853140d195c2a924537afbf9a6d04348e76a6987846123fa611a35565b5f5f612c33611564565b90505f816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c72573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c9691906156e0565b60ff1690505f81601211612caa575f612cb5565b612cb58260126156a1565b6001600160a01b038085165f908152601160205260409020549192501680612d1f5760405162461bcd60e51b815260206004820152601e60248201527f5072696365206f7261636c65206e6f742073657420666f7220617373657400006044820152606401610e09565b5f612d2982614770565b50600c5490915060ff1615612e1f57600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201525f918716906370a0823190602401602060405180830381865afa158015612d86573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612daa9190615617565b90505f612dd4612dbb86600a6157e3565b612dc590846157ee565b84670de0b6b3a7640000614b8b565b90505f612de286600a6157e3565b601f54612def91906157ee565b90505f612e058286670de0b6b3a7640000614b8b565b9050612e118184615642565b995050505050505050505090565b600a545f90815b8181108015612e365750600b5481105b15612f15575f600a8281548110612e4f57612e4f615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff1615612e845750612f0d565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ede575060408051601f3d908101601f19168201909252612edb91810190615617565b60015b612f0657604051635bc417b160e11b81526001600160a01b0382166004820152602401610e09565b9390930192505b600101612e26565b50600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201525f918916906370a0823190602401602060405180830381865afa158015612f64573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f889190615617565b90505f612fb2612f9988600a6157e3565b612fa390846157ee565b86670de0b6b3a7640000614b8b565b9050612fbe8185615642565b93505f612fcc88600a6157e3565b601f54612fd991906157ee565b90505f612fef8288670de0b6b3a7640000614b8b565b9050612ffb8187615642565b9c9b505050505050505050505050565b613013613ff8565b60215460ff161561305b5760405162461bcd60e51b8152602060048201526012602482015271105b1c9958591e4818dbdb999a59dd5c995960721b6044820152606401610e09565b5f8211801561306957505f81115b6130a65760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b6044820152606401610e09565b601f82905560208181556021805460ff19166001179055604080518481529182018390527f171d3d4c4c825d590ef0ee55f60220c40c3655c72f46f3e7fd0d67d7386dae9d91016112e2565b6130fa613ff8565b6001600160a01b0381165f81815260266020526040808220805460ff19166001179055517fd7fedf311ee2376b0669ff5505fcbde8322725ac23644f17b0b6e2408ea004d69190a250565b61314d614c3b565b6001600160a01b0381166131895760405162461bcd60e51b815260206004820152600360248201526227a22d60e91b6044820152606401610e09565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b5f611042825f6141fd565b6131be613ff8565b600c5460ff161580156131cf575080155b156131ed5760405163197b261160e21b815260040160405180910390fd5b600c5460ff161580156131fd5750805b15613280575f831180613219575060095460ff16151582151514155b156132375760405163197b261160e21b815260040160405180910390fd5b600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c8409060200160405180910390a1505050565b82156132ec57600a548310156132a95760405163016f784b60e61b815260040160405180910390fd5b600b80549084905560408051828152602081018690527f8a0629a30d225e1651321c029707ae1546f1e895d6ab27551bf40a2259e2ab68910160405180910390a1505b60095460ff1615158215151461331757811561330f5761330a614c7a565b613317565b613317614cd4565b600c5460ff1615158115151461336c57600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c8409060200160405180910390a15b505050565b6001600160a01b0381165f90815260208190526040812054611042905f614052565b6001600160a01b0381165f90815260208190526040812054611042565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6133e26146a7565b600c5461010090046001600160a01b031633146134125760405163d7fed6bd60e01b815260040160405180910390fd5b5f8181526024602052604090205460ff1615613441576040516387b273b960e01b815260040160405180910390fd5b5f81815260236020526040812054900361346e576040516302f8fe3560e31b815260040160405180910390fd5b815f0361348e5760405163fe7e4c3560e01b815260040160405180910390fd5b81613497611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa1580156134e3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135079190615617565b10156135265760405163fe7e4c3560e01b815260040160405180910390fd5b8161352f611564565b600c54604051636eb1769f60e11b81526001600160a01b036101009092048216600482015230602482015291169063dd62ed3e90604401602060405180830381865afa158015613581573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135a59190615617565b10156135c4576040516313be252b60e01b815260040160405180910390fd5b5f6135cd611a35565b600c549091506136009061010090046001600160a01b031630856135ef611564565b6001600160a01b0316929190614d0d565b5f828152602360205260408120546136289085906c0c9f2c9cd04674edea4000000090614b8b565b90505f612710601e5461271061363e91906156a1565b61364890856157ee565b6136529190615819565b90505f612710601e546127106136689190615642565b61367290866157ee565b61367c9190615819565b9050818310156136dd5760405162461bcd60e51b815260206004820152602660248201527f536574746c656d656e74204e41562062656c6f77206d696e696d756d20746872604482015265195cda1bdb1960d21b6064820152608401610e09565b8083111561373c5760405162461bcd60e51b815260206004820152602660248201527f536574746c656d656e74204e41562061626f7665206d6178696d756d20746872604482015265195cda1bdb1960d21b6064820152608401610e09565b50506019545f9067ffffffffffffffff81111561375b5761375b6152e1565b604051908082528060200260200182016040528015613784578160200160208202803683370190505b5090505f80805b60195481101561381a575f601982815481106137a9576137a9615655565b5f9182526020808320909101548083526017909152604090912060058101549192509060ff161580156137df5750888160040154145b1561381057818686815181106137f7576137f7615655565b60209081029190910101528461380c816156c8565b9550505b505060010161378b565b505f5b82811015613944575f84828151811061383857613838615655565b602002602001015190505f60175f8381526020019081526020015f2090505f61387782600201548c60235f8e81526020019081526020015f2054614b8b565b60058301805460ff1916600117905560028301549091506138989086615642565b5f848152601a60205260409020805460ff1916905560028301549095506138c0903090614d46565b60018201546138db906001600160a01b031682611b54611564565b600182015482546002840154604080519182526020820185905281018b90526001600160a01b03928316929091169085907f91de9a7ea75480b6e4db60f7c0a142c2a3148bf82fbe71edf0c218d729c3b36c9060600160405180910390a450505060010161381d565b5080601b5f82825461395691906156a1565b90915550505f86815260236020908152604080832083905560249091528120805460ff1916600117905560195490805b82811015613a1f57601a5f601983815481106139a4576139a4615655565b5f918252602080832090910154835282019290925260400190205460ff1615613a1757808214613a0957601981815481106139e1576139e1615655565b905f5260205f200154601983815481106139fd576139fd615655565b5f918252602090912001555b81613a13816156c8565b9250505b600101613986565b505f613a2b82846156a1565b90505f5b81811015613a66576019805480613a4857613a486156b4565b5f8281526020812082015f1990810191909155019055600101613a2f565b50604080518b815260208101869052908101889052606081018690527ff55c89f8cba9d727bffa5994a241d4c88ef19bcb1435090f60a7e5addfb6ca4c9060800160405180910390a15f613ab8611564565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613afc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b209190615617565b90508015613b9257600c54613b469061010090046001600160a01b031682611b54611564565b600c54604080518381524260208201526101009092046001600160a01b0316917f2a29498f8624cccc0d482ba111f45eea856619e7197449687c96635b84c5a114910160405180910390a25b505050505050505050613ba56001600855565b5050565b60198181548110613bb8575f80fd5b5f91825260209091200154905081565b600e546001600160a01b03163314613bf357604051635990781360e01b815260040160405180910390fd5b6025805460ff191690556040517f73f109ff397323e276e38b27fa4bf2a3d7bc07fb71be9fccbcd541e39140ea3f905f90a1565b613c2f613ff8565b6025805461ff0019166101001790556040517f9d698fd24be4742b66dfed36fcf4fba3a96cc75981a270d5c522face9ee8bcea905f90a1565b600e546001600160a01b03163314613c9357604051635990781360e01b815260040160405180910390fd5b601c545f9081526023602052604090205460011115613cc55760405163569d142960e01b815260040160405180910390fd5b601c80549081905f613cd6836156c8565b9091555050601c80545f90815260226020908152604091829020859055915481518481529283015281018390527f84bac22106eba2c39942f15c2d88947f759b7dfa7b606356cf8ec2f03e18517b906060016112e2565b600e546001600160a01b03163314613d5857604051635990781360e01b815260040160405180910390fd5b601c54821015613daa5760405162461bcd60e51b815260206004820152601e60248201527f63616e277420757064617465206f6c6420636f756e746572206c696d697400006044820152606401610e09565b601c548203613e0557601654811015613e055760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177616c7320616c7265616479207265676973746572656400006044820152606401610e09565b5f82815260226020908152604091829020839055601c5491518381527f902e2e6b752663edace480c0fd2f609e0545646292fed74b34294c8090d1a7e891016119ab565b613e51614c3b565b600680546001600160a01b0383166001600160a01b03199091168117909155613e826005546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b613ec2613ff8565b6025805461ff00191690556040517f1646ce43ade83b19f47eb6d0baa4777d8262c5d9e922b5a74a99701f23c19f1d905f90a1565b5f5f5f60605f5f5f5f5f5f5f613f0b61106b565b9850613f15611bc2565b9950613f1f611a35565b9a508a8a8a600a8080549050600b54600c60019054906101000a90046001600160a01b0316600e5f9054906101000a90046001600160a01b0316600c5f9054906101000a900460ff16601554602560019054906101000a900460ff1687805480602002602001604051908101604052809291908181526020018280548015613fce57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311613fb0575b505050505097509a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6005546001600160a01b03163314611bdc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e09565b5f5f61405c61106b565b90505f614067611564565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140a2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140c691906156e0565b60ff1690505f816012116140da575f6140e5565b6140e58260126156a1565b90505f60115f6140f3611564565b6001600160a01b03908116825260208201929092526040015f2054169050806141555760405162461bcd60e51b8152602060048201526014602482015273141c9a58d9481bdc9858db19481b9bdd081cd95d60621b6044820152606401610e09565b5f61415f82614770565b5090505f855f036141855761417e89670de0b6b3a7640000808b61465c565b90506141b6565b5f61418e612c29565b9050805f036141a6575f975050505050505050611042565b6141b28a82898c61465c565b9150505b5f6141cb82670de0b6b3a7640000858c61465c565b90506141d885600a6157e3565b6141e29082615819565b9a9950505050505050505050565b61336c8383836001614d7a565b5f5f614207611564565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614242573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061426691906156e0565b60ff1690505f8160121161427a575f614285565b6142858260126156a1565b90505f61429382600a6157e3565b61429d90876157ee565b90505f60115f6142ab611564565b6001600160a01b03908116825260208201929092526040015f20541690508061430d5760405162461bcd60e51b8152602060048201526014602482015273141c9a58d9481bdc9858db19481b9bdd081cd95d60621b6044820152606401610e09565b5f61431782614770565b5090505f61432f8483670de0b6b3a76400008b61465c565b90505f61433a61106b565b9050805f036143655761435782670de0b6b3a7640000808c61465c565b975050505050505050611042565b5f61436e612c29565b9050805f03614387575f98505050505050505050611042565b6143938383838d61465c565b9b9a5050505050505050505050565b5f6143ad84846133b0565b90505f1981101561440057818110156143f257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610e09565b61440084848484035f614d7a565b50505050565b6001600160a01b03831661442f57604051634b637e8f60e11b81525f6004820152602401610e09565b6001600160a01b0382166144585760405163ec442f0560e01b81525f6004820152602401610e09565b61336c838383614e3e565b6040516001600160a01b0383811660248301526044820183905261336c91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614e88565b60095460ff1615611bdc5760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b03811661450d5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0381165f9081526018602052604090205460ff161561454657604051633cb3e7d960e21b815260040160405180910390fd5b600b54600a541061456a5760405163016f784b60e61b815260040160405180910390fd5b5f5b600a548110156145cd57816001600160a01b0316600a828154811061459357614593615655565b5f918252602090912001546001600160a01b0316036145c557604051633cb3e7d960e21b815260040160405180910390fd5b60010161456c565b50600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091555f81815260186020526040808220805460ff1916909417909355915190917fcf9c2c7f9adbb156bd76affb04df84595f8f5e69cab2e61221b05b05a902fa2691a250565b5f61468961466983614ef4565b801561468457505f848061467f5761467f615805565b868809115b151590565b614694868686614b8b565b61469e9190615642565b95945050505050565b6002600854036146ca57604051633ee5aeb560e01b815260040160405180910390fd5b6002600855565b5f5f195f6146de856131ab565b9050611d4533858784614705565b600680546001600160a01b03191690556119d081614f20565b614718614710611564565b853085614d0d565b6147228382614f71565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78484604051611f66929190918252602082015260400190565b5f806001600160a01b0383166147995760405163d92e233d60e01b815260040160405180910390fd5b5f5f5f5f866001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156147d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147fd9190615845565b9450945050935093505f83136148255760405162fc7cad60e51b815260040160405180910390fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff16101561485e57604051631510fe5b60e31b815260040160405180910390fd5b604084811c61ffff9081169183901c16146148ac5760405162461bcd60e51b815260206004820152600e60248201526d0a0d0c2e6ca40dad2e6dac2e8c6d60931b6044820152606401610e09565b5f821180156148bb5750428211155b6148fb5760405162461bcd60e51b81526020600482015260116024820152700496e76616c69642074696d657374616d7607c1b6044820152606401610e09565b6001600160a01b0387165f8181526012602090815260409182902054825163313ce56760e01b8152925190939263313ce5679260048083019391928290030181865afa15801561494d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061497191906156e0565b955083601260ff881610156149a75761498b876012615893565b61499690600a6158ac565b6149a090826157ee565b97506149d7565b60128760ff1611156149d3576149be601288615893565b6149c990600a6158ac565b6149a09082615819565b8097505b5f896001600160a01b031663245a7bfc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a14573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614a3891906158ba565b90505f816001600160a01b03166322adbc786040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614a9b9190615617565b90505f826001600160a01b03166370da2f676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614ada573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614afe9190615617565b90508084101580614b0f5750818411155b15614b2d5760405163953964f160e01b815260040160405180910390fd5b8415614b7d57865f03614b5357604051631510fe5b60e31b815260040160405180910390fd5b84614b5e88426156a1565b1115614b7d57604051631510fe5b60e31b815260040160405180910390fd5b505050505050505050915091565b5f5f5f614b988686614fa5565b91509150815f03614bbc57838181614bb257614bb2615805565b0492505050611299565b818411614bd357614bd36003851502601118614fc1565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b6007546001600160a01b03163314611bdc5760405162461bcd60e51b81526020600482015260026024820152614e4160f01b6044820152606401610e09565b614c826144c2565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614cb73390565b6040516001600160a01b03909116815260200160405180910390a1565b614cdc614fd2565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614cb7565b6040516001600160a01b0384811660248301528381166044830152606482018390526144009186918216906323b872dd90608401614490565b6001600160a01b038216614d6f57604051634b637e8f60e11b81525f6004820152602401610e09565b613ba5825f83614e3e565b6001600160a01b038416614da35760405163e602df0560e01b81525f6004820152602401610e09565b6001600160a01b038316614dcc57604051634a1406b160e11b81525f6004820152602401610e09565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561440057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051611f6691815260200190565b6001600160a01b03821630148015614e5f575060255462010000900460ff16155b15614e7d57604051639dba6a7560e01b815260040160405180910390fd5b61336c838383614ff5565b5f5f60205f8451602086015f885af180614ea7576040513d5f823e3d81fd5b50505f513d91508115614ebe578060011415614ecb565b6001600160a01b0384163b155b1561440057604051635274afe760e01b81526001600160a01b0385166004820152602401610e09565b5f6002826003811115614f0957614f096158d5565b614f1391906158e9565b60ff166001149050919050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038216614f9a5760405163ec442f0560e01b81525f6004820152602401610e09565b613ba55f8383614e3e565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b60095460ff16611bdc57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b03831661501f578060025f8282546150149190615642565b9091555061508f9050565b6001600160a01b0383165f90815260208190526040902054818110156150715760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610e09565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166150ab576002805482900390556150c9565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161510e91815260200190565b60405180910390a3505050565b60405180604001604052806002906020820280368337509192915050565b5f60208284031215615149575f5ffd5b5035919050565b6001600160a01b03811681146119d0575f5ffd5b803561516f81615150565b919050565b5f60208284031215615184575f5ffd5b813561129981615150565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f604083850312156151d5575f5ffd5b82356151e081615150565b946020939093013593505050565b5f8151808452602084019350602083015f5b8281101561521e578151865260209586019590910190600101615200565b5093949350505050565b5f8151808452602084019350602083015f5b8281101561521e5781516001600160a01b031686526020958601959091019060010161523a565b606081525f61527360608301866151ee565b82810360208401526152858186615228565b9050828103604084015261529981856151ee565b9695505050505050565b5f5f5f606084860312156152b5575f5ffd5b83356152c081615150565b925060208401356152d081615150565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112615304575f5ffd5b813567ffffffffffffffff81111561531e5761531e6152e1565b8060051b604051601f19603f830116810181811067ffffffffffffffff8211171561534b5761534b6152e1565b604052918252602081850181019290810186841115615368575f5ffd5b6020860192505b8383101561538e5761538083615164565b81526020928301920161536f565b5095945050505050565b5f5f5f5f606085870312156153ab575f5ffd5b843567ffffffffffffffff8111156153c1575f5ffd5b6153cd878288016152f5565b945050602085013567ffffffffffffffff8111156153e9575f5ffd5b6153f5878288016152f5565b935050604085013567ffffffffffffffff811115615411575f5ffd5b8501601f81018713615421575f5ffd5b803567ffffffffffffffff811115615437575f5ffd5b8760208260051b840101111561544b575f5ffd5b949793965060200194505050565b5f5f6040838503121561546a575f5ffd5b82359150602083013561547c81615150565b809150509250929050565b8035801515811461516f575f5ffd5b5f602082840312156154a6575f5ffd5b61129982615487565b6040810181835f5b60028110156154d857815115158352602092830192909101906001016154b7565b50505092915050565b5f5f5f606084860312156154f3575f5ffd5b83359250602084013561550581615150565b9150604084013561551581615150565b809150509250925092565b5f5f60408385031215615531575f5ffd5b50508035926020909101359150565b5f5f5f60608486031215615552575f5ffd5b8335925061556260208501615487565b915061557060408501615487565b90509250925092565b5f5f6040838503121561558a575f5ffd5b823561559581615150565b9150602083013561547c81615150565b8b81528a602082015289604082015261016060608201525f6155cb61016083018b615228565b60808301999099525060a08101969096526001600160a01b0394851660c08701529290931660e08501521515610100840152610120830191909152151561014090910152949350505050565b5f60208284031215615627575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156110425761104261562e565b634e487b7160e01b5f52603260045260245ffd5b600181811c9082168061567d57607f821691505b60208210810361569b57634e487b7160e01b5f52602260045260245ffd5b50919050565b818103818111156110425761104261562e565b634e487b7160e01b5f52603160045260245ffd5b5f600182016156d9576156d961562e565b5060010190565b5f602082840312156156f0575f5ffd5b815160ff81168114611299575f5ffd5b6001815b600184111561573b5780850481111561571f5761571f61562e565b600184161561572d57908102905b60019390931c928002615704565b935093915050565b5f8261575157506001611042565b8161575d57505f611042565b8160018114615773576002811461577d57615799565b6001915050611042565b60ff84111561578e5761578e61562e565b50506001821b611042565b5060208310610133831016604e8410600b84101617156157bc575081810a611042565b6157c85f198484615700565b805f19048211156157db576157db61562e565b029392505050565b5f6112998383615743565b80820281158282048414176110425761104261562e565b634e487b7160e01b5f52601260045260245ffd5b5f8261582757615827615805565b500490565b805169ffffffffffffffffffff8116811461516f575f5ffd5b5f5f5f5f5f60a08688031215615859575f5ffd5b6158628661582c565b602087015160408801516060890151929750909550935091506158876080870161582c565b90509295509295909350565b60ff82811682821603908111156110425761104261562e565b5f61129960ff841683615743565b5f602082840312156158ca575f5ffd5b815161129981615150565b634e487b7160e01b5f52602160045260245ffd5b5f60ff8316806158fb576158fb615805565b8060ff8416069150509291505056fea264697066735822122032682ef39441d1d1723d71aa4c5cf3a61bf705f7f8002f0ffd27250f984dc5a064736f6c634300081e0033000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb6030000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c6c0f5a106a145d6d3bc3ad1f345d17cdf001739000000000000000000000000f73ca2e2ae618e3e08b2f137f6c2c4f35ba416680000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000116161726e61206174765969656c644d6178000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6174765969656c644d61780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561000f575f5ffd5b5060043610610553575f3560e01c80638129d90a116102bf578063c6e6f59211610186578063e30c3978116100ef578063ec8f0d4d116100a9578063f77c479111610084578063f77c479114610c2e578063f9ab132514610c41578063fbfcae6814610c49578063fef840ff14610c6b575f5ffd5b8063ec8f0d4d14610c08578063ef8b30f714610aee578063f2fde38b14610c1b575f5ffd5b8063e30c397814610ba8578063e4c4be5814610bb9578063e6929a0a14610bc1578063e9f2838e14610bc9578063eb37b53614610bd6578063ec4142f014610bf5575f5ffd5b8063d88150ea11610140578063d88150ea14610b4a578063d905777e14610b53578063dc20c8ff14610b66578063dd62ed3e14610b6f578063dd7694ee14610b82578063e1c99d1b14610b95575f5ffd5b8063c6e6f59214610aee578063c88af39214610b01578063cb1d63d514610b14578063cc3d272114610b1d578063ce96cb7714610b26578063d7f5870314610b39575f5ffd5b8063b2505eed11610228578063bb318d5c116101e2578063bb318d5c14610aa4578063bbde86ec14610aac578063bc85177c14610abf578063c0b8a37214610ac8578063c4aa09d314610adb578063c63d75b61461071c575f5ffd5b8063b2505eed14610a3c578063b3d7f6b914610a4f578063b460af9414610a62578063b88de06314610a75578063ba08765214610a88578063bab6199814610a9b575f5ffd5b806394bf804d1161027957806394bf804d146109de57806395d89b41146109f15780639f01f7ba146109f9578063a16e663514610a0c578063a9059cbb14610a14578063b187bd2614610a27575f5ffd5b80638129d90a146108fa57806388cfce561461090d5780638da5cb5b146109255780638f752c14146109365780638fcc9cfb1461093f578063937b258114610952575f5ffd5b80634cdad5061161041d57806363d8882a116103865780637060b44011610340578063755fe5b81161031b578063755fe5b8146108b757806376686eab146108d657806378ef63ac146108e957806379ba5097146108f2575f5ffd5b80637060b4401461087f57806370a0823114610887578063715018a6146108af575f5ffd5b806363d8882a1461080f57806368c18beb14610817578063693de592146108395780636ab16feb146108415780636e553f65146108635780636fa0d85d14610876575f5ffd5b80635a593024116103d75780635a593024146107a25780635a9b6ac1146107b65780635b8b7c27146107be5780635c975abb146107c757806360d54d41146107d2578063621fd0fa146107e5575f5ffd5b80634cdad506146105c35780634d3b367a146107585780634dfde616146107615780634ef501ac1461077457806356bb54a714610787578063585cd34b1461078f575f5ffd5b806321d1fc60116104bf57806337ffd3471161047957806337ffd347146106ee57806338743b591461070157806338d52e0f14610714578063402d267d1461071c57806340fb9b4d1461073057806341b3d1851461074f575f5ffd5b806321d1fc601461066357806323b872dd14610675578063284e02de14610688578063313ce567146106aa57806334f0a8d9146106b957806335aa134a146106db575f5ffd5b80630905f560116105105780630905f560146105d6578063095ea7b3146105f35780630a28a4771461060657806312c385781461061957806318160ddd146106445780631ffcd7ed1461064c575f5ffd5b806301e1d11414610557578063021919801461057257806303bd6dcd1461057c57806306cb5b661461059b57806306fdde03146105ae57806307a2d13a146105c3575b5f5ffd5b61055f610c8a565b6040519081526020015b60405180910390f35b61057a610ebf565b005b61055f61058a366004615139565b60236020525f908152604090205481565b61057a6105a9366004615174565b610f27565b6105b6610fa7565b604051610569919061518f565b61055f6105d1366004615139565b611037565b600c546105e39060ff1681565b6040519015158152602001610569565b6105e36106013660046151c4565b611048565b61055f610614366004615139565b61105f565b600d5461062c906001600160a01b031681565b6040516001600160a01b039091168152602001610569565b61055f61106b565b610654611087565b60405161056993929190615261565b6025546105e390610100900460ff1681565b6105e36106833660046152a3565b61127b565b6105e3610696366004615139565b5f9081526024602052604090205460ff1690565b60405160128152602001610569565b6105e36106c7366004615174565b60266020525f908152604090205460ff1681565b61057a6106e9366004615139565b6112a0565b61057a6106fc366004615139565b6112ee565b61057a61070f366004615398565b6113c4565b61062c611564565b61055f61072a366004615174565b505f1990565b61055f61073e366004615174565b60126020525f908152604090205481565b61055f60105481565b61055f601c5481565b61057a61076f366004615139565b611588565b61062c610782366004615139565b6115ef565b61057a611617565b61057a61079d366004615174565b611679565b6025546105e3906301000000900460ff1681565b61057a6118c9565b61055f601d5481565b60095460ff166105e3565b61057a6107e0366004615174565b6119b7565b61055f6107f33660046151c4565b601360209081525f928352604080842090915290825290205481565b61057a6119d3565b6105e3610825366004615174565b60186020525f908152604090205460ff1681565b61055f611a35565b6105e361084f366004615139565b601a6020525f908152604090205460ff1681565b61055f610871366004615459565b611a7d565b61055f60165481565b61055f611bc2565b61055f610895366004615174565b6001600160a01b03165f9081526020819052604090205490565b61057a611bcb565b61055f6108c5366004615139565b5f9081526023602052604090205490565b61057a6108e4366004615496565b611bde565b61055f60145481565b61057a611c27565b61057a610908366004615139565b611c9e565b600c5461062c9061010090046001600160a01b031681565b6005546001600160a01b031661062c565b61055f601e5481565b61057a61094d366004615139565b611ce4565b6109a4610960366004615139565b60176020525f90815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039485169593909416939192909160ff1686565b604080516001600160a01b0397881681529690951660208701529385019290925260608401526080830152151560a082015260c001610569565b61055f6109ec366004615459565b611d2a565b6105b6611d4d565b61057a610a07366004615139565b611d5c565b61055f600181565b6105e3610a223660046151c4565b611f74565b610a2f611f81565b60405161056991906154af565b61057a610a4a366004615174565b611fa6565b61055f610a5d366004615139565b611ff6565b61055f610a703660046154e1565b612002565b61057a610a83366004615174565b612423565b61055f610a963660046154e1565b612831565b61055f601f5481565b61055f612c29565b61057a610aba366004615520565b61300b565b61055f60205481565b61057a610ad6366004615174565b6130f2565b61057a610ae9366004615174565b613145565b61055f610afc366004615139565b6131ab565b61057a610b0f366004615540565b6131b6565b61055f600b5481565b61055f600f5481565b61055f610b34366004615174565b613371565b6007546001600160a01b031661062c565b61055f60155481565b61055f610b61366004615174565b613393565b61055f601b5481565b61055f610b7d366004615579565b6133b0565b61057a610b90366004615520565b6133da565b61055f610ba3366004615139565b613ba9565b6006546001600160a01b031661062c565b61057a613bc8565b61057a613c27565b6025546105e39060ff1681565b61055f610be4366004615139565b60226020525f908152604090205481565b61057a610c03366004615139565b613c68565b61057a610c16366004615520565b613d2d565b61057a610c29366004615174565b613e49565b600e5461062c906001600160a01b031681565b61057a613eba565b6105e3610c57366004615139565b60246020525f908152604090205460ff1681565b610c73613ef7565b6040516105699b9a999897969594939291906155a5565b600c545f9060ff1615610d26575f610ca0611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015610cec573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d109190615617565b9050601f5481610d209190615642565b91505090565b600a545f90815b8181108015610d3d5750600b5481105b15610e21575f600a8281548110610d5657610d56615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff1615610d8b5750610e19565b806001600160a01b0316636e07302b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610de5575060408051601f3d908101601f19168201909252610de291810190615617565b60015b610e1257604051635bc417b160e11b81526001600160a01b03821660048201526024015b60405180910390fd5b9390930192505b600101610d2d565b505f610e2b611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015610e77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e9b9190615617565b9050610ea78184615642565b9250601f5483610eb79190615642565b935050505090565b600e546001600160a01b03163314610eea57604051635990781360e01b815260040160405180910390fd5b6025805463ff000000191663010000001790556040517fdeeb69430b7153361c25d630947115165636e6a723fa8daea4b0de34b3247459905f90a1565b610f2f613ff8565b6001600160a01b038116610f56576040516336abb4df60e11b815260040160405180910390fd5b600e80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1c87e2bbc4e5fa5d7f6f8c44d66cb241dff224b8602eb5435ca2076d2a5c6fc2905f90a35050565b606060038054610fb690615669565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe290615669565b801561102d5780601f106110045761010080835404028352916020019161102d565b820191905f5260205f20905b81548152906001019060200180831161101057829003601f168201915b5050505050905090565b5f611042825f614052565b92915050565b5f336110558185856141f0565b5060019392505050565b5f6110428260016141fd565b5f60205461107860025490565b6110829190615642565b905090565b601954606090819081908067ffffffffffffffff8111156110aa576110aa6152e1565b6040519080825280602002602001820160405280156110d3578160200160208202803683370190505b5093508067ffffffffffffffff8111156110ef576110ef6152e1565b604051908082528060200260200182016040528015611118578160200160208202803683370190505b5092508067ffffffffffffffff811115611134576111346152e1565b60405190808252806020026020018201604052801561115d578160200160208202803683370190505b5091505f5b81811015611274575f6019828154811061117e5761117e615655565b5f91825260208083209091015480835260178252604092839020835160c08101855281546001600160a01b03908116825260018301541693810193909352600281015493830193909352600383015460608301526004830154608083015260059092015460ff16151560a0820152875191925090829088908590811061120657611206615655565b602002602001018181525050805f015186848151811061122857611228615655565b60200260200101906001600160a01b031690816001600160a01b031681525050806040015185848151811061125f5761125f615655565b60209081029190910101525050600101611162565b5050909192565b5f336112888582856143a2565b611293858585614406565b60019150505b9392505050565b6112a8613ff8565b600f80549082905560408051828152602081018490527f26fc4e16c739648a3cabd49425a14877b9a014cfd363be9f35c6feb6c3fdc27791015b60405180910390a15050565b6112f6613ff8565b6107d081111561133f5760405162461bcd60e51b81526020600482015260146024820152734d6178696d756d2032302520736c69707061676560601b6044820152606401610e09565b60648110156113865760405162461bcd60e51b81526020600482015260136024820152724d696e696d756d20312520736c69707061676560681b6044820152606401610e09565b601e80549082905560408051828152602081018490527f48906d6b1d9e74a39fd9d9289e75ee5bc5856fe98800c1d3ce67a18b63880c2091016112e2565b6113cc613ff8565b825184511415806113de575082518114155b156113fc5760405163512509d360e11b815260040160405180910390fd5b5f5b845181101561155d575f83838381811061141a5761141a615655565b9050602002013511801561144957506201518083838381811061143f5761143f615655565b9050602002013511155b61148b5760405162461bcd60e51b8152602060048201526013602482015272496e76616c6964207374616c6557696e646f7760681b6044820152606401610e09565b83818151811061149d5761149d615655565b602002602001015160115f8784815181106114ba576114ba615655565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082828281811061151657611516615655565b9050602002013560125f86848151811061153257611532615655565b6020908102919091018101516001600160a01b031682528101919091526040015f20556001016113fe565b5050505050565b7f000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60390565b600e546001600160a01b031633146115b357604051635990781360e01b815260040160405180910390fd5b601d8190556040518181527f7868b49a4010376b5c0d2aa4c7eec0e84e1fa9a7f82667bd5bea9a9de5d383ea906020015b60405180910390a150565b600a81815481106115fe575f80fd5b5f918252602090912001546001600160a01b0316905081565b600e546001600160a01b0316331461164257604051635990781360e01b815260040160405180910390fd5b6025805460ff191660011790556040517f6022a9e759c95aad593773b7a47586ff34cddc74d34ea6361f64c5bac98cf294905f90a1565b611681613ff8565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116bd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116e19190615617565b1561172e5760405162461bcd60e51b815260206004820152601c60248201527f41646170746572206861732061637469766520706f736974696f6e73000000006044820152606401610e09565b6001600160a01b0381165f9081526018602052604090205460ff1661176657604051637bd8dfc760e11b815260040160405180910390fd5b5f805b600a5481101561186157826001600160a01b0316600a828154811061179057611790615655565b5f918252602090912001546001600160a01b03160361185957600a80546117b9906001906156a1565b815481106117c9576117c9615655565b5f91825260209091200154600a80546001600160a01b0390921691839081106117f4576117f4615655565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a805480611830576118306156b4565b5f8281526020902081015f1990810180546001600160a01b031916905501905560019150611861565b600101611769565b508061188057604051637bd8dfc760e11b815260040160405180910390fd5b6001600160a01b0382165f81815260186020526040808220805460ff19169055517fdf980d21d8c7bb34800e668dbe003299093bac8e693614151d3c57f73f98a93d9190a25050565b6118d1613ff8565b5f6118da611564565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611921573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119459190615617565b600c54909150611967906001600160a01b038481169161010090041683614463565b600c54604080518381524260208201526101009092046001600160a01b0316917f2a29498f8624cccc0d482ba111f45eea856619e7197449687c96635b84c5a11491015b60405180910390a25050565b6119bf613ff8565b6119c76144c2565b6119d0816144e6565b50565b600e546001600160a01b031633146119fe57604051635990781360e01b815260040160405180910390fd5b6025805463ff000000191690556040517f823084e804e36d8971e8b86749b6b0ace7b9f87ed272bef910c1e72d123eeb48905f90a1565b5f5f611a3f61106b565b9050805f03611a5757670de0b6b3a764000091505090565b5f611a60612c29565b9050611a7681670de0b6b3a7640000845f61465c565b9250505090565b5f611a866146a7565b611a8e6144c2565b600c5460ff1615611ab2576040516310326a8d60e11b815260040160405180910390fd5b602554610100900460ff1615611adb5760405163efaf4e0960e01b815260040160405180910390fd5b6025546301000000900460ff1615611b0657604051630b4cba3160e31b815260040160405180910390fd5b826010541115611b295760405163478bb70f60e01b815260040160405180910390fd5b611b3383836146d1565b600c54909150611b649061010090046001600160a01b031684611b54611564565b6001600160a01b03169190614463565b6001600160a01b038216337f04012be6878140390e13a3d11b44fe235daeff975b9278396470cc65515bc36d8584611b9a611a35565b6040805193845260208401929092529082015260600160405180910390a36110426001600855565b5f611082612c29565b611bd3613ff8565b611bdc5f6146ec565b565b611be6613ff8565b600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c840906020016115e4565b60065433906001600160a01b03168114611c955760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610e09565b6119d0816146ec565b611ca6613ff8565b601480549082905560408051828152602081018490527f11389fc971218d4b251d5b0e38a98af9b8a9947ad9bc77d850121d4a76290aed91016112e2565b611cec613ff8565b601080549082905560408051828152602081018490527f1dbbe91e11267d8261b171010af0890734a6f9a4d6ec75ea2fdc17dabb7905e591016112e2565b5f5f195f611d3785611ff6565b9050611d4533858388614705565b949350505050565b606060048054610fb690615669565b5f81815260176020526040902080546001600160a01b03163314611db25760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b6044820152606401610e09565b5f828152601a602052604090205460ff16611e025760405162461bcd60e51b815260206004820152601060248201526f5265717565737420696e61637469766560801b6044820152606401610e09565b601c54816004015414611e575760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742063616e63656c20736574746c656420636f756e7465720000006044820152606401610e09565b60028101546004820154335f9081526013602090815260408083208484529091528120805460019290611e8b9084906156a1565b909155505081611ed15760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81d1bc818d85b98d95b607a1b6044820152606401610e09565b611edc303384614406565b81601b5f828254611eed91906156a1565b90915550505f8181526023602052604081208054849290611f0f9084906156a1565b90915550505f60028401819055848152601a602052604090819020805460ff1916905551849033907f1575adcdc526a67d3f6e771cd9123208ea6b3f48534cbc0ceec405608cc5860590611f669086815260200190565b60405180910390a350505050565b5f33611055818585614406565b611f8961511b565b60255460ff63010000008204811615158352161515602082015290565b611fae613ff8565b6001600160a01b0381165f81815260266020526040808220805460ff19169055517f2cd0112e7d04167fb90200723b45a6020b6f216132674ad9a6afad9f8b409cc99190a250565b5f611042826001614052565b5f61200b6146a7565b6120136144c2565b600c5460ff1615612037576040516310326a8d60e11b815260040160405180910390fd5b835f0361205757604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03831661207e5760405163d92e233d60e01b815260040160405180910390fd5b60255460ff16156120a2576040516370a7336d60e11b815260040160405180910390fd5b6014546001600160a01b0383165f908152601360209081526040808320601c548452909152902054106120e8576040516353c034cf60e01b815260040160405180910390fd5b601c545f9081526024602052604090205460ff161561211a576040516391d1173960e01b815260040160405180910390fd5b6121238461105f565b9050600f548111612147576040516336633d3760e01b815260040160405180910390fd5b6001600160a01b0382163314612192575f61216283336133b0565b90508181101561218557604051633999656760e01b815260040160405180910390fd5b6121908333846143a2565b505b806121b1836001600160a01b03165f9081526020819052604090205490565b10156121d057604051633999656760e01b815260040160405180910390fd5b6025805462ff00001916620100001790556121ec823083614406565b6025805462ff000019169055601580545f9190829061220a906156c8565b9182905550601680549192505f612220836156c8565b9091555050601c545f90815260226020526040902054601654111561226d57601c8054905f61224e836156c8565b9091555050601d54601c545f9081526022602052604090205560016016555b6001600160a01b0383165f908152601360209081526040808320601c548452909152812080549161229d836156c8565b90915550506040805160c0810182526001600160a01b03808616825286811660208084019182528385018781524260608601908152601c54608087019081525f60a088018181528a825260178652898220985189549089166001600160a01b0319918216178a55965160018a8101805492909a169190981617909755925160028801559051600387015551600486015592516005909401805494151560ff19958616179055601980548084019091557f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501869055858352601a905292812080549092169092179055601b8054849290612397908490615642565b9091555050601c545f90815260236020526040812080548492906123bc908490615642565b90915550506001600160a01b038085169084167f3aeb15af61588a39bcfafb19ed853140d195c2a924537afbf9a6d04348e76a6984846123fa611a35565b6040805193845260208401929092529082015260600160405180910390a3506112996001600855565b61242b6146a7565b6007546001600160a01b031633146124795760405162461bcd60e51b81526020600482015260116024820152704f6e6c792064656c6179206d6f64756c6560781b6044820152606401610e09565b6001600160a01b0381166124a05760405163d92e233d60e01b815260040160405180910390fd5b306001600160a01b038216036124c95760405163628a43fd60e01b815260040160405180910390fd5b600c546001600160a01b038281166101009092041614612827575f6124ec611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa158015612538573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061255c9190615617565b905080156125c45760405162461bcd60e51b815260206004820152602f60248201527f4f6c6420736166652077616c6c6574206861732055534443202d206d6967726160448201526e1d1948185cdcd95d1cc8199a5c9cdd608a1b6064820152608401610e09565b5f805b600a548110156126b3575f600a82815481106125e5576125e5615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff161561261a57506126ab565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612674575060408051601f3d908101601f1916820190925261267191810190615617565b60015b61269c57604051635bc417b160e11b81526001600160a01b0382166004820152602401610e09565b6126a68185615642565b935050505b6001016125c7565b5080156127285760405162461bcd60e51b815260206004820152603f60248201527f416461707465727320686176652061637469766520706f736974696f6e73202d60448201527f206d696772617465206265666f7265206368616e67696e672077616c6c6574006064820152608401610e09565b601b541561279e5760405162461bcd60e51b815260206004820152603760248201527f416374697665207769746864726177616c207175657565202d20736574746c6560448201527f206265666f7265206368616e67696e672077616c6c65740000000000000000006064820152608401610e09565b600c80546001600160a01b03858116610100908102610100600160a81b0319841617909355600d549290910481169116156127e457600d80546001600160a01b03191690555b836001600160a01b0316816001600160a01b03167e5cd7e3d6890000c92693f661e9926eecc4ef7d749ebcf2a7f3fb2a6867883060405160405180910390a35050505b6119d06001600855565b5f61283a6146a7565b6128426144c2565b600c5460ff1615612866576040516310326a8d60e11b815260040160405180910390fd5b835f0361288657604051639811e0c760e01b815260040160405180910390fd5b6001600160a01b0383166128ad5760405163d92e233d60e01b815260040160405180910390fd5b60255460ff16156128d1576040516370a7336d60e11b815260040160405180910390fd5b600f5484116128f3576040516336633d3760e01b815260040160405180910390fd5b6014546001600160a01b0383165f908152601360209081526040808320601c54845290915290205410612939576040516353c034cf60e01b815260040160405180910390fd5b601c545f9081526024602052604090205460ff161561296b576040516391d1173960e01b815260040160405180910390fd5b61297484611037565b90506001600160a01b03821633146129c1575f61299183336133b0565b9050848110156129b457604051633999656760e01b815260040160405180910390fd5b6129bf8333876143a2565b505b836129e0836001600160a01b03165f9081526020819052604090205490565b10156129ff57604051633999656760e01b815260040160405180910390fd5b6025805462ff0000191662010000179055612a1b823086614406565b6025805462ff000019169055601580545f91908290612a39906156c8565b9182905550601680549192505f612a4f836156c8565b9091555050601c545f908152602260205260409020546016541115612a9c57601c8054905f612a7d836156c8565b9091555050601d54601c545f9081526022602052604090205560016016555b6001600160a01b0383165f908152601360209081526040808320601c5484529091528120805491612acc836156c8565b90915550506040805160c0810182526001600160a01b03808616825286811660208084019182528385018a81524260608601908152601c54608087019081525f60a088018181528a825260178652898220985189549089166001600160a01b0319918216178a55965160018a8101805492909a169190981617909755925160028801559051600387015551600486015592516005909401805494151560ff19958616179055601980548084019091557f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c969501869055858352601a905292812080549092169092179055601b8054879290612bc6908490615642565b9091555050601c545f9081526023602052604081208054879290612beb908490615642565b90915550506001600160a01b038085169084167f3aeb15af61588a39bcfafb19ed853140d195c2a924537afbf9a6d04348e76a6987846123fa611a35565b5f5f612c33611564565b90505f816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c72573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c9691906156e0565b60ff1690505f81601211612caa575f612cb5565b612cb58260126156a1565b6001600160a01b038085165f908152601160205260409020549192501680612d1f5760405162461bcd60e51b815260206004820152601e60248201527f5072696365206f7261636c65206e6f742073657420666f7220617373657400006044820152606401610e09565b5f612d2982614770565b50600c5490915060ff1615612e1f57600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201525f918716906370a0823190602401602060405180830381865afa158015612d86573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612daa9190615617565b90505f612dd4612dbb86600a6157e3565b612dc590846157ee565b84670de0b6b3a7640000614b8b565b90505f612de286600a6157e3565b601f54612def91906157ee565b90505f612e058286670de0b6b3a7640000614b8b565b9050612e118184615642565b995050505050505050505090565b600a545f90815b8181108015612e365750600b5481105b15612f15575f600a8281548110612e4f57612e4f615655565b5f9182526020808320909101546001600160a01b0316808352602690915260409091205490915060ff1615612e845750612f0d565b806001600160a01b03166397b3fcaa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612ede575060408051601f3d908101601f19168201909252612edb91810190615617565b60015b612f0657604051635bc417b160e11b81526001600160a01b0382166004820152602401610e09565b9390930192505b600101612e26565b50600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201525f918916906370a0823190602401602060405180830381865afa158015612f64573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f889190615617565b90505f612fb2612f9988600a6157e3565b612fa390846157ee565b86670de0b6b3a7640000614b8b565b9050612fbe8185615642565b93505f612fcc88600a6157e3565b601f54612fd991906157ee565b90505f612fef8288670de0b6b3a7640000614b8b565b9050612ffb8187615642565b9c9b505050505050505050505050565b613013613ff8565b60215460ff161561305b5760405162461bcd60e51b8152602060048201526012602482015271105b1c9958591e4818dbdb999a59dd5c995960721b6044820152606401610e09565b5f8211801561306957505f81115b6130a65760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b6044820152606401610e09565b601f82905560208181556021805460ff19166001179055604080518481529182018390527f171d3d4c4c825d590ef0ee55f60220c40c3655c72f46f3e7fd0d67d7386dae9d91016112e2565b6130fa613ff8565b6001600160a01b0381165f81815260266020526040808220805460ff19166001179055517fd7fedf311ee2376b0669ff5505fcbde8322725ac23644f17b0b6e2408ea004d69190a250565b61314d614c3b565b6001600160a01b0381166131895760405162461bcd60e51b815260206004820152600360248201526227a22d60e91b6044820152606401610e09565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b5f611042825f6141fd565b6131be613ff8565b600c5460ff161580156131cf575080155b156131ed5760405163197b261160e21b815260040160405180910390fd5b600c5460ff161580156131fd5750805b15613280575f831180613219575060095460ff16151582151514155b156132375760405163197b261160e21b815260040160405180910390fd5b600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c8409060200160405180910390a1505050565b82156132ec57600a548310156132a95760405163016f784b60e61b815260040160405180910390fd5b600b80549084905560408051828152602081018690527f8a0629a30d225e1651321c029707ae1546f1e895d6ab27551bf40a2259e2ab68910160405180910390a1505b60095460ff1615158215151461331757811561330f5761330a614c7a565b613317565b613317614cd4565b600c5460ff1615158115151461336c57600c805460ff19168215159081179091556040519081527fb8a34678623c94d0d3977ce6d4db867e7e96ffd365f2c0f677563f8dddd4c8409060200160405180910390a15b505050565b6001600160a01b0381165f90815260208190526040812054611042905f614052565b6001600160a01b0381165f90815260208190526040812054611042565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6133e26146a7565b600c5461010090046001600160a01b031633146134125760405163d7fed6bd60e01b815260040160405180910390fd5b5f8181526024602052604090205460ff1615613441576040516387b273b960e01b815260040160405180910390fd5b5f81815260236020526040812054900361346e576040516302f8fe3560e31b815260040160405180910390fd5b815f0361348e5760405163fe7e4c3560e01b815260040160405180910390fd5b81613497611564565b600c546040516370a0823160e01b81526001600160a01b03610100909204821660048201529116906370a0823190602401602060405180830381865afa1580156134e3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135079190615617565b10156135265760405163fe7e4c3560e01b815260040160405180910390fd5b8161352f611564565b600c54604051636eb1769f60e11b81526001600160a01b036101009092048216600482015230602482015291169063dd62ed3e90604401602060405180830381865afa158015613581573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135a59190615617565b10156135c4576040516313be252b60e01b815260040160405180910390fd5b5f6135cd611a35565b600c549091506136009061010090046001600160a01b031630856135ef611564565b6001600160a01b0316929190614d0d565b5f828152602360205260408120546136289085906c0c9f2c9cd04674edea4000000090614b8b565b90505f612710601e5461271061363e91906156a1565b61364890856157ee565b6136529190615819565b90505f612710601e546127106136689190615642565b61367290866157ee565b61367c9190615819565b9050818310156136dd5760405162461bcd60e51b815260206004820152602660248201527f536574746c656d656e74204e41562062656c6f77206d696e696d756d20746872604482015265195cda1bdb1960d21b6064820152608401610e09565b8083111561373c5760405162461bcd60e51b815260206004820152602660248201527f536574746c656d656e74204e41562061626f7665206d6178696d756d20746872604482015265195cda1bdb1960d21b6064820152608401610e09565b50506019545f9067ffffffffffffffff81111561375b5761375b6152e1565b604051908082528060200260200182016040528015613784578160200160208202803683370190505b5090505f80805b60195481101561381a575f601982815481106137a9576137a9615655565b5f9182526020808320909101548083526017909152604090912060058101549192509060ff161580156137df5750888160040154145b1561381057818686815181106137f7576137f7615655565b60209081029190910101528461380c816156c8565b9550505b505060010161378b565b505f5b82811015613944575f84828151811061383857613838615655565b602002602001015190505f60175f8381526020019081526020015f2090505f61387782600201548c60235f8e81526020019081526020015f2054614b8b565b60058301805460ff1916600117905560028301549091506138989086615642565b5f848152601a60205260409020805460ff1916905560028301549095506138c0903090614d46565b60018201546138db906001600160a01b031682611b54611564565b600182015482546002840154604080519182526020820185905281018b90526001600160a01b03928316929091169085907f91de9a7ea75480b6e4db60f7c0a142c2a3148bf82fbe71edf0c218d729c3b36c9060600160405180910390a450505060010161381d565b5080601b5f82825461395691906156a1565b90915550505f86815260236020908152604080832083905560249091528120805460ff1916600117905560195490805b82811015613a1f57601a5f601983815481106139a4576139a4615655565b5f918252602080832090910154835282019290925260400190205460ff1615613a1757808214613a0957601981815481106139e1576139e1615655565b905f5260205f200154601983815481106139fd576139fd615655565b5f918252602090912001555b81613a13816156c8565b9250505b600101613986565b505f613a2b82846156a1565b90505f5b81811015613a66576019805480613a4857613a486156b4565b5f8281526020812082015f1990810191909155019055600101613a2f565b50604080518b815260208101869052908101889052606081018690527ff55c89f8cba9d727bffa5994a241d4c88ef19bcb1435090f60a7e5addfb6ca4c9060800160405180910390a15f613ab8611564565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613afc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b209190615617565b90508015613b9257600c54613b469061010090046001600160a01b031682611b54611564565b600c54604080518381524260208201526101009092046001600160a01b0316917f2a29498f8624cccc0d482ba111f45eea856619e7197449687c96635b84c5a114910160405180910390a25b505050505050505050613ba56001600855565b5050565b60198181548110613bb8575f80fd5b5f91825260209091200154905081565b600e546001600160a01b03163314613bf357604051635990781360e01b815260040160405180910390fd5b6025805460ff191690556040517f73f109ff397323e276e38b27fa4bf2a3d7bc07fb71be9fccbcd541e39140ea3f905f90a1565b613c2f613ff8565b6025805461ff0019166101001790556040517f9d698fd24be4742b66dfed36fcf4fba3a96cc75981a270d5c522face9ee8bcea905f90a1565b600e546001600160a01b03163314613c9357604051635990781360e01b815260040160405180910390fd5b601c545f9081526023602052604090205460011115613cc55760405163569d142960e01b815260040160405180910390fd5b601c80549081905f613cd6836156c8565b9091555050601c80545f90815260226020908152604091829020859055915481518481529283015281018390527f84bac22106eba2c39942f15c2d88947f759b7dfa7b606356cf8ec2f03e18517b906060016112e2565b600e546001600160a01b03163314613d5857604051635990781360e01b815260040160405180910390fd5b601c54821015613daa5760405162461bcd60e51b815260206004820152601e60248201527f63616e277420757064617465206f6c6420636f756e746572206c696d697400006044820152606401610e09565b601c548203613e0557601654811015613e055760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177616c7320616c7265616479207265676973746572656400006044820152606401610e09565b5f82815260226020908152604091829020839055601c5491518381527f902e2e6b752663edace480c0fd2f609e0545646292fed74b34294c8090d1a7e891016119ab565b613e51614c3b565b600680546001600160a01b0383166001600160a01b03199091168117909155613e826005546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b613ec2613ff8565b6025805461ff00191690556040517f1646ce43ade83b19f47eb6d0baa4777d8262c5d9e922b5a74a99701f23c19f1d905f90a1565b5f5f5f60605f5f5f5f5f5f5f613f0b61106b565b9850613f15611bc2565b9950613f1f611a35565b9a508a8a8a600a8080549050600b54600c60019054906101000a90046001600160a01b0316600e5f9054906101000a90046001600160a01b0316600c5f9054906101000a900460ff16601554602560019054906101000a900460ff1687805480602002602001604051908101604052809291908181526020018280548015613fce57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311613fb0575b505050505097509a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6005546001600160a01b03163314611bdc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e09565b5f5f61405c61106b565b90505f614067611564565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140a2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140c691906156e0565b60ff1690505f816012116140da575f6140e5565b6140e58260126156a1565b90505f60115f6140f3611564565b6001600160a01b03908116825260208201929092526040015f2054169050806141555760405162461bcd60e51b8152602060048201526014602482015273141c9a58d9481bdc9858db19481b9bdd081cd95d60621b6044820152606401610e09565b5f61415f82614770565b5090505f855f036141855761417e89670de0b6b3a7640000808b61465c565b90506141b6565b5f61418e612c29565b9050805f036141a6575f975050505050505050611042565b6141b28a82898c61465c565b9150505b5f6141cb82670de0b6b3a7640000858c61465c565b90506141d885600a6157e3565b6141e29082615819565b9a9950505050505050505050565b61336c8383836001614d7a565b5f5f614207611564565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614242573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061426691906156e0565b60ff1690505f8160121161427a575f614285565b6142858260126156a1565b90505f61429382600a6157e3565b61429d90876157ee565b90505f60115f6142ab611564565b6001600160a01b03908116825260208201929092526040015f20541690508061430d5760405162461bcd60e51b8152602060048201526014602482015273141c9a58d9481bdc9858db19481b9bdd081cd95d60621b6044820152606401610e09565b5f61431782614770565b5090505f61432f8483670de0b6b3a76400008b61465c565b90505f61433a61106b565b9050805f036143655761435782670de0b6b3a7640000808c61465c565b975050505050505050611042565b5f61436e612c29565b9050805f03614387575f98505050505050505050611042565b6143938383838d61465c565b9b9a5050505050505050505050565b5f6143ad84846133b0565b90505f1981101561440057818110156143f257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610e09565b61440084848484035f614d7a565b50505050565b6001600160a01b03831661442f57604051634b637e8f60e11b81525f6004820152602401610e09565b6001600160a01b0382166144585760405163ec442f0560e01b81525f6004820152602401610e09565b61336c838383614e3e565b6040516001600160a01b0383811660248301526044820183905261336c91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614e88565b60095460ff1615611bdc5760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b03811661450d5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0381165f9081526018602052604090205460ff161561454657604051633cb3e7d960e21b815260040160405180910390fd5b600b54600a541061456a5760405163016f784b60e61b815260040160405180910390fd5b5f5b600a548110156145cd57816001600160a01b0316600a828154811061459357614593615655565b5f918252602090912001546001600160a01b0316036145c557604051633cb3e7d960e21b815260040160405180910390fd5b60010161456c565b50600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091555f81815260186020526040808220805460ff1916909417909355915190917fcf9c2c7f9adbb156bd76affb04df84595f8f5e69cab2e61221b05b05a902fa2691a250565b5f61468961466983614ef4565b801561468457505f848061467f5761467f615805565b868809115b151590565b614694868686614b8b565b61469e9190615642565b95945050505050565b6002600854036146ca57604051633ee5aeb560e01b815260040160405180910390fd5b6002600855565b5f5f195f6146de856131ab565b9050611d4533858784614705565b600680546001600160a01b03191690556119d081614f20565b614718614710611564565b853085614d0d565b6147228382614f71565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78484604051611f66929190918252602082015260400190565b5f806001600160a01b0383166147995760405163d92e233d60e01b815260040160405180910390fd5b5f5f5f5f866001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156147d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147fd9190615845565b9450945050935093505f83136148255760405162fc7cad60e51b815260040160405180910390fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff16101561485e57604051631510fe5b60e31b815260040160405180910390fd5b604084811c61ffff9081169183901c16146148ac5760405162461bcd60e51b815260206004820152600e60248201526d0a0d0c2e6ca40dad2e6dac2e8c6d60931b6044820152606401610e09565b5f821180156148bb5750428211155b6148fb5760405162461bcd60e51b81526020600482015260116024820152700496e76616c69642074696d657374616d7607c1b6044820152606401610e09565b6001600160a01b0387165f8181526012602090815260409182902054825163313ce56760e01b8152925190939263313ce5679260048083019391928290030181865afa15801561494d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061497191906156e0565b955083601260ff881610156149a75761498b876012615893565b61499690600a6158ac565b6149a090826157ee565b97506149d7565b60128760ff1611156149d3576149be601288615893565b6149c990600a6158ac565b6149a09082615819565b8097505b5f896001600160a01b031663245a7bfc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a14573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614a3891906158ba565b90505f816001600160a01b03166322adbc786040518163ffffffff1660e01b8152600401602060405180830381865afa158015614a77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614a9b9190615617565b90505f826001600160a01b03166370da2f676040518163ffffffff1660e01b8152600401602060405180830381865afa158015614ada573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614afe9190615617565b90508084101580614b0f5750818411155b15614b2d5760405163953964f160e01b815260040160405180910390fd5b8415614b7d57865f03614b5357604051631510fe5b60e31b815260040160405180910390fd5b84614b5e88426156a1565b1115614b7d57604051631510fe5b60e31b815260040160405180910390fd5b505050505050505050915091565b5f5f5f614b988686614fa5565b91509150815f03614bbc57838181614bb257614bb2615805565b0492505050611299565b818411614bd357614bd36003851502601118614fc1565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b6007546001600160a01b03163314611bdc5760405162461bcd60e51b81526020600482015260026024820152614e4160f01b6044820152606401610e09565b614c826144c2565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614cb73390565b6040516001600160a01b03909116815260200160405180910390a1565b614cdc614fd2565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614cb7565b6040516001600160a01b0384811660248301528381166044830152606482018390526144009186918216906323b872dd90608401614490565b6001600160a01b038216614d6f57604051634b637e8f60e11b81525f6004820152602401610e09565b613ba5825f83614e3e565b6001600160a01b038416614da35760405163e602df0560e01b81525f6004820152602401610e09565b6001600160a01b038316614dcc57604051634a1406b160e11b81525f6004820152602401610e09565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561440057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051611f6691815260200190565b6001600160a01b03821630148015614e5f575060255462010000900460ff16155b15614e7d57604051639dba6a7560e01b815260040160405180910390fd5b61336c838383614ff5565b5f5f60205f8451602086015f885af180614ea7576040513d5f823e3d81fd5b50505f513d91508115614ebe578060011415614ecb565b6001600160a01b0384163b155b1561440057604051635274afe760e01b81526001600160a01b0385166004820152602401610e09565b5f6002826003811115614f0957614f096158d5565b614f1391906158e9565b60ff166001149050919050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038216614f9a5760405163ec442f0560e01b81525f6004820152602401610e09565b613ba55f8383614e3e565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b60095460ff16611bdc57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b03831661501f578060025f8282546150149190615642565b9091555061508f9050565b6001600160a01b0383165f90815260208190526040902054818110156150715760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610e09565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166150ab576002805482900390556150c9565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161510e91815260200190565b60405180910390a3505050565b60405180604001604052806002906020820280368337509192915050565b5f60208284031215615149575f5ffd5b5035919050565b6001600160a01b03811681146119d0575f5ffd5b803561516f81615150565b919050565b5f60208284031215615184575f5ffd5b813561129981615150565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f604083850312156151d5575f5ffd5b82356151e081615150565b946020939093013593505050565b5f8151808452602084019350602083015f5b8281101561521e578151865260209586019590910190600101615200565b5093949350505050565b5f8151808452602084019350602083015f5b8281101561521e5781516001600160a01b031686526020958601959091019060010161523a565b606081525f61527360608301866151ee565b82810360208401526152858186615228565b9050828103604084015261529981856151ee565b9695505050505050565b5f5f5f606084860312156152b5575f5ffd5b83356152c081615150565b925060208401356152d081615150565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112615304575f5ffd5b813567ffffffffffffffff81111561531e5761531e6152e1565b8060051b604051601f19603f830116810181811067ffffffffffffffff8211171561534b5761534b6152e1565b604052918252602081850181019290810186841115615368575f5ffd5b6020860192505b8383101561538e5761538083615164565b81526020928301920161536f565b5095945050505050565b5f5f5f5f606085870312156153ab575f5ffd5b843567ffffffffffffffff8111156153c1575f5ffd5b6153cd878288016152f5565b945050602085013567ffffffffffffffff8111156153e9575f5ffd5b6153f5878288016152f5565b935050604085013567ffffffffffffffff811115615411575f5ffd5b8501601f81018713615421575f5ffd5b803567ffffffffffffffff811115615437575f5ffd5b8760208260051b840101111561544b575f5ffd5b949793965060200194505050565b5f5f6040838503121561546a575f5ffd5b82359150602083013561547c81615150565b809150509250929050565b8035801515811461516f575f5ffd5b5f602082840312156154a6575f5ffd5b61129982615487565b6040810181835f5b60028110156154d857815115158352602092830192909101906001016154b7565b50505092915050565b5f5f5f606084860312156154f3575f5ffd5b83359250602084013561550581615150565b9150604084013561551581615150565b809150509250925092565b5f5f60408385031215615531575f5ffd5b50508035926020909101359150565b5f5f5f60608486031215615552575f5ffd5b8335925061556260208501615487565b915061557060408501615487565b90509250925092565b5f5f6040838503121561558a575f5ffd5b823561559581615150565b9150602083013561547c81615150565b8b81528a602082015289604082015261016060608201525f6155cb61016083018b615228565b60808301999099525060a08101969096526001600160a01b0394851660c08701529290931660e08501521515610100840152610120830191909152151561014090910152949350505050565b5f60208284031215615627575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156110425761104261562e565b634e487b7160e01b5f52603260045260245ffd5b600181811c9082168061567d57607f821691505b60208210810361569b57634e487b7160e01b5f52602260045260245ffd5b50919050565b818103818111156110425761104261562e565b634e487b7160e01b5f52603160045260245ffd5b5f600182016156d9576156d961562e565b5060010190565b5f602082840312156156f0575f5ffd5b815160ff81168114611299575f5ffd5b6001815b600184111561573b5780850481111561571f5761571f61562e565b600184161561572d57908102905b60019390931c928002615704565b935093915050565b5f8261575157506001611042565b8161575d57505f611042565b8160018114615773576002811461577d57615799565b6001915050611042565b60ff84111561578e5761578e61562e565b50506001821b611042565b5060208310610133831016604e8410600b84101617156157bc575081810a611042565b6157c85f198484615700565b805f19048211156157db576157db61562e565b029392505050565b5f6112998383615743565b80820281158282048414176110425761104261562e565b634e487b7160e01b5f52601260045260245ffd5b5f8261582757615827615805565b500490565b805169ffffffffffffffffffff8116811461516f575f5ffd5b5f5f5f5f5f60a08688031215615859575f5ffd5b6158628661582c565b602087015160408801516060890151929750909550935091506158876080870161582c565b90509295509295909350565b60ff82811682821603908111156110425761104261562e565b5f61129960ff841683615743565b5f602082840312156158ca575f5ffd5b815161129981615150565b634e487b7160e01b5f52602160045260245ffd5b5f60ff8316806158fb576158fb615805565b8060ff8416069150509291505056fea264697066735822122032682ef39441d1d1723d71aa4c5cf3a61bf705f7f8002f0ffd27250f984dc5a064736f6c634300081e0033

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

000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb6030000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000c6c0f5a106a145d6d3bc3ad1f345d17cdf001739000000000000000000000000f73ca2e2ae618e3e08b2f137f6c2c4f35ba416680000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000116161726e61206174765969656c644d6178000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6174765969656c644d61780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _asset (address): 0x754704Bc059F8C67012fEd69BC8A327a5aafb603
Arg [1] : _name (string): aarna atvYieldMax
Arg [2] : _symbol (string): atvYieldMax
Arg [3] : _initialAdapters (address[]):
Arg [4] : _maxAdapters (uint256): 10
Arg [5] : _safeWallet (address): 0xc6c0f5a106A145D6d3Bc3aD1f345D17cDf001739
Arg [6] : _controller (address): 0xf73CA2E2AE618e3e08b2f137F6c2c4f35bA41668
Arg [7] : _firstQueueLimit (uint256): 100
Arg [8] : _defaultSettleQueueLimit (uint256): 100

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb603
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [5] : 000000000000000000000000c6c0f5a106a145d6d3bc3ad1f345d17cdf001739
Arg [6] : 000000000000000000000000f73ca2e2ae618e3e08b2f137f6c2c4f35ba41668
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [10] : 6161726e61206174765969656c644d6178000000000000000000000000000000
Arg [11] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [12] : 6174765969656c644d6178000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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