Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ratio

Hierarchy

  • FixedPoint
    • Ratio

Index

Constructors

constructor

  • new Ratio(amount: BN): Ratio
  • Parameters

    • amount: BN

    Returns Ratio

Properties

Readonly amount

amount: BN

Static Readonly DIV

DIV: number = 1000000

Static Readonly DIV_BN

DIV_BN: BN = new BN(Ratio.DIV)

Methods

add

  • add(other: this): this
  • Parameters

    • other: this

    Returns this

Protected check

  • check(other: FixedPoint, type?: Function): void
  • Parameters

    • other: FixedPoint
    • Default value type: Function = this.constructor

    Returns void

cmp

  • cmp(other: this): number
  • Parameters

    • other: this

    Returns number

div

  • div(ratio: Ratio): this
  • Parameters

    Returns this

divFloor

  • divFloor(ratio: Ratio): this
  • Parameters

    Returns this

divRound

  • divRound(ratio: Ratio): this
  • Parameters

    Returns this

divToRatio

  • divToRatio(other: this): Ratio
  • Parameters

    • other: this

    Returns Ratio

eq

  • eq(other: this): boolean
  • Parameters

    • other: this

    Returns boolean

gte

  • gte(other: this): boolean
  • Parameters

    • other: this

    Returns boolean

isZero

  • isZero(): boolean
  • Returns boolean

lte

  • lte(other: this): boolean
  • Parameters

    • other: this

    Returns boolean

mul

  • mul(ratio: Ratio): this
  • Parameters

    Returns this

mulCeil

  • mulCeil(ratio: Ratio): this
  • Parameters

    Returns this

mulRound

  • mulRound(ratio: Ratio): this
  • Parameters

    Returns this

sub

  • sub(other: this): this
  • Parameters

    • other: this

    Returns this

toJSON

  • toJSON(): string
  • Returns string

toNumber

  • toNumber(): number
  • Returns number

toString

  • toString(radix?: number): string
  • Parameters

    • Default value radix: number = 10

    Returns string

zeroToNull

  • zeroToNull(): this | null
  • Returns this | null

Static of

  • Parameters

    • num: number

    Returns Ratio

Static parse

  • parse(str: string): Ratio
  • Parameters

    • str: string

    Returns Ratio

Generated using TypeDoc