Creating Your First Module
Last updated
Was this helpful?
Last updated
Was this helpful?
A is a concept defined by the programming language Rell.
We use modules in Yours Protocol as utility providers for tokens. Let's create a simple example: imagine you have a token that represents a sweater, and you want to allow this token to be equipped by an account. For this, we'll build an equippables
module.
First, create your module file - assuming you followed the instruction of the - it should be under rell/src/
.
Next, define the persistence layer for your utility. Here you have complete freedom as a developer to decide what metadata you want to associate with the token and how you want to persist it.
In this step we will create an equippable entity and specify that an equippable entity is linked to one Yours Token.
The occupying slot will specify what slot (e.g. hat, torso, bottom) the equippable will occupy.
Certainly equippable
and occupying_slot
entities could be normalized in one unique entity, for the simplicity of the tutorial, we prefer to keep them separate for now.
Add some basic functionality by attaching your module to the token:
That's all you need to provide utility to a token with Yours Protocol! You can now build additional logic in your dapp that utilizes these entities to provide functionality and dynamic metadata to your tokens.