diff --git a/substrate/frame/assets/src/impl_sufficiency.rs b/substrate/frame/assets/src/impl_sufficiency.rs index 00fdbd2289dd..837cc57cc0f3 100644 --- a/substrate/frame/assets/src/impl_sufficiency.rs +++ b/substrate/frame/assets/src/impl_sufficiency.rs @@ -1,15 +1,34 @@ +// This file is part of Substrate. + +// 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. + +//! Assets pallet's `StoredMap` implementation. + use crate::{ - traits::sufficiency::{Inspect, Mutate}, + traits::sufficiency::{IsSufficient, SetSufficiency}, Asset, Config, Pallet, }; -impl, I: 'static> Inspect<>::AssetId> for Pallet { +impl, I: 'static> IsSufficient<>::AssetId> for Pallet { fn is_sufficient(asset_id: >::AssetId) -> bool { Asset::::get(asset_id).map(|asset| asset.is_sufficient).unwrap_or(false) } } -impl, I: 'static> Mutate<>::AssetId> for Pallet { +impl, I: 'static> SetSufficiency<>::AssetId> for Pallet { fn make_sufficient(asset_id: >::AssetId) -> sp_runtime::DispatchResult { Pallet::::do_set_sufficiency(asset_id, true) } diff --git a/substrate/frame/assets/src/tests.rs b/substrate/frame/assets/src/tests.rs index f5bd8943eeec..a1186a20c3e5 100644 --- a/substrate/frame/assets/src/tests.rs +++ b/substrate/frame/assets/src/tests.rs @@ -102,7 +102,7 @@ fn basic_minting_should_work() { #[test] fn insufficient_assets_can_turn_into_sufficient() { - use sufficiency::{Inspect, Mutate}; + use sufficiency::{IsSufficient, SetSufficiency}; new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); diff --git a/substrate/frame/assets/src/traits.rs b/substrate/frame/assets/src/traits.rs index b5b12c5698e8..d83fd87ab9f2 100644 --- a/substrate/frame/assets/src/traits.rs +++ b/substrate/frame/assets/src/traits.rs @@ -2,13 +2,13 @@ pub mod sufficiency { use sp_runtime::DispatchResult; /// Trait for providing the sufficiency of an asset. - pub trait Inspect { + pub trait IsSufficient { /// Returns whether an asset is sufficient or not. fn is_sufficient(asset_id: AssetId) -> bool; } /// Trait for mutating the sufficiency of an asset - pub trait Mutate { + pub trait SetSufficiency { /// Makes the asset sufficient. fn make_sufficient(asset_id: AssetId) -> DispatchResult;