# new ERC20TokenLock(options)
ERC20 Token Lock Contract Object
Parameters:
Name | Type | Description |
---|---|---|
options |
ERC20TokenLock~Options
|
Members
# __assert
Methods
# approveERC20Transfer() → {Promise.<boolean>}
Approve this contract to transfer tokens of the ERC20 token contract on behalf of user
Success True if operation was successful
Promise.<boolean>
# canRelease(params) → {Promise.<boolean>}
Check if locked tokens release date has come and user can withdraw them
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
canRelease
Promise.<boolean>
# deploy(options) → {Promise.<(*|undefined)>}
Deploy the ERC20 Token Lock Contract
Parameters:
Name | Type | Description |
---|---|---|
options |
IContract~TxOptions
|
No Token Address Provided
Error
Promise.<(*|undefined)>
# getLockedTokens(params) → {Promise.<number>}
Get locked tokens amount for a given address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
amount Locked token amount
Promise.<number>
# getLockedTokensInfo(params) → {Date|Date|Promise.<number>}
Get locked tokens info for a given address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
startDate
Date
endDate
Date
amount Token amount
Promise.<number>
# getTokenAmount(params) → {Promise.<number>}
Get Token Amount of ERC20 Address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
Token Amount
Promise.<number>
# lock(params) → {Promise.<boolean>}
User locks his tokens until specified end date. REQUIREMENTS: user must have approved this contract to spend the tokens "amount" he wants to lock before calling this function.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
User Address |
amount |
number
|
Tokens amount to be locked |
endDate |
Date
|
Lock tokens until this end date |
Success True if operation was successful
Promise.<boolean>
# async maxAmountToLock() → {Promise.<number>}
Get maximum amount of tokens to lock per user
Maximum Amount
Promise.<number>
# async minAmountToLock() → {Promise.<number>}
Get minimum amount of tokens to lock per user
Minimum Amount
Promise.<number>
# release(params) → {Promise.<boolean>}
User withdraws his locked tokens after specified end date
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
User Address |
Success True if operation was successful
Promise.<boolean>
# setMaxAmountToLock(params) → {Promise.<boolean>}
(Admin only) sets maximum amount of tokens to lock per user
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
tokenAmount |
Address
|
Amount of Tokens |
Success True if operation was successful
Promise.<boolean>
# setMinAmountToLock(params) → {Promise.<boolean>}
(Admin only) sets minimum amount of tokens to lock per user
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
tokenAmount |
number
|
Minimum tokens amount |
Success True if operation was successful
Promise.<boolean>
# async totalAmountStaked() → {Integer}
Get All Tokens staked/locked at that specific moment
Token Amount
Integer
Type Definitions
Object
# Options
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tokenAddress |
string
|
|||
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> |