Secure the networkBug Bounty 2019

TokenLockingClient

The TokenLockingClient is a standard interface for interactions with methods and events described in ITokenLocking.sol. These interactions are generally concerned token locking, such as locking and unlocking tokens.

See Clients for information about initializing TokenLockingClient.

Callers

All callers return promises which resolve to an object containing the given return values..

getTotalLockCount.call({ token })

Get the total number of locked tokens.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).

Return Values

A promise which resolves to an object containing the following properties:

Return ValueTypeDescription
countnumberThe total number of locked tokens in the colony.

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

getUserLock.call({ token, user })

Get the total number of locked tokens for a given user.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).
useraddressThe address of the user.

Return Values

A promise which resolves to an object containing the following properties:

Return ValueTypeDescription
countbig numberThe total number of locked tokens.

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

Senders

All senders return an instance of a ContractResponse. Every send() method takes an options object as the second argument.

deposit.send({ token, amount }, options)

Deposit tokens. This function only be called if the tokens that the user is attempting to deposit are not locked and if the user has allowed the token locking contract to transfer the tokens.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).
amountbig numberThe amount of tokens that will be deposited.

Response

An instance of a ContractResponse which will eventually receive the following event data:

Event DataTypeDescription
tokenaddressThe address of the token contract receiving the deposit.
useraddressThe address of the user that deposited tokens.
amountbig numberThe amount of tokens that were deposited.
timestampdateThe timestamp when the tokens were deposited.
UserTokenDepositedobjectContains the data defined in UserTokenDeposited

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

lockToken.send({ token }, options)

Lock all tokens for a given token contract.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).

Response

An instance of a ContractResponse which will eventually receive the following event data:

Event DataTypeDescription
tokenaddressThe address of the token contract that was locked.
lockCountbig numberThe address of the token contract that was assigned.
TokenLockedobjectContains the data defined in TokenLocked

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

incrementLockCounterTo.send({ token, lockId }, options)

Increment the token lock counter. This method allows users to waive reward payouts for past reward payout cycles, unlocking the tokens that were locked in previous reward payout cycles.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).
lockIdnumberThe ID of the lock count that will be set.

Response

An instance of a ContractResponse

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

unlockTokenForUser.send({ token, user, lockId }, options)

Unlock all tokens for a user on a given token contract.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).
useraddressThe address of the user.
lockIdnumberThe ID of the lock count that will be set.

Response

An instance of a ContractResponse which will eventually receive the following event data:

Event DataTypeDescription
tokenaddressThe address of the token contract that was unlocked.
useraddressThe address of the user that the tokens were unlocked for.
lockIdnumberThe ID of the lock that the was set for the user.
UserTokenUnlockedobjectContains the data defined in UserTokenUnlocked

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

withdraw.send({ token, amount }, options)

Withdraw tokens. This function only be called if the tokens that the user is attempting to withdraw are not locked.

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract (an empty address if Ether).
amountbig numberThe amount of tokens that will be deposited.

Response

An instance of a ContractResponse which will eventually receive the following event data:

Event DataTypeDescription
tokenaddressThe address of the token contract from which tokens were withdrawn.
useraddressThe address of the user that withdrew tokens.
amountbig numberThe amount of tokens that were withdrawn.
UserTokenWithdrawnobjectContains the data defined in UserTokenWithdrawn

Contract Information

Contract: TokenLocking.sol

Interface: ITokenLocking.sol

Events

events.TokenLocked.addListener(({ token, lockCount }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract that was locked.
lockCountbig numberThe address of the token contract that was assigned.

events.UserTokenDeposited.addListener(({ token, user, amount, timestamp }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract receiving the deposit.
useraddressThe address of the user that deposited tokens.
amountbig numberThe amount of tokens that were deposited.
timestampdateThe timestamp when the tokens were deposited.

events.UserTokenUnlocked.addListener(({ token, user, lockId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract that was unlocked.
useraddressThe address of the user that the tokens were unlocked for.
lockIdnumberThe ID of the lock that the was set for the user.

events.UserTokenWithdrawn.addListener(({ token, user, amount }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenaddressThe address of the token contract from which tokens were withdrawn.
useraddressThe address of the user that withdrew tokens.
amountbig numberThe amount of tokens that were withdrawn.