# ConversionRatesInterface

{% 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/misc-contracts/broken-reference/README.md)
* [**`Elastic`**](https://docs.kyberswap.com/reference/legacy/kyberswap-elastic)
* [**`Limit Order`**](https://docs.kyberswap.com/kyberswap-solutions/limit-order)
* [**`Aggregator`**](https://docs.kyberswap.com/kyberswap-solutions/kyberswap-aggregator)
  {% endhint %}

## interface ConversionRatesInterface

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

***

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

\<AUTOGENERATED\_TABLE\_OF\_CONTENTS>

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

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

#### `getRate`[​](https://docs.kyberswap.com/Legacy/api-abi/misc/api_abi-conversionratesinterface#getrate) <a href="#getrate" id="getrate"></a>

Gets the conversion rate of the ERC20 token depending on quantity at block height

***

function **getRate**(ERC20 token, uint currentBlockNumber, bool buy, uint qty) public view returns (uint) | Parameter | Type | Description | | -------------------- |:-----:|:------------------------------------------------------------------:| | `token` | ERC20 | ERC20 token contract address | | `currentBlockNumber` | uint | current block height or block number | | `buy` | bool | `true` if action is to buy, otherwise `false` if action is to sell | | `qty` | uint | wei amount of ERC20 tokens | **Returns:**\ Conversion rate of ERC20 token depending on quantity at block height\\

#### `recordImbalance`[​](https://docs.kyberswap.com/Legacy/api-abi/misc/api_abi-conversionratesinterface#recordimbalance) <a href="#recordimbalance" id="recordimbalance"></a>

Records the wei amount of net absolute (+/-) change for a token in a block

***

function **recordImbalance**(ERC20 token, int buyAmount, uint rateUpdateBlock, uint currentBlock) public | Parameter | Type | Description | | ----------------- |:-----:|:------------------------------------:| | `token` | ERC20 | ERC20 token contract address | | `buyAmount` | int | buy amount of ERC20 tokens in wei | | `rateUpdateBlock` | uint | **NOT SURE** | | `currentBlock` | uint | current block height or block number |
