KyberDeveloper · Powering Liquidity for the Ecosystem

KyberDeveloper · Powering Liquidity for the Ecosystem

  • Home
  • Integrations
  • Reserves
  • KyberPRO
  • Addresses
  • API/ABI
  • Trade Debugger
  • Tracker
  • GitHub

›Core Smart Contracts

Getting Started

  • Introduction

RESTful API

  • RESTful API Overview
  • RESTful API

Widgets

  • Widgets Overview
  • KyberWidget
  • Sign In Widget

Core Smart Contracts

  • IKyberNetworkProxy
  • KyberNetworkProxy
  • IKyberNetwork
  • ISimpleKyberProxy
  • IKyberMatchingEngine
  • KyberMatchingEngine
  • IKyberHint
  • KyberHintHandler
  • IKyberFeeHandler
  • KyberFeeHandler
  • IKyberStaking
  • KyberStaking
  • IKyberDao
  • KyberDao
  • IKyberStorage
  • KyberStorage
  • IKyberHistory
  • KyberHistory
  • IKyberReserve
  • KyberReserve
  • ConversionRates
  • LiquidityConversionRates
  • IEpochUtils
  • EpochUtils

Contract ABIs

  • ABIs

Plugins

  • Plugins Overview
  • WooCommerce Plugin

Code Snippets

  • Token Quantity Conversion

Misc Contracts

  • KyberNetwork
  • ConversionRatesInterface
  • OrderbookReserveInterface
  • PermissionGroups
  • SanityRates
  • SanityRatesInterface
  • Withdrawable

IKyberNetworkProxy

interface IKyberNetworkProxy

imports IERC20

Source: IKyberNetworkProxy.sol


INDEX

  • ExecuteTrade
  • tradeWithHint
  • tradeWithHintAndFee
  • trade
  • getExpectedRate
  • getExpectedRateAfterFee

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)

ParameterTypeDescription
traderaddresstrader's/taker's address
srcIERC20source ERC20 token contract address
destIERC20destination ERC20 Token contract address
destAddressaddressthe address where the destAmount will be sent to
actualSrcAmountuint256source ERC20 token amount in wei
actualDestAmountuint256destination ERC20 token amount in wei
platformWalletaddressaddress receiving the platform fee
platformFeeBpsuint256platform 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)

ParameterTypeDescription
srcERC20source ERC20 token contract address
srcAmountuint256source ERC20 token amount in its token decimals
destERC20destination ERC20 token contract address
destAddressaddressrecipient address for destination ERC20 token
maxDestAmountuint256limit on the amount of destination tokens
minConversionRateuint256minimum conversion rate; trade is canceled if actual rate is lower
walletIdaddressdeprecated
hintbyteshint 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)

ParameterTypeDescription
srcIERC20source ERC20 token contract address
srcAmountuint256source ERC20 token amount in its token decimals
destIERC20destination ERC20 token contract address
destAddressaddressrecipient address for destination ERC20 token
maxDestAmountuint256limit on the amount of destination tokens
minConversionRateuint256minimum conversion rate; trade is canceled if actual rate is lower
platformWalletaddressaddress receiving the platform fee
platformFeeBpsuint256platform fee in BPS to be used in this trade
hintbyteshint 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)

ParameterTypeDescription
srcIERC20source ERC20 token contract address
srcAmountuint256source ERC20 token amount in its token decimals
destIERC20destination ERC20 token contract address
destAddressaddressrecipient address for destination ERC20 token
maxDestAmountuint256limit on the amount of destination tokens
minConversionRateuint256minimum conversion rate; trade is canceled if actual rate is lower
platformWalletaddressaddress 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)

ParameterTypeDescription
srcERC20source ERC20 token contract address
destERC20destination ERC20 token contract address
srcQtyuint256source 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)

ParameterTypeDescription
srcIERC20source ERC20 token contract address
destIERC20destination ERC20 token contract address
srcQtyuint256source ERC20 token amount in its token decimals
platformFeeBpsuint256platform fee in BPS
hintbyteshint in bytes for reserve routing

Returns:
expectedRate - conversion rate of the src and dest tokens after deducting the network and platform fee.

← Sign In WidgetKyberNetworkProxy →
  • INDEX
  • REFERENCE
    • Events
    • ExecuteTrade
    • Functions
    • tradeWithHint
    • tradeWithHintAndFee
    • trade
    • getExpectedRate
    • getExpectedRateAfterFee
KyberDeveloper · Powering Liquidity for the Ecosystem
EssentialsGetting StartedDesign PrinciplesProtocol OverviewSmart Contract Architecture
IntegrationsDAppsVendorsWalletsPlatform Fees
ReservesFed PriceAutomated Price
© 2019 Kyber Network. All rights reserved.
Follow us on Facebook
Follow us on Twitter
Follow us on Github
Follow us on Reddit
Join our Telegram group
Subscribe to our Youtube channel
Read our blog on Medium