What this does
This plug computes a minimum received amount from an expected amount and a slippage tolerance. It asks the caller for expected_amount, the baseline quantity, and max_slippage, the tolerance fraction expressed against a WAD scale of 1e18. It runs on demand, subtracting max_slippage from 1 and multiplying expected_amount by that retained fraction divided by WAD, rounded down. Deriving this floor by hand or from a stale expected_amount risks setting a threshold that a swap cannot clear or that admits more slippage than intended.
Actions · 4




Related plugs · 8