Class

ERC20Contract

ERC20Contract(options)

Constructor

# new ERC20Contract(options)

Parameters:
Name Type Description
options ERC20Contract~Options

View Source models/ERC20/ERC20Contract.js, line 13

Members

# __assert

Use a ierc20 contract with the current address

View Source models/ERC20/ERC20Contract.js, line 26

Methods

# approve(params) → {Promise.<Transaction>}

Approve tokens to be used by another address/contract

Parameters:
Name Type Description
params Object

Parameters

address Address

Spender Address/Contract

amount number

Amount of Tokens

callback function

callback for the Tx

View Source models/ERC20/ERC20Contract.js, line 143

Transaction

Promise.<Transaction>

# deploy(params) → {Promise.<Transaction>}

Deploy ERC20 Token

Parameters:
Name Type Description
params Object

Parameters

name string

Name of token

symbol string

Symbol of token

cap number

Max supply of Token (ex : 100M)

distributionAddress Address

Where tokens should be sent to initially

View Source models/ERC20/ERC20Contract.js, line 173

Transaction

Promise.<Transaction>

# getABI() → {Contract}

View Source models/ERC20/ERC20Contract.js, line 92

Contract

# getAddress() → {Address}

Get Token Address

View Source models/ERC20/ERC20Contract.js, line 43

address

Address

# getContract() → {*}

View Source models/ERC20/ERC20Contract.js, line 35

*

# getDecimals() → {number}

Get Decimals of Token

View Source models/ERC20/ERC20Contract.js, line 101

Total supply

number

# getTokenAmount(address) → {Promise.<Transaction>}

Get Amount of Tokens User Holds

Parameters:
Name Type Description
address Address

User Address

View Source models/ERC20/ERC20Contract.js, line 73

Transaction

Promise.<Transaction>

# isApproved(params) → {Promise.<boolean>}

Verify if Spender is Approved to use tokens

Parameters:
Name Type Description
params Object

Parameters

address Address

Sender Address

amount number

Amount of Tokens

spenderAddress Address

Spender Address

View Source models/ERC20/ERC20Contract.js, line 120

isApproved

Promise.<boolean>

# totalSupply() → {Promise.<number>}

Get Total Supply of Token

View Source models/ERC20/ERC20Contract.js, line 83

Total supply

Promise.<number>

# transferTokenAmount(params) → {Promise.<Transaction>}

Transfer Tokens

Parameters:
Name Type Description
params Object

Parameters

toAddress Address

To Address

tokenAmount Integer

Amount of Tokens

View Source models/ERC20/ERC20Contract.js, line 55

Transaction

Promise.<Transaction>

Type Definitions

Object

# Options

Properties:
Name Type Attributes Default Description
test Boolean
localtest Boolean

ganache local blockchain

web3Connection Web3Connection <optional>
Web3Connection

created from params: 'test', 'localtest' and optional 'web3Connection' string and 'privateKey'

contractAddress string <optional>

View Source models/ERC20/ERC20Contract.js, line 5