Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 6.08 KB

File metadata and controls

47 lines (29 loc) · 6.08 KB

KyberHintHandler

{% hint style="warning" %} You are referring to the Legacy version of KyberSwap docs.

For the most updated information, please refer to:

contract KyberHintHandler

is IKyberHint, Utils5\ imports Utils5, IKyberHint

Source: KyberHintHandler.sol

INDEX

<AUTOGENERATED_TABLE_OF_CONTENTS>

REFERENCE

Functions

parseTokenToEthHint

Parses the hint for a token -> eth trade.

function parseTokenToEthHint(IERC20 tokenSrc, bytes hint) public view override returns (TradeType tokenToEthType, bytes32[] tokenToEthReserveIds, IKyberReserve[] tokenToEthAddresses, uint256[] tokenToEthSplits) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | tokenSrc | IERC20 | source token to trade | | hint | bytes | the ABI encoded hint, built using the build hint functions |

Returns:\ tokenToEthType - decoded hint type tokenToEthReserveIds - decoded reserve IDs tokenToEthAddresses - reserve addresses corresponding to reserve IDs tokenToEthSplits - decoded splits


### `parseEthToTokenHint` Parses the hint for a eth -> token trade. ___ function __parseEthToTokenHint__(IERC20 tokenDest, bytes hint) public view override returns (TradeType ethToTokenType, bytes32[] ethToTokenReserveIds, IKyberReserve[] ethToTokenAddresses, uint256[] ethToTokenSplits) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `tokenDest` | IERC20 | dest token to trade | | `hint` | bytes | the ABI encoded hint, built using the build hint functions |

Returns:\ ethToTokenType - decoded hint type ethToTokenReserveIds - decoded reserve IDs ethToTokenAddresses - reserve addresses corresponding to reserve IDs ethToTokenSplits - decoded splits


### `parseTokenToTokenHint` Parses the hint for a token to token trade. ___ function __parseTokenToTokenHint__(IERC20 tokenSrc, IERC20 tokenDest, bytes hint) public view override returns (TradeType tokenToEthType, bytes32[] tokenToEthReserveIds, IKyberReserve[] tokenToEthAddresses, uint256[] tokenToEthSplits, TradeType ethToTokenType, bytes32[] ethToTokenReserveIds, IKyberReserve[] ethToTokenAddresses, uint256[] ethToTokenSplits) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `tokenSrc` | IERC20 | source token to trade | | `tokenDest` | IERC20 | dest token to trade | | `hint` | bytes | the ABI encoded hint, built using the build hint functions | **Returns:**\ tokenToEthType - decoded hint type tokenToEthReserveIds - decoded reserve IDs tokenToEthAddresses - reserve addresses corresponding to reserve IDs tokenToEthSplits - decoded splits ethToTokenType - decoded hint type ethToTokenReserveIds - decoded reserve IDs ethToTokenAddresses - reserve addresses corresponding to reserve IDs ethToTokenSplits - decoded splits
### `buildTokenToEthHint` Builds the hint for a token -> eth trade. ___ function __buildTokenToEthHint__(IERC20 tokenSrc, TradeType tokenToEthType, bytes32[] tokenToEthReserveIds, uint256[] tokenToEthSplits) public view override returns (bytes hint) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `tokenSrc` | IERC20 | source token to trade | | `tokenToEthType` | TradeType | token -> eth trade hint type | | `tokenToEthReserveIds` | bytes32[] | token -> eth reserve IDs | | `tokenToEthSplits` | uint256[] | token -> eth reserve splits | **Returns:**\ hint - the ABI encoded hint
### `buildEthToTokenHint` Builds the hint for a eth -> token trade. ___ function __buildEthToTokenHint__(IERC20 tokenDest, TradeType ethToTokenType, bytes32[] ethToTokenReserveIds, uint256[] ethToTokenSplits) public view override returns (bytes hint) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `tokenDest` | IERC20 | destination token to trade | | `ethToTokenType` | TradeType | eth -> token trade hint type | | `ethToTokenReserveIds` | bytes32[] | eth -> token reserve IDs | | `ethToTokenSplits` | uint256[] | eth -> token reserve splits | **Returns:**\ hint - the ABI encoded hint
### `buildTokenToTokenHint` Builds the hint for a token to token trade. ___ function __buildTokenToTokenHint__(IERC20 tokenSrc, TradeType tokenToEthType, bytes32[] tokenToEthReserveIds, uint256[] tokenToEthSplits, IERC20 tokenDest, TradeType ethToTokenType, bytes32[] ethToTokenReserveIds, uint256[] ethToTokenSplits) public view override returns (bytes hint) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `tokenSrc` | IERC20 | source token to trade | | `tokenToEthType` | TradeType | token -> eth trade hint type | | `tokenToEthReserveIds` | bytes32[] | token -> eth reserve IDs | | `tokenToEthSplits` | uint256[] | token -> eth reserve splits | | `tokenDest` | IERC20 | destination token to trade | | `ethToTokenType` | TradeType | eth -> token trade hint type | | `ethToTokenReserveIds` | bytes32[] | eth -> token reserve IDs | | `ethToTokenSplits` | uint256[] | eth -> token reserve splits |

Returns:\ hint - the ABI encoded hint