Class

ERC20TokenLock

ERC20TokenLock(options)

Constructor

# new ERC20TokenLock(options)

ERC20 Token Lock Contract Object

Parameters:
Name Type Description
options ERC20TokenLock~Options

View Source models/ERC20/ERC20TokenLock.js, line 18

Methods

# approveERC20Transfer() → {Promise.<boolean>}

Approve this contract to transfer tokens of the ERC20 token contract on behalf of user

View Source models/ERC20/ERC20TokenLock.js, line 270

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

View Source models/ERC20/ERC20TokenLock.js, line 98

canRelease

Promise.<boolean>

# deploy(params) → {Promise.<(*|undefined)>}

Deploy the ERC20 Token Lock Contract

Parameters:
Name Type Description
params Object
callback function

View Source models/ERC20/ERC20TokenLock.js, line 317

No Token Address Provided

Error
Promise.<(*|undefined)>

# async erc20() → {Promise.<Address>}

Get ERC20 Address of the Token Contract managed

View Source models/ERC20/ERC20TokenLock.js, line 42

Promise.<Address>

# getERC20Contract()

View Source models/ERC20/ERC20TokenLock.js, line 334

ERC20Contract|undefined

# getLockedTokens(params) → {Promise.<number>}

Get locked tokens amount for a given address

Parameters:
Name Type Description
params Object
address Address

View Source models/ERC20/ERC20TokenLock.js, line 107

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

View Source models/ERC20/ERC20TokenLock.js, line 124

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

View Source models/ERC20/ERC20TokenLock.js, line 53

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

View Source models/ERC20/ERC20TokenLock.js, line 197

Success True if operation was successful

Promise.<boolean>

# async maxAmountToLock() → {Promise.<number>}

Get maximum amount of tokens to lock per user

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

Maximum Amount

Promise.<number>

# async minAmountToLock() → {Promise.<number>}

Get minimum amount of tokens to lock per user

View Source models/ERC20/ERC20TokenLock.js, line 71

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

View Source models/ERC20/ERC20TokenLock.js, line 245

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

View Source models/ERC20/ERC20TokenLock.js, line 147

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

View Source models/ERC20/ERC20TokenLock.js, line 170

Success True if operation was successful

Promise.<boolean>

# async totalAmountStaked() → {Integer}

Get All Tokens staked/locked at that specific moment

View Source models/ERC20/ERC20TokenLock.js, line 59

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>

View Source models/ERC20/ERC20TokenLock.js, line 9