[−][src]Trait pallet_commodities::nft::UniqueAssets
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.
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>
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
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.
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
fn total() -> u128
[src]
fn burned() -> u128
[src]
fn total_for_account(account: &T::AccountId) -> u64
[src]
fn assets_for_account(
account: &T::AccountId
) -> Vec<Commodity<CommodityId<T>, <T as Trait<I>>::CommodityInfo>>
[src]
account: &T::AccountId
) -> Vec<Commodity<CommodityId<T>, <T as Trait<I>>::CommodityInfo>>
fn owner_of(commodity_id: &CommodityId<T>) -> T::AccountId
[src]
fn mint(
owner_account: &T::AccountId,
commodity_info: <T as Trait<I>>::CommodityInfo
) -> Result<CommodityId<T>, DispatchError>
[src]
owner_account: &T::AccountId,
commodity_info: <T as Trait<I>>::CommodityInfo
) -> Result<CommodityId<T>, DispatchError>
fn burn(commodity_id: &CommodityId<T>) -> DispatchResult
[src]
fn transfer(
dest_account: &T::AccountId,
commodity_id: &CommodityId<T>
) -> DispatchResult
[src]
dest_account: &T::AccountId,
commodity_id: &CommodityId<T>
) -> DispatchResult