> For the complete documentation index, see [llms.txt](https://docs.kyberswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kyberswap.com/reference/legacy/api-abi/core-smart-contracts/ikybermatchingengine.md).

# IKyberMatchingEngine

{% hint style="warning" %}
You are referring to the **`Legacy`** version of KyberSwap docs.

For the most updated information, please refer to:

* [**`Classic`**](https://github.com/KyberNetwork/kyberswap-documentation/blob/main/reference/legacy/api-abi/core-smart-contracts/broken-reference/README.md)
* [**`Elastic`**](/reference/legacy/kyberswap-elastic.md)
* [**`Limit Order`**](/kyberswap-solutions/limit-order.md)
* [**`Aggregator`**](/kyberswap-solutions/kyberswap-aggregator.md)
  {% endhint %}

## interface IKyberMatchingEngine

is [IKyberReserve](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberreserve.md), [IKyberNetwork](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikybernetwork.md), [IKyberStorage](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstorage.md)\\

*Source*: [IKyberMatchingEngine.sol](https://github.com/KyberNetwork/smart-contracts/blob/master/contracts/sol6/IKyberMatchingEngine.sol)

***

### INDEX[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikybermatchingengine#index) <a href="#index" id="index"></a>

\<AUTOGENERATED\_TABLE\_OF\_CONTENTS>

### REFERENCE[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikybermatchingengine#reference) <a href="#reference" id="reference"></a>

#### Functions[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikybermatchingengine#functions) <a href="#functions" id="functions"></a>

#### `getNegligibleRateDiffBps`[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikybermatchingengine#getnegligibleratediffbps) <a href="#getnegligibleratediffbps" id="getnegligibleratediffbps"></a>

Returns the negligible rate difference in BPS.

***

function **getNegligibleRateDiffBps**() external view returns (uint256)\ **Returns:**\ The negligible rate difference in BPS.

\
\### \`getTradingReserves\` Returns trading reserves info for a trade. \_\_\_ function \_\_getTradingReserves\_\_(IERC20 src, IERC20 dest, bool isTokenToToken, bytes hint) external returns (bytes32\[] reserveIds, uint256\[] splitValuesBps, ProcessWithRate processWithRate) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | \`src\` | IERC20 | source token address | | \`dest\` | IERC20 | destination token address | | \`isTokenToToken\` | bool | whether the trade is token -> token | | \`hint\` | bytes | encoded hint for reserve routing | \*\*Returns:\*\*\ reserveIds - array of 32-byte reserve IDs for the trade splitValuesBps - array of split values in BPS for the trade respective to reserveIds processWithRate - whether extra processing is required or not\
\### \`doMatch\` Returns the indexes of the best rate from the rates array for token -> eth or eth -> token trade. \_\_\_ function \_\_doMatch\_\_(IERC20 src, IERC20 dest, uint256\[] srcAmounts, uint256\[] feesAccountedDestBps, uint256\[] rates) external view returns (uint256\[] reserveIndexes) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | \`src\` | IERC20 | source token address | | \`dest\` | IERC20 | destination token address | | \`srcAmounts\` | uint256\[] | array of srcAmounts after deducting fees: | | \`feesAccountedDestBps\` | uint256\[] | fees charged in BPS, to be deducted from calculated destAmount | | \`rates\` | uint256\[] | array of rates queried from reserves | \*\*Returns:\*\*\ reserveIndexes - array of the indexes most suited for the trade


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.kyberswap.com/reference/legacy/api-abi/core-smart-contracts/ikybermatchingengine.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
