NFT Trader
Ask or search…
K

Concepts

Gain an understanding of how the trading cycle works to effectively implement the SDK.

Index

Trading lifecycle

To effectively utilize the SDK within the platform you are developing, it is necessary to understand some basic concepts revolving around the lifecycle of trading functionality. The act between two users exchanging or trading their NFTs is defined as a "Trade".
Therefore, utilizing the SDK will enable the creation of trades between two users. The users involved in trading are defined as maker and taker. The maker is the initiator of the trade, while the taker is the counterparty of the trade. Every trade has its own life cycle, whose phases can be defined in the following list:
  • Creation phase, carried out by the maker
  • Cancellation phase (optional), carried out by the maker
  • Execution phase, carried out by the taker.
It is important to note that these stages are completely automated by the SDK. The developer is not required to operate on a low level on the blockchain or on assets as these operations are managed by the library itself.

Creation Phase

The creation phase of a Trade is executed by the maker, who is required to approve their assets (i.e., the user authorizes the smart contract to operate on them) and then generate a hash corresponding to the desired order. To generate this hash, the maker's wallet will require a signature. This operation is performed without writing to the blockchain, and therefore no transactions will be created.
The resulting operation will be completely free. The order's hash will be saved within the backend infrastructure of NFT Trader, and as a result, the Trade will be available to SDK clients requesting information about it.

Cancellation Phase

The cancellation phase of the trade is an optional operation that can only be executed by the maker. The maker who performs this operation will effectively interact directly with the smart contract, canceling the order and invalidating it.
As it is a write operation on the chain, this will require the maker to pay the transaction fee.

Execution Phase

The Trade execution phase is an operation that can only be performed by the taker. The taker interacts directly with the smart contract and therefore finalizes the order previously created by the maker. Since it is a writing operation on the blockchain, it will pay the transaction fee.

Trading assets

In addition to understanding the trading phases, developers must also be familiar with the types of assets that end-users can use for trading operations.
The usable assets include native tokens are the following:
  • NATIVE tokens (Ethereum, Matic, etc.)
  • ERC20 tokens
  • ERC721 tokens
  • ERC1155 tokens.
To ensure safety for end-users and some consistency in the tokens used by the system, the SDK places some limitations on ERC20 assets and native tokens, preventing the latter from being included among the maker's assets and not allowing them to be combined in any way with native asset types for the taker.
Therefore, the maker can only select ERC721 or ERC1155 tokens as their assets.
However, the taker can add ERC20 assets only if no native tokens are included in their assets, and they can add native assets only if no ERC20 tokens are included. An illustration below will clarify these concepts.
Last modified 7mo ago