Skip to main content
BopAMM router fees let integrators take a share of successful BopAMM output. They are optional: pass 0 when you do not want a fee. Fees apply only when the BopAMM leg succeeds. Fallback output from swapWithFallback is not fee-charged by the BopAMM router.

How fees work

The requested fee is the total fee on gross BopAMM output, in basis points, capped at 1,000 bps. The router applies its configured protocol share to that total fee, sends the remainder to your fee_recipient, and delivers the remaining output to the swap recipient. For example, if the gross BopAMM output is 1,000 units and fee = 25, the total router fee is 2.5 units. A configured protocol share applies to that 2.5, and the rest goes to your fee recipient. The router checks minAmountOut after fees. If you set a fee yourself, calculate your minimum from the post-fee amount.

Pack the router fee

BopAmmRouter takes a single packed uint256 fee argument.

Add a fee to router calldata

When you build swapWithAllowance calldata yourself, pass the packed fee as the final argument.
The same packed FEE argument is used when composing swapWithFallback manually.

Add a fee through /quote

For /quote-generated swapWithFallback calldata, pass fee and fee_recipient as query parameters. The endpoint packs them into tx.data for you.
Quote response buy amounts are net of the total router fee. buyTokens[].minimumAmount already reflects fee plus slippage, and the returned tx.data carries the packed router fee.