Secure the networkBug Bounty!November 2018

ColonyClient

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

These interactions are generally concerned with functions and events internal to a colony, such as creating a task, assigning a work rating, or moving funds between pots.

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 ColonyClient is to ask the ColonyNetworkClient for a new instance:

const colonyClient = await networkClient.getColonyClient(colonyId);

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

const colonyClient = new ColonyClient({ adapter, query });

await colonyClient.init();

Callers

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

getRecoveryRolesCount.call()

Returns the number of recovery roles.

Returns

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

Return valueTypeDescription
countnumberNumber of users with the recovery role (excluding founder)

isInRecoveryMode.call()

Is the colony in recovery mode?

Returns

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

Return valueTypeDescription
inRecoveryModebooleanReturn true if recovery mode is active, false otherwise

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

hasUserRole.call({ user, role })

For the given user's address and role, return true if the user has that role.

Arguments

ArgumentTypeDescription
userAddressThe user in question.
roleAuthority RoleThat user's role ( FOUNDER or ADMIN ).

Returns

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

Return valueTypeDescription
hasRolebooleanWhether the user has the given role

getVersion.call()

Gets the Colony contract version. This starts from 1 and is incremented with every deployed contract change.

Returns

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

Return valueTypeDescription
versionnumberThe version number.

generateSecret.call({ salt, value })

Helper function used to generate the rating secret used in task ratings. Accepts a salt value and a value to hide, and returns the keccak256 hash of both.

Arguments

ArgumentTypeDescription
saltstringSalt value.
valuenumberValue to hide (typically a rating of 1-3).

Returns

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

Return valueTypeDescription
secretHex stringkeccak256 hash of joint Salt and Value.

getDomain.call({ domainId })

Gets the selected domain's local skill ID and funding pot ID.

Arguments

ArgumentTypeDescription
domainIdnumberID of the domain.

Returns

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

Return valueTypeDescription
localSkillIdnumberThe domain's local skill ID.
potIdnumberThe domain's funding pot ID.

getDomainCount.call()

Gets the total number of domains in a Colony. This number equals the last domainId created.

Returns

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

Return valueTypeDescription
countnumberNumber of all domain in this Colony; == the last added domainId.

getGlobalRewardPayoutCount.call()

Gets the total number of reward payout cycles.

Returns

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

Return valueTypeDescription
countnumberNumber of reward payout cycles.

getUserRewardPayoutCount.call({ user })

Gets the number of claimed and waived reward payouts for a given user.

Arguments

ArgumentTypeDescription
userAddressAddress of user.

Returns

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

Return valueTypeDescription
countnumberNumber of claimed and waived reward payouts.

getTaskCount.call()

Gets the total number of tasks in a Colony. This number equals the last taskId created.

Returns

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

Return valueTypeDescription
countnumberTotal number of tasks in this Colony.

getTask.call({ taskId })

Gets a certain task defined by its integer taskId.

Arguments

ArgumentTypeDescription
taskIdnumber

Returns

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

Return valueTypeDescription
completionDateDate (optional)Date when the task was completed.
deliverableHashIPFS hash (optional)Unique hash of the deliverable content.
domainIdnumberInteger Domain ID the task belongs to.
dueDateDate (optional)When the task is due.
idnumberInteger task ID.
payoutsWeCannotMakenumber (optional)Number of payouts that cannot be completed with the current task funding.
potIdnumber (optional)Integer ID of funding pot for the task.
skillIdnumberInteger Skill ID the task is assigned to.
specificationHashIPFS hashUnique hash of the specification content.
statusundefinedThe task status (ACTIVE, CANCELLED or FINALIZED).

getTaskPayout.call({ taskId, role, token })

Given a specific task, a defined role for the task, and a token address, will return any payout attached to the task in the token specified.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleRole the payout is specified for: MANAGER, EVALUATOR, or WORKER.
tokenToken addressAddress of the token's contract. 0x0 value indicates Ether.

Returns

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

Return valueTypeDescription
amountBigNumberAmount of specified tokens to payout for that task and a role.

getTotalTaskPayout.call({ taskId, token })

Given a specific task, and a token address, will return any payout attached to the task in the token specified (for all roles).

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
tokenToken addressAddress of the token's contract. 0x0 value indicates Ether.

