Proof of concept for a Frequent Batch Auction on Suave.
$ forge build
Use the ffi flag with Forge. You should have a Suave node running on your local machine.
$ forge test --ffi
$ forge fmt
$ forge doc --serve --port 4000
The FBA process revolves around three main functions:
placeOrder
: Allows users to place orders in the order book.cancelOrder
: Enables users to cancel their previously placed orders.executeFills
: Executed by the operator at regular intervals to match and fulfill orders.
We can illustrate the interaction between the main participants
- Users: the users who place and cancel orders
- Operator: the entity responsible for executing fills
- Contract: the smart contract that manages the order book and fills
- Storage: Confidential Data Store that stores orders and the contract storage that stores cancels
sequenceDiagram
participant Users
participant Operator
participant Contract
participant Storage
Users ->> Contract: placeOrder() / cancelOrder()
Contract ->> Storage: store orders / cancels
Operator ->> Contract: executeFills()
Storage ->> Contract: retrieve orders and cancels
Contract ->> Contract: execute cancels
Contract ->> Storage: update orders and cancels
Storage ->> Contract: retrieve orders
Contract ->> Contract: match orders
Contract ->> Storage: update orders