Skip to main content

Introduction

1inch limit order protocol is a set of smart contracts that work on any supported EVM based blockchains.

Key features of the protocol are extreme flexibility and high gas efficiency which are achieved by using two different order types - regular Limit Order and RFQ Order.

Smart Contracts allow users to place limit orders and RFQ Orders, that later could be filled on-chain. Both types of orders are data structures created off-chain and signed according to EIP-712.

I. Limit order

A limit order is a financial instrument with which you can put up an ERC-20 token for sale at a fixed price.
For example, you can put up 2 WBTC tokens for sale at the price of 82415 DAI tokens.

The 1inch limit order protocol has many tools for flexible trade management:

  • Partial fill
  • Predicates
  • Single cancellation
  • Bunch cancellation
  • Fullness check
  • Validation

Note: For market-making, there are RFQ orders that have special optimization which does not require a large amount of gas for execution.

Limit order execution

  1. 1inch users can place their limit orders through the 1inch dApp.
  2. The signed orders placed by the users can be fetched by anyone using the 1inch Limit Orders Liquidity Source API to execute trades by filling the order on-chain.
  3. To fill a limit order on-chain, you need to pass the signed order to the fillOrder method on the contract. You can find the latest contract addresses here.

    Note: Both the buyer and seller of the assets being traded must approve their assets to be used by the 1inch limit order contract.

  4. The Pathfinder algorithm uses the limit orders placed via the 1inch dApp and REST API as a liquidity source, making them available for any 1inch user to fill. This integration ensures that 1inch limit orders are available on the DeFi ecosystem from day one.

Limit order features

Limit orders are highly flexible and can be configured with the following features:

  1. Order execution predicate: This feature allows you to specify certain conditions to be met before the order can be executed.
    • For example, you can set an expiration time based on a certain timestamp or block number.
    • You can also construct any predicate you want, such as checking that a certain price is higher than the oracle price, to implement stop loss or take profit strategies.
  2. Helper function for asset price evaluation.
    • Function that will allow to extract assets price from arbitrary on-chain source
  3. Callback: For notifying the maker of the order execution.

II. RFQ order

A request for quotation (RFQ) is a business process in which a customer requests a quote from a supplier (market-maker) for the purchase of some tokens.

RFQ orders have different use cases, and are dedicated to market-makers in the first place. The typical scenario is following: Market-maker creates a bunch of RFQ Orders, and exposes it via the API. Trader or the platform algorithm ask for market maker quotes. If the quotes match traders' needs, the trader receives signed RFQ order from the market-maker.

RFQ order features

Gas optimized order with restricted capabilities suitable for market-makers

  • Supports expiration time
  • Supports cancelation by order id
  • RFQ Order could be filled only once
  • Partial Fill is possible (once)

Supported tokens

  • ERC 20
  • ERC 721
  • ERC 1155
  • Other token standards could be supported via external extension

More resources