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 e55669cc3e
commit 75c09157b2
@@ -43,7 +43,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, match_type, parameter_types,
traits::{Everything, InstanceFilter, Nothing},
traits::{Contains, Everything, InstanceFilter, Nothing},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
DispatchClass, IdentityFee, Weight,
@@ -127,9 +127,21 @@ parameter_types! {
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.
impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything;
type BaseCallFilter = BaseFilter;
type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength;
type AccountId = AccountId;