Secure the networkBug Bounty 2019

ColonyNetworkClient

The ColonyNetworkClient is a standard interface for interactions with methods and events described in IColonyNetwork.sol. These interactions are generally concerned with the colony network as a whole. This includes operations like getting a count of all colonies on the network, querying for information about a skill, or registering an ENS label for a user.

See Clients for information about initializing ColonyNetworkClient.

Instance methods

All instance methods return promises.

getColonyAddress(id)

Get the address of a Colony for the specified id of a deployed colony contract.

Arguments

ArgumentTypeDescription
keystringName of the Colony to get
idnumberInteger number of the Colony

Response

Promise<Address>. The address of the given Colony contract

getColonyClient(id)

Returns an initialized ColonyClient for the specified id of a deployed colony contract.

Arguments

ArgumentTypeDescription
keystringName of the Colony to get
idnumberInteger number of the Colony

Response

Promise<ColonyClient>. An instance of a ColonyClient associated with the given Colony contract

getColonyClientByAddress(contractAddress)

Returns an initialized ColonyClient for the contract at address contractAddress

Arguments

ArgumentTypeDescription
contractAddressAdressAddress of a deployed Colony contract

Response

Promise<ColonyClient>. An instance of a ColonyClient associated with the given Colony contract

getMetaColonyClient()

Gets the Meta Colony as an initialized ColonyClient

Response

Promise<ColonyClient>. An instance of a ColonyClient associated with the MetaColony contract

Callers

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

ensSupportsInterface.call({ interfaceId })

Check whether or not ENS supports a contract interface. A supported contract interface implements interfaceId.

Arguments

ArgumentTypeDescription
interfaceIdhex stringThe hashed ID of the contract interface as specified in ERC-165.

Return Values

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

Return ValueTypeDescription
isSupportedbooleanA boolean indicating whether or not the contract interface is supported.

Contract Information

Function: supportsInterface

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

getAddressForENSHash.call({ nameHash })

Get the address of a registered ENS label. This function will return an empty address if an ENS label has not been registered.

Arguments

ArgumentTypeDescription
nameHashhex stringThe hached ENS label that will be checked.

Return Values

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

Return ValueTypeDescription
ensAddressaddressThe address associated with the ENS label.

Contract Information

Function: addr

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

getChildSkillId.call({ skillId, childSkillIndex })

Get the ID of a child skill.

Arguments

ArgumentTypeDescription
skillIdnumberThe numberic ID of the skill that will be checked.
childSkillIndexnumberThe index of the child skill array to be checked.

Return Values

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

Return ValueTypeDescription
childSkillIdnumberThe ID of the child skill.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getColony.call({ id })

Get the colony contract address for a colony.

Arguments

ArgumentTypeDescription
idnumberThe ID of the colony.

Return Values

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

Return ValueTypeDescription
addressaddressThe address of the colony contract.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getColonyCount.call()

Get the total number of colonies on the network. The return value is also the ID of the last colony created.

Return Values

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

Return ValueTypeDescription
countnumberThe total number of colonies.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getColonyVersionResolver.call({ version })

Get the address of the resolver contract for a specific colony version.

Arguments

ArgumentTypeDescription
versionnumberThe version number of the colony contract.

Return Values

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

Return ValueTypeDescription
addressaddressThe address of the resolver contract.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getCurrentColonyVersion.call()

Get the latest colony contract version. This is the version used to create all new colonies.

Return Values

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

Return ValueTypeDescription
versionnumberThe version number of the latest colony contract.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getFeeInverse.call()

Get the inverse amount of the network fee. If the fee is 1% (or 0.01), the inverse amount will be 100.

Return Values

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

Return ValueTypeDescription
feeInversebig numberThe inverse amount of the network fee.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getMetaColonyAddress.call()

Get the Meta Colony contract address.

Return Values

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

Return ValueTypeDescription
addressaddressThe address of the Meta Colony contract.

Contract Information

Function: getMetaColony

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getParentSkillId.call({ skillId, parentSkillIndex })

