Reference
Choose the right order parameters

Choose the right order parameters

When creating orders, you might be confused on how to set nonce, minAmountOut and deadline, this page will help you understand how to pick the right values.

Setting nonce

As Flood uses Permit2, you orders need to include a valid Permit2 nonce.

Since there is no standard way to pick Permit2 nonces, we built a PermitNonceFinder (opens in a new tab) to help you find the next free nonce for an offerer.

If you plan to sign multiple nonces at once, you should keep track of the last signed nonce and use it as an offset in the nonce finder. The SDK will soon include a NonceManager class to handle this for you.

💡

When you have multiple orders with the same nonce standing, and one of them gets filled, the others will be automatically cancelled. Increment your nonces when sending orders in rapid succession!

    cast call 0xf100Df4CA9bF942878888c1F05010F1823E5Dc73 "nextNonceAfter(address,uint)" $YOUR_ADDRESS $LAST_SIGNED_NONCE

Setting minAmountOut

The minAmountOut field is the minimum amount of tokens you are willing to accept for your order, Flood contracts will not allow a trade to settle if the recipient would receive less than minAmountOut tokens, thus setting a value that is too high will prevent your order from being filled.

Here a few ideas on how to set minAmountOut safely:

  1. Using an price oracle like Chainlink or UniswapV3.
  2. Using Flood own quote endpoint, setting it some % points below the returned value. This is what FloodSwap (opens in a new tab) does.
  3. Using an arbitrary price point you come up with. This is also how limit orders are implemented in FloodSwap (opens in a new tab).
  4. UNSAFE: Using a fixed value. This is not recommended as it will make you vulnerable to Fulfillers giving you a bad price.

Setting deadline

Deadline is the UNIX timestamp at which the order won't be fillable anymore. It is up to you to pick what works best for your use case.