The master branch contains the latest work-in-progress version of limit orders. It hasn't been audited and may contain severe security issues or may not work at all.
Please, use the commit tagged version to get the latest production version that has passed through a series of security audits:
- tag
4.3.2Fee Flow in Limit order protocol v4 / secure audits - tag
4.0.0Limit order protocol v4 / security audits - tag
3.0.1Limit order protocol v3 / security audits - tag
v2- Limit order protocol v2 / security audits
You can find the latest general overview and documentation on the 1inch limit orders protocol in the description.md. Documentation for this and previous versions can be found on the 1inch documentation portal.
The repository contains smart contracts for EVM-based blockchains (such as Ethereum, Binance Smart Chain, etc.). These contracts are a core part of the 1inch limit order protocol, allowing users to create limit orders off-chain that can be filled on-chain. A limit order is a data structure signed according to EIP-712.
The key features of the protocol are extreme flexibility and high gas efficiency, which are achieved with the following features
Basic features
- Select an asset receiver for an order.
- Choose whether to allow or disallow partial and multiple fills.
- Define conditions that must be met before execution can proceed (e.g. stop-loss, take-profit orders).
- Specify interactions (arbitrary maker's code) to execute before and after order filling.
- Choose an approval scheme for token spend (approve, permit, permit2).
- Request that WETH be unwrapped to ETH either before (to sell ETH) or after the swap (to receive ETH).
- Make an order private by specifying the only allowed taker's address.
- Set the order's expiration date.
- Assign a nonce or epoch to the order for easy cancellation later.
Advanced features
- Define a proxy to handle transfers of assets that are not compliant with
IERC20, allowing the swapping of non-ERC20 tokens, such as ERC721 or ERC1155. - Define functions to calculate, on-chain, the exchange rate for maker and taker assets. These functions can be used to implement dutch auctions (where the rate decreases over time) or range orders (where the rate depends on the volume already filled), among others.
Separate RFQ order are deprecated in v4. To create the most gas efficient order use a basic order without extensions.
- ERC 20
- ERC 721
- ERC 1155
- Other token standards could be supported via external extension
The protocol ships as part of the 1inch Router v6 contract, so 1inch Router v6 and 1inch Limit Order protocol v4 share a single address on each network:
| Network | Contract Address |
|---|---|
| Ethereum mainnet | 0x111111125421cA6dc452d289314280a0f8842A65 |
| BSC mainnet | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Polygon mainnet | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Optimism mainnet | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Arbitrum One | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Gnosis Chain | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Avalanche | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Fantom | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Aurora | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Kaia | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Base | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Linea | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Sonic | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Unichain | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Cronos | 0x111111125421cA6dc452d289314280a0f8842A65 |
| Monad | 0x111111125421cA6dc452d289314280a0f8842A65 |
| HyperEVM | 0x5281602aDc446A94eb48D055f514A6d8D5bee176 |
| zkSync Era | 0x6fd4383cB451173D5f9304F041C7BCBf27d561fF |
Note: HyperEVM and zkSync Era do not use the shared address. The verifying contract is part of the EIP-712 domain an order is signed against, so always take the address of the network you are signing for.
You can find audit reports on etherscan and in the separate audit repository.
Plenty of utils that helps create & sign orders are available in our typescript utils library: