> For the complete documentation index, see [llms.txt](https://docs.ionprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionprotocol.io/devs/smart-contract-architecture/flash/lst/ethxhandler.md).

# EthXHandler

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

**Inherits:** UniswapFlashloanBalancerSwapHandler, UniswapFlashswapHandler, BalancerFlashloanDirectMintHandler

Handler for the ETHx collateral.

### [State Variables](broken://pages/Oi4RbFOEG60SbEtglfdT) <a href="#state-variables" id="state-variables"></a>

#### [STADER\_DEPOSIT](broken://pages/Oi4RbFOEG60SbEtglfdT) <a href="#stader_deposit" id="stader_deposit"></a>

```
IStaderStakePoolsManager public immutable STADER_DEPOSIT;
```

### [Functions](broken://pages/Oi4RbFOEG60SbEtglfdT) <a href="#functions" id="functions"></a>

#### [constructor](broken://pages/Oi4RbFOEG60SbEtglfdT) <a href="#constructor" id="constructor"></a>

Creates a new `EthXHandler` instance.

```
constructor(
    uint8 _ilkIndex,
    IonPool _ionPool,
    GemJoin _gemJoin,
    IStaderStakePoolsManager _staderDeposit,
    Whitelist _whitelist,
    IUniswapV3Pool _wstEthUniswapPool,
    IUniswapV3Pool _ethXUniswapPool,
    bytes32 _balancerPoolId
)
    UniswapFlashloanBalancerSwapHandler(_wstEthUniswapPool, _balancerPoolId)
    IonHandlerBase(_ilkIndex, _ionPool, _gemJoin, _whitelist)
    UniswapFlashswapHandler(_ethXUniswapPool, false);
```

**Parameters**

| Name                 | Type                       | Description                                      |
| -------------------- | -------------------------- | ------------------------------------------------ |
| `_ilkIndex`          | `uint8`                    | of ETHx.                                         |
| `_ionPool`           | `IonPool`                  | `IonPool` contract address.                      |
| `_gemJoin`           | `GemJoin`                  | `GemJoin` contract address associated with ETHx. |
| `_staderDeposit`     | `IStaderStakePoolsManager` | Address for the Stader deposit contract.         |
| `_whitelist`         | `Whitelist`                | Address of the `Whitelist` contract.             |
| `_wstEthUniswapPool` | `IUniswapV3Pool`           | Address of the WSTETH/ETH Uniswap V3 pool.       |
| `_ethXUniswapPool`   | `IUniswapV3Pool`           | Address of the ETHx/ETH Uniswap V3 pool.         |
| `_balancerPoolId`    | `bytes32`                  | Balancer pool ID for the ETHx/ETH pool.          |

#### [\_depositWethForLst](broken://pages/Oi4RbFOEG60SbEtglfdT) <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](broken://pages/Oi4RbFOEG60SbEtglfdT) <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] |
