# Managing Rebalancers

### Managing Rebalancers

Rebalancers must first be whitelisted at the protocol level before they can be added to individual Nodes.

#### Protocol Level

```solidity
// Protocol owner whitelists rebalancer
registry.setRegistryType(rebalancerAddress, RegistryType.REBALANCER, true);
```

#### Node Level

```solidity
// Add rebalancer to Node
function addRebalancer(address newRebalancer) external onlyOwner {
    if (isRebalancer[newRebalancer]) revert ErrorsLib.AlreadySet();
    if (!registry.isRegistryType(newRebalancer, RegistryType.REBALANCER)) {
        revert ErrorsLib.NotWhitelisted();
    }
    isRebalancer[newRebalancer] = true;
}

// Remove rebalancer from Node
function removeRebalancer(address oldRebalancer) external onlyOwner {
    if (!isRebalancer[oldRebalancer]) revert ErrorsLib.NotSet();
    isRebalancer[oldRebalancer] = false;
}
```

#### Constraints

* Only Node owner can add/remove rebalancers
* Cannot add zero address
* Cannot add already-set rebalancer
* Cannot add non-whitelisted rebalancer
* Cannot remove non-existent rebalancer

#### Important Notes

* A Node without any rebalancers cannot execute rebalances or fulfill redemptions
* Best practice: Maintain at least one active rebalancer at all times
* Removing all rebalancers will not affect existing positions but will prevent:
  * Starting new rebalances
  * Fulfilling redemption requests
  * Investing in or liquidating from components
