OrderbookReserveLister
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
You are referring to the Legacy
version of KyberSwap docs.
For the most updated information, please refer to:
imports OrderbookReserve, FeeBurnerInterface
Source: PermissionlessOrderbookReserveLister.sol
The Permissionless Orderbook Reserve Lister is used for creating, initialising and listing new Permissionless Orderbook Reserves.
<AUTOGENERATED_TABLE_OF_CONTENTS>
TokenOrderbookListingStage
Event for logging of the listing stage of an orderbook reserve for a particular ERC20 token.
event TokenOrderbookListingStage(ERC20 token, ListingStage stage) | Parameter | Type | Description | | --------- |:-----:|:----------------------------:| | token
| ERC20 | ERC20 token contract address | | stage
| enum ListingStage | Takes 1 of the following values: {NO_RESERVE, RESERVE_ADDED, RESERVE_INIT, RESERVE_LISTED} |\
PermissionlessOrderbookReserveLister
Contract constructor. Note that constructor methods are called exactly once during contract instantiation and cannot be called again.
function PermissionlessOrderbookReserveLister(InternalNetworkInterface kyber, OrderListFactoryInterface factory, MedianizerInterface medianizer, ERC20 knc, uint maxOrders, uint minOrderValueUsd) public | Parameter | Type | Description | | -----------------|:------------------------:|:--------------------------------:| | kyber
| InternalNetworkInterface | KyberNetwork contract address | | factory
| OrderListFactoryInterface | OrderListFactory contract address | | medianizer
| MedianizerInterface | Medianizer contract address | | knc
| ERC20 | KNC token contract address | | maxOrders
| uint | Maximum number of orders to traverse for 1 trade | | minOrderValueUsd
| uint | Minimum USD amount needed to create a new order on a permissionless orderbook reserve |
\
addOrderbookContract
The first step for creating an orderbook reserve for a specified ERC20 token.
function addOrderbookContract(ERC20 token) public returns (bool) | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | token
| ERC20 | ERC20 token contract address | Returns:\ True if the function was executed successfully.
Web3 Example:
// DISCLAIMER: Code snippets in this guide are just examples and you
// should always do your own testing. If you have questions, visit our
// https://t.me/KyberDeveloper.
transactionData = PermissionlessOrderbookReserveLister.methods
.addOrderbookContract(token)
.encodeABI();
txReceipt = await web3.eth.sendTransaction({
from: ADMIN_ADDRESS,
to: PERMISSIONLESS_ORDERBOOK_RESERVE_LISTER_ADDRESS,
data: transactionData,
});
\
getOrderbookListingStage
Get the current listing stage for a specified ERC20 token.
function getOrderbookListingStage(ERC20 token) public view returns (address, ListingStage) | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | token
| ERC20 | ERC20 token contract address |
Returns:\ | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | address
| address | Orderbook reserve contract address for specified ERC20 token | | ListingStage
| ListingStage | Latest successful stage |
Web3 Example:
// DISCLAIMER: Code snippets in this guide are just examples and you
// should always do your own testing. If you have questions, visit our
// https://t.me/KyberDeveloper.
const token = '0xe41d2489571d322189246dafa5ebde1f4699f498'; // ZRX
result = await OrderbookReserve.methods.getOrderbookListingStage(token).call();
\
initOrderbookContract
The second step for creating an orderbook reserve for a specified ERC20 token.
function initOrderbookContract(ERC20 token) public returns (bool) | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | token
| ERC20 | ERC20 token contract address | Returns:\ True if the function was executed successfully.
Web3 Example:
// DISCLAIMER: Code snippets in this guide are just examples and you
// should always do your own testing. If you have questions, visit our
// https://t.me/KyberDeveloper.
transactionData = PermissionlessOrderbookReserveLister.methods
.initOrderbookContract(token)
.encodeABI();
txReceipt = await web3.eth.sendTransaction({
from: ADMIN_ADDRESS,
to: PERMISSIONLESS_ORDERBOOK_RESERVE_LISTER_ADDRESS,
data: transactionData,
});
\
listOrderbookContract
The third and final step for creating an orderbook reserve for a specified ERC20 token.
function listOrderbookContract(ERC20 token) public returns (bool) | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | token
| ERC20 | ERC20 token contract address | Returns:\ True if the function was executed successfully.
Web3 Example:
// DISCLAIMER: Code snippets in this guide are just examples and you
// should always do your own testing. If you have questions, visit our
// https://t.me/KyberDeveloper.
transactionData = PermissionlessOrderbookReserveLister.methods
.listOrderbookContract(token)
.encodeABI();
txReceipt = await web3.eth.sendTransaction({
from: ADMIN_ADDRESS,
to: PERMISSIONLESS_ORDERBOOK_RESERVE_LISTER_ADDRESS,
data: transactionData,
});
\
unlistOrderbookContract
Unlist an orderbook reserve for a specified ERC20 token.
function unlistOrderbookContract(ERC20 token, uint hintReserveIndex) public returns (bool) | Parameter | Type | Description | | ----------|:-----:|:------------------------------------------:| | token
| ERC20 | ERC20 token contract address | | hintReserveIndex
| uint | index in Kyber Network reserve array | Returns:\ True if the reserve was successfully removed.
Web3 Example:
// DISCLAIMER: Code snippets in this guide are just examples and you
// should always do your own testing. If you have questions, visit our
// https://t.me/KyberDeveloper.
transactionData = PermissionlessOrderbookReserveLister.methods
.unlistOrderbookContract(token, hintReserveIndex)
.encodeABI();
txReceipt = await web3.eth.sendTransaction({
from: ADMIN_ADDRESS,
to: PERMISSIONLESS_ORDERBOOK_RESERVE_LISTER_ADDRESS,
data: transactionData,
});