LogoLogo
  • Envelop (NIFTSY) documentation
  • Documents
    • Key terms
    • F.A.Q.
    • White paper
      • Disclaimers
      • Introduction
      • Key terms
      • Industry (market) analysis and NIFTSY's place in it
        • Figures and facts
        • Possible implementations of Envelop
      • Protocol. Oracle. Index
        • Protocol
          • NFT as a new order ETF and a brief history of NIFTSY
        • Oracle
        • Index
      • The architecture of the Project and the role of the Token
        • DAO. Token. IDO
        • The token as a linking element in the project
        • IDO (Initial DAO offering)
      • Roadmap. Part. #01
      • Roadmap. Part #02
      • Conclusion
      • List of references
    • Lite paper
      • Abstract
      • Disclaimers
      • Market challenges - our solutions
      • The main hypostases and parts of the Project
      • Development strategy and market coverage
      • Additions
    • White paper (Spanish)
      • Descargo de responsabilidad
      • Introducción
      • Términos clave
      • Análisis de la industria (mercado) y el lugar de NIFTSY en el
        • Figuras y hechos
        • Posibles implementaciones de NIFTSY
      • Protocolo. Oráculo. Índice
        • Protocolo
        • NFTs como un nuevo de EFT y una breve historia de NIFTS
        • Oraculo
        • Índice
        • Untitled
      • La arquitectura del proyecto y el rol del token
        • DAO. Token. IDO
        • El token como un elemento vinculante en el proyecto
        • IDO
      • Mapa de ruta
      • Conclusiones
      • Lista de referencias
    • Lite paper (Spanish)
      • Abstracto
      • Descargo de responsabilidad
      • Los desafíos del mercado y nuestras soluciones
      • La hipótesis principal y partes del proyecto
      • Estrategia de desarrollo y cobertura de mercado
      • Adiciones
    • White paper (BAHASA INDONESIA)
      • PENAFIAN
      • PENGANTAR
      • ​KATA KUNCI
      • ANALISIS INDUSTRI (PASAR)) DAN KEDUDUKAN niftsy DI DALAMNYA
      • Angka dan Fakta
      • Kemungkinan implementasi NIFTSY
      • PROTOKOL. ORACLE. INDEKS
        • Protokol
        • Oracle
        • Indeks
      • ARSITEKTUR PROYEK DAN PERAN TOKEN
      • DAO. Token. IDO
      • Token sebagai elemen penghubung dalam proyek
      • IDO
      • ROADMAP
      • KESIMPULAN
      • DAFTAR REFERENSI
    • LITE PAPER (BAHASA INDONESIA)
      • Abstrak
      • Penafian
      • Tantangan pasar - solusi kami
      • Hipotesis utama dan bagian dari Proyek
      • Strategi pengembangan dan cakupan pasar
      • Tambahan
    • Tokenomics
      • General provisions
      • Links
  • Technical documentation
    • URLs of dAPPs
    • Technical paper
      • Introduction
      • Protocol
      • Oracle
      • Index
      • Stack
      • Conclusion
    • Smart-contracts
      • Deployment addresses v2
      • Deployment addresses v1
      • Deployment addresses v0
      • Security and smart contracts
      • Contract NiftsyERC20.sol
      • Protocol
        • V0
          • Audit
          • Contracts
            • WrapperWithERC20Collateral (V.0)
            • WrapperDistributor721.sol
            • WrapperFarming.sol
        • V1
          • Audit
          • Contracts
            • WrapperV1
            • AdvancedWhiteList.sol
            • EnvelopwNFT721
            • EnvelopwNFT1155
            • Saft
            • SBT smart-contract Factory
          • Gas measurements for Protocol version 1
      • Launchpad
        • V0
          • Launchpad.sol
        • V1
          • NFTKiosk.sol
          • DefaultPriceModel.sol
      • Subscription service
      • Factory (smart-contracts) minting
      • P2P NFT/wNFT trading service
    • Envelop dApps Troubleshooting
  • Tutorials
    • Introduction to tutorials
    • dApps
      • Minting
        • Version 0
          • Release notes
          • Instruction
          • Video
        • Version 1.1
          • Release notes
          • Instruction
          • Video
      • Main app
        • Version 0
          • Release notes
          • Instruction
          • Aptos instruction
          • Video
        • Version 1.0
          • Release notes
          • Instruction
        • Version 1.1
          • Release notes
          • Instruction
          • Video
      • Cross-NFT
        • Version 0
          • Release notes
          • Instruction
          • Video
      • Launchpad (wINO)
        • Version 0
          • Release notes
          • Instruction
          • Video
        • Version 1
          • Release notes
          • Instruction
            • NFT trading
            • ERC20 tokens trading
          • Video
      • Farming
        • Version 0
          • Release notes
          • Instruction
      • SAFT wNFT
        • Version 0
          • Release notices
          • Instruction
          • Video
        • Version 1.0
          • Release notices
          • Insctruction
          • Video
        • Version 1.1
          • Release notices
          • Insctruction
          • Video
    • Oracle
      • Version 0
        • Release notices
      • Version 1
        • Release notices
    • Subscription service
      • Version 0
        • Release notes
      • Version 1
        • Release notes
    • Metamask settings for different networks
    • How to wrap your NFT
    • How to make SAFT wNFT
    • How to unwrap your wNFT
    • How to mint Soulbound tokens with Envelop
    • How to use Wrapper from Safe Gnosis
    • Video tutorials
  • Bounty
    • Bounty FAQ
    • General conditions
    • Bounty rules
    • Approximate (maximum) activity estimates
    • Bug Bounty
  • Legal
    • Privacy-policy
    • Legal FAQ
    • DAO
    • Archive
      • Licence
  • ARHIVE
    • Archive tutorials
      • Wrap NFT
    • Others
      • Marketplace (Scotch.sale)
      • How do I buy on DEXs?
        • Uniswap
        • PancakeSwap
        • QuickSwap
