Skip to main content

Maker Orders (EIP-712 signatures)

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 on-chain orders (called Taker Orders). This design is similar to other NFT marketplaces (e.g., OpenSea, Rarible) running on the Ethereum blockchain.

However, unlike some of these platforms, 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 is a passive order, which can be executed (if not cancelled!) against a taker order 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 MakerOrder.

Overview of parameters in a MakerOrder

The MakerOrder struct contains 13 distinct parameters and 3 signature parameters:

  • isOrderAsk — 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).
  • signer — The address of the signer of the maker order.
  • collection — The specific collection address.
  • price — The price of the order. The price is expressed in BigNumber based on the number of decimals of the “currency”. For Dutch auction, it is the minimum price at the end of the auction.
  • tokenId — The id of the token for the order. 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.
  • amount — The amount of tokens transferred. It is only used for ERC-1155 tokens (e.g., “2 items for a given tokenId”). For ERC-721 tokens, it is set at 1 if you use the exchange frontend available at looksrare.org.
  • strategy — The execution strategy address for the trade execution for this order.
  • currency — The currency address for this order.
  • nonce — The order nonce of the sender.
  • startTime — The start time for the order (in epoch format).
  • endTime — The end time for the order (in epoch format).
  • minPercentageToAsk — The minimum percentage required to be transferred to the ask or the trade is rejected (e.g., 9800 = 98% of the trade price).
  • params — Can contain additional parameters that are not used for standard orders (e.g., maximum price for a Dutch auction, recipient address for a private sale, or a Merkle root... for future advanced order types!). If it doesn't, it is displayed "0x" (using the exchange frontend available at looksrare.org)
  • v, r, and s — Cryptographic parameters generated by the web3 provider. These parameters are used to verify cryptographically that the signer address did sign the order.

Breakdown of parameters

isOrderAsk

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 (with a fungible currency like WETH).

BoolDescription
trueMaker order is a Ask
falseMaker order is a Bid

signer

The address signing the message. For instance, it can be displayed as 0xab5801a7d398351b8be11c439e05c5b3259aec9b.

collection

The address of the collection to trade. For instance, it can be displayed as 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d.

price

The price for the order. 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.

PriceValue displayed in the signature
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!

tokenId

The tokenId, part of the collection, that the signer is looking to purchase/sell.

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.

amount

The amount of tokens to transfer for the tokenId. While this is currently only relevant for ERC-1155 tokens (e.g., “2 items for a given tokenId”), for ERC-721 tokens, it is set at 1 if you use the exchange frontend available at looksrare.org.

strategy

The address of the execution strategy to execute the trade. Strategies can only be valid in the LooksRare exchange if they are whitelisted by the ExecutionManager contract. If the execution strategy is not whitelisted, the trade cannot occur (it reverts).

currency

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

nonce

The nonce represents the user order nonce that is marked on-chain as executed if the trade is matched by a taker order or if the user cancels her order. Two orders can exist off-chain with the same nonce. If one of them is executed, the other is cancelled. Nonces are specific to each distinct signer address. For instance, if Alice signs a maker order with nonce = 3 and Bob also signs a maker order with nonce = 3. If Alice's order is executed against a taker order, Bob's order remains valid.

It is recommended to verify (and write down for a sizeable order) the order nonce when you submit a trade, especially if using a third-party service. This allows you to cancel this trade easily directly by interacting against the contract.

startTime

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

endTime

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

minPercentageToAsk

The minPercentageToAsk protects ask users from potential unexpected increase in fees. It acts as a protection that the trade would revert if a specific percentage of the platform gross price does not go to the ask users when the trade is executed on-chain.

params

This 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.

cryptographic parameters (v, r, and s)

Ethereum uses ECDSA signatures. These signatures consist of two numbers (integers): r and s with the addition of a v parameters ("recovery identifier") variable, which is always equal to 27 or 28.

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