diff --git a/.gitbook/assets/architecture/use-case (1).png b/.gitbook/assets/architecture/use-case (1).png deleted file mode 100644 index a581963f..00000000 Binary files a/.gitbook/assets/architecture/use-case (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-1 (1).png b/.gitbook/assets/hosting/azure-1 (1).png deleted file mode 100644 index fa00009a..00000000 Binary files a/.gitbook/assets/hosting/azure-1 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-2 (1).png b/.gitbook/assets/hosting/azure-2 (1).png deleted file mode 100644 index 511ff199..00000000 Binary files a/.gitbook/assets/hosting/azure-2 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-3 (1).png b/.gitbook/assets/hosting/azure-3 (1).png deleted file mode 100644 index 4cf63916..00000000 Binary files a/.gitbook/assets/hosting/azure-3 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-4 (1).png b/.gitbook/assets/hosting/azure-4 (1).png deleted file mode 100644 index 2b074641..00000000 Binary files a/.gitbook/assets/hosting/azure-4 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-5 (1).png b/.gitbook/assets/hosting/azure-5 (1).png deleted file mode 100644 index c07525e5..00000000 Binary files a/.gitbook/assets/hosting/azure-5 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-6 (1).png b/.gitbook/assets/hosting/azure-6 (1).png deleted file mode 100644 index 4c576189..00000000 Binary files a/.gitbook/assets/hosting/azure-6 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-7 (1).png b/.gitbook/assets/hosting/azure-7 (1).png deleted file mode 100644 index 000dc780..00000000 Binary files a/.gitbook/assets/hosting/azure-7 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-8 (1).png b/.gitbook/assets/hosting/azure-8 (1).png deleted file mode 100644 index d424ccae..00000000 Binary files a/.gitbook/assets/hosting/azure-8 (1).png and /dev/null differ diff --git a/.gitbook/assets/hosting/azure-9 (1).png b/.gitbook/assets/hosting/azure-9 (1).png deleted file mode 100644 index f46b3c23..00000000 Binary files a/.gitbook/assets/hosting/azure-9 (1).png and /dev/null differ diff --git a/.gitbook/assets/wallet/login-options (1).png b/.gitbook/assets/wallet/login-options (1).png deleted file mode 100644 index 187f2446..00000000 Binary files a/.gitbook/assets/wallet/login-options (1).png and /dev/null differ diff --git a/.gitbook/assets/wallet/main-wallet-page (1).png b/.gitbook/assets/wallet/main-wallet-page (1).png deleted file mode 100644 index bbae9830..00000000 Binary files a/.gitbook/assets/wallet/main-wallet-page (1).png and /dev/null differ diff --git a/.gitbook/assets/wallet/matic-bridge (1).png b/.gitbook/assets/wallet/matic-bridge (1).png deleted file mode 100644 index 2c35cbdb..00000000 Binary files a/.gitbook/assets/wallet/matic-bridge (1).png and /dev/null differ diff --git a/.gitbook/assets/wallet/transferring-process (1).png b/.gitbook/assets/wallet/transferring-process (1).png deleted file mode 100644 index f131fc78..00000000 Binary files a/.gitbook/assets/wallet/transferring-process (1).png and /dev/null differ diff --git a/developers/core-concepts/datanft-and-datatoken.md b/developers/core-concepts/datanft-and-datatoken.md index b9142ea7..6baa9aad 100644 --- a/developers/core-concepts/datanft-and-datatoken.md +++ b/developers/core-concepts/datanft-and-datatoken.md @@ -29,16 +29,16 @@ With data NFTs, you are able to take advantage of the wider NFT ecosystem and al The image above describes how ERC721 data NFTs and ERC20 datatokens relate. -* Bottom: The publisher deploys an ERC721 data NFT contract representing the base IP for the data asset. They are now the manager of the data NFT. -* Top: The manager then deploys an ERC20 datatoken contract against the data NFT. The ERC20 represents a license with specific terms like "can download for the next 3 days". They could even publish further ERC20 datatoken contracts, to represent different license terms or for compute-to-data. +- Bottom: The publisher deploys an ERC721 data NFT contract representing the base IP for the data asset. They are now the manager of the data NFT. +- Top: The manager then deploys an ERC20 datatoken contract against the data NFT. The ERC20 represents a license with specific terms like "can download for the next 3 days". They could even publish further ERC20 datatoken contracts, to represent different license terms or for compute-to-data. ### Terminology -* **Base IP** means the artifact being copyrighted. Represented by the {ERC721 address, tokenId} from the publish transactions. -* **Base IP holder** means the holder of the Base IP. Represented as the actor that did the initial "publish" action. -* **Sub-licensee** is the holder of the sub-license. Represented as the entity that controls address ERC721.\_owners\[tokenId=x]. -* **To Publish**: Claim copyright or exclusive base license. -* **To Sub-license**: Transfer one (of many) sub-licenses to new licensee: ERC20.transfer(to=licensee, value=1.0). +- **Base IP** means the artifact being copyrighted. Represented by the {ERC721 address, tokenId} from the publish transactions. +- **Base IP holder** means the holder of the Base IP. Represented as the actor that did the initial "publish" action. +- **Sub-licensee** is the holder of the sub-license. Represented as the entity that controls address ERC721.\_owners\[tokenId=x]. +- **To Publish**: Claim copyright or exclusive base license. +- **To Sub-license**: Transfer one (of many) sub-licenses to new licensee: ERC20.transfer(to=licensee, value=1.0). ### Implementation in Ocean Protocol @@ -62,12 +62,12 @@ Ocean provides convenient methods to list ERC20 datatokens for sale, with fixed- ### High-Level Behavior -![High-Level Flow](<../../.gitbook/assets/architecture/use-case (1).png>) +![High-Level Flow](../../.gitbook/assets/architecture/use-case.png) Here's an example. -* In step 1, Alice **publishes** her dataset with Ocean: this means deploying an ERC721 data NFT contract (claiming copyright/base IP), then an ERC20 datatoken contract (license against base IP). -* In step 2, she **mints** some ERC20 datatokens and **transfers** 1.0 of them to Bob's wallet; now he has a license to be able to download that dataset. +- In step 1, Alice **publishes** her dataset with Ocean: this means deploying an ERC721 data NFT contract (claiming copyright/base IP), then an ERC20 datatoken contract (license against base IP). +- In step 2, she **mints** some ERC20 datatokens and **transfers** 1.0 of them to Bob's wallet; now he has a license to be able to download that dataset. ### Revenue @@ -87,8 +87,8 @@ The only data NFT template currently available has templateId `1` and the source The details regarding currently supported datatoken templates are as follows: -* **Regular template**: The regular template allows users to buy/sell/hold datatokens. The datatokens can be minted by the address having a `MINTER` role, making the supply of datatoken variable. This template is assigned templateID `1` and the source code is available [here](https://github.com/oceanprotocol/contracts/blob/v4main/contracts/templates/ERC20Template.sol). -* **Enterprise template**: The enterprise template has additional functions apart from methods in the ERC20 interface. This additional feature allows access to the service by paying in the basetoken instead of datatoken. Internally, the smart contract handles conversion of basetoken to datatoken, initiating an order to access the service, and minting/burning the datatoken. The total supply of the datatoken effectively remains 0 in the case of the enterprise template. This template is assigned templateID `2` and the source code is available [here](https://github.com/oceanprotocol/contracts/blob/v4main/contracts/templates/ERC20TemplateEnterprise.sol). +- **Regular template**: The regular template allows users to buy/sell/hold datatokens. The datatokens can be minted by the address having a `MINTER` role, making the supply of datatoken variable. This template is assigned templateID `1` and the source code is available [here](https://github.com/oceanprotocol/contracts/blob/v4main/contracts/templates/ERC20Template.sol). +- **Enterprise template**: The enterprise template has additional functions apart from methods in the ERC20 interface. This additional feature allows access to the service by paying in the basetoken instead of datatoken. Internally, the smart contract handles conversion of basetoken to datatoken, initiating an order to access the service, and minting/burning the datatoken. The total supply of the datatoken effectively remains 0 in the case of the enterprise template. This template is assigned templateID `2` and the source code is available [here](https://github.com/oceanprotocol/contracts/blob/v4main/contracts/templates/ERC20TemplateEnterprise.sol). _NOTE: Ocean Protocol might support additional variations of data NFT/datatoken by adding new templates._ @@ -98,8 +98,8 @@ Fractional ownership is an exciting sub-niche of Web3, at the intersection of NF Ocean provides two approaches to fractional ownership: -* Sharded holding of ERC20 datatokens, where each ERC20 holder has the usual datatoken rights as described above, e.g. 1.0 datatokens to consume an asset. This comes out-of-the-box with Ocean. -* Sharding ERC721 data NFT, where each co-holder has right to some earnings against base IP, and co-controls the data NFT. For example, there’s a DAO with the sole purpose to hold the data NFT; this DAO has its own ERC20 token; DAO members vote with tokens to update data NFT roles or deploy ERC20 datatokens against the ERC721. +- Sharded holding of ERC20 datatokens, where each ERC20 holder has the usual datatoken rights as described above, e.g. 1.0 datatokens to consume an asset. This comes out-of-the-box with Ocean. +- Sharding ERC721 data NFT, where each co-holder has right to some earnings against base IP, and co-controls the data NFT. For example, there’s a DAO with the sole purpose to hold the data NFT; this DAO has its own ERC20 token; DAO members vote with tokens to update data NFT roles or deploy ERC20 datatokens against the ERC721. Note: For (2), one might consider doing sharding with something like Niftex. But then there are questions: what rights do the shard-holders get exactly? It could be zero; for example, Amazon shareholders don’t have the right to walk the hallways of the Amazon offices just because they hold shares. Secondly, how do the shard-holders control the data NFT? These questions get resolved by using a tokenized DAO, as described above. @@ -111,7 +111,7 @@ This has several variants. Each member’s data feed could be its own data NFT w ### Other References -* [Data & NFTs 1: Practical Connections of ERC721 with Intellectual Property](https://blog.oceanprotocol.com/nfts-ip-1-practical-connections-of-erc721-with-intellectual-property-dc216aaf005d) -* [Data & NFTs 2: Leveraging ERC20 Fungibility](https://blog.oceanprotocol.com/nfts-ip-2-leveraging-erc20-fungibility-bcee162290e3) -* [Data & NFTs 3: Combining ERC721 & ERC20](https://blog.oceanprotocol.com/nfts-ip-3-combining-erc721-erc20-b69ea659115e) -* [Fungibility sightings in NFTs](https://blog.oceanprotocol.com/on-difficult-to-explain-fungibility-sightings-in-nfts-26bc18620f70) +- [Data & NFTs 1: Practical Connections of ERC721 with Intellectual Property](https://blog.oceanprotocol.com/nfts-ip-1-practical-connections-of-erc721-with-intellectual-property-dc216aaf005d) +- [Data & NFTs 2: Leveraging ERC20 Fungibility](https://blog.oceanprotocol.com/nfts-ip-2-leveraging-erc20-fungibility-bcee162290e3) +- [Data & NFTs 3: Combining ERC721 & ERC20](https://blog.oceanprotocol.com/nfts-ip-3-combining-erc721-erc20-b69ea659115e) +- [Fungibility sightings in NFTs](https://blog.oceanprotocol.com/on-difficult-to-explain-fungibility-sightings-in-nfts-26bc18620f70) diff --git a/discover/bridges.md b/discover/bridges.md index 8a264b42..c58ce90b 100644 --- a/discover/bridges.md +++ b/discover/bridges.md @@ -10,24 +10,24 @@ title: Bridges BSC provides several bridge options, including: -* withdraw crypto from Binance.com, and -* use Binance bridge. +- withdraw crypto from Binance.com, and +- use Binance bridge. The article [How to Get Started with BSC](https://academy.binance.com/en/articles/how-to-get-started-with-binance-smart-chain-bsc) by Binance Academy provides further details. #### Links -* [BSC Wallet Support](https://docs.binance.org/wallets/bsc-wallets.html). Includes MetaMask and Trust Wallet. -* [BSC Bridge](https://www.bnbchain.org/en/bridge) -* [How to set up a custom network in MetaMask](../orientation/metamask-setup.md#set-up-custom-network) +- [BSC Wallet Support](https://docs.binance.org/wallets/bsc-wallets.html). Includes MetaMask and Trust Wallet. +- [BSC Bridge](https://www.bnbchain.org/en/bridge) +- [How to set up a custom network in MetaMask](../orientation/metamask-setup.md#set-up-custom-network) ## Polygon (ex Matic) Bridge #### Links -* [Matic Wallet](https://wallet.polygon.technology/) -* [Matic Bridge](https://wallet.polygon.technology/bridge/) -* [How to set up a custom network in MetaMask](../orientation/metamask-setup.md#set-up-custom-network) +- [Matic Wallet](https://wallet.polygon.technology/) +- [Matic Bridge](https://wallet.polygon.technology/bridge/) +- [How to set up a custom network in MetaMask](../orientation/metamask-setup.md#set-up-custom-network) #### Intro to Polygon's Bridge @@ -45,7 +45,7 @@ For details check the [blog post](https://blog.oceanprotocol.com/ocean-on-polygo On the main page of the wallet, you can see all tokens you own on the Matic Mainnet. To deposit tokens (transfer them from the Ethereum Mainnet) you can either use the “deposit” button for a selected token or use “Move funds to Matic Mainnet”. -![Main wallet page](<../.gitbook/assets/wallet/main-wallet-page (1).png>) +![Main wallet page](../.gitbook/assets/wallet/main-wallet-page.png) Both options will redirect you to the bridge interface. In case you chose the second one, use the dropdown and select the token you want to transfer from the Ethereum Mainnet. diff --git a/tutorials/using-ocean-market/asset-hosting.md b/tutorials/using-ocean-market/asset-hosting.md index b12c538c..6d928225 100644 --- a/tutorials/using-ocean-market/asset-hosting.md +++ b/tutorials/using-ocean-market/asset-hosting.md @@ -105,7 +105,7 @@ Now, the asset can be uploaded by selecting the bucket name and choosing `Upload Get the files and add them to the bucket. -The file is an example used in multiple Ocean repositories, and it can be found [here](https://raw.githubusercontent.com/oceanprotocol/c2d-examples/main/branin\_and\_gpr/branin.arff). +The file is an example used in multiple Ocean repositories, and it can be found [here](https://raw.githubusercontent.com/oceanprotocol/c2d-examples/main/branin_and_gpr/branin.arff). ![Upload asset on S3 bucket - 3](../.gitbook/assets/hosting/aws-7.png) @@ -186,11 +186,11 @@ Go to the Azure portal: https://portal.azure.com/#home and select `Storage accou **Create a new storage account** -![Create a storage account - 2](<../../.gitbook/assets/hosting/azure-2 (1).png>) +![Create a storage account - 2](../../.gitbook/assets/hosting/azure-2.png) **Fill in the details** -![Add details](<../../.gitbook/assets/hosting/azure-3 (1).png>) +![Add details](../../.gitbook/assets/hosting/azure-3.png) **Storage account created** @@ -202,17 +202,17 @@ Go to the Azure portal: https://portal.azure.com/#home and select `Storage accou **Step 3 - Upload a file** -![Upload a file](<../../.gitbook/assets/hosting/azure-6 (1).png>) +![Upload a file](../../.gitbook/assets/hosting/azure-6.png) **Step 4 - Share the file** **Select the file to be published and click Generate SAS** -![Click generate SAS](<../../.gitbook/assets/hosting/azure-7 (1).png>) +![Click generate SAS](../../.gitbook/assets/hosting/azure-7.png) **Configure the SAS details and click `Generate SAS token and URL`** -![Generate link to file](<../../.gitbook/assets/hosting/azure-8 (1).png>) +![Generate link to file](../../.gitbook/assets/hosting/azure-8.png) **Copy the generated link** diff --git a/tutorials/using-ocean-subgraph/list-fixed-rate-exchanges.md b/tutorials/using-ocean-subgraph/list-fixed-rate-exchanges.md index 544b3928..25c1151f 100644 --- a/tutorials/using-ocean-subgraph/list-fixed-rate-exchanges.md +++ b/tutorials/using-ocean-subgraph/list-fixed-rate-exchanges.md @@ -1,2 +1,254 @@ # List Fixed Rate Exchanges +The result of following GraphQL query returns the information about the Fixed Rate Exchanges. + +{% hint style="info" %} +Copy the query in the [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) to fetch the results from the mainnet. For other networks use [this table](./#ocean-subgraph-graphiql). +{% endhint %} + +#### Query + +```graphql +{ + fixedRateExchanges(skip:0, first:2, subgraphError:deny){ + id + contract + exchangeId + owner{id} + datatoken{ + id + name + symbol + } + price + datatokenBalance + active + totalSwapValue + swaps(skip:0, first:1){ + tx + by { + id + } + baseTokenAmount + dataTokenAmount + createdTimestamp + } + updates(skip:0, first:1){ + oldPrice + newPrice + newActive + createdTimestamp + tx + } + } +} +``` + +#### Code + +{% tabs %} +{% tab title="Python" %} +The python script below can be used to run the the query. If you wish to change the network, then replace the value of variable `base_url` as needed. + +**Create script** + +{% code title="list_fixed_rate_exchanges.py" %} +```python +import requests +import json + + +query = """ +{ + fixedRateExchanges(skip:0, first:2, subgraphError:deny){ + id + contract + exchangeId + owner{id} + datatoken{ + id + name + symbol + } + price + datatokenBalance + active + totalSwapValue + swaps(skip:0, first:1){ + tx + by { + id + } + baseTokenAmount + dataTokenAmount + createdTimestamp + } + updates(skip:0, first:1){ + oldPrice + newPrice + newActive + createdTimestamp + tx + } + } +}""" + + +base_url = "https://v4.subgraph.mainnet.oceanprotocol.com" +route = "/subgraphs/name/oceanprotocol/ocean-subgraph" + +url = base_url + route + +headers = {"Content-Type": "application/json"} +payload = json.dumps({"query": query}) +response = requests.request("POST", url, headers=headers, data=payload) +result = json.loads(response.text) + +print(json.dumps(result, indent=4, sort_keys=True)) +``` +{% endcode %} + +**Execute script** + +``` +python list_fixed_rate_exchanges.py +``` +{% endtab %} + +{% tab title="Javascript" %} +The javascript below can be used to run the the query. If you wish to change the network, then replace the value of variable `baseUrl` as needed. + +#### Create script + +{% code title="listFRE.js" %} +```javascript +var axios = require('axios'); + +const query = `{ + fixedRateExchanges(skip:0, first:2, subgraphError:deny){ + id + contract + exchangeId + owner{id} + datatoken{ + id + name + symbol + } + price + datatokenBalance + active + totalSwapValue + swaps(skip:0, first:1){ + tx + by { + id + } + baseTokenAmount + dataTokenAmount + createdTimestamp + } + updates(skip:0, first:1){ + oldPrice + newPrice + newActive + createdTimestamp + tx + } + } +}` + +const baseUrl = "https://v4.subgraph.mainnet.oceanprotocol.com" +const route = "/subgraphs/name/oceanprotocol/ocean-subgraph" + +const url = `${baseUrl}${route}` + +var config = { + method: 'post', + url: url, + headers: { "Content-Type": "application/json" }, + data: JSON.stringify({ "query": query }) +}; + +axios(config) + .then(function (response) { + console.log(JSON.stringify(response.data)); + }) + .catch(function (error) { + console.log(error); + }); +``` +{% endcode %} + +#### Execute script + +```bash +node listFRE.js +``` +{% endtab %} +{% endtabs %} + +#### Response + +
+ +Sample response + +```json +{ + "data": { + "fixedRateExchanges": [ + { + "active": true, + "contract": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02", + "datatoken": { + "id": "0x9b39a17cc72c8be4813d890172eff746470994ac", + "name": "Delightful Pelican Token", + "symbol": "DELPEL-79" + }, + "datatokenBalance": "0", + "exchangeId": "0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44", + "id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44", + "owner": { + "id": "0x03ef3f422d429bcbd4ee5f77da2917a699f237ed" + }, + "price": "33", + "swaps": [ + { + "baseTokenAmount": "33.033", + "by": { + "id": "0x9b39a17cc72c8be4813d890172eff746470994ac" + }, + "createdTimestamp": 1656563684, + "dataTokenAmount": "1", + "tx": "0x0b55482f69169c103563062e109f9d71afa01d18f201c425b24b1c74d3c282a3" + } + ], + "totalSwapValue": "0", + "updates": [] + }, + { + "active": true, + "contract": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02", + "datatoken": { + "id": "0x2cf074e36a802241f2f8ddb35f4a4557b8f1179b", + "name": "Arcadian Eel Token", + "symbol": "ARCEEL-17" + }, + "datatokenBalance": "0", + "exchangeId": "0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb", + "id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb", + "owner": { + "id": "0x87b5606fba13529e1812319d25c6c2cd5c3f3cbc" + }, + "price": "35", + "swaps": [], + "totalSwapValue": "0", + "updates": [] + } + ] + } +} +``` + +