# new ERC20Contract(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
ERC20Contract~Options
|
Methods
# allowance(params) → {Promise.<number>}
Check allowance for given spender address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
address |
Address
|
Sender Address |
spenderAddress |
Address
|
Spender Address |
allowance amount
Promise.<number>
# 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 |
Transaction
Promise.<Transaction>
# deploy(params, options) → {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 |
options |
IContract~TxOptions
|
Transaction
Promise.<Transaction>
# fromDecimalsToBN(amount) → {Promise.<number>}
Convert given tokens amount integer to float number with decimals for UI.
Parameters:
Name | Type | Description |
---|---|---|
amount |
number
|
Tokens amount to convert |
tokensAmount
Promise.<number>
# getTokenAmount(address) → {Promise.<Transaction>}
Get Amount of Tokens User Holds
Parameters:
Name | Type | Description |
---|---|---|
address |
Address
|
User Address |
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 |
isApproved
Promise.<boolean>
# toTokens(amount) → {Promise.<number>}
Convert given tokens amount as tokens with decimals for smart contract.
Parameters:
Name | Type | Description |
---|---|---|
amount |
number
|
Tokens amount to convert |
tokensAmount
Promise.<number>
# transferTokenAmount(params) → {Promise.<Transaction>}
Transfer Tokens
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
toAddress |
Address
|
To Address |
tokenAmount |
Integer
|
Amount of Tokens |
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> |