From 8fe61bea5c8e048e2b663af0d17476fd01721797 Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Thu, 27 Apr 2023 15:29:26 +0300 Subject: [PATCH] added function description --- code/parachain/frame/oracle/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/parachain/frame/oracle/src/lib.rs b/code/parachain/frame/oracle/src/lib.rs index 0d4aa70202d..36dd34627e0 100644 --- a/code/parachain/frame/oracle/src/lib.rs +++ b/code/parachain/frame/oracle/src/lib.rs @@ -929,6 +929,12 @@ pub mod pallet { }); } + /// This functions processes submitted preprices in the previous blocks and accumulates rewards for every asset + /// PrePrices that lived longer than block_interval are removed per asset. if PrePrices length is longer than max_amount + /// all except last max_amount PrePrices are removed per asset. + /// Afterwards, if for an asset, number of PrePrices submitted by oracles is greater than min_amount, then new price is calculated. + /// Oracles that submitted prices within assets' threshhold are rewarded proportionally to their staked amounts with amount of rewards accumulated + /// for an asset since last reward distribution for this asset. Other oracles are slashed with assets' slash amount pub fn update_prices_and_rewards(block: T::BlockNumber) -> Weight { let mut total_weight: Weight = Zero::zero(); let one_read = T::DbWeight::get().reads(1);