mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
GITBOOK-498: Updated the fees page
This commit is contained in:
parent
7d4cec62d2
commit
51b990be6d
14
SUMMARY.md
14
SUMMARY.md
@ -31,7 +31,7 @@
|
|||||||
* [Claim Rewards Data Farming](user-guides/claim-ocean-rewards.md)
|
* [Claim Rewards Data Farming](user-guides/claim-ocean-rewards.md)
|
||||||
* [Liquidity Pools \[deprecated\]](user-guides/remove-liquidity-using-etherscan.md)
|
* [Liquidity Pools \[deprecated\]](user-guides/remove-liquidity-using-etherscan.md)
|
||||||
* [👨💻 Developers](developers/README.md)
|
* [👨💻 Developers](developers/README.md)
|
||||||
* [Architecture Overview](developers/architecture.md)
|
* [Architecture Overview](developers/contracts/architecture.md)
|
||||||
* [Contracts](developers/contracts/README.md)
|
* [Contracts](developers/contracts/README.md)
|
||||||
* [Data NFTs](developers/contracts/data-nfts.md)
|
* [Data NFTs](developers/contracts/data-nfts.md)
|
||||||
* [Datatokens](developers/contracts/datatokens.md)
|
* [Datatokens](developers/contracts/datatokens.md)
|
||||||
@ -39,7 +39,7 @@
|
|||||||
* [Datatoken Templates](developers/contracts/datatoken-templates.md)
|
* [Datatoken Templates](developers/contracts/datatoken-templates.md)
|
||||||
* [Roles](developers/contracts/roles.md)
|
* [Roles](developers/contracts/roles.md)
|
||||||
* [Pricing Schemas](developers/contracts/pricing-schemas.md)
|
* [Pricing Schemas](developers/contracts/pricing-schemas.md)
|
||||||
* [Fees](developers/fees.md)
|
* [Fees](developers/contracts/fees.md)
|
||||||
* [Revenue](developers/contracts/revenue.md)
|
* [Revenue](developers/contracts/revenue.md)
|
||||||
* [Fractional Ownership](developers/fractional-ownership.md)
|
* [Fractional Ownership](developers/fractional-ownership.md)
|
||||||
* [Community Monetization](developers/community-monetization.md)
|
* [Community Monetization](developers/community-monetization.md)
|
||||||
@ -55,11 +55,11 @@
|
|||||||
* [Customising a Market](developers/build-a-marketplace/customising-your-market.md)
|
* [Customising a Market](developers/build-a-marketplace/customising-your-market.md)
|
||||||
* [Deploying a Market](developers/build-a-marketplace/deploying-market.md)
|
* [Deploying a Market](developers/build-a-marketplace/deploying-market.md)
|
||||||
* [Subgraph](developers/subgraph/README.md)
|
* [Subgraph](developers/subgraph/README.md)
|
||||||
* [Get data NFTs](developers/using-ocean-subgraph/list-data-nfts.md)
|
* [Get data NFTs](developers/subgraph/list-data-nfts.md)
|
||||||
* [Get data NFT information](developers/using-ocean-subgraph/get-data-nft-information.md)
|
* [Get data NFT information](developers/subgraph/get-data-nft-information.md)
|
||||||
* [Get datatokens](developers/using-ocean-subgraph/list-datatokens.md)
|
* [Get datatokens](developers/subgraph/list-datatokens.md)
|
||||||
* [Get datatoken information](developers/using-ocean-subgraph/get-datatoken-information.md)
|
* [Get datatoken information](developers/subgraph/get-datatoken-information.md)
|
||||||
* [Get fixed-rate exchanges](developers/using-ocean-subgraph/list-fixed-rate-exchanges.md)
|
* [Get fixed-rate exchanges](developers/subgraph/list-fixed-rate-exchanges.md)
|
||||||
* [Get veOCEAN stats](developers/subgraph/get-veocean-stats.md)
|
* [Get veOCEAN stats](developers/subgraph/get-veocean-stats.md)
|
||||||
* [List datatoken buyers](developers/subgraph/list-datatoken-buyers.md)
|
* [List datatoken buyers](developers/subgraph/list-datatoken-buyers.md)
|
||||||
* [Ocean.py](developers/ocean.py/README.md)
|
* [Ocean.py](developers/ocean.py/README.md)
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
---
|
|
||||||
description: Ocean Protocol Architecture Adventure!
|
|
||||||
---
|
|
||||||
|
|
||||||
# Architecture Overview
|
|
||||||
|
|
||||||
Embark on an exploration of the innovative realm of Ocean Protocol, where data flows seamlessly and AI achieves new heights. Dive into the intricately layered architecture that converges data and services, fostering a harmonious collaboration. Let us delve deep and uncover the profound design of Ocean Protocol.🐬
|
|
||||||
|
|
||||||
<figure><img src="../.gitbook/assets/OP High Level Architecture.jpg" alt=""><figcaption><p>Overview of the Ocean Protocol Architecture</p></figcaption></figure>
|
|
||||||
|
|
||||||
### Layer 1: The Foundational Blockchain Layer
|
|
||||||
|
|
||||||
At the core of Ocean Protocol lies the robust [Blockchain Layer](contracts/). Powered by blockchain technology, this layer ensures secure and transparent transactions. It forms the bedrock of decentralized trust, where data providers and consumers come together to trade valuable assets. 
|
|
||||||
|
|
||||||
The [smart contracts](contracts/) are deployed on the Ethereum mainnet and other compatible [networks](../discover/networks/). The libraries encapsulate the calls to these smart contracts and provide features like publishing new assets, facilitating consumption, managing pricing, and much more. To explore the contracts in more depth, go ahead to the [contracts](contracts/) section.
|
|
||||||
|
|
||||||
### Layer 2: The Empowering Middle Layer
|
|
||||||
|
|
||||||
Above the smart contracts, you'll find essential [libraries](architecture.md#libraries) employed by applications within the Ocean Protocol ecosystem, the [middleware components](architecture.md#middleware-components), and [Compute-to-Data](architecture.md#compute-to-data).
|
|
||||||
|
|
||||||
#### Libraries
|
|
||||||
|
|
||||||
These libraries include [Ocean.js](broken-reference), a JavaScript library, and [Ocean.py](ocean.py/), a Python library. They serve as powerful tools for developers, enabling integration and interaction with the protocol.
|
|
||||||
|
|
||||||
1. [Ocean.js](broken-reference): Ocean.js is a JavaScript library that serves as a powerful tool for developers looking to integrate their applications with the Ocean Protocol ecosystem. Designed to facilitate interaction with the protocol, Ocean.js provides a comprehensive set of functionalities, including data tokenization, asset management, and smart contract interaction. Ocean.js simplifies the process of implementing data access controls, building dApps, and exploring data sets within a decentralized environment. 
|
|
||||||
2. [Ocean.py](ocean.py/): Ocean.py is a Python library that empowers developers to integrate their applications with the Ocean Protocol ecosystem. With its rich set of functionalities, Ocean.py provides a comprehensive toolkit for interacting with the protocol. Developers and [data scientists](../data-science/) can leverage Ocean.py to perform a wide range of tasks, including data tokenization, asset management, and smart contract interactions. This library serves as a bridge between Python and the decentralized world of Ocean Protocol, enabling you to harness the power of decentralized data.
|
|
||||||
|
|
||||||
#### Middleware components
|
|
||||||
|
|
||||||
Additionally, in supporting the discovery process, middleware components come into play:
|
|
||||||
|
|
||||||
1. [Aquarius](aquarius/): Aquarius acts as a metadata cache, enhancing search efficiency by caching on-chain data into Elasticsearch. By accelerating metadata retrieval, Aquarius enables faster and more efficient data discovery.
|
|
||||||
2. [Provider](provider/): The Provider component plays a crucial role in facilitating various operations within the ecosystem. It assists in asset downloading, handles [DDO](ddo-specification.md) (Decentralized Data Object) encryption, and establishes communication with the operator-service for Compute-to-Data jobs. This ensures secure and streamlined interactions between different participants.
|
|
||||||
3. [Subgraph](subgraph/): The Subgraph is an off-chain service that utilizes GraphQL to offer efficient access to information related to datatokens, users, and balances. By leveraging the subgraph, data retrieval becomes faster compared to an on-chain query. This enhances the overall performance and responsiveness of applications that rely on accessing this information.
|
|
||||||
|
|
||||||
#### Compute-to-Data
|
|
||||||
|
|
||||||
[Compute-to-Data](compute-to-data/) (C2D) represents a groundbreaking paradigm within the Ocean Protocol ecosystem, revolutionizing the way data is processed and analyzed. With C2D, the traditional approach of moving data to the computation is inverted, ensuring privacy and security. Instead, algorithms are securely transported to the data sources, enabling computation to be performed locally, without the need to expose sensitive data. This innovative framework facilitates collaborative data analysis while preserving data privacy, making it ideal for scenarios where data owners want to retain control over their valuable assets. C2D provides a powerful tool for enabling secure and privacy-preserving data analysis and encourages collaboration among data providers, ensuring the utilization of valuable data resources while maintaining strict privacy protocols.
|
|
||||||
|
|
||||||
### Layer 3: The Accessible Application Layer
|
|
||||||
|
|
||||||
Here, the ocean comes alive with a vibrant ecosystem of dApps, marketplaces, and more. This layer hosts a variety of user-friendly interfaces, applications, and tools, inviting data scientists and curious explorers alike to access, explore, and contribute to the ocean's treasures. 
|
|
||||||
|
|
||||||
Prominently featured within this layer is [Ocean Market](../user-guides/using-ocean-market.md), a hub where data enthusiasts and industry stakeholders converge to discover, trade, and unlock the inherent value of data assets. Beyond Ocean Market, the Application Layer hosts a diverse ecosystem of specialized applications and marketplaces, each catering to unique use cases and industries. Empowered by the capabilities of Ocean Protocol, these applications facilitate advanced data exploration, analytics, and collaborative ventures, revolutionizing the way data is accessed, shared, and monetized. 
|
|
||||||
|
|
||||||
### Layer 4: The Friendly Wallets
|
|
||||||
|
|
||||||
At the top of the Ocean Protocol ecosystem, we find the esteemed [Web 3 Wallets](../discover/wallets/), the gateway for users to immerse themselves in the world of decentralized data transactions. These wallets serve as trusted companions, enabling users to seamlessly transact within the ecosystem, purchase and sell data NFTs, and acquire valuable datatokens. For a more detailed exploration of Web 3 Wallets and their capabilities, you can refer to the [wallet intro page](../discover/wallets/).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
With the layers of the architecture clearly delineated, the stage is set for a comprehensive exploration of their underlying logic and intricate design. By examining each individually, we can gain a deeper understanding of their unique characteristics and functionalities.
|
|
@ -24,7 +24,7 @@ If you’re part of an established organization or a growing startup, you’ll 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.
|
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 dApp 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 dApp 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](contracts/fees.md) page.
|
||||||
|
|
||||||
Another new opportunity is using your own **ERC20** token in your dApp, where it’s used as the unit of exchange. This is fully supported and can be a great way to ensure the sustainability of your project.
|
Another new opportunity is using your own **ERC20** token in your dApp, where it’s used as the unit of exchange. This is fully supported and can be a great way to ensure the sustainability of your project.
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ By utilizing ERC721 tokens, Ocean V4 **grants data creators greater flexibility
|
|||||||
|
|
||||||
Ocean V4 brings forth enhanced opportunities for marketplace operators, creating a conducive environment for the emergence of a thriving market of **third-party Providers**.
|
Ocean V4 brings forth enhanced opportunities for marketplace operators, creating a conducive environment for the emergence of a thriving market of **third-party Providers**.
|
||||||
|
|
||||||
With Ocean V4, marketplace operators can unlock additional benefits. Firstly, the V4 smart contracts empower marketplace operators to collect [fees](../fees.md) not only during **data consumption** but also through **fixed-rate exchanges**. This expanded revenue model allows operators to derive more value from the ecosystem. Moreover, in Ocean V4, the marketplace operator has the authority to determine the fee value, providing them with **increased control** over their pricing strategies.
|
With Ocean V4, marketplace operators can unlock additional benefits. Firstly, the V4 smart contracts empower marketplace operators to collect [fees](fees.md) not only during **data consumption** but also through **fixed-rate exchanges**. This expanded revenue model allows operators to derive more value from the ecosystem. Moreover, in Ocean V4, the marketplace operator has the authority to determine the fee value, providing them with **increased control** over their pricing strategies.
|
||||||
|
|
||||||
In addition to empowering marketplace operators, Ocean V4 facilitates the participation of third-party [Providers](../provider/) who can offer compute services in exchange for a fee. This paves the way for the development of a diverse marketplace of Providers. This model supports both centralized trusted providers, where data publishers and consumers have established trust relationships, as well as trustless providers that leverage decentralization or other privacy-preserving mechanisms.
|
In addition to empowering marketplace operators, Ocean V4 facilitates the participation of third-party [Providers](../provider/) who can offer compute services in exchange for a fee. This paves the way for the development of a diverse marketplace of Providers. This model supports both centralized trusted providers, where data publishers and consumers have established trust relationships, as well as trustless providers that leverage decentralization or other privacy-preserving mechanisms.
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ Key features of the V4 smart contracts:
|
|||||||
* Interoperability with the NFT ecosystem (and DeFi & DAO tools).
|
* Interoperability with the NFT ecosystem (and DeFi & DAO tools).
|
||||||
* Allows new data [NFT & datatoken templates](datatoken-templates.md), for flexibility and future-proofing.
|
* Allows new data [NFT & datatoken templates](datatoken-templates.md), for flexibility and future-proofing.
|
||||||
* Besides base data IP, you can use data NFTs to **implement comments & ratings, verifiable claims, identity credentials, and social media posts**. They can point to parent data NFTs, enabling the nesting of comments on comments, or replies to tweets. All on-chain, GDPR-compliant, easily searched, with js & py drivers 🤯
|
* Besides base data IP, you can use data NFTs to **implement comments & ratings, verifiable claims, identity credentials, and social media posts**. They can point to parent data NFTs, enabling the nesting of comments on comments, or replies to tweets. All on-chain, GDPR-compliant, easily searched, with js & py drivers 🤯
|
||||||
* Introduce an advanced [Fee](../fees.md) structure both for Marketplace and Provider runners 💰
|
* Introduce an advanced [Fee](fees.md) structure both for Marketplace and Provider runners 💰
|
||||||
* [Roles](roles.md) Administration: there are now multiple roles for a more flexible administration both at [NFT](data-nfts.md) and [ERC20](datatokens.md) levels 👥
|
* [Roles](roles.md) Administration: there are now multiple roles for a more flexible administration both at [NFT](data-nfts.md) and [ERC20](datatokens.md) levels 👥
|
||||||
* When the NFT is transferred, it auto-updates all permissions, e.g. who receives payment, or who can mint derivative ERC20 datatokens.
|
* When the NFT is transferred, it auto-updates all permissions, e.g. who receives payment, or who can mint derivative ERC20 datatokens.
|
||||||
* Key-value store in the NFT contract: NFT contract can be used to store custom key-value pairs (ERC725Y standard) enabling applications like soulbound tokens and Sybil protection approaches 🗃️
|
* Key-value store in the NFT contract: NFT contract can be used to store custom key-value pairs (ERC725Y standard) enabling applications like soulbound tokens and Sybil protection approaches 🗃️
|
||||||
|
@ -4,80 +4,106 @@ description: The Ocean Protocol defines various fees for creating a sustainabili
|
|||||||
|
|
||||||
# Fees
|
# Fees
|
||||||
|
|
||||||
### Path to Sustainability
|
One transaction may have fees going to several entities, such as the market where the asset was published, or the Ocean Community. Here are all of them:
|
||||||
|
|
||||||
Ocean Protocol achieves sustainability via the [Web3 sustainability loop](https://blog.oceanprotocol.com/the-web3-sustainability-loop-b2a4097a36e).
|
* Publish Market: the market where the asset was published.
|
||||||
|
* Consume Market: the market where the asset was consumed.
|
||||||
|
* Provider: the entity facilitating asset consumption. May serve up data, run compute, etc.
|
||||||
|
* Ocean Community: Ocean Community Wallet.
|
||||||
|
|
||||||
* The project grows and improves through the efforts of OceanDAO grant recipients.
|
### Publish fee
|
||||||
* The OceanDAO votes to decide which proposals receive grants.
|
|
||||||
* Grant funds are sourced from the Ocean Protocol community treasury.
|
|
||||||
* The Ocean Protocol community collects fees when users interact with the protocol, thus completing the sustainability loop.
|
|
||||||
|
|
||||||
### Fee types
|
When you publish an asset on the Ocean marketplace, there are currently no charges for publishing fees :tada:
|
||||||
|
|
||||||
|
However, if you're building a custom marketplace, you have the flexibility to include a publishing fee by adding an extra transaction in the publish flow. Depending on your marketplace's unique use case, you, as the marketplace owner, can decide whether or not to implement this fee. We believe in giving you the freedom to tailor your marketplace to your specific needs and preferences.
|
||||||
|
|
||||||
|
| Value in Ocean Market | Value in Other Markets |
|
||||||
|
| --------------------- | ------------------------------ |
|
||||||
|
| 0% | Customizable in market config. |
|
||||||
|
|
||||||
#### Publish fee
|
### Consume(aka. Order) fee
|
||||||
|
|
||||||
Publish fees can be charged to a publisher when they publish an asset.
|
When a user exchanges a [datatoken](datatokens.md) for the privilege of downloading an asset or initiating a compute job that utilizes the asset, consume fees come into play. These fees are associated with accessing an asset and include:
|
||||||
|
|
||||||
Currently, the Ocean marketplace does not charge a publishing fee. Custom marketplaces can charge a publishing fee by adding an extra transaction in the publish flow.
|
1. **Publisher Market** Consumption Fee 
|
||||||
|
* Defined during the ERC20 [creation](https://github.com/oceanprotocol/contracts/blob/b937a12b50dc4bdb7a6901c33e5c8fa136697df7/contracts/templates/ERC721Template.sol#L334).
|
||||||
|
* Defined as Address, Token, Amount. The amount is an absolute value(not a percentage).
|
||||||
|
* A marketplace can charge a specified amount per order. 
|
||||||
|
* Eg: A market can set a fixed fee of 10 USDT per order, no matter what pricing schemas are used (fixedrate with ETH, BTC, dispenser, etc).
|
||||||
|
2. **Consume Market** Consumption Fee 
|
||||||
|
*  A market can specify what fee it wants on the order function.
|
||||||
|
3. **Provider Consumption** Fees 
|
||||||
|
* Defined by the [Provider](../provider/) for any consumption.
|
||||||
|
* Expressed in: Address, Token, Amount (absolute), Timeout.
|
||||||
|
* You can retrieve them when calling the initialize endpoint. 
|
||||||
|
* Eg: A provider can charge a fixed fee of 10 USDT per consume, irrespective of the pricing schema used (e.g., fixed rate with ETH, BTC, dispenser).
|
||||||
|
4. **Ocean Community** Fee
|
||||||
|
* Ocean's smart contracts collect **Ocean Community fees** during order operations. These fees are reinvested in community projects and distributed to the veOcean holders through Data Farming.
|
||||||
|
* This fee is set at the [smart contract](https://github.com/oceanprotocol/contracts/blob/main/contracts/communityFee/OPFCommunityFeeCollector.sol) level.
|
||||||
|
* It can be updated by Ocean Protocol Foundation. See details in our [smart contracts](https://github.com/oceanprotocol/contracts/blob/main/contracts/pools/FactoryRouter.sol#L391-L407).
|
||||||
|
|
||||||
Based on the use case of the marketplace, the marketplace owner can decide if this fee should be charged or not.
|
<details>
|
||||||
|
|
||||||
#### Consume(aka. Order) fee
|
<summary>Update Ocean Community Fees</summary>
|
||||||
|
|
||||||
Consume fees are charged when a user holding a datatoken exchanges it for the right to download an asset or to start a compute job that uses the asset.
|
The Ocean Protocol Foundation can [change](https://github.com/oceanprotocol/contracts/blob/main/contracts/pools/FactoryRouter.sol#L391-L407) the Ocean community fees.
|
||||||
|
|
||||||
These are the fees that are applied whenever a user pays to access an asset:
|
```solidity
|
||||||
|
/**
|
||||||
|
* @dev updateOPCFee
|
||||||
|
* Updates OP Community Fees
|
||||||
|
* @param _newSwapOceanFee Amount charged for swapping with ocean approved tokens
|
||||||
|
* @param _newSwapNonOceanFee Amount charged for swapping with non ocean approved tokens
|
||||||
|
* @param _newConsumeFee Amount charged from consumeFees
|
||||||
|
* @param _newProviderFee Amount charged for providerFees
|
||||||
|
*/
|
||||||
|
function updateOPCFee(uint256 _newSwapOceanFee, uint256 _newSwapNonOceanFee,
|
||||||
|
uint256 _newConsumeFee, uint256 _newProviderFee) external onlyRouterOwner {
|
||||||
|
|
||||||
* Consume Market Consumption Fee
|
swapOceanFee = _newSwapOceanFee;
|
||||||
* Publisher Market Consumption Fee
|
swapNonOceanFee = _newSwapNonOceanFee;
|
||||||
* Provider Consumption Fees
|
consumeFee = _newConsumeFee;
|
||||||
* [Ocean Community Fee](fees.md#ocean-community-fee)
|
providerFee = _newProviderFee;
|
||||||
|
emit OPCFeeChanged(msg.sender, _newSwapOceanFee, _newSwapNonOceanFee, _newConsumeFee, _newProviderFee);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Ocean Community fee
|
</details>
|
||||||
|
|
||||||
Ocean's smart contracts collect **Ocean Community fees** during order operations. These fees are reinvested in community projects and distributed to the veOcean holders through Data Farming.
|
Each of these fees plays a role in ensuring fair compensation and supporting the Ocean community. 
|
||||||
|
|
||||||
The provider Ocean Community order fee is 0.03 DT per order operation.
|
| Fee | Value in Ocean Market | Value in Other Markets |
|
||||||
|
| ---------------- | --------------------- | -------------------------------------------------------- |
|
||||||
|
| Publisher Market | 0 | Customizable in market config. |
|
||||||
|
| Consume Market | 0 | Customizable in market config. |
|
||||||
|
| Provider | 0 | Customizable. See details [below](fees.md#provider-fee). |
|
||||||
|
| Ocean Community | 0.03 DT | 0.03 DT |
|
||||||
|
|
||||||
These fees can be updated by the Ocean Protocol Foundation.
|
### Provider fee
|
||||||
|
|
||||||
#### Provider fee
|
[Providers](../provider/) facilitate data consumption, initiate compute jobs, encrypt and decrypt DDOs, and verify user access to specific data assets or services. 
|
||||||
|
|
||||||
Provider is a component of Ocean Protocol's ecosystem that facilitates data consumption, starts compute jobs, encrypts DDOs, and decrypts DDOs. The provider also validates if the user can access a particular data asset or service. To learn more about Provider, click here.
|
Provider fees serve as [compensation](../community-monetization.md#3.-running-your-own-provider) to the individuals or organizations operating their own provider instances when users request assets. 
|
||||||
|
|
||||||
Provider fees are paid to the individual or organization running their Provider instance when the user orders an asset. These fees can be set to an absolute amount, not as a percentage. The provider can also specify which token the fees must be paid in - they don't have to be the same token used in the consuming market.
|
* Defined by the [Provider](../provider/) for any consumption.
|
||||||
|
* Expressed in: Address, Token, Amount (absolute), Timeout.
|
||||||
|
* You can retrieve them when calling the initialize endpoint. 
|
||||||
|
* These fees can be set as a **fixed amount** rather than a percentage. 
|
||||||
|
* Providers have the flexibility to specify the token in which the fees must be paid, which can differ from the token used in the consuming market.
|
||||||
|
* Provider fees can be utilized to charge for [computing](../compute-to-data/) resources. Consumers can select the desired payment amount based on the compute resources required to execute an algorithm within the [Compute-to-Data](../compute-to-data/) environment, aligning with their specific needs.
|
||||||
|
* Eg: A provider can charge a fixed fee of 10 USDT per consume, irrespective of the pricing schema used (e.g., fixed rate with ETH, BTC, dispenser).
|
||||||
|
* Eg: A provider may impose a fixed fee of 15 DAI to reserve compute resources for 1 hour, enabling the initiation of compute jobs.
|
||||||
|
|
||||||
Provider fees can also be used to charge for computing resources. Based on the compute resources needed to run an algorithm in the Compute-to-Data environment, a consumer can choose the amount to pay according to their needs.
|
These fees play a crucial role in incentivizing individuals and organizations to operate provider instances and charge consumers based on their resource usage. By doing so, they contribute to the growth and sustainability of the Ocean Protocol ecosystem.
|
||||||
|
|
||||||
These fees incentivize individuals and organizations to run their provider instances and charge consumers according to resource usage.
|
|
||||||
|
|
||||||
### Fee values
|
|
||||||
|
|
||||||
The table is periodically updated. Users are advised to confirm new values through the [contracts](https://github.com/oceanprotocol/contracts) and the [market](https://github.com/oceanprotocol/market).
|
|
||||||
|
|
||||||
#### Publish fees
|
|
||||||
|
|
||||||
| Market/Type | Value in Ocean Market, using any Provider | Value in Other Markets |
|
|
||||||
| ----------- | ----------------------------------------- | ---------------------- |
|
|
||||||
| - | 0% | 0% |
|
|
||||||
|
|
||||||
#### Order fees (1 DT)
|
|
||||||
|
|
||||||
| Market/Type | Value in Ocean Market, using any Provider | Value in Other Markets |
|
|
||||||
| ----------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------- |
|
|
||||||
| <p>publishMarket<br>Absolute value, in any token. E.g. 5 USDT</p> | 0 | Set in market config, by the publishing market. |
|
|
||||||
| <p>consumeMarket<br>Absolute value, in any token. E.g. 2 DAI</p> | 0 | Set in market config, by the consuming market. |
|
|
||||||
| <p>Ocean Community<br>Fixed price in DT</p> | 0.03 DT | 0.03 DT |
|
|
||||||
|
|
||||||
#### Ocean Provider fees
|
|
||||||
|
|
||||||
| Type | OPF Provider | 3rd party Provider |
|
| Type | OPF Provider | 3rd party Provider |
|
||||||
| ---------------------------------------------------------------------------- | :--------------------: | ------------------------------ |
|
| ---------------------------------------------------------------------------- | :--------------------: | --------------------------------------------------------------------- |
|
||||||
| Token in which fee is charged: `PROVIDER_FEE_TOKEN` | OCEAN | E.g. USDC |
|
| Token to charge the fee: `PROVIDER_FEE_TOKEN` | OCEAN | <p>Customizable by the Provider Owner. <br>E.g. <code>USDC</code></p> |
|
||||||
| Download: `COST_PER_MB` | 0 | Set in Provider envvars. |
|
| Download: `COST_PER_MB` | 0 | Customizable in the Provider `envvars`. |
|
||||||
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 60 secs max</p> | 0 | Set in OperatorEngine envvars. |
|
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 60 secs max</p> | 0 | Customizable in the OperatorEngine `envvars`. |
|
||||||
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 1 hour max</p> | 1.0 OCEAN/min | Set in OperatorEngine envvars. |
|
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 1 hour max</p> | 1.0 OCEAN/min | Customizable in the OperatorEngine `envvars`. |
|
||||||
| Ocean Community | 0% of the Provider fee | 0% of the Provider fee |
|
| Ocean Community | 0% of the Provider fee | 0% of the Provider fee. |
|
||||||
|
|
||||||
|
{% hint style="info" %}
|
||||||
|
Stay up-to-date with the latest information! The values within the system are regularly updated. We recommend verifying the most recent values directly from the [contracts](https://github.com/oceanprotocol/contracts) and the [market](https://github.com/oceanprotocol/market).
|
||||||
|
{% endhint %}
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
---
|
|
||||||
description: The Ocean Protocol defines various fees for creating a sustainability loop.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Fees
|
|
||||||
|
|
||||||
### Path to Sustainability
|
|
||||||
|
|
||||||
Ocean Protocol achieves sustainability via the [Web3 sustainability loop](https://blog.oceanprotocol.com/the-web3-sustainability-loop-b2a4097a36e).
|
|
||||||
|
|
||||||
* The project grows and improves through the efforts of OceanDAO grant recipients.
|
|
||||||
* The OceanDAO votes to decide which proposals receive grants.
|
|
||||||
* Grant funds are sourced from the Ocean Protocol community treasury.
|
|
||||||
* The Ocean Protocol community collects fees when users interact with the protocol, thus completing the sustainability loop.
|
|
||||||
|
|
||||||
### Fee types
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Publish fee
|
|
||||||
|
|
||||||
Publish fees can be charged to a publisher when they publish an asset.
|
|
||||||
|
|
||||||
Currently, the Ocean marketplace does not charge a publishing fee. Custom marketplaces can charge a publishing fee by adding an extra transaction in the publish flow.
|
|
||||||
|
|
||||||
Based on the use case of the marketplace, the marketplace owner can decide if this fee should be charged or not.
|
|
||||||
|
|
||||||
#### Consume(aka. Order) fee
|
|
||||||
|
|
||||||
Consume fees are charged when a user holding a datatoken exchanges it for the right to download an asset or to start a compute job that uses the asset.
|
|
||||||
|
|
||||||
These are the fees that are applied whenever a user pays to access an asset:
|
|
||||||
|
|
||||||
* Consume Market Consumption Fee
|
|
||||||
* Publisher Market Consumption Fee
|
|
||||||
* Provider Consumption Fees
|
|
||||||
* [Ocean Community Fee](fees.md#ocean-community-fee)
|
|
||||||
|
|
||||||
#### Ocean Community fee
|
|
||||||
|
|
||||||
Ocean's smart contracts collect **Ocean Community fees** during order operations. These fees are reinvested in community projects and distributed to the veOcean holders through Data Farming.
|
|
||||||
|
|
||||||
The provider Ocean Community order fee is 0.03 DT per order operation.
|
|
||||||
|
|
||||||
These fees can be updated by the Ocean Protocol Foundation.
|
|
||||||
|
|
||||||
#### Provider fee
|
|
||||||
|
|
||||||
Provider is a component of Ocean Protocol's ecosystem that facilitates data consumption, starts compute jobs, encrypts DDOs, and decrypts DDOs. The provider also validates if the user can access a particular data asset or service. To learn more about Provider, click here.
|
|
||||||
|
|
||||||
Provider fees are paid to the individual or organization running their Provider instance when the user orders an asset. These fees can be set to an absolute amount, not as a percentage. The provider can also specify which token the fees must be paid in - they don't have to be the same token used in the consuming market.
|
|
||||||
|
|
||||||
Provider fees can also be used to charge for computing resources. Based on the compute resources needed to run an algorithm in the Compute-to-Data environment, a consumer can choose the amount to pay according to their needs.
|
|
||||||
|
|
||||||
These fees incentivize individuals and organizations to run their provider instances and charge consumers according to resource usage.
|
|
||||||
|
|
||||||
### Fee values
|
|
||||||
|
|
||||||
The table is periodically updated. Users are advised to confirm new values through the [contracts](https://github.com/oceanprotocol/contracts) and the [market](https://github.com/oceanprotocol/market).
|
|
||||||
|
|
||||||
#### Publish fees
|
|
||||||
|
|
||||||
| Market/Type | Value in Ocean Market, using any Provider | Value in Other Markets |
|
|
||||||
| ----------- | ----------------------------------------- | ---------------------- |
|
|
||||||
| - | 0% | 0% |
|
|
||||||
|
|
||||||
#### Order fees (1 DT)
|
|
||||||
|
|
||||||
| Market/Type | Value in Ocean Market, using any Provider | Value in Other Markets |
|
|
||||||
| ----------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------- |
|
|
||||||
| <p>publishMarket<br>Absolute value, in any token. E.g. 5 USDT</p> | 0 | Set in market config, by the publishing market. |
|
|
||||||
| <p>consumeMarket<br>Absolute value, in any token. E.g. 2 DAI</p> | 0 | Set in market config, by the consuming market. |
|
|
||||||
| <p>Ocean Community<br>Fixed price in DT</p> | 0.03 DT | 0.03 DT |
|
|
||||||
|
|
||||||
#### Ocean Provider fees
|
|
||||||
|
|
||||||
| Type | OPF Provider | 3rd party Provider |
|
|
||||||
| ---------------------------------------------------------------------------- | :--------------------: | ------------------------------ |
|
|
||||||
| Token in which fee is charged: `PROVIDER_FEE_TOKEN` | OCEAN | E.g. USDC |
|
|
||||||
| Download: `COST_PER_MB` | 0 | Set in Provider envvars. |
|
|
||||||
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 60 secs max</p> | 0 | Set in OperatorEngine envvars. |
|
|
||||||
| <p>Compute: <code>COST_PER_MIN</code><br>Environment: 1 CPU, 1 hour max</p> | 1.0 OCEAN/min | Set in OperatorEngine envvars. |
|
|
||||||
| Ocean Community | 0% of the Provider fee | 0% of the Provider fee |
|
|
@ -1,195 +0,0 @@
|
|||||||
---
|
|
||||||
description: >-
|
|
||||||
Explore the Power of Querying: Unveiling In-Depth Details of Individual Data
|
|
||||||
NFTs
|
|
||||||
---
|
|
||||||
|
|
||||||
# Get data NFT information
|
|
||||||
|
|
||||||
Now that you are familiar with the process of retrieving a list of data NFTs 😎, let's explore how to obtain more specific details about a particular NFT through querying. By utilizing the knowledge you have gained, you can customize your GraphQL query to include additional parameters such as the NFT's metadata, creator information, template, or any other relevant data points. This will enable you to delve deeper into the intricacies of a specific NFT and gain a comprehensive understanding of its attributes. With this newfound capability, you can unlock valuable insights and make informed decisions based on the specific details retrieved. So, let's dive into the fascinating world of querying and unravel the unique characteristics of individual data NFTs.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The result of the following GraphQL query returns the information about a particular data NFT. In this example, `0x1c161d721e6d99f58d47f709cdc77025056c544c`.
|
|
||||||
|
|
||||||
_PS: In this example, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
|
||||||
|
|
||||||
{% tabs %}
|
|
||||||
{% tab title="Javascript" %}
|
|
||||||
The javascript below can be used to run the query and fetch the information of a data NFT. If you wish to change the network, replace the variable's value `network` as needed. Change the value of the variable `datanftAddress` with the address of your choice.
|
|
||||||
|
|
||||||
```runkit nodeVersion="18.x.x"
|
|
||||||
var axios = require('axios');
|
|
||||||
|
|
||||||
const datanftAddress = "0x1c161d721e6d99f58d47f709cdc77025056c544c";
|
|
||||||
|
|
||||||
const query = `{
|
|
||||||
nft (id:"${datanftAddress}", subgraphError:deny){
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
creator
|
|
||||||
createdTimestamp
|
|
||||||
providerUrl
|
|
||||||
managerRole
|
|
||||||
erc20DeployerRole
|
|
||||||
storeUpdateRole
|
|
||||||
metadataRole
|
|
||||||
tokenUri
|
|
||||||
template
|
|
||||||
orderCount
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
const network = "mainnet"
|
|
||||||
var config = {
|
|
||||||
method: 'post',
|
|
||||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: JSON.stringify({ "query": query })
|
|
||||||
};
|
|
||||||
|
|
||||||
axios(config)
|
|
||||||
.then(function (response) {
|
|
||||||
let result = JSON.stringify(response.data)
|
|
||||||
console.log(result)
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Python" %}
|
|
||||||
The Python script below can be used to run the query and fetch the details about an NFT. If you wish to change the network, replace the variable's value `base_url` as needed. Change the value of the variable dataNFT\_address with the address of the datatoken of your choice.
|
|
||||||
|
|
||||||
**Create script**
|
|
||||||
|
|
||||||
{% code title="dataNFT_information.py" %}
|
|
||||||
```python
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
dataNFT_address = "0x1c161d721e6d99f58d47f709cdc77025056c544c"
|
|
||||||
query = """
|
|
||||||
{{
|
|
||||||
nft (id:"{0}", subgraphError:deny){{
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
creator
|
|
||||||
createdTimestamp
|
|
||||||
providerUrl
|
|
||||||
managerRole
|
|
||||||
erc20DeployerRole
|
|
||||||
storeUpdateRole
|
|
||||||
metadataRole
|
|
||||||
tokenUri
|
|
||||||
template
|
|
||||||
orderCount
|
|
||||||
}}
|
|
||||||
}}""".format(
|
|
||||||
dataNFT_address
|
|
||||||
)
|
|
||||||
|
|
||||||
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**
|
|
||||||
|
|
||||||
<pre class="language-bash"><code class="lang-bash"><strong>python dataNFT_information.py
|
|
||||||
</strong></code></pre>
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Query" %}
|
|
||||||
Copy the query to fetch the information about a data NFT in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). If you want to fetch the information about another NFT, replace the `id` with the address of your choice.
|
|
||||||
|
|
||||||
```graphql
|
|
||||||
{
|
|
||||||
nft (id:"0x1c161d721e6d99f58d47f709cdc77025056c544c", subgraphError:deny){
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
creator
|
|
||||||
createdTimestamp
|
|
||||||
providerUrl
|
|
||||||
managerRole
|
|
||||||
erc20DeployerRole
|
|
||||||
storeUpdateRole
|
|
||||||
metadataRole
|
|
||||||
tokenUri
|
|
||||||
template
|
|
||||||
orderCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
{% endtabs %}
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary>Sample response</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"nft": {
|
|
||||||
"address": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185270,
|
|
||||||
"createdTimestamp": 1658397870,
|
|
||||||
"creator": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"erc20DeployerRole": [
|
|
||||||
"0x1706df1f2d93558d1d77bed49ccdb8b88fafc306"
|
|
||||||
],
|
|
||||||
"id": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
|
||||||
"managerRole": [
|
|
||||||
"0xd30dd83132f2227f114db8b90f565bca2832afbd"
|
|
||||||
],
|
|
||||||
"metadataRole": null,
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"orderCount": "1",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"providerUrl": "https://v4.provider.mainnet.oceanprotocol.com",
|
|
||||||
"storeUpdateRole": null,
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"template": "",
|
|
||||||
"tokenUri": "<removed>",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x327a9da0d2e9df945fd2f8e10b1caa77acf98e803c5a2f588597172a0bcbb93a"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
@ -1,238 +0,0 @@
|
|||||||
---
|
|
||||||
description: >-
|
|
||||||
Explore the Power of Querying: Unveiling In-Depth Details of Individual
|
|
||||||
Datatokens
|
|
||||||
---
|
|
||||||
|
|
||||||
# Get datatoken information
|
|
||||||
|
|
||||||
To fetch detailed information about a specific datatoken, you can utilize the power of GraphQL queries. By constructing a query tailored to your needs, you can access key parameters such as the datatoken's ID, name, symbol, total supply, creator, and associated dataTokenAddress. This allows you to gain a deeper understanding of the datatoken's characteristics and properties. With this information at your disposal, you can make informed decisions, analyze market trends, and explore the vast potential of datatokens within the Ocean ecosystem. Harness the capabilities of GraphQL and unlock a wealth of datatoken insights.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The result of the following GraphQL query returns the information about a particular datatoken. Here, `0x122d10d543bc600967b4db0f45f80cb1ddee43eb` is the address of the datatoken.
|
|
||||||
|
|
||||||
_PS: In this example, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
|
||||||
|
|
||||||
{% tabs %}
|
|
||||||
{% tab title="Javascript" %}
|
|
||||||
The javascript below can be used to run the query and fetch the information of a datatoken. If you wish to change the network, replace the variable's value `network` as needed. Change the value of the variable `datatokenAddress` with the address of your choice.
|
|
||||||
|
|
||||||
```runkit nodeVersion="18.x.x"
|
|
||||||
var axios = require('axios');
|
|
||||||
|
|
||||||
const datatokenAddress = "0x122d10d543bc600967b4db0f45f80cb1ddee43eb";
|
|
||||||
|
|
||||||
const query = `{
|
|
||||||
token(id:"${datatokenAddress}", subgraphError: deny){
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
consumer{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fixedRateExchanges(subgraphError:deny){
|
|
||||||
id
|
|
||||||
price
|
|
||||||
active
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
const network = "mainnet"
|
|
||||||
var config = {
|
|
||||||
method: 'post',
|
|
||||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: JSON.stringify({ "query": query })
|
|
||||||
};
|
|
||||||
|
|
||||||
axios(config)
|
|
||||||
.then(function (response) {
|
|
||||||
let result = JSON.stringify(response.data)
|
|
||||||
console.log(result);
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Python" %}
|
|
||||||
The Python script below can be used to run the query and fetch a datatoken information. If you wish to change the network, replace the variable's value `base_url` as needed. Change the value of the variable `datatoken_address` with the address of the datatoken of your choice.
|
|
||||||
|
|
||||||
**Create script**
|
|
||||||
|
|
||||||
{% code title="datatoken_information.py" %}
|
|
||||||
```python
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
datatoken_address = "0x122d10d543bc600967b4db0f45f80cb1ddee43eb"
|
|
||||||
query = """
|
|
||||||
{{
|
|
||||||
token(id:"{0}", subgraphError: deny){{
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {{
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){{
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {{
|
|
||||||
id
|
|
||||||
}}
|
|
||||||
consumer{{
|
|
||||||
id
|
|
||||||
}}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}}
|
|
||||||
}}
|
|
||||||
fixedRateExchanges(subgraphError:deny){{
|
|
||||||
id
|
|
||||||
price
|
|
||||||
active
|
|
||||||
}}
|
|
||||||
}}""".format(
|
|
||||||
datatoken_address
|
|
||||||
)
|
|
||||||
|
|
||||||
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**
|
|
||||||
|
|
||||||
<pre class="language-bash"><code class="lang-bash"><strong>python datatoken_information.py
|
|
||||||
</strong></code></pre>
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Query" %}
|
|
||||||
Copy the query to fetch the information of a datatoken in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). 
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
token(id:"0x122d10d543bc600967b4db0f45f80cb1ddee43eb", subgraphError: deny){
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
consumer{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fixedRateExchanges(subgraphError:deny){
|
|
||||||
id
|
|
||||||
price
|
|
||||||
active
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
{% endtabs %}
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary>Sample response</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"fixedRateExchanges": [
|
|
||||||
{
|
|
||||||
"active": true,
|
|
||||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44",
|
|
||||||
"price": "33"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"active": true,
|
|
||||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb",
|
|
||||||
"price": "35"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"active": true,
|
|
||||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2dccaa373e4b65d5ec153c150270e989d1bda1efd3794c851e45314c40809f9c",
|
|
||||||
"price": "33"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"token": {
|
|
||||||
"cap": "115792089237316195423570985008687900000000000000000000000000",
|
|
||||||
"holderCount": "0",
|
|
||||||
"id": "0x122d10d543bc600967b4db0f45f80cb1ddee43eb",
|
|
||||||
"isDatatoken": true,
|
|
||||||
"name": "Brave Lobster Token",
|
|
||||||
"nft": {
|
|
||||||
"address": "0xea615374949a2405c3ee555053eca4d74ec4c2f0",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"symbol": "OCEAN-NFT"
|
|
||||||
},
|
|
||||||
"orderCount": "0",
|
|
||||||
"orders": [],
|
|
||||||
"symbol": "BRALOB-11"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
@ -1,250 +0,0 @@
|
|||||||
---
|
|
||||||
description: 'Discover the World of NFTs: Retrieving a List of Data NFTs'
|
|
||||||
---
|
|
||||||
|
|
||||||
# Get data NFTs
|
|
||||||
|
|
||||||
If you are already familiarized with the concept of NFTs, you're off to a great start. However, if you require a refresher, we recommend visiting the [data NFTs and datatokens page](../contracts/datanft-and-datatoken.md) for a quick overview. 
|
|
||||||
|
|
||||||
Now, let us delve into the realm of utilizing the subgraph to extract a list of data NFTs that have been published using the Ocean contracts. By employing GraphQL queries, we can seamlessly retrieve the desired information from the subgraph. You'll see how simple it is :sunglasses:
|
|
||||||
|
|
||||||
You'll find below an example of a GraphQL query that retrieves the first 10 data NFTs from the subgraph. The GraphQL query is structured to access the "nfts" route, extracting the first 10 elements. For each item retrieved, it retrieves the "id," "name," "symbol," "owner," "address," "assetState," "tx," "block," and "transferable" parameters.
|
|
||||||
|
|
||||||
There are several options available to see this query in action. Below, you will find three:
|
|
||||||
|
|
||||||
1. Run the GraphQL query in the GraphiQL interface.
|
|
||||||
2. Execute the query in Python by following the code snippet.
|
|
||||||
3. Execute the query in JavaScript by clicking on the "Run" button of the Javascript tab.
|
|
||||||
|
|
||||||
_PS: In these examples, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
|
||||||
|
|
||||||
{% tabs %}
|
|
||||||
{% tab title="Javascript" %}
|
|
||||||
The javascript below can be used to run the query and retrieve a list of NFTs. If you wish to change the network, then replace the value of `network` variable as needed.
|
|
||||||
|
|
||||||
```runkit nodeVersion="18.x.x"
|
|
||||||
const axios = require('axios')
|
|
||||||
|
|
||||||
const query = `{
|
|
||||||
nfts (skip:0, first: 10, subgraphError:deny){
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
const network = "mainnet"
|
|
||||||
const config = {
|
|
||||||
method: 'post',
|
|
||||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: JSON.stringify({ query: query })
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await axios(config)
|
|
||||||
for (let nft of response.data.data.nfts) {
|
|
||||||
console.log(' id:' + nft.id + ' name: ' + nft.name + ' address: ' + nft.address)
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Python" %}
|
|
||||||
The Python script below can be used to run the query to fetch a list of data NFTs from the subgraph. If you wish to change the network, replace the value of the variable `base_url` as needed.
|
|
||||||
|
|
||||||
**Create script**
|
|
||||||
|
|
||||||
{% code title="list_dataNFTs.py" %}
|
|
||||||
```python
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
query = """
|
|
||||||
{
|
|
||||||
nfts (skip:0, first: 10, subgraphError:deny){
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
}
|
|
||||||
}"""
|
|
||||||
|
|
||||||
|
|
||||||
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_dataNFTs.py
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Query" %}
|
|
||||||
Copy the query to fetch a list of data NFTs in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql).
|
|
||||||
|
|
||||||
```graphql
|
|
||||||
{
|
|
||||||
nfts (skip:0, first: 10, subgraphError:deny){
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
owner
|
|
||||||
address
|
|
||||||
assetState
|
|
||||||
tx
|
|
||||||
block
|
|
||||||
transferable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
{% endtabs %}
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary>Sample response</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"nfts": [
|
|
||||||
{
|
|
||||||
"address": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185270,
|
|
||||||
"id": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x327a9da0d2e9df945fd2f8e10b1caa77acf98e803c5a2f588597172a0bcbb93a"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x1e06501660623aa973474e3c59efb8ba542cb083",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185119,
|
|
||||||
"id": "0x1e06501660623aa973474e3c59efb8ba542cb083",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0xd351ccee22b505d811c29fa524db920815936672b20b8f3a09485e389902fd27"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x2eaa55236f799c6ebec72e77a1a6296ea2e704b1",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185009,
|
|
||||||
"id": "0x2eaa55236f799c6ebec72e77a1a6296ea2e704b1",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0xf6d55306ab4dc339dc1655a2d119af468a79a70fa62ea11de78879da61e89e7b"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x2fbe924f6c92825929dc7785fe05d15e35f2612b",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185235,
|
|
||||||
"id": "0x2fbe924f6c92825929dc7785fe05d15e35f2612b",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0xa9ff9d461b4b7344ea181de32fa6412c7ea8e21f485ab4d8a7b9cfcdb68d9d51"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x4c04433bb1760a66be7713884bb6370e9c567cef",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185169,
|
|
||||||
"id": "0x4c04433bb1760a66be7713884bb6370e9c567cef",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x54c5463e8988b5fa4e4cfe71ee391505801931abe9e94bf1588dd538ec3aa4c9"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x619c500dcb0251b31cd480030db2dcc19866c0c3",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15236619,
|
|
||||||
"id": "0x619c500dcb0251b31cd480030db2dcc19866c0c3",
|
|
||||||
"name": "abc",
|
|
||||||
"owner": "0x12fe650c86cd4346933ef1bcab21a1979d4c6786",
|
|
||||||
"symbol": "GOAL-9956",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x6178b03589cda98573ff52a1afbcc07b14a2fddacc0132595949e9d8a0ed1b32"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x6d45a5b38a122a6dbc042601236d6ecc5c8e343e",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15109853,
|
|
||||||
"id": "0x6d45a5b38a122a6dbc042601236d6ecc5c8e343e",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xbbd33afa85539fa65cc08a2e61a001876d2f13fe",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x27aa77a0bf3f7878910dc7bfe2116d9271138c222b3d898381a5c72eefefe624"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x7400078c5d4fd7704afca45a928d9fc97cbea744",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185056,
|
|
||||||
"id": "0x7400078c5d4fd7704afca45a928d9fc97cbea744",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x2025374cd347e25e2651feec2f2faa2feb26664698eaea42b5dad1a31eda57f8"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x81decdb59dce5b4323e683a76f8fa8dd0eabc560",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 15185003,
|
|
||||||
"id": "0x81decdb59dce5b4323e683a76f8fa8dd0eabc560",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x6ad6ec2ce86bb70e077590a64c886d72975374bd2e993f143d9da8edcaace82b"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0x8684119ecf77c5be41f01760ad466725ffd9b960",
|
|
||||||
"assetState": 0,
|
|
||||||
"block": 14933034,
|
|
||||||
"id": "0x8684119ecf77c5be41f01760ad466725ffd9b960",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"owner": "0x87b5606fba13529e1812319d25c6c2cd5c3f3cbc",
|
|
||||||
"symbol": "OCEAN-NFT",
|
|
||||||
"transferable": true,
|
|
||||||
"tx": "0x55ba746cd8e8fb4c739b8544a9034848082b627500b854cb8db0802dd7beb172"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
@ -1,213 +0,0 @@
|
|||||||
---
|
|
||||||
description: 'Discover the World of datatokens: Retrieving a List of datatokens'
|
|
||||||
---
|
|
||||||
|
|
||||||
# Get datatokens
|
|
||||||
|
|
||||||
With your newfound knowledge of fetching data NFTs and retrieving the associated information, fetching a list of datatokens will be a breeze :ocean:. Building upon your understanding, let's now delve into the process of retrieving a list of datatokens. By applying similar techniques and leveraging the power of GraphQL queries, you'll be able to effortlessly navigate the landscape of datatokens and access the wealth of information they hold. So, let's dive right in and unlock the potential of exploring datatokens with ease and efficiency.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_PS: In this example, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
|
||||||
|
|
||||||
{% tabs %}
|
|
||||||
{% tab title="Javascript" %}
|
|
||||||
The javascript below can be used to run the query. If you wish to change the network, replace the variable's value `network` as needed. 
|
|
||||||
|
|
||||||
```runkit nodeVersion="18.x.x"
|
|
||||||
var axios = require('axios');
|
|
||||||
|
|
||||||
const query = `{
|
|
||||||
tokens(skip:0, first: 2, subgraphError: deny){
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
consumer{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
const network = "mainnet"
|
|
||||||
var config = {
|
|
||||||
method: 'post',
|
|
||||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: JSON.stringify({ "query": query })
|
|
||||||
};
|
|
||||||
|
|
||||||
axios(config)
|
|
||||||
.then(function (response) {
|
|
||||||
let result = JSON.stringify(response.data)
|
|
||||||
console.log(result);
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Python" %}
|
|
||||||
The Python script below can be used to run the query and fetch a list of datatokens. If you wish to change the network, then replace the value of the variable `base_url` as needed.
|
|
||||||
|
|
||||||
**Create script**
|
|
||||||
|
|
||||||
{% code title="list_all_tokens.py" %}
|
|
||||||
```python
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
query = """
|
|
||||||
{{
|
|
||||||
tokens(skip:0, first: 2, subgraphError: deny){{
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {{
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){{
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {{
|
|
||||||
id
|
|
||||||
}}
|
|
||||||
consumer{{
|
|
||||||
id
|
|
||||||
}}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
|
||||||
}}"""
|
|
||||||
|
|
||||||
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_all_tokens.py
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Query" %}
|
|
||||||
Copy the query to fetch a list of datatokens in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). 
|
|
||||||
|
|
||||||
```graphql
|
|
||||||
{
|
|
||||||
tokens(skip:0, first: 2, subgraphError: deny){
|
|
||||||
id
|
|
||||||
symbol
|
|
||||||
nft {
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
address
|
|
||||||
}
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
cap
|
|
||||||
isDatatoken
|
|
||||||
holderCount
|
|
||||||
orderCount
|
|
||||||
orders(skip:0,first:1){
|
|
||||||
amount
|
|
||||||
serviceIndex
|
|
||||||
payer {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
consumer{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
estimatedUSDValue
|
|
||||||
lastPriceToken
|
|
||||||
lastPriceValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
{% endtabs %}
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary>Sample Response</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"tokens": [
|
|
||||||
{
|
|
||||||
"cap": null,
|
|
||||||
"holderCount": "0",
|
|
||||||
"id": "0x0642026e7f0b6ccac5925b4e7fa61384250e1701",
|
|
||||||
"isDatatoken": false,
|
|
||||||
"name": "H2O",
|
|
||||||
"nft": null,
|
|
||||||
"orderCount": "0",
|
|
||||||
"orders": [],
|
|
||||||
"symbol": "H2O"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cap": "115792089237316195423570985008687900000000000000000000000000",
|
|
||||||
"holderCount": "0",
|
|
||||||
"id": "0x122d10d543bc600967b4db0f45f80cb1ddee43eb",
|
|
||||||
"isDatatoken": true,
|
|
||||||
"name": "Brave Lobster Token",
|
|
||||||
"nft": {
|
|
||||||
"address": "0xea615374949a2405c3ee555053eca4d74ec4c2f0",
|
|
||||||
"name": "Ocean Data NFT",
|
|
||||||
"symbol": "OCEAN-NFT"
|
|
||||||
},
|
|
||||||
"orderCount": "0",
|
|
||||||
"orders": [],
|
|
||||||
"symbol": "BRALOB-11"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
@ -1,244 +0,0 @@
|
|||||||
---
|
|
||||||
description: 'Discover the World of NFTs: Retrieving a List of Fixed-rate exchanges'
|
|
||||||
---
|
|
||||||
|
|
||||||
# Get fixed-rate exchanges
|
|
||||||
|
|
||||||
Having gained knowledge about fetching lists of data NFTs and datatokens and extracting specific information about each, let's now explore the process of retrieving the information of fixed-rate exchanges. A fixed-rate exchange refers to a mechanism where data assets can be traded at a predetermined rate or price. These exchanges offer stability and predictability in data transactions, enabling users to securely and reliably exchange data assets based on fixed rates. If you need a refresher on fixed-rate exchanges, visit the [asset pricing](../contracts/pricing-schemas.md#fixed-pricing) page.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_PS: In this example, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
|
||||||
|
|
||||||
{% tabs %}
|
|
||||||
{% tab title="Javascript" %}
|
|
||||||
The javascript below can be used to run the query and fetch a list of fixed-rate exchanges. If you wish to change the network, replace the variable's value `network` as needed. 
|
|
||||||
|
|
||||||
```runkit nodeVersion="18.x.x"
|
|
||||||
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 network = "mainnet"
|
|
||||||
var config = {
|
|
||||||
method: 'post',
|
|
||||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: JSON.stringify({ "query": query })
|
|
||||||
};
|
|
||||||
|
|
||||||
axios(config)
|
|
||||||
.then(function (response) {
|
|
||||||
let result = JSON.stringify(response.data)
|
|
||||||
console.log(result)
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
|
|
||||||
{% tab title="Python" %}
|
|
||||||
The Python script below can be used to run the query and retrieve a list of fixed-rate exchanges. If you wish to change the network, then replace the value of the 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="Query" %}
|
|
||||||
Copy the query to fetch a list of fixed-rate exchanges in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
{% endtab %}
|
|
||||||
{% endtabs %}
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary>Sample response</summary>
|
|
||||||
|
|
||||||
```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": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
@ -106,7 +106,7 @@ With the _free pricing_ schema, the publisher provides an asset that is free to
|
|||||||
|
|
||||||
For more information on the pricing models, please refer this [document](../developers/contracts/pricing-schemas.md).
|
For more information on the pricing models, please refer this [document](../developers/contracts/pricing-schemas.md).
|
||||||
|
|
||||||
For a deep dive into the fee structure, please refer to this [document](../developers/fees.md).
|
For a deep dive into the fee structure, please refer to this [document](../developers/contracts/fees.md).
|
||||||
|
|
||||||
![Asset pricing](../.gitbook/assets/market/publish-3.png)
|
![Asset pricing](../.gitbook/assets/market/publish-3.png)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user