# Adding & Removing Components

Components are the vaults and strategies where a Node deploys assets. Each component must be validated and whitelisted before being added to a Node. This section covers the complete lifecycle of component management, from addition and configuration to removal.

### Adding Components

```solidity
function addComponent(
    address component,
    uint64 targetWeight,
    uint64 maxDelta,
    address router
) external onlyOwner onlyWhenNotRebalancing
```

#### Security Checks

1. Component must:
   * Not be zero address
   * Not already be a component
   * Have same underlying asset as Node
   * Be whitelisted in specified Router
2. Router must:
   * Be whitelisted in Node
   * Be whitelisted in Registry
3. Timing:
   * Cannot add during rebalance window

#### Example Usage

```solidity
// As Node owner
node.addComponent(
    vaultAddress,      // ERC4626 or ERC7540 vault
    0.4e18,           // 40% target allocation
    0.05e18,          // 5% maximum deviation
    router4626Address  // Router for this component type
);
```

### Removing Components

```solidity
function removeComponent(
    address component,
    bool force
) external onlyOwner onlyWhenNotRebalancing
```

#### Security Checks

1. Component must:
   * Be registered component
   * Have zero balance (unless force=true)
2. Timing:
   * Cannot remove during rebalance window

#### Best Practices

1. Update allocation to zero first:

```solidity
node.updateComponentAllocation(
    component,
    0,              // zero target weight
    0,              // zero max delta
    routerAddress
);
```

2. Wait for rebalancer to exit position
3. Remove component:

```solidity
node.removeComponent(component, false);
```

### Component Validation

Components and their allocations must:

* Sum to 100% (1e18) with reserve ratio
* Use whitelisted routers
* Match Node's underlying asset
* Be whitelisted in their respective routers

These checks are enforced during:

* Component addition
* Allocation updates
* Rebalance initiation

### 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](https://nashpoint.gitbook.io/nashpoint/adding-routers-and-components-step-by-step-guide)

## Emergency Removal

A faulty component may prevent proper operations of a node. For example, an address that is no longer returning standard read values will prevent `totalAssets` calculation. In this situation a Node Owner can use the `force` boolean to remove a component, without having to rebalance out of the component position.

As a safeguard against malicious Node Owners. This can only be accomplished for components that have been [blacklisted](https://nashpoint.gitbook.io/nashpoint/blacklisting-a-component) on their respective router contract.

&#x20;
