[][src]Trait pallet_commodities::nft::UniqueAssets

pub trait UniqueAssets<Asset: NFT> {
    type AccountId;
    type AssetLimit: Get<u128>;
    type UserAssetLimit: Get<u64>;
    fn total() -> u128;
fn burned() -> u128;
fn total_for_account(account: &Self::AccountId) -> u64;
fn assets_for_account(account: &Self::AccountId) -> Vec<Asset>;
fn owner_of(asset_id: &Asset::Id) -> Self::AccountId;
fn mint(
        owner_account: &Self::AccountId,
        asset_info: Asset::Info
    ) -> Result<Asset::Id, DispatchError>;
fn burn(asset_id: &Asset::Id) -> DispatchResult;
fn transfer(
        dest_account: &Self::AccountId,
        asset_id: &Asset::Id
    ) -> DispatchResult; }

An interface over a set of unique assets.

Associated Types

type AccountId

The type used to identify asset owners.

type AssetLimit: Get<u128>

The maximum number of this type of asset that may exist (minted - burned).

type UserAssetLimit: Get<u64>

The maximum number of this type of asset that any single account may own.

Loading content...

Required methods

fn total() -> u128

The total number of this type of asset that exists (minted - burned).

fn burned() -> u128

The total number of this type of asset that has been burned (may overflow).

fn total_for_account(account: &Self::AccountId) -> u64

The total number of this type of asset owned by an account.

fn assets_for_account(account: &Self::AccountId) -> Vec<Asset>

The set of unique assets owned by an account.

fn owner_of(asset_id: &Asset::Id) -> Self::AccountId

The ID of the account that owns an asset.

fn mint(
    owner_account: &Self::AccountId,
    asset_info: Asset::Info
) -> Result<Asset::Id, DispatchError>

Use the provided asset info to create a new unique asset for the specified user. This method must return an error in the following cases:

  • The asset, as identified by the asset info, already exists.
  • The specified owner account has already reached the user asset limit.
  • The total asset limit has already been reached.

fn burn(asset_id: &Asset::Id) -> DispatchResult

Destroy an asset. This method must return an error in the following case:

  • The asset with the specified ID does not exist.

fn transfer(
    dest_account: &Self::AccountId,
    asset_id: &Asset::Id
) -> DispatchResult

Transfer ownership of an asset to another account. This method must return an error in the following cases:

  • The asset with the specified ID does not exist.
  • The destination account has already reached the user asset limit.
Loading content...

Implementors

impl<T: Trait<I>, I: Instance> UniqueAssets<Commodity<<T as Trait>::Hash, <T as Trait<I>>::CommodityInfo>> for Module<T, I>[src]

type AccountId = <T as Trait>::AccountId

type AssetLimit = T::CommodityLimit

type UserAssetLimit = T::UserCommodityLimit

Loading content...