> ## Documentation Index
> Fetch the complete documentation index at: https://docs.berachain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Public Allocator

> Just-in-time liquidity reallocation between Bend markets; how borrowers get liquidity from multiple vault markets.

Isolated markets in Morpho/Bend contain risk but can **fragment liquidity** across many pools. You might want to borrow from a market that doesn't have enough supply. The **Public Allocator** fixes this: it reallocates a vault's assets between markets on demand so your borrow can succeed.

The Public Allocator is a smart contract that routes liquidity and moves assets between markets when a borrow needs them.

<Note>The Vault Owner must whitelist the Public Allocator contract for it to operate.</Note>

## Overview

The Public Allocator is callable by anyone. It can move a vault's idle or underused supply into the market where a borrower needs liquidity, at the time of the borrow. For you as a borrower, many small pools behave like one deep pool, with isolated risk preserved.

## Borrower flow

Example: you want to borrow 1,000 WETH from the wstETH/WETH market, but that market only has 200 WETH.

1. **Borrow request**: You (or your app) initiate the borrow. The system sees a 800 WETH shortfall.
2. **Allocator runs**: The Public Allocator is called. It finds 800 WETH in other markets where the same vault has supply (e.g. idle or an underused rETH/WETH market).
3. **Reallocate**: The Allocator runs `reallocate`, moving 800 WETH into the wstETH/WETH market.
4. **Borrow**: The market now has 1,000 WETH; your borrow completes.

With a **Bundler**, reallocation and borrow happen in **one transaction**. You get deep liquidity in a single step.

## Curator controls: flow caps

Curators limit how much the Public Allocator can move:

* **maxIn**: Max assets the Allocator can move **into** a market.
* **maxOut**: Max assets it can move **out of** a market.

So liquidity stays flexible but within the vault's risk parameters.
