I'm writing a custom pallet that uses AssetsPallet. The idea is to create a call/function that can be called only by the creator of an Asset/Token. I know I need that info from the following struct of Assets pallet:

#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)]
pub struct AssetDetails<Balance, AccountId, DepositBalance> {
    /// Can change `owner`, `issuer`, `freezer` and `admin` accounts.
    pub(super) owner: AccountId,
    /// Can mint tokens.
    pub(super) issuer: AccountId,
    /// Can thaw tokens, force transfers and burn tokens from any account.
    pub(super) admin: AccountId,
    /// Can freeze tokens.
    pub(super) freezer: AccountId,
    /// The total supply across all accounts.
    pub(super) supply: Balance,
    /// The balance deposited for this asset. This pays for the data stored here.
    pub(super) deposit: DepositBalance,
    /// The ED for virtual accounts.
    pub(super) min_balance: Balance,
    /// If `true`, then any account with this asset is given a provider reference. Otherwise, it
    /// requires a consumer reference.
    pub(super) is_sufficient: bool,
    /// The total number of accounts.
    pub(super) accounts: u32,
    /// The total number of accounts for which we have placed a self-sufficient reference.
    pub(super) sufficients: u32,
    /// The total number of approvals.
    pub(super) approvals: u32,
    /// The status of the asset
    pub(super) status: AssetStatus,

That is Stored in the following storage when created:

/// Details of an asset.
pub(super) type Asset<T: Config<I>, I: 'static = ()> = StorageMap<
    AssetDetails<T::Balance, T::AccountId, DepositBalanceOf<T, I>>,

I know this is related to the topic of loose coupling, but the examples I found use a frame_support trait as the link. So I'm not getting how to do it.

1 Answer 1


The idea is to create a call/function that can be called only by the creator of an Asset/Token.

Use this function to get the owner.


Import the frame_support::traits::fungibles::roles::Inspect.

// Your pallet

use frame_support::traits::fungibles::roles::Inspect;

pub trait Config: frame_system::Config {
  type Inspector: Inspect;

impl<T: Config> for Pallet<T> {
  fn is_owner/creator_of(who: &T::AccountId, asset_id: AssetId) -> bool {
    T::Inspector::owner(asset_id).map(|owner| owner == who).unwrap_or_default()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.