mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Generalised proxies in Polkadot (#1190)
* Introduce generalised proxies to polkadot * Introduce proxy to westend * Add proxy to Kusama. * Fix
This commit is contained in:
@@ -22,6 +22,10 @@ pub mod currency {
|
||||
pub const DOLLARS: Balance = DOTS;
|
||||
pub const CENTS: Balance = DOLLARS / 100;
|
||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS
|
||||
}
|
||||
}
|
||||
|
||||
/// Time and blocks.
|
||||
|
||||
@@ -52,8 +52,8 @@ use version::NativeVersion;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_staking::SessionIndex;
|
||||
use frame_support::{
|
||||
parameter_types, construct_runtime, debug,
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness, LockIdentifier, Filter},
|
||||
parameter_types, construct_runtime, debug, RuntimeDebug,
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness, LockIdentifier, Filter, InstanceFilter},
|
||||
weights::Weight,
|
||||
};
|
||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
@@ -762,6 +762,52 @@ impl vesting::Trait for Runtime {
|
||||
type MinVestedTransfer = MinVestedTransfer;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size 32, value size 8; .
|
||||
pub const ProxyDepositBase: Balance = deposit(1, 8);
|
||||
// Additional storage item size of 33 bytes.
|
||||
pub const ProxyDepositFactor: Balance = deposit(0, 33);
|
||||
pub const MaxProxies: u16 = 32;
|
||||
}
|
||||
|
||||
/// The type used to represent the kinds of proxying allowed.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
|
||||
pub enum ProxyType {
|
||||
Any,
|
||||
NonTransfer,
|
||||
Governance,
|
||||
Staking,
|
||||
}
|
||||
impl Default for ProxyType { fn default() -> Self { Self::Any } }
|
||||
impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::Governance => matches!(c,
|
||||
Call::Democracy(..) | Call::Council(..) | Call::TechnicalCommittee(..)
|
||||
| Call::ElectionsPhragmen(..) | Call::Treasury(..)
|
||||
),
|
||||
ProxyType::NonTransfer => !matches!(c,
|
||||
Call::Balances(..) | Call::Utility(..)
|
||||
| Call::Vesting(vesting::Call::vested_transfer(..))
|
||||
| Call::Indices(indices::Call::transfer(..))
|
||||
),
|
||||
ProxyType::Staking => matches!(c, Call::Staking(..)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl proxy::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type IsCallable = IsCallable;
|
||||
type ProxyType = ProxyType;
|
||||
type ProxyDepositBase = ProxyDepositBase;
|
||||
type ProxyDepositFactor = ProxyDepositFactor;
|
||||
type MaxProxies = MaxProxies;
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
@@ -826,6 +872,9 @@ construct_runtime! {
|
||||
|
||||
// System scheduler.
|
||||
Scheduler: scheduler::{Module, Call, Storage, Event<T>},
|
||||
|
||||
// Proxy module. Late addition.
|
||||
Proxy: proxy::{Module, Call, Storage, Event}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user