> For the complete documentation index, see [llms.txt](https://rubicon-chinese.gitbook.io/rubicon-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rubicon-chinese.gitbook.io/rubicon-docs/he-yue/rubicon-shi-chang/guan-jian-gong-neng.md).

# 关键功能&#x20;

#### 提供

```
 function offer(uint pay_amt, ERC20 pay_gem, uint buy_amt, ERC20 buy_gem) 
         public returns (uint)
```

报价功能是在 Rubicon 市场下新的限价买入或限价卖出订单的主要功能。 此功能为给定的 ERC-20 对获取用户的资金，并将其放入智能合约的订单簿中。 当另一个用户选择购买订单或订单与另一个订单匹配时，报价将被执行并由 Rubicon Market 执行交易。

| 参数                        | 功能                    |
| ------------------------- | --------------------- |
| uint pay\_amt             | 用户以 wad 形式提供的资产数量     |
| ERC20 pay\_gem            | 用户提供的 ERC-20 资产       |
| uint buy\_amt             | 用户希望在 wad 中兑换的资产数量    |
| ERC20 buy\_gem            | 用户希望交换的资产             |
| ERC20 buy\_gem            | 用户想要下订单的排序订单簿中的位置     |
| \[Optional] bool matching | 可选的布尔值，指示是否应尽可能自动匹配报价 |

需要買注意的是，报价功能在 Rubicon 市场中有一些表现形式。 用户可以添加 pos 或匹配参数。 这些允许用户选择报价应该在排序后的订单簿中的哪个位置以及报价是否应该受到潜在的订单自动匹配的影响。

### **買**

```
 function buy(uint id, uint amount) public can_buy(id) 
  returns (bool)
```

<table><thead><tr><th>参数</th><th>功能</th><th data-hidden></th><th data-hidden></th></tr></thead><tbody><tr><td>uint id</td><td>用户要购买的订单的id</td><td></td><td></td></tr><tr><td>uint amount</td><td>用户想要购买的订单的 wad 数量/部分</td><td></td><td></td></tr></tbody></table>

此功能允许用户取消报价并将资金返还给用户。 修饰符 can\_cancel 检查以确保调用者拥有报价并且报价处于活动状态。 或者，用户也可以使用 kill 路由功能来达到相同的结果并取消给定 id 的订单。

**取消**

```
function cancel(uint id)
 public
 can_cancel(id)
 returns (bool success)
```

| 参数      | 功能           |
| ------- | ------------ |
| uint id | 用户想要取消的订单的id |

### **途径功能**

#### BuyAllAmount

```
function buyAllAmount(
ERC20 buy_gem,
 uint256 buy_amt,
 ERC20 pay_gem,
 uint256 max_fill_amount
 ) external returns (uint256 fill_amt)
```

| 参数      | 功能        |
| ------- | --------- |
| uint id | 用户想要取消的订单 |

此功能允许用户通过账簿中的多个订单购买任意数量的资产（buy\_gem）。 该功能将继续通过订单进行购买，直到获得所需的购买量。

#### Make

```
function make(ERC20 pay_gem, ERC20 buy_gem, uint128 pay_amt, uint128 buy_amt)
public
returns (bytes32)
```

| 参数             | 功能                 |
| -------------- | ------------------ |
| uint pay\_amt  | 用户以 wad 形式提供的资产数量  |
| ERC20 pay\_gem | 用户提供的 ERC-20 资产    |
| uint buy\_amt  | 用户希望在 wad 中兑换的资产数量 |
| ERC20 buy\_gem | 用户希望交换的资产          |

这只是一个简单的路由功能，它允许用户通过 make 入口点轻松地提供报价。 这将引导用户然后创建报价。

#### Take

```
function take(bytes32 id, uint128 maxTakeAmount) public
```

| 参数                 | 功能                   |
| ------------------ | -------------------- |
| uint id            | 用户要购买的订单的id          |
| uint maxTakeAmount | 用户想要购买的订单的 wad 数量/部分 |

这只是一个路由功能，允许用户通过获取入口点轻松获取报价。 这将引导用户然后购买报价。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rubicon-chinese.gitbook.io/rubicon-docs/he-yue/rubicon-shi-chang/guan-jian-gong-neng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
