diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index ad74495ce090..9a7a542b336d 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -240,6 +240,9 @@ pub mod pallet { /// /// NOTE: This parameter is also used within the Bounties Pallet extension if enabled. #[pallet::constant] + #[deprecated( + note = "TODO: better deprecation message" + )] type MaxApprovals: Get; /// The origin required for approving spends from the treasury outside of the proposal @@ -279,10 +282,16 @@ pub mod pallet { /// Number of proposals that have been made. #[pallet::storage] + #[deprecated( + note = "TODO: better deprecation message" + )] pub type ProposalCount = StorageValue<_, ProposalIndex, ValueQuery>; /// Proposals that have been made. #[pallet::storage] + #[deprecated( + note = "TODO: better deprecation message" + )] pub type Proposals, I: 'static = ()> = StorageMap< _, Twox64Concat, @@ -298,6 +307,9 @@ pub mod pallet { /// Proposal indices that have been approved but not yet awarded. #[pallet::storage] + #[deprecated( + note = "TODO: better deprecation message" + )] pub type Approvals, I: 'static = ()> = StorageValue<_, BoundedVec, ValueQuery>; @@ -449,6 +461,25 @@ pub mod pallet { spend_in_context: BTreeMap, } + impl, I: 'static> Pay for Pallet { + type Beneficiary = T::Beneficiary; + type Balance = AssetBalanceOf; + type Id = ::Id; + type AssetKind = T::AssetKind; + type Error = <>::Paymaster as frame_support::traits::tokens::Pay>::Error; + + fn pay( + beneficiary: &Self::Beneficiary, + asset_kind: Self::AssetKind, + amount: Self::Balance, + ) -> Result { + T::Paymaster::pay(beneficiary, asset_kind, amount) + } + fn check_payment(id: Self::Id) -> PaymentStatus { + T::Paymaster::check_payment(id) + } + } + #[pallet::call] impl, I: 'static> Pallet { /// Propose and approve a spend of treasury funds. @@ -470,6 +501,7 @@ pub mod pallet { /// Emits [`Event::SpendApproved`] if successful. #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::spend_local())] + #[deprecated(note = "TODO: better deprecation message")] pub fn spend_local( origin: OriginFor, #[pallet::compact] amount: BalanceOf, @@ -538,6 +570,9 @@ pub mod pallet { /// in the first place. #[pallet::call_index(4)] #[pallet::weight((T::WeightInfo::remove_approval(), DispatchClass::Operational))] + #[deprecated( + note = "TODO: suggest alternative. `remove_approval` will be removed in May 2025" + )] pub fn remove_approval( origin: OriginFor, #[pallet::compact] proposal_id: ProposalIndex, @@ -680,7 +715,7 @@ pub mod pallet { Error::::AlreadyAttempted ); - let id = T::Paymaster::pay(&spend.beneficiary, spend.asset_kind.clone(), spend.amount) + let id = as Pay>::pay(&spend.beneficiary, spend.asset_kind.clone(), spend.amount) .map_err(|_| Error::::PayoutError)?; spend.status = PaymentState::Attempted { id }; @@ -793,16 +828,25 @@ impl, I: 'static> Pallet { } /// Public function to proposal_count storage. + #[deprecated( + note = "TODO: better deprecation message" + )] pub fn proposal_count() -> ProposalIndex { ProposalCount::::get() } /// Public function to proposals storage. + #[deprecated( + note = "TODO: better deprecation message" + )] pub fn proposals(index: ProposalIndex) -> Option>> { Proposals::::get(index) } /// Public function to approvals storage. + #[deprecated( + note = "TODO: better deprecation message" + )] pub fn approvals() -> BoundedVec { Approvals::::get() }