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

# Settlement & Smart Contracts

> Bebop's on-chain settlement architecture - contracts, approvals, and how trades are executed.

All Bebop trades settle on-chain through audited smart contracts. Bebop never takes custody of user funds - the settlement contracts verify signatures, enforce price minimums, and atomically transfer tokens between parties.

## Settlement Architecture

Bebop uses separate contract systems for each API:

### RFQ API

The RFQ API can use the router or the settlement contract. The route and integration determine the contract:

| Contract | Address | Purpose |
| - | - | - |
| BebopRouter | `0xBeb0009ACa35087ce7cCF11637E24dd1Aad3bf2A` | Routes eligible RFQ trades |
| BebopSettlement | `0xbbbbbBB520d69a9775E85b458C58c648259FAD5F` | Settles RFQ trades directly |

An EVM one-to-one quote can target either contract. Always use `approvalTarget`, `settlementAddress`, and `tx.to` from the quote response.

### Aggregation API

The Aggregation API uses a two-contract architecture:

| Contract | Address | Purpose |
| - | - | - |
| Balance Manager (`approvalTarget`) | `0xC5a350853E4e36b73EB0C24aaA4b8816C9A3579a` | Holds token approvals and manages taker balances during settlement |
| JamSettlement (`settlementAddress`) | `0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6` | Executes the swap - verifies signatures, enforces minimums, transfers tokens |

<Danger>
  These are two distinct contracts. Takers must approve the **balance manager**, not the settlement contract. The quote response handles this for you via the `approvalTarget` field - see [Token Approvals](/core-concepts/token-approvals) for the full flow.
</Danger>

### Chain-Specific Addresses

The addresses above apply to all supported EVM chains except zkSync Era (chain ID 324), which uses different contract addresses. Always use the values from the quote response rather than hardcoding.

See [Supported Chains](/supported-chains) for the full list of networks.

## How Settlement Works

### RFQ and Aggregation transactions

For EVM, a quote includes the complete settlement transaction in `tx`. For Solana, an RFQ quote includes `solana_tx` and `blockhash`.

You sign and broadcast the returned transaction. The applicable settlement program checks the trade terms and transfers the tokens atomically.

If any condition fails, the entire transaction reverts - no partial state changes, no stuck funds, the contracts enforce the same guarantees and Bebop never takes custody of your tokens.

## Approvals

Token approvals target the `approvalTarget` address from the quote response. The general pattern is the same across both APIs - see [Token Approvals](/core-concepts/token-approvals) for the full check-and-approve flow.

| Approval type | Use |
| - | - |
| `Standard` | Public RFQ and Aggregation transactions |

For direct EVM trades, call ERC-20 `approve()` before you broadcast the settlement transaction.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.