{% hint style="warning" %}
You are referring to the Legacy
version of KyberSwap docs.
For the most updated information, please refer to:
Classic
Elastic
Limit Order
Aggregator
{% endhint %}
imports IERC20
Source: IKyberReserve.sol
INDEX
<AUTOGENERATED_TABLE_OF_CONTENTS>
REFERENCE
Functions
trade
Executes a trade between the reserve and the KyberNetwork contract.
function trade(IERC20 srcToken, uint256 srcAmount, IERC20 destToken, address payable destAddress, uint256 conversionRate, bool validate) external payable returns (bool) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | srcToken
| IERC20 | source ERC20 token contract address | | srcAmount
| uint256 | source ERC20 token amount in its token decimals | | destToken
| IERC20 | destination ERC20 token contract address | | destAddress
| address | recipient address for destination ERC20 tokens | | conversionRate
| uint256 | actual conversion rate between srcToken and destToken | | validate
| bool | Apply additional validations if true
| Returns:\ true
if the trade was successful, otherwise false
if unsuccessful
### `getConversionRate` Gets the conversion rate for a pair of tokens at block number. ___ function __getConversionRate__(IERC20 src, IERC20 dest, uint256 srcQty, uint256 blockNumber) external view returns (uint256) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `src` | IERC20 | source ERC20 token contract address | | `dest` | IERC20 | destination ERC20 token contract address | | `srcQty` | uint256 | source ERC20 token in its token decimals | | `blockNumber` | uint256 | current block height or block number | **Returns:**\ Current conversion rate of token pairs at `blockNumber`