3b50b7
Set a Slippage Ceiling for Treasury Swaps
Set a treasury swap ceiling by translating the maximum acceptable execution loss into a minimum output, then checking the route, fees and failure behavior.
The Hashbeam Desk··4 min read

Set a treasury swap’s slippage ceiling by converting the maximum execution loss the mandate permits into a minimum amount of output tokens. The ceiling is an on-chain execution bound when the route enforces it: if the trade would return less than that minimum, the swap reverts. It does not guarantee a good quote, cap network fees, or ensure a cross-chain swap completes.
For a treasury executing an exact-input trade, the key field is usually amountOutMinimum in the router call or its equivalent in the chosen interface. For an exact-output trade, the corresponding guard is amountInMaximum. A stalled cross-chain route adds separate questions about pending and completed transfers; the thor swap guide covers that recovery path in more detail.
What does the slippage ceiling actually limit?
It limits how far execution can move from the quote before the transaction is rejected. In an exact-input swap, the treasury fixes the quantity sold and sets the least output it will accept. If the quote is Q output tokens and the approved tolerance is s, the minimum output is Q × (1 − s). The router compares the actual output with that minimum at execution; below it, the call reverts.
That bound is not the same as price impact. Price impact comes from the trade’s own size against available liquidity and is already reflected in the quoted output. Slippage is the further movement between quoting or signing and execution, including intervening trades and changes in route conditions. A tolerance applied to the quoted amount can allow execution at a worse price than the headline quote, but it should not be used to disguise an already poor quote.
For an exact-output swap, the treasury specifies the desired quantity to receive and caps the input instead. The router reverts if acquiring that output requires more than amountInMaximum. This is often the clearer control when a treasury has an obligation to acquire a fixed amount, while exact-input is simpler when the amount being sold is fixed. In either case, define the boundary in the token units that the contract actually checks, accounting for token decimals and the route’s fees.
How should a treasury choose the ceiling?
Choose it from the mandate’s loss limit and the trade’s execution conditions, rather than copying a default tolerance. The treasury needs to define the worst acceptable exchange rate or output amount, then encode that limit in the route’s supported parameter. A wider tolerance reduces the chance of a revert after a small market move, but permits a worse fill; a tighter one protects the rate and can leave the trade unfilled.
Before signing, record and review:
- Trade type: fixed input with a minimum output, or fixed output with a maximum input.
- Quote and route: expected output, route composition, pool liquidity and fees included in the quote.
- Execution bound: minimum received or maximum spent, in the correct token units.
- Expiry and fee budget: when the transaction becomes invalid, and the network fee the treasury can pay even if execution fails.
For an AMM router, the contract parameter matters more than a display label such as “slippage.” Uniswap v2 exact-input router calls, for example, use amountOutMin; Uniswap v3’s exactInputSingle takes amountOutMinimum and a deadline. Names and behavior vary by router and interface, so verify the transaction data or the operator’s integration rather than assuming a setting in one app maps directly to another contract’s guard.
What can still go wrong after setting it?
A ceiling can reject an uneconomic fill, but it cannot ensure the swap succeeds or make every route safe. If the market moves past the bound, the transaction reverts. The swap itself does not execute, but a public-chain transaction that reverts can still consume gas. A deadline is a separate control: it invalidates a transaction after its expiry, while the minimum-output check constrains the execution price before expiry.
On a cross-chain route, source-chain acceptance and destination-chain settlement may be distinct steps. The source transaction’s guard may determine whether assets leave the source, while later handling can depend on the route’s own contracts and status rules. Do not assume a source-chain slippage field guarantees a minimum amount on the destination chain; inspect what the quote promises and what each transaction enforces.
For treasury policy, the practical rule is to approve a maximum loss per trade, translate it into the router’s actual output or input bound, and reject quotes whose price impact or route is already outside policy. Use a deadline to prevent stale execution, and treat a revert as a failed trade with a fee cost—not as evidence that the guard malfunctioned. A ceiling is useful precisely because it makes the worst acceptable execution explicit; its value depends on encoding that boundary in the contract that settles the swap.