Ir ao conteúdo principal

Orders Types

Introduction

LooksRare’s exchange is built on a hybrid system (off-chain/on-chain), which incorporates off-chain signatures (these are called Maker Orders and use the Maker schema defined below) and on-chain orders (called Taker Orders which use the Taker schema). This design is similar to other NFT marketplaces (e.g., OpenSea, Rarible) running on the Ethereum blockchain.

LooksRare uses exclusively EIP-712 signatures, which provide key benefits for users such as greater readability for humans in the message they sign.

A maker order (Maker) is a passive order, which can be executed (if not cancelled) against a taker order (Taker) after it is signed. Since the execution of a maker order is done once a taker order matches on-chain, network gas fees are never paid by the maker user.

Signatures for the LooksRare exchange all contain a set of parameters that are defined in a Solidity struct named Maker. While Taker Orders are standardized in a Solidity struct named Taker. For more information about the protocol see the LooksRare Protocol Overview.

Overview of parameters in a Maker

The Maker struct contains 15 distinct parameters:

  • quoteType — Whether the order is an Ask (sending a passive order to sell a NFT) or a Bid (sending a passive order to buy an NFT).
  • globalNonce — The global user order nonce for maker orders.
  • subsetNonce — The subset nonce (shared across bid/ask maker orders).
  • orderNonce — The order nonce (it can be shared across bid/ask maker orders).
  • strategyId — The id of the strategy used in the maker order.
  • collectionType — The collection type (i.e. ERC721 or ERC1155).
  • collection — The collection's address.
  • currency — The currency address for this order.
  • signer — The signer's address.
  • startTime — The start time for the order (in epoch format).
  • endTime — The end time for the order (in epoch format).
  • price — Minimum price for maker ask, maximum price for maker bid.
  • itemIds — Array of item ids.
  • amounts— Array of amounts.
  • additionalParameters — Can contain additional parameters that are not used for standard orders.

Breakdown of parameters

quoteType

Type: BigNumber

Like most exchange marketplaces & protocols (including non-NFT marketplaces), an order can be of two distinct types: Ask or Bid.

In the LooksRare protocol, Ask means the user is selling a NFT whereas Bid means the user is buying a NFT.

ValueDescription
0Maker order is a Bid
1Maker order is a Ask

globalNonce

Type: BigNumber

The globalNonce field represent the global user order nonce for the maker order. Each user address is mapped to one ask nonce and one bid nonce. The nonce on the maker order struct must match the signer's value on the chain. This can be used for canceling all pending maker bids or/and pending maker asks.

subsetNonce

Type: BigNumber

The subsetNonce is assigned a to each order. A subset nonce can only be cancelled manually. It cancels all orders sharing this subset and can be shared for bid and ask maker orders.

orderNonce

Type: BigNumber

The orderNonce is used to know whether an order with this nonce can be filled, is being filled, or has been filled/cancelled. If an order has started "partial filling", it is impossible to execute other orders sharing this order nonce.

strategyId

Type: BigNumber

The strategyId represent the id of the strategy being used in the maker order. Strategies can only be valid in the LooksRare protocol if they are implemented in the StrategyManager contract. If the execution strategy is not included, the trade cannot occur (it reverts). For more details, see LooksRare Protocol - Execution Strategies

collectionType

Type: BigNumber

The collectionType field represent the type of collection included in the Maker object.

ValueDescription
0ERC-721
1ERC-1155

collection

Type: string

The collection field represent the address of the asset's collection.

currency

Type: string

The currency field represent the address of the currency to execute the trade. Currencies can only be valid in the LooksRare Protocol if they are allowed by the CurrencyManager contract. If the currency is not allowed, the trade cannot occur (it reverts).

signer

Type: string

The signer field represent the address used to EIP-712 sign the Maker object.

startTime

Type: BigNumber

The startTime represents the epoch timestamp of a maker order from where its execution can be valid.

endTime

Type: BigNumber

The endTime represents the epoch timestamp of a maker order from where its execution stops being valid.

price

Type: BigNumber

The price for the order in WEI. It is a uint256 value, which doesn't contain any decimal. Ethereum does not support float numbers. Price must be displayed as a number in "BigNumber" formatting.

Desired priceActual filed value
0.1 ETH100000000000000000
1 ETH1000000000000000000
100 ETH100000000000000000000

Converters can be useful to convert WETH (or other assets with 18 decimals) to wei.

Never sign a message with a price displayed as "10" if you are looking to sell an item for 10 WETH, you would end up selling your item for 100 wei!

itemIds

Type: BigNumber[]

The itemIds field is an array containing the token id of each asset.

For collection orders, this field is not used in the execution and set it at 0 if you use the exchange frontend available at looksrare.org.

amounts

Type: BigNumber[]

The amounts field is an array defining the amount of asset to transfer for each itemId, must be 1 for ERC-721, while it can be 1+ for ERC-1155.

additionalParameters

Type: string[]

The additionalParameters field is used for additional parameters specific to complex orders that are less frequent (e.g., private sale, Dutch auctions, and more complex order types). The set of additional parameters is represented as bytes, where parameters are concatenated.

Further reading:

For more details, please visit this website to read more about digital signatures.

Overview of parameters in a Taker

The Taker struct contains 2 distinct parameters:

  • recipient — The address which will receive the asset (if matched with a MakerAsk) or the profits (if matched with a MakerBid).
  • additionalParameters — Can contain additional parameters that are not used for standard orders.

Solidity Structs & Enums

When working with EIP-712 signatures and interacting with contracts it can be useful to understand how certain data structures are defined at within the solidity smart contracts. Here are the main data structures you will have to work with when interacting with the LooksRare protocol.

The Maker struct as defined at the contract level:

struct Maker {
QuoteType quoteType;
uint256 globalNonce;
uint256 subsetNonce;
uint256 orderNonce;
uint256 strategyId;
CollectionType collectionType;
address collection;
address currency;
address signer;
uint256 startTime;
uint256 endTime;
uint256 price;
uint256[] itemIds;
uint256[] amounts;
bytes additionalParameters;
}

The Taker struct as defined at the contract level:

struct Taker {
address recipient;
bytes additionalParameters;
}

The QuoteType enum as defined at the contract level:

enum QuoteType {
Bid,
Ask
}

The CollectionType enum as defined at the contract level:

enum CollectionType {
ERC721,
ERC1155
}