Skip to main content

Class: ColonyToken

Hierarchy

Constructors

constructor

new ColonyToken(colonyNetwork, token)

Creates a new instance of a Colony deployed Token

Remarks

This does not deploy a new token, only connects to an exisiting one

Parameters

NameTypeDescription
colonyNetworkColonyNetworkA ColonyNetwork instance
tokenstring | MetaTxTokenA token address or a full contract (like on a colony token client)

Overrides

ERC20Token.constructor

Properties

address

address: string

Inherited from

ERC20Token.address

Methods

approve

approve(amount, spender?): TxCreator<TokenERC20, "approve", { guy?: string ; src?: string ; wad?: BigNumber }, MetadataType>

Approve amount of the wallet owners holdings of the specified token

In order for the wallet owner to stake tokens, that amount has to be approved and deposited into the Colony first. In the dapp the process is called "Activation" of a certain amount of the Colony's native token. The wallet must hold at least the amount of the token that will be approved.

Example

import { w } from '@colony/sdk';

// Immediately executing async function
(async function() {
// Approve 100 tokens to be "activated"
await colony.token.approve(w`100`).force();
// Deposit the tokens
await colonyNetwork.locking.deposit(token.address, w`100`).force();
})();

Parameters

NameTypeDescription
amountBigNumberishAmount of the token to be approved
spender?stringSpender to approve the amount for. Defaults to the Colony Network

Returns

TxCreator<TokenERC20, "approve", { guy?: string ; src?: string ; wad?: BigNumber }, MetadataType>

A transaction creator

Event data

PropertyTypeDescription
srcstringThe address that approved the tokens from their wallet
guystringAddress of the TokenLocking contract
wadBigNumberAmount that was approved

Inherited from

ERC20Token.approve


decimals

decimals(): Promise<number>

Gets the token's decimals

Returns

Promise<number>

The token's decimals (e.g. 18)

Inherited from

ERC20Token.decimals


name

name(): Promise<string>

Gets the token's name

Returns

Promise<string>

The token's name (e.g. Colony Network Token)

Inherited from

ERC20Token.name


setAuthority

setAuthority(tokenAuthorityAddress): MetaTxCreator<MetaTxToken, "setAuthority", { authority?: string }, MetadataType>

Sets the address of the TokenAuthority for this token

Set the TokenAuthority for this token. Only has to be done once, after the TokenAuthority has been deployed. See Colony.deployTokenAuthority for more information.

Remarks

Only works for native tokens deployed with Colony (not imported tokens).

Example

import { w } from '@colony/sdk';

// Immediately executing async function
(async function() {
// Deploy the TokenAuthority contract
// (forced transaction example)
const [{ tokenAuthorityAddress }] = await colony.deployTokenAuthority().tx();
// Set the TokenAuthority for this token
// (forced transaction example)
await colony.token.setAuthority(tokenAuthorityAddress).tx();
})();

Parameters

NameTypeDescription
tokenAuthorityAddressstringAddress of the TokenAuthority contract

Returns

MetaTxCreator<MetaTxToken, "setAuthority", { authority?: string }, MetadataType>

A transaction creator

Event data

PropertyTypeDescription
authoritystringThe address of the tokenAuthority that has been set

setOwner

setOwner(address): MetaTxCreator<MetaTxToken, "setOwner", { owner?: string }, MetadataType>

Sets the owner of the token

Set the owner address for this token. Should usually be the colony. This will allow the Colony to always affect certain token parameters, event without the TokenAuthority deployed or used

Remarks

Only works for native tokens deployed with Colony (not imported tokens).

Parameters

NameTypeDescription
addressstringAddress to set as the owner of the token (usually the colony)

Returns

MetaTxCreator<MetaTxToken, "setOwner", { owner?: string }, MetadataType>

A transaction creator

Event data

PropertyTypeDescription
ownerstringThe address of the owner that has been set

symbol

symbol(): Promise<string>

Gets the token's symbol

Returns

Promise<string>

The token's symbol (e.g. CLNY)

Inherited from

ERC20Token.symbol