Roles Definition
This page describes how NFT Creators can define how Borrowers use their rented NFTs.
What are Roles?
Each NFT has a specific set of utilities. These utilities can be access to a game, community benefits, or even smart contract access rights. To enable a more granular approach to NFT utility, ERC-7432 introduced Roles.
Roles comprise a set of access rights defined by the NFT Creator, enabling the NFT Owner to delegate its utility to another user. Roles can also include inputs the user is required to provide. The most common role input is profit share, which allows the NFT Owner to share token earnings with the user who received the role.
Most NFTs will contain a single role that, when granted, allows the borrower to use all benefits of the NFT. Multiple roles are helpful for more complex use cases.
Examples
Here are some examples of use cases for roles:
Creating a Role Definition with JSON
The Role Definition JSON is a simple data format that enables NFT Creators to specify all the roles associated with an NFT and their respective inputs.
To learn more about the JSON data type, read this article.
Here is an example of a role definition according to the Simple Game
As seen above, all the role information defined at Simple Game is available in the role definition, with the addition of id
and isUniqueRole
. id
is a hexadecimal representation of the role, usually calculated as the keccak256
of the role's name, which in this case is keccak256("Player")
, and IsUniqueRole
refers to whether the role can be assigned to multiple users simultaneously. Read Unique and Non-Unique Roles to learn more.
The role definition specification is described more deeply in the ERC-7432 Metadata section.
We can also represent the role definition of theDigital Real Estate example as the following:
In this example, we have two roles: One unique and another non-unique. The Tenant
role is not unique because a property can have more than one Tenant
, but Farmer
is unique because only one user can earn tokens in the property.
Conclusion
As mentioned above, most use cases only require a single role with one or two parameters. However, the ERC-7432 metadata was designed to be generic and cater to complex use cases.
If you need help to create the role definition of your NFT, don't hesitate to get in touch via Contact
Last updated