Skip to content

Commit 38d2fa8

Browse files
Moliholybkchrgui1117
authored
Add an extra_constant to pallet-treasury (#7918)
Aligned with #7206, this PR exposes `pallet-treasury`'s pot account as an extra constant. Users can this way for instance donate to the chain's treasury account, or founders can easily spot it in case they require to fund it. In any case this greatly reduces errors and headaches trying to figure out what's the pot's address. --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Guillaume Thiolliere <[email protected]>
1 parent 88a31f2 commit 38d2fa8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

prdoc/pr_7918.prdoc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: "Add an extra_constant to pallet-treasury"
5+
6+
doc:
7+
- audience: Runtime Dev
8+
description: |
9+
- Allows to query pallet-treasury's pot account via extra constant.
10+
11+
crates:
12+
- name: pallet-treasury
13+
bump: minor

substrate/frame/treasury/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ pub mod pallet {
289289
type BlockNumberProvider: BlockNumberProvider;
290290
}
291291

292+
#[pallet::extra_constants]
293+
impl<T: Config<I>, I: 'static> Pallet<T, I> {
294+
/// Gets this pallet's derived pot account.
295+
fn pot_account() -> T::AccountId {
296+
Self::account_id()
297+
}
298+
}
299+
292300
/// DEPRECATED: associated with `spend_local` call and will be removed in May 2025.
293301
/// Refer to <https://github.com/paritytech/polkadot-sdk/pull/5961> for migration to `spend`.
294302
///

0 commit comments

Comments
 (0)