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

SanityRatesContract

Extends:

BaseContract → SanityRatesContract

SanityRatesContract represents the KyberNetwork sanity rates smart contract. It's purpose is to prevent unusual rates from conversion rates contract to be used.

Constructor Summary

Public Constructor
public

constructor(provider: object, address: string)

Create new SanityRatesContract instance.

Member Summary

Public Members
public
public

web3: *

Method Summary

Public Methods
public

Return the sanity Rate of a pair of token

public

resonableDiffInBps return the list of reasonableDiffs in basis points (bps)

public

async setReasonableDiff(adminAddress: object, addresses: string[], diffs: uint[], gasPrice: number): object

setResonableDiff Set reasonable conversion rate difference in percentage (any conversion rate outside of this range is considered unreasonable).

public

async setSanityRates(operatorAddress: object, srcs: string[], rates: uint[], gasPrice: number): object

Set Sanity Rate for the contract

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 SanityRatesContract instance.

Override:

BaseContract#constructor

Params:

NameTypeAttributeDescription
provider object

Web3 provider

address string

address of smart contract.

Public Members

public contract: * source

Override:

BaseContract#contract

public web3: * source

Override:

BaseContract#web3

Public Methods

public getSanityRate(src: string, dest: string): string source

Return the sanity Rate of a pair of token

Params:

NameTypeAttributeDescription
src string

ERC20 token contract address of source token

dest string

ERC20 token contract address of destination token

Return:

string

the uint rate in strings format.

public reasonableDiffInBps(address: string): string source

resonableDiffInBps return the list of reasonableDiffs in basis points (bps)

Params:

NameTypeAttributeDescription
address string

ERC20 token contract address to query

Return:

string

the uint reasonable diff in string format

public async setReasonableDiff(adminAddress: object, addresses: string[], diffs: uint[], gasPrice: number): object source

setResonableDiff Set reasonable conversion rate difference in percentage (any conversion rate outside of this range is considered unreasonable).

Params:

NameTypeAttributeDescription
adminAddress object

address of admin account

addresses string[]

list of ERC20 token contract to set

diffs uint[]

list of diffs in bps (1 bps = 0.01%)

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 setSanityRates(operatorAddress: object, srcs: string[], rates: uint[], gasPrice: number): object source

Set Sanity Rate for the contract

Params:

NameTypeAttributeDescription
operatorAddress object

address of operator account

srcs string[]

list of source ERC20 token contract addresses

rates uint[]

list of Rates in ETH wei

gasPrice number

(optional) - the gasPrice desired for the tx

Return:

object

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