🌐 1inch Limit Orders Protocol utils

1inch network

Utils library for 1inch Limit Orders Protocol

This is the package of utilities for working with the 1inch Limit Orders Protocol

You can find general overview and docs on 1inch limit orders protocol here.

Smart contract addresses

  • Ethereum mainnet: 0x3ef51736315f52d568d6d2cf289419b9cfffe782

  • BSC mainnet: 0xe3456f4ee65e745a44ec3bcb83d0f2529d1b84eb

  • Polygon mainnet: 0xb707d89d29c189421163515c59e42147371d6857

  • Smart contracts source code repository is available here​

Test coverage

Statements

Branches

Functions

Lines

​Statements​

​Branches​

​Functions​

​Lines​

Installation

Node

npm install @1inch/limit-order-protocol

Yarn

yarn add @1inch/limit-order-protocol

Contributing

See CONTRIBUTING.md​

Changelog

See CHANGELOG.md​

About

Contract allows users to place limit orders, that later could be filled on-chain. Limit order itself is a data structure created off-chain and signed according to EIP-712.

Most probably you would need use following classes:

​LimitOrderBuilder - to create a limit order LimitOrderPredicateBuilder - to create a predicate for limit order LimitOrderProtocolFacade - to interact with the protocol on the blockchain

Key features of the protocol is extreme flexibility and high gas efficiency that achieved by using following order types.

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 for sale 2 WBTC tokens at the price of 82415 DAI tokens.

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

  • Partial fill

  • Predicates

  • Single cancellation

  • Bunch cancellation

  • Fullness check

  • Validation

Note: You can create a limit order even if your balance is insufficient to execute the limit order right now. However you must have an allowance for the maker asset.

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

Limit orders in the 1inch aggregation protocol

​1inch aggregation protocol - the protocol sources liquidity from various exchanges and is capable of splitting a single trade transaction across multiple DEXes to ensure the best rates. You can send your limit orders to the 1inch database and then your order will participate in the 1inch aggregation protocol.

REST API (swagger):

Docs

  1. ​Quick start​

  2. ​Nonce​

  3. ​Predicate​

  4. ​Fill a limit order​

  5. ​Domain separator​

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.

Technically, RFQ orders are a stripped-down version of standard orders, which contains less data and tools to manage, which in turn allows to spend significantly less gas for their execution.

Docs: