cryptos

Can a Fraxswap Long-Term Order Be Cancelled: What Returns

Fraxswap long-term orders can be cancelled before completion by the address that placed them. The Fraxswap TWAMM is a concrete example: it sells an order over time through virtual trades, so the pair still holds the input it has yet to sell. Cancellation returns that unsold input and the output already bought.

Fraxswap pair contracts embed a TWAMM based on Paradigm’s 2021 design. When the owner cancels, the pair executes any pending virtual trades first, through the cancellation block. It then settles the order in one transaction. The two amounts returned reflect execution up to that block, which may be later than the team’s decision to stop.

Say a treasury orders the sale of 1,000,000 FRAX over 10 days and cancels around day 4. Roughly 600,000 FRAX comes back as unsold input, along with the other token bought using about 400,000 FRAX. Treat those as separate amounts: one is a return of treasury inventory; the other is the result of the part of the trade that executed. The exact figures depend on the cancellation block and the order’s execution, so the four-day split is an estimate.

To record the trade, start with the original 1,000,000 FRAX and subtract the unsold FRAX returned. That gives the FRAX actually sold. Divide the total output bought by that executed FRAX amount to calculate the average price in output tokens per FRAX. If the treasury withdrew proceeds before cancelling, add those earlier withdrawals to the output paid at cancellation. Otherwise, the calculated price omits part of the executed trade. Keep the returned FRAX out of the price denominator because it was never sold.

Only the address that placed the order can submit its cancellation. If that address is a multisig, the team needs its usual approvals to sign and execute the transaction, as it did for placement. Record the order ID, cancellation transaction hash, unsold input returned, and output paid out. Keep any earlier proceeds withdrawals alongside that record so the final executed amount and average price can be reconstructed from the full order history.