Returns

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

Return valueTypeDescription
amountBigNumberAmount of specified tokens to payout for that task.

getTaskRole.call({ taskId, role })

Every task has three roles associated with it which determine permissions for editing the task, submitting work, and ratings for performance.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleMANAGER, EVALUATOR, or WORKER.

Returns

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

Return valueTypeDescription
addressAddressAddress of the user for the given role.
rateFailbooleanWhether the user failed to rate their counterpart.
ratingnumberRating the user received (1-3).

getTaskWorkRatings.call({ taskId })

For a given task, will return the number of submitted ratings and the date of their submission.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

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

Return valueTypeDescription
countnumberTotal number of submitted ratings for a task.
dateDateDate of the last submitted rating.

getTaskWorkRatingSecret.call({ taskId, role })

If ratings for a task are still in the commit period, their ratings will still be hidden, but the hashed value can still be returned.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleRole that submitted the rating: MANAGER, EVALUATOR, or WORKER.

Returns

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

Return valueTypeDescription
secretHex stringthe hashed rating (equivalent to the output of keccak256(_salt, _rating) ).

getPotBalance.call({ potId, token })

Gets a balance for a certain token in a specific pot.

Arguments

ArgumentTypeDescription
potIdnumberInteger potId.
tokenToken addressAddress to get funds from, such as the token contract address, or empty address ( 0x0 for Ether)

Returns

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

Return valueTypeDescription
balanceBigNumberBalance for token token in pot potId .

getNonRewardPotsTotal.call({ token })

The nonRewardPotsTotal is a value that keeps track of the total assets a colony has to work with, which may be split among several distinct pots associated with various domains and tasks.

Arguments

ArgumentTypeDescription
tokenToken addressAddress of the token's contract. 0x0 value indicates Ether.

Returns

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

Return valueTypeDescription
totalBigNumberAll tokens that are not within the colony's rewards pot.

getRewardPayoutInfo.call({ payoutId })

Given a specific payout, returns useful information about the payout.

Arguments

ArgumentTypeDescription
payoutIdnumberId of the reward payout.

Returns

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

Return valueTypeDescription
blockNumbernumberBlock number at the time of creation.
remainingTokenAmountBigNumberRemaining (unclaimed) amount of tokens.
reputationRootHashstringReputation root hash at the time of creation.
tokenToken addressToken address ( 0x0 value indicates Ether).
totalTokenAmountForRewardPayoutBigNumberTotal amount of tokens taken aside for reward payout.
totalTokensBigNumberTotal colony tokens at the time of creation.

getRewardInverse.call()

Return 1 / the reward to pay out from revenue. e.g. if the fee is 1% (or 0.01), return 100

Returns

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

Return valueTypeDescription
rewardInverseBigNumberThe inverse of the reward

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

getTransactionCount.call()

Returns the total number of transactions the colony has made, == the transactionId of the last added transaction to the Colony.

Returns

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

Return valueTypeDescription
countnumberNumber of all transactions in this Colony; == the last added transactionId.

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.

approveExitRecovery.send(options)

Indicate approval to exit recovery mode. Can only be called by user with recovery role.

Returns

An instance of a ContractResponse

enterRecoveryMode.send(options)

Put the colony into recovery mode. Can only be called by user with a recovery role.

Returns

An instance of a ContractResponse

exitRecoveryMode.send({ newVersion }, options)

Exit recovery mode. Can be called by anyone if enough whitelist approvals are given.

Arguments

ArgumentTypeDescription
newVersionnumberResolver version to upgrade to (>= current version)

Returns

An instance of a ContractResponse

setRecoveryRole.send({ user }, options)

Set new colony recovery role. Can only be called by the founder role.

Arguments

ArgumentTypeDescription
userAddressThe user we want to give a recovery role to.

Returns

An instance of a ContractResponse

setRewardInverse.send({ rewardInverse }, options)

Set the reward inverse to pay out from revenue. e.g. if the fee is 1% (or 0.01), set 100

Arguments

ArgumentTypeDescription
rewardInverseBigNumberThe inverse of the reward

Returns

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

Event dataTypeDescription
rewardInverseBigNumberThe reward inverse value
ColonyRewardInverseSetobjectContains the data defined in ColonyRewardInverseSet