Get the ID of a parent skill.

Arguments

ArgumentTypeDescription
skillIdnumberThe numberic ID of the skill that will be checked.
parentSkillIndexnumberThe index of the parent skill array to be checked.

Return Values

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

Return ValueTypeDescription
parentSkillIdnumberThe ID of the parent skill.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getProfileDBAddress.call({ nameHash })

Get the address of the OrbitDB database associaated with a user profile.

Arguments

ArgumentTypeDescription
nameHashhex stringThe hashed ENS label that was registered for the user.

Return Values

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

Return ValueTypeDescription
orbitDBAddressstringThe path of the OrbitDB database associated with the user profile.

Contract Information

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

getRecoveryRolesCount.call()

Get the total number of users that are assigned a network recovery role.

Return Values

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

Return ValueTypeDescription
countnumberThe total number of users that are assigned a colony recovery role.

Contract Information

Function: numRecoveryRoles

Contract: ContractRecovery.sol

Interface: IRecovery.sol

getRootGlobalSkillId.call()

Get the ID of the root global skill.

Return Values

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

Return ValueTypeDescription
skillIdnumberThe ID of the root global skill.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getSkill.call({ skillId })

Get information about a domain.

Arguments

ArgumentTypeDescription
skillIdnumberThe ID of the skill.

Return Values

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

Return ValueTypeDescription
nParentsnumberThe total number of parent skills.
nChildrennumberThe total number of child skills.
isGlobalSkillbooleanA boolean indicating whether or not the skill is a global skill.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getSkillCount.call()

Get the total number of global and local skills in the network.

Return Values

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

Return ValueTypeDescription
countnumberThe total number of global and local skills in the network.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

getTokenLocking.call()

Get the token locking contract address.

Return Values

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

Return ValueTypeDescription
lockingAddressaddressThe address of the token locking contract.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

isColony.call({ colony })

Check whether or not an address is a colony contract.

Arguments

ArgumentTypeDescription
colonyaddressThe address that will be checked.

Return Values

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

Return ValueTypeDescription
isColonybooleanA boolean indicating whether or not an address is a colony contract.

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

isInRecoveryMode.call()

Check whether or not the network is in recovery mode.

Return Values

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

Return ValueTypeDescription
inRecoveryModebooleanA boolean indicating whether or not the network is in recovery mode.

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

lookupRegisteredENSDomain.call({ ensAddress })

Lookup the registed ENS label for an address. This function will return an empty string if the address does not have a registered ENS label.

Arguments

ArgumentTypeDescription
ensAddressaddressThe address that will checked.

Return Values

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

Return ValueTypeDescription
domainstringThe ENS label associated with the address.

Contract Information

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

Senders

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

addColonyVersion.send({ version, resolver }, options)

Add a new colony contract version and set the address of the resolver contract.

Arguments

ArgumentTypeDescription
versionnumberThe versions number of the colony contract.
resolveraddressThe address of the resolver contract.

Response

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

Event DataTypeDescription
versionnumberThe version number of the colony contract that was added.
resolveraddressThe address of the resolver contract.
ColonyVersionAddedobjectContains the data defined in ColonyVersionAdded

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

addSkill.send({ parentSkillId, globalSkill }, options)

Add a new global or local skill to the skills tree.

Arguments

ArgumentTypeDescription
parentSkillIdnumberThe ID of the skill under which the new skill will be added.
globalSkillbooleanA boolean indicating whether or not the skill will be a global skill.

Response

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

Event DataTypeDescription
skillIdnumberThe ID of the skill that was added.
parentSkillIdnumberThe ID of the parent skill.
SkillAddedobjectContains the data defined in SkillAdded

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

approveExitRecovery.send(options)

Indicate approval to exit network recovery mode. This function can only be called by a user with a recovery role.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

createColony.send({ tokenAddress }, options)

Create a new colony on the network.

Arguments

ArgumentTypeDescription
tokenAddressaddressThe address of the token contract.

