0xBeb0009ACa35087ce7cCF11637E24dd1Aad3bf2A contract, which now wraps BebopSettlement extending its functionality.
Do you need to migrate?
WithStandard approvals, no changes are required if your integration already reads these fields from the quote response. Confirm both:
- Approvals. You approve the
approvalTargetfrom the quote response, not a hardcoded address. See Token approvals. - Broadcast. You send the returned
txobject as-is;tx.toalready targets the correct contract.
approvalTarget and tx from the quote response.
Reading the calldata
WithStandard approvals, Bebop returns calldata ready to broadcast in tx.data. It calls the router’s swap function:
For a concrete reference, see this example transaction.
Permit2 self-execution
BebopRouter supports Permit2 self-execution for ERC-20 sell tokens.1
Request a quote
Add
gasless=false&approval_type=Permit2 to your quote request. Set taker_address to the user who owns the tokens, not your wrapper contract.2
Approve Permit2
If needed, approve
quote.approvalTarget on the sell token for at least quote.toSign.permitted.amount. For this flow, approvalTarget is the Permit2 contract.3
Sign the permit
Have the taker sign
quote.toSign as the EIP-712 message using the Permit2 witness types.
Use the domain { name: "Permit2", chainId: quote.chainId, verifyingContract: quote.approvalTarget } without a version.
Keep spender as returned: it is BebopRouter, not your wrapper.4
Add the signature and submit
The returned Simulate the completed transaction before submission. Then broadcast the updated
tx.data calls settle with an empty userSignature.
With an ethers v6 Interface for BebopRouter, replace that final argument:quote.tx, or call quote.tx.to from your wrapper with the updated calldata.