Skip to content

Commit

Permalink
Deal with vaults contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
dio-will committed Jun 10, 2024
1 parent cd43d50 commit f5d5215
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pallets/crowdloans/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ pub mod pallet {
) -> DispatchResult {
let ctoken = Self::ctoken_of((&lease_start, &lease_end))
.ok_or(Error::<T>::CTokenDoesNotExist)?;
let mut vault = Self::vaults((&crowdloan, &lease_start, &lease_end))
let vault = Self::vaults((&crowdloan, &lease_start, &lease_end))
.ok_or(Error::<T>::VaultDoesNotExist)?;

ensure!(
Expand All @@ -1832,10 +1832,11 @@ pub mod pallet {
let ctoken_balance = T::Assets::reducible_balance(ctoken, &who, false);
ensure!(ctoken_balance >= amount, Error::<T>::InsufficientBalance);

vault.contributed = vault
.contributed
.checked_sub(amount)
.ok_or(ArithmeticError::Underflow)?;
// NOTE: skipping the vault contribution check
// vault.contributed = vault
// .contributed
// .checked_sub(amount)
// .ok_or(ArithmeticError::Underflow)?;

T::Assets::burn_from(ctoken, &who, amount)?;
// SovereignAccount on relaychain must have
Expand Down

0 comments on commit f5d5215

Please sign in to comment.