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

Pallet balances quick updates #14557

Merged
merged 2 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,11 @@ pub mod pallet {
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
let source = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
<Self as fungible::Mutate<_>>::transfer(&source, &dest, value, Expendable)?;
Ok(().into())
Ok(())
}

/// Set the regular balance of a given account; it also takes a reserved balance but this
Expand All @@ -564,7 +564,7 @@ pub mod pallet {
who: AccountIdLookupOf<T>,
#[pallet::compact] new_free: T::Balance,
#[pallet::compact] old_reserved: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
let who = T::Lookup::lookup(who)?;
let existential_deposit = Self::ed();
Expand Down Expand Up @@ -592,7 +592,7 @@ pub mod pallet {
}

Self::deposit_event(Event::BalanceSet { who, free: new_free });
Ok(().into())
Ok(())
}

/// Exactly as `transfer_allow_death`, except the origin must be root and the source account
Expand All @@ -603,12 +603,12 @@ pub mod pallet {
source: AccountIdLookupOf<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
let source = T::Lookup::lookup(source)?;
let dest = T::Lookup::lookup(dest)?;
<Self as fungible::Mutate<_>>::transfer(&source, &dest, value, Expendable)?;
Ok(().into())
Ok(())
}

/// Same as the [`transfer_allow_death`] call, but with a check that the transfer will not
Expand All @@ -622,11 +622,11 @@ pub mod pallet {
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
let source = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
<Self as fungible::Mutate<_>>::transfer(&source, &dest, value, Preserve)?;
Ok(().into())
Ok(())
}

/// Transfer the entire transferable balance from the caller account.
Expand Down Expand Up @@ -724,11 +724,11 @@ pub mod pallet {
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
let source = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
<Self as fungible::Mutate<_>>::transfer(&source, &dest, value, Expendable)?;
Ok(().into())
Ok(())
}

/// Set the regular balance of a given account.
Expand All @@ -743,7 +743,7 @@ pub mod pallet {
origin: OriginFor<T>,
who: AccountIdLookupOf<T>,
#[pallet::compact] new_free: T::Balance,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
let who = T::Lookup::lookup(who)?;
let existential_deposit = Self::ed();
Expand All @@ -767,7 +767,7 @@ pub mod pallet {
}

Self::deposit_event(Event::BalanceSet { who, free: new_free });
Ok(().into())
Ok(())
}
}

Expand Down
3 changes: 1 addition & 2 deletions frame/support/src/traits/tokens/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ pub trait Currency<AccountId> {

/// Transfer some liquid free balance to another staker.
///
/// This is a very high-level function. It will ensure all appropriate fees are paid
/// and no imbalance in the system remains.
/// This is a very high-level function. It will ensure no imbalance in the system remains.
fn transfer(
source: &AccountId,
dest: &AccountId,
Expand Down