# IPSMRouter

## Functions

### psm

```solidity
function psm() external returns (contract IPegStabilityModule)
```

reference to the PegStabilityModule that this router interacts with

### chi

```solidity
function chi() external returns (contract IChi)
```

reference to the CHI contract used.

### getMintAmountOut

```solidity
function getMintAmountOut(
    uint256 amountIn
) external returns (uint256 amountChiOut)
```

calculate the amount of CHI out for a given `amountIn` of underlying

#### Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| `amountIn` | uint256 |             |

### getRedeemAmountOut

```solidity
function getRedeemAmountOut(
    uint256 amountChiIn
) external returns (uint256 amountOut)
```

calculate the amount of underlying out for a given `amountChiIn` of CHI

#### Parameters

| Name          | Type    | Description |
| ------------- | ------- | ----------- |
| `amountChiIn` | uint256 |             |

### getMaxMintAmountOut

```solidity
function getMaxMintAmountOut() external returns (uint256)
```

the maximum mint amount out

### getMaxRedeemAmountOut

```solidity
function getMaxRedeemAmountOut() external returns (uint256)
```

the maximum redeem amount out

### mint

```solidity
function mint(
    address _to,
    uint256 _minAmountOut,
    uint256 ethAmountIn
) external returns (uint256)
```

Mints chi to the given address, with a minimum amount required

This wraps ETH and then calls into the PSM to mint the chi. We return the amount of chi minted.

#### Parameters

| Name            | Type    | Description                       |
| --------------- | ------- | --------------------------------- |
| `_to`           | address | The address to mint chi to        |
| `_minAmountOut` | uint256 | The minimum amount of chi to mint |
| `ethAmountIn`   | uint256 |                                   |

### redeem

```solidity
function redeem(
    address to,
    uint256 amountChiIn,
    uint256 minAmountOut
) external returns (uint256 amountOut)
```

Redeems chi for ETH First pull user CHI into this contract Then call redeem on the PSM to turn the CHI into weth Withdraw all weth to eth in the router Send the eth to the specified recipient

#### Parameters

| Name           | Type    | Description                           |
| -------------- | ------- | ------------------------------------- |
| `to`           | address | the address to receive the eth        |
| `amountChiIn`  | uint256 | the amount of CHI to redeem           |
| `minAmountOut` | uint256 | the minimum amount of weth to receive |
