mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Remove deprecated pallet_balances's set_balance_deprecated and transfer dispatchables (#1226)
* remove deprecated dispatchables * update test * update tests * update tests * add prdocs * add prdoc * Update docs/prdoc/pr_1226.prdoc Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * move prdoc file --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
This commit is contained in:
@@ -563,53 +563,6 @@ pub mod pallet {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the regular balance of a given account; it also takes a reserved balance but this
|
||||
/// must be the same as the account's current reserved balance.
|
||||
///
|
||||
/// The dispatch origin for this call is `root`.
|
||||
///
|
||||
/// WARNING: This call is DEPRECATED! Use `force_set_balance` instead.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(
|
||||
T::WeightInfo::force_set_balance_creating() // Creates a new account.
|
||||
.max(T::WeightInfo::force_set_balance_killing()) // Kills an existing account.
|
||||
)]
|
||||
pub fn set_balance_deprecated(
|
||||
origin: OriginFor<T>,
|
||||
who: AccountIdLookupOf<T>,
|
||||
#[pallet::compact] new_free: T::Balance,
|
||||
#[pallet::compact] old_reserved: T::Balance,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let who = T::Lookup::lookup(who)?;
|
||||
let existential_deposit = Self::ed();
|
||||
|
||||
let wipeout = new_free < existential_deposit;
|
||||
let new_free = if wipeout { Zero::zero() } else { new_free };
|
||||
|
||||
// First we try to modify the account's balance to the forced balance.
|
||||
let old_free = Self::try_mutate_account_handling_dust(
|
||||
&who,
|
||||
|account, _is_new| -> Result<T::Balance, DispatchError> {
|
||||
let old_free = account.free;
|
||||
ensure!(account.reserved == old_reserved, TokenError::Unsupported);
|
||||
account.free = new_free;
|
||||
Ok(old_free)
|
||||
},
|
||||
)?;
|
||||
|
||||
// This will adjust the total issuance, which was not done by the `mutate_account`
|
||||
// above.
|
||||
if new_free > old_free {
|
||||
mem::drop(PositiveImbalance::<T, I>::new(new_free - old_free));
|
||||
} else if new_free < old_free {
|
||||
mem::drop(NegativeImbalance::<T, I>::new(old_free - new_free));
|
||||
}
|
||||
|
||||
Self::deposit_event(Event::BalanceSet { who, free: new_free });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Exactly as `transfer_allow_death`, except the origin must be root and the source account
|
||||
/// may be specified.
|
||||
#[pallet::call_index(2)]
|
||||
@@ -730,22 +683,6 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias for `transfer_allow_death`, provided only for name-wise compatibility.
|
||||
///
|
||||
/// WARNING: DEPRECATED! Will be released in approximately 3 months.
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(T::WeightInfo::transfer_allow_death())]
|
||||
pub fn transfer(
|
||||
origin: OriginFor<T>,
|
||||
dest: AccountIdLookupOf<T>,
|
||||
#[pallet::compact] value: T::Balance,
|
||||
) -> DispatchResult {
|
||||
let source = ensure_signed(origin)?;
|
||||
let dest = T::Lookup::lookup(dest)?;
|
||||
<Self as fungible::Mutate<_>>::transfer(&source, &dest, value, Expendable)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the regular balance of a given account.
|
||||
///
|
||||
/// The dispatch origin for this call is `root`.
|
||||
|
||||
Reference in New Issue
Block a user