mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 14:01:06 +00:00
Westend: Fellowship Treasury (#2532)
Treasury Pallet Instance for the Fellowship in Westend Collectives. In this update, we present a Treasury Pallet Instance that is under the control of the Fellowship body, with oversight from the Root and Treasurer origins. Here's how it is governed: - the Root origin have the authority to reject or approve spend proposals, with no amount limit for approvals. - the Treasurer origin have the authority to reject or approve spend proposals, with approval limits of up to 10,000,000 DOT. - Voice of all Fellows ranked at 3 or above can reject or approve spend proposals, with a maximum approval limit of 10,000 DOT. - Voice of Fellows ranked at 4 or above can also reject or approve spend proposals, with a maximum approval limit of 10,000,000 DOT. Additionally, we introduce the Asset Rate Pallet Instance to establish conversion rates from asset A to B. This is used to determine if a proposed spend amount involving a non-native asset is permissible by the commanding origin. The rates can be set up by the Root, Treasurer origins, or Voice of all Fellows. --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: joepetrowski <joe@parity.io>
This commit is contained in:
@@ -149,8 +149,11 @@ impl TryConvert<&VersionedMultiLocation, xcm::latest::MultiLocation>
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub mod benchmarks {
|
||||
use super::VersionedLocatableAsset;
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::traits::Get;
|
||||
use pallet_asset_rate::AssetKindFactory;
|
||||
use pallet_treasury::ArgumentsFactory as TreasuryArgumentsFactory;
|
||||
use sp_core::{ConstU32, ConstU8};
|
||||
use xcm::prelude::*;
|
||||
|
||||
/// Provides a factory method for the [`VersionedLocatableAsset`].
|
||||
@@ -172,12 +175,22 @@ pub mod benchmarks {
|
||||
/// Provide factory methods for the [`VersionedLocatableAsset`] and the `Beneficiary` of the
|
||||
/// [`VersionedMultiLocation`]. The location of the asset is determined as a Parachain with an
|
||||
/// ID equal to the passed seed.
|
||||
pub struct TreasuryArguments;
|
||||
impl TreasuryArgumentsFactory<VersionedLocatableAsset, VersionedMultiLocation>
|
||||
for TreasuryArguments
|
||||
pub struct TreasuryArguments<Parents = ConstU8<0>, ParaId = ConstU32<0>>(
|
||||
PhantomData<(Parents, ParaId)>,
|
||||
);
|
||||
impl<Parents: Get<u8>, ParaId: Get<u32>>
|
||||
TreasuryArgumentsFactory<VersionedLocatableAsset, VersionedMultiLocation>
|
||||
for TreasuryArguments<Parents, ParaId>
|
||||
{
|
||||
fn create_asset_kind(seed: u32) -> VersionedLocatableAsset {
|
||||
AssetRateArguments::create_asset_kind(seed)
|
||||
VersionedLocatableAsset::V3 {
|
||||
location: xcm::v3::MultiLocation::new(Parents::get(), X1(Parachain(ParaId::get()))),
|
||||
asset_id: xcm::v3::MultiLocation::new(
|
||||
0,
|
||||
X2(PalletInstance(seed.try_into().unwrap()), GeneralIndex(seed.into())),
|
||||
)
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
fn create_beneficiary(seed: [u8; 32]) -> VersionedMultiLocation {
|
||||
VersionedMultiLocation::V3(xcm::v3::MultiLocation::new(
|
||||
|
||||
@@ -124,6 +124,7 @@ pub mod xcm {
|
||||
const ROOT_INDEX: u32 = 0;
|
||||
// The bodies corresponding to the Polkadot OpenGov Origins.
|
||||
pub const FELLOWSHIP_ADMIN_INDEX: u32 = 1;
|
||||
pub const TREASURER_INDEX: u32 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use super::{
|
||||
GeneralAdmin, ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin,
|
||||
TransactionByteFee, Treasury, WeightToFee, XcmPallet,
|
||||
};
|
||||
|
||||
use crate::governance::pallet_custom_origins::Treasurer;
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
@@ -34,7 +34,9 @@ use runtime_common::{
|
||||
};
|
||||
use sp_core::ConstU32;
|
||||
use westend_runtime_constants::{
|
||||
currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX,
|
||||
currency::CENTS,
|
||||
system_parachain::*,
|
||||
xcm::body::{FELLOWSHIP_ADMIN_INDEX, TREASURER_INDEX},
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
@@ -198,6 +200,8 @@ parameter_types! {
|
||||
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
|
||||
// FellowshipAdmin pluralistic body.
|
||||
pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX);
|
||||
// `Treasurer` pluralistic body.
|
||||
pub const TreasurerBodyId: BodyId = BodyId::Index(TREASURER_INDEX);
|
||||
}
|
||||
|
||||
/// Type to convert the `GeneralAdmin` origin to a Plurality `MultiLocation` value.
|
||||
@@ -220,6 +224,9 @@ pub type StakingAdminToPlurality =
|
||||
pub type FellowshipAdminToPlurality =
|
||||
OriginToPluralityVoice<RuntimeOrigin, FellowshipAdmin, FellowshipAdminBodyId>;
|
||||
|
||||
/// Type to convert the `Treasurer` origin to a Plurality `MultiLocation` value.
|
||||
pub type TreasurerToPlurality = OriginToPluralityVoice<RuntimeOrigin, Treasurer, TreasurerBodyId>;
|
||||
|
||||
/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an
|
||||
/// interior location of this chain for a destination chain.
|
||||
pub type LocalPalletOriginToLocation = (
|
||||
@@ -229,6 +236,8 @@ pub type LocalPalletOriginToLocation = (
|
||||
StakingAdminToPlurality,
|
||||
// FellowshipAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||
FellowshipAdminToPlurality,
|
||||
// `Treasurer` origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||
TreasurerToPlurality,
|
||||
);
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user