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

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

This commit is contained in:
Ana Loznianu 2023-06-06 15:47:12 +00:00 committed by gitbook-bot
parent 144960b0b0
commit 2f6957192d
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
5 changed files with 164 additions and 53 deletions

View File

@ -35,14 +35,14 @@
* [Data NFTs](developers/contracts/data-nfts.md)
* [Datatokens](developers/contracts/datatokens.md)
* [Data NFTs and Datatokens](developers/contracts/datanft-and-datatoken.md)
* [Community monetization](developers/contracts/community-monetization.md)
* [Datatoken Templates](developers/contracts/datatoken-templates.md)
* [Metadata](developers/contracts/metadata.md)
* [Revenue](developers/contracts/revenue.md)
* [Roles](developers/contracts/roles.md)
* [Revenue](developers/contracts/revenue.md)
* [Fees](developers/fees.md)
* [Fractional Ownership](developers/contracts/fractional-ownership.md)
* [Asset Pricing](developers/asset-pricing.md)
* [Community Monetization](developers/community-monetization.md)
* [Identifiers & Metadata](developers/Identifiers-Metadata.md)
* [DDO Specification](developers/ddo-specification.md)
* [Storage Specifications](developers/storage-specifications.md)

View File

@ -2,7 +2,7 @@
description: How can you build a self sufficient project?
---
# Community monetization
# Community Monetization
@ -16,9 +16,9 @@ Ocean V3 introduced the new crypto primitives of “data on-ramp” and “data
The datasets can take one of many shapes. For AI use cases, they may be raw datasets, cleaned-up datasets, feature-engineered **data**, **AI models**, **AI model predictions**, or otherwise. (They can even be other forms of copyright-style IP such as **photos**, **videos**, or **music**!) Algorithms themselves may be sold as part of Oceans Compute-to-Data feature.
The first opportunity of data NFTs is the potential to sell the base intellectual property (IP) as an exclusive license to others. This is akin to EMI selling the Beatles master tapes to Universal Music: whoever owns the masters has the right to create records, CDs, and digital [sub-licenses](../../discover/glossary.md#sub-licensee). Its the same for data: as the data NFT owner you have the **exclusive right** to create ERC20 datatoken sub-licenses. With Ocean V4, this right is now transferable as a data NFT. You can sell these data NFTs in **OpenSea** and other NFT marketplaces.
The first opportunity of data NFTs is the potential to sell the base intellectual property (IP) as an exclusive license to others. This is akin to EMI selling the Beatles master tapes to Universal Music: whoever owns the masters has the right to create records, CDs, and digital [sub-licenses](../discover/glossary.md#sub-licensee). Its the same for data: as the data NFT owner you have the **exclusive right** to create ERC20 datatoken sub-licenses. With Ocean V4, this right is now transferable as a data NFT. You can sell these data NFTs in **OpenSea** and other NFT marketplaces.
If youre part of an established organization or a growing startup, youll also love the new role structure that comes with data NFTs. For example, you can specify a different address to collect [revenue](revenue.md) compared to the address that owns the NFT. Its now possible to fully administer your project through these [roles](roles.md).
If youre part of an established organization or a growing startup, youll also love the new role structure that comes with data NFTs. For example, you can specify a different address to collect [revenue](contracts/revenue.md) compared to the address that owns the NFT. Its now possible to fully administer your project through these [roles](contracts/roles.md).
**In short, if you have data to sell, then Ocean V4 gives you superpowers to scale up and manage your data project. We hope this enables you to bring your data to new audiences and increase your profits.**
@ -26,15 +26,15 @@ If youre part of an established organization or a growing startup, youll a
We have always been super encouraging of anyone who wishes to build a dApp on top of Ocean or to fork Ocean Market and make their own data marketplace. With the V4 release, we have taken this to the next level and introduced more opportunities and even more fee customization options.
Unlike in V3, where the fee collection was limited to the consume action with a fixed value of 0.1%, V4 empowers marketplace operators like yourself to have greater flexibility and control over the fees you can charge. This means you can tailor the fee structure to suit your specific needs and ensure the sustainability of your project. **V4 smart contracts enable you to collect a fee not only in consume, but also in fixed-rate exchange, also you can set the fee value.** For more detailed information regarding the fees, we invite you to visit the [fees](../fees.md) page.
Unlike in V3, where the fee collection was limited to the consume action with a fixed value of 0.1%, V4 empowers marketplace operators like yourself to have greater flexibility and control over the fees you can charge. This means you can tailor the fee structure to suit your specific needs and ensure the sustainability of your project. **V4 smart contracts enable you to collect a fee not only in consume, but also in fixed-rate exchange, also you can set the fee value.** For more detailed information regarding the fees, we invite you to visit the [fees](fees.md) page.
Another new opportunity is using your own **ERC20** token in your marketplace, where its used as the unit of exchange. This is fully supported and can be a great way to ensure the sustainability of your project.
### 3. Running Your Own Provider
Now this is a completely brand new opportunity to start generating [revenue](revenue.md) — running your own [provider](https://github.com/oceanprotocol/provider). We have been aware for a while now that many of you havent taken up the opportunity to run your own provider, and the reason seems obvious — there arent strong enough incentives to do so.
Now this is a completely brand new opportunity to start generating [revenue](contracts/revenue.md) — running your own [provider](https://github.com/oceanprotocol/provider). We have been aware for a while now that many of you havent taken up the opportunity to run your own provider, and the reason seems obvious — there arent strong enough incentives to do so.
For those that arent aware, [Ocean Provider](../provider/) is the proxy service thats responsible for encrypting/ decrypting the data and streaming it to the consumer. It also validates if the user is allowed to access a particular data asset or service. Its a crucial component in Oceans architecture.
For those that arent aware, [Ocean Provider](provider/) is the proxy service thats responsible for encrypting/ decrypting the data and streaming it to the consumer. It also validates if the user is allowed to access a particular data asset or service. Its a crucial component in Oceans architecture.
Now, as mentioned above, fees are now paid to the individual or organization running the provider whenever a user downloads a data asset. The fees for downloading an asset are set as a cost per MB. In addition, there is also a provider fee that is paid whenever a compute job is run, which is set as a price per minute.
@ -45,7 +45,7 @@ Additionally, provider fees are not limited to data consumption — they can als
**Benefits to the Ocean Community**\
Were always looking to give back to the Ocean community and collecting fees is an important part of that. As mentioned above, the Ocean Protocol Foundation retains the ability to implement community fees on data consumption. The tokens that we receive will either be burned or invested in the community via projects that they are building. These investments will take place either through [Data Farming](../../rewards/df-intro.md), [Ocean Shipyard](https://oceanprotocol.com/shipyard), or Ocean Ventures.
Were always looking to give back to the Ocean community and collecting fees is an important part of that. As mentioned above, the Ocean Protocol Foundation retains the ability to implement community fees on data consumption. The tokens that we receive will either be burned or invested in the community via projects that they are building. These investments will take place either through [Data Farming](../rewards/df-intro.md), [Ocean Shipyard](https://oceanprotocol.com/shipyard), or Ocean Ventures.
Additionally, we will also be placing an additional 0.1% fee on projects that arent using either the Ocean token or H2O. We want to support marketplaces that use other tokens but we also recognize that they dont bring the same wider benefit to the Ocean community, so we feel this small additional fee is proportionate. 

View File

@ -22,7 +22,7 @@ By utilizing ERC721 tokens, Ocean V4 **grants data creators greater flexibility
<figure><img src="../../.gitbook/assets/v4-contracts.png" alt=""><figcaption><p>Ocean Protocol V4 Smart Contracts</p></figcaption></figure>
### [**Community monetization**](community-monetization.md), to help the community create sustainable businesses.
### [**Community monetization**](../community-monetization.md), to help the community create sustainable businesses.
Ocean V4 brings forth enhanced opportunities for marketplace operators, creating a conducive environment for the emergence of a thriving market of **third-party Providers**.

View File

@ -21,7 +21,7 @@ This information is used in the discovery process by aquarius and also gives imp
* @param _metaDataHash hash of clear data (before the encryption, if any)
* @param _metadataProofs optional signatures of entitys who validated data (before the encryption, if any)
*/
function setMetaData(uint8 _metaDataState, string calldata _metaDataDecryptorUrl
function set metadata(uint8 _metaDataState, string calldata _metaDataDecryptorUrl
, string calldata _metaDataDecryptorAddress, bytes calldata flags,
bytes calldata data,bytes32 _metaDataHash, metaDataProof[] memory _metadataProofs) external {
require(

View File

@ -7,66 +7,177 @@ description: >-
# Roles
The permissions are stored in the data NFT (ERC721) smart contract. The data NFT (ERC721) and datatoken (ERC20) smart contracts both use this information to restrict access to the smart contract functions. The tables below list restricted actions that are accessible only to the allowed users.
The permissions governing access to the smart contract functions are stored within the [data NFT](data-nfts.md) (ERC721) smart contract. Both the [data NFT](data-nfts.md) (ERC721) and [datatoken](datatokens.md) (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.
### What Roles Can The Data NFT Owner Assign?
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.&#x20;
The data NFT is the base IP for the asset and all the datatokens are therefore linked to the data NFT smart contract — this has enabled us to do a bunch of cool new things around role administration. Weve introduced a host of useful roles which give you flexibility in how you manage your project. This can be a big help for enterprises and startups who are ready to scale up and introduce a level of administration.
#### NFT Owner
### 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 cant be assigned to multiple users — the only way to share this role is via multi-sig or a DAO.
#### Manager
### What Roles Can The Data NFT Owner Assign?
The manager can assign or revoke three main roles (deployer, metadata updater, store updater). The manager is also able to interact with the ERC725 data.
```mermaid
stateDiagram-v2
NFT_OWNER --> MANAGER
MANAGER --> METADATA_UPDATER
MANAGER --> ERC20_DEPLOYER
MANAGER --> STORE_UPDATER
ERC20_DEPLOYER --> MINTER
ERC20_DEPLOYER --> FEE_MANAGER
```
#### ERC20 Deployer
{% hint style="info" %}
With the exception of the NFT owner role, all other roles can be assigned to multiple users.
{% endhint %}
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 the ERC20 level.
If you prefer a simple method for adding or removing roles and permissions(eg. add a new minter), you can follow the live demo provided below. This allows you to perform these actions directly through the user-friendly interface of a network explorer. Alternatively, if you need more detailed instructions, we have provided additional information down below.
#### Metadata Updater
{% @arcade/embed flowId="OHlwsPbf29S1PLh03FM7" url="https://app.arcade.software/share/OHlwsPbf29S1PLh03FM7" %}
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.
### Manager
#### Store Updater
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.
```solidity
function addManager(address _managerAddress) external onlyNFTOwner {
_addManager(_managerAddress);
}
function removeManager(address _managerAddress) external onlyNFTOwner {
_removeManager(_managerAddress);
}
```
The **manager** can assign or revoke three main roles (**deployer, metadata updater, store updater**). The manager is also able to interact with the ERC725 data.
### 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.
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.
```solidity
function addToCreateERC20List(address _allowedAddress) public onlyManager {
_addToCreateERC20List(_allowedAddress);
}
function removeFromCreateERC20List(address _allowedAddress)
public
{
if(permissions[msg.sender].manager == true ||
(msg.sender == _allowedAddress && permissions[msg.sender].deployERC20 == true)
)......
}
```
### 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.
To add/remove a metadata updater, the manager can use the [addToMetadataList](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L164)/[removeFromMetadataList](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L183) functions from the ERC721RolesAddress.
```solidity
function addToMetadataList(address _allowedAddress) public onlyManager {
_addToMetadataList(_allowedAddress);
}
function removeFromMetadataList(address _allowedAddress)
public
{
if(permissions[msg.sender].manager == true ||
(msg.sender == _allowedAddress && permissions[msg.sender].updateMetadata == true)
)
.....
}
```
### 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.
#### Minter
To add/remove a store updater, the manager can use the [addTo725StoreList](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L61)/[removeFrom725StoreList](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/utils/ERC721RolesAddress.sol#L76) functions from the ERC721RolesAddress.
The Minter has the ability to mint new datatokens, provided the limit has not been exceeded. In most cases, this role will not be used as the alternative is for the datatokens to be minted by the side-staking bot which has many advantages. We highly recommend taking a read of this article if youre interested in learning more about safer staking and one-sided staking.
```solidity
function addTo725StoreList(address _allowedAddress) public onlyManager {
if(_allowedAddress != address(0)){
...
}
}
function removeFrom725StoreList(address _allowedAddress) public {
if(permissions[msg.sender].manager == true ||
(msg.sender == _allowedAddress && permissions[msg.sender].store == true)
)
...
}
```
#### 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. The applicable fees (market and community fees) are automatically deducted from the datatokens that are received.
### Roles in data NFT (ERC721) smart contract
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:
| 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 | | | | **✓** | |
```solidity
function addMultipleUsersToRoles(address[] memory addresses, RolesType[] memory roles) external onlyManager {
require(addresses.length == roles.length && roles.length>0 && roles.length<50, "Invalid array size");
...
}
```
### Roles in datatoken (ERC20) smart contract
### Minter
| 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 | | | | **✓** |
The Minter has the ability to mint new datatokens, provided the limit has not been exceeded.&#x20;
To add/remove a minter, the ERC20 deployer can use the [addMinter](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC20Template.sol#L617)/[removeMinter](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC20Template.sol#L628) functions from the ERC20Template.
```solidity
function addMinter(address _minter) external onlyERC20Deployer {
_addMinter(_minter);
}
function removeMinter(address _minter) external onlyERC20Deployer {
_removeMinter(_minter);
}
```
### 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**.&#x20;
{% hint style="info" %}
The applicable fees (market and community fees) are automatically deducted from the datatokens that are received.
{% endhint %}
To add/remove a fee manager, the ERC20 deployer can use the [addPaymentManager](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC20Template.sol#L639)/[removePaymentManager](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC20Template.sol#L653) functions from the ERC20Template.
```solidity
function addPaymentManager(address _paymentManager)
external
onlyERC20Deployer
{
_addPaymentManager(_paymentManager);
}
function removePaymentManager(address _paymentManager)
external
onlyERC20Deployer
{
_removePaymentManager(_paymentManager);
}
```
{% hint style="info" %}
When the NFT ownership is transferred to another wallet address, all the roles and permissions and [cleared](https://github.com/oceanprotocol/contracts/blob/9e29194d910f28a4f0ef17ce6dc8a70741f63309/contracts/templates/ERC721Template.sol#L511).
<pre class="language-solidity"><code class="lang-solidity"><strong>function cleanPermissions() external onlyNFTOwner {
</strong><strong> _cleanPermissions();
</strong><strong> //Make sure that owner still has permissions
</strong><strong> _addManager(ownerOf(1));
</strong><strong>}
</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="163">ERC20 Deployer</th><th width="145">Store Updater</th><th>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="155">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>