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
orderControl: Almost full control. The
tokenInfield is hardcoded to always beWRAPPED_NATIVE_TOKEN.Constraints:
order.amountInmust be nonzero and equalmsg.value. Theorder.validTofield must not be in the past. The hash of the entire order struct cannot already exist in thenativeTokenOrdersmapping, 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