cowprotocol / services

Off-chain services for CoW Protocol
https://cow.fi/
Other
199 stars 78 forks source link

feat: Enable jit orders for CoW AMMs #2607

Closed harisang closed 5 months ago

harisang commented 7 months ago

In order to realize the potential of CoW AMMs, solvers need to be able to post jit orders to the CoW AMM. A special property of these orders is that they are eligible for surplus, that should be accounted for when computing the score of a solution. This requires that the autopilot and the default driver are aware that these orders can accumulate surplus.

Copy-pasting an important observation from the first comment below.

Also, those orders require to execute a pre interaction (to commit the AMM to a unique order id and prevent replay attacks). JIT orders and high level solutions currently don't have a way of specifying pre/post interactions. This should be added as well (not entirely sure if on the JIT order level or solution struct, my hunch would be the latter for more flexibility).

fleupold commented 7 months ago

The list for those can probably be hardcoded initially (and should be similar to the list of addresses that are exempt from protocol fees).

Also, those orders require to execute a pre interaction (to commit the AMM to a unique order id and prevent replay attacks). JIT orders and high level solutions currently don't have a way of specifying pre/post interactions. This should be added as well (not entirely sure if on the JIT order level or solution struct, my hunch would be the latter for more flexibility).

squadgazzz commented 7 months ago

Split the issue into https://github.com/cowprotocol/services/issues/2635 and https://github.com/cowprotocol/services/issues/2636. This ticket can be used for the wiring up.

fleupold commented 7 months ago

While not strictly required, it would probably be good to complete #2215 before implementing this issue as otherwise we have to add the logic to encode clearing prices for JIT orders that accrue surplus in the legacy encoder (which may be a bit hairy)

github-actions[bot] commented 5 months ago

This issue has been marked as stale because it has been inactive a while. Please update this issue or it will be automatically closed.

MartinquaXD commented 5 months ago

Last bit for submitting cow amm JIT orders was implemented in https://github.com/cowprotocol/services/pull/2764