removeRecoveryRole.send({ user }, options)

Remove colony recovery role. Can only be called by the founder role.

Arguments

ArgumentTypeDescription
userAddressThe user we want to remove the recovery role from.

Returns

An instance of a ContractResponse

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

Update the value of an arbitrary storage variable. This can only be called by a user with the recovery role. Certain critical variables are protected from editing in this function.

Arguments

ArgumentTypeDescription
slotnumberAddress of storage slot to be updated.
valueHex stringWord of data to be set.

Returns

An instance of a ContractResponse

createTask.send({ specificationHash, domainId, skillId, dueDate }, options)

Creates a new task by invoking makeTask on-chain.

Arguments

ArgumentTypeDescription
specificationHashIPFS hashHashed output of the task's work specification, stored so that it can later be referenced for task ratings or in the event of a dispute.
domainIdnumberDomain in which the task has been created (default value: 1 ).
skillIdnumberThe skill associated with the task (optional)
dueDateDateThe due date of the task (optional)

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
potIdnumberThe ID of the funding pot that was added.
domainIdnumberThe ID of the domain that was added.
TaskAddedobjectContains the data defined in TaskAdded
PotAddedobjectContains the data defined in PotAdded
DomainAddedobjectContains the data defined in DomainAdded

completeTask.send({ taskId }, options)

Mark a task as complete after the due date has passed. This allows the task to be rated and finalized (and funds recovered) even in the presence of a worker who has disappeared. Note that if the due date was not set, then this function will throw.

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
TaskCompletedobjectContains the data defined in TaskCompleted

registerColonyLabel.send({ colonyName, orbitDBPath }, options)

Register the colony's ENS label.

Arguments

ArgumentTypeDescription
colonyNamestringThe label to register
orbitDBPathstringThe path of the orbitDB database associated with the colony name

Returns

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

Event dataTypeDescription
colonyAddressAddress of the colony that registered a label
labelstringThe label registered
ColonyLabelRegisteredobjectContains the data defined in ColonyLabelRegistered

setFounderRole.send({ user }, options)

Set a new colony founder role. There can only be one address assigned to the founder role at a time. Whoever calls this function will lose their founder role. Can be called by founder role.

Arguments

ArgumentTypeDescription
userAddressUser we want to give a founder role to

Returns

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

Event dataTypeDescription
oldFounderAddressThe current founder delegating the role away
newFounderAddressThe user receiving the colony founder role
ColonyFounderRoleSetobjectContains the data defined in ColonyFounderRoleSet

setAdminRole.send({ user }, options)

Set a new colony admin role. Can be called by a founder or admin role.

Arguments

ArgumentTypeDescription
userAddressUser we want to give an admin role to

Returns

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

Event dataTypeDescription
userAddressThe newly-added colony admin user
ColonyAdminRoleSetobjectContains the data defined in ColonyAdminRoleSet

setRecoveryRole.send({ user }, options)

Set a new colony recovery role. Can be called by the founder role.

Arguments

ArgumentTypeDescription
userAddressUser we want to give a recovery role to

Returns

An instance of a ContractResponse

removeAdminRole.send({ user }, options)

Remove a colony admin role. Can only be called by the founder role.

Arguments

ArgumentTypeDescription
userAddressUser we want to remove an admin role from

Returns

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

Event dataTypeDescription
userAddressThe removed colony admin user
ColonyAdminRoleRemovedobjectContains the data defined in ColonyAdminRoleRemoved

setAllTaskPayouts.send({ taskId, token, managerAmount, evaluatorAmount, workerAmount }, options)

Set the payouts for the task manager, evaluator and worker in one transaction, for a specific token address. This can only be called by the task manager, and only if the evaluator and worker roles are either unassigned or the same as the manager.

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
tokenAddressAddress of the token, 0x0 value indicates Ether.
managerAmountBigNumberPayout amount for the manager.
evaluatorAmountBigNumberPayout amount for the evaluator.
workerAmountBigNumberPayout amount for the worker.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
roleRoleThe role the payout is for
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.
TaskPayoutSetobjectContains the data defined in TaskPayoutSet

submitTaskDeliverable.send({ taskId, deliverableHash }, options)

