ETH Price: $3,096.07 (+0.89%)
Gas: 7 Gwei

Contract

0x839D6833cEE34ffab6FA9057B39f02Bd3091a1D6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Manage Position ...194157382024-03-12 1:31:47120 days ago1710207107IN
0x839D6833...d3091a1D6
0 ETH0.0146844955.93285027
Manage Position ...193823782024-03-07 9:24:23125 days ago1709803463IN
0x839D6833...d3091a1D6
0 ETH0.0136514451.99600722
Manage Position ...192579052024-02-18 23:21:59142 days ago1708298519IN
0x839D6833...d3091a1D6
0 ETH0.0056821421.61178161
Manage Position ...192561182024-02-18 17:18:47143 days ago1708276727IN
0x839D6833...d3091a1D6
0 ETH0.0074559728.39850385
Manage Position ...190803042024-01-25 1:16:47167 days ago1706145407IN
0x839D6833...d3091a1D6
0 ETH0.0057941822.03791095
Manage Position ...190257772024-01-17 9:41:11175 days ago1705484471IN
0x839D6833...d3091a1D6
0 ETH0.0063118628.47993617
Manage Position ...189790612024-01-10 20:54:11181 days ago1704920051IN
0x839D6833...d3091a1D6
0 ETH0.01254747.72194463
Manage Position ...188482512023-12-23 11:35:11200 days ago1703331311IN
0x839D6833...d3091a1D6
0 ETH0.0048787519.60458936
Manage Position ...188058492023-12-17 12:49:47206 days ago1702817387IN
0x839D6833...d3091a1D6
0 ETH0.0078283631.45713686
Manage Position ...187864262023-12-14 19:21:35208 days ago1702581695IN
0x839D6833...d3091a1D6
0 ETH0.0110736749.96583015
Manage Position ...187827032023-12-14 6:49:23209 days ago1702536563IN
0x839D6833...d3091a1D6
0 ETH0.0139070952.96972476
Manage Position ...187824112023-12-14 5:50:47209 days ago1702533047IN
0x839D6833...d3091a1D6
0 ETH0.0111321542.40043762
Manage Position ...187459972023-12-09 3:28:59214 days ago1702092539IN
0x839D6833...d3091a1D6
0 ETH0.0089993432.57939242
Manage Position ...187419762023-12-08 13:56:23215 days ago1702043783IN
0x839D6833...d3091a1D6
0 ETH0.0133035250.67081952
Manage Position ...186851622023-11-30 14:58:23223 days ago1701356303IN
0x839D6833...d3091a1D6
0 ETH0.0091936341.41352837
Manage Position ...186546112023-11-26 8:18:35227 days ago1700986715IN
0x839D6833...d3091a1D6
0 ETH0.0049579118.85719455
Manage Position ...186190862023-11-21 8:56:23232 days ago1700556983IN
0x839D6833...d3091a1D6
0 ETH0.0070836626.9423876
Manage Position ...186190062023-11-21 8:40:23232 days ago1700556023IN
0x839D6833...d3091a1D6
0 ETH0.0067812525.79220059
Manage Position ...186051822023-11-19 10:12:23234 days ago1700388743IN
0x839D6833...d3091a1D6
0 ETH0.0051504120.66538134
Manage Position ...185967152023-11-18 5:40:23235 days ago1700286023IN
0x839D6833...d3091a1D6
0 ETH0.0046352217.62984081
Manage Position ...185851202023-11-16 14:43:35237 days ago1700145815IN
0x839D6833...d3091a1D6
0 ETH0.0122928446.75524408
Manage Position ...185849652023-11-16 14:12:23237 days ago1700143943IN
0x839D6833...d3091a1D6
0 ETH0.0094941636.11062259
Manage Position ...185713332023-11-14 16:27:35239 days ago1699979255IN
0x839D6833...d3091a1D6
0 ETH0.0125359445.38260852
Manage Position ...185708222023-11-14 14:45:11239 days ago1699973111IN
0x839D6833...d3091a1D6
0 ETH0.0131155849.9550006
Manage Position ...185689432023-11-14 8:27:11239 days ago1699950431IN
0x839D6833...d3091a1D6
0 ETH0.0070330526.78870114
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PositionManagerStETH

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200000 runs

Other Settings:
default evmVersion
File 1 of 1 : PositionManagerStETH.flattened.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

/// Parameters for ERC20Permit.permit call
struct ERC20PermitSignature {
    IERC20Permit token;
    uint256 value;
    uint256 deadline;
    uint8 v;
    bytes32 r;
    bytes32 s;
}

library PermitHelper {
    function applyPermit(
        ERC20PermitSignature calldata p,
        address owner,
        address spender
    ) internal {
        p.token.permit(owner, spender, p.value, p.deadline, p.v, p.r, p.s);
    }

    function applyPermits(
        ERC20PermitSignature[] calldata permits,
        address owner,
        address spender
    ) internal {
        for (uint256 i = 0; i < permits.length; i++) {
            applyPermit(permits[i], owner, spender);
        }
    }
}

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

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

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

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

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

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

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

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

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

interface IWstETH is IERC20 {
    // --- Functions ---

    function stETH() external returns (IERC20);

    /// @notice Exchanges stETH to wstETH
    /// @param stETHAmount amount of stETH to wrap in exchange for wstETH
    /// @dev Requirements:
    ///  - `stETHAmount` must be non-zero
    ///  - msg.sender must approve at least `stETHAmount` stETH to this
    ///    contract.
    ///  - msg.sender must have at least `stETHAmount` of stETH.
    /// User should first approve `stETHAmount` to the WstETH contract
    /// @return Amount of wstETH user receives after wrap
    function wrap(uint256 stETHAmount) external returns (uint256);

    /// @notice Exchanges wstETH to stETH.
    /// @param wstETHAmount Amount of wstETH to unwrap in exchange for stETH.
    /// @dev Requirements:
    ///  - `wstETHAmount` must be non-zero
    ///  - msg.sender must have at least `wstETHAmount` wstETH.
    /// @return Amount of stETH user receives after unwrap.
    function unwrap(uint256 wstETHAmount) external returns (uint256);

    /// @notice Get amount of wstETH for a given amount of stETH.
    /// @param stETHAmount Amount of stETH.
    /// @return Amount of wstETH for a given stETH amount.
    function getWstETHByStETH(uint256 stETHAmount) external view returns (uint256);

    /// @notice Get amount of stETH for a given amount of wstETH.
    /// @param wstETHAmount amount of wstETH.
    /// @return Amount of stETH for a given wstETH amount.
    function getStETHByWstETH(uint256 wstETHAmount) external view returns (uint256);

    /// @notice Get amount of stETH for a one wstETH.
    /// @return Amount of stETH for 1 wstETH.
    function stEthPerToken() external view returns (uint256);

    /// @notice Get amount of wstETH for a one stETH.
    /// @return Amount of wstETH for a 1 stETH.
    function tokensPerStEth() external view returns (uint256);
}

interface IPositionManagerDependent {
    // --- Errors ---

    /// @dev Position Manager cannot be zero.
    error PositionManagerCannotBeZero();

    /// @dev Caller is not Position Manager.
    error CallerIsNotPositionManager(address caller);

    // --- Functions ---

    /// @dev Returns address of the PositionManager contract.
    function positionManager() external view returns (address);
}

interface IERC20Indexable is IERC20, IPositionManagerDependent {
    // --- Events ---

    /// @dev New token is deployed.
    /// @param positionManager Address of the PositionManager contract that is authorized to mint and burn new tokens.
    event ERC20IndexableDeployed(address positionManager);

    /// @dev New index has been set.
    /// @param newIndex Value of the new index.
    event IndexUpdated(uint256 newIndex);

    // --- Errors ---

    /// @dev Unsupported action for ERC20Indexable contract.
    error NotSupported();

    // --- Functions ---

    /// @return Precision for token index. Represents index that is equal to 1.
    function INDEX_PRECISION() external view returns (uint256);

    /// @return Current index value.
    function currentIndex() external view returns (uint256);

    /// @dev Sets new token index. Callable only by PositionManager contract.
    /// @param backingAmount Amount of backing token that is covered by total supply.
    function setIndex(uint256 backingAmount) external;

