Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "htt
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }

sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-block-builder = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand Down Expand Up @@ -90,6 +91,7 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
"pallet-teerex/std",
"pallet-proxy/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
92 changes: 88 additions & 4 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use codec::{Decode, Encode, MaxEncodedLen};
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
Expand All @@ -44,7 +44,7 @@ pub use frame_support::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
IdentityFee, Weight,
},
PalletId, StorageValue,
PalletId, StorageValue, RuntimeDebug,
};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_timestamp::Call as TimestampCall;
Expand All @@ -53,10 +53,9 @@ use pallet_transaction_payment::CurrencyAdapter;
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};
use frame_system::EnsureRoot;

/// added by Integritee
pub use pallet_teerex;
use frame_support::traits::{OnUnbalanced, Imbalance};
use frame_support::traits::{OnUnbalanced, Imbalance, InstanceFilter};


/// An index to a block.
Expand Down Expand Up @@ -402,6 +401,90 @@ impl pallet_multisig::Config for Runtime {
type WeightInfo = ();
}

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;
pub const AnnouncementDepositBase: Balance = deposit(1, 8);
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
pub const MaxPending: u16 = 32;
}

/// The type used to represent the kinds of proxying allowed.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen,
)]
pub enum ProxyType {
Any, //any transactions
NonTransfer, //any type of transaction except balance transfers (including vested transfers)
Governance,
//Staking = 3,
//IdentityJudgement = 4,
CancelProxy,
//Auction,
}
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::NonTransfer => matches!(
c,
Call::System(..) |
Call::Timestamp(..) |
// Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet
Call::Grandpa(..) |
Call::Treasury(..) |
// Call::Vesting(pallet_vesting::Call::vest(..)) |
// Call::Vesting(pallet_vesting::Call::vest_other(..)) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Proxy(..) |
Call::Multisig(..)
),
ProxyType::Governance => {
matches!(
c,
Call::Treasury(..)
)
},
ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement(..)))
},
}
}
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
(ProxyType::NonTransfer, _) => true,
_ => false,
}
}
}

impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = ();
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Expand All @@ -421,6 +504,7 @@ construct_runtime!(
Teerex: pallet_teerex::{Pallet, Call, Storage, Event<T>},
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>},
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>},
}
);

Expand Down