Powered by GitBook
LogoLogo

Links:

  • envelop.is
  • daoenvelop.eth

dApps:

  • app.envelop.is
  • crossing

Soc. nets:

  • blog
  • youtube
On this page
  • P2POrderManager
  • Method makeOrder
  • Method removeOrder
  • Method takeOrder
  • Method getOrdersForItem
  • ET.Order
  • OrderBook721
  • Method getOrdersForItem
  • Method getPriceForOrder

Was this helpful?

  1. Technical documentation
  2. Smart-contracts

P2P NFT/wNFT trading service

This is the group of the smart contracts which give the opportunity to sell and buy NFTs and wNFTs ERC721. There are two smart contracts: P2POrderManager.sol and OrderBook721.sol.

The first one responses for the actions, the second one responses for the storing the informations about the orders. There are sell orders and buy offers. The owners of NFTs/wNFTs can create the sell orders only. The buyers can create offers to buy any NFTs/wNFTs. The sell orders can be created with the native and ERC20 tokens as the price. The buy offers can be created with ERC20 tokens as the price only. The sellers of NFTs/wNFTs should give the allowance to P2POrderManager to use them. The buyers of NFTs/wNFTs and creators of the buy offers should give the allowance to P2POrderManager to use their ERC20 tokens to pay.

P2POrderManager

Method makeOrder

function makeOrder(
        ET.AssetItem memory _assetItem,
        ET.Price calldata _price,
        ET.OrderType _ordeType
    ) external returns (bytes32 orderId)

The method creates the orders.

Input parameters of the method:

Name
Type
Description

_assetItem

ET.AssetItem

_price

ET.Price

_orderType

ET.OrderType

ET.AssetItem

Name
Type
Description

asset

ET.Asset

Data on the type and contract of tradable NFT/wNFT tokens

tokenId

uint256

Token number

amount

amount

Number of NFT/wNFT copies. Zero value

ET.Asset

Name
Type
Type

assetType

ET.AssetType

Value from the type dictionary

contractAddress

address

Address of the tradable NFT/wNFT contract

ET.AssetType:

  • 3 - ERC-721;

ET.Price

Name
Type
Description

payToken

address

The smart contract address of the price token. If the price is in the native tokens fill in zero address.

payAmount

uint256

The token amount of the price.

The method returns values:

Name
Type
Description

orderId

bytes32

The created order id

The method emits EnvelopP2PNewOrder event with the follow data:

Name
Type
Description

OrderId

bytes32

The created order id

OrderMaker

address

The creator of the order

AssetAddress

address

The smart contract address of tradable NFT/wNFT

TokenId

uint256

The token id of tradable NFT/wNFT

AssetAmount

uint256

The copy amount of NFT/wNFT tokens. For ERC721 is zero

PayToken

address

The smart contract address of the price token. If the price is in the native tokens the value is zero address.

PayAmount

uint256

The token amount of the price.

OrderType

uint8

The id of the order type from enum ET. OrderType

Method removeOrder

function removeOrder(
        bytes32  _orderId,
        ET.AssetItem memory _assetItem
    ) external returns(bool deleted)

The method removes the orders.

Input parameters of the method:

Name
Type
Description

_orderId

bytes32

The id of the order which will be removed.

_assetItem

ET.AssetItem

The method returns values:

Name
Type
Description

deleted

bool

The flag the order is deleted.

