# Non-Custodial Architecture

Yieldbay never takes custody of user assets.\
Instead, all deposits and withdrawals flow directly through **Cross-Program Invocations (CPI)** to trusted partner vaults like **Meteora**, **Kamino**, and **Jito**.

Each integrated vault implements a standardized **Vault Adapter Interface (VIS)** that defines three essential functions:

```
pub trait VaultAdapter {
    fn deposit(&self, amount: u64, user: Pubkey) -> Result<()>;
    fn withdraw(&self, shares: u64, user: Pubkey) -> Result<()>;
    fn query_yield(&self) -> YieldMetrics;
}
```

When a routing batch executes, the **Router Executor** coordinates CPI calls to multiple vaults atomically.\
After completion, authority is released back to the vault programs — ensuring no intermediate contract can retain control.

Users can always withdraw directly from the underlying protocol by proving ownership of their vault shares, without relying on Yieldbay’s routing engine.

> ⚙️ *This guarantees complete composability and eliminates systemic custody risk.*
