From e1196d216adb12243a945c9f598e4eaa8ca37500 Mon Sep 17 00:00:00 2001
From: Shaopeng Wang <spxwang@gmail.com>
Date: Thu, 5 Mar 2020 14:00:21 +1300
Subject: [PATCH] auction, oracle and prices brief documentation (#107)

---
 auction/README.md |  5 +++++
 oracle/README.md  | 12 ++++++++++++
 prices/README.md  |  6 ++++++
 3 files changed, 23 insertions(+)
 create mode 100644 auction/README.md
 create mode 100644 oracle/README.md
 create mode 100644 prices/README.md

diff --git a/auction/README.md b/auction/README.md
new file mode 100644
index 0000000..d80f59e
--- /dev/null
+++ b/auction/README.md
@@ -0,0 +1,5 @@
+# Auction module
+
+### Overview
+
+Auction module provides a way to open auction and place bids on-chain. You can open an auction by specifying a `start: BlockNumber` and/or an `end: BlockNumber`, and when the auction becomes active enabling anyone to place a bid at a higher price. Trait `AuctionHandler` is been used to validate the bid and when the auction ends `AuctionHandle::on_auction_ended(id, bid)` gets called.
diff --git a/oracle/README.md b/oracle/README.md
new file mode 100644
index 0000000..a63e569
--- /dev/null
+++ b/oracle/README.md
@@ -0,0 +1,12 @@
+# Oracle module
+
+### Overview
+
+Oracle module can be used to feed the system with off-chain data. e.g. a bot can query off-chain data from other sources and submit it into on-chain storage by calling oracle module.
+
+It uses a trait called `OperatorProvider::can_feed_data(who)` to ensure someone have permission to submit data otherwise it will fail with error `NoPermission`.
+You can only submit updates once per block otherwise oracle will call `OnRedundantCall::multiple_calls_per_block(&who)` and fail with error `UpdateAlreadyDispatched`. The trait `OnRedundantCall` can be implemented to slash those who don't play by the roles, by default it does nothing.
+
+Oracle module provides 2 public methods to submit data. Method `feed_value` is used to provide a single update and `feed_values` for batch updates. Keep in mind that you can call only one of them per block otherwise it will be a redundant call and fail. Both those methods are weight zero and dispatch class operational with a high priority, which means they can be misused to DoS the system, so be careful who you allow to call them and make sure to use `CheckOperator` to prevent multiple calls per block.
+
+Module provides additional methods to read raw or combined data. `CombineData` provides a default implementation which finds a median from an array of valid values, but you can provide a custom implementation as well.
diff --git a/prices/README.md b/prices/README.md
new file mode 100644
index 0000000..d529325
--- /dev/null
+++ b/prices/README.md
@@ -0,0 +1,6 @@
+# Prices module
+
+### Overview
+
+This module is been used to get the prices from a source `DataProvider` i.e. Oracle module, and calculate the price for a given `CurrencyId` pair.
+`fn get_price(base_currency_id: CurrencyId, quote_currency_id: CurrencyId) -> Option<Price>`
-- 
GitLab