# UnstakePool

## Contents

## Globals

| Var           | Type                        |
| ------------- | --------------------------- |
| balanceOf     | mapping(address => uint256) |
| totalSupplyOf | mapping(address => uint256) |

## Functions

### constructor

No description

**Declaration:**

```solidity
  function constructor(
  ) public Only
```

**Modifiers:**

| Modifier |
| -------- |
| Only     |

### deposit

Deposit REI to `UnstakePool`, only can be called by stake manager, this will be called when user starts unstake.

**Declaration:**

```solidity
  function deposit(
    address validator
  ) external nonReentrant onlyStakeManager returns (uint256 shares)
```

**Modifiers:**

| Modifier         |
| ---------------- |
| nonReentrant     |
| onlyStakeManager |

**Args:**

| Arg         | Type    | Description        |
| ----------- | ------- | ------------------ |
| `validator` | address | Validator address. |

### withdraw

Withdraw REI and burn shares, only can be called by stake manager, this will be called when unstake timeout.

**Declaration:**

```solidity
  function withdraw(
    address validator,
    uint256 shares,
    address payable to
  ) external nonReentrant onlyStakeManager returns (uint256 amount)
```

**Modifiers:**

| Modifier         |
| ---------------- |
| nonReentrant     |
| onlyStakeManager |

**Args:**

| Arg         | Type            | Description                                                           |
| ----------- | --------------- | --------------------------------------------------------------------- |
| `validator` | address         | Validator address.                                                    |
| `shares`    | uint256         | Number of shares.                                                     |
| `to`        | address payable | REI receiver address(this value is set when the user starts unstake). |

### slash

Slash validator and transfer the slashed amount to `address(0)`.

**Declaration:**

```solidity
  function slash(
    address validator,
    uint8 factor
  ) external nonReentrant onlyStakeManager returns (uint256 amount)
```

**Modifiers:**

| Modifier         |
| ---------------- |
| nonReentrant     |
| onlyStakeManager |

**Args:**

| Arg         | Type    | Description        |
| ----------- | ------- | ------------------ |
| `validator` | address | Validator address. |
| `factor`    | uint8   | Slash factor.      |
