Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document templates #833

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ from artifacts import address

- Base IP is now represented by an [NFT](https://blog.oceanprotocol.com/what-is-a-data-nft-5804a2d88671), from which a datapublisher can create multiple ERC20s representing different type of access for the same dataset.

- An automated Datatoken [Staking](https://blog.oceanprotocol.com/ocean-v4-one-sided-staking-93988f65e378) helps with the initial DTs distribution and price stability. Goodbye rug pulls!

- Help [Ocean Community Monetize](https://blog.oceanprotocol.com/how-to-make-money-from-ocean-v4-477b3decad51): there's a swap fee for the Ocean Community, if Ocean or allied tokens are the basetoken in a pool, Ocean Community will receive 0.1% swap fee, otherwhise it will be 0.2%.

#### Flexibility

- Based on ERC721 and ERC20 [templates](contracts/templates/README.md) to provide different features
- Introduce an advanced [Fee Structure](https://docs.oceanprotocol.com/core-concepts/fees) both for Market and Provider runners.

- Roles Administration: there are now multiple roles for a more flexible administation both at NFT and ERC20 levels
Expand Down
50 changes: 50 additions & 0 deletions contracts/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Ocean v1.x is build on top of templates, in order to accomodate severals scenarios which are mutually exclusive
alexcos20 marked this conversation as resolved.
Show resolved Hide resolved
alexcos20 marked this conversation as resolved.
Show resolved Hide resolved


# ERC721 Templates
Only [ERC721Template](ERC721Template.sol) is defined, and has the following specs:
- adhers to standard ERC721 implementation, but allows only one tokenId (==1). Any operation involving tokenId>1 will revert
- has functions to deal with metadata (DDO)
- has roles
- allows creation of datatokens (caller chooses the datatoken template)

# ERC20 Templates

For now, three templates are defined:
- [ERC20Template](#ERC20Template)
- [ERC20TemplateEnterprise](#ERC20TemplateEnterprise)
- [ERC20Template3](#ERC20Template3)

### ERC20Template
- follows the mental model of "get datatokens" then "pass them around" then "consume".
- requires 2 tx to consume
1. get tokens (buy, dispense, etc)
2. call startOrder
- has the following price schemas:
- pools (deprecated)
- fixed rate exchanges
- dispensers

### ERC20TemplateEnterprise
- follows the mental model of "do not have datatokens in circulation". Means that in a single tx, datatoken is minted, exchanged, used and burned.
- requires 1 tx to consume: (buyFromFreAndOrder / buyFromDispenserAndOrder)
- does not allow self custody of datatokens (means that nobody can get tokens from dispensers or fixed rate exchangers)
- has the following price schemas:
- fixed rate exchanges
- dispensers

### ERC20Template3 (Predictoor)
- designed to work only on Oasis Sapphire, due to privacy features
- requires 1 tx to consume: buyFromFreAndOrder
- does not allow self custody of datatokens (means that nobody can buy a datatoken from fixed rate exchange)
- has the following price schemas:
- fixed rate exchanges


The following table sums it up
Template # | Label | Allows fre/dispense by default? | Allows custody of datatokens? | Combines txs? | Purpose
:----: | :----: | :----: | :----: | :----:| :----:
1 | ERC20Template | Y | Y | N | General
2 | ERC20TemplateEnterprise | N | N | Y | General
3 | ERC20Template3 | N | N | Y | Predictoor

Loading