Exact-Output Swaps: What Your Receive Amount Fixes

In an exact-output Matcha swap, the receive amount you enter is fixed, while the amount you spend can move up to a stated maximum. The swap’s contract checks that spending limit when the trade executes; if the trade would exceed it, the transaction reverts. Some routes or modes may only let you enter a sell amount.

What changes when you type in the receive field?

You tell the swap how many tokens you need to receive. The quoted sell amount becomes an estimate, and the quote shows a maximum sold: the most the swap can take from you while still delivering your requested amount.

This is useful when a payment, transfer, or other next step requires a specific token quantity. You keep that quantity fixed, but should be prepared for the final spend to be higher than the quote. If the market moves enough that the required spend passes the maximum, the trade fails instead of taking more.

The Uniswap v3 SwapRouter documentation describes this bound through its exactOutput function, which accepts an amountInMaximum. That parameter establishes the maximum input the contract will allow for the specified output. It does not promise that every quote will execute: the trade must still fit within the limit when it runs.

What does the sell field fix instead?

Typing a sell amount makes the trade exact-input: the amount you sell is fixed, while the amount you receive can vary. Its protection figure is minimum received, the least output the contract will accept.

The SwapRouter’s exactInput function uses amountOutMinimum for that check. If the trade would return less than the minimum, it reverts. Otherwise, you may receive more than the minimum, but the entered sell amount does not change.

This is the common source of confusion: a receive estimate shown after entering a sell amount is not itself guaranteed. For the Matcha swap process, the practical consequence is that you should choose the receive field when you need a set token quantity, then read the maximum sold before submitting. If you choose the sell field, read minimum received to see how low the output can go.

Which quote line tells you what can move?

The minimum or maximum line identifies the floating side and its limit. “Minimum received” means the output may move down to that floor; “maximum sold” means the input may move up to that ceiling. The other side is the amount you entered.

Slippage is the tolerance behind this bound: it allows the floating amount to change within a limit, rather than changing the fixed amount. So, if you need exactly 25 units of a token, enter 25 in the receive field and judge the quote by maximum sold. If the maximum spend is too high, wait or reconsider the trade; entering a sell amount instead would make the 25-unit receive figure only an estimate.

Comments

Popular posts from this blog

How to Judge a Changing Swap Quote Before You Sign

Token Allowlists Explained for Cross-Chain Routes

How Do You Set a Bitcoin Fee for a Swap?