Allfeat hosts data structures and logic that specialize in the creation, management, and use of assets in the network.
See the Advanced section at the bottom for discussion on using proxy and multisig accounts to replicate oft used contract logic.
Fungible assets are those that are interchangeable, i.e. one unit is equivalent to any other unit for the purposes of claiming the underlying item. Allfeat represents fungible assets in the Assets module. For those familiar with the ERC20 standard, this pallet presents a similar interface. However, the logic is encoded directly in the chain's runtime. As such, operations are not gas metered and instead are benchmarked upon every release, leading to efficient execution and stable transaction fees.
Creation and Management
The Allfeat Assets module doesn't expose publicly the API to create and manage them. This mean that users can't natively deploy tokens, this should be made through a deployed application which permit it.
However, any builder which want to use fungibles tokens inside his application logic may use the Assets module.
Each created assets reserve a required deposit (5 AFT) for the storage that the asset data use.
An asset always come with a unique
AssetId, an integer of type
u32, to identify the asset. The
should be the canonical identifier for an asset, as the chain does not enforce the uniqueness of
metadata like "name" and "symbol". The creator must also specify a minimum balance, which will
prevent accounts from having dust balances, and an optional maximum supply to ensure that their will never be new tokens minted over this limit.
An asset class has a number of privileged roles. The creator of the asset automatically takes on all privileged roles, but can reassign them after creation. These roles are:
The owner has the ability to set the accounts responsible for the other three roles, as well as set asset metadata (e.g. name, symbol, decimals). The issuer can mint and burn tokens to/from addresses of their choosing. The freezer can freeze assets on target addresses or the entire asset class. The admin can make force transfers as well as unfreeze accounts of the asset class. Always refer to the reference documentation for certainty on privileged roles.
Transferring Asset Balances
Users have a simple interface, namely the ability to transfer asset balances to other accounts on-chain. As mentioned before, the destination account must already exist for the transfer to succeed.
The chain also contains a
transfer_keep_alive function, similar to that of the Balances pallet,
that will fail if execution would kill the sending account.
Allfeat also sweeps dust balances into transfers. For example, if an asset has a minimum balance of 10 and an account has a balance of 25, then an attempt to transfer 20 units would actually transfer all 25.
Allfeat provides an
cancel_approval interface. Application developers can use this interface
so that users can authorize the application to effectuate transfers up to a given amount on behalf
of an account.
Unlike fungible assets, the particular instance of a non-fungible asset (NFT) has meaning separate from another instance of the same class. Allfeat represents NFTs in the Allfeat Uniques pallet, which is a fork of the Substrate Uniques pallet.
Similar to the Assets pallet, this functionality is encoded into the chain. Operations are benchmarked prior to each release in lieu of any runtime metering, ensuring efficient execution and stable transaction fees.
Creation and Management
Similar to the Assets module, users can't natively create and manage NFT collections, but developers that may want to use NFTs logic inside their application could use the private API of the Uniques module.
Creating instances of a class also requires a per-instance deposit. The creator must specify
ClassId, which, like its cousin
AssetId, should be the canonical identifier for the class.
The creator can also specify the same privileged roles of Owner, Admin, Issuer, and Freezer.
Asset classes and instances can have associated metadata. The metadata is an array of data that the class Owner can add on-chain, for example, a link to an IPFS hash or other off-chain hosting service. The Uniques pallet also supports setting key/value pairs as attributes to a class or instance.
Users can transfer their NFTs to other accounts. The chain also provides an
cancel_approval interface that application developers can use to allow
users to authorize an application to transfer an instance on their behalf.
Many asset creators on other networks use smart contracts to control privileged functions like minting and burning. Although Allfeat does not have a smart contract interface, it contains the Multisig, Proxy, and Utility modules, which will meet most account management needs.
For example, if a team wants sign-off from two groups to perform a privileged operation, it could create a 2-of-2 multisig from two anonymous proxies, and then set members from each group as proxies to those two accounts.