Craftable Output Token
A token can be both a Craftable input and output
What's CraftableIn?
It's an abstract contract providing all necessary functionality to be adapted as an output in future crafting rules. This involves reading and writing attributes and template, as well as minting tokens from the crafting rule.
Implementing CraftableOut in your Token
To turn your token in development into a Craftable Output token. Here are the instructions:
Compose your definition metadata file. Set the classes you have and their attributes descriptions.
import
craftable/CraftableOut.sol
from the repo.
extend the abstract contract from your token
Implement the virtual functions to make the contract usable.
First override the functions to enable CraftableBase
. Other functions to override for CraftableOut specifically are the following:
_storeTemplateData( _id, _template, _class, _attributes)
This function is given an_attributes
list and the purpose of this function is to handle the storage of the attributes to a specific template id and class id. this is important to allow the flexibility of the developer._templateURI( _template )
Given the tokens with the same template have the same values for the attributes, the URI for the token metadata is the same as its template.
In addition to overriding some functions, we also provide private functions to provide minter approval. for example _setMintingRule(...)
allows you to create public functions that have some logic before adding random users.
Docs
Last updated