# Reserve Management

## Node Reserve Management

### Overview

Each Node maintains a reserve of its underlying asset (e.g., USDC) to:

* Process user withdrawals without incurring cost or slippage to interact with component protocols
* Enable efficient rebalancing as excess reserve is allocated to underlying components per the strategy timing and percentage allocations.
* Pay protocol and management fees

### Reserve Configuration

```solidity
function updateTargetReserveRatio(uint64 targetReserveRatio_) 
external onlyOwner onlyWhenNotRebalancing
```

Important:

* Must be less than 100% (1e18)
* Combined with component allocations must total 100% or `startRebalance()`will revert
* Cannot update during rebalance window

## Reserve Mechanics

### Asset Requirements

* The Reserve asset is Node's underlying `node.asset()`per ERC-4626 specifications
* All node components must use same underlying asset as the reserve asset

### Reserve Calculations

#### Pending Redemptions

When using a value for the reserve in calculations, the Node and all other protocol contracts will first subtract the asset value of any Node shares that are pending redemptions.&#x20;

```solidity
function getCashAfterRedemptions() public view returns (uint256) {
    uint256 balance = IERC20(asset).balanceOf(address(this));
    uint256 exitingAssets = convertToAssets(sharesExiting);
    return balance >= exitingAssets ? balance - exitingAssets : 0;
}
```

#### Claimable Redemptions

When an redeemRequest is made claimable for users the value of the redemption is transferred to the Escrow contract and is no longer calculated as part of the reserve

## Impact on Operations

#### Rebalancing

* Router's `invest()` function will revert if Node's reserve is below `targetReserveRatio`
* Each investment attempt checks current reserve against target before proceeding
* When components are liquidated, assets return to reserve for redemptions or reinvestment

#### Fee Payment

* Management fees are deducted from reserve and split between Node owner and protocol
* Protocol execution fee is taken from reserve before each component investment
* Both fee types will revert if reserve balance insufficient to pay full amount

#### Redemptions

* Rebalancer attempts to fulfill redemptions from reserve first
* If reserve insufficient, liquidate funds from components and fulfill redemptions
