LooksRare Exchange Overview
What is the LooksRare exchange?
LooksRare's exchange consists of a hybrid off-chain/on-chain system where taker orders match maker orders to execute trades for NFTs.
It is a non-custodial exchange where orders require approval of the tokens (fungible and non-fungible) being transferred in a trade.
Off-chain orders ("Maker orders") are EIP-712 signatures that are stored off-chain.
A trade consists of a bilateral exchange of a ERC-20 token against a NFT token (e.g., ERC-721, ERC-1155) with a specific amount at a specific price. On each trade, trading fees can exist as (1) protocol fee and/or (2) collection rebate.
Protocol fees go to LOOKS stakers and collection rebates are collected by creators (at each trade).
What is the core architecture?
LooksRare consists of a stand-alone contract (
LooksRareExchange) that coordinates with other smart contracts designed to provide instructions on how trades must be executed, verifies the validity of strategies and currencies, whether collection rebates must be paid (and to who), and how tokens must be transferred.
LooksRare's core exchange architecture consists of:
- Currency manager (
CurrencyManager) — it handles a whitelist of ERC-20 tokens that are valid for transactions on the system.
- Execution manager (
ExecutionManager) — it handles the list of valid execution strategies for matching makers and takers.
- Transfer selector for NFT contracts (
TransferSelectorNFT) — it assigns a token contract to its transfer manager based on the ERC-165 interfaceId, or other set of rules if contract is non-compliant (through a dedicated mapping).
- Royalty manager (
RoyaltyFeeManager) — it provides a stand-alone logic that tells if collection rebates should be collected. It supports ERC-2981 ("NFT Royalty Standard"), its own stand-alone royalty registry (
RoyaltyFeeRegistry), with plans to support future third-party royalty fee oracles.
How are trades matched?
Trades exist such as a combination of taker/order and bid/ask. Hence, there are four primary orders:
- MakerBid — a passive order that exists off-chain where the user wishes to acquire a NFT using a specific ERC-20 token.
- MakerAsk — a passive order that exists off-chain where the user wishes to sell a NFT for a specific ERC-20 token.
- TakerBid — an order that is executed on-chain that matches the
MakerAsk, e.g., the taker accepts the offer from the maker and buys the NFT for the ERC-20 token specified.
- TakerAsk — an order that is executed on-chain that matches the
MakerBid, e.g., the taker accepts the offer from the maker and sells the NFT for the ERC-20 token specified.
LooksRare's execution strategies allow custom implementation of a set of rules that can be added over time. The execution strategy is defined by the
MakerOrder, through the use of a field named
strategy, that represents a contract that specifies how the trade is going to be executed.
Each strategy consists of a contract that takes two order inputs (
TakerAsk) and returns a 3-tuple:
- Whether the taker can be executed against the maker.
amountof tokens transferred (ERC-721: 1 /ERC-1155: 1+).
LooksRare's execution strategy design can allow innovative order types, such as:
- Collection orders; a MakerBid can be executable against any TakerAsk within a designated collection (e.g,. "I wish to buy any tokenId from the BAYC collection for 40 WETH").
- Trait-based orders (pending implementation) through the use of cryptographic proofs (e.g,. "I wish to buy any tokenId from the BAYC collection for 55 WETH if its metadata for hat is a party hat").
Other design decisions
LooksRare's exchange modular design allows the upgradeability of specific parts of the exchange without any need for proxies, circuit breakers (e.g., possibility to discontinue a strategy or a currency), and the rollout of new features continuously (e.g., support of new order types).
LooksRare's exchange supports innovative features such as OCO to replace passive orders (with more aggressive orders) through the use of
orderNonce, batch cancelling for orders, and other "cancel-all" features.
The system is also designed with additional protections for users. For instance, protocol fees are read from each execution strategy, for which the protocol fee cannot be increased without redeploying a new strategy contract. Similarly, ask orders contain protections against unexpected changes in collection rebates with a minimum percentage of the price that must go to the ask side (or the transaction would revert).
Finally, the system offer benefits to users such as the human-readability of the signed message thanks to the use of EIP-712 signatures but it also supports EIP-1271 as a signature validation method for smart contracts.
The LooksRare exchange protocol exists as smart-contract code running on the Ethereum blockchain. To understand how each contract works individually, head over to the section for smart contracts.