    /// @dev Mints new tokens. Callable only by PositionManager contract.
    /// @param to Address that will receive newly minted tokens.
    /// @param amount Amount of tokens to mint.
    function mint(address to, uint256 amount) external;

    /// @dev Mints new tokens. Callable only by PositionManager contract.
    /// @param from Address of user whose tokens are burnt.
    /// @param amount Amount of tokens to burn.
    function burn(address from, uint256 amount) external;
}

/// @dev Interface to be used by contracts that collect fees. Contains fee recipient that can be changed by owner.
interface IFeeCollector {
    // --- Events ---

    /// @dev Fee Recipient is changed to @param feeRecipient address.
    /// @param feeRecipient New fee recipient address.
    event FeeRecipientChanged(address feeRecipient);

    // --- Errors ---

    /// @dev Invalid fee recipient.
    error InvalidFeeRecipient();

    // --- Functions ---

    /// @return Address of the current fee recipient.
    function feeRecipient() external view returns (address);

    /// @dev Sets new fee recipient address
    /// @param newFeeRecipient Address of the new fee recipient.
    function setFeeRecipient(address newFeeRecipient) external;
}

interface IPriceOracle {
    // --- Types ---

    struct PriceOracleResponse {
        bool isBrokenOrFrozen;
        bool priceChangeAboveMax;
        uint256 price;
    }

    // --- Errors ---

    /// @dev Invalid wstETH address.
    error InvalidWstETHAddress();

    // --- Functions ---

    /// @dev Return price oracle response which consists the following information: oracle is broken or frozen, the
    /// price change between two rounds is more than max, and the price.
    function getPriceOracleResponse() external returns (PriceOracleResponse memory);

    /// @dev Return wstETH address.
    function wstETH() external view returns (IWstETH);

    /// @dev Maximum time period allowed since oracle latest round data timestamp, beyond which oracle is considered
    /// frozen.
    function TIMEOUT() external view returns (uint256);

    /// @dev Used to convert a price answer to an 18-digit precision uint.
    function TARGET_DIGITS() external view returns (uint256);

    /// @dev price deviation for the oracle in percentage.
    function DEVIATION() external view returns (uint256);
}

interface IPriceFeed {
    // --- Events ---

    /// @dev Last good price has been updated.
    event LastGoodPriceUpdated(uint256 lastGoodPrice);

    /// @dev Price difference between oracles has been updated.
    /// @param priceDifferenceBetweenOracles New price difference between oracles.
    event PriceDifferenceBetweenOraclesUpdated(uint256 priceDifferenceBetweenOracles);

    /// @dev Primary oracle has been updated.
    /// @param primaryOracle New primary oracle.
    event PrimaryOracleUpdated(IPriceOracle primaryOracle);

    /// @dev Secondary oracle has been updated.
    /// @param secondaryOracle New secondary oracle.
    event SecondaryOracleUpdated(IPriceOracle secondaryOracle);

    // --- Errors ---

    /// @dev Invalid primary oracle.
    error InvalidPrimaryOracle();

    /// @dev Invalid secondary oracle.
    error InvalidSecondaryOracle();

    /// @dev Primary oracle is broken or frozen or has bad result.
    error PrimaryOracleBrokenOrFrozenOrBadResult();

    /// @dev Invalid price difference between oracles.
    error InvalidPriceDifferenceBetweenOracles();

    // --- Functions ---

    /// @dev Return primary oracle address.
    function primaryOracle() external returns (IPriceOracle);

    /// @dev Return secondary oracle address
    function secondaryOracle() external returns (IPriceOracle);

    /// @dev The last good price seen from an oracle by Raft.
    function lastGoodPrice() external returns (uint256);

    /// @dev The maximum relative price difference between two oracle responses.
    function priceDifferenceBetweenOracles() external returns (uint256);

    /// @dev Set primary oracle address.
    /// @param newPrimaryOracle Primary oracle address.
    function setPrimaryOracle(IPriceOracle newPrimaryOracle) external;

    /// @dev Set secondary oracle address.
    /// @param newSecondaryOracle Secondary oracle address.
    function setSecondaryOracle(IPriceOracle newSecondaryOracle) external;

    /// @dev Set the maximum relative price difference between two oracle responses.
    /// @param newPriceDifferenceBetweenOracles The maximum relative price difference between two oracle responses.
    function setPriceDifferenceBetweenOracles(uint256 newPriceDifferenceBetweenOracles) external;

    /// @dev Returns the latest price obtained from the Oracle. Called by Raft functions that require a current price.
    ///
    /// Also callable by anyone externally.
    /// Non-view function - it stores the last good price seen by Raft.
    ///
    /// Uses a primary oracle and a fallback oracle in case primary fails. If both fail,
    /// it uses the last good price seen by Raft.
    ///
    /// @return currentPrice Returned price.
    /// @return deviation Deviation of the reported price in percentage.
    /// @notice Actual returned price is in range `currentPrice` +/- `currentPrice * deviation / ONE`
    function fetchPrice() external returns (uint256 currentPrice, uint256 deviation);
}

// OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashLender.sol)

// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol)

/**
 * @dev Interface of the ERC3156 FlashBorrower, as defined in
 * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
 *
 * _Available since v4.1._
 */
interface IERC3156FlashBorrower {
    /**
     * @dev Receive a flash loan.
     * @param initiator The initiator of the loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param fee The additional amount of tokens to repay.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     * @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan"
     */
    function onFlashLoan(
        address initiator,
        address token,
        uint256 amount,
        uint256 fee,
        bytes calldata data
    ) external returns (bytes32);
}

/**
 * @dev Interface of the ERC3156 FlashLender, as defined in
 * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
 *
 * _Available since v4.1._
 */
