mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-07 22:04:03 -05:00
doc: arch/dex design doc
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
- [Smart Contracts](arch/sc/sc.md)
|
||||
- [Transaction lifetime](arch/sc/tx-lifetime.md)
|
||||
- [DAO](arch/dao.md)
|
||||
- [DEX](arch/dex.md)
|
||||
- [Wallet](arch/wallet.md)
|
||||
- [zkas](zkas/index.md)
|
||||
- [Writing ZK Proofs](zkas/writing-zk-proofs.md)
|
||||
|
||||
29
doc/src/arch/dex.md
Normal file
29
doc/src/arch/dex.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# DEX
|
||||
|
||||
With cross-chain bridging and darkpool DEX then DarkFi would be a very
|
||||
attractive trading tool.
|
||||
|
||||
We currently have OTC swaps which are an efficient way to settle trades
|
||||
on-chain. But there needs to be an orderbook for matching counterparties.
|
||||
|
||||
We propose that this job can be performed by an order-matching bot which
|
||||
maintains an orderbook. Later this role can be split with MPC.
|
||||
|
||||
The order-matching party needs to be able to construct the swap trade,
|
||||
even when the LP is offline.
|
||||
|
||||
We propose to do this using the spend hook and a special `auth_otc` function.
|
||||
The `auth_otc` basically says:
|
||||
|
||||
* The sender of the funds has the right at any time to withdraw liquidity and
|
||||
cancel the LP.
|
||||
* The funds are delegated to the order-matching party but with restrictions:
|
||||
* Can only make an OTC swap tx using the funds.
|
||||
* The trade parameters are completely specified such as the price and
|
||||
currencies.
|
||||
|
||||
The funds are therefore delegated to the order-matching party, who finds
|
||||
counterparty offers and executes the trades settling them on-chain. Both parties
|
||||
receive their funds in a trustless anonymous manner. At any time the LP can be
|
||||
canceled and funds withdrawn.
|
||||
|
||||
Reference in New Issue
Block a user