Function: createOrder(Order order)

This function creates a new order to exchange native token for another ERC-20 token. This will transfer the specified amount of native token from the sender to the contract.

Inputs

  • order

    • Control: Almost full control. The tokenIn field is hardcoded to always be WRAPPED_NATIVE_TOKEN.

    • Constraints: order.amountIn must be nonzero and equal msg.value. The order.validTo field must not be in the past. The hash of the entire order struct cannot already exist in the nativeTokenOrders mapping, and the receiver must be a valid address.

    • Impact: Receives native tokens and creates a new order that stores metadata about the exchange order (native to ERC-20 token).

The bytes16 quoteId field is not part of the order digest and is meant for off-chain analysis. There is no uniqueness check on this field, and it only serves to be emitted in the OrderCreated event at the end. Do note that it is possible to create a separate order with the same quoteId, so event filtering must make certain to verify the order as well.

Branches and code coverage

Intended branches

Negative behavior

Zellic © 2025Back to top ↑