Response

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

Event DataTypeDescription
colonyIdnumberThe ID of the colony that was added.
colonyAddressaddressThe address of the colony contract that was created.
tokenAddressaddressThe address of the token contract that was assigned.
ColonyAddedobjectContains the data defined in ColonyAdded

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

createMetaColony.send({ tokenAddress }, options)

Create the Meta Colony.

Arguments

ArgumentTypeDescription
tokenAddressaddressThe address of the token contract.

Response

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

Event DataTypeDescription
colonyAddressnumberThe address of the Meta Colony.
tokenAddressaddressThe address of the CLNY token contract.
rootSkillIdnumberThe ID of the root skill.
MetaColonyCreatedobjectContains the data defined in MetaColonyCreated

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

createToken.send({ symbol }, options)

Create a new ERC20 token contract.

Arguments

ArgumentTypeDescription
symbolstringThe symbol of the token.

Response

An instance of a ContractResponse which will receive a receipt with a contractAddress property (the address of the newly-deployed contract)

Contract Information

Contract: Token.sol

enterRecoveryMode.send(options)

Enter network recovery mode. This function can only be called by a user with a recovery role.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

exitRecoveryMode.send(options)

Exit network recovery mode. This function can be called by anyone if enough whitelist approvals are given.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

registerUserLabel.send({ username, orbitDBPath }, options)

Register an ENS label for a user.

Arguments

ArgumentTypeDescription
usernamestringThe ENS label that will be registered for the user.
orbitDBPathstringThe path of the OrbitDB database associated with the user profile.

Response

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

Event DataTypeDescription
useraddressThe address of the user that registered a label.
labelstringThe ENS label that was registered for the user.
UserLabelRegisteredobjectContains the data defined in UserLabelRegistered

Contract Information

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

removeRecoveryRole.send({ user }, options)

Remove the network recovery role from a user. This function can only be called by the FOUNDER authority role.

Arguments

ArgumentTypeDescription
useraddressThe address of the user that will be unassigned a network recovery role.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

setFeeInverse.send({ feeInverse }, options)

Set the inverse amount of the network fee. If the fee is 1% (or 0.01), the inverse amount will be 100.

Arguments

ArgumentTypeDescription
feeInversebig numberThe inverse amount of the network fee.

Response

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

Event DataTypeDescription
feeInversebig numberThe inverse value of the network fee that was set.
NetworkFeeInverseSetobjectContains the data defined in NetworkFeeInverseSet

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

setRecoveryRole.send({ user }, options)

Assign a network recovery role to a user. This function can only be called by the FOUNDER authority role.

Arguments

ArgumentTypeDescription
useraddressThe address of the user that will be assigned a network recovery role.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

setStorageSlotRecovery.send({ slot, value }, options)

Set the value for a storage slot while in recovery mode. This can only be called by a user with a recovery role.

Arguments

ArgumentTypeDescription
slotnumberThe ID of the storage slot that will be modified.
valuehex stringThe hex string of data that will be set as the value.

Response

An instance of a ContractResponse

Contract Information

Contract: ContractRecovery.sol

Interface: IRecovery.sol

setTokenLocking.send({ tokenLockingAddress }, options)

Set the token locking address.

Arguments

ArgumentTypeDescription
tokenLockingAddressaddressThe address of the locking contract.

Response

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

Event DataTypeDescription
tokenLockingaddressThe address of the token locking contract.
TokenLockingAddressSetobjectContains the data defined in TokenLockingAddressSet

Contract Information

Contract: ColonyNetwork.sol

Interface: IColonyNetwork.sol

setupRegistrar.send({ ens, rootNode }, options)

Set up the registrar.

Arguments

ArgumentTypeDescription
ensaddressThe adddress of the ENS registrar.
rootNodestringThe namehash of the root node for the domain.

Response

An instance of a ContractResponse

Contract Information

Contract: ColonyNetworkENS.sol

Interface: IColonyNetwork.sol

startTokenAuction.send({ tokenAddress }, options)

