Publish
Last updated
Was this helpful?
Last updated
Was this helpful?
This tutorial guides you through the process of creating your own data NFT and a datatoken using Ocean libraries. To know more about data NFTs and datatokens please refer . Ocean Protocol supports different pricing schemes which can be set while publishing an asset. Please refer for more details on pricing schemes.
Create a new file in the same working directory where configuration file (config.js
) and .env
files are present, and copy the code as listed below.
The code utilizes methods such as NftFactory
and Datatoken
from the Ocean libraries to enable you to interact with the Ocean Protocol and perform various operations related to data NFTs and datatokens.
The createFRE()
performs the following:
Creates a web3 instance and import Ocean configs.
Retrieves the accounts from the web3 instance and sets the publisher.
Defines parameters for the data NFT, including name, symbol, template index, token URI, transferability, and owner.
Defines parameters for the datatoken, including name, symbol, template index, cap, fee amount, payment collector address, fee token address, minter, and multi-party fee address.
Defines parameters for the price schema, including the fixed rate address, base token address, owner, market fee collector, base token decimals, datatoken decimals, fixed rate, market fee, and optional parameters.
Uses the NftFactory to create a data NFT and datatoken with the fixed rate exchange, using the specified parameters.
Retrieves the addresses of the data NFT and datatoken from the result.
Returns the data NFT and datatoken addresses.
Execute script
By utilizing these dependencies and configuration settings, the script can leverage the functionalities provided by the Ocean libraries and interact with the Ocean Protocol ecosystem effectively.