A simple, secure module for dealing with fungible assets.
The Assets module provides functionality for asset management of fungible asset classes with a fixed supply, including:
- Asset Issuance (Minting)
- Asset Transferal
- Asset Freezing
- Asset Destruction (Burning)
- Delegated Asset Transfers (“Approval API”)
To use it in your runtime, you need to implement the assets
The supported dispatchable functions are documented in the
- Admin: An account ID uniquely privileged to be able to unfreeze (thaw) an account and it’s assets, as well as forcibly transfer a particular class of assets between arbitrary accounts and reduce the balance of a particular class of assets of arbitrary accounts.
- Asset issuance/minting: The creation of a new asset, whose total supply will belong to the account that issues the asset. This is a privileged operation.
- Asset transfer: The reduction of the balance of an asset of one account with the corresponding increase in the balance of another.
- Asset destruction: The process of reduce the balance of an asset of one account. This is a privileged operation.
- Fungible asset: An asset whose units are interchangeable.
- Issuer: An account ID uniquely privileged to be able to mint a particular class of assets.
- Freezer: An account ID uniquely privileged to be able to freeze an account from transferring a particular class of assets.
- Freezing: Removing the possibility of an unpermissioned transfer of an asset from a particular account.
- Non-fungible asset: An asset for which each unit has unique characteristics.
- Owner: An account ID uniquely privileged to be able to destroy a particular asset class, or to set the Issuer, Freezer or Admin of that asset class.
- Approval: The act of allowing an account the permission to transfer some balance of asset from the approving account into some third-party destination account.
- Sufficiency: The idea of a minimum-balance of an asset being sufficient to allow the account’s existence on the system without requiring any other existential-deposit.
The assets system in Substrate is designed to make the following possible:
- Issue a new assets in a permissioned or permissionless way, if permissionless, then with a deposit required.
- Allow accounts to be delegated the ability to transfer assets without otherwise existing on-chain (approvals).
- Move assets between accounts.
- Update the asset’s total supply.
- Allow administrative activities by specially privileged accounts including freezing account balances and minting/burning assets.
create: Creates a new asset class, taking the required deposit.
transfer: Transfer sender’s assets to another account.
transfer_keep_alive: Transfer sender’s assets to another account, keeping the sender alive.
set_metadata: Set the metadata of an asset class.
clear_metadata: Remove the metadata of an asset class.
approve_transfer: Create or increase an delegated transfer.
cancel_approval: Rescind a previous approval.
transfer_approved: Transfer third-party’s assets to another account.
force_create: Creates a new asset class without taking any deposit.
force_set_metadata: Set the metadata of an asset class.
force_clear_metadata: Remove the metadata of an asset class.
force_asset_status: Alter an asset class’s attributes.
force_cancel_approval: Rescind a previous approval.
destroy: Destroys an entire asset class; called by the asset class’s Owner.
mint: Increases the asset balance of an account; called by the asset class’s Issuer.
burn: Decreases the asset balance of an account; called by the asset class’s Admin.
force_transfer: Transfers between arbitrary accounts; called by the asset class’s Admin.
freeze: Disallows further
transfers from an account; called by the asset class’s Freezer.
thaw: Allows further
transfers from an account; called by the asset class’s Admin.
transfer_ownership: Changes an asset class’s Owner; called by the asset class’s Owner.
set_team: Changes an asset class’s Admin, Freezer and Issuer; called by the asset class’s Owner.
Please refer to the
Call enum and its associated variants for documentation on each
balance- Get the asset
total_supply- Get the total supply of an asset
Please refer to the
Pallet struct for details on publicly available functions.
Autogenerated weights for pallet_assets
Data concerning an approval.
Converts a balance value into an asset balance based on the ratio between the fungible’s minimum balance and the minimum asset balance.
Witness data for the destroy transactions.
A mutator type allowing inspection and possible modification of the extra “sidecar” data.
Possible errors when converting between external and asset balances.
Trait for allowing a minimum balance on the account to be specified, beyond the
minimum_balance of the asset. This is additive - the
minimum_balance of the asset must be
met and then anything here in addition.