Skip to main content
Version: Legacy

KyberMatchingEngine

contract KyberMatchingEngine

is KyberHintHandler, IKyberMatchingEngine, WithdrawableNoModifiers\ imports WithdrawableNoModifiers, IKyberMatchingEngine, IKyberNetwork, KyberHintHandler, IKyberStorage

Source: KyberMatchingEngine.sol


INDEX

<AUTOGENERATED_TABLE_OF_CONTENTS>

REFERENCE

Events

KyberStorageUpdated

Event logging the setting of the new KyberStorage contract address.


event KyberStorageUpdated(IKyberStorage newKyberStorage) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | newKyberStorage | IKyberStorage | new KyberStorage contract address | Signature: 0xed8c790db7ddf303f576c18e6644ec19e7b39356088eeeeac11c95212c61f49a


KyberNetworkUpdated

Event logging the setting of the new KyberNetwork contract address.


event KyberNetworkUpdated(IKyberNetwork newKyberNetwork) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | newKyberNetwork | IKyberNetwork | new KyberNetwork contract address | Signature: 0x18970d46ac8a7d7e0da90e1bebb0be3e87ffc7705fc09d3bba5373d59b7a12aa


Functions

getTradingReserves

Returns trading reserves info for a trade.


function getTradingReserves(IERC20 src, IERC20 dest, bool isTokenToToken, bytes hint) external view override 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


### `getNegligibleRateDiffBps` Returns the negligible rate difference in BPS. ___ function __getNegligibleRateDiffBps__() external view override returns (uint256)\ **Returns:**\ The negligible rate difference in BPS.
### `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 override 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