@1inch/limit-order-protocol 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

1inch network

Utils library for 1inch Limit Orders Protocol V2

这是用于使用 1inch Limit Orders Protocol 的实用程序包

您可以找到有关 1inch limit orders 协议的一般概述和文档 此处

Smart contract addresses

  • Ethereum mainnet: 0x119c71d3bbac22029622cbaec24854d3d32d2828
  • BSC mainnet: 0x1e38eff998df9d3669e32f4ff400031385bf6362
  • Polygon mainnet: 0x94bc2a1c732bcad7343b25af48385fe76e08734f
  • Optimism mainnet: 0x11431a89893025d2a48dca4eddc396f8c8117187
  • Arbitrum mainnet: 0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9
  • Smart contracts source code repository is available here

Test coverage

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

Installation

Node

npm install @1inch/limit-order-protocol

Yarn

yarn add @1inch/limit-order-protocol

Contributing

请参阅 CONTRIBUTING.md

Changelog

请参阅 CHANGELOG.md


About

合约允许用户下限价订单,稍后可以在链上完成。 限价订单本身是一种在链下创建并根据 EIP-712 签名的数据结构。

您很可能需要使用以下类:

LimitOrderBuilder - 创建限价订单
LimitOrderPredicateBuilder - 创建谓词限价订单
LimitOrderProtocolFacade - 与区块链上

的协议 该协议的主要特点是通过使用以下订单类型实现的极大灵活性和高气体效率。

I. Limit order

限价订单是一种金融工具,您可以使用它以固定价格出售 ERC-20 代币。
例如,您可以以 82415 DAI 代币的价格出售 2 个 WBTC 代币。

1inch limit orders protocol 有许多灵活的交易管理工具:

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

注意:即使您的余额不足以立即执行限价订单,您也可以创建限价订单。 但是,您必须为制造商资产留出余地。

对于做市,有RFQ订单经过特殊优化,执行时不需要大量gas。

Limit orders in the 1inch aggregation protocol

1inch aggregation protocol - 该协议从各种交易所获取流动性,并能够拆分单个贸易交易跨多个 DEX,以确保最佳费率。
您可以将您的限价订单发送到1inch 数据库,然后您的订单将参与1inch 聚合协议。

REST API (swagger):

Docs

  1. Quick start
  2. Create a limit order
  3. Limit order structure
  4. Limit order remaining
  5. Nonce
  6. Validate a limit order
  7. Predicate
  8. Fill a limit order
  9. Cancel a limit order
  10. Cancel all limit orders
  11. Domain separator

II. RFQ order

报价请求 (RFQ) 是客户向供应商(做市商)请求报价以购买某些代币的业务流程。

从技术上讲,RFQ 订单是标准订单的精简版,它包含更少的数据和管理工具,从而可以显着减少执行费用。

Docs:

  1. Creating an RFQ order
  2. RFQ order structure
  3. Canceling an RFQ order
  4. Filling an RFQ order

1inch network

Utils library for 1inch Limit Orders Protocol V2

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: 0x119c71d3bbac22029622cbaec24854d3d32d2828
  • BSC mainnet: 0x1e38eff998df9d3669e32f4ff400031385bf6362
  • Polygon mainnet: 0x94bc2a1c732bcad7343b25af48385fe76e08734f
  • Optimism mainnet: 0x11431a89893025d2a48dca4eddc396f8c8117187
  • Arbitrum mainnet: 0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9
  • Smart contracts source code repository is available here

Test coverage

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

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. Create a limit order
  3. Limit order structure
  4. Limit order remaining
  5. Nonce
  6. Validate a limit order
  7. Predicate
  8. Fill a limit order
  9. Cancel a limit order
  10. Cancel all limit orders
  11. 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:

  1. Creating an RFQ order
  2. RFQ order structure
  3. Canceling an RFQ order
  4. Filling an RFQ order
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文