Batch Transactions
Batch transactions on Euler let you combine multiple actions—like supplying, borrowing, swapping, and more—into a single, atomic blockchain transaction. This feature streamlines complex operations, saves on gas fees, and together with the simulation feature, provides a safer, more predictable user experience.
What are Batch Transactions?
Instead of sending separate transactions for each action (e.g., one to supply collateral, another to borrow), batch transactions let you bundle several operations together and submit them as a single transaction. This is especially useful for advanced strategies like Multiply, but can benefit any user looking to optimize their workflow.
Common Actions You Can Batch
- Supplying assets
- Borrowing assets
- Withdrawing assets
- Repaying debt
- Swapping tokens (often required for Multiply/Strategy loops)
Why Use Batch Transactions?
Batching offers several advantages:
- Gas Savings: Executing multiple operations in one transaction is usually much cheaper than doing each separately.
- Atomicity: All actions in a batch either succeed together or fail together—no partial execution.
- Convenience: Simplifies complex operations, like opening a leveraged Multiply position, into a single step.
- Simulation: Preview the outcome of all batched actions before sending the transaction on-chain.
How Batch Transactions Work in the Euler App
The Euler app provides an explicit batching interface, often visible as a "Batch" panel or cart on the right side of the screen when managing positions.
Using the Batch Cart
- Adding Actions: Instead of executing immediately, actions like supplying, borrowing, or setting up a multiply loop can be added to the batch cart using an "Add to batch" button.
- Viewing the Batch Cart: The Batch panel displays the sequence of actions you've queued (e.g., Supply USDC, Borrow WETH, Swap WETH for USDC).
- Simulation:
- Use the "Simulate transactions" toggle in the Batch panel to preview the combined effect of all actions before sending any transaction.
- The simulation predicts your resulting position, including metrics like Health Score, Time to Liquidation, and Estimated Gas Fee.
- Adjust your batch until you're satisfied with the simulated outcome.
- Execution:
- Once you've reviewed the batch and simulation results, click "Execute".
- Confirm the transaction in your wallet. All queued actions are submitted to the blockchain as one atomic transaction.
Best Practices
- Always simulate your batch before executing to understand the impact on your positions and avoid surprises.
- Monitor gas fees—batching is usually cheaper, but complex batches can still incur significant costs.
- Review the order of actions in your batch to ensure they execute as intended.
- Use batching for Multiply/Strategy positions to streamline the process and reduce risk of partial execution.
Batch transactions give you greater control, efficiency, and safety when managing your positions on Euler.
Understanding Atomic Transactions in the UI
Many operations in the Euler UI already combine multiple actions into a single transaction, even when executed immediately. For example:
- Borrowing: When you borrow assets, the UI automatically supplies the assets from your wallet or takes them from your existing deposits in a single transaction.
- Multiply/Strategy: These operations automatically perform a series of actions—borrowing, swapping, and redepositing—all in one transaction.
This means you don't always need to use the batch builder to achieve atomic transactions. The batch builder is most useful when you want to combine multiple distinct operations or when you need to preview the outcome of a complex sequence of actions before executing them.