Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Sep 18, 2023
1 parent 289991c commit 937f9f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
4 changes: 2 additions & 2 deletions pallets/foreign-investments/src/impls/invest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ mod tests {
amount: foreign_swap.amount - to_foreign(pool_swap.amount),
..foreign_swap
},
done_amount: 100,
done_amount: done_amount + 40,
invest_amount: pool_swap.amount
}
);
Expand All @@ -1298,7 +1298,7 @@ mod tests {
amount: foreign_swap.amount - to_foreign(pool_swap.amount),
..foreign_swap
},
done_amount: 100,
done_amount: done_amount + 40,
invest_amount: invest_amount + pool_swap.amount
}
);
Expand Down
27 changes: 3 additions & 24 deletions pallets/foreign-investments/src/impls/redeem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,16 +597,6 @@ mod tests {
Pool,
}

const CONVERSION_RATE: u128 = 3; // 300%

fn to_pool(foreign_amount: u128) -> u128 {
foreign_amount * CONVERSION_RATE
}

fn to_foreign(pool_amount: u128) -> u128 {
pool_amount / CONVERSION_RATE
}

type RedeemState = super::RedeemState<u128, CurrencyId>;
type RedeemTransition = super::RedeemTransition<u128, CurrencyId>;

Expand All @@ -627,18 +617,7 @@ mod tests {
}

fn get_swap_amount(&self) -> u128 {
match *self {
Self::ActiveSwapIntoForeignCurrency { swap } => swap.amount,
Self::ActiveSwapIntoForeignCurrencyAndSwapIntoForeignDone { swap, .. } => {
swap.amount
}
Self::RedeemingAndActiveSwapIntoForeignCurrency { swap, .. } => swap.amount,
Self::RedeemingAndActiveSwapIntoForeignCurrencyAndSwapIntoForeignDone {
swap,
..
} => swap.amount,
_ => 0,
}
self.get_active_swap().map(|swap| swap.amount).unwrap_or(0)
}

fn total(&self) -> u128 {
Expand Down Expand Up @@ -714,8 +693,8 @@ mod tests {
RedeemTransition::DecreaseRedeemOrder(60),
RedeemTransition::FulfillSwapOrder(foreign_swap_big),
RedeemTransition::FulfillSwapOrder(foreign_swap_small),
//RedeemTransition::CollectInvestment(60),
//RedeemTransition::CollectInvestment(120),
RedeemTransition::CollectRedemption(30, foreign_swap_big),
RedeemTransition::CollectRedemption(30, foreign_swap_small),
];

let mut rng = StdRng::seed_from_u64(42); // Determinism for reproduction
Expand Down

0 comments on commit 937f9f2

Please sign in to comment.