Secure the networkBug Bounty!November 2018

MetaColonyClient

The MetaColonyClient class is a standard interface for interactions with the on-chain functions and events described in IMetaColony.sol.

These interactions are generally concerned with functions and events internal to the Meta Colony, such as adding global skills.

For functions and events that concern the colonyNetwork as a whole, refer to the ColonyNetworkClient API.

Create an instance

The easiest way to initialize the MetaColonyClient is to ask the ColonyNetworkClient for a new instance:

const metaColonyClient = await networkClient.getMetaColonyClient();

You could create an instance of MetaColonyClient by providing an adapter and a query:

const metaColonyClient = new MetaColonyClient({ adapter, query });

await metaColonyClient.init();

Callers

All callers return promises which resolve to an object containing the given return values. For a reference please check here.

getAuthority.call()

Gets the colony's Authority contract address

Returns

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

Return valueTypeDescription
addressAddressThe colony's Authority contract address

getToken.call()

Gets the address of the colony's official token contract.

Returns

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

Return valueTypeDescription
addressAddressThe address of the colony's official deployed token contract

Senders

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

addGlobalSkill.send({ parentSkillId }, options)

Adds a global skill under a given parent SkillId. This can only be called from the Meta Colony, and only by the Meta Colony owners.

Arguments

ArgumentTypeDescription
parentSkillIdnumberInteger id of the parent skill.

Returns

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

Event dataTypeDescription
skillIdnumberA skillId for this domain.
parentSkillIdnumberThe parent skill id.
SkillAddedobjectContains the data defined in SkillAdded

mintTokensForColonyNetwork.send({ amount }, options)

In the case of the Colony Network, only the Meta Colony may mint new tokens.

Arguments

ArgumentTypeDescription
amountBigNumberAmount of new tokens to be minted.

Returns

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

Event dataTypeDescription
addressAddressThe address that initiated the mint event.
amountBigNumberEvent data indicating the amount of tokens minted.
MintobjectContains the data defined in Mint

setNetworkFeeInverse.send({ feeInverse }, options)

Set the Colony Network fee inverse amount. This can only be called from the Meta Colony, and only by the Meta Colony owners.

Arguments

ArgumentTypeDescription
feeInversenumberInteger id of the parent skill.

Returns

An instance of a ContractResponse

Events

Refer to the ContractEvent class here to interact with these events.

events.SkillAdded.addListener(({ skillId, parentSkillId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
skillIdnumberA skillId for this domain.
parentSkillIdnumberThe parent skill id.

events.Mint.addListener(({ address, amount }) => { /* ... */ })

Arguments

ArgumentTypeDescription
addressAddressThe address that initiated the mint event.
amountBigNumberEvent data indicating the amount of tokens minted.