mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Replace T::AccountId with <T::Lookup as StaticLookup>::Source (#11670)
* initial * update * update * update * cargo fmt * update * update benchmarks * AccountIdLookupOf<T> * cargo fmt * fix conflits * cargo fmt * update Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -61,7 +61,7 @@ pub mod migrations;
|
||||
pub mod weights;
|
||||
|
||||
use sp_runtime::{
|
||||
traits::{AccountIdConversion, BadOrigin, Hash, TrailingZeroInput, Zero},
|
||||
traits::{AccountIdConversion, BadOrigin, Hash, StaticLookup, TrailingZeroInput, Zero},
|
||||
Percent, RuntimeDebug,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
@@ -80,6 +80,7 @@ pub use weights::WeightInfo;
|
||||
|
||||
pub type BalanceOf<T, I = ()> = pallet_treasury::BalanceOf<T, I>;
|
||||
pub type NegativeImbalanceOf<T, I = ()> = pallet_treasury::NegativeImbalanceOf<T, I>;
|
||||
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
|
||||
|
||||
/// An open tipping "motion". Retains all details of a tip including information on the finder
|
||||
/// and the members who have voted.
|
||||
@@ -237,9 +238,10 @@ pub mod pallet {
|
||||
pub fn report_awesome(
|
||||
origin: OriginFor<T>,
|
||||
reason: Vec<u8>,
|
||||
who: T::AccountId,
|
||||
who: AccountIdLookupOf<T>,
|
||||
) -> DispatchResult {
|
||||
let finder = ensure_signed(origin)?;
|
||||
let who = T::Lookup::lookup(who)?;
|
||||
|
||||
ensure!(
|
||||
reason.len() <= T::MaximumReasonLength::get() as usize,
|
||||
@@ -331,10 +333,11 @@ pub mod pallet {
|
||||
pub fn tip_new(
|
||||
origin: OriginFor<T>,
|
||||
reason: Vec<u8>,
|
||||
who: T::AccountId,
|
||||
who: AccountIdLookupOf<T>,
|
||||
#[pallet::compact] tip_value: BalanceOf<T, I>,
|
||||
) -> DispatchResult {
|
||||
let tipper = ensure_signed(origin)?;
|
||||
let who = T::Lookup::lookup(who)?;
|
||||
ensure!(T::Tippers::contains(&tipper), BadOrigin);
|
||||
let reason_hash = T::Hashing::hash(&reason[..]);
|
||||
ensure!(!Reasons::<T, I>::contains_key(&reason_hash), Error::<T, I>::AlreadyKnown);
|
||||
|
||||
Reference in New Issue
Block a user