The whole trade is a single call into the Balancer Vault. Every step below runs inside it, so either the loop closes with the loan repaid, or nothing happens at all.
Quotes getAmountsOut() for WETH ↔ DIA / ZRO on all three routers and picks the widest spread.
Your contract asks the Balancer Vault for 1 WETH and passes the encoded route as userData.
The vault sends the WETH and calls back. Only the vault may call this function.
Decodes the route, buys the token on DEX A, then sells it back to WETH on DEX B.
Returns amount + fee (0 on Balancer) to the vault. Anything left over is profit.
The bot packs the route into raw bytes, and the contract decodes them in assembly. Pick the DEXs and token to see the exact payload it would pass to makeFlashLoan().
- Buy on · 1 B
- Sell on · 1 B
- Token · 20 B
- len(min₁) · 1 B
- len(min₂) · 1 B
- Min token out · 6 B
- Min WETH back · 5 B