Skip to content

Commit

Permalink
improve correlation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Feb 1, 2024
1 parent f899f3b commit e2e3091
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pallets/foreign-investments/src/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ pub struct InvestmentInfo<T: Config> {
/// 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<T>,
Expand Down Expand Up @@ -459,6 +462,7 @@ impl<T: Config> RedemptionInfo<T> {
pending_amount: T::Balance,
) -> Result<Option<ExecutedForeignCollect<T::Balance, T::CurrencyId>>, DispatchError> {
self.swapped_amount.ensure_add_assign(swapped_amount)?;

if pending_amount.is_zero() {
let msg = ExecutedForeignCollect {
currency: self.foreign_currency,
Expand Down

0 comments on commit e2e3091

Please sign in to comment.