0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Set swap limits for recurring AVAX payouts

0
Posted at

A treasury can make recurring AVAX payouts more predictable by setting a minimum acceptable output for each swap, provided the quote still meets its price and timing limits when the transaction executes. That limit puts a hard floor under execution; it does not guarantee a fill or a fixed market price.

  • Set the minimum output from a fresh quote and an approved slippage budget.
  • Keep price impact, swap fees and market movement separate when reviewing the quote.
  • Requote or split a trade when the output floor would reject execution.

Use minimum output as an execution bound

A swap’s minimum output, often called amountOutMinimum, is the least amount of the destination token the transaction will accept. The router checks the actual output against that threshold during execution; if output is lower, the transaction reverts instead of completing the swap.

For a quoted output Q and slippage tolerance s, the usual bound is Q × (1 − s). If a treasury expects 10,000 USDT and approves 0.5% slippage, the floor is 9,950 USDT. That 50 USDT is a permitted deterioration from the quote, not an extra fee or a promise that the trade will land at 9,950.

Blackhole swap is an Avalanche C-Chain service for token swaps and liquidity access. Set policy around the treasury’s payout obligation: if recipients must receive at least 9,950 USDT, use that obligation to determine the floor, then check that the quoted output leaves enough room for it.

Separate price impact from execution slippage

Price impact is the effect the proposed trade has on the pool’s price as it consumes liquidity; slippage is the difference between the quoted and executed result. A large order can have high price impact before submission, while a small order can still face slippage if the pool changes before execution.

For a constant-product pool with reserves x and y, swapping input Δx changes the reserve ratio; ignoring fees, output is y × Δx / (x + Δx). The pool fee reduces that output, and a route through multiple pools compounds fees and price impact. The quoted output should already account for the route and its fees, so don’t subtract the fee again when calculating minimum output.

For example, suppose a treasury swaps 5,000 AVAX for USDT and the current route quote is 175,000 USDT. At 0.4% tolerance, the floor is 174,300 USDT. If a competing transaction or a price move pushes execution below that amount, the swap reverts; if the pool’s depth means the quote itself is already poor, the tolerance setting will not fix that price impact.

Choose a tolerance that matches the payout

Choose slippage tolerance from the maximum loss the payout can absorb, not from a habit of using one setting for every trade. Stable, deep pools may support a tighter bound, while volatile assets, thin liquidity or a multi-hop route can require more room; each treasury should set its own limit from observed quotes and payout requirements.

For a recurring transfer, compare the quoted output with the required recipient amount and the treasury’s approved execution price. If the floor is too low to protect the payout, reduce the trade size, split it into scheduled clips, or wait for a better quote. Splitting can reduce price impact per transaction, but adds transactions and exposure to price changes between clips.

To compare execution paths before setting the limit, see how Blackhole swap routes trades; that article covers the route or pool choice in more detail. This article’s focus is the output floor applied after choosing a route.

Handle stale quotes and reverted swaps

A transaction can revert even on Avalanche C-Chain, whose consensus provides fast finality, because the pool state may change between quoting and inclusion. Reversion protects the minimum output, but the submitted transaction may still consume gas; a retry should use a fresh quote and a newly calculated floor.

For treasury operations, record the input, quoted output, minimum output, route, timestamp and final receipt for each payout. If a swap repeatedly reverts, investigate quote age, pool depth and trade size before widening tolerance: a looser bound can turn an operational delay into an accepted worse execution.

Set the floor from the payout obligation, then trade only while the live quote can meet it.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?