1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

GITBOOK-581: change request with no subject merged in GitBook

This commit is contained in:
Mihai Badea 2023-06-21 11:37:54 +00:00 committed by gitbook-bot
parent 7a1eac9c81
commit 5814e7383f
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
2 changed files with 88 additions and 134 deletions

View File

@ -15,7 +15,9 @@ The [data NFT](data-nfts.md) serves as the foundational intellectual property (I
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 cant be assigned to multiple users — the only way to share this role is via multi-sig or a DAO.
### Roles at the NFT level
## Roles-NFT level
```mermaid
stateDiagram-v2
@ -33,7 +35,7 @@ There are several methods available to assign roles and permissions. One option
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
### 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 [addManager](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC721Template.sol#L426)/[removeManager](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC721Template.sol#L438) function within the ERC721Template contract. This function enables you to grant managerial permissions to the designated individual. 
@ -70,59 +72,7 @@ The **manager** can assign or revoke three main roles (**deployer, metadata upda
{% @arcade/embed flowId="qC8QpkLsFIQk3NxPzB8p" url="https://app.arcade.software/share/qC8QpkLsFIQk3NxPzB8p" %}
#### 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 [addToCreateERC20List](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L111)/[removeFromCreateERC20List](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L129) functions from the ERC721RolesAddress.
<details>
<summary>Add/Remove ERC20 Deployer Contract functions</summary>
```solidity
/**
* @dev addToCreateERC20List
* Adds deployERC20 role to an user.
* It can be called only by a manager
* @param _allowedAddress user address
*/
function addToCreateERC20List(address _allowedAddress) public onlyManager {
_addToCreateERC20List(_allowedAddress);
}
/**
* @dev removeFromCreateERC20List
* Removes deployERC20 role from an user.
* It can be called by a manager or by the same user, if he already has deployERC20 role
* @param _allowedAddress user address
*/
function removeFromCreateERC20List(address _allowedAddress) public {
if(permissions[msg.sender].manager == true ||
(msg.sender == _allowedAddress && permissions[msg.sender].deployERC20 == true)
){
Roles storage user = permissions[_allowedAddress];
user.deployERC20 = false;
emit RemovedFromCreateERC20List(_allowedAddress,msg.sender,block.timestamp,block.number);
_SafeRemoveFromAuth(_allowedAddress);
}
else{
revert("ERC721RolesAddress: Not enough permissions to remove from ERC20List");
}
}
```
</details>
### Roles at the datatokens level
```mermaid
stateDiagram-v2
ERC20_DEPLOYER --> MINTER
ERC20_DEPLOYER --> FEE_MANAGER
```
#### Metadata Updater
### Metadata Updater
There is also a specific role for updating the metadata. The [Metadata](../metadata.md) 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.
@ -167,7 +117,7 @@ function removeFromMetadataList(address _allowedAddress) public {
</details>
#### Store Updater
### 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.
@ -216,7 +166,53 @@ function removeFrom725StoreList(address _allowedAddress) public {
</details>
To assign/remove all the above roles(ERC20 Deployer, Metadata Updater, or Store Updater), the manager can use the [**addMultipleUsersToRoles**](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L268) function from the ERC721RolesAddress:
### 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 [addToCreateERC20List](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L111)/[removeFromCreateERC20List](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L129) functions from the ERC721RolesAddress.
<details>
<summary>Add/Remove ERC20 Deployer Contract functions</summary>
```solidity
/**
* @dev addToCreateERC20List
* Adds deployERC20 role to an user.
* It can be called only by a manager
* @param _allowedAddress user address
*/
function addToCreateERC20List(address _allowedAddress) public onlyManager {
_addToCreateERC20List(_allowedAddress);
}
/**
* @dev removeFromCreateERC20List
* Removes deployERC20 role from an user.
* It can be called by a manager or by the same user, if he already has deployERC20 role
* @param _allowedAddress user address
*/
function removeFromCreateERC20List(address _allowedAddress) public {
if(permissions[msg.sender].manager == true ||
(msg.sender == _allowedAddress && permissions[msg.sender].deployERC20 == true)
){
Roles storage user = permissions[_allowedAddress];
user.deployERC20 = false;
emit RemovedFromCreateERC20List(_allowedAddress,msg.sender,block.timestamp,block.number);
_SafeRemoveFromAuth(_allowedAddress);
}
else{
revert("ERC721RolesAddress: Not enough permissions to remove from ERC20List");
}
}
```
</details>
{% hint style="info" %}
To assign/remove all the above roles(ERC20 Deployer, Metadata Updater, or Store Updater), the manager can use the [**addMultipleUsersToRoles**](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L268) function from the ERC721RolesAddress.
{% endhint %}
<details>
@ -260,7 +256,21 @@ function addMultipleUsersToRoles(address[] memory addresses, RolesType[] memory
</details>
#### Minter
### Roles & permissions in data NFT (ERC721) smart contract
<table><thead><tr><th width="216">Action ↓ / Role →</th><th width="121">NFT Owner</th><th width="102">Manager</th><th width="160">ERC20 Deployer</th><th width="160">Store Updater</th><th width="170">Metadata Updater</th></tr></thead><tbody><tr><td>Set token URI</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Add manager</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Remove manager</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Clean permissions</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Set base URI</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Set Metadata state</td><td></td><td></td><td></td><td></td><td><strong></strong></td></tr><tr><td>Set Metadata</td><td></td><td></td><td></td><td></td><td><strong></strong></td></tr><tr><td>Create new datatoken</td><td></td><td></td><td><strong></strong></td><td></td><td></td></tr><tr><td>Executes any other smart contract</td><td></td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Set new key-value in store</td><td></td><td></td><td></td><td><strong></strong></td><td></td></tr></tbody></table>
##
## Roles-datatokens level
```mermaid
stateDiagram-v2
ERC20_DEPLOYER --> MINTER
ERC20_DEPLOYER --> FEE_MANAGER
```
### Minter
The Minter has the ability to mint new datatokens, provided the limit has not been exceeded.
@ -298,7 +308,7 @@ function removeMinter(address _minter) external onlyERC20Deployer {
{% @arcade/embed flowId="OHlwsPbf29S1PLh03FM7" url="https://app.arcade.software/share/OHlwsPbf29S1PLh03FM7" %}
#### Fee Manager
### 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**.
@ -350,10 +360,6 @@ When the NFT ownership is transferred to another wallet address, all the roles a
</strong></code></pre>
{% endhint %}
### Roles & permissions in data NFT (ERC721) smart contract
<table><thead><tr><th width="255">Action ↓ / Role →</th><th width="121">NFT Owner</th><th width="102">Manager</th><th width="160">ERC20 Deployer</th><th width="160">Store Updater</th><th width="170">Metadata Updater</th></tr></thead><tbody><tr><td>Set token URI</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Add manager</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Remove manager</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Clean permissions</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Set base URI</td><td><strong></strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Set Metadata state</td><td></td><td></td><td></td><td></td><td><strong></strong></td></tr><tr><td>Set Metadata</td><td></td><td></td><td></td><td></td><td><strong></strong></td></tr><tr><td>Create new datatoken</td><td></td><td></td><td><strong></strong></td><td></td><td></td></tr><tr><td>Executes any other smart contract</td><td></td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Set new key-value in store</td><td></td><td></td><td></td><td><strong></strong></td><td></td></tr></tbody></table>
### Roles & permission in datatoken (ERC20) smart contract
<table><thead><tr><th width="263">Action ↓ / Role →</th><th width="169">ERC20 Deployer</th><th width="93">Minter</th><th width="144">NFT owner</th><th>Fee manager</th></tr></thead><tbody><tr><td>Create Fixed Rate exchange</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Create Dispenser</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Add minter</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Remove minter</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Add fee manager</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Remove fee manager</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Set data</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Clean permissions</td><td></td><td></td><td><strong></strong></td><td></td></tr><tr><td>Mint</td><td></td><td><strong></strong></td><td></td><td></td></tr><tr><td>Set fee collector</td><td></td><td></td><td></td><td><strong></strong></td></tr></tbody></table>
<table><thead><tr><th width="210">Action ↓ / Role →</th><th width="159">ERC20 Deployer</th><th width="93">Minter</th><th width="117">NFT owner</th><th>Fee manager</th></tr></thead><tbody><tr><td>Create Fixed Rate exchange</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Create Dispenser</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Add minter</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Remove minter</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Add fee manager</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Remove fee manager</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Set data</td><td><strong></strong></td><td></td><td></td><td></td></tr><tr><td>Clean permissions</td><td></td><td></td><td><strong></strong></td><td></td></tr><tr><td>Mint</td><td></td><td><strong></strong></td><td></td><td></td></tr><tr><td>Set fee collector</td><td></td><td></td><td></td><td><strong></strong></td></tr></tbody></table>

View File

@ -9,83 +9,31 @@ description: >-
# DDO Specification
**v4.1.0**
<< Diagram Work in Progress>>
```mermaid
erDiagram
DDO ||--|{ Metadata : contains
DDO ||--|{ Services : contains
DDO
Metadata
Services
Compute
publisherTrustedAlgorithms
ConsumerParameters
AlgorithmMetadata
Container
DDO ||--|{Metadata : contains
DDO ||--|{Services : contains
Metadata ||--|{AlgorithmMetadata : contains
AlgorithmMetadata ||--|{Container : contains
Compute ||--|{ publisherTrustedAlgorithms : contains
Services ||--|{ Compute : contains
Services ||--|{ ConsumerParameters : contains
Metadata ||--|{ AlgorithmMetadata : contains
AlgorithmMetadata ||--|{ Container : contains
DDO {
arrayOfString context
string id
string version
number chainID
string nftAddress
Metadata metadata
Services services
Credentials credentials
}
Metadata {
ISODateTimeString created
ISODateTimeString updated
string description
string copyrightHolder
string name
string type
string author
string license
arrayOfString links
string contentLanguage
arrayOfString tags
arrayOfStrings categories
Object additionalInformation
AlgorithmMetadata algorithm
}
AlgorithmMetadata {
string language
string version
ConsumerParameters consumerParameters
Container container
}
Container {
string entrypoint
string image
string tag
string checksum
}
Services {
string id
string type
string name
string description
string datatokenAddress
string serviceEndpoint
Files files
number timeout
Compute compute
ConsumerParameters consumerParameters
Object additionalInformation
}
ConsumerParameters {
string name
string type
string label
boolean required
string description
string-number-boolean default
ArrayOfOptions options
}
```
## Required Attributes
A DDO in Ocean has these required attributes: