Fees and Price Protection
Last updated
DEX pool fees: each liquidity pool charges its own standard swap fee, set by the DEX rather than by Zest Protocol. These are already accounted for in the quote. The routing engine selects the route with the best output after all pool fees. Zest Protocol does not charge any additional fees for standard swaps through the Zest Protocol Stacks Swap router contracts.
On-chain prices can move between the moment a quote is shown and the moment the transaction confirms. Zest Protocol Stacks Swap protects against this in three ways:
Minimum received, enforced on-chain
Every swap carries a minimum output amount written into the transaction itself. The smart contract checks it after the swap executes. If the final output is below the minimum, the entire transaction reverts and no tokens move. No app, server, or operator can override this check.
Quote deadlines
Every swap carries a deadline. A transaction that has not confirmed by the deadline reverts instead of executing against stale prices.
Stacks wallet post-conditions
Stacks transactions include post-conditions: rules shown by the wallet before signing that cap exactly which tokens can leave the account and in what amount. If execution would violate them, the network aborts the transaction automatically. See an example of a post-condition below.

The quote a user approves is the worst case they can receive. The swap either fills at the quoted amount or better, or it does not happen at all.
Last updated