Skip to content

Commit

Permalink
nit: use traits::tokens::fungible => use traits::fungible (#1753)
Browse files Browse the repository at this point in the history
Slightly less verbose use of fungible(s).

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
  • Loading branch information
2 people authored and tdimitrov committed Oct 23, 2023
1 parent 3678380 commit 341423e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
.is_empty());

// check update metadata
use frame_support::traits::tokens::fungibles::roles::Inspect as InspectRoles;
use frame_support::traits::fungibles::roles::Inspect as InspectRoles;
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::owner(
asset_id.into()
Expand Down
8 changes: 4 additions & 4 deletions cumulus/parachains/runtimes/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ pub fn assert_metadata<Fungibles, AccountId>(
expected_symbol: &str,
expected_decimals: u8,
) where
Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect<AccountId>
+ frame_support::traits::tokens::fungibles::Inspect<AccountId>,
Fungibles: frame_support::traits::fungibles::metadata::Inspect<AccountId>
+ frame_support::traits::fungibles::Inspect<AccountId>,
{
assert_eq!(Fungibles::name(asset_id.into()), Vec::from(expected_name),);
assert_eq!(Fungibles::symbol(asset_id.into()), Vec::from(expected_symbol),);
Expand All @@ -428,8 +428,8 @@ pub fn assert_total<Fungibles, AccountId>(
expected_total_issuance: impl Into<Fungibles::Balance>,
expected_active_issuance: impl Into<Fungibles::Balance>,
) where
Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect<AccountId>
+ frame_support::traits::tokens::fungibles::Inspect<AccountId>,
Fungibles: frame_support::traits::fungibles::metadata::Inspect<AccountId>
+ frame_support::traits::fungibles::Inspect<AccountId>,
{
assert_eq!(Fungibles::total_issuance(asset_id.into()), expected_total_issuance.into());
assert_eq!(Fungibles::active_issuance(asset_id.into()), expected_active_issuance.into());
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/xcm-builder/src/asset_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM.
//! Adapters to work with [`frame_support::traits::fungibles`] through XCM.

use frame_support::traits::{Contains, Get};
use sp_runtime::traits::MaybeEquivalence;
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/xcm-builder/src/fungibles_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM.
//! Adapters to work with [`frame_support::traits::fungibles`] through XCM.

use frame_support::traits::{
tokens::{
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM.
//! Adapters to work with [`frame_support::traits::fungibles`] through XCM.

use crate::{AssetChecking, MintLocation};
use frame_support::{
Expand Down
8 changes: 4 additions & 4 deletions substrate/frame/assets/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ fn freezer_should_work() {

#[test]
fn imbalances_should_work() {
use frame_support::traits::tokens::fungibles::Balanced;
use frame_support::traits::fungibles::Balanced;

new_test_ext().execute_with(|| {
assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1));
Expand Down Expand Up @@ -1591,7 +1591,7 @@ fn assets_from_genesis_should_exist() {
#[test]
fn querying_name_symbol_and_decimals_should_work() {
new_test_ext().execute_with(|| {
use frame_support::traits::tokens::fungibles::metadata::Inspect;
use frame_support::traits::fungibles::metadata::Inspect;
assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1));
assert_ok!(Assets::force_set_metadata(
RuntimeOrigin::root(),
Expand All @@ -1610,7 +1610,7 @@ fn querying_name_symbol_and_decimals_should_work() {
#[test]
fn querying_allowance_should_work() {
new_test_ext().execute_with(|| {
use frame_support::traits::tokens::fungibles::approvals::{Inspect, Mutate};
use frame_support::traits::fungibles::approvals::{Inspect, Mutate};
assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1));
assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100));
Balances::make_free_balance_be(&1, 2);
Expand All @@ -1635,7 +1635,7 @@ fn transfer_large_asset() {
#[test]
fn querying_roles_should_work() {
new_test_ext().execute_with(|| {
use frame_support::traits::tokens::fungibles::roles::Inspect;
use frame_support::traits::fungibles::roles::Inspect;
assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1));
assert_ok!(Assets::set_team(
RuntimeOrigin::signed(1),
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/balances/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
parameter_types,
traits::{
tokens::fungible, ConstU32, ConstU64, ConstU8, Imbalance as ImbalanceT, OnUnbalanced,
fungible, ConstU32, ConstU64, ConstU8, Imbalance as ImbalanceT, OnUnbalanced,
StorageMapShim, StoredMap, WhitelistedStorageKeys,
},
weights::{IdentityFee, Weight},
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/examples/kitchensink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub mod pallet {
type WeightInfo: WeightInfo;

/// This is a normal Rust type, nothing specific to FRAME here.
type Currency: frame_support::traits::tokens::fungible::Inspect<Self::AccountId>;
type Currency: frame_support::traits::fungible::Inspect<Self::AccountId>;

/// Similarly, let the runtime decide this.
fn some_function() -> u32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl<
Balance,
AssetIdType,
AssetId: Get<AssetIdType>,
Handler: crate::traits::tokens::fungibles::HandleImbalanceDrop<AssetIdType, Balance>,
Handler: crate::traits::fungibles::HandleImbalanceDrop<AssetIdType, Balance>,
> HandleImbalanceDrop<Balance>
for ConvertImbalanceDropHandler<AccountId, Balance, AssetIdType, AssetId, Handler>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchInfo, DispatchResult, PostDispatchInfo},
traits::{
tokens::fungibles::{Balanced, Inspect},
fungibles::{Balanced, Inspect},
IsType,
},
DefaultNoBound,
Expand Down

0 comments on commit 341423e

Please sign in to comment.