# WstEthHandler

[Git Source](https://github.com/Ion-Protocol/ion-protocol/blob/88cc595825f1dc2eb738fb93e172a3e8ab7a5c43/src/flash/lst/WstEthHandler.sol)

**Inherits:** UniswapFlashswapHandler, BalancerFlashloanDirectMintHandler

Handler for the wstETH collateral.

### [State Variables](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#state-variables" id="state-variables"></a>

#### [STETH](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#steth" id="steth"></a>

```
IERC20 constant STETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
```

### [Functions](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#functions" id="functions"></a>

#### [constructor](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#constructor" id="constructor"></a>

Creates a new `WstEthHandler` instance.

```
constructor(
    uint8 _ilkIndex,
    IonPool _ionPool,
    GemJoin _gemJoin,
    Whitelist _whitelist,
    IUniswapV3Pool _wstEthUniswapPool
)
    IonHandlerBase(_ilkIndex, _ionPool, _gemJoin, _whitelist)
    UniswapFlashswapHandler(_wstEthUniswapPool, false);
```

**Parameters**

| Name                 | Type             | Description                                        |
| -------------------- | ---------------- | -------------------------------------------------- |
| `_ilkIndex`          | `uint8`          | of wstETH.                                         |
| `_ionPool`           | `IonPool`        | `IonPool` contract address.                        |
| `_gemJoin`           | `GemJoin`        | `GemJoin` contract address associated with wstETH. |
| `_whitelist`         | `Whitelist`      | Address of the `Whitelist` contract.               |
| `_wstEthUniswapPool` | `IUniswapV3Pool` | Address of the wstETH/ETH Uniswap V3 pool.         |

#### [\_depositWethForLst](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#depositwethforlst" id="depositwethforlst"></a>

Unwraps weth into eth and deposits into lst contract.

*Unwraps weth into eth and deposits into lst contract.*

```
function _depositWethForLst(uint256 amountWeth) internal override returns (uint256);
```

**Parameters**

| Name         | Type      | Description                        |
| ------------ | --------- | ---------------------------------- |
| `amountWeth` | `uint256` | The WETH amount to deposit. \[WAD] |

**Returns**

| Name     | Type      | Description                    |
| -------- | --------- | ------------------------------ |
| `<none>` | `uint256` | Amount of lst received. \[WAD] |

#### [\_getEthAmountInForLstAmountOut](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#getethamountinforlstamountout" id="getethamountinforlstamountout"></a>

Calculates the amount of eth required to receive `amountLst`.

*Calculates the amount of eth required to receive `amountLst`.*

```
function _getEthAmountInForLstAmountOut(uint256 amountLst) internal view override returns (uint256);
```

**Parameters**

| Name        | Type      | Description                   |
| ----------- | --------- | ----------------------------- |
| `amountLst` | `uint256` | Desired output amount. \[WAD] |

**Returns**

| Name     | Type      | Description                                 |
| -------- | --------- | ------------------------------------------- |
| `<none>` | `uint256` | Eth required for desired lst output. \[WAD] |

#### [zapDepositAndBorrow](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#zapdepositandborrow" id="zapdepositandborrow"></a>

```
function zapDepositAndBorrow(
    uint256 stEthAmount,
    uint256 amountToBorrow,
    bytes32[] calldata proof
)
    external
    onlyWhitelistedBorrowers(proof);
```

#### [zapFlashLeverageCollateral](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#zapflashleveragecollateral" id="zapflashleveragecollateral"></a>

```
function zapFlashLeverageCollateral(
    uint256 initialDeposit,
    uint256 resultingAdditionalStEthCollateral,
    uint256 maxResultingAdditionalDebt,
    bytes32[] calldata proof
)
    external
    onlyWhitelistedBorrowers(proof);
```

#### [zapFlashLeverageWeth](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#zapflashleverageweth" id="zapflashleverageweth"></a>

```
function zapFlashLeverageWeth(
    uint256 initialDeposit,
    uint256 resultingAdditionalStEthCollateral,
    uint256 maxResultingAdditionalDebt,
    bytes32[] calldata proof
)
    external
    onlyWhitelistedBorrowers(proof);
```

#### [zapFlashswapLeverage](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/broken-reference) <a href="#zapflashswapleverage" id="zapflashswapleverage"></a>

```
function zapFlashswapLeverage(
    uint256 initialDeposit,
    uint256 resultingAdditionalStEthCollateral,
    uint256 maxResultingAdditionalDebt,
    uint160 sqrtPriceLimitX96,
    uint256 deadline,
    bytes32[] calldata proof
)
    external
    checkDeadline(deadline)
    onlyWhitelistedBorrowers(proof);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/wstethhandler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
