Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PrintableToken

PrintableToken is a ERC-20 compatible token with an additional 'print' method that allows printing of tokens and sending them to any user. We use this in our demo setup to allow users to quickly acquire our collateral and loan tokens without having to use faucets.

Hierarchy

Index

Constructors

constructor

Properties

ascii

ascii: string

Protected blockchain

blockchain: Blockchain

name

name: function = this.contractProperty<string>('name')

Returns token name.

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

printValue

printValue: function = this.contractProperty<BigNumber>('printValue')

Returns token print value (how much will be printed at once).

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

symbol

symbol: function = this.contractProperty<string>('symbol')

Returns token symbol.

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

Methods

allowance

  • Returns this token's allowance of an address and spender.

    Parameters

    Returns Promise<BigNumber>

    Balance in this token.

approve

  • approve(spender: Address, value: BigNumber): Promise<void>
  • Sets this token's allowance of a spender from the current coinbase.

    Parameters

    • spender: Address

      Spender of tokens.

    • value: BigNumber

      New allowance for this spender.

    Returns Promise<void>

    Balance in this token.

balance

  • balance(token: Token): Promise<BigNumber>
  • Returns a token's balance of this address.

    Parameters

    • token: Token

      ERC20 compatible token.

    Returns Promise<BigNumber>

    balance

balanceOf

  • balanceOf(address: Address): Promise<BigNumber>
  • Returns this token's balance of an address.

    Parameters

    • address: Address

      Address of which balance to get.

    Returns Promise<BigNumber>

    Balance in this token.

Protected contractProperty

  • contractProperty<T>(key: string): function
  • Returns a caching getter for a constant contract property.

    Type parameters

    • T

    Parameters

    • key: string

      Name of contract property.

    Returns function

    Getter for contract property.

      • (): Promise<T>
      • Returns Promise<T>

decimals

  • decimals(): Promise<BigNumber>
  • Returns token decimal places count.

    TODO(q3k): Replace this once our smart contracts start returning uint8, per ERC20.

    Returns Promise<BigNumber>

eq

  • Compares two addresses for equality, ie. if they are the same address.

    Parameters

    • other: Address

      Address to compare with.

    Returns boolean

    Whether addresses are equal.

humanize

  • humanize(internal: BigNumber): Promise<BigNumber>
  • Converts an integer representation of the tokan into a human-friendly decimal point representation.

    Parameters

    • internal: BigNumber

      Token amount as integer.

    Returns Promise<BigNumber>

    Human-readable decimal point representation.

integerize

  • integerize(human: BigNumber): Promise<BigNumber>
  • Converts a decimal representation of the token into the internal integer representation.

    Parameters

    • human: BigNumber

      Token amount with decimal point.

    Returns Promise<BigNumber>

    Internal integer representation.

print

  • print(who: Address): Promise<void>
  • Prints printValue tokens and sends them to an address.

    Parameters

    • who: Address

      Receiver of newly printed tokens.

    Returns Promise<void>

printable

proto

  • proto(): pb.Address
  • Converts this address to a proto representation.

    Returns pb.Address

    This address as a protobuf.

token

Generated using TypeDoc