Expected Amount to Minimum Received
0x484428507A212cA56D71baa27Ca6089a6dB63a88

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

  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Get constant
    Get constant
    Holds a well-known constant as a named value: max uint256, WAD, RAY, basis points, one, or zero.
  • Multiply then divide
    Calculate times divided by rounded
    Multiplies two values and divides by a third in one step, rounding up or down.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.

Related plugs · 8