Submit the task deliverable, i.e. the output of the work performed for task _id Submission is allowed only to the assigned worker before the task due date. Submissions cannot be overwritten.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
deliverableHashIPFS hashIPFS hash of the work performed.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
taskIdnumberThe task ID.
deliverableHashIPFS hashThe IPFS hash of the deliverable.
TaskCompletedobjectContains the data defined in TaskCompleted
TaskDeliverableSubmittedobjectContains the data defined in TaskDeliverableSubmitted

submitTaskWorkRating.send({ taskId, role, secret }, options)

Submits a hidden work rating for a task. This is generated by generateSecret(_salt, _rating).

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleRole that receives rating, either MANAGER or WORKER.
secretHex stringhidden work rating, generated as the output of generateSecret(_salt, _rating) , where _rating is a score from 1-3.

Returns

An instance of a ContractResponse

submitTaskDeliverableAndRating.send({ taskId, deliverableHash, secret }, options)

Submit the task deliverable for the worker and the rating for the manager.

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
deliverableHashIPFS hashIPFS hash of the work performed.
secretHex stringhidden work rating, generated as the output of generateSecret(_salt, _rating) , where _rating is a score from 1-3.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
taskIdnumberThe task ID.
deliverableHashIPFS hashThe IPFS hash of the deliverable.
TaskCompletedobjectContains the data defined in TaskCompleted
TaskDeliverableSubmittedobjectContains the data defined in TaskDeliverableSubmitted

revealTaskWorkRating.send({ taskId, role, rating, salt }, options)

Reveals a previously submitted work rating, by proving that the _rating and _salt values result in the same secret submitted during the rating submission period. This is checked on-chain using the generateSecret function.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleRole whose rating submission gets revealed, either MANAGER or WORKER.
ratingnumberRating scored (1-3).
saltstring_salt value to be used in generateSecret . A correct value will result in the same secret submitted during the work rating submission period.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID.
roleRoleThe role of the work rating.
ratingnumberThe rating value.
TaskWorkRatingRevealedobjectContains the data defined in TaskWorkRatingRevealed

assignWorkRating.send({ taskId }, options)

In the event of a user not committing or revealing within the 10 day rating window, their rating of their counterpart is assumed to be the highest possible and they will receive a reputation penalty.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

An instance of a ContractResponse

finalizeTask.send({ taskId }, options)

Finalizes a task, allowing roles to claim payouts and prohibiting all further changes to the task.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID of the task that was finalized.
TaskFinalizedobjectContains the data defined in TaskFinalized

claimPayout.send({ taskId, role, token }, options)

Claims the payout for token denomination for work completed in task taskId by contributor with role role. Allowed only by the contributors themselves after task is finalized. Here the network receives its fee from each payout. Ether fees go straight to the Meta Colony whereas Token fees go to the Network to be auctioned off.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
roleRoleRole of the contributor claiming the payout: MANAGER, EVALUATOR, or WORKER
tokenToken addressAddress to claim funds from, e.g. the token's contract address, or empty address ( 0x0 for Ether)

Returns

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

Event dataTypeDescription
taskIdnumberThe task ID of the task that was finalized.
roleRoleThe role of the work rating.
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.
fromAddressEvent data indicating the 'from' address.
toAddressEvent data indicating the 'to' address.
valueBigNumberEvent data indicating the amount transferred.
TaskPayoutClaimedobjectContains the data defined in TaskPayoutClaimed
TransferobjectContains the data defined in Transfer

addDomain.send({ parentDomainId }, options)

Adds a domain to the colony. Adding new domains is currently retricted to one level, i.e. parentDomainId has to be the id of the root domain (parentDomainId: 1).

Arguments

ArgumentTypeDescription
parentDomainIdnumberId of the domain under which the new domain will be added.

Returns

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

Event dataTypeDescription
domainIdnumberThe ID of the domain that was added.
DomainAddedobjectContains the data defined in DomainAdded

claimColonyFunds.send({ token }, options)

Move any funds received by the colony for token denomination to the top-levl domain pot, siphoning off a small amount to the rewards pot. No fee is taken if called against a colony's own token.

Arguments

ArgumentTypeDescription
tokenToken addressAddress to claim funds from; empty address ( 0x0 for Ether)

Returns

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