The method emits EnvelopOrderRemoved event with the follow data:

Name
Type
Description

OrderId

bytes32

The removed order id

AssetAddress

address

The smart contract address of tradable NFT/wNFT

TokenId

uint256

The token id of tradable NFT/wNFT

AssetAmount

uint256

The copy amount of NFT/wNFT tokens. For ERC721 is zero

OrderType

uint8

The id of the order type from enum ET.OrderType

Method takeOrder

function takeOrder(
        bytes32  _orderId, 
        address _orderBook,
        ET.OrderType _orderType,
        ET.AssetItem memory _assetItem
    ) 
        external 
        payable

The method marks the orders like closed and run the changing by the assets between the seller and the buyer. If the owner of P2POrderManager smart contract set the fee for the deal this method would charge the fee from the payment asset and make the transfer to fee beneficiary address. If

Input parameters of the method:

Name
Type
Description

_orderId

bytes32

The order id which will be closed.

_orderBook

address

The address of OrderBook721 smart contract where info about the order is storing

_orderType

ET.OrderType

_assetItem

ET.AssetItem

The method emits EnvelopP2POrderTaked event with the follow data:

Name
Type
Description

AssetAddress

address

The smart contract address of tradable NFT/wNFT

TokenId

uint256

The token id of tradable NFT/wNFT

OrderId

bytes32

The closed order id

OrderMaker

address

The creator of the order

OrderTaker

address

The user who closed the order

PayToken

address

The smart contract address of the price token. If the price is in the native tokens the value is zero address.

PayAmount

uint256

The token amount of the price.

OrderType

uint8

The id of the order type from enum ET. OrderType

Method getOrdersForItem

function getOrdersForItem(ET.AssetItem memory _assetItem) 
        external view returns(ET.Order[] memory orderList) 

This view method returns the information about all existing orders for the tradable asset.

Input parameters of the method:

Name
Type
Description

_assetItem

ET.AssetItem

The method returns values:

Name
Type
Description

orderList

ET.Order[]

ET.Order

Name
Type
Description

orderId

bytes32

The order id

orderType

uint8

The id of the order type from enum ET. OrderType

orderBook

address

The address of OrderBook721 smart contract where info about the order is storing

orderMaker

address

The creator of the order

amount

uint256

The copy amount of NFT/wNFT tokens. For ERC721 is zero

Price

price

assetApproveExist

bool

The flag there is the allowance for P2POrderManager smart contract to use the assets of the order maker (NFT/wNFT or ERC20 tokens)

OrderBook721

Method getOrdersForItem

function getOrdersForItem(ET.AssetItem memory _assetItem) 
        external 
        view 
        returns(ET.Order[] memory orderList) 

This view method returns the information about all existing orders for the tradable asset.

Input parameters of the method:

Name
Type
Description

_assetItem

ET.AssetItem

The method returns values:

Name
Type
Description

orderList

ET.Order[]

Method getPriceForOrder

function getPriceForOrder(
        bytes32  _orderId,
        ET.OrderType _orderType,
        ET.AssetItem memory _assetItem
    ) 
        external view returns(ET.Price memory pr, address payer, address maker) 

The method returns the information about the orders.

Input parameters of the method:

Name
Type
Description

_orderId

bytes32

The id of the order for which user asks the price information.

_orderType

ET.OrderType

The id of the order type from enum ET. OrderType

_assetItem

ET.AssetItem

The method returns values:

Name
Type
Description

pr

ET.Price

payer

address

For sell order – zero address. For buy order – the order creator

maker

address

For sell order – the owner of tradable asset (NFT/wNFT). For buy order – the order creator

PreviousFactory (smart-contracts) mintingNextEnvelop dApps Troubleshooting

Last updated 5 months ago

Was this helpful?

The data about NFT/wNFT. The type description is above. Github link of the

The data about a price. The type description is above. Github link of the

Order type. There two types of orders: Sell, Buy. This is enum from ET library - enum OrderType {SELL, BUY}. Github link of the

The data about NFT/wNFT. The type description is above. Github link of the

Order type. There two types of orders: Sell, Buy. This is enum from ET library - enum OrderType {SELL, BUY}. Github link of the

The data about NFT/wNFT. The type description is above. Github link of the

The data about NFT/wNFT. The type description is above. Github link of the

The array of the records with the information about the every existing order. Github link of the

The data about a price. The type description is above. Github link of the

The data about NFT/wNFT. The type description is above. Github link of the

The array of the records with the information about the every existing order. The type description is above. Github link of the

The data about NFT/wNFT of the order. The type description is above. Github link of the

The data about a price of the order. The type description is above. Github link of the

library
library
library
library
library
library
library
library
library
library
library
library
library