> For the complete documentation index, see [llms.txt](https://nashpoint.gitbook.io/nashpoint/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nashpoint.gitbook.io/nashpoint/upgrading-a-node/adding-routers.md).

# 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)
