Skip to content

Commit

Permalink
pallet-treasury cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Jan 23, 2025
1 parent 7e4745c commit 16499d7
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 1,851 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 3 additions & 29 deletions runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use frame_support::{
genesis_builder_helper, parameter_types,
traits::{
fungible::{Balanced, Credit, HoldConsideration},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, Contains,
EqualPrivilegeOnly, FindAuthor, Get, Imbalance, InstanceFilter, LinearStoragePrice,
Nothing, OnFinalize, OnUnbalanced, Randomness, WithdrawReasons,
Expand Down Expand Up @@ -63,8 +62,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto,
DispatchInfoOf, Dispatchable, IdentityLookup, OpaqueKeys, PostDispatchInfoOf,
UniqueSaturatedInto, Zero,
DispatchInfoOf, Dispatchable, OpaqueKeys, PostDispatchInfoOf, UniqueSaturatedInto, Zero,
},
transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError},
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Permill, Perquintill, RuntimeDebug,
Expand Down Expand Up @@ -1404,20 +1402,8 @@ impl pallet_treasury::Config<MainTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand All @@ -1444,20 +1430,8 @@ impl pallet_treasury::Config<CommunityTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand Down
32 changes: 3 additions & 29 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use frame_support::{
construct_runtime, genesis_builder_helper, parameter_types,
traits::{
fungible::{Balanced, Credit, HoldConsideration},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Contains, EqualPrivilegeOnly,
FindAuthor, Get, InsideBoth, InstanceFilter, LinearStoragePrice, Nothing, OnFinalize,
WithdrawReasons,
Expand Down Expand Up @@ -56,8 +55,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto,
DispatchInfoOf, Dispatchable, IdentityLookup, NumberFor, PostDispatchInfoOf,
UniqueSaturatedInto,
DispatchInfoOf, Dispatchable, NumberFor, PostDispatchInfoOf, UniqueSaturatedInto,
},
transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError},
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Permill, Perquintill, RuntimeDebug,
Expand Down Expand Up @@ -1048,20 +1046,8 @@ impl pallet_treasury::Config<MainTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand All @@ -1088,20 +1074,8 @@ impl pallet_treasury::Config<CommunityTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand Down
32 changes: 3 additions & 29 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use frame_support::{
genesis_builder_helper, parameter_types,
traits::{
fungible::{Balanced, Credit, HoldConsideration},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, Contains,
EqualPrivilegeOnly, FindAuthor, Get, Imbalance, InsideBoth, InstanceFilter,
LinearStoragePrice, Nothing, OnFinalize, OnUnbalanced, WithdrawReasons,
Expand Down Expand Up @@ -62,8 +61,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto,
DispatchInfoOf, Dispatchable, IdentityLookup, OpaqueKeys, PostDispatchInfoOf,
UniqueSaturatedInto,
DispatchInfoOf, Dispatchable, OpaqueKeys, PostDispatchInfoOf, UniqueSaturatedInto,
},
transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError},
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Permill, Perquintill, RuntimeDebug,
Expand Down Expand Up @@ -1444,20 +1442,8 @@ impl pallet_treasury::Config<MainTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand All @@ -1484,20 +1470,8 @@ impl pallet_treasury::Config<CommunityTreasuryInst> for Runtime {
type Burn = ();
type BurnDestination = ();
type SpendFunds = ();

type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, MainTreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;

// New approach to using treasury, useful for OpenGov but not necessarily for us.
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
// Only used by 'spend' approach which is disabled
type PayoutPeriod = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();

type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
}

Expand Down
2 changes: 1 addition & 1 deletion vendor/treasury/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-treasury"
version = "36.0.1"
version = "37.0.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
homepage = "https://paritytech.github.io/polkadot-sdk/"
Expand Down
25 changes: 0 additions & 25 deletions vendor/treasury/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,3 @@ and use the funds to pay developers.
- **Deposit:** Funds that a proposer must lock when making a proposal. The deposit will be returned
or slashed if the proposal is approved or rejected respectively.
- **Pot:** Unspent funds accumulated by the treasury pallet.

## Interface

### Dispatchable Functions

General spending/proposal protocol:
- `spend_local` - Propose and approve a spend of treasury funds, enables the
creation of spends using the native currency of the chain, utilizing the funds
stored in the pot
- `spend` - Propose and approve a spend of treasury funds, allows spending any
asset kind managed by the treasury
- `remove_approval` - Force a previously approved proposal to be removed from
the approval queue
- `payout` - Claim a spend
- `check_status` - Check the status of the spend and remove it from the storage
if processed
- `void_spend` - Void previously approved spend


## Release

polkadot v1.15.0
- `propose_spend` - Make a spending proposal and stake the required deposit.
- `reject_proposal` - Reject a proposal, slashing the deposit.
- `approve_proposal` - Accept the proposal, returning the deposit.
Loading

0 comments on commit 16499d7

Please sign in to comment.