From e2e3091d5b75bffc26e49124233966ed2f379b95 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Thu, 1 Feb 2024 15:49:35 +0100 Subject: [PATCH] improve correlation docs --- pallets/foreign-investments/src/entities.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pallets/foreign-investments/src/entities.rs b/pallets/foreign-investments/src/entities.rs index e5b0147d63..f32a875a15 100644 --- a/pallets/foreign-investments/src/entities.rs +++ b/pallets/foreign-investments/src/entities.rs @@ -102,8 +102,11 @@ pub struct InvestmentInfo { /// Used to correlate the pool amount into foreign amount and vice-versa /// when the market conversion is not known upfront. /// - /// The correlation is increased & decreased to be have the following - /// values: + /// The correlation + /// - is increased when an increase swap is paritally swapped + /// - is decreased when a decrease swap is partially swapped. + /// + /// Which can also be seen an addition of the following values: /// - The invested amount. /// - The pending decrease amount not swapped yet. pub correlation: Correlation, @@ -459,6 +462,7 @@ impl RedemptionInfo { pending_amount: T::Balance, ) -> Result>, DispatchError> { self.swapped_amount.ensure_add_assign(swapped_amount)?; + if pending_amount.is_zero() { let msg = ExecutedForeignCollect { currency: self.foreign_currency,