Skip to content

Commit 1fa0dae

Browse files
committed
added TypedGet implementation to get treasury account
1 parent fac4743 commit 1fa0dae

File tree

1 file changed

+13
-1
lines changed
  • substrate/frame/treasury/src

1 file changed

+13
-1
lines changed

substrate/frame/treasury/src/lib.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ use sp_runtime::{
8686
traits::{AccountIdConversion, CheckedAdd, Saturating, StaticLookup, Zero},
8787
Permill, RuntimeDebug,
8888
};
89-
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
89+
use sp_std::{collections::btree_map::BTreeMap, marker::PhantomData, prelude::*};
9090

9191
use frame_support::{
9292
dispatch::{DispatchResult, DispatchResultWithPostInfo},
@@ -1120,3 +1120,15 @@ impl<T: Config<I>, I: 'static> OnUnbalanced<NegativeImbalanceOf<T, I>> for Palle
11201120
Self::deposit_event(Event::Deposit { value: numeric_amount });
11211121
}
11221122
}
1123+
1124+
/// TypedGet implementation to get the AccountId of the Treasury.
1125+
pub struct TreasuryAccountId<R>(PhantomData<R>);
1126+
impl<R> sp_runtime::traits::TypedGet for TreasuryAccountId<R>
1127+
where
1128+
R: crate::Config,
1129+
{
1130+
type Type = <R as frame_system::Config>::AccountId;
1131+
fn get() -> Self::Type {
1132+
crate::Pallet::<R>::account_id()
1133+
}
1134+
}

0 commit comments

Comments
 (0)