interface IERC3156FlashLender {
    /**
     * @dev The amount of currency available to be lended.
     * @param token The loan currency.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(address token) external view returns (uint256);

    /**
     * @dev The fee to be charged for a given loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(address token, uint256 amount) external view returns (uint256);

    /**
     * @dev Initiate a flash loan.
     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);
}

/// @dev Interface of R stablecoin token. Implements some standards like IERC20, IERC20Permit, and IERC3156FlashLender.
/// Raft's specific implementation contains IFeeCollector and IPositionManagerDependent.
/// PositionManager can mint and burn R when particular actions happen with user's position.
interface IRToken is IERC20, IERC20Permit, IERC3156FlashLender, IFeeCollector, IPositionManagerDependent {
    // --- Events ---

    /// @dev New R token is deployed
    /// @param positionManager Address of the PositionManager contract that is authorized to mint and burn new tokens.
    /// @param flashMintFeeRecipient Address of flash mint fee recipient.
    event RDeployed(address positionManager, address flashMintFeeRecipient);

    /// @dev The Flash Mint Fee Percentage has been changed.
    /// @param flashMintFeePercentage The new Flash Mint Fee Percentage value.
    event FlashMintFeePercentageChanged(uint256 flashMintFeePercentage);

    /// --- Errors ---

    /// @dev Proposed flash mint fee percentage is too big.
    /// @param feePercentage Proposed flash mint fee percentage.
    error FlashFeePercentageTooBig(uint256 feePercentage);

    // --- Functions ---

    /// @return Number representing 100 percentage.
    function PERCENTAGE_BASE() external view returns (uint256);

    /// @dev Mints new tokens. Callable only by PositionManager contract.
    /// @param to Address that will receive newly minted tokens.
    /// @param amount Amount of tokens to mint.
    function mint(address to, uint256 amount) external;

    /// @dev Mints new tokens. Callable only by PositionManager contract.
    /// @param from Address of user whose tokens are burnt.
    /// @param amount Amount of tokens to burn.
    function burn(address from, uint256 amount) external;

    /// @return Maximum flash mint fee percentage that can be set by owner.
    function MAX_FLASH_MINT_FEE_PERCENTAGE() external view returns (uint256);

    /// @return Current flash mint fee percentage.
    function flashMintFeePercentage() external view returns (uint256);

    /// @dev Sets new flash mint fee percentage. Callable only by owner.
    /// @notice The proposed flash mint fee percentage cannot exceed `MAX_FLASH_MINT_FEE_PERCENTAGE`.
    /// @param feePercentage New flash fee percentage.
    function setFlashMintFeePercentage(uint256 feePercentage) external;
}

interface ISplitLiquidationCollateral {
    // --- Functions ---

    /// @dev Returns lowest total debt that will be split.
    function LOW_TOTAL_DEBT() external view returns (uint256);

    /// @dev Minimum collateralisation ratio for position
    function MCR() external view returns (uint256);

    /// @dev Splits collateral between protocol and liquidator.
    /// @param totalCollateral Amount of collateral to split.
    /// @param totalDebt Amount of debt to split.
    /// @param price Price of collateral.
    /// @param isRedistribution True if this is a redistribution.
    /// @return collateralToSendToProtocol Amount of collateral to send to protocol.
    /// @return collateralToSentToLiquidator Amount of collateral to send to liquidator.
    function split(
        uint256 totalCollateral,
        uint256 totalDebt,
        uint256 price,
        bool isRedistribution
    )
        external
        view
        returns (uint256 collateralToSendToProtocol, uint256 collateralToSentToLiquidator);
}

/// @dev Common interface for the Position Manager.
interface IPositionManager is IFeeCollector {
    // --- Types ---

    /// @dev Information for a Raft indexable collateral token.
    /// @param collateralToken The Raft indexable collateral token.
    /// @param debtToken Coresponding Rafft indexable debt token.
    /// @param priceFeed The contract that provides a price for the collateral token.
    /// @param splitLiquidation The contract that calculates collateral split in case of liquidation.
    /// @param isEnabled Whether the token can be used as collateral or not.
    /// @param lastFeeOperationTime Timestamp of the last operation for the collateral token.
    /// @param borrowingSpread The current borrowing spread.
    /// @param baseRate The current base rate.
    /// @param redemptionSpread The current redemption spread.
    /// @param redemptionRebate Percentage of the redemption fee returned to redeemed positions.
    struct CollateralTokenInfo {
        IERC20Indexable collateralToken;
        IERC20Indexable debtToken;
        IPriceFeed priceFeed;
        ISplitLiquidationCollateral splitLiquidation;
        bool isEnabled;
        uint256 lastFeeOperationTime;
        uint256 borrowingSpread;
        uint256 baseRate;
        uint256 redemptionSpread;
        uint256 redemptionRebate;
    }

    // --- Events ---

    /// @dev New position manager has been token deployed.
    /// @param rToken The R token used by the position manager.
    /// @param feeRecipient The address of fee recipient.
    event PositionManagerDeployed(IRToken rToken, address feeRecipient);

    /// @dev New collateral token has been added added to the system.
    /// @param collateralToken The token used as collateral.
    /// @param raftCollateralToken The Raft indexable collateral token for the given collateral token.
    /// @param raftDebtToken The Raft indexable debt token for given collateral token.
    /// @param priceFeed The contract that provides price for the collateral token.
    event CollateralTokenAdded(
        IERC20 collateralToken,
        IERC20Indexable raftCollateralToken,
        IERC20Indexable raftDebtToken,
        IPriceFeed priceFeed
    );

    /// @dev Collateral token has been enabled or disabled.
    /// @param collateralToken The token used as collateral.
    /// @param isEnabled True if the token is enabled, false otherwise.
    event CollateralTokenModified(IERC20 collateralToken, bool isEnabled);

    /// @dev A delegate has been whitelisted for a certain position.
    /// @param position The position for which the delegate was whitelisted.
    /// @param delegate The delegate which was whitelisted.
    /// @param whitelisted Specifies whether the delegate whitelisting has been enabled (true) or disabled (false).
    event DelegateWhitelisted(address indexed position, address indexed delegate, bool whitelisted);

    /// @dev New position has been created.
    /// @param position The address of the user opening new position.
    /// @param collateralToken The token used as collateral for the created position.
    event PositionCreated(address indexed position, IERC20 indexed collateralToken);

    /// @dev The position has been closed by either repayment, liquidation, or redemption.
    /// @param position The address of the user whose position is closed.
    event PositionClosed(address indexed position);

    /// @dev Collateral amount for the position has been changed.
    /// @param position The address of the user that has opened the position.
    /// @param collateralToken The address of the collateral token being added to position.
    /// @param collateralAmount The amount of collateral added or removed.
    /// @param isCollateralIncrease Whether the collateral is added to the position or removed from it.
    event CollateralChanged(
        address indexed position, IERC20 indexed collateralToken, uint256 collateralAmount, bool isCollateralIncrease
    );

    /// @dev Debt amount for position has been changed.
    /// @param position The address of the user that has opened the position.
    /// @param collateralToken The address of the collateral token backing the debt.
    /// @param debtAmount The amount of debt added or removed.
    /// @param isDebtIncrease Whether the debt is added to the position or removed from it.
    event DebtChanged(
        address indexed position, IERC20 indexed collateralToken, uint256 debtAmount, bool isDebtIncrease
    );

    /// @dev Borrowing fee has been paid. Emitted only if the actual fee was paid - doesn't happen with no fees are
    /// paid.
    /// @param collateralToken Collateral token used to mint R.
    /// @param position The address of position's owner that triggered the fee payment.
    /// @param feeAmount The amount of tokens paid as the borrowing fee.
    event RBorrowingFeePaid(IERC20 collateralToken, address indexed position, uint256 feeAmount);

    /// @dev Liquidation has been executed.
    /// @param liquidator The liquidator that executed the liquidation.
    /// @param position The address of position's owner whose position was liquidated.
    /// @param collateralToken The collateral token used for the liquidation.
    /// @param debtLiquidated The total debt that was liquidated or redistributed.
    /// @param collateralLiquidated The total collateral liquidated.
    /// @param collateralSentToLiquidator The collateral amount sent to the liquidator.
    /// @param collateralLiquidationFeePaid The total collateral paid as the liquidation fee to the fee recipient.
    /// @param isRedistribution Whether the executed liquidation was redistribution or not.
    event Liquidation(
        address indexed liquidator,
        address indexed position,
        IERC20 indexed collateralToken,
        uint256 debtLiquidated,
        uint256 collateralLiquidated,
        uint256 collateralSentToLiquidator,
        uint256 collateralLiquidationFeePaid,
        bool isRedistribution
    );

    /// @dev Redemption has been executed.
    /// @param redeemer User that redeemed R.
    /// @param amount Amount of R that was redeemed.
    /// @param collateralSent The amount of collateral sent to the redeemer.
    /// @param fee The amount of fee paid to the fee recipient.
    /// @param rebate Redemption rebate amount.
    event Redemption(address indexed redeemer, uint256 amount, uint256 collateralSent, uint256 fee, uint256 rebate);

    /// @dev Borrowing spread has been updated.
    /// @param borrowingSpread The new borrowing spread.
    event BorrowingSpreadUpdated(uint256 borrowingSpread);

    /// @dev Redemption rebate has been updated.
    /// @param redemptionRebate The new redemption rebate.
    event RedemptionRebateUpdated(uint256 redemptionRebate);

    /// @dev Redemption spread has been updated.
    /// @param collateralToken Collateral token that the spread was set for.
    /// @param redemptionSpread The new redemption spread.
    event RedemptionSpreadUpdated(IERC20 collateralToken, uint256 redemptionSpread);

    /// @dev Base rate has been updated.
    /// @param collateralToken Collateral token that the baser rate was updated for.
    /// @param baseRate The new base rate.
    event BaseRateUpdated(IERC20 collateralToken, uint256 baseRate);

    /// @dev Last fee operation time has been updated.
    /// @param collateralToken Collateral token that the baser rate was updated for.
    /// @param lastFeeOpTime The new operation time.
    event LastFeeOpTimeUpdated(IERC20 collateralToken, uint256 lastFeeOpTime);

    /// @dev Split liquidation collateral has been changed.
    /// @param collateralToken Collateral token whose split liquidation collateral contract is set.
    /// @param newSplitLiquidationCollateral New value that was set to be split liquidation collateral.
    event SplitLiquidationCollateralChanged(
        IERC20 collateralToken, ISplitLiquidationCollateral indexed newSplitLiquidationCollateral
    );

    // --- Errors ---

    /// @dev Max fee percentage must be between borrowing spread and 100%.
    error InvalidMaxFeePercentage();

    /// @dev Max fee percentage must be between 0.5% and 100%.
    error MaxFeePercentageOutOfRange();

    /// @dev Amount is zero.
    error AmountIsZero();

    /// @dev Nothing to liquidate.
    error NothingToLiquidate();

    /// @dev Cannot liquidate last position.
    error CannotLiquidateLastPosition();

    /// @dev Cannot redeem collateral below minimum debt threshold.
    /// @param collateralToken Collateral token used to redeem.
    /// @param newTotalDebt New total debt backed by collateral, which is lower than minimum debt.
    error TotalDebtCannotBeLowerThanMinDebt(IERC20 collateralToken, uint256 newTotalDebt);

    /// @dev Fee would eat up all returned collateral.
    error FeeEatsUpAllReturnedCollateral();

    /// @dev Borrowing spread exceeds maximum.
    error BorrowingSpreadExceedsMaximum();

    /// @dev Redemption rebate exceeds maximum.
    error RedemptionRebateExceedsMaximum();

    /// @dev Redemption spread is out of allowed range.
    error RedemptionSpreadOutOfRange();

    /// @dev There must be either a collateral change or a debt change.
    error NoCollateralOrDebtChange();

    /// @dev There is some collateral for position that doesn't have debt.
    error InvalidPosition();

    /// @dev An operation that would result in ICR < MCR is not permitted.
    /// @param newICR Resulting ICR that is bellow MCR.
    error NewICRLowerThanMCR(uint256 newICR);

    /// @dev Position's net debt must be greater than minimum.
    /// @param netDebt Net debt amount that is below minimum.
    error NetDebtBelowMinimum(uint256 netDebt);

    /// @dev The provided delegate address is invalid.
    error InvalidDelegateAddress();

    /// @dev A non-whitelisted delegate cannot adjust positions.
    error DelegateNotWhitelisted();

    /// @dev Fee exceeded provided maximum fee percentage.
    /// @param fee The fee amount.
    /// @param amount The amount of debt or collateral.
    /// @param maxFeePercentage The maximum fee percentage.
    error FeeExceedsMaxFee(uint256 fee, uint256 amount, uint256 maxFeePercentage);

    /// @dev Borrower uses a different collateral token already.
    error PositionCollateralTokenMismatch();

    /// @dev Collateral token address cannot be zero.
    error CollateralTokenAddressCannotBeZero();

    /// @dev Price feed address cannot be zero.
    error PriceFeedAddressCannotBeZero();

    /// @dev Collateral token already added.
    error CollateralTokenAlreadyAdded();

    /// @dev Collateral token is not added.
    error CollateralTokenNotAdded();

    /// @dev Collateral token is not enabled.
    error CollateralTokenDisabled();

    /// @dev Split liquidation collateral cannot be zero.
    error SplitLiquidationCollateralCannotBeZero();

    /// @dev Cannot change collateral in case of repaying the whole debt.
    error WrongCollateralParamsForFullRepayment();

    // --- Functions ---

    /// @return The R token used by position manager.
    function rToken() external view returns (IRToken);

    /// @dev Retrieves information about certain collateral type.
    /// @param collateralToken The token used as collateral.
    /// @return raftCollateralToken The Raft indexable collateral token.
    /// @return raftDebtToken The Raft indexable debt token.
    /// @return priceFeed The contract that provides a price for the collateral token.
    /// @return splitLiquidation The contract that calculates collateral split in case of liquidation.
    /// @return isEnabled Whether the collateral token can be used as collateral or not.
    /// @return lastFeeOperationTime Timestamp of the last operation for the collateral token.
    /// @return borrowingSpread The current borrowing spread.
    /// @return baseRate The current base rate.
    /// @return redemptionSpread The current redemption spread.
    /// @return redemptionRebate Percentage of the redemption fee returned to redeemed positions.
    function collateralInfo(IERC20 collateralToken)
        external
        view
        returns (
            IERC20Indexable raftCollateralToken,
            IERC20Indexable raftDebtToken,
            IPriceFeed priceFeed,
            ISplitLiquidationCollateral splitLiquidation,
            bool isEnabled,
            uint256 lastFeeOperationTime,
            uint256 borrowingSpread,
            uint256 baseRate,
            uint256 redemptionSpread,
            uint256 redemptionRebate
        );

    /// @param collateralToken Collateral token whose raft collateral indexable token is being queried.
    /// @return Raft collateral token address for given collateral token.
    function raftCollateralToken(IERC20 collateralToken) external view returns (IERC20Indexable);

    /// @param collateralToken Collateral token whose raft collateral indexable token is being queried.
    /// @return Raft debt token address for given collateral token.
    function raftDebtToken(IERC20 collateralToken) external view returns (IERC20Indexable);

    /// @param collateralToken Collateral token whose price feed contract is being queried.
    /// @return Price feed contract address for given collateral token.
    function priceFeed(IERC20 collateralToken) external view returns (IPriceFeed);

    /// @param collateralToken Collateral token whose split liquidation collateral is being queried.
    /// @return Returns address of the split liquidation collateral contract.
    function splitLiquidationCollateral(IERC20 collateralToken) external view returns (ISplitLiquidationCollateral);

    /// @param collateralToken Collateral token whose split liquidation collateral is being queried.
    /// @return Returns whether collateral is enabled or nor.
    function collateralEnabled(IERC20 collateralToken) external view returns (bool);

    /// @param collateralToken Collateral token we query last operation time fee for.
    /// @return The timestamp of the latest fee operation (redemption or new R issuance).
    function lastFeeOperationTime(IERC20 collateralToken) external view returns (uint256);

    /// @param collateralToken Collateral token we query borrowing spread for.
    /// @return The current borrowing spread.
    function borrowingSpread(IERC20 collateralToken) external view returns (uint256);

    /// @param collateralToken Collateral token we query base rate for.
    /// @return rate The base rate.
    function baseRate(IERC20 collateralToken) external view returns (uint256 rate);

    /// @param collateralToken Collateral token we query redemption spread for.
    /// @return The current redemption spread for collateral token.
    function redemptionSpread(IERC20 collateralToken) external view returns (uint256);

    /// @param collateralToken Collateral token we query redemption rebate for.
    /// @return rebate Percentage of the redemption fee returned to redeemed positions.
    function redemptionRebate(IERC20 collateralToken) external view returns (uint256);

    /// @param collateralToken Collateral token we query redemption rate for.
    /// @return rate The current redemption rate for collateral token.
    function getRedemptionRate(IERC20 collateralToken) external view returns (uint256 rate);

    /// @dev Returns the collateral token that a given position used for their position.
    /// @param position The address of the borrower.
    /// @return collateralToken The collateral token of the borrower's position.
    function collateralTokenForPosition(address position) external view returns (IERC20 collateralToken);

    /// @dev Adds a new collateral token to the protocol.
    /// @param collateralToken The new collateral token.
    /// @param priceFeed The price feed for the collateral token.
    /// @param newSplitLiquidationCollateral split liquidation collateral contract address.
    function addCollateralToken(
        IERC20 collateralToken,
        IPriceFeed priceFeed,
        ISplitLiquidationCollateral newSplitLiquidationCollateral
    )
        external;

    /// @dev Enables or disables a collateral token. Reverts if the collateral token has not been added.
    /// @param collateralToken The collateral token.
    /// @param isEnabled Whether the collateral token can be used as collateral or not.
    function setCollateralEnabled(IERC20 collateralToken, bool isEnabled) external;

    /// @dev Sets the new split liquidation collateral contract.
    /// @param collateralToken Collateral token whose split liquidation collateral is being set.
    /// @param newSplitLiquidationCollateral New split liquidation collateral contract address.
    function setSplitLiquidationCollateral(
        IERC20 collateralToken,
        ISplitLiquidationCollateral newSplitLiquidationCollateral
    )
        external;

    /// @dev Liquidates the borrower if its position's ICR is lower than the minimum collateral ratio.
    /// @param position The address of the borrower.
    function liquidate(address position) external;

    /// @dev Redeems the collateral token for a given debt amount. It sends @param debtAmount R to the system and
    /// redeems the corresponding amount of collateral from as many positions as are needed to fill the redemption
    /// request.
    /// @param collateralToken The token used as collateral.
    /// @param debtAmount The amount of debt to be redeemed. Must be greater than zero.
    /// @param maxFeePercentage The maximum fee percentage to pay for the redemption.
    function redeemCollateral(IERC20 collateralToken, uint256 debtAmount, uint256 maxFeePercentage) external;

    /// @dev Manages the position on behalf of a given borrower.
    /// @param collateralToken The token the borrower used as collateral.
    /// @param position The address of the borrower.
    /// @param collateralChange The amount of collateral to add or remove.
    /// @param isCollateralIncrease True if the collateral is being increased, false otherwise.
    /// @param debtChange The amount of R to add or remove. In case of repayment (isDebtIncrease = false)
    /// `type(uint256).max` value can be used to repay the whole outstanding loan.
    /// @param isDebtIncrease True if the debt is being increased, false otherwise.
    /// @param maxFeePercentage The maximum fee percentage to pay for the position management.
    /// @param permitSignature Optional permit signature for tokens that support IERC20Permit interface.
    /// @notice `permitSignature` it is ignored if permit signature is not for `collateralToken`.
    /// @notice In case of full debt repayment, `isCollateralIncrease` is ignored and `collateralChange` must be 0.
    /// These values are set to `false`(collateral decrease), and the whole collateral balance of the user.
    /// @return actualCollateralChange Actual amount of collateral added/removed.
    /// Can be different to `collateralChange` in case of full repayment.
    /// @return actualDebtChange Actual amount of debt added/removed.
    /// Can be different to `debtChange` in case of passing type(uint256).max as `debtChange`.
    function managePosition(
        IERC20 collateralToken,
        address position,
        uint256 collateralChange,
        bool isCollateralIncrease,
        uint256 debtChange,
        bool isDebtIncrease,
        uint256 maxFeePercentage,
        ERC20PermitSignature calldata permitSignature
    )
        external
        returns (uint256 actualCollateralChange, uint256 actualDebtChange);

    /// @return The max borrowing spread.
    function MAX_BORROWING_SPREAD() external view returns (uint256);

    /// @return The max borrowing rate.
    function MAX_BORROWING_RATE() external view returns (uint256);

    /// @dev Sets the new borrowing spread.
    /// @param collateralToken Collateral token we set borrowing spread for.
    /// @param newBorrowingSpread New borrowing spread to be used.
    function setBorrowingSpread(IERC20 collateralToken, uint256 newBorrowingSpread) external;

    /// @param collateralToken Collateral token we query borrowing rate for.
    /// @return The current borrowing rate.
    function getBorrowingRate(IERC20 collateralToken) external view returns (uint256);

    /// @param collateralToken Collateral token we query borrowing rate with decay for.
    /// @return The current borrowing rate with decay.
    function getBorrowingRateWithDecay(IERC20 collateralToken) external view returns (uint256);

    /// @dev Returns the borrowing fee for a given debt amount.
    /// @param collateralToken Collateral token we query borrowing fee for.
    /// @param debtAmount The amount of debt.
    /// @return The borrowing fee.
    function getBorrowingFee(IERC20 collateralToken, uint256 debtAmount) external view returns (uint256);

    /// @dev Sets the new redemption spread.
    /// @param newRedemptionSpread New redemption spread to be used.
    function setRedemptionSpread(IERC20 collateralToken, uint256 newRedemptionSpread) external;

    /// @dev Sets new redemption rebate percentage.
    /// @param newRedemptionRebate Value that is being set as a redemption rebate percentage.
    function setRedemptionRebate(IERC20 collateralToken, uint256 newRedemptionRebate) external;

    /// @param collateralToken Collateral token we query redemption rate with decay for.
    /// @return The current redemption rate with decay.
    function getRedemptionRateWithDecay(IERC20 collateralToken) external view returns (uint256);

    /// @dev Returns the redemption fee for a given collateral amount.
    /// @param collateralToken Collateral token we query redemption fee for.
    /// @param collateralAmount The amount of collateral.
    /// @param priceDeviation Deviation for the reported price by oracle in percentage.
    /// @return The redemption fee.
    function getRedemptionFee(
        IERC20 collateralToken,
        uint256 collateralAmount,
        uint256 priceDeviation
    )
        external
        view
        returns (uint256);

    /// @dev Returns the redemption fee with decay for a given collateral amount.
    /// @param collateralToken Collateral token we query redemption fee with decay for.
    /// @param collateralAmount The amount of collateral.
    /// @return The redemption fee with decay.
    function getRedemptionFeeWithDecay(
        IERC20 collateralToken,
        uint256 collateralAmount
    )
        external
        view
        returns (uint256);

    /// @return Half-life of 12h (720 min).
    /// @dev (1/2) = d^720 => d = (1/2)^(1/720)
    function MINUTE_DECAY_FACTOR() external view returns (uint256);

    /// @dev Returns if a given delegate is whitelisted for a given borrower.
    /// @param position The address of the borrower.
    /// @param delegate The address of the delegate.
    /// @return isWhitelisted True if the delegate is whitelisted for a given borrower, false otherwise.
    function isDelegateWhitelisted(address position, address delegate) external view returns (bool isWhitelisted);

    /// @dev Whitelists a delegate.
    /// @param delegate The address of the delegate.
    /// @param whitelisted True if delegate is being whitelisted, false otherwise.
    function whitelistDelegate(address delegate, bool whitelisted) external;

    /// @return Parameter by which to divide the redeemed fraction, in order to calc the new base rate from a
    /// redemption. Corresponds to (1 / ALPHA) in the white paper.
    function BETA() external view returns (uint256);
}

interface IStETH is IERC20 {
    // --- Functions ---

    function getPooledEthByShares(uint256 sharesAmount) external view returns (uint256);

    function getSharesByPooledEth(uint256 pooledEthAmount) external view returns (uint256);

    function submit(address referral) external payable returns (uint256);
}

interface IWstETHWrapper {
    /// @dev Invalid wstETH address.
    error WstETHAddressCannotBeZero();

    /// @dev Sending ether has failed.
    error SendingEtherFailed();

    /// @dev Returns wstETH token.
    function wstETH() external view returns (IWstETH);

    /// @dev Returns stETH token.
    function stETH() external view returns (IStETH);
}

/// @notice Interface for the PositionManagerStETH contract.
interface IPositionManagerStETH is IPositionManagerDependent, IWstETHWrapper {
    // --- Events ---

    /// @dev The position is changed using ETH.
    /// @param position The address of the user that has opened the position.
    /// @param collateralAmount The amount of collateral added.
    /// @param debtAmount The amount of debt added or removed.
    /// @param isDebtIncrease Whether the debt is added to the position or removed from it.
    event ETHPositionChanged(
        address indexed position, uint256 collateralAmount, uint256 debtAmount, bool isDebtIncrease
    );

    /// @dev The position is changed using stETH.
    /// @param position The address of the user that has opened the position.
    /// @param collateralAmount The amount of collateral added or removed.
    /// @param isCollateralIncrease Whether the collateral is added to the position or removed from it.
    /// @param debtAmount The amount of debt added or removed.
    /// @param isDebtIncrease Whether the debt is added to the position or removed from it.
    event StETHPositionChanged(
        address indexed position,
        uint256 collateralAmount,
        bool isCollateralIncrease,
        uint256 debtAmount,
        bool isDebtIncrease
    );

    // --- Functions ---

    /// @dev Manages the position with ether for the position (the caller).
    /// @param debtChange The amount of R to add or remove.
    /// @param isDebtIncrease True if the debt is being increased, false otherwise.
    /// @param maxFeePercentage The maximum fee percentage to pay for the position management.
    /// @param permitSignature The permit signature for the R token used for position repayment. Ignored in other
    /// cases.
    function managePositionETH(
        uint256 debtChange,
        bool isDebtIncrease,
        uint256 maxFeePercentage,
        ERC20PermitSignature calldata permitSignature
    )
        external
        payable;

    /// @dev Manages the position with stETH for the position (the caller).
    /// @param collateralChange The amount of stETH to add or remove.
    /// @param isCollateralIncrease True if the collateral is being increased, false otherwise.
    /// @param debtChange The amount of R to add or remove.
    /// @param isDebtIncrease True if the debt is being increased, false otherwise.
    /// @param maxFeePercentage The maximum fee percentage to pay for the position management.
    /// @param permitSignature The permit signature for the R token used for position repayment. Ignored in other
    /// cases.
    function managePositionStETH(
        uint256 collateralChange,
        bool isCollateralIncrease,
        uint256 debtChange,
        bool isDebtIncrease,
        uint256 maxFeePercentage,
        ERC20PermitSignature calldata permitSignature
    )
        external;
}

abstract contract PositionManagerDependent is IPositionManagerDependent {
    // --- Immutable variables ---

    address public immutable override positionManager;

    // --- Modifiers ---

    modifier onlyPositionManager() {
        if (msg.sender != positionManager) {
            revert CallerIsNotPositionManager(msg.sender);
        }
        _;
    }

    // --- Constructor ---

    constructor(address positionManager_) {
        if (positionManager_ == address(0)) {
            revert PositionManagerCannotBeZero();
        }
        positionManager = positionManager_;
    }
}

abstract contract WstETHWrapper is IWstETHWrapper {
    IWstETH public immutable override wstETH;
    IStETH public immutable override stETH;

    constructor(IWstETH wstETH_) {
        if (address(wstETH_) == address(0)) {
            revert WstETHAddressCannotBeZero();
        }
        wstETH = wstETH_;
        stETH = IStETH(address(wstETH_.stETH()));

        stETH.approve(address(wstETH), type(uint256).max); // for wrapping
    }

    function wrapETH() internal returns (uint256) {
        uint256 wstETHBalanceBefore = wstETH.balanceOf(address(this));
        (bool sent,) = address(wstETH).call{ value: msg.value }("");
        if (!sent) {
            revert SendingEtherFailed();
        }

        return wstETH.balanceOf(address(this)) - wstETHBalanceBefore;
    }

    function wrapStETH(uint256 stETHAmount) internal returns (uint256) {
        stETH.transferFrom(msg.sender, address(this), stETHAmount);
        return wstETH.wrap(stETHAmount);
    }

    function unwrapStETH(uint256 wstETHAmount) internal {
        stETH.transfer(msg.sender, wstETH.unwrap(wstETHAmount));
    }
}

contract PositionManagerStETH is IPositionManagerStETH, PositionManagerDependent, WstETHWrapper {
    IERC20Indexable private immutable raftDebtToken;
    IRToken private immutable rToken;

    // --- Constructor ---

    constructor(
        address positionManager_,
        IWstETH wstETH_
    )
        PositionManagerDependent(positionManager_)
        WstETHWrapper(wstETH_)
    {
        (, raftDebtToken,,,,,,,,) = IPositionManager(positionManager_).collateralInfo(wstETH);
        rToken = IPositionManager(positionManager_).rToken();
        wstETH.approve(positionManager, type(uint256).max); // for deposits
    }

    // --- Functions ---

    function managePositionETH(
        uint256 debtChange,
        bool isDebtIncrease,
        uint256 maxFeePercentage,
        ERC20PermitSignature calldata permitSignature
    )
        external
        payable
        override
    {
        ERC20PermitSignature memory emptySignature;
        uint256 wstETHAmount = wrapETH();

        if (!isDebtIncrease) {
            _applyPermit(rToken, permitSignature);
            rToken.transferFrom(msg.sender, address(this), debtChange);
        }

        IPositionManager(positionManager).managePosition(
            wstETH, msg.sender, wstETHAmount, true, debtChange, isDebtIncrease, maxFeePercentage, emptySignature
        );
        if (isDebtIncrease) {
            rToken.transfer(msg.sender, debtChange);
        }

        emit ETHPositionChanged(msg.sender, msg.value, debtChange, isDebtIncrease);
    }

    function managePositionStETH(
        uint256 stETHCollateralChange,
        bool isCollateralIncrease,
        uint256 debtChange,
        bool isDebtIncrease,
        uint256 maxFeePercentage,
        ERC20PermitSignature calldata permitSignature
    )
        external
        override
    {
        ERC20PermitSignature memory emptySignature;

        if (!isDebtIncrease) {
            if (debtChange == type(uint256).max) {
                debtChange = raftDebtToken.balanceOf(msg.sender);
            }
            _applyPermit(rToken, permitSignature);
            rToken.transferFrom(msg.sender, address(this), debtChange);
        }

        uint256 wstETHCollateralChange = (isCollateralIncrease && stETHCollateralChange > 0)
            ? wrapStETH(stETHCollateralChange)
            : wstETH.getWstETHByStETH(stETHCollateralChange);

        (wstETHCollateralChange, debtChange) = IPositionManager(positionManager).managePosition(
            wstETH,
            msg.sender,
            wstETHCollateralChange,
            isCollateralIncrease,
            debtChange,
            isDebtIncrease,
            maxFeePercentage,
            emptySignature
        );

        if (!isCollateralIncrease && wstETHCollateralChange > 0) {
            unwrapStETH(wstETHCollateralChange);
        }

        if (isDebtIncrease) {
            rToken.transfer(msg.sender, debtChange);
        }

        emit StETHPositionChanged(msg.sender, stETHCollateralChange, isCollateralIncrease, debtChange, isDebtIncrease);
    }

    function _applyPermit(IERC20Permit token, ERC20PermitSignature calldata permitSignature) internal {
        if (address(permitSignature.token) == address(token)) {
            PermitHelper.applyPermit(permitSignature, msg.sender, address(this));
        }
    }
}

Settings
{
  "remappings": [
    "@balancer-labs/=node_modules/@balancer-labs/",
    "@balancer-labs/v2-interfaces/contracts/=lib/balancer-v2-monorepo/pkg/interfaces/contracts/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@redstone-finance/=node_modules/@redstone-finance/",
    "@smartcontractkit/chainlink/=lib/chainlink/contracts/src/v0.8/",
    "@tempusfinance/=node_modules/@tempusfinance/",
    "@tempusfinance/tempus-utils/contracts/=lib/tempus-utils/contracts/",
    "balancer-v2-monorepo/=lib/balancer-v2-monorepo/",
    "chainlink/=lib/chainlink/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "tempus-utils/=lib/tempus-utils/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200000
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"positionManager_","type":"address"},{"internalType":"contract IWstETH","name":"wstETH_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerIsNotPositionManager","type":"error"},{"inputs":[],"name":"PositionManagerCannotBeZero","type":"error"},{"inputs":[],"name":"SendingEtherFailed","type":"error"},{"inputs":[],"name":"WstETHAddressCannotBeZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"position","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"debtAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDebtIncrease","type":"bool"}],"name":"ETHPositionChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"position","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isCollateralIncrease","type":"bool"},{"indexed":false,"internalType":"uint256","name":"debtAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDebtIncrease","type":"bool"}],"name":"StETHPositionChanged","type":"event"},{"inputs":[{"internalType":"uint256","name":"debtChange","type":"uint256"},{"internalType":"bool","name":"isDebtIncrease","type":"bool"},{"internalType":"uint256","name":"maxFeePercentage","type":"uint256"},{"components":[{"internalType":"contract IERC20Permit","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ERC20PermitSignature","name":"permitSignature","type":"tuple"}],"name":"managePositionETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stETHCollateralChange","type":"uint256"},{"internalType":"bool","name":"isCollateralIncrease","type":"bool"},{"internalType":"uint256","name":"debtChange","type":"uint256"},{"internalType":"bool","name":"isDebtIncrease","type":"bool"},{"internalType":"uint256","name":"maxFeePercentage","type":"uint256"},{"components":[{"internalType":"contract IERC20Permit","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ERC20PermitSignature","name":"permitSignature","type":"tuple"}],"name":"managePositionStETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stETH","outputs":[{"internalType":"contract IStETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wstETH","outputs":[{"internalType":"contract IWstETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

610120604081815234620003da578082620015738038038091620000248285620003df565b833981010312620003da5781516001600160a01b0380821693909190848203620003da5760208091015183811692838203620003da578615620003c9576080528215620003b85760a052835163183fc7c960e31b81528181600481600080975af1908115620003ae57908491849162000369575b5016928360c0528060a05116855163095ea7b360e01b9182825260048201528381604481886000199a8b60248401525af180156200035f5762000323575b5060a0518651631c85f0e760e21b815290831660048201526101409081816024818c5afa9182156200031957869262000293575b505060e05285516320632fb960e11b8152968390889060049082905afa9687156200028957849762000245575b509060448392610100988952858360a05116936080511693895198899586948552600485015260248401525af180156200023b57620001fa575b5050505161113691826200043d83396080518281816102ca015281816109960152610bd7015260a0518281816101ba0152818161022e0152818161061201528181610a3d0152610fd3015260c051828181610155015281816104970152610927015260e0518261086601525181818161039c015281816106cd01528181610c8f0152610d140152f35b82813d831162000233575b620002118183620003df565b8101031262000230575062000226906200042e565b5038808062000171565b80fd5b503d62000205565b84513d84823e3d90fd5b9096508281813d831162000281575b620002608183620003df565b810103126200027d575181811681036200027d5795604462000137565b8380fd5b503d62000254565b86513d86823e3d90fd5b90809250813d831162000311575b620002ad8183620003df565b810103126200030d57620002c18162000419565b50620002cf84820162000419565b90878101518481160362000309576060810151848116036200030957978491620002fe608060049b016200042e565b50918199506200010a565b8580fd5b8480fd5b503d620002a1565b88513d88823e3d90fd5b8381813d831162000357575b6200033b8183620003df565b810103126200030d576200034f906200042e565b5038620000d6565b503d6200032f565b87513d87823e3d90fd5b809250838092503d8311620003a6575b620003858183620003df565b81010312620003a257518381168103620003a25783903862000098565b8280fd5b503d62000379565b85513d85823e3d90fd5b84516307824dbb60e21b8152600490fd5b855163179a321360e11b8152600490fd5b600080fd5b601f909101601f19168101906001600160401b038211908210176200040357604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620003da57565b51908115158203620003da5756fe608060408181526004908136101561001657600080fd5b600092833560e01c9081634aa07e6414610f89575080634e338d5b146109ba578063791b98bc1461094b578063c1fe3e48146108dc5763e7f8f4551461005b57600080fd5b34610815576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261081557813591610096610ff7565b91604435606435928315908115958686036108c65760c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c3601126108c657836100de61108f565b9361068d575b508080610684575b156105cb5784517f23b872dd0000000000000000000000000000000000000000000000000000000081523383820190815230602082810191909152604082018b9052918b9181906060010390838173ffffffffffffffffffffffffffffffffffffffff938186867f0000000000000000000000000000000000000000000000000000000000000000165af1801561057257908492916105ae575b5060248c8a5194859384927fea598cb00000000000000000000000000000000000000000000000000000000084528a8401527f0000000000000000000000000000000000000000000000000000000000000000165af19182156104ef578b9261057c575b5050955b898651977f171672b100000000000000000000000000000000000000000000000000000000895273ffffffffffffffffffffffffffffffffffffffff93847f0000000000000000000000000000000000000000000000000000000000000000169182878c01523360248c015260448b0152159889159788606483015260848201528a60a482015260843560c48201528487511660e482015260a0602097888101516101048401528a81015161012484015260ff6060820151166101448401526080810151610164840152015161018482015288816101a48186897f0000000000000000000000000000000000000000000000000000000000000000165af1998a15610572578391849b610535575b509187959391838c96949061052c575b610408575b505050610356575b50505050825195865285015283015260608201527f8ec6bac52c41abc2cd8ffecf547e7916fa2412325d10243ca4cf318727cda01960803392a280f35b86517fa9059cbb000000000000000000000000000000000000000000000000000000008152339481019485526020850192909252909283919082908c90829060400103927f0000000000000000000000000000000000000000000000000000000000000000165af180156103fe576103d1575b818582610319565b6103f090823d84116103f7575b6103e8818361104e565b8101906110d2565b50386103c9565b503d6103de565b84513d8a823e3d90fd5b6024919294969395508a5194859384927fde0e9a3e0000000000000000000000000000000000000000000000000000000084528a8401525af180156104ef5785908c906104f9575b88517fa9059cbb000000000000000000000000000000000000000000000000000000008152338782019081526020810192909252925082908d90829081906040015b0391877f0000000000000000000000000000000000000000000000000000000000000000165af180156104ef579185939189936104d2575b808d91610311565b6104e890853d87116103f7576103e8818361104e565b50386104ca565b87513d8d823e3d90fd5b5081813d8311610525575b61050e818361104e565b8101031261052157846104929151610450565b8a80fd5b503d610504565b5080151561030c565b61055d9195939b5088969492508a3d8c1161056b575b610555818361104e565b8101906110ea565b9a90919395949092946102fc565b503d61054b565b89513d85823e3d90fd5b90809250813d83116105a7575b610593818361104e565b810103126105a3575138806101ea565b8980fd5b503d610589565b6105c490833d85116103f7576103e8818361104e565b5038610186565b84517fb0e38900000000000000000000000000000000000000000000000000000000008152888382015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa90811561067a578a91610649575b50956101ee565b90506020813d8211610672575b816106636020938361104e565b810103126105a3575138610642565b3d9150610656565b86513d8c823e3d90fd5b508715156100ec565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461081d575b73ffffffffffffffffffffffffffffffffffffffff89817f0000000000000000000000000000000000000000000000000000000000000000169160a4359081168091036108195782811461077c575b505085517f23b872dd0000000000000000000000000000000000000000000000000000000081523384820190815230602082810191909152604082018890529192839182908e90829060600103925af1801561067a57156100e4576107759060203d81116103f7576103e8818361104e565b50386100e4565b610104359060ff821680920361081557803b156108155760e483928a5194859384927fd505accf000000000000000000000000000000000000000000000000000000008452338b85015230602485015260c43560448501528435606485015260848401526101243560a48401526101443560c48401525af180156104ef57610806575b8a90610703565b61080f9061100b565b386107ff565b8280fd5b5080fd5b925083517f70a08231000000000000000000000000000000000000000000000000000000008152338282015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa9081156108d257899161089d575b50926106b4565b90506020813d82116108ca575b816108b76020938361104e565b810103126108c6575138610896565b8880fd5b3d91506108aa565b85513d8b823e3d90fd5b83823461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610819576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b83823461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610819576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b506101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610815578135906109f1610ff7565b9160c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c360112610f8557610a2461108f565b9373ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000000000000000000000000000000000000000000016948451957f70a08231000000000000000000000000000000000000000000000000000000009788885230858901526020986024988a818b81875afa908115610ef6578c91610f58575b508b80808034885af13d15610f53573d67ffffffffffffffff8111610f28578a5190610af9601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168f018361104e565b81528d8d3d92013e5b15610f0057885191825230878301528a828b81875afa918215610ef6578c92610ec3575b508103908111610e9857831598891599610d11575b9060a092918951947f171672b10000000000000000000000000000000000000000000000000000000086528886015233908501526044840152600160648401528660848401528860a484015260443560c48401528481511660e4840152898101516101048401528781015161012484015260ff6060820151166101448401526080810151610164840152015161018482015285816101a4818c877f0000000000000000000000000000000000000000000000000000000000000000165af18015610d0757918893918693610ceb575b50610c49575b505050508151933485528401528201527fd038d081bcdade128ef9513d84a47dd35c9c996c99500213e9fc458252ba2b6360603392a280f35b85517fa9059cbb000000000000000000000000000000000000000000000000000000008152339481019485526020850192909252909283919082908a90829060400103927f0000000000000000000000000000000000000000000000000000000000000000165af18015610ce157610cc4575b848282610c10565b610cda90853d87116103f7576103e8818361104e565b5038610cbc565b83513d88823e3d90fd5b610d0190883d8a1161056b57610555818361104e565b50610c0a565b86513d8b823e3d90fd5b857f0000000000000000000000000000000000000000000000000000000000000000166064358d888216809203610e9557828a8f9392838f968f9514610de1575b5094517f23b872dd0000000000000000000000000000000000000000000000000000000081523391810191825230602083015260408201939093529193849283919082906060015b03925af18015610dd7579060a094939291610dba575b5090919250610b3b565b610dd0908d803d106103f7576103e8818361104e565b5038610db0565b8a513d8f823e3d90fd5b9350935050925060c43560ff811680910361081557813b1561081557829060e48c8f84905195869485937fd505accf0000000000000000000000000000000000000000000000000000000085523390850152308b850152608435604485015260a43560648501526084840152833560a48401526101043560c48401525af18015610e8b57928a8f938e8e94610d9a97610e7c575b5095610d52565b610e859061100b565b38610e75565b8c513d84823e3d90fd5b80fd5b888b6011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9091508a81813d8311610eef575b610edb818361104e565b81010312610eeb57519038610b26565b8b80fd5b503d610ed1565b89513d8e823e3d90fd5b8689517f20061bb4000000000000000000000000000000000000000000000000000000008152fd5b8b8e60418b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b610b02565b90508a81813d8311610f7e575b610f6f818361104e565b81010312610eeb575138610aa6565b503d610f65565b8480fd5b84903461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126108195760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b60243590811515820361100657565b600080fd5b67ffffffffffffffff811161101f57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761101f57604052565b6040519060c0820182811067ffffffffffffffff82111761101f576040528160a06000918281528260208201528260408201528260608201528260808201520152565b90816020910312611006575180151581036110065790565b919082604091031261100657602082519201519056fea2646970667358221220552348f27d0e16332a7653d72ecc0ee9d07d03077f5438ca6d50cfb85588a73864736f6c634300081300330000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0

Deployed Bytecode

0x608060408181526004908136101561001657600080fd5b600092833560e01c9081634aa07e6414610f89575080634e338d5b146109ba578063791b98bc1461094b578063c1fe3e48146108dc5763e7f8f4551461005b57600080fd5b34610815576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261081557813591610096610ff7565b91604435606435928315908115958686036108c65760c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c3601126108c657836100de61108f565b9361068d575b508080610684575b156105cb5784517f23b872dd0000000000000000000000000000000000000000000000000000000081523383820190815230602082810191909152604082018b9052918b9181906060010390838173ffffffffffffffffffffffffffffffffffffffff938186867f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84165af1801561057257908492916105ae575b5060248c8a5194859384927fea598cb00000000000000000000000000000000000000000000000000000000084528a8401527f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0165af19182156104ef578b9261057c575b5050955b898651977f171672b100000000000000000000000000000000000000000000000000000000895273ffffffffffffffffffffffffffffffffffffffff93847f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0169182878c01523360248c015260448b0152159889159788606483015260848201528a60a482015260843560c48201528487511660e482015260a0602097888101516101048401528a81015161012484015260ff6060820151166101448401526080810151610164840152015161018482015288816101a48186897f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc165af1998a15610572578391849b610535575b509187959391838c96949061052c575b610408575b505050610356575b50505050825195865285015283015260608201527f8ec6bac52c41abc2cd8ffecf547e7916fa2412325d10243ca4cf318727cda01960803392a280f35b86517fa9059cbb000000000000000000000000000000000000000000000000000000008152339481019485526020850192909252909283919082908c90829060400103927f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e21165af180156103fe576103d1575b818582610319565b6103f090823d84116103f7575b6103e8818361104e565b8101906110d2565b50386103c9565b503d6103de565b84513d8a823e3d90fd5b6024919294969395508a5194859384927fde0e9a3e0000000000000000000000000000000000000000000000000000000084528a8401525af180156104ef5785908c906104f9575b88517fa9059cbb000000000000000000000000000000000000000000000000000000008152338782019081526020810192909252925082908d90829081906040015b0391877f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84165af180156104ef579185939189936104d2575b808d91610311565b6104e890853d87116103f7576103e8818361104e565b50386104ca565b87513d8d823e3d90fd5b5081813d8311610525575b61050e818361104e565b8101031261052157846104929151610450565b8a80fd5b503d610504565b5080151561030c565b61055d9195939b5088969492508a3d8c1161056b575b610555818361104e565b8101906110ea565b9a90919395949092946102fc565b503d61054b565b89513d85823e3d90fd5b90809250813d83116105a7575b610593818361104e565b810103126105a3575138806101ea565b8980fd5b503d610589565b6105c490833d85116103f7576103e8818361104e565b5038610186565b84517fb0e38900000000000000000000000000000000000000000000000000000000008152888382015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0165afa90811561067a578a91610649575b50956101ee565b90506020813d8211610672575b816106636020938361104e565b810103126105a3575138610642565b3d9150610656565b86513d8c823e3d90fd5b508715156100ec565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461081d575b73ffffffffffffffffffffffffffffffffffffffff89817f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e21169160a4359081168091036108195782811461077c575b505085517f23b872dd0000000000000000000000000000000000000000000000000000000081523384820190815230602082810191909152604082018890529192839182908e90829060600103925af1801561067a57156100e4576107759060203d81116103f7576103e8818361104e565b50386100e4565b610104359060ff821680920361081557803b156108155760e483928a5194859384927fd505accf000000000000000000000000000000000000000000000000000000008452338b85015230602485015260c43560448501528435606485015260848401526101243560a48401526101443560c48401525af180156104ef57610806575b8a90610703565b61080f9061100b565b386107ff565b8280fd5b5080fd5b925083517f70a08231000000000000000000000000000000000000000000000000000000008152338282015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001c1d49d8f601f19d2fa88b14bef491759aaaf5d8165afa9081156108d257899161089d575b50926106b4565b90506020813d82116108ca575b816108b76020938361104e565b810103126108c6575138610896565b8880fd5b3d91506108aa565b85513d8b823e3d90fd5b83823461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610819576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84168152f35b83823461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610819576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc168152f35b506101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610815578135906109f1610ff7565b9160c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c360112610f8557610a2461108f565b9373ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca016948451957f70a08231000000000000000000000000000000000000000000000000000000009788885230858901526020986024988a818b81875afa908115610ef6578c91610f58575b508b80808034885af13d15610f53573d67ffffffffffffffff8111610f28578a5190610af9601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168f018361104e565b81528d8d3d92013e5b15610f0057885191825230878301528a828b81875afa918215610ef6578c92610ec3575b508103908111610e9857831598891599610d11575b9060a092918951947f171672b10000000000000000000000000000000000000000000000000000000086528886015233908501526044840152600160648401528660848401528860a484015260443560c48401528481511660e4840152898101516101048401528781015161012484015260ff6060820151166101448401526080810151610164840152015161018482015285816101a4818c877f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc165af18015610d0757918893918693610ceb575b50610c49575b505050508151933485528401528201527fd038d081bcdade128ef9513d84a47dd35c9c996c99500213e9fc458252ba2b6360603392a280f35b85517fa9059cbb000000000000000000000000000000000000000000000000000000008152339481019485526020850192909252909283919082908a90829060400103927f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e21165af18015610ce157610cc4575b848282610c10565b610cda90853d87116103f7576103e8818361104e565b5038610cbc565b83513d88823e3d90fd5b610d0190883d8a1161056b57610555818361104e565b50610c0a565b86513d8b823e3d90fd5b857f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e21166064358d888216809203610e9557828a8f9392838f968f9514610de1575b5094517f23b872dd0000000000000000000000000000000000000000000000000000000081523391810191825230602083015260408201939093529193849283919082906060015b03925af18015610dd7579060a094939291610dba575b5090919250610b3b565b610dd0908d803d106103f7576103e8818361104e565b5038610db0565b8a513d8f823e3d90fd5b9350935050925060c43560ff811680910361081557813b1561081557829060e48c8f84905195869485937fd505accf0000000000000000000000000000000000000000000000000000000085523390850152308b850152608435604485015260a43560648501526084840152833560a48401526101043560c48401525af18015610e8b57928a8f938e8e94610d9a97610e7c575b5095610d52565b610e859061100b565b38610e75565b8c513d84823e3d90fd5b80fd5b888b6011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9091508a81813d8311610eef575b610edb818361104e565b81010312610eeb57519038610b26565b8b80fd5b503d610ed1565b89513d8e823e3d90fd5b8689517f20061bb4000000000000000000000000000000000000000000000000000000008152fd5b8b8e60418b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b610b02565b90508a81813d8311610f7e575b610f6f818361104e565b81010312610eeb575138610aa6565b503d610f65565b8480fd5b84903461081957817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126108195760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0168152f35b60243590811515820361100657565b600080fd5b67ffffffffffffffff811161101f57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761101f57604052565b6040519060c0820182811067ffffffffffffffff82111761101f576040528160a06000918281528260208201528260408201528260608201528260808201520152565b90816020910312611006575180151581036110065790565b919082604091031261100657602082519201519056fea2646970667358221220552348f27d0e16332a7653d72ecc0ee9d07d03077f5438ca6d50cfb85588a73864736f6c63430008130033

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

0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0

-----Decoded View---------------
Arg [0] : positionManager_ (address): 0x5F59b322eB3e16A0C78846195af1F588b77403FC
Arg [1] : wstETH_ (address): 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc
Arg [1] : 0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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