Description
swap/pool_swap should accept a user-supplied min_amount_out and a deadline ledger timestamp to protect against slippage and stale execution, standard for AMM safety.
Direction
- Add
min_amount_out: i128 and deadline: u64 parameters (or an overloaded swap_with_protection).
- Reject if
env.ledger().timestamp() > deadline (Expired error) or output < min_amount_out (SlippageExceeded error).
- Keep the existing
max_slippage_bps global as a fallback ceiling.
Acceptance criteria
Description
swap/pool_swapshould accept a user-suppliedmin_amount_outand adeadlineledger timestamp to protect against slippage and stale execution, standard for AMM safety.Direction
min_amount_out: i128anddeadline: u64parameters (or an overloadedswap_with_protection).env.ledger().timestamp() > deadline(Expirederror) or output< min_amount_out(SlippageExceedederror).max_slippage_bpsglobal as a fallback ceiling.Acceptance criteria
min_amount_outand before deadline.SlippageExceededwhen output would be belowmin_amount_out(no state change).Expiredpast the deadline.