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:
Doordashcon
2022-08-18 10:30:46 +01:00
committed by GitHub
parent 511e5c9651
commit d46f6f0d34
50 changed files with 465 additions and 309 deletions
+7 -9
View File
@@ -84,6 +84,7 @@ type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
type MaxLocksOf<T> =
<<T as Config>::Currency as LockableCurrency<<T as frame_system::Config>::AccountId>>::MaxLocks;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
const VESTING_ID: LockIdentifier = *b"vesting ";
@@ -321,10 +322,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::vest_other_locked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
.max(T::WeightInfo::vest_other_unlocked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
)]
pub fn vest_other(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
pub fn vest_other(origin: OriginFor<T>, target: AccountIdLookupOf<T>) -> DispatchResult {
ensure_signed(origin)?;
let who = T::Lookup::lookup(target)?;
Self::do_vest(who)
@@ -352,7 +350,7 @@ pub mod pallet {
)]
pub fn vested_transfer(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source,
target: AccountIdLookupOf<T>,
schedule: VestingInfo<BalanceOf<T>, T::BlockNumber>,
) -> DispatchResult {
let transactor = ensure_signed(origin)?;
@@ -383,8 +381,8 @@ pub mod pallet {
)]
pub fn force_vested_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
target: <T::Lookup as StaticLookup>::Source,
source: AccountIdLookupOf<T>,
target: AccountIdLookupOf<T>,
schedule: VestingInfo<BalanceOf<T>, T::BlockNumber>,
) -> DispatchResult {
ensure_root(origin)?;
@@ -494,8 +492,8 @@ impl<T: Config> Pallet<T> {
// Execute a vested transfer from `source` to `target` with the given `schedule`.
fn do_vested_transfer(
source: <T::Lookup as StaticLookup>::Source,
target: <T::Lookup as StaticLookup>::Source,
source: AccountIdLookupOf<T>,
target: AccountIdLookupOf<T>,
schedule: VestingInfo<BalanceOf<T>, T::BlockNumber>,
) -> DispatchResult {
// Validate user inputs.