githubEdit

Roles

The permissions stored on chain in the contracts control the access to the data NFT (ERC721) and datatoken (ERC20) smart contract functions.

The permissions governing access to the smart contract functions are stored within the data NFT (ERC721) smart contract. Both the data NFT (ERC721) and datatoken (ERC20) smart contracts utilize this information to enforce restrictions on certain actions, limiting access to authorized users. The tables below outline the specific actions that are restricted and can only be accessed by allowed users.

The data NFT serves as the foundational intellectual property (IP) for the asset, and all datatokens are inherently linked to the data NFT smart contract. This linkage has enabled the introduction of various exciting capabilities related to role administration.

NFT Owner

The NFT owner is the owner of the base-IP and is therefore at the highest level. The NFT owner can perform any action or assign any role but crucially, the NFT owner is the only one who can assign the manager role. Upon deployment or transfer of the data NFT, the NFT owner is automatically added as a manager. The NFT owner is also the only role that can’t be assigned to multiple users β€” the only way to share this role is via multi-sig or a DAO.

Roles-NFT level

Roles at the data NFT level
circle-info

With the exception of the NFT owner role, all other roles can be assigned to multiple users.

There are several methods available to assign roles and permissions. One option is to utilize the ocean.pyarrow-up-right and ocean.jsarrow-up-right libraries that we provide. These libraries offer a streamlined approach for assigning roles and permissions programmatically.

Alternatively, for a more straightforward solution that doesn't require coding, you can utilize the network explorer of your asset's network. By accessing the network explorer, you can directly interact with the contracts associated with your asset. Below, we provide a few examples to help guide you through the process.

Manager

The ability to add or remove Managers is exclusive to the NFT Owner. If you are the NFT Owner and wish to add/remove a new manager, simply call the addManagerarrow-up-right/removeManagerarrow-up-right function within the ERC721Template contract. This function enables you to grant managerial permissions to the designated individual.

chevron-rightAdd/Remove Manager Contract functionshashtag

The manager can assign or revoke three main roles (deployer, metadata updater, and store updater). The manager is also able to call any other contract (ERC725X implementation).

spinner

Metadata Updater

There is also a specific role for updating the metadata. The Metadata updater has the ability to update the information about the data asset (title, description, sample data etc) that is displayed to the user on the asset detail page within the market.

To add/remove a metadata updater, the manager can use the addToMetadataListarrow-up-right/removeFromMetadataListarrow-up-right functions from the ERC721RolesAddress.

chevron-rightAdd/Remove Metadata Updater Contract functionshashtag

Store Updater

The store updater can store, remove or update any arbitrary key value using the ERC725Y implementation (at the ERC721 level). The use case for this role depends a lot on what data is being stored in the ERC725Y key-value pair β€” as mentioned above, this is highly flexible.

To add/remove a store updater, the manager can use the addTo725StoreListarrow-up-right/removeFrom725StoreListarrow-up-right functions from the ERC721RolesAddress.

chevron-rightAdd/Remove Store Updater Contract functionshashtag

ERC20 Deployer

The Deployer has a bunch of privileges at the ERC20 datatoken level. They can deploy new datatokens with fixed price exchange, or free pricing. They can also update the ERC725Y key-value store and assign roles at the ERC20 level(datatoken level).

To add/remove an ERC20 deployer, the manager can use the addToCreateERC20Listarrow-up-right/removeFromCreateERC20Listarrow-up-right functions from the ERC721RolesAddress.

chevron-rightAdd/Remove ERC20 Deployer Contract functionshashtag
circle-info

To assign/remove all the above roles(ERC20 Deployer, Metadata Updater, or Store Updater), the manager can use the addMultipleUsersToRolesarrow-up-right function from the ERC721RolesAddress.

chevron-rightAssign multiple roles at once Contract functionhashtag

Roles & permissions in data NFT (ERC721) smart contract

Action ↓ / Role β†’
NFT Owner
Manager
ERC20 Deployer
Store Updater
Metadata Updater

Set token URI

Add manager

βœ“

Remove manager

βœ“

Clean permissions

βœ“

Set base URI

βœ“

Set Metadata state

βœ“

Set Metadata

βœ“

Create new datatoken

βœ“

Executes any other smart contract

βœ“

Set new key-value in store

βœ“

Roles-datatokens level

Roles at the datatokens level

Minter

The Minter has the ability to mint new datatokens, provided the limit has not been exceeded.

To add/remove a minter, the ERC20 deployer can use the addMinterarrow-up-right/removeMinterarrow-up-right functions from the ERC20Template.

chevron-rightAdd/Remove Minter Contract functionshashtag
spinner

Fee Manager

Finally, we also have a fee manager which has the ability to set a new fee collector β€” this is the account that will receive the datatokens when a data asset is consumed. If no fee collector account has been set, the datatokens will be sent by default to the NFT Owner.

circle-info

The applicable fees (market and community fees) are automatically deducted from the datatokens that are received.

To add/remove a fee manager, the ERC20 deployer can use the addPaymentManagerarrow-up-right/removePaymentManagerarrow-up-right functions from the ERC20Template.

chevron-rightAdd/Remove Fee Manager Contract functionshashtag
circle-info

When the NFT ownership is transferred to another wallet address, all the roles and permissions and clearedarrow-up-right.

Roles & permission in datatoken (ERC20) smart contract

Action ↓ / Role β†’
ERC20 Deployer
Minter
NFT owner
Fee manager

Create Fixed Rate exchange

βœ“

Create Dispenser

βœ“

Add minter

βœ“

Remove minter

βœ“

Add fee manager

βœ“

Remove fee manager

βœ“

Set data

βœ“

Clean permissions

βœ“

Mint

βœ“

Set fee collector

βœ“

Last updated

Was this helpful?