mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Updating dev docs
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ The arrows in the image represent the information flow between the three pieces
|
||||
|
||||
- The _Client_ displays information about orders. It _reads_ this information from ipfs-swap-service.
|
||||
- The _Client_ is also a wallet. It can generate the needed transactions to _write_ information to the P2WDB.
|
||||
- `ipfs-swap-service` imports data from the global P2WDB database into its local database, using a [webhook](https://en.wikipedia.org/wiki/Webhook).
|
||||
- `ipfs-swap-service` imports data from the global P2WDB database into its local database, using a [webhook](https://en.wikipedia.org/wiki/Webhook) (dashed line). It can also custody funds by creating an _Offer_ and submitting the data to the P2WDB to generate an _Order_ (solid line).
|
||||
|
||||
This architecture keeps the global database highly censorship resistant, while allowing local installations to maintain tight control over the user experience. The goal is to have many redundant copies of `ipfs-swap-service` on the network, and to empower individual traders to run their own, private copy.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -15,7 +15,7 @@ Entities make up the core business concepts. If these entities change, they fund
|
||||
|
||||
### Order
|
||||
|
||||
An order is created when a new Signal is detected via the P2WDB webhook.
|
||||
An order is created from data passed to the app by the P2WDB webhook.
|
||||
It is destroyed when the UTXO described in the Signal has been detected as spent.
|
||||
|
||||
Order entities have the following properties:
|
||||
@@ -46,7 +46,7 @@ An Offer Entity is nearly the same as an Order. But while an Order is generated
|
||||
by a webhook from P2WDB, the Offer Entity is created internally. It is used
|
||||
to track an Order generated by this application.
|
||||
|
||||
The Offer tracks the [HD index address](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc#hd-wallets-bip-32bip-44) used to hold tokens or BCH for sale. This is the part of the app concerned with the custody of the funds. It creates a segregated [UTXO](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch06.asciidoc#transaction-outputs-and-inputs) to hold the offered asset. The Offer is automatically destroyed if the UTXO is accidentally spent, which is why it needs to be segregated.
|
||||
The Offer tracks the [HD index address](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc#hd-wallets-bip-32bip-44) used to hold tokens or BCH for sale. This is the part of the app concerned with the custody of the funds. It creates a segregated [UTXO](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch06.asciidoc#transaction-outputs-and-inputs) to hold the offered asset. The Offer is automatically destroyed if the UTXO is accidentally spent, which is why it needs to be segregated from other wallet UTXOs.
|
||||
|
||||
Offer entities have the following properties:
|
||||
|
||||
@@ -77,6 +77,16 @@ Offer entities have the following properties:
|
||||
|
||||
Use cases are verbs or actions that is done _to_ an Entity or _between_ Entities.
|
||||
|
||||
### Order
|
||||
|
||||
- **`createOrder()`** - This method is triggered by a webhook from the P2WDB. It will take the data provided by the P2WDB and create a new Order entity in the local database.
|
||||
|
||||
### Offer
|
||||
|
||||
- **`ensureFunds()`** - Ensure that the wallet has enough BCH and tokens to complete the requested trade.
|
||||
- **`moveTokens()`** - Move the tokens indicated in the offer to a temporary holding address. This will generate the UTXO used in the webhook message. This function moves the funds and returns the UTXO information.
|
||||
- **`createOffer`** - A macro command that leverages `ensureFunds()` and `moveTokens()`, to create a new Offer and submit it to the P2WDB.
|
||||
|
||||
- **Delete** - This is actually _not_ a use case. It's mentioned here to point out that deleting websites is not necessary. Users can instead move their PSF tokens to a different address, and the merit will go to zero. This will cause the website entry to drop to the bottom of the rankings for its category. Entries with zero merit will be ignored, or possibly garbage-collected.
|
||||
- **Add to Blacklist** - This is an action that can only be performed by a logged-in user with admin privledges. This allows the admin to prevent entries that violate the ToS from being displayed.
|
||||
- **Get Merit** - Read the merit value of the Website Entity.
|
||||
|
||||
Reference in New Issue
Block a user