# Adding Routers

Routers handle deposits, withdrawals, and rebalances. They must be whitelisted at the protocol level before they can be used by individual Nodes.

Protocol-level management:

```solidity
function addRouter(address router) external onlyOwner {
    if (router == address(0)) revert ErrorsLib.ZeroAddress();
    routers[router] = true;
    emit EventsLib.RouterAdded(router);
}

function removeRouter(address router) external onlyOwner {
    if (!routers[router]) revert ErrorsLib.NotWhitelisted();
    delete routers[router];
    emit EventsLib.RouterRemoved(router);
}
```

Node-level management:

```solidity
function addRouter(address router) external onlyOwner {
    if (router == address(0)) revert ErrorsLib.ZeroAddress();
    if (!protocol.isRouterWhitelisted(router)) revert ErrorsLib.NotWhitelisted();
    if (routers[router]) revert ErrorsLib.AlreadySet();
    routers[router] = true;
    emit EventsLib.RouterAdded(router);
}

function removeRouter(address router) external onlyOwner {
    if (!routers[router]) revert ErrorsLib.NotWhitelisted();
    delete routers[router];
    emit EventsLib.RouterRemoved(router);
}
```

Constraints:

* Only protocol owner can whitelist/remove routers
* Nodes can only use routers whitelisted at a protocol level
* Nodes can have multiple active routers
* Cannot add same router twice to a Node
* Cannot remove a router that's not added to the Node

### Removing a Router

When removing a Router contract that had previously been used to manage integrations with a specific component ALWAYS update the `componentAllocation` to the new router address. Otherwise functionality such as the calculating component assets will not work correctly, and will prevent rebalancing and user withdrawals.

### Governance & Whitelisting

NashPoint implements a multi-tiered permissioning system to protect Nodes from misconfiguration or malicious components. Each router and component must be approved at protocol, router, and node levels before use.

[Adding Routers and Components - Step by Step Guide](/nashpoint/adding-routers-and-components-step-by-step-guide.md)


---

# 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://nashpoint.gitbook.io/nashpoint/upgrading-a-node/adding-routers.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.
