End users (swappers) create order intents, specifying data like what tokens they wish to trade, how much they expect to receive and the max. amount they are willing to give. They call a newOrder function, passing intent data confidentially. The intent is saved confidentially in storage by creating a new bid, but an event emits public data, including the intent order info and the bidId. Solvers listen to these
I ran a local Suave node and deployed a contract on Suave that handles the auction. I added a custom precompile to suave-geth that lets me call the goerli block number within the suave contract. This lets me run block-by-block auction for an order. The contract currently only supports one order for this PoC, but shouId allow a batch auction eventually. When solvers receive new order information, they generate a solution and submit this to the contract. In this case, they pass in bundle data - which encompasses a settlement transaction. When the solver submits their data, the contract checks if they are still within the current auction block. If not it will settle the previous auction by executing the current top-ranking solver bundle., and then update the current block. Solver gets their solution ranked against the current auction solution by simulating the bundle and getting an egp score. If their score is greater than the one for this block, replace it. I also wrote scripts in go for deploying, creating an order and also a solver that listens to events on the contract. I wanted to demo everything but I was short on time and changed the contract implementation before I was able to finish these. A bunch of things still need to be implemented for a fool-proof solution but I enjoyed working on this early prototype.