Skip to content

Onchain creation of orders #3357

@MartinquaXD

Description

@MartinquaXD

Problem

Currently the majority of ways to create orders require the user to do some offchain action. For some users or use cases this is not ideal.

Suggested solution

A way to send a transaction which will result in the creation of an order in the offchain orderbook would be great.

Possibly the simplest way would be to create a helper contract for that. This helper contract only really needs 1 function for that. It should take 2 arguments (cow protocol order struct, signature) and all it has to do is emit an event with that data and signature.
Because the user is posting normal orders, this helper contract does not have to implement any additional security functionality.

Then the backend could index these events from that contract and insert the orders automatically into the offchain orderbook. The maximum validity of regular orders should still be enforced, though.

Also the helper contract should allow you to cancel orders. The same approach (function that emits an event) can be used for this as well. We only need to verify that the cancellation is actually valid be checking that the same address that signed the original order is now also trying to cancel it. This can be done by recovering the public address from the signature together with the signed data.

Additional context

We should not miss any order creation events during restarts so we need to store in the DB which block was last indexed to know where we need to continue after the restart.

Acceptance criteria

A user is able to place an order by submitting a very simple ethereum transaction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions