Home Reference Source
public class | source

CompactData

CompactData is used to save gas on get, set rates operations. Instead of sending the whole buy, sell rates every time, only the different is sent if possible. The compact rate is calculated by following formula:

 compact = ((rate / base) - 1) * 1000

Constructor Summary

Public Constructor
public

constructor(rate: BigNumber, base: BigNumber)

Create a new CompactData instance.

Member Summary

Public Members
public get

base: *

public set
public get

compact: *

public set
public get
public set
Private Members
private

_base: *

private
private

Public Constructors

public constructor(rate: BigNumber, base: BigNumber) source

Create a new CompactData instance.

Params:

NameTypeAttributeDescription
rate BigNumber

the total rate

base BigNumber

the base to generate compact data

Public Members

public get base: * source

public set base source

public get compact: * source

public set compact source

public get isBaseChanged: * source

public set isBaseChanged source

Private Members

private _base: * source

private _compact: * source

private _isBaseChanged: * source