git.delta.rocks / unique-network / refs/commits / c12e121fed0b

difftreelog

source

primitives/sponsorship/src/lib.rs922 Bsourcehistory
1#![no_std]23pub trait SponsorshipHandler<AccountId, Call> {4	fn get_sponsor(who: &AccountId, call: &Call) -> Option<AccountId>;5}67impl<A, C> SponsorshipHandler<A, C> for () {8	fn get_sponsor(_who: &A, _call: &C) -> Option<A> {9		None10	}11}1213macro_rules! impl_tuples {14	($($ident:ident)+) => {15		impl<AccountId, Call, $($ident),+> SponsorshipHandler<AccountId, Call> for ($($ident,)+)16		where17			$(18				$ident: SponsorshipHandler<AccountId, Call>19			),+20		{21			fn get_sponsor(who: &AccountId, call: &Call) -> Option<AccountId> {22				$(23					if let Some(account) = $ident::get_sponsor(who, call) {24						return Some(account);25					}26				)+27				None28			}29		}30	}31}3233impl_tuples! {A}34impl_tuples! {A B}35impl_tuples! {A B C}36impl_tuples! {A B C D}37impl_tuples! {A B C D E}38impl_tuples! {A B C D E F}39impl_tuples! {A B C D E F G}40impl_tuples! {A B C D E F G H}41impl_tuples! {A B C D E F G H I}42impl_tuples! {A B C D E F G H I J}