import ConversionRatesContract from 'kyber-fpr-sdk/src/conversion_rates_contract.js'
ConversionRatesContract
Extends:
ConversionRatesContract represents the KyberNetwork conversion rates smart contract.
Constructor Summary
Public Constructor | ||
public |
constructor(provider: object, address: string) Create new ConversionRatesContract instance. |
Member Summary
Public Members | ||
public |
contract: * |
|
public |
getTokenIndices(token: string): number: * getTokenIndices returns the index of given Token to use in setCompact data call. |
|
public |
web3: * |
Method Summary
Public Methods | ||
public |
async addToken(adminAccount: object, token: string, tokenControlInfo: TokenControlInfo, gasPrice: number): * Add a ERC20 token and its pricing configurations to reserve contract and enable it for trading. |
|
public |
getBuyRates(token: string, qty: number, currentBlockNumber: number): number Return the buying ETH based rate. |
|
public |
getSellRates(token: string, qty: number, currentBlockNumber: number): * Return the buying ETH based rate. |
|
public |
async setImbalanceStepFunction(operatorAddress: object, token: string, buy: StepFunctionDataPoint[], sell: StepFunctionDataPoint[], gasPrice: number): * Set adjustments for tokens' buy and sell rates depending on the net traded amounts. Only operator can invoke. |
|
public |
async setQtyStepFunction(operatorAddress: object, token: string, buy: StepFunctionDataPoint[], sell: StepFunctionDataPoint[], gasPrice: number): * Set adjustments for tokens' buy and sell rates depending on the size of a buy / sell order. Only operator can invoke. |
|
public |
async setRate(operatorAddress: object, rates: RateSetting[], currentBlockNumber: number, gasPrice: number): * Set the buying rate for given token. |
|
public |
async updateTokenControlInfo(adminAccount: object, token: string, tokenControlInfo: TokenControlInfo, gasPrice: number): * Add a ERC20 token and its pricing configurations to reserve contract and enable it for trading. |
Inherited Summary
From class BaseContract | ||
public |
contract: * |
|
public |
web3: * |
|
public |
async addAlerter(adminAddress: object, address: string, gasPrice: number): * Add new address to alerters list. |
|
public |
async addOperator(adminAddress: object, address: string, gasPrice: number): * Add given address from operators list. |
|
public |
Return the current admin address of contract. |
|
public |
async claimAdmin(newAccount: object, gasPrice: number): * Claim admin privilege. |
|
public |
getAlerters(): array Return alerter addresses of contract. |
|
public |
getOperators(): array Return operator addresses of contract. |
|
public |
Return the pending admin address of contract. |
|
public |
async removeAlerter(adminAddress: object, address: string, gasPrice: number): * Remove address from alerters list. |
|
public |
async removeOperator(adminAddress: object, address: string, gasPrice: number): * Remove given address from operators list. |
|
public |
async transferAdmin(adminAddress: object, address: string, gasPrice: number): * transfer admin privilege to given address. |
Public Constructors
Public Members
Public Methods
public async addToken(adminAccount: object, token: string, tokenControlInfo: TokenControlInfo, gasPrice: number): * source
Add a ERC20 token and its pricing configurations to reserve contract and enable it for trading.
Params:
Name | Type | Attribute | Description |
adminAccount | object | admin account address |
|
token | string | ERC20 token address |
|
tokenControlInfo | TokenControlInfo | https://developer.kyber.network/docs/VolumeImbalanceRecorder#settokencontrolinfo |
|
gasPrice | number | (optional) - the gasPrice desired for the tx |
Return:
* |
public getBuyRates(token: string, qty: number, currentBlockNumber: number): number source
Return the buying ETH based rate. The rate might be vary with different quantity.
public getSellRates(token: string, qty: number, currentBlockNumber: number): * source
Return the buying ETH based rate. The rate might be vary with different quantity.
Return:
* |
public async setImbalanceStepFunction(operatorAddress: object, token: string, buy: StepFunctionDataPoint[], sell: StepFunctionDataPoint[], gasPrice: number): * source
Set adjustments for tokens' buy and sell rates depending on the net traded amounts. Only operator can invoke.
Params:
Name | Type | Attribute | Description |
operatorAddress | object | address of the operator account |
|
token | string | ERC20 token address |
|
buy | StepFunctionDataPoint[] | array of buy step function configurations |
|
sell | StepFunctionDataPoint[] | array of sell step function configurations |
|
gasPrice | number |
|
the gasPrice desired for the tx |
Return:
* |
public async setQtyStepFunction(operatorAddress: object, token: string, buy: StepFunctionDataPoint[], sell: StepFunctionDataPoint[], gasPrice: number): * source
Set adjustments for tokens' buy and sell rates depending on the size of a buy / sell order. Only operator can invoke.
Params:
Name | Type | Attribute | Description |
operatorAddress | object | address of the operator account |
|
token | string | ERC20 token address |
|
buy | StepFunctionDataPoint[] | array of buy step function configurations |
|
sell | StepFunctionDataPoint[] | array of sell step function configurations |
|
gasPrice | number | (optional) - the gasPrice desired for the tx |
Return:
* |
public async setRate(operatorAddress: object, rates: RateSetting[], currentBlockNumber: number, gasPrice: number): * source
Set the buying rate for given token.
Params:
Name | Type | Attribute | Description |
operatorAddress | object | address of the operator account |
|
rates | RateSetting[] | token address |
|
currentBlockNumber | number |
|
current block number |
gasPrice | number | (optional) - the gasPrice desired for the tx |
Return:
* |
public async updateTokenControlInfo(adminAccount: object, token: string, tokenControlInfo: TokenControlInfo, gasPrice: number): * source
Add a ERC20 token and its pricing configurations to reserve contract and enable it for trading.
Params:
Name | Type | Attribute | Description |
adminAccount | object | admin account address |
|
token | string | ERC20 token address |
|
tokenControlInfo | TokenControlInfo | https://developer.kyber.network/docs/VolumeImbalanceRecorder#settokencontrolinfo |
|
gasPrice | number | (optional) - the gasPrice desired for the tx |
Return:
* |