disable permissionless asset creation for Statemint (#669)

* disable permissionless asset creation for Statemint

* cargo fmt

* fix import and call format
This commit is contained in:
Alexander Popiak
2021-10-20 14:55:42 +02:00
committed by GitHub
parent 2ff5f7c443
commit 95a453eac4
+14 -2
View File
@@ -43,7 +43,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee}; use constants::{currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, match_type, parameter_types, construct_runtime, match_type, parameter_types,
traits::{Everything, InstanceFilter, Nothing}, traits::{Contains, Everything, InstanceFilter, Nothing},
weights::{ weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight}, constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
DispatchClass, IdentityFee, Weight, DispatchClass, IdentityFee, Weight,
@@ -127,9 +127,21 @@ parameter_types! {
pub const SS58Prefix: u8 = 0; pub const SS58Prefix: u8 = 0;
} }
pub struct BaseFilter;
impl Contains<Call> for BaseFilter {
fn contains(c: &Call) -> bool {
// Disable permissionless asset creation.
!matches!(
c,
Call::Assets(pallet_assets::Call::create { .. }) |
Call::Uniques(pallet_uniques::Call::create { .. })
)
}
}
// Configure FRAME pallets to include in runtime. // Configure FRAME pallets to include in runtime.
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything; type BaseCallFilter = BaseFilter;
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;
type AccountId = AccountId; type AccountId = AccountId;