ETH Price: $2,103.51 (+0.09%)

Contract

0xdAc6748CbB7CD9DA1868eB7aD598273122f012db
 

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...205384812024-08-16 3:24:47575 days ago1723778687IN
0xdAc6748C...122f012db
0 ETH0.000036521.27394358

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
RedeemOperator

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import "../interfaces/IRedeemOperator.sol";
import "../interfaces/IVault.sol";
import "./libraries/Errors.sol";
import "./common/Constants.sol";

/**
 * @title RedeemOperator contract
 * @author Naturelab
 * @notice Manages temporary storage of share tokens and facilitates redemption operations.
 * @dev Implements the IRedeemOperator interface and uses OpenZeppelin libraries for safety and utility functions.
 */
contract RedeemOperator is IRedeemOperator, Constants, Ownable {
    using SafeERC20 for IERC20;
    using Math for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;

    uint256 public constant MAX_GAS_LIMIT = 300_000_000;

    // Address of the vault contract (immutable)
    address public immutable vault;

    // Address of the operator managing withdrawals
    address public operator;

    // Address to receive fees
    address public feeReceiver;

    // Mapping to track withdrawal requests
    mapping(address => uint256) private _withdrawalSTETHRequest;

    // Mapping to track withdrawal requests
    mapping(address => uint256) private _withdrawalEETHRequest;

    // Set to keep track of pending withdrawers
    EnumerableSet.AddressSet private _pendingSTETHWithdrawers;

    // Set to keep track of pending withdrawers
    EnumerableSet.AddressSet private _pendingEETHWithdrawers;

    modifier onlyVault() {
        if (msg.sender != vault) revert Errors.CallerNotVault();
        _;
    }

    modifier onlyOperator() {
        if (msg.sender != operator) revert Errors.CallerNotOperator();
        _;
    }

    /**
     * @dev Initializes the contract with the vault, operator, fee receiver, and gas parameters.
     * @param _vault Address of the vault contract.
     * @param _operator Address of the operator.
     * @param _feeReceiver Address to receive fees.
     */
    constructor(address _admin, address _vault, address _operator, address _feeReceiver) Ownable(_admin) {
        if (_vault == address(0)) revert Errors.InvalidVault();
        if (_operator == address(0)) revert Errors.InvalidNewOperator();
        if (_feeReceiver == address(0)) revert Errors.InvalidFeeReceiver();
        vault = _vault;
        operator = _operator;
        feeReceiver = _feeReceiver;
    }

    /**
     * @dev Updates the operator address.
     * @param _newOperator New operator address.
     */
    function updateOperator(address _newOperator) external onlyOwner {
        if (_newOperator == address(0)) revert Errors.InvalidNewOperator();
        emit UpdateOperator(operator, _newOperator);
        operator = _newOperator;
    }

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

    /**
     * @dev Registers a withdrawal request for a user.
     * @param _user Address of the user requesting withdrawal.
     * @param _shares Amount of shares to withdraw.
     * @param _token Address of the token to withdraw.
     */
    function registerWithdrawal(address _user, uint256 _shares, address _token) external onlyVault {
        if (_shares == 0) revert Errors.InvalidShares();
        if (_token == STETH) {
            // Handle existing pending withdrawal
            if (_pendingSTETHWithdrawers.contains(_user)) {
                revert Errors.IncorrectState();
            } else {
                // Register new withdrawal request
                _pendingSTETHWithdrawers.add(_user);
                _withdrawalSTETHRequest[_user] = _shares;
            }
        } else if (_token == EETH) {
            // Handle existing pending withdrawal
            if (_pendingEETHWithdrawers.contains(_user)) {
                revert Errors.IncorrectState();
            } else {
                // Register new withdrawal request
                _pendingEETHWithdrawers.add(_user);
                _withdrawalEETHRequest[_user] = _shares;
            }
        } else {
            revert Errors.UnsupportedToken();
        }

        emit RegisterWithdrawal(_user, _shares);
    }

    /**
     * @dev Returns the withdrawal request details for a user.
     * @param _user Address of the user.
     * @return WithdrawalRequest struct containing the token address and shares amount.
     */
    function withdrawalRequest(address _user) external view returns (uint256, uint256) {
        return (_withdrawalSTETHRequest[_user], _withdrawalEETHRequest[_user]);
    }

    /**
     * @dev Returns the withdrawal request details for multiple users.
     * @param _users Array of user addresses.
     * @return stETHshares_ Array of shares requested for stETH withdrawal.
     * @return eETHshares_ Array of shares requested for eETH withdrawal.
     */
    function withdrawalRequests(address[] calldata _users)
        external
        view
        returns (uint256[] memory stETHshares_, uint256[] memory eETHshares_)
    {
        uint256 count_ = _users.length;
        if (count_ == 0) revert Errors.InvalidLength();

        stETHshares_ = new uint256[](count_);
        eETHshares_ = new uint256[](count_);
        for (uint256 i = 0; i < count_; ++i) {
            stETHshares_[i] = _withdrawalSTETHRequest[_users[i]];
            eETHshares_[i] = _withdrawalEETHRequest[_users[i]];
        }
    }

    /**
     * @dev Returns the number of pending withdrawers.
     * @return Number of pending withdrawers.
     */
    function pendingWithdrawersCount() external view returns (uint256, uint256) {
        return (_pendingSTETHWithdrawers.length(), _pendingEETHWithdrawers.length());
    }

    /**
     * @dev Returns a paginated list of pending withdrawers.
     * @param _limit Maximum number of addresses to return.
     * @param _offset Offset for pagination.
     * @return result_ Array of addresses of pending withdrawers.
     */
    function pendingWithdrawers(uint256 _limit, uint256 _offset, address _token)
        external
        view
        returns (address[] memory result_)
    {
        EnumerableSet.AddressSet storage withdrawers_;
        if (_token == STETH) {
            withdrawers_ = _pendingSTETHWithdrawers;
        } else if (_token == EETH) {
            withdrawers_ = _pendingEETHWithdrawers;
        } else {
            revert Errors.UnsupportedToken();
        }
        uint256 count_ = withdrawers_.length();
        if (_offset >= count_ || _limit == 0) return result_;

        count_ -= _offset;
        if (count_ > _limit) count_ = _limit;

        result_ = new address[](count_);
        for (uint256 i = 0; i < count_; ++i) {
            result_[i] = withdrawers_.at(_offset + i);
        }
        return result_;
    }

    /**
     * @dev Returns the list of all pending withdrawers.
     * @return Array of addresses of all pending withdrawers.
     */
    function allPendingWithdrawers() external view returns (address[] memory, address[] memory) {
        return (_pendingSTETHWithdrawers.values(), _pendingEETHWithdrawers.values());
    }

    function confirmWithdrawal(address[] calldata _stEthUsers, address[] calldata _eEthUsers, uint256 _totalGasLimit)
        external
        onlyOperator
    {
        if (_totalGasLimit > MAX_GAS_LIMIT) revert Errors.InvalidGasLimit();
        uint256 getStEthShares_ = _getTotalShares(_stEthUsers, _pendingSTETHWithdrawers, _withdrawalSTETHRequest);
        uint256 getEEthShares_ = _getTotalShares(_eEthUsers, _pendingEETHWithdrawers, _withdrawalEETHRequest);
        uint256 totalShares_ = getStEthShares_ + getEEthShares_;
        uint256 exchangePrice_ = IVault(vault).exchangePrice();
        uint256 lastExchangePrice = IVault(vault).lastExchangePrice();
        if (lastExchangePrice == 0) revert Errors.UnSupportedOperation();
        uint256 cutPercentage_;
        if (exchangePrice_ < lastExchangePrice) {
            uint256 diff_ = (lastExchangePrice - exchangePrice_).mulDiv(
                (IERC20(vault).totalSupply() - totalShares_), PRECISION, Math.Rounding.Ceil
            );
            cutPercentage_ = diff_.mulDiv(PRECISION * PRECISION, totalShares_ * exchangePrice_, Math.Rounding.Ceil);
        }
        uint256 gasPerUser_ = _totalGasLimit * tx.gasprice / (_stEthUsers.length + _eEthUsers.length);
        if (getStEthShares_ != 0) {
            _confirmWithdrawal(
                _stEthUsers,
                STETH,
                getStEthShares_,
                gasPerUser_,
                cutPercentage_,
                _withdrawalSTETHRequest,
                _pendingSTETHWithdrawers
            );
            emit ConfirmWithdrawalSTETH(_stEthUsers);
        }
        if (getEEthShares_ != 0) {
            _confirmWithdrawal(
                _eEthUsers,
                EETH,
                getEEthShares_,
                gasPerUser_,
                cutPercentage_,
                _withdrawalEETHRequest,
                _pendingEETHWithdrawers
            );
            emit ConfirmWithdrawalEETH(_eEthUsers);
        }
    }

    function _getTotalShares(
        address[] calldata _users,
        EnumerableSet.AddressSet storage _pendingWithdrawers,
        mapping(address => uint256) storage _withdrawalRequest
    ) internal view returns (uint256 totalShares_) {
        if (_users.length == 0) return 0;
        for (uint256 i = 0; i < _users.length; ++i) {
            if (!_pendingWithdrawers.contains(_users[i])) revert Errors.InvalidWithdrawalUser();
            totalShares_ += _withdrawalRequest[_users[i]];
        }
    }

    /**
     * @dev Confirms withdrawals for a list of users.
     * @param _users Array of user addresses to confirm withdrawals for.
     */
    function _confirmWithdrawal(
        address[] calldata _users,
        address _token,
        uint256 _totalShares,
        uint256 _gasPerUser,
        uint256 _cutPercentage,
        mapping(address => uint256) storage _withdrawalRequest,
        EnumerableSet.AddressSet storage _pendingWithdrawers
    ) internal {
        uint256 tokenBalanceBefore_ = IERC20(_token).balanceOf(address(this));
        IVault(vault).optionalRedeem(_token, _totalShares, _cutPercentage, address(this), address(this));
        uint256 tokenBalanceGet_ = IERC20(_token).balanceOf(address(this)) - tokenBalanceBefore_;
        uint256 assetPerShare_ = tokenBalanceGet_.mulDiv(PRECISION, _totalShares, Math.Rounding.Floor);
        address thisUser_;
        uint256 thisUserGet_;
        for (uint256 i = 0; i < _users.length; ++i) {
            thisUser_ = _users[i];
            thisUserGet_ = _withdrawalRequest[thisUser_].mulDiv(assetPerShare_, PRECISION, Math.Rounding.Floor);
            // If the user's share is not enough to cover the gas, it will fail.
            IERC20(_token).safeTransfer(thisUser_, thisUserGet_ - _gasPerUser);
            _pendingWithdrawers.remove(thisUser_);
            delete _withdrawalRequest[thisUser_];
        }
        uint256 totalGas_ = _gasPerUser * _users.length;
        IERC20(_token).safeTransfer(feeReceiver, totalGas_);
    }

    /**
     * @dev Handles accidental transfers of tokens or ETH to this contract.
     * @param _token Address of the token to sweep.
     */
    function sweep(address _token) external onlyOwner {
        uint256 amount_ = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransfer(msg.sender, amount_);

        uint256 ethbalance_ = address(this).balance;
        if (ethbalance_ > 0) {
            Address.sendValue(payable(msg.sender), ethbalance_);
        }

        emit Sweep(_token);
    }
}

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

