> ## 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.

# Introduction

> Coordinated, oracle-priced AMM liquidity from Bebop's market maker network.

<Note>
  You need BopAMM API access to call authenticated endpoints and receive production support.
</Note>

BopAMM (Block Oracle Priced AMM) is Bebop's Ethereum execution primitive: a coordinated, oracle-priced AMM updated by participating market makers and built for best execution at size.

## Contracts

BopAMM now has two Ethereum contracts:

| Contract       | Address                                      | Use                                                                                               |
| -------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `BopAmm`       | `0xB09AAA8933626d7E4C48D65dAd2D77021CFBCA9a` | Core ERC-20 pool for `quote`, push-payment `swap`, and `swapWithCallback`.                        |
| `BopAmmRouter` | `0xB098881c587f623FAC85eAe60809bEE7A174CeE7` | Taker and integrator entrypoint for allowance swaps, native ETH, router fees, and fallback swaps. |

The core `BopAmm` contract is ERC-20 only. Native ETH is supported at the router boundary with the sentinel address `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`.

## Swapping

There are two integration surfaces.

### Direct Pool Integration

Use the core `BopAmm` contract when you are building a router, solver, or contract integration that can manage token movement itself.

```solidity theme={null}
function quote(address tokenIn, address tokenOut, uint256 amountIn)
    external view returns (uint256 amountOut);

function swap(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut,
    address recipient,
    uint256 deadline
) external returns (uint256 amountOut);

function swapWithCallback(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut,
    address recipient,
    uint256 deadline,
    bytes calldata callbackData
) external returns (uint256 amountOut);
```

`swap` is a push-payment entrypoint. The caller must transfer `amountIn` of `tokenIn` to `BopAmm` before calling `swap`, similar to how Uniswap-style pools consume tokens already sent to the pool. `BopAmm` does not pull the taker's input with allowance on this path.

`swapWithCallback` is a flash-style entrypoint. `BopAmm` delivers `tokenOut` first, then calls `msg.sender.bopAmmSwapCallback(...)`; the callback must provide enough `tokenIn` before returning so maker payment can complete.

Direct pool integration does not support native ETH and does not apply router fees.

### Router Integration

Use `BopAmmRouter` for normal taker and integrator flows.

```solidity theme={null}
function swapWithAllowance(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut,
    address recipient,
    uint256 deadline,
    uint256 fee
) external payable returns (uint256 amountOut);

function swapWithFallback(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut,
    address recipient,
    uint256 deadline,
    address adapter,
    bytes calldata adapterData,
    uint256 fee
) external payable returns (uint256 amountOut, bool usedFallback);
```

`swapWithAllowance` pulls ERC-20 input from `msg.sender` after the taker approves the router. For native ETH input, pass the native ETH sentinel as `tokenIn` and send `msg.value == amountIn`. For native ETH output, pass the sentinel as `tokenOut`; the router unwraps WETH and sends ETH to `recipient`.

`swapWithFallback` first tries the BopAMM leg. If that leg reverts or cannot satisfy `minAmountOut` after fees, the router calls an allowlisted fallback adapter with pre-encoded Bebop RFQ calldata. See [Falling back to RFQ](/bopamm/guides/falling-back-to-rfq).

## Fees

`BopAmmRouter` supports integrator fees on successful BopAMM output. The router `fee` argument packs an integrator fee recipient and fee bps into a single `uint256`:

The router charges the total fee before `minAmountOut` is checked. A configured percentage of that fee goes to the protocol, and the rest goes to the integrator recipient. Fallback output is not fee-charged by the BopAMM router.

The `/quote` endpoint accepts `fee` and `fee_recipient`, packs them into the returned `swapWithFallback` calldata, and returns output amounts net of the BopAMM router fee. Custom router integrations can also pack the fee directly in calldata:

```python theme={null}
def pack_router_fee(recipient: str, fee_bps: int) -> int:
    if fee_bps == 0:
        return 0
    if fee_bps > 1_000:
        raise ValueError("BopAMM router fees are capped at 1,000 bps")
    return (fee_bps << 160) | int(Web3.to_checksum_address(recipient), 16)
```

Both router functions accept an optional packed `fee` argument for integrator fees. See [Fees](/bopamm/guides/fees).

## Builder Support

Plain BopAMM settlement should be submitted through a builder that receives BopAMM updates. Current supported builders are:

* Titan
* BuilderNet
* Quasar
* Bombora

`swapWithFallback` can still settle through the fallback path when the BopAMM leg misses.

## API Surface

| Endpoint      | Description                                                                                          |
| ------------- | ---------------------------------------------------------------------------------------------------- |
| `GET /assets` | Public asset metadata: asset ID, token address, tick size, lot size, decimals, and operator address. |
| `GET /state`  | Current aggregated books and state overrides for `eth_call` quoting and simulation.                  |
| `WS /state`   | Binary protobuf stream of the same state snapshots.                                                  |
| `GET /quote`  | Returns a standard Bebop quote response with `BopAmmRouter.swapWithFallback` calldata.               |

<CardGroup cols={3}>
  <Card title="Router quickstart" icon="bolt" href="/bopamm/quickstart">
    Quote, simulate, and submit a `swapWithAllowance` transaction.
  </Card>

  <Card title="Fees" icon="badge-percent" href="/bopamm/guides/fees">
    Add optional integrator fees to BopAMM router swaps.
  </Card>

  <Card title="Request BopAMM access" icon="sparkles" href="https://form.typeform.com/to/cYMBjLQy?utm_source=docs_bopamm_intro&utm_medium=docs&utm_campaign=bopamm_access">
    Get API access and direct support from the Bebop team.
  </Card>
</CardGroup>