Event dataTypeDescription
tokenAddressThe token address being claimed
feeBigNumberThe fee deducted for rewards
payoutRemainderBigNumberThe remaining funds moved to the top-level domain pot
ColonyFundsClaimedobjectContains the data defined in ColonyFundsClaimed

finalizeRewardPayout.send({ payoutId }, options)

Finalises the reward payout and allows creation of next reward payout for token that has been used in payoutId. Can only be called when reward payout cycle is finished, i.e. 60 days from its creation.

Arguments

ArgumentTypeDescription
payoutIdnumberId of the reward payout.

Returns

An instance of a ContractResponse

moveFundsBetweenPots.send({ fromPot, toPot, amount, token }, options)

Move a given amount of token funds from one pot to another.

Arguments

ArgumentTypeDescription
fromPotnumberOrigin pot Id.
toPotnumberDestination pot Id.
amountBigNumberAmount of funds to move.
tokenToken addressAddress of the token contract ( 0x0 value indicates Ether).

Returns

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

Event dataTypeDescription
fromPotnumberThe source funding pot
toPotnumberThe target funding pot
amountBigNumberThe amount that was transferred
tokenAddressThe token address being transferred
ColonyFundsMovedBetweenFundingPotsobjectContains the data defined in ColonyFundsMovedBetweenFundingPots

mintTokens.send({ amount }, options)

The founder of a 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.
fromAddressEvent data indicating the 'from' address.
toAddressEvent data indicating the 'to' address.
valueBigNumberEvent data indicating the amount transferred.
MintobjectContains the data defined in Mint
TransferobjectContains the data defined in Transfer

startNextRewardPayout.send({ token }, options)

Start the next reward payout for token. All funds in the reward pot for token will become unavailable. All tokens will be locked, and can be unlocked by calling waiveRewardPayout or claimRewardPayout.

Arguments

ArgumentTypeDescription
tokenToken addressAddress of token used for reward payout ( 0x0 value indicates Ether).

Returns

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

Event dataTypeDescription
payoutIdnumberThe reward payout cycle ID logged when a new reward payout cycle has started.
RewardPayoutCycleStartedobjectContains the data defined in RewardPayoutCycleStarted

waiveRewardPayouts.send({ numPayouts }, options)

Waive reward payout. This unlocks the sender's tokens and increments the users reward payout counter, allowing them to claim the next reward payout.

Arguments

ArgumentTypeDescription
numPayoutsnumberNumber of payouts to waive.

Returns

An instance of a ContractResponse

setToken.send({ token }, options)

Set the colony token. Secured function to authorised members. Note that if the mint functionality is to be controlled through the colony, control has to be transferred to the colony after this call.

Arguments

ArgumentTypeDescription
tokenAddressAddress of the token contract to use.

Returns

An instance of a ContractResponse

upgrade.send({ newVersion }, options)

Upgrades the colony to a new Colony contract version. Downgrades are not allowed (i.e. newVersion should be higher than the currect colony version).

Arguments

ArgumentTypeDescription
newVersionnumber

Returns

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

Event dataTypeDescription
oldVersionnumberThe previous colony version
newVersionnumberThe new colony version
ColonyUpgradedobjectContains the data defined in ColonyUpgraded

Task MultiSig

All MultiSig functions return an instance of a MultiSigOperation. For a reference please check here.

setTaskBrief.startOperation({ taskId, specificationHash })

The task brief, or specification, is a description of the tasks work specification. The description is hashed and stored with the task for future reference in ratings or in the event of a dispute.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
specificationHashIPFS hashdigest of the task's hashed specification.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
specificationHashstringThe IPFS hash of the task's new specification.
TaskBriefSetobjectContains the data defined in TaskBriefSet

setTaskDomain.startOperation({ taskId, domainId })

Every task must belong to a single existing Domain. This can only be called by the manager of the task.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
domainIdnumberInteger domainId.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
domainIdnumberThe task's new domain ID.
TaskDomainSetobjectContains the data defined in TaskDomainSet

setTaskDueDate.startOperation({ taskId, dueDate })

The task's due date determines when a worker may submit the task's deliverable(s).

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
dueDateDateDue date.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
dueDateDateThe task's new due date.
TaskDueDateSetobjectContains the data defined in TaskDueDateSet

