zeitgeist
zeitgeist copied to clipboard
Untie orderbook from `Market`
(Based on a discussion with @Robiquet)
Aside from tying the use of the order book to the scoring_rule
(to ensure that other trading mechanisms can't be used), what's the point of having market-commons as dependency of orderbook.
Motivation for the question is that we may want to run the order book and AMM in parallel in the future. Furthermore, it seems like an unnecessary hinderance for builders.
The only argument against this seems to be that we can't ensure the following:
- Trades can only be placed on open markets.
- Trades can only include outcome tokens that actually exist.
- Trades can only be against the collateral of the market.
I don't think either of these are a concern.
This is also a continuation of the discussion at https://github.com/zeitgeistpm/zeitgeist/pull/1099#discussion_r1340004299
I think the first simple adjustment would be to remove the requirement scoring_rule == ScoringRule::orderBook
. This would generally allow trading outcome tokens no matter if there is another trading mechanism. This would already be a huge gain.
In regards to completely generalizing the orderbook: I am in favor of that, although I don't see the benefit at this given moment. In the future, any asset could be exchanged such as custom tokens from organizations. To achieve that, I propose to make orderbook capable of distinguishing between the outcome asset class and any other asset class. In case of the outcome asset class, orderbook ensures that the above mentioned safe guards (like do not trade after market closure) are in place. For any other asset class, orderbook just does provides a means to exchange.
Needs more discussion now that we've got the router.