atomiclabs/hyperdex

Use the concept of "orders" instead of "swaps"

sindresorhus opened this issue · 0 comments

mm2 is using a different concept for orders than what we implemented for mm1. For mm1, one order was equal to one swap. In mm2, there's the concept of a order having potentially multiple swaps, and it also has the concept of taker/maker (in mm1 the end-user was always Taker and the server was Maker).

At the moment we have no concept of orders, we just use the UUID we get from the buy API and wait for it to show in my_recent_swaps. Which taker orders always will. But for maker order, we need to track the actual order to check for all swaps that may be started for it. But that won’t work for taker orders because the order is deleted as soon as it's matched, which we can easily miss when it's matched quickly.
From Artem in Discord, the proper way to currently track both of these use cases is:
We will have to persist the order_history sooner or later (KomodoPlatform/komodo-defi-framework#451) so it'll be done for sure. As of now you have to follow these steps: create order -> check order_status -> if there's no order check my_swap_status with same uuid -> if swap is not found there's something unexpected. - @lukechilds