Craftable Output Token
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
To turn your token in development into a Craftable Output token. Here are the instructions:
Compose your 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 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.