// 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.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

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

    function registerWithdrawal(address _user, uint256 _shares, address _token) external;

    function pendingWithdrawersCount() external view returns (uint256, uint256);

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

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

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

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.25;

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

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

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

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

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

    function exchangePrice() external view returns (uint256);

    function revenueExchangePrice() external view returns (uint256);

    function revenue() external view returns (uint256);

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

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

abstract contract Constants {
    address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address public constant EETH = 0x35fA164735182de50811E8e2E824cFb9B6118ac2;
    address public constant WEETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee;
    address public constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;
    address public constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;

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

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

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

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_feeReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CallerNotOperator","type":"error"},{"inputs":[],"name":"CallerNotVault","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IncorrectState","type":"error"},{"inputs":[],"name":"InvalidFeeReceiver","type":"error"},{"inputs":[],"name":"InvalidGasLimit","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"InvalidNewOperator","type":"error"},{"inputs":[],"name":"InvalidShares","type":"error"},{"inputs":[],"name":"InvalidVault","type":"error"},{"inputs":[],"name":"InvalidWithdrawalUser","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UnSupportedOperation","type":"error"},{"inputs":[],"name":"UnsupportedToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"}],"name":"ConfirmWithdrawalEETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"}],"name":"ConfirmWithdrawalSTETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RegisterWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"Sweep","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldFeeReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"newFeeReceiver","type":"address"}],"name":"UpdateFeeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOperator","type":"address"},{"indexed":false,"internalType":"address","name":"newOperator","type":"address"}],"name":"UpdateOperator","type":"event"},{"inputs":[],"name":"EETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_GAS_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WSTETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPendingWithdrawers","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_stEthUsers","type":"address[]"},{"internalType":"address[]","name":"_eEthUsers","type":"address[]"},{"internalType":"uint256","name":"_totalGasLimit","type":"uint256"}],"name":"confirmWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"},{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"pendingWithdrawers","outputs":[{"internalType":"address[]","name":"result_","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingWithdrawersCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"registerWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeReceiver","type":"address"}],"name":"updateFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOperator","type":"address"}],"name":"updateOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"withdrawalRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"withdrawalRequests","outputs":[{"internalType":"uint256[]","name":"stETHshares_","type":"uint256[]"},{"internalType":"uint256[]","name":"eETHshares_","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

60a060405234801561000f575f80fd5b50604051611e0c380380611e0c83398101604081905261002e9161017c565b836001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61006581610112565b506001600160a01b03831661008d57604051630681d31960e51b815260040160405180910390fd5b6001600160a01b0382166100b45760405163ba0cdec560e01b815260040160405180910390fd5b6001600160a01b0381166100db57604051633480121760e21b815260040160405180910390fd5b6001600160a01b03928316608052600180549284166001600160a01b031993841617905560028054919093169116179055506101cd565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114610177575f80fd5b919050565b5f805f806080858703121561018f575f80fd5b61019885610161565b93506101a660208601610161565b92506101b460408601610161565b91506101c260608601610161565b905092959194509250565b608051611c046102085f395f818161039e0152818161069d01528181610720015281816107d001528181610a42015261119a0152611c045ff3fe608060405234801561000f575f80fd5b5060043610610153575f3560e01c8063ac7475ed116100bf578063e00bfe5011610079578063e00bfe5014610329578063e3f5aa5114610344578063e59de7001461034f578063e8698f9814610370578063f2fde38b14610386578063fbfa77cf14610399575f80fd5b8063ac7475ed146102a7578063ad5c4648146102ba578063b3f00674146102d5578063b5a388dc146102e8578063c69bebe4146102fb578063d9fb643a1461030e575f80fd5b8063715018a611610110578063715018a614610229578063814edb3f146102315780638322fff2146102445780638da5cb5b1461025f578063a846ffef1461026f578063aaf5eb681461028a575f80fd5b806301681a621461015757806305e2d5411461016c57806309f2224f146101a45780631ef44e68146101c4578063429bef101461020e578063570ca73514610216575b5f80fd5b61016a610165366004611812565b6103c0565b005b61018773cd5fe23c85820f7b72d0926fc9b05b43e359b7ee81565b6040516001600160a01b0390911681526020015b60405180910390f35b6101b76101b236600461182b565b610498565b60405161019b91906118a0565b6101f96101d2366004611812565b6001600160a01b03165f908152600360209081526040808320546004909252909120549091565b6040805192835260208301919091520161019b565b6101f96105ea565b600154610187906001600160a01b031681565b61016a610608565b61016a61023f3660046118fa565b61061b565b61018773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b5f546001600160a01b0316610187565b6101877335fa164735182de50811e8e2e824cfb9b6118ac281565b610299670de0b6b3a764000081565b60405190815260200161019b565b61016a6102b5366004611812565b61099f565b61018773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600254610187906001600160a01b031681565b61016a6102f6366004611968565b610a37565b61016a610309366004611812565b610bd6565b610187737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b61018773ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b6102996311e1a30081565b61036261035d366004611998565b610c6e565b60405161019b929190611a06565b610378610e07565b60405161019b929190611a2a565b61016a610394366004611812565b610e1e565b6101877f000000000000000000000000000000000000000000000000000000000000000081565b6103c8610e60565b6040516370a0823160e01b81523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa15801561040c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104309190611a4e565b90506104466001600160a01b0383163383610e8c565b478015610457576104573382610ee3565b6040516001600160a01b03841681527f807273efecfbeb7ae7d3a2189d1ed5a7db80074eed86e7d80b10bb925cd1db739060200160405180910390a1505050565b60605f73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b038416016104c85750600561050e565b7335fa164735182de50811e8e2e824cfb9b6118ac1196001600160a01b038416016104f55750600761050e565b60405163350b944160e11b815260040160405180910390fd5b5f61051882610f76565b90508085101580610527575085155b156105335750506105e3565b61053d8582611a79565b90508581111561054a5750845b8067ffffffffffffffff81111561056357610563611a8c565b60405190808252806020026020018201604052801561058c578160200160208202803683370190505b5092505f5b818110156105df576105ad6105a68288611aa0565b8490610f85565b8482815181106105bf576105bf611ab3565b6001600160a01b0390921660209283029190910190910152600101610591565b5050505b9392505050565b5f806105f66005610f76565b6106006007610f76565b915091509091565b610610610e60565b6106195f610f90565b565b6001546001600160a01b031633146106465760405163a5523ee560e01b815260040160405180910390fd5b6311e1a30081111561066b576040516304c5ed9760e51b815260040160405180910390fd5b5f61067a868660056003610fdf565b90505f61068b858560076004610fdf565b90505f6106988284611aa0565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639e65741e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061071b9190611a4e565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c0587a956040518163ffffffff1660e01b8152600401602060405180830381865afa15801561077a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061079e9190611a4e565b9050805f036107c05760405163e9ec812960e01b815260040160405180910390fd5b5f818310156108a4575f610875857f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561082a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084e9190611a4e565b6108589190611a79565b670de0b6b3a7640000600161086d8888611a79565b9291906110a6565b90506108a061088c670de0b6b3a764000080611ac7565b6108968688611ac7565b83919060016110a6565b9150505b5f6108af898c611aa0565b6108b93a8a611ac7565b6108c39190611af2565b9050861561092b576108f18c8c73ae7ab96520de3a18e5e111b5eaab095312d7fe848a8587600360056110f5565b7f79c4f7e4d85ec64bf07ed6ed1d18c0ff4c1316c6c2feb4c74f2e445b288cdee98c8c604051610922929190611b05565b60405180910390a15b8515610991576109578a8a7335fa164735182de50811e8e2e824cfb9b6118ac2898587600460076110f5565b7fd40811a85b2e8160b2b68e534da72309fbc53bd08930d432c95e4fef0eefd5b68a8a604051610988929190611b05565b60405180910390a15b505050505050505050505050565b6109a7610e60565b6001600160a01b0381166109ce5760405163ba0cdec560e01b815260040160405180910390fd5b600154604080516001600160a01b03928316815291831660208301527ff7fa3b6184cd955c4d8db1b118f541d29ad3cde98ac41ffac1864077b27acc5b910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a805760405163edd7338f60e01b815260040160405180910390fd5b815f03610aa057604051636edcc52360e01b815260040160405180910390fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b03821601610b1957610ad060058461137d565b15610aee57604051630508c93960e41b815260040160405180910390fd5b610af960058461139e565b506001600160a01b0383165f908152600360205260409020829055610b8e565b7335fa164735182de50811e8e2e824cfb9b6118ac1196001600160a01b038216016104f557610b4960078461137d565b15610b6757604051630508c93960e41b815260040160405180910390fd5b610b7260078461139e565b506001600160a01b0383165f9081526004602052604090208290555b826001600160a01b03167f8333410c98bc9c547df96e8a03e08475253d13a1889ff7ed7e4cd3df61010a0783604051610bc991815260200190565b60405180910390a2505050565b610bde610e60565b6001600160a01b038116610c0557604051633480121760e21b815260040160405180910390fd5b600254604080516001600160a01b03928316815291831660208301527f2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666910160405180910390a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b606080825f819003610c935760405163251f56a160e21b815260040160405180910390fd5b8067ffffffffffffffff811115610cac57610cac611a8c565b604051908082528060200260200182016040528015610cd5578160200160208202803683370190505b5092508067ffffffffffffffff811115610cf157610cf1611a8c565b604051908082528060200260200182016040528015610d1a578160200160208202803683370190505b5091505f5b81811015610dfe5760035f878784818110610d3c57610d3c611ab3565b9050602002016020810190610d519190611812565b6001600160a01b03166001600160a01b031681526020019081526020015f2054848281518110610d8357610d83611ab3565b60200260200101818152505060045f878784818110610da457610da4611ab3565b9050602002016020810190610db99190611812565b6001600160a01b03166001600160a01b031681526020019081526020015f2054838281518110610deb57610deb611ab3565b6020908102919091010152600101610d1f565b50509250929050565b606080610e1460056113b2565b61060060076113b2565b610e26610e60565b6001600160a01b038116610e5457604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610e5d81610f90565b50565b5f546001600160a01b031633146106195760405163118cdaa760e01b8152336004820152602401610e4b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ede9084906113be565b505050565b80471015610f065760405163cd78605960e01b8152306004820152602401610e4b565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610f4f576040519150601f19603f3d011682016040523d82523d5f602084013e610f54565b606091505b5050905080610ede57604051630a12f52160e11b815260040160405180910390fd5b5f610f7f825490565b92915050565b5f6105e3838361141f565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f838103610fee57505f61109e565b5f5b8481101561109c5761102986868381811061100d5761100d611ab3565b90506020020160208101906110229190611812565b859061137d565b611046576040516336c1731960e01b815260040160405180910390fd5b825f87878481811061105a5761105a611ab3565b905060200201602081019061106f9190611812565b6001600160a01b0316815260208101919091526040015f20546110929083611aa0565b9150600101610ff0565b505b949350505050565b5f806110b3868686611445565b90506110be83611504565b80156110d957505f84806110d4576110d4611ade565b868809115b156110ec576110e9600182611aa0565b90505b95945050505050565b6040516370a0823160e01b81523060048201525f906001600160a01b038816906370a0823190602401602060405180830381865afa158015611139573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061115d9190611a4e565b6040516329edcc9560e21b81526001600160a01b0389811660048301526024820189905260448201879052306064830181905260848301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063a7b732549060a4016020604051808303815f875af11580156111e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112069190611a4e565b506040516370a0823160e01b81523060048201525f9082906001600160a01b038a16906370a0823190602401602060405180830381865afa15801561124d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112719190611a4e565b61127b9190611a79565b90505f61129282670de0b6b3a76400008a846110a6565b90505f805f5b8c811015611344578d8d828181106112b2576112b2611ab3565b90506020020160208101906112c79190611812565b6001600160a01b0381165f90815260208a905260408120549194506112f891908690670de0b6b3a7640000906110a6565b9150611319836113088c85611a79565b6001600160a01b038f169190610e8c565b6113238784611530565b506001600160a01b0383165f90815260208990526040812055600101611298565b505f6113508d8b611ac7565b60025490915061136d906001600160a01b038e8116911683610e8c565b5050505050505050505050505050565b6001600160a01b0381165f90815260018301602052604081205415156105e3565b5f6105e3836001600160a01b038416611544565b60605f6105e383611590565b5f6113d26001600160a01b038416836115e9565b905080515f141580156113f65750808060200190518101906113f49190611b50565b155b15610ede57604051635274afe760e01b81526001600160a01b0384166004820152602401610e4b565b5f825f01828154811061143457611434611ab3565b905f5260205f200154905092915050565b5f838302815f1985870982811083820303915050805f036114795783828161146f5761146f611ade565b04925050506105e3565b8084116114995760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f600282600381111561151957611519611b6f565b6115239190611b83565b60ff166001149050919050565b5f6105e3836001600160a01b0384166115f6565b5f81815260018301602052604081205461158957508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610f7f565b505f610f7f565b6060815f018054806020026020016040519081016040528092919081815260200182805480156115dd57602002820191905f5260205f20905b8154815260200190600101908083116115c9575b50505050509050919050565b60606105e383835f6116d9565b5f81815260018301602052604081205480156116d0575f611618600183611a79565b85549091505f9061162b90600190611a79565b905080821461168a575f865f01828154811061164957611649611ab3565b905f5260205f200154905080875f01848154811061166957611669611ab3565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061169b5761169b611ba4565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610f7f565b5f915050610f7f565b6060814710156116fe5760405163cd78605960e01b8152306004820152602401610e4b565b5f80856001600160a01b031684866040516117199190611bb8565b5f6040518083038185875af1925050503d805f8114611753576040519150601f19603f3d011682016040523d82523d5f602084013e611758565b606091505b5091509150611768868383611772565b9695505050505050565b60608261178757611782826117ce565b6105e3565b815115801561179e57506001600160a01b0384163b155b156117c757604051639996b31560e01b81526001600160a01b0385166004820152602401610e4b565b50806105e3565b8051156117de5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b038116811461180d575f80fd5b919050565b5f60208284031215611822575f80fd5b6105e3826117f7565b5f805f6060848603121561183d575f80fd5b8335925060208401359150611854604085016117f7565b90509250925092565b5f815180845260208085019450602084015f5b838110156118955781516001600160a01b031687529582019590820190600101611870565b509495945050505050565b602081525f6105e3602083018461185d565b5f8083601f8401126118c2575f80fd5b50813567ffffffffffffffff8111156118d9575f80fd5b6020830191508360208260051b85010111156118f3575f80fd5b9250929050565b5f805f805f6060868803121561190e575f80fd5b853567ffffffffffffffff80821115611925575f80fd5b61193189838a016118b2565b90975095506020880135915080821115611949575f80fd5b50611956888289016118b2565b96999598509660400135949350505050565b5f805f6060848603121561197a575f80fd5b611983846117f7565b925060208401359150611854604085016117f7565b5f80602083850312156119a9575f80fd5b823567ffffffffffffffff8111156119bf575f80fd5b6119cb858286016118b2565b90969095509350505050565b5f815180845260208085019450602084015f5b83811015611895578151875295820195908201906001016119ea565b604081525f611a1860408301856119d7565b82810360208401526110ec81856119d7565b604081525f611a3c604083018561185d565b82810360208401526110ec818561185d565b5f60208284031215611a5e575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610f7f57610f7f611a65565b634e487b7160e01b5f52604160045260245ffd5b80820180821115610f7f57610f7f611a65565b634e487b7160e01b5f52603260045260245ffd5b8082028115828204841417610f7f57610f7f611a65565b634e487b7160e01b5f52601260045260245ffd5b5f82611b0057611b00611ade565b500490565b60208082528181018390525f908460408401835b86811015611b45576001600160a01b03611b32846117f7565b1682529183019190830190600101611b19565b509695505050505050565b5f60208284031215611b60575f80fd5b815180151581146105e3575f80fd5b634e487b7160e01b5f52602160045260245ffd5b5f60ff831680611b9557611b95611ade565b8060ff84160691505092915050565b634e487b7160e01b5f52603160045260245ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220bceb8880964b7726e719450b8a4884c458745d2e2446e3e4e5bc8a91a08c467464736f6c634300081900330000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d0000000000000000000000006d425b3d302dd82cc611866ec8176d435307b616000000000000000000000000c554747ffde2e378a562a09f2f72f4121c1d493d

Deployed Bytecode

0x608060405234801561000f575f80fd5b5060043610610153575f3560e01c8063ac7475ed116100bf578063e00bfe5011610079578063e00bfe5014610329578063e3f5aa5114610344578063e59de7001461034f578063e8698f9814610370578063f2fde38b14610386578063fbfa77cf14610399575f80fd5b8063ac7475ed146102a7578063ad5c4648146102ba578063b3f00674146102d5578063b5a388dc146102e8578063c69bebe4146102fb578063d9fb643a1461030e575f80fd5b8063715018a611610110578063715018a614610229578063814edb3f146102315780638322fff2146102445780638da5cb5b1461025f578063a846ffef1461026f578063aaf5eb681461028a575f80fd5b806301681a621461015757806305e2d5411461016c57806309f2224f146101a45780631ef44e68146101c4578063429bef101461020e578063570ca73514610216575b5f80fd5b61016a610165366004611812565b6103c0565b005b61018773cd5fe23c85820f7b72d0926fc9b05b43e359b7ee81565b6040516001600160a01b0390911681526020015b60405180910390f35b6101b76101b236600461182b565b610498565b60405161019b91906118a0565b6101f96101d2366004611812565b6001600160a01b03165f908152600360209081526040808320546004909252909120549091565b6040805192835260208301919091520161019b565b6101f96105ea565b600154610187906001600160a01b031681565b61016a610608565b61016a61023f3660046118fa565b61061b565b61018773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b5f546001600160a01b0316610187565b6101877335fa164735182de50811e8e2e824cfb9b6118ac281565b610299670de0b6b3a764000081565b60405190815260200161019b565b61016a6102b5366004611812565b61099f565b61018773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600254610187906001600160a01b031681565b61016a6102f6366004611968565b610a37565b61016a610309366004611812565b610bd6565b610187737f39c581f595b53c5cb19bd0b3f8da6c935e2ca081565b61018773ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b6102996311e1a30081565b61036261035d366004611998565b610c6e565b60405161019b929190611a06565b610378610e07565b60405161019b929190611a2a565b61016a610394366004611812565b610e1e565b6101877f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d81565b6103c8610e60565b6040516370a0823160e01b81523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa15801561040c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104309190611a4e565b90506104466001600160a01b0383163383610e8c565b478015610457576104573382610ee3565b6040516001600160a01b03841681527f807273efecfbeb7ae7d3a2189d1ed5a7db80074eed86e7d80b10bb925cd1db739060200160405180910390a1505050565b60605f73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b038416016104c85750600561050e565b7335fa164735182de50811e8e2e824cfb9b6118ac1196001600160a01b038416016104f55750600761050e565b60405163350b944160e11b815260040160405180910390fd5b5f61051882610f76565b90508085101580610527575085155b156105335750506105e3565b61053d8582611a79565b90508581111561054a5750845b8067ffffffffffffffff81111561056357610563611a8c565b60405190808252806020026020018201604052801561058c578160200160208202803683370190505b5092505f5b818110156105df576105ad6105a68288611aa0565b8490610f85565b8482815181106105bf576105bf611ab3565b6001600160a01b0390921660209283029190910190910152600101610591565b5050505b9392505050565b5f806105f66005610f76565b6106006007610f76565b915091509091565b610610610e60565b6106195f610f90565b565b6001546001600160a01b031633146106465760405163a5523ee560e01b815260040160405180910390fd5b6311e1a30081111561066b576040516304c5ed9760e51b815260040160405180910390fd5b5f61067a868660056003610fdf565b90505f61068b858560076004610fdf565b90505f6106988284611aa0565b90505f7f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d6001600160a01b0316639e65741e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061071b9190611a4e565b90505f7f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d6001600160a01b031663c0587a956040518163ffffffff1660e01b8152600401602060405180830381865afa15801561077a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061079e9190611a4e565b9050805f036107c05760405163e9ec812960e01b815260040160405180910390fd5b5f818310156108a4575f610875857f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561082a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084e9190611a4e565b6108589190611a79565b670de0b6b3a7640000600161086d8888611a79565b9291906110a6565b90506108a061088c670de0b6b3a764000080611ac7565b6108968688611ac7565b83919060016110a6565b9150505b5f6108af898c611aa0565b6108b93a8a611ac7565b6108c39190611af2565b9050861561092b576108f18c8c73ae7ab96520de3a18e5e111b5eaab095312d7fe848a8587600360056110f5565b7f79c4f7e4d85ec64bf07ed6ed1d18c0ff4c1316c6c2feb4c74f2e445b288cdee98c8c604051610922929190611b05565b60405180910390a15b8515610991576109578a8a7335fa164735182de50811e8e2e824cfb9b6118ac2898587600460076110f5565b7fd40811a85b2e8160b2b68e534da72309fbc53bd08930d432c95e4fef0eefd5b68a8a604051610988929190611b05565b60405180910390a15b505050505050505050505050565b6109a7610e60565b6001600160a01b0381166109ce5760405163ba0cdec560e01b815260040160405180910390fd5b600154604080516001600160a01b03928316815291831660208301527ff7fa3b6184cd955c4d8db1b118f541d29ad3cde98ac41ffac1864077b27acc5b910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b037f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d1614610a805760405163edd7338f60e01b815260040160405180910390fd5b815f03610aa057604051636edcc52360e01b815260040160405180910390fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe83196001600160a01b03821601610b1957610ad060058461137d565b15610aee57604051630508c93960e41b815260040160405180910390fd5b610af960058461139e565b506001600160a01b0383165f908152600360205260409020829055610b8e565b7335fa164735182de50811e8e2e824cfb9b6118ac1196001600160a01b038216016104f557610b4960078461137d565b15610b6757604051630508c93960e41b815260040160405180910390fd5b610b7260078461139e565b506001600160a01b0383165f9081526004602052604090208290555b826001600160a01b03167f8333410c98bc9c547df96e8a03e08475253d13a1889ff7ed7e4cd3df61010a0783604051610bc991815260200190565b60405180910390a2505050565b610bde610e60565b6001600160a01b038116610c0557604051633480121760e21b815260040160405180910390fd5b600254604080516001600160a01b03928316815291831660208301527f2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666910160405180910390a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b606080825f819003610c935760405163251f56a160e21b815260040160405180910390fd5b8067ffffffffffffffff811115610cac57610cac611a8c565b604051908082528060200260200182016040528015610cd5578160200160208202803683370190505b5092508067ffffffffffffffff811115610cf157610cf1611a8c565b604051908082528060200260200182016040528015610d1a578160200160208202803683370190505b5091505f5b81811015610dfe5760035f878784818110610d3c57610d3c611ab3565b9050602002016020810190610d519190611812565b6001600160a01b03166001600160a01b031681526020019081526020015f2054848281518110610d8357610d83611ab3565b60200260200101818152505060045f878784818110610da457610da4611ab3565b9050602002016020810190610db99190611812565b6001600160a01b03166001600160a01b031681526020019081526020015f2054838281518110610deb57610deb611ab3565b6020908102919091010152600101610d1f565b50509250929050565b606080610e1460056113b2565b61060060076113b2565b610e26610e60565b6001600160a01b038116610e5457604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610e5d81610f90565b50565b5f546001600160a01b031633146106195760405163118cdaa760e01b8152336004820152602401610e4b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ede9084906113be565b505050565b80471015610f065760405163cd78605960e01b8152306004820152602401610e4b565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610f4f576040519150601f19603f3d011682016040523d82523d5f602084013e610f54565b606091505b5050905080610ede57604051630a12f52160e11b815260040160405180910390fd5b5f610f7f825490565b92915050565b5f6105e3838361141f565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f838103610fee57505f61109e565b5f5b8481101561109c5761102986868381811061100d5761100d611ab3565b90506020020160208101906110229190611812565b859061137d565b611046576040516336c1731960e01b815260040160405180910390fd5b825f87878481811061105a5761105a611ab3565b905060200201602081019061106f9190611812565b6001600160a01b0316815260208101919091526040015f20546110929083611aa0565b9150600101610ff0565b505b949350505050565b5f806110b3868686611445565b90506110be83611504565b80156110d957505f84806110d4576110d4611ade565b868809115b156110ec576110e9600182611aa0565b90505b95945050505050565b6040516370a0823160e01b81523060048201525f906001600160a01b038816906370a0823190602401602060405180830381865afa158015611139573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061115d9190611a4e565b6040516329edcc9560e21b81526001600160a01b0389811660048301526024820189905260448201879052306064830181905260848301529192507f000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d9091169063a7b732549060a4016020604051808303815f875af11580156111e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112069190611a4e565b506040516370a0823160e01b81523060048201525f9082906001600160a01b038a16906370a0823190602401602060405180830381865afa15801561124d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112719190611a4e565b61127b9190611a79565b90505f61129282670de0b6b3a76400008a846110a6565b90505f805f5b8c811015611344578d8d828181106112b2576112b2611ab3565b90506020020160208101906112c79190611812565b6001600160a01b0381165f90815260208a905260408120549194506112f891908690670de0b6b3a7640000906110a6565b9150611319836113088c85611a79565b6001600160a01b038f169190610e8c565b6113238784611530565b506001600160a01b0383165f90815260208990526040812055600101611298565b505f6113508d8b611ac7565b60025490915061136d906001600160a01b038e8116911683610e8c565b5050505050505050505050505050565b6001600160a01b0381165f90815260018301602052604081205415156105e3565b5f6105e3836001600160a01b038416611544565b60605f6105e383611590565b5f6113d26001600160a01b038416836115e9565b905080515f141580156113f65750808060200190518101906113f49190611b50565b155b15610ede57604051635274afe760e01b81526001600160a01b0384166004820152602401610e4b565b5f825f01828154811061143457611434611ab3565b905f5260205f200154905092915050565b5f838302815f1985870982811083820303915050805f036114795783828161146f5761146f611ade565b04925050506105e3565b8084116114995760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f600282600381111561151957611519611b6f565b6115239190611b83565b60ff166001149050919050565b5f6105e3836001600160a01b0384166115f6565b5f81815260018301602052604081205461158957508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610f7f565b505f610f7f565b6060815f018054806020026020016040519081016040528092919081815260200182805480156115dd57602002820191905f5260205f20905b8154815260200190600101908083116115c9575b50505050509050919050565b60606105e383835f6116d9565b5f81815260018301602052604081205480156116d0575f611618600183611a79565b85549091505f9061162b90600190611a79565b905080821461168a575f865f01828154811061164957611649611ab3565b905f5260205f200154905080875f01848154811061166957611669611ab3565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061169b5761169b611ba4565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610f7f565b5f915050610f7f565b6060814710156116fe5760405163cd78605960e01b8152306004820152602401610e4b565b5f80856001600160a01b031684866040516117199190611bb8565b5f6040518083038185875af1925050503d805f8114611753576040519150601f19603f3d011682016040523d82523d5f602084013e611758565b606091505b5091509150611768868383611772565b9695505050505050565b60608261178757611782826117ce565b6105e3565b815115801561179e57506001600160a01b0384163b155b156117c757604051639996b31560e01b81526001600160a01b0385166004820152602401610e4b565b50806105e3565b8051156117de5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b038116811461180d575f80fd5b919050565b5f60208284031215611822575f80fd5b6105e3826117f7565b5f805f6060848603121561183d575f80fd5b8335925060208401359150611854604085016117f7565b90509250925092565b5f815180845260208085019450602084015f5b838110156118955781516001600160a01b031687529582019590820190600101611870565b509495945050505050565b602081525f6105e3602083018461185d565b5f8083601f8401126118c2575f80fd5b50813567ffffffffffffffff8111156118d9575f80fd5b6020830191508360208260051b85010111156118f3575f80fd5b9250929050565b5f805f805f6060868803121561190e575f80fd5b853567ffffffffffffffff80821115611925575f80fd5b61193189838a016118b2565b90975095506020880135915080821115611949575f80fd5b50611956888289016118b2565b96999598509660400135949350505050565b5f805f6060848603121561197a575f80fd5b611983846117f7565b925060208401359150611854604085016117f7565b5f80602083850312156119a9575f80fd5b823567ffffffffffffffff8111156119bf575f80fd5b6119cb858286016118b2565b90969095509350505050565b5f815180845260208085019450602084015f5b83811015611895578151875295820195908201906001016119ea565b604081525f611a1860408301856119d7565b82810360208401526110ec81856119d7565b604081525f611a3c604083018561185d565b82810360208401526110ec818561185d565b5f60208284031215611a5e575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610f7f57610f7f611a65565b634e487b7160e01b5f52604160045260245ffd5b80820180821115610f7f57610f7f611a65565b634e487b7160e01b5f52603260045260245ffd5b8082028115828204841417610f7f57610f7f611a65565b634e487b7160e01b5f52601260045260245ffd5b5f82611b0057611b00611ade565b500490565b60208082528181018390525f908460408401835b86811015611b45576001600160a01b03611b32846117f7565b1682529183019190830190600101611b19565b509695505050505050565b5f60208284031215611b60575f80fd5b815180151581146105e3575f80fd5b634e487b7160e01b5f52602160045260245ffd5b5f60ff831680611b9557611b95611ade565b8060ff84160691505092915050565b634e487b7160e01b5f52603160045260245ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220bceb8880964b7726e719450b8a4884c458745d2e2446e3e4e5bc8a91a08c467464736f6c63430008190033

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

0000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d0000000000000000000000006d425b3d302dd82cc611866ec8176d435307b616000000000000000000000000c554747ffde2e378a562a09f2f72f4121c1d493d

-----Decoded View---------------
Arg [0] : _admin (address): 0x8FA9aa69a6e94c1cd49FbF214C833B2911D02553
Arg [1] : _vault (address): 0xB13aa2d0345b0439b064f26B82D8dCf3f508775d
Arg [2] : _operator (address): 0x6d425B3D302DD82cC611866eC8176d435307b616
Arg [3] : _feeReceiver (address): 0xc554747ffde2e378a562a09f2f72f4121C1d493D

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000008fa9aa69a6e94c1cd49fbf214c833b2911d02553
Arg [1] : 000000000000000000000000b13aa2d0345b0439b064f26b82d8dcf3f508775d
Arg [2] : 0000000000000000000000006d425b3d302dd82cc611866ec8176d435307b616
Arg [3] : 000000000000000000000000c554747ffde2e378a562a09f2f72f4121c1d493d


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.