> For the complete documentation index, see [llms.txt](https://docs.bextree.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bextree.com/developers/settlement-programs.md).

# Settlement Programs

Three Anchor programs implement custody and settlement on-chain. Their design brief: **know settlements, not auctions.**

## asset-vault

Holds pre-custodied assets (LP position NFTs) from listing time onward.

* Deposit at listing time gates the auction going live.
* Two exits: transfer to buyer via an authorized settlement CPI, or withdrawal back to the seller when a listing ends without sale.
* Settlement CPIs are authorized against `SETTLEMENT_AUTHORITY` — a PDA derived from the settlement program's ID, so only that program's encoded logic can move vaulted assets into a trade.

## settlement

Escrow and execution for pre-custodied trades.

* Buyer deposits winning-bid USDC into program escrow.
* Executes the swap atomically: vaulted asset → buyer, payment minus fee → seller, fee → treasury (destination enforced by compiled-in owner check).

## streamflow-settlement

Escrow, window, and bond handling for post-custodied trades.

* Buyer deposit starts the settlement window.
* Release to seller requires on-chain verification that the Streamflow contract's recipient is now the buyer.
* Window expiry path: full buyer refund plus bond forfeiture, split 70/30 platform/buyer.

## Properties worth auditing against

* Every escrowed deposit has exactly two exit paths — no administrative sweep.
* Fee `bps` is validated (cannot exceed 100%) and snapshotted per settlement.
* No marketplace concepts in program state: a settlement is seller, buyer, asset, amount.

The programs are live on mainnet — see [Program IDs](/security/program-ids.md) for addresses and [Program Registry](/developers/program-registry.md) for verification status.
