feat(tycho-execution): add BopAMM executor and swap encoder#1087
Closed
tvinagre wants to merge 1 commit into
Closed
feat(tycho-execution): add BopAMM executor and swap encoder#1087tvinagre wants to merge 1 commit into
tvinagre wants to merge 1 commit into
Conversation
BopAMM (Bebop's on-chain PMM) settles swaps through the BopAmmV2 contract, which debits tokenIn from the caller via allowance and sends output to the recipient param. The executor is ProtocolWillDebit with the settlement as approval target; protocol data is the packed (tokenIn, tokenOut) pair and the book follows from it. The protocol-level minAmountOut is 0 (the router enforces the user's minimum and the Dispatcher measures output via balance diff) and expiry is block.timestamp: BopAMM quotes are only valid in the block whose timestamp equals the book's committed registry update, so fork tests pin block 25266710 (a quote-commit block) and fund the maker wallet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Execution support for BopAMM (Bebop's on-chain PMM):
BopAMMExecutor.sol,BopAMMSwapEncoder(vm:bopamm), config entries, and tests — same structure as the FermiSwap execution files in #1034.ProtocolWillDebit— the TransferManager pulls tokenIn to the router and approves the BopAmmV2 settlement (0xdB13ad0fcD134E9c48f2fDaEa8f6751a0F5349ca), which debits via allowance and sends output to therecipientparam (outputToRouter = false).swap()callssettlement.swap(tokenIn, tokenOut, amountIn, 0, block.timestamp, receiver); protocol-levelminAmountOutis 0 because the router enforces the user's minimum and the Dispatcher measures output via balance diff. No callbacks.(tokenIn, tokenOut)— 40 bytes; the settlement is an executor immutable and the traded book follows from the token pair. Ethereum-only.Constants.sol,TychoRouterTestSetup.sol(executors 21→22),test_executor_addresses.json,deploy-executors.js.Timestamp gate
BopAMM swaps only succeed in a block whose timestamp equals the book's committed registry update (
StaleUpdate()otherwise — on-chain takers need builder bundles). Fork tests pin block 25266710 (a quote-commit block for the WETH/USDC book) and fund the maker wallet, since the venue's quote caps at the committed lane size while settlement transfers come from the maker's inventory.Testing
test_single_encoding_strategy_bopamm_weth_usdc;clippy -D warningsand fmt clean.singleSwapintegration test, all passing on a mainnet fork. Pre-existingTychoRouterSingleSwapsuites re-run green (19/19).Note for whoever merges second (#1034 or this)
Both PRs append the 22nd executor to the deterministic test deployment sequence, so both predict the test executor address
0xe8dc788818033232EF9772CB2e6622F1Ec8bc840. The PR that lands second must re-derive itstest_executor_addresses.jsonentry (the executor moves to position 23) and regeneratecalldata.txt.Related: #1081 (substreams), #1082 (simulation adapter).
🤖 Generated with Claude Code