feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,223 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! New governance configurations for the Kusama runtime.
|
||||
|
||||
use super::*;
|
||||
use crate::xcm_config::Collectives;
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, tokens::UnityOrOuterConversion, EitherOf, EitherOfDiverse,
|
||||
FromContains, LinearStoragePrice,
|
||||
},
|
||||
};
|
||||
use pezframe_system::EnsureRootWithSuccess;
|
||||
use pezpallet_xcm::{EnsureXcm, IsVoiceOfBody};
|
||||
use pezkuwi_runtime_common::impls::{
|
||||
ContainsParts, LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter,
|
||||
};
|
||||
use pezsp_runtime::{traits::IdentityLookup, Percent};
|
||||
use xcm::latest::{
|
||||
prelude::{InteriorLocation, PalletInstance},
|
||||
BodyId,
|
||||
};
|
||||
|
||||
mod origins;
|
||||
pub use origins::{
|
||||
pezpallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin,
|
||||
ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller,
|
||||
};
|
||||
mod tracks;
|
||||
pub use tracks::TracksInfo;
|
||||
use xcm_builder::PayOverXcm;
|
||||
|
||||
parameter_types! {
|
||||
pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
|
||||
}
|
||||
|
||||
impl pezpallet_conviction_voting::Config for Runtime {
|
||||
type WeightInfo = weights::pezpallet_conviction_voting::WeightInfo<Self>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Currency = Balances;
|
||||
type VoteLockingPeriod = VoteLockingPeriod;
|
||||
type MaxVotes = ConstU32<512>;
|
||||
type MaxTurnout =
|
||||
pezframe_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>;
|
||||
type Polls = Referenda;
|
||||
type BlockNumberProvider = RelayChainBlockNumberProvider;
|
||||
type VotingHooks = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AlarmInterval: BlockNumber = 1;
|
||||
pub const SubmissionDeposit: Balance = 1 * 3 * CENTS;
|
||||
pub const UndecidingTimeout: BlockNumber = 14 * DAYS;
|
||||
}
|
||||
|
||||
impl origins::pezpallet_custom_origins::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
// Fellows pluralistic body.
|
||||
pub const FellowsBodyId: BodyId = BodyId::Technical;
|
||||
}
|
||||
|
||||
impl pezpallet_whitelist::Config for Runtime {
|
||||
type WeightInfo = weights::pezpallet_whitelist::WeightInfo<Self>;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WhitelistOrigin = EitherOfDiverse<
|
||||
EnsureRoot<Self::AccountId>,
|
||||
EnsureXcm<IsVoiceOfBody<Collectives, FellowsBodyId>>,
|
||||
>;
|
||||
type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
|
||||
type Preimages = Preimage;
|
||||
}
|
||||
|
||||
impl pezpallet_referenda::Config for Runtime {
|
||||
type WeightInfo = weights::pezpallet_referenda::WeightInfo<Self>;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Scheduler = Scheduler;
|
||||
type Currency = Balances;
|
||||
type SubmitOrigin = pezframe_system::EnsureSigned<AccountId>;
|
||||
type CancelOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>;
|
||||
type KillOrigin = EitherOf<EnsureRoot<AccountId>, ReferendumKiller>;
|
||||
type Slash = Treasury;
|
||||
type Votes = pezpallet_conviction_voting::VotesOf<Runtime>;
|
||||
type Tally = pezpallet_conviction_voting::TallyOf<Runtime>;
|
||||
type SubmissionDeposit = SubmissionDeposit;
|
||||
type MaxQueued = ConstU32<100>;
|
||||
type UndecidingTimeout = UndecidingTimeout;
|
||||
type AlarmInterval = AlarmInterval;
|
||||
type Tracks = TracksInfo;
|
||||
type Preimages = Preimage;
|
||||
type BlockNumberProvider = RelayChainBlockNumberProvider;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const SpendPeriod: BlockNumber = 6 * DAYS;
|
||||
pub const Burn: Permill = Permill::from_perthousand(2);
|
||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||
pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
|
||||
// The asset's interior location for the paying account. This is the Treasury
|
||||
// pallet instance (which sits at index 37).
|
||||
pub TreasuryInteriorLocation: InteriorLocation = PalletInstance(37).into();
|
||||
|
||||
pub const TipCountdown: BlockNumber = 1 * DAYS;
|
||||
pub const TipFindersFee: Percent = Percent::from_percent(20);
|
||||
pub const TipReportDepositBase: Balance = 100 * CENTS;
|
||||
pub const DataDepositPerByte: Balance = 1 * CENTS;
|
||||
pub const MaxApprovals: u32 = 100;
|
||||
pub const MaxAuthorities: u32 = 100_000;
|
||||
pub const MaxKeys: u32 = 10_000;
|
||||
pub const MaxPeerInHeartbeats: u32 = 10_000;
|
||||
pub const MaxBalance: Balance = Balance::max_value();
|
||||
}
|
||||
|
||||
pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
|
||||
|
||||
impl pezpallet_treasury::Config for Runtime {
|
||||
type PalletId = TreasuryPalletId;
|
||||
type Currency = Balances;
|
||||
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
type BurnDestination = ();
|
||||
type MaxApprovals = MaxApprovals;
|
||||
type WeightInfo = weights::pezpallet_treasury::WeightInfo<Runtime>;
|
||||
type SpendFunds = ();
|
||||
type SpendOrigin = TreasurySpender;
|
||||
type AssetKind = VersionedLocatableAsset;
|
||||
type Beneficiary = VersionedLocation;
|
||||
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
|
||||
type Paymaster = PayOverXcm<
|
||||
TreasuryInteriorLocation,
|
||||
crate::xcm_config::XcmRouter,
|
||||
crate::PezkuwiXcm,
|
||||
ConstU32<{ 6 * HOURS }>,
|
||||
Self::Beneficiary,
|
||||
Self::AssetKind,
|
||||
LocatableAssetConverter,
|
||||
VersionedLocationConverter,
|
||||
>;
|
||||
type BalanceConverter = UnityOrOuterConversion<
|
||||
ContainsParts<
|
||||
FromContains<
|
||||
xcm_builder::IsChildSystemTeyrchain<ParaId>,
|
||||
xcm_builder::IsParentsOnly<ConstU8<1>>,
|
||||
>,
|
||||
>,
|
||||
AssetRate,
|
||||
>;
|
||||
type PayoutPeriod = PayoutSpendPeriod;
|
||||
type BlockNumberProvider = RelayChainBlockNumberProvider;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type BenchmarkHelper = pezkuwi_runtime_common::impls::benchmarks::TreasuryArguments;
|
||||
}
|
||||
impl pezpallet_asset_rate::Config for Runtime {
|
||||
type WeightInfo = weights::pezpallet_asset_rate::WeightInfo<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type CreateOrigin = EnsureRoot<AccountId>;
|
||||
type RemoveOrigin = EnsureRoot<AccountId>;
|
||||
type UpdateOrigin = EnsureRoot<AccountId>;
|
||||
type Currency = Balances;
|
||||
type AssetKind = <Runtime as pezpallet_treasury::Config>::AssetKind;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type BenchmarkHelper = pezkuwi_runtime_common::impls::benchmarks::AssetRateArguments;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub MaximumSchedulerWeight: pezframe_support::weights::Weight = Perbill::from_percent(80) *
|
||||
RuntimeBlockWeights::get().max_block;
|
||||
pub const MaxScheduledPerBlock: u32 = 50;
|
||||
pub const NoPreimagePostponement: Option<u32> = Some(10);
|
||||
}
|
||||
|
||||
impl pezpallet_scheduler::Config for Runtime {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type MaximumWeight = MaximumSchedulerWeight;
|
||||
type ScheduleOrigin = EnsureRoot<AccountId>;
|
||||
type MaxScheduledPerBlock = MaxScheduledPerBlock;
|
||||
type WeightInfo = weights::pezpallet_scheduler::WeightInfo<Runtime>;
|
||||
type OriginPrivilegeCmp = pezframe_support::traits::EqualPrivilegeOnly;
|
||||
type Preimages = Preimage;
|
||||
type BlockNumberProvider = RelayChainBlockNumberProvider;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
|
||||
pub const PreimageByteDeposit: Balance = deposit(0, 1);
|
||||
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pezpallet_preimage::HoldReason::Preimage);
|
||||
}
|
||||
|
||||
impl pezpallet_preimage::Config for Runtime {
|
||||
type WeightInfo = weights::pezpallet_preimage::WeightInfo<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Currency = Balances;
|
||||
type ManagerOrigin = EnsureRoot<AccountId>;
|
||||
type Consideration = HoldConsideration<
|
||||
AccountId,
|
||||
Balances,
|
||||
PreimageHoldReason,
|
||||
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
|
||||
>;
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Custom origins for governance interventions.
|
||||
|
||||
pub use pezpallet_custom_origins::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pezpallet_custom_origins {
|
||||
use crate::{Balance, CENTS, GRAND};
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[derive(
|
||||
PartialEq,
|
||||
Eq,
|
||||
Clone,
|
||||
MaxEncodedLen,
|
||||
Encode,
|
||||
Decode,
|
||||
DecodeWithMemTracking,
|
||||
TypeInfo,
|
||||
RuntimeDebug,
|
||||
)]
|
||||
#[pallet::origin]
|
||||
pub enum Origin {
|
||||
/// Origin for cancelling slashes.
|
||||
StakingAdmin,
|
||||
/// Origin for spending (any amount of) funds.
|
||||
Treasurer,
|
||||
/// Origin for managing the composition of the fellowship.
|
||||
FellowshipAdmin,
|
||||
/// Origin for managing the registrar.
|
||||
GeneralAdmin,
|
||||
/// Origin for starting auctions.
|
||||
AuctionAdmin,
|
||||
/// Origin able to force slot leases.
|
||||
LeaseAdmin,
|
||||
/// Origin able to cancel referenda.
|
||||
ReferendumCanceller,
|
||||
/// Origin able to kill referenda.
|
||||
ReferendumKiller,
|
||||
/// Origin able to spend up to 1 KSM from the treasury at once.
|
||||
SmallTipper,
|
||||
/// Origin able to spend up to 5 KSM from the treasury at once.
|
||||
BigTipper,
|
||||
/// Origin able to spend up to 50 KSM from the treasury at once.
|
||||
SmallSpender,
|
||||
/// Origin able to spend up to 500 KSM from the treasury at once.
|
||||
MediumSpender,
|
||||
/// Origin able to spend up to 5,000 KSM from the treasury at once.
|
||||
BigSpender,
|
||||
/// Origin able to dispatch a whitelisted call.
|
||||
WhitelistedCaller,
|
||||
/// Origin commanded by any members of the Pezkuwi Fellowship (no Dan grade needed).
|
||||
FellowshipInitiates,
|
||||
/// Origin commanded by Pezkuwi Fellows (3rd Dan fellows or greater).
|
||||
Fellows,
|
||||
/// Origin commanded by Pezkuwi Experts (5th Dan fellows or greater).
|
||||
FellowshipExperts,
|
||||
/// Origin commanded by Pezkuwi Masters (7th Dan fellows of greater).
|
||||
FellowshipMasters,
|
||||
/// Origin commanded by rank 1 of the Pezkuwi Fellowship and with a success of 1.
|
||||
Fellowship1Dan,
|
||||
/// Origin commanded by rank 2 of the Pezkuwi Fellowship and with a success of 2.
|
||||
Fellowship2Dan,
|
||||
/// Origin commanded by rank 3 of the Pezkuwi Fellowship and with a success of 3.
|
||||
Fellowship3Dan,
|
||||
/// Origin commanded by rank 4 of the Pezkuwi Fellowship and with a success of 4.
|
||||
Fellowship4Dan,
|
||||
/// Origin commanded by rank 5 of the Pezkuwi Fellowship and with a success of 5.
|
||||
Fellowship5Dan,
|
||||
/// Origin commanded by rank 6 of the Pezkuwi Fellowship and with a success of 6.
|
||||
Fellowship6Dan,
|
||||
/// Origin commanded by rank 7 of the Pezkuwi Fellowship and with a success of 7.
|
||||
Fellowship7Dan,
|
||||
/// Origin commanded by rank 8 of the Pezkuwi Fellowship and with a success of 8.
|
||||
Fellowship8Dan,
|
||||
/// Origin commanded by rank 9 of the Pezkuwi Fellowship and with a success of 9.
|
||||
Fellowship9Dan,
|
||||
}
|
||||
|
||||
macro_rules! decl_unit_ensures {
|
||||
( $name:ident: $success_type:ty = $success:expr ) => {
|
||||
pub struct $name;
|
||||
impl<O: Into<Result<Origin, O>> + From<Origin>>
|
||||
EnsureOrigin<O> for $name
|
||||
{
|
||||
type Success = $success_type;
|
||||
fn try_origin(o: O) -> Result<Self::Success, O> {
|
||||
o.into().and_then(|o| match o {
|
||||
Origin::$name => Ok($success),
|
||||
r => Err(O::from(r)),
|
||||
})
|
||||
}
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<O, ()> {
|
||||
Ok(O::from(Origin::$name))
|
||||
}
|
||||
}
|
||||
};
|
||||
( $name:ident ) => { decl_unit_ensures! { $name : () = () } };
|
||||
( $name:ident: $success_type:ty = $success:expr, $( $rest:tt )* ) => {
|
||||
decl_unit_ensures! { $name: $success_type = $success }
|
||||
decl_unit_ensures! { $( $rest )* }
|
||||
};
|
||||
( $name:ident, $( $rest:tt )* ) => {
|
||||
decl_unit_ensures! { $name }
|
||||
decl_unit_ensures! { $( $rest )* }
|
||||
};
|
||||
() => {}
|
||||
}
|
||||
decl_unit_ensures!(
|
||||
StakingAdmin,
|
||||
Treasurer,
|
||||
FellowshipAdmin,
|
||||
GeneralAdmin,
|
||||
AuctionAdmin,
|
||||
LeaseAdmin,
|
||||
ReferendumCanceller,
|
||||
ReferendumKiller,
|
||||
WhitelistedCaller,
|
||||
FellowshipInitiates: u16 = 0,
|
||||
Fellows: u16 = 3,
|
||||
FellowshipExperts: u16 = 5,
|
||||
FellowshipMasters: u16 = 7,
|
||||
);
|
||||
|
||||
macro_rules! decl_ensure {
|
||||
(
|
||||
$vis:vis type $name:ident: EnsureOrigin<Success = $success_type:ty> {
|
||||
$( $item:ident = $success:expr, )*
|
||||
}
|
||||
) => {
|
||||
$vis struct $name;
|
||||
impl<O: Into<Result<Origin, O>> + From<Origin>>
|
||||
EnsureOrigin<O> for $name
|
||||
{
|
||||
type Success = $success_type;
|
||||
fn try_origin(o: O) -> Result<Self::Success, O> {
|
||||
o.into().and_then(|o| match o {
|
||||
$(
|
||||
Origin::$item => Ok($success),
|
||||
)*
|
||||
r => Err(O::from(r)),
|
||||
})
|
||||
}
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<O, ()> {
|
||||
// By convention the more privileged origins go later, so for greatest chance
|
||||
// of success, we want the last one.
|
||||
let _result: Result<O, ()> = Err(());
|
||||
$(
|
||||
let _result: Result<O, ()> = Ok(O::from(Origin::$item));
|
||||
)*
|
||||
_result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decl_ensure! {
|
||||
pub type Spender: EnsureOrigin<Success = Balance> {
|
||||
SmallTipper = 250 * 3 * CENTS,
|
||||
BigTipper = 1 * GRAND,
|
||||
SmallSpender = 10 * GRAND,
|
||||
MediumSpender = 100 * GRAND,
|
||||
BigSpender = 1_000 * GRAND,
|
||||
Treasurer = 10_000 * GRAND,
|
||||
}
|
||||
}
|
||||
|
||||
decl_ensure! {
|
||||
pub type EnsureFellowship: EnsureOrigin<Success = u16> {
|
||||
Fellowship1Dan = 1,
|
||||
Fellowship2Dan = 2,
|
||||
Fellowship3Dan = 3,
|
||||
Fellowship4Dan = 4,
|
||||
Fellowship5Dan = 5,
|
||||
Fellowship6Dan = 6,
|
||||
Fellowship7Dan = 7,
|
||||
Fellowship8Dan = 8,
|
||||
Fellowship9Dan = 9,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Track configurations for governance.
|
||||
|
||||
use super::*;
|
||||
|
||||
use alloc::borrow::Cow;
|
||||
use pezsp_runtime::str_array as s;
|
||||
|
||||
const fn percent(x: i32) -> pezsp_arithmetic::FixedI64 {
|
||||
pezsp_arithmetic::FixedI64::from_rational(x as u128, 100)
|
||||
}
|
||||
use pezpallet_referenda::Curve;
|
||||
const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
|
||||
const APP_STAKING_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_STAKING_ADMIN: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_TREASURER: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
|
||||
const APP_FELLOWSHIP_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_FELLOWSHIP_ADMIN: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_GENERAL_ADMIN: Curve =
|
||||
Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_GENERAL_ADMIN: Curve =
|
||||
Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50));
|
||||
const APP_AUCTION_ADMIN: Curve =
|
||||
Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_AUCTION_ADMIN: Curve =
|
||||
Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50));
|
||||
const APP_LEASE_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_LEASE_ADMIN: Curve = Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_REFERENDUM_CANCELLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_REFERENDUM_CANCELLER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_REFERENDUM_KILLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_REFERENDUM_KILLER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_SMALL_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
|
||||
const SUP_SMALL_TIPPER: Curve = Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(50));
|
||||
const APP_BIG_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
|
||||
const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(1), percent(0), percent(50));
|
||||
const APP_SMALL_SPENDER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_SMALL_SPENDER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_MEDIUM_SPENDER: Curve = Curve::make_linear(23, 28, percent(50), percent(100));
|
||||
const SUP_MEDIUM_SPENDER: Curve =
|
||||
Curve::make_reciprocal(16, 28, percent(1), percent(0), percent(50));
|
||||
const APP_BIG_SPENDER: Curve = Curve::make_linear(28, 28, percent(50), percent(100));
|
||||
const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percent(0), percent(50));
|
||||
const APP_WHITELISTED_CALLER: Curve =
|
||||
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
|
||||
const SUP_WHITELISTED_CALLER: Curve =
|
||||
Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50));
|
||||
|
||||
const TRACKS_DATA: [pezpallet_referenda::Track<u16, Balance, BlockNumber>; 15] = [
|
||||
pezpallet_referenda::Track {
|
||||
id: 0,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("root"),
|
||||
max_deciding: 1,
|
||||
decision_deposit: 100 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_ROOT,
|
||||
min_support: SUP_ROOT,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 1,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("whitelisted_caller"),
|
||||
max_deciding: 100,
|
||||
decision_deposit: 10 * GRAND,
|
||||
prepare_period: 6 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 4 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_WHITELISTED_CALLER,
|
||||
min_support: SUP_WHITELISTED_CALLER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 10,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("staking_admin"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 5 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_STAKING_ADMIN,
|
||||
min_support: SUP_STAKING_ADMIN,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 11,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("treasurer"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 1 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_TREASURER,
|
||||
min_support: SUP_TREASURER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 12,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("lease_admin"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 5 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_LEASE_ADMIN,
|
||||
min_support: SUP_LEASE_ADMIN,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 13,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("fellowship_admin"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 5 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_FELLOWSHIP_ADMIN,
|
||||
min_support: SUP_FELLOWSHIP_ADMIN,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 14,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("general_admin"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 5 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_GENERAL_ADMIN,
|
||||
min_support: SUP_GENERAL_ADMIN,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 15,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("auction_admin"),
|
||||
max_deciding: 10,
|
||||
decision_deposit: 5 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_AUCTION_ADMIN,
|
||||
min_support: SUP_AUCTION_ADMIN,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 20,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("referendum_canceller"),
|
||||
max_deciding: 1_000,
|
||||
decision_deposit: 10 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_REFERENDUM_CANCELLER,
|
||||
min_support: SUP_REFERENDUM_CANCELLER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 21,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("referendum_killer"),
|
||||
max_deciding: 1_000,
|
||||
decision_deposit: 50 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_REFERENDUM_KILLER,
|
||||
min_support: SUP_REFERENDUM_KILLER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 30,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("small_tipper"),
|
||||
max_deciding: 200,
|
||||
decision_deposit: 1 * 3 * CENTS,
|
||||
prepare_period: 1 * MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 4 * MINUTES,
|
||||
min_enactment_period: 1 * MINUTES,
|
||||
min_approval: APP_SMALL_TIPPER,
|
||||
min_support: SUP_SMALL_TIPPER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 31,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("big_tipper"),
|
||||
max_deciding: 100,
|
||||
decision_deposit: 10 * 3 * CENTS,
|
||||
prepare_period: 4 * MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_BIG_TIPPER,
|
||||
min_support: SUP_BIG_TIPPER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 32,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("small_spender"),
|
||||
max_deciding: 50,
|
||||
decision_deposit: 100 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 10 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_SMALL_SPENDER,
|
||||
min_support: SUP_SMALL_SPENDER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 33,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("medium_spender"),
|
||||
max_deciding: 50,
|
||||
decision_deposit: 200 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_MEDIUM_SPENDER,
|
||||
min_support: SUP_MEDIUM_SPENDER,
|
||||
},
|
||||
},
|
||||
pezpallet_referenda::Track {
|
||||
id: 34,
|
||||
info: pezpallet_referenda::TrackInfo {
|
||||
name: s("big_spender"),
|
||||
max_deciding: 50,
|
||||
decision_deposit: 400 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 14 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_BIG_SPENDER,
|
||||
min_support: SUP_BIG_SPENDER,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
pub struct TracksInfo;
|
||||
impl pezpallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
||||
type Id = u16;
|
||||
type RuntimeOrigin = <RuntimeOrigin as pezframe_support::traits::OriginTrait>::PalletsOrigin;
|
||||
|
||||
fn tracks(
|
||||
) -> impl Iterator<Item = Cow<'static, pezpallet_referenda::Track<Self::Id, Balance, BlockNumber>>>
|
||||
{
|
||||
TRACKS_DATA.iter().map(Cow::Borrowed)
|
||||
}
|
||||
fn track_for(id: &Self::RuntimeOrigin) -> Result<Self::Id, ()> {
|
||||
if let Ok(system_origin) = pezframe_system::RawOrigin::try_from(id.clone()) {
|
||||
match system_origin {
|
||||
pezframe_system::RawOrigin::Root => Ok(0),
|
||||
_ => Err(()),
|
||||
}
|
||||
} else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) {
|
||||
match custom_origin {
|
||||
origins::Origin::WhitelistedCaller => Ok(1),
|
||||
// General admin
|
||||
origins::Origin::StakingAdmin => Ok(10),
|
||||
origins::Origin::Treasurer => Ok(11),
|
||||
origins::Origin::LeaseAdmin => Ok(12),
|
||||
origins::Origin::FellowshipAdmin => Ok(13),
|
||||
origins::Origin::GeneralAdmin => Ok(14),
|
||||
origins::Origin::AuctionAdmin => Ok(15),
|
||||
// Referendum admins
|
||||
origins::Origin::ReferendumCanceller => Ok(20),
|
||||
origins::Origin::ReferendumKiller => Ok(21),
|
||||
// Limited treasury spenders
|
||||
origins::Origin::SmallTipper => Ok(30),
|
||||
origins::Origin::BigTipper => Ok(31),
|
||||
origins::Origin::SmallSpender => Ok(32),
|
||||
origins::Origin::MediumSpender => Ok(33),
|
||||
origins::Origin::BigSpender => Ok(34),
|
||||
_ => Err(()),
|
||||
}
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user