setTaskManagerRole.startOperation({ taskId, user })

Set the manager role for the address user in task taskId. Only allowed before the task is finalized, meaning that the value cannot be changed after the task is complete. The current manager and the user we want to assign this role to both need to sign this transaction.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
userAddressaddress of the user.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.
TaskRoleUserSetobjectContains the data defined in TaskRoleUserSet

setTaskWorkerRole.startOperation({ taskId, user })

Set the worker role for the address user in task taskId. Only allowed before the task is finalized, meaning that the value cannot be changed after the task is complete. The current worker and the user we want to assign this role to both need to sign this transaction.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
userAddressaddress of the user.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.
TaskRoleUserSetobjectContains the data defined in TaskRoleUserSet

setTaskEvaluatorRole.startOperation({ taskId, user })

Set the evaluator role for the address user in task taskId. Only allowed before the task is finalized, meaning that the value cannot be changed after the task is complete. The current evaluator and the user we want to assign this role to both need to sign this transaction.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
userAddressaddress of the user.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.
TaskRoleUserSetobjectContains the data defined in TaskRoleUserSet

setTaskSkill.startOperation({ taskId, skillId })

Sets the skill tag associated with the task. Currently there is only one skill tag available per task, but additional skills for tasks are planned in future implementations. This can only be called by the manager and worker of the task.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
skillIdnumberInteger skillId.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
skillIdnumberThe task's new skill ID.
TaskSkillSetobjectContains the data defined in TaskSkillSet

setTaskEvaluatorPayout.startOperation({ taskId, token, amount })

Sets the payout given to the EVALUATOR role when the task is finalized.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
tokenToken addressAddress to send funds from, e.g. the token's contract address, or empty address ( 0x0 for Ether)
amountBigNumberAmount to be paid.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
roleRoleThe role the payout is for
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.
TaskPayoutSetobjectContains the data defined in TaskPayoutSet

setTaskManagerPayout.startOperation({ taskId, token, amount })

Sets the payout given to the MANAGER role when the task is finalized. This MultisigSender only requires one signature (from the manager).

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
tokenToken addressAddress to send funds from, e.g. the token's contract address, or empty address ( 0x0 for Ether)
amountBigNumberAmount to be paid.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
roleRoleThe role the payout is for
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.
TaskPayoutSetobjectContains the data defined in TaskPayoutSet

setTaskWorkerPayout.startOperation({ taskId, token, amount })

Sets the payout given to the WORKER role when the task is finalized.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.
tokenToken addressAddress to send funds from, e.g. the token's contract address, or empty address ( 0x0 for Ether)
amountBigNumberAmount to be paid.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
roleRoleThe role the payout is for
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.
TaskPayoutSetobjectContains the data defined in TaskPayoutSet

removeTaskWorkerRole.startOperation({ taskId })

Removes the worker role for the given task. Only allowed before the task is complete. Must be signed by the current worker and the manager.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.
TaskRoleUserSetobjectContains the data defined in TaskRoleUserSet

removeTaskEvaluatorRole.startOperation({ taskId })

Removes the worker role for the given task. Only allowed before the task is complete. Must be signed by the current evaluator and the manager.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.
TaskRoleUserSetobjectContains the data defined in TaskRoleUserSet

cancelTask.startOperation({ taskId })

Cancels a task.

Arguments

ArgumentTypeDescription
taskIdnumberInteger taskId.

Returns

An instance of a MultiSigOperation whose sender will eventually receive the following event data:

Event DataTypeDescription
taskIdnumberThe task ID of the task that was canceled.
TaskCanceledobjectContains the data defined in TaskCanceled

Events

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

