Connect quote, allowance and minimum output
By the end, explain the diagram in your own words, solve the case and justify the correction.
Prerequisites : Liquidity pools and automated market makers · Token approvals and wallet security
Level 2 · Intermediate →Reading path · 33 / 35 · Intermediate
A decentralised exchange can execute a trade through smart contracts and liquidity pools.
The essentials
A decentralised exchange can execute a trade through smart contracts and liquidity pools. A quote describes an expected output at a moment in time. The submitted transaction must still execute against the state it encounters, subject to its limits.
How it works
Price impact is the effect of the trade on available liquidity. Slippage is the difference between expected and executed terms; slippage tolerance bounds what a particular transaction accepts. These are related but different concepts. A generous tolerance can expose the user to a substantially worse execution.
What to watch
For many tokens, an allowance is a separate permission for a spender contract. Check the spender, token, amount and duration if applicable. Router addresses and routes matter. A successful allowance transaction is not itself a completed swap, and unused permissions can remain afterwards.
Understand the details
If the quote is 100 units and the interface sets a minimum of 99, an execution below 99 should fail under that minimum-output condition. Network fees may still be charged for a reverted transaction that is included in a block. Review token behaviour, route fees and the chain separately: a displayed output does not necessarily capture every cost. Use a simulation to understand intent, while recognising that state can change before inclusion.
Boundaries and common mistakes
Tolerance is not a guarantee of a fair market price. A small percentage applied to a bad quote remains a bad reference.
The mechanism at a glance
- Inspect quote
- Review allowance
- Set execution limit
- Check received assets
Apply the lesson to a case
A fictional swap quotes 200 units and sets a minimum output of 198. The execution would return 197.5. Assume the contract correctly enforces that minimum.
197.5 is below 198, so the minimum-output condition fails. The condition limits accepted execution; it does not guarantee inclusion or reimburse gas.
Terms in this lesson
- Liquidity pool
- Assets held under shared contract rules to support activities such as exchange or lending.
Prepare a correction note
Describe the passage and the proposed correction. This creates a local note for you to share; it sends nothing. Do not include personal or confidential information.