Home Reference Source
import ReserveContract from 'kyber-fpr-sdk/src/reserve_contract.js'
public class | source

ReserveContract

Extends:

BaseContract → ReserveContract

ReserveContract contains extended methods for KyberReserveContract

Constructor Summary

Public Constructor
public

constructor(provider: object, address: string)

Create new BaseContract instance.

Member Summary

Public Members
public
public

web3: *

Method Summary

Public Methods
public

async approveWithdrawAddress(adminAddress: object, tokenAddress: string, withdrawAddress: string, gasPrice: number): object

approve withdraw address for a token on reserve.

public

approvedWithdrawAddresses(address: object, tokenAddress: string): boolean

check for approval status of a token address to a particular address

public

conversionRatesContract return the address of conversion rates of this reserve

public

async disableTrade(alerterAddress: object, gasPrice: number): object

disableTrade stop the reserve from trading

public

async disapproveWithdrawAddress(adminAddress: object, tokenAddress: string, withdrawAddress: string, gasPrice: number): object

disapprove withdraw address for a token on reserve.

public

async enableTrade(adminAddress: object, gasPrice: number): object

enableTrade allow the reserve to continue trading

public

Return balance of given token.

public

kyberNetwork return the address of kyberNetwork contract of this reserve

public

sanityRatesContract return the address of sanity rates of this reserve

public

async setContracts(adminAddress: object, network: string, conversion: string, sanity: string, gasPrice: number): object

set Contract addresses for reserve contract.

public

async setTokenWallet(adminAddress: object, tokenAddress: string, walletAddress: object): *

set different token wallet per token.

public

tradeEnabled return true if the reserve is tradeEnabled, false otherwise

public

async withdraw(operatorAddress: object, tokenAddress: string, amount: object, toAddress: string, gasPrice: number): object

withdraw an amount of token to specified account

Inherited Summary

From class BaseContract
public
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 constructor(provider: object, address: string) source

Create new BaseContract instance.

Override:

BaseContract#constructor

Params:

NameTypeAttributeDescription
provider object

Web3 provider

address string

address of kyber reserve smart contract.

Public Members

public contract: * source

Override:

BaseContract#contract

public web3: * source

Override:

BaseContract#web3

Public Methods

public async approveWithdrawAddress(adminAddress: object, tokenAddress: string, withdrawAddress: string, gasPrice: number): object source

approve withdraw address for a token on reserve.

Params:

NameTypeAttributeDescription
adminAddress object

address of admin account.

tokenAddress string

contract address of the modifying token.

withdrawAddress string

address for withdrawal.

gasPrice number
  • optional
  • default: undefined

the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method

public approvedWithdrawAddresses(address: object, tokenAddress: string): boolean source

check for approval status of a token address to a particular address

Params:

NameTypeAttributeDescription
address object

address to withdraw the token to

tokenAddress string

address of the token's smart contract. Must be deployed already.

Return:

boolean

true for approved, false otherwise

public conversionRatesContract(): string source

conversionRatesContract return the address of conversion rates of this reserve

Return:

string

address of conversion rates contract

public async disableTrade(alerterAddress: object, gasPrice: number): object source

disableTrade stop the reserve from trading

Params:

NameTypeAttributeDescription
alerterAddress object

address of Alerter account

gasPrice number

(optional) - the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method

public async disapproveWithdrawAddress(adminAddress: object, tokenAddress: string, withdrawAddress: string, gasPrice: number): object source

disapprove withdraw address for a token on reserve.

Params:

NameTypeAttributeDescription
adminAddress object

address of admin account.

tokenAddress string

contract address of the modifying token.

withdrawAddress string

address for withdrawal.

gasPrice number
  • optional
  • default: undefined

the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method

public async enableTrade(adminAddress: object, gasPrice: number): object source

enableTrade allow the reserve to continue trading

Params:

NameTypeAttributeDescription
adminAddress object

address of Admin account

gasPrice number

(optional) - the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method

public getBalance(token: string): number source

Return balance of given token.

Params:

NameTypeAttributeDescription
token string

address of token to check balance.

Return:

number

balance of given token

public kyberNetwork(): string source

kyberNetwork return the address of kyberNetwork contract of this reserve

Return:

string

address of kyberNetwork contract

public sanityRatesContract(): string source

sanityRatesContract return the address of sanity rates of this reserve

Return:

string

address of sanity rates contract

public async setContracts(adminAddress: object, network: string, conversion: string, sanity: string, gasPrice: number): object source

set Contract addresses for reserve contract.

Params:

NameTypeAttributeDescription
adminAddress object

address of admin account.

network string

address of kyber network smart contract.

conversion string

address of kyber network smart contract.

sanity string

(optional) - address of sanity rates contract.

gasPrice number
  • optional
  • default: undefined

the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method

public async setTokenWallet(adminAddress: object, tokenAddress: string, walletAddress: object): * source

set different token wallet per token.

Params:

NameTypeAttributeDescription
adminAddress object

address of admin account.

tokenAddress string

address of the token's smart contract.

walletAddress object

address of wallet in which tokens are present.

Return:

*

public tradeEnabled(): boolean source

tradeEnabled return true if the reserve is tradeEnabled, false otherwise

Return:

boolean

tradeEnabled status of the reserve

public async withdraw(operatorAddress: object, tokenAddress: string, amount: object, toAddress: string, gasPrice: number): object source

withdraw an amount of token to specified account

Params:

NameTypeAttributeDescription
operatorAddress object

address of operator account.

tokenAddress string

address of the token's smart contract. Must be deployed already.

amount object

amount to withdraw (BN|String|int), must be in wei.

toAddress string

address for withdrawal. Must be approved already.

gasPrice number
  • optional
  • default: undefined

the gasPrice desired for the tx

Return:

object

the tx object of send() command from this contract method