IKyberNetworkProxy
interface IKyberNetworkProxy
imports IERC20
Source: IKyberNetworkProxy.sol
INDEX
REFERENCE
Events
ExecuteTrade
Event for logging execution of trades.
event ExecuteTrade(address trader, IERC20 src, IERC20 dest, address destAddress, uint256 actualSrcAmount, uint256 actualDestAmount, address platformWallet, uint256 platformFeeBps)
Parameter | Type | Description |
---|---|---|
trader | address | trader's/taker's address |
src | IERC20 | source ERC20 token contract address |
dest | IERC20 | destination ERC20 Token contract address |
destAddress | address | the address where the destAmount will be sent to |
actualSrcAmount | uint256 | source ERC20 token amount in wei |
actualDestAmount | uint256 | destination ERC20 token amount in wei |
platformWallet | address | address receiving the platform fee |
platformFeeBps | uint256 | platform fee in BPS used in this trade |
Signature: 0xf724b4df6617473612b53d7f88ecc6ea983074b30960a049fcd0657ffe808083
Functions
tradeWithHint
Executes a trade between src and dest token and send dest tokens to destAddress; platform fee is ignored and is pre-Katalyst/backwards compatible.
function tradeWithHint(ERC20 src, uint256 srcAmount, ERC20 dest, address payable destAddress, uint256 maxDestAmount, uint256 minConversionRate, address payable walletId, bytes hint) external payable returns (uint256)
Parameter | Type | Description |
---|---|---|
src | ERC20 | source ERC20 token contract address |
srcAmount | uint256 | source ERC20 token amount in its token decimals |
dest | ERC20 | destination ERC20 token contract address |
destAddress | address | recipient address for destination ERC20 token |
maxDestAmount | uint256 | limit on the amount of destination tokens |
minConversionRate | uint256 | minimum conversion rate; trade is canceled if actual rate is lower |
walletId | address | deprecated |
hint | bytes | hint in bytes for reserve routing |
Returns:
Amount of actual destination tokens in twei
tradeWithHintAndFee
Executes a trade between src and dest token and send dest tokens to destAddress; includes the platform fee.
function tradeWithHintAndFee(IERC20 src, uint256 srcAmount, IERC20 dest, address payable destAddress, uint256 maxDestAmount, uint256 minConversionRate, address payable platformWallet, uint256 platformFeeBps, bytes hint) external returns (uint256 destAmount)
Parameter | Type | Description |
---|---|---|
src | IERC20 | source ERC20 token contract address |
srcAmount | uint256 | source ERC20 token amount in its token decimals |
dest | IERC20 | destination ERC20 token contract address |
destAddress | address | recipient address for destination ERC20 token |
maxDestAmount | uint256 | limit on the amount of destination tokens |
minConversionRate | uint256 | minimum conversion rate; trade is canceled if actual rate is lower |
platformWallet | address | address receiving the platform fee |
platformFeeBps | uint256 | platform fee in BPS to be used in this trade |
hint | bytes | hint in bytes for reserve routing |
Returns:
destAmount - Amount of actual destination tokens in twei
trade
Executes a Best-of-All trade (no reserve routing) between src and dest token and send dest tokens to destAddress; platform fee is ignored and is pre-Katalyst/backwards compatible.
function trade(IERC20 src, uint256 srcAmount, IERC20 dest, address payable destAddress, uint256 maxDestAmount, uint256 minConversionRate, address payable platformWallet) external returns (uint256)
Parameter | Type | Description |
---|---|---|
src | IERC20 | source ERC20 token contract address |
srcAmount | uint256 | source ERC20 token amount in its token decimals |
dest | IERC20 | destination ERC20 token contract address |
destAddress | address | recipient address for destination ERC20 token |
maxDestAmount | uint256 | limit on the amount of destination tokens |
minConversionRate | uint256 | minimum conversion rate; trade is canceled if actual rate is lower |
platformWallet | address | address receiving the platform fee |
Returns:
Amount of actual destination tokens in twei
getExpectedRate
Get the token conversion rate without platform fee; pre-Katalyst/backwards compatible.
function getExpectedRate(ERC20 src, contract ERC20 dest, uint256 srcQty) external returns (uint256 expectedRate, uint256 worstRate)
Parameter | Type | Description |
---|---|---|
src | ERC20 | source ERC20 token contract address |
dest | ERC20 | destination ERC20 token contract address |
srcQty | uint256 | source ERC20 token amount in its token decimals |
Returns:
expectedRate - conversion rate of the src and dest tokens after deducting the network fee.
worstRate - 97% rate of the conversion rate, allowaing a 3% buffer for use in minConversionRate in trade.
getExpectedRateAfterFee
Get the token conversion rate after processing the hint and includes the platform fee.
function getExpectedRateAfterFee(IERC20 src, IERC20 dest, uint256 srcQty, uint256 platformFeeBps, bytes hint) external returns (uint256 expectedRate)
Parameter | Type | Description |
---|---|---|
src | IERC20 | source ERC20 token contract address |
dest | IERC20 | destination ERC20 token contract address |
srcQty | uint256 | source ERC20 token amount in its token decimals |
platformFeeBps | uint256 | platform fee in BPS |
hint | bytes | hint in bytes for reserve routing |
Returns:
expectedRate - conversion rate of the src and dest tokens after deducting the network and platform fee.