# Rebase Controller

`RebaseController` is responsible for initiating rebases to distribute rewards in the `StakingPool` and handling emergency pausing and reopening of the pool. It acts as a security and automation layer, ensuring that rewards are updated regularly and that the pool can be paused or reopened in response to detected losses or emergencies.

## View Functions

### stakingPool

Returns the address of the staking pool.

```solidity
function stakingPool() external view returns (address)
```

#### Return Values

| Name        | Type    | Description             |
| ----------- | ------- | ----------------------- |
| stakingPool | address | Address of staking pool |

### priorityPool

Returns the address of the priority pool.

```solidity
function priorityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| priorityPool | address | Address of priority pool |

### securityPool

Returns the address of the security pool.

```solidity
function securityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| securityPool | address | Address of security pool |

### emergencyPauser

Returns the address authorized to pause the pool in case of emergency.

```solidity
function emergencyPauser() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| emergencyPauser | address | Address of emergency pauser |

### rewardsUpdater

Returns the address authorized to update rewards.

```solidity
function rewardsUpdater() external view returns (address)
```

#### Return Values

| Name           | Type    | Description                |
| -------------- | ------- | -------------------------- |
| rewardsUpdater | address | Address of rewards updater |

### checkUpkeep

Checks if a loss has been detected in any strategy.

```solidity
function checkUpkeep(bytes calldata) external view returns (bool upkeepNeeded, bytes memory performData)
```

#### Return Values

| Name         | Type  | Description                                    |
| ------------ | ----- | ---------------------------------------------- |
| upkeepNeeded | bool  | True if a loss is detected in any strategy     |
| performData  | bytes | Encoded index of strategy with a loss (if any) |

## Write Functions

### updateRewards

Updates strategy rewards in the staking pool.

```solidity
function updateRewards(bytes calldata _data) external
```

#### Parameters

| Name   | Type  | Description                        |
| ------ | ----- | ---------------------------------- |
| \_data | bytes | Encoded data to pass to strategies |

### performUpkeep

Pauses the priority pool if a loss has been detected in a strategy.

```solidity
function performUpkeep(bytes calldata _performData) external
```

#### Parameters

| Name          | Type  | Description                           |
| ------------- | ----- | ------------------------------------- |
| \_performData | bytes | Encoded index of strategy with a loss |

### pausePool

Pauses the priority pool in the case of an emergency.

```solidity
function pausePool() external
```

*No parameters.*

### reopenPool

Reopens the priority pool and security pool after they were paused due to a loss, and updates strategy rewards.

```solidity
function reopenPool(bytes calldata _data) external
```

#### Parameters

| Name   | Type  | Description                        |
| ------ | ----- | ---------------------------------- |
| \_data | bytes | Encoded data to pass to strategies |

### setEmergencyPauser

Sets the address authorized to pause the pool in case of emergency.

```solidity
function setEmergencyPauser(address _emergencyPauser) external
```

#### Parameters

| Name              | Type    | Description                 |
| ----------------- | ------- | --------------------------- |
| \_emergencyPauser | address | Address of emergency pauser |

### setRewardsUpdater

Sets the address authorized to update rewards.

```solidity
function setRewardsUpdater(address _rewardsUpdater) external
```

#### Parameters

| Name             | Type    | Description                |
| ---------------- | ------- | -------------------------- |
| \_rewardsUpdater | address | Address of rewards updater |


---

# 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.stake.link/core-staking-contracts/rebasecontroller.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.
