git.delta.rocks / unique-network / refs/commits / 17276cf3fcc4

difftreelog

chore fix code review requests

Grigoriy Simonov2022-08-04parent: #b24c77c.patch.diff
in: master

1 file changed

modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
403 )?;403 )?;
404 }404 }
405
406 let updated_balances = data
407 .into_iter()
408 .map(|(user, amount)| {
409 let updated_balance = <Balance<T>>::get((collection.id, &user))
410 .checked_add(amount)
411 .ok_or(ArithmeticError::Overflow)?;
412 Ok((user, amount, updated_balance))
413 })
414 .collect::<Result<Vec<_>, DispatchError>>()?;
405415
406 // =========416 // =========
407417
408 <TotalSupply<T>>::insert(collection.id, total_supply);418 <TotalSupply<T>>::insert(collection.id, total_supply);
409 for (user, amount) in data {419 for (user, amount, updated_balance) in updated_balances {
410 let updated_balance = <Balance<T>>::get((collection.id, &user))
411 .checked_add(amount)
412 .ok_or(ArithmeticError::Overflow)?;
413 <Balance<T>>::insert((collection.id, &user), updated_balance);420 <Balance<T>>::insert((collection.id, &user), updated_balance);
414 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(421 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(
415 &user,422 &user,