The Problem
Traditional batching requires hardcoded values:The Solution
Use runtime functions to inject actual values at execution time:Available Functions
| Function | Description |
|---|---|
runtimeERC20BalanceOf | ERC-20 token balance |
runtimeNativeBalanceOf | Native token balance (ETH, MATIC) |
runtimeERC20AllowanceOf | Token allowance between addresses |
runtimeParamViaCustomStaticCall | Any contract read (up to 32 bytes) |
runtimeERC20BalanceOf
Most common—inject token balance at execution:runtimeNativeBalanceOf
For native token operations:Constraints
Constraints control when instructions execute and protect against bad values.Minimum Balance
Non-Zero Check
Transaction Ordering
Constraints determine execution sequence. MEE retries until satisfied:- Bridge instruction executes
- Swap instruction simulated → fails (no tokens yet)
- MEE waits and retries
- Bridge completes, tokens arrive
- Constraint satisfied → swap executes
Example: Swap and Deposit All
Best Practices
Use for Unknown Values
Swap outputs, bridge results, slippage
Add Constraints
Protect against unexpected states
Sweep Remaining
Transfer leftover tokens back to user
Set Slippage Tolerance
Use
greaterThanOrEqualTo with minimumSummary
Runtime injection turns static transactions into adaptive, state-aware flows that handle:- Unknown swap outputs
- Bridge timing
- Slippage protection
- Automatic sequencing