events.DomainAdded.addListener(({ domainId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
domainIdnumberThe ID of the domain that was added.

events.PotAdded.addListener(({ potId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
potIdnumberThe ID of the funding pot that was added.

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

Arguments

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

events.TaskAdded.addListener(({ taskId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.

events.TaskBriefSet.addListener(({ taskId, specificationHash }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
specificationHashstringThe IPFS hash of the task's new specification.

events.TaskCompleted.addListener(({ taskId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.

events.TaskDueDateSet.addListener(({ taskId, dueDate }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
dueDateDateThe task's new due date.

events.TaskDomainSet.addListener(({ taskId, domainId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
domainIdnumberThe task's new domain ID.

events.TaskSkillSet.addListener(({ taskId, skillId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
skillIdnumberThe task's new skill ID.

events.TaskRoleUserSet.addListener(({ taskId, role, user }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
rolenumberThe role that changed for the task.
userAddressThe user with the role that changed for the task.

events.TaskPayoutSet.addListener(({ taskId, role, token, amount }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
roleRoleThe role the payout is for
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.

events.TaskDeliverableSubmitted.addListener(({ taskId, deliverableHash }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
deliverableHashIPFS hashThe IPFS hash of the deliverable.

events.TaskWorkRatingRevealed.addListener(({ taskId, role, rating }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID.
roleRoleThe role of the work rating.
ratingnumberThe rating value.

events.TaskFinalized.addListener(({ taskId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID of the task that was finalized.

events.TaskPayoutClaimed.addListener(({ taskId, role, token, amount }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID of the task that was finalized.
roleRoleThe role of the work rating.
tokenToken addressThe token address (0x indicates ether).
amountnumberThe token amount.

events.TaskCanceled.addListener(({ taskId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
taskIdnumberThe task ID of the task that was canceled.

events.RewardPayoutCycleStarted.addListener(({ payoutId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
payoutIdnumberThe reward payout cycle ID logged when a new reward payout cycle has started.

events.RewardPayoutCycleEnded.addListener(({ payoutId }) => { /* ... */ })

Arguments

ArgumentTypeDescription
payoutIdnumberThe reward payout cycle ID logged when a reward payout cycle has ended.

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

Arguments

ArgumentTypeDescription
colonyAddressAddress of the colony that registered a label
labelstringThe label registered

events.Transfer.addListener(({ from, to, value }) => { /* ... */ })

Arguments

ArgumentTypeDescription
fromAddressEvent data indicating the 'from' address.
toAddressEvent data indicating the 'to' address.
valueBigNumberEvent data indicating the amount transferred.

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

Arguments

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

events.ColonyFounderRoleSet.addListener(({ oldFounder, newFounder }) => { /* ... */ })

Arguments

ArgumentTypeDescription
oldFounderAddressThe current founder delegating the role away
newFounderAddressThe user receiving the colony founder role

events.ColonyAdminRoleSet.addListener(({ user }) => { /* ... */ })

Arguments

ArgumentTypeDescription
userAddressThe newly-added colony admin user

events.ColonyAdminRoleRemoved.addListener(({ user }) => { /* ... */ })

Arguments

ArgumentTypeDescription
userAddressThe removed colony admin user

events.ColonyFundsMovedBetweenFundingPots.addListener(({ fromPot, toPot, amount, token }) => { /* ... */ })

Arguments

ArgumentTypeDescription
fromPotnumberThe source funding pot
toPotnumberThe target funding pot
amountBigNumberThe amount that was transferred
tokenAddressThe token address being transferred

events.ColonyFundsClaimed.addListener(({ token, fee, payoutRemainder }) => { /* ... */ })

Arguments

ArgumentTypeDescription
tokenAddressThe token address being claimed
feeBigNumberThe fee deducted for rewards
payoutRemainderBigNumberThe remaining funds moved to the top-level domain pot

events.RewardPayoutClaimed.addListener(({ rewardPayoutId, user, fee, payoutRemainder }) => { /* ... */ })

Arguments

ArgumentTypeDescription
rewardPayoutIdnumberThe reward payout cycle ID
userAddressThe user who received the reward payout
feeBigNumberThe fee deducted from the payout
payoutRemainderBigNumberThe remaining reward amount paid out to the user

events.ColonyRewardInverseSet.addListener(({ rewardInverse }) => { /* ... */ })

Arguments

ArgumentTypeDescription
rewardInverseBigNumberThe reward inverse value

events.ColonyInitialised.addListener(({ colonyNetwork }) => { /* ... */ })

Arguments

ArgumentTypeDescription
colonyNetworkAddressThe Colony Network address

events.ColonyUpgraded.addListener(({ oldVersion, newVersion }) => { /* ... */ })

Arguments

ArgumentTypeDescription
oldVersionnumberThe previous colony version
newVersionnumberThe new colony version