Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Uniques pallet: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
iorveth committed Jul 29, 2021
1 parent eb6924d commit 6fabf25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frame/uniques/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
let mut deposit = Zero::zero();
if !class_details.free_holding && maybe_check_owner.is_some() {
deposit = T::DepositPerByte::get()
.saturating_mul(((key.len() + value.len()) as u32).into())
.saturating_mul((key.len().saturating_add(value.len()) as u32).into())
.saturating_add(T::AttributeDepositBase::get());
}
class_details.total_deposit.saturating_accrue(deposit);
if deposit > old_deposit {
T::Currency::reserve(&class_details.owner, deposit - old_deposit)?;
T::Currency::reserve(&class_details.owner, deposit.saturating_sub(old_deposit))?;
} else if deposit < old_deposit {
T::Currency::unreserve(&class_details.owner, old_deposit - deposit);
T::Currency::unreserve(&class_details.owner, old_deposit.saturating_sub(deposit));
}

Attribute::<T, I>::insert((&class, maybe_instance, &key), (&value, deposit));
Expand Down

0 comments on commit 6fabf25

Please sign in to comment.