Create and start an auction for a token owned by the Colony Network. The auction will be for the total amount of the specificed tokens that are owned by the Colony Network.

Arguments

ArgumentTypeDescription
tokenAddressaddressThe address of the token contract.

Response

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

Event DataTypeDescription
auctionstringThe address of the auction contract that was created.
tokenaddressThe address of the token contract that was assigned.
quantitybig numberThe amount of tokens available for the auction.
AuctionCreatedobjectContains the data defined in AuctionCreated

Contract Information

Contract: ColonyNetworkAuction.sol

Interface: IColonyNetwork.sol

Events

events.AuctionCreated.addListener(({ auction, token, quantity }) => { /* ... */ })

Arguments

ArgumentTypeDescription
auctionstringThe address of the auction contract that was created.
tokenaddressThe address of the token contract that was assigned.
quantitybig numberThe amount of tokens available for the auction.

events.ColonyAdded.addListener(({ colonyId, colonyAddress, tokenAddress }) => { /* ... */ })

Arguments

ArgumentTypeDescription
colonyIdnumberThe ID of the colony that was added.
colonyAddressaddressThe address of the colony contract that was created.
tokenAddressaddressThe address of the token contract that was assigned.

events.ColonyLabelRegistered.addListener(({ colony, label }) => { /* ... */ })

Arguments

ArgumentTypeDescription
colonyaddressThe address of the colony that registered a label.
labelstringThe ENS label that was registered for the colony.

events.ColonyNetworkInitialised.addListener(({ resolver }) => { /* ... */ })

Arguments

ArgumentTypeDescription
resolveraddressThe address of the resolver contract.

events.ColonyVersionAdded.addListener(({ version, resolver }) => { /* ... */ })

Arguments

ArgumentTypeDescription
versionnumberThe version number of the colony contract that was added.
resolveraddressThe address of the resolver contract.

events.MetaColonyCreated.addListener(({ colonyAddress, tokenAddress, rootSkillId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
colonyAddressnumberThe address of the Meta Colony.
tokenAddressaddressThe address of the CLNY token contract.
rootSkillIdnumberThe ID of the root skill.

events.MiningCycleResolverSet.addListener(({ miningCycleResolver }) => { /* ... */ })

Arguments

ArgumentTypeDescription
miningCycleResolveraddressThe address of the resolver contract for the reputation mining cycle contract.

events.NetworkFeeInverseSet.addListener(({ feeInverse }) => { /* ... */ })

Arguments

ArgumentTypeDescription
feeInversebig numberThe inverse value of the network fee that was set.

events.ReputationMiningCycleComplete.addListener(({ hash, nNodes }) => { /* ... */ })

Arguments

ArgumentTypeDescription
hashhex stringThe root hash of the reputation state that was accepted.
nNodesnumberThe total number of nodes in the reputation state.

events.ReputationMiningInitialised.addListener(({ inactiveReputationMiningCycle }) => { /* ... */ })

Arguments

ArgumentTypeDescription
inactiveReputationMiningCycleaddressThe address of the reputation mining cycle that was initialized.

events.ReputationRootHashSet.addListener(({ newHash, newNNodes, stakers, reward }) => { /* ... */ })

Arguments

ArgumentTypeDescription
newHashhex stringThe reputation root hash that was set.
newNNodesnumberThe total number of nodes in the reputation state.
stakersarrayThe array of users who submitted or backed the accepted hash.
rewardarrayThe array of corresponding amounts of CLNY each user received.

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

Arguments

ArgumentTypeDescription
skillIdnumberThe ID of the skill that was added.
parentSkillIdnumberThe ID of the parent skill.

events.TokenLockingAddressSet.addListener(({ tokenLocking }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenLockingaddressThe address of the token locking contract.

events.UserLabelRegistered.addListener(({ user, label }) => { /* ... */ })

Arguments

ArgumentTypeDescription
useraddressThe address of the user that registered a label.
labelstringThe ENS label that was registered for the user.