Updating dev docs

This commit is contained in:
Chris Troutner
2021-11-24 10:54:45 -08:00
parent 05a7cdb6a4
commit ca3fddb279
2 changed files with 9 additions and 15 deletions
+8 -14
View File
@@ -85,25 +85,19 @@ Use cases are verbs or actions that is done _to_ an Entity or _between_ Entities
- **`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.
- **Update Merit** - Recalculate and update the merit value of the Website Entity.
- **`createOffer()`** - A macro command that leverages `ensureFunds()` and `moveTokens()`, to create a new Offer and submit it to the P2WDB.
## Controllers
Controllers are inputs to the system. When a controller is activated, it causes the system to react in some way.
- **POST Webhook** - This POST REST endpoint will be triggered by a webhook generated by the P2WDB. This will notify the tor-list-api that a new entry has been added to the P2WDB that matches the `appId` of `torlist`. It's a new entry that should be evaluated for inclusion in the tor-list-api local database.
- **GET by Category** - Return the 100 top-ranked Website Entities within a specific category, and with a merit above zero.
- **POST Blacklist** - Creates a new Blacklist Entity. This endpoint is only accessible by an Admin user.
- **24 hour Timer** - A timer which triggers every 24 hours, sets off an update of the database. When it triggers, the following actions should take place:
- All the website entities should be added to a retry-queue. Highest-merit websites are processed first, lowest merit last.
- The server will recalculate the merit for each Website Entity in the queue.
- TODO: Figure out a good garbage collection scheme to remove websites that consistently have no merit.
- The server will update the 'top 100' in each Category Entity.
### Orders
- **POST /order** - This POST REST API endpoint will be triggered by a webhook generated by the P2WDB. This will notify the `ipfs-swap-service` that a new entry has been added to the P2WDB that matches the `appId` of `swap-<chain>`, where `<chain>` has a value of `avax`, `bch`, or `ecash`. It's a new entry that should be evaluated for inclusion in the `ipfs-swap-service` local database.
### Offers
- **POST /offer** - This POST REST API endpoint can be triggered by the Client or a simple curl call. It passes in the data needed for `ipfs-swap-service` to generate and track a new Offer, then submit the data to the P2WDB to generate an Order that is tracked by all other instances of `ipfs-swap-service`.
## Adapters
+1 -1
View File
@@ -2,7 +2,7 @@
Offer Entity
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 Order generated by this application.
to track an Order generated by this application.
The Offer tracks the hdIndex address used to hold tokens or BCH for sale.
*/