IColony

Interface Methods

addDomain

Add a colony domain, and its respective local skill under skill with id _parentSkillId. New funding pot is created and associated with the domain here.

Note: Adding new domains is currently retricted to one level only, i.e. _parentDomainId has to be the root domain id: 1.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_parentDomainIduint256Id of the domain under which the new one will be added

addPayment

Add a new payment in the colony. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId, (only used if _permissionDomainId is different to _domainId)
_recipientaddressAddress of the payment recipient
_tokenaddressAddress of the token, 0x0 value indicates Ether
_amountuint256Payout amount
_domainIduint256The domain where the payment belongs
_skillIduint256The skill associated with the payment

Return Parameters

NameTypeDescription
paymentIduint256Identifier of the newly created payment

authority

Get the ColonyAuthority for the colony.

Return Parameters

NameTypeDescription
colonyAuthorityaddressThe ColonyAuthority contract address

bootstrapColony

Allows the colony to bootstrap itself by having initial reputation and token _amount assigned to _users. This reputation is assigned in the colony-wide domain. Secured function to authorised members.

Note: Only allowed to be called when taskCount is 0 by authorized addresses.

Parameters

NameTypeDescription
_usersaddress[]Array of address to bootstrap with reputation
_amountint[]Amount of reputation/tokens for every address

cancelTask

Cancel a task at any point before it is finalized. Secured function to authorised members. Any funds assigned to its funding pot can be moved back to the domain via IColony.moveFundsBetweenPots.

Note: Set the task.status property to 1.

Parameters

NameTypeDescription
_iduint256Id of the task

claimColonyFunds

Move any funds received by the colony in _token denomination to the top-level domain pot, siphoning off a small amount to the reward pot. If called against a colony's own token, no fee is taken.

Parameters

NameTypeDescription
_tokenaddressAddress of the token, 0x0 value indicates Ether

claimPayment

Claim the payout in _token denomination for payment _id. Here the network receives its fee from each payout. Same as for tasks, ether fees go straight to the Meta Colony whereas Token fees go to the Network to be auctioned off.

Parameters

NameTypeDescription
_iduint256Payment identifier
_tokenaddressAddress of the token, 0x0 value indicates Ether

claimRewardPayout

Claim the reward payout at _payoutId. User needs to provide their reputation and colony-wide reputation which will be proven via Merkle proof inside this function. Can only be called if payout is active, i.e if 60 days have not passed from its creation. Can only be called if next in queue.

Parameters

NameTypeDescription
_payoutIduint256Id of the reward payout
_squareRootsuint256[7]Square roots of values used in equation: _squareRoots[0] - square root of user reputation, _squareRoots[1] - square root of user tokens, _squareRoots[2] - square root of total reputation, _squareRoots[3] - square root of total tokens, _squareRoots[4] - square root of numerator (user reputation * user tokens), _squareRoots[5] - square root of denominator (total reputation * total tokens), _squareRoots[6] - square root of payout amount.
keybytesSome Reputation hash tree key
valuebytesReputation value
branchMaskuint256The branchmask of the proof
siblingsbytes32[]The siblings of the proof

claimTaskPayout

Claim the payout in _token denomination for work completed in task _id by contributor with role _role. Allowed only 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.

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum
_tokenaddressAddress of the token, 0x0 value indicates Ether

completeTask

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.

Parameters

NameTypeDescription
_iduint256Id of the task

executeTaskChange

Executes a task update transaction _data which is approved and signed by two of its roles (e.g. manager and worker) using the detached signatures for these users.

Note: The Colony functions which require approval and the task roles to review these are set in IColony.initialiseColony at colony creation. Upon successful execution the taskChangeNonces entry for the task is incremented.

Parameters

NameTypeDescription
_sigVuint8[]recovery id
_sigRbytes32[]r output of the ECDSA signature of the transaction
_sigSbytes32[]s output of the ECDSA signature of the transaction
_modeuint8[]How the signature was generated - 0 for Geth-style (usual), 1 for Trezor-style (only Trezor does this)
_valueuint256The transaction value, i.e. number of wei to be sent when the transaction is executed Currently we only accept 0 value transactions but this is kept as a future option
_databytesThe transaction data

executeTaskRoleAssignment

Executes a task role update transaction _data which is approved and signed by two of addresses. depending of which function we are calling. Allowed functions are setTaskManagerRole, setTaskEvaluatorRole and setTaskWorkerRole. Upon successful execution the taskChangeNonces entry for the task is incremented.

Parameters

NameTypeDescription
_sigVuint8[]recovery id
_sigRbytes32[]r output of the ECDSA signature of the transaction
_sigSbytes32[]s output of the ECDSA signature of the transaction
_modeuint8[]How the signature was generated - 0 for Geth-style (usual), 1 for Trezor-style (only Trezor does this)
_valueuint256The transaction value, i.e. number of wei to be sent when the transaction is executed Currently we only accept 0 value transactions but this is kept as a future option
_databytesThe transaction data

finalizePayment

Finalizes the payment and logs the reputation log updates. Allowed to be called once after payment is fully funded. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_iduint256Payment identifier

finalizeRewardPayout

Finalises the reward payout. Allows creation of next reward payouts for token that has been used in _payoutId. Can only be called when reward payout cycle is finished i.e when 60 days have passed from its creation.

Parameters

NameTypeDescription
_payoutIduint256Id of the reward payout

finalizeTask

Called after task work rating is complete which closes the task and logs the respective reputation log updates. Allowed to be called once per task. Secured function to authorised members.

Note: Set the task.finalized property to true

Parameters

NameTypeDescription
_iduint256Id of the task

generateSecret

Helper function used to generage consistently the rating secret using salt value _salt and value to hide _value

Parameters

NameTypeDescription
_saltbytes32Salt value
_valueuint256Value to hide

Return Parameters

NameTypeDescription
secretbytes32keccak256 hash of joint _salt and _value

getColonyNetwork

Returns the colony network address set on the Colony.

Note: The colonyNetworkAddress we read here is set once, during initialiseColony.

Return Parameters

NameTypeDescription
colonyNetworkaddressThe address of Colony Network instance

getDomain

Get a domain by id.

Parameters

NameTypeDescription
_iduint256Id of the domain which details to get

Return Parameters

NameTypeDescription
domainDomainThe domain

getDomainCount

Get the number of domains in the colony.

Return Parameters

NameTypeDescription
countuint256The domain count. Min 1 as the root domain is created at the same time as the colony

getFundingPot

Get the non-mapping properties of a pot by id.

Note: For the reward funding pot (e.g. id: 0) this returns (0, 0, 0).

Parameters

NameTypeDescription
_iduint256Id of the pot which details to get

Return Parameters

NameTypeDescription
associatedTypeFundingPotAssociatedTypeThe FundingPotAssociatedType value of the current funding pot, e.g. Domain, Task, Payout
associatedTypeIduint256Id of the associated type, e.g. if associatedType = FundingPotAssociatedType.Domain, this refers to the domainId
payoutsWeCannotMakeuint256Number of payouts that cannot be completed with the current funding

getFundingPotBalance

Get the _token balance of pot with id _potId.

Parameters

NameTypeDescription
_potIduint256Id of the funding pot
_tokenaddressAddress of the token, 0x0 value indicates Ether

Return Parameters

NameTypeDescription
balanceuint256Funding pot supply balance

getFundingPotCount

Get the number of funding pots in the colony.

Return Parameters

NameTypeDescription
countuint256The funding pots count

getFundingPotPayout

Get the assigned _token payouts of pot with id _potId.

Parameters

NameTypeDescription
_potIduint256Id of the funding pot
_tokenaddressAddress of the token, 0x0 value indicates Ether

Return Parameters

NameTypeDescription
payoutuint256Funding pot payout amount

getNonRewardPotsTotal

Get the total amount of tokens _token minus amount reserved to be paid to the reputation and token holders as rewards.

Parameters

NameTypeDescription
_tokenaddressAddress of the token, 0x0 value indicates Ether

Return Parameters

NameTypeDescription
amountuint256Total amount of tokens in funding pots other than the rewards pot (id 0)

getPayment

Returns an exiting payment.

Parameters

NameTypeDescription
_iduint256Payment identifier

Return Parameters

NameTypeDescription
paymentPaymentThe Payment data structure

getPaymentCount

Get the number of payments in the colony.

Return Parameters

NameTypeDescription
countuint256The payment count

getRewardInverse

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

Return Parameters

NameTypeDescription
rewardInverseuint256The inverse of the reward

getRewardPayoutInfo

Get useful information about specific reward payout.

Parameters

NameTypeDescription
_payoutIduint256Id of the reward payout

Return Parameters

NameTypeDescription
rewardPayoutCycleRewardPayoutCycleRewardPayoutCycle, containing propertes: reputationState Reputation root hash at the time of creation, colonyWideReputation Colony wide reputation in reputationState, totalTokens Total colony tokens at the time of creation, amount Total amount of tokens taken aside for reward payout, tokenAddress Token address, blockTimestamp Block number at the time of creation.

getTask

Get a task with id _id

Parameters

NameTypeDescription
_iduint256Id of the task

Return Parameters

NameTypeDescription
specificationHashbytes32Task brief hash
deliverableHashbytes32Task deliverable hash
statusTaskStatusTaskStatus property. 0 - Active. 1 - Cancelled. 2 - Finalized
dueDateuint256Due date
fundingPotIduint256Id of funding pot for task
completionTimestampuint256Task completion timestamp
domainIduint256Task domain id, default is root colony domain with id 1
skillIdsuint256[]Array of global skill ids assigned to task

getTaskChangeNonce

Starts from 0 and is incremented on every co-reviewed task change via executeTaskChange call.

Parameters

NameTypeDescription
_iduint256Id of the task

Return Parameters

NameTypeDescription
nonceuint256The current task change nonce value

getTaskCount

Get the number of tasks in the colony.

Return Parameters

NameTypeDescription
countuint256The task count

getTaskPayout

Get payout amount in _token denomination for role _role in task _id.

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum
_tokenaddressAddress of the token, 0x0 value indicates Ether

Return Parameters

NameTypeDescription
amountuint256Payout amount

getTaskRole

Get the Role properties back for role _role in task _id.

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum

Return Parameters

NameTypeDescription
roleRoleThe Role

getTaskWorkRatingSecret

Get the rating secret submitted for role _role in task _id

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum

Return Parameters

NameTypeDescription
secretbytes32Rating secret bytes32 value

getTaskWorkRatingSecretsInfo

Get the ColonyStorage.RatingSecrets information for task _id.

Parameters

NameTypeDescription
_iduint256Id of the task

Return Parameters

NameTypeDescription
nSecretsuint256Number of secrets
lastSubmittedAtuint256Timestamp of the last submitted rating secret

getToken

Get the colony token.

Return Parameters

NameTypeDescription
tokenAddressaddressAddress of the token contract

hasUserRole

Check whether a given user has a given role for the colony. Calls the function of the same name on the colony's authority contract.

Parameters

NameTypeDescription
_useraddressThe user whose role we want to check
_domainIduint256The domain where we want to check for the role
_roleColonyRoleThe role we want to check for

Return Parameters

NameTypeDescription
hasRoleboolBoolean indicating whether the given user has the given role in domain

initialiseColony

Called once when the colony is created to initialise certain storage slot values.

Note: Sets the reward inverse to the uint max 2**256 - 1.

Parameters

NameTypeDescription
_colonyNetworkAddressaddressAddress of the colony network
_tokenaddressAddress of the colony ERC20 Token

makeTask

Make a new task in the colony. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_specificationHashbytes32Database identifier where the task specification is stored
_domainIduint256The domain where the task belongs
_skillIduint256The skill associated with the task, can set to 0 for no-op
_dueDateuint256The due date of the task, can set to 0 for no-op

mintTokens

Mint _wad amount of colony tokens. Secured function to authorised members.

Parameters

NameTypeDescription
_waduint256Amount to mint

moveFundsBetweenPots

Move a given amount: _amount of _token funds from funding pot with id _fromPot to one with id _toPot.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_fromChildSkillIndexuint256The child index in _permissionDomainId where we can find the domain for _fromPotId
_toChildSkillIndexuint256The child index in _permissionDomainId where we can find the domain for _toPotId
_fromPotuint256Funding pot id providing the funds
_toPotuint256Funding pot id receiving the funds
_amountuint256Amount of funds
_tokenaddressAddress of the token, 0x0 value indicates Ether

owner

Get the colony owner address. This should be address(0x0) at all times.

Note: Used for testing.

Return Parameters

NameTypeDescription
colonyOwneraddressAddress of the colony owner

registerColonyLabel

Register colony's ENS label.

Parameters

NameTypeDescription
colonyNamestringThe label to register.
orbitdbstringThe path of the orbitDB database associated with the colony name

removeTaskEvaluatorRole

Removing evaluator role. Agreed between manager and currently assigned evaluator.

Parameters

NameTypeDescription
_iduint256Id of the task

removeTaskWorkerRole

Removing worker role. Agreed between manager and currently assigned worker.

Parameters

NameTypeDescription
_iduint256Id of the task

revealTaskWorkRating

Reveal the secret rating submitted in IColony.submitTaskWorkRating for task _id and task role with id _role. Allowed within 5 days period starting which whichever is first from either both rating secrets being submitted (via IColony.submitTaskWorkRating) or the 5 day rating period expiring.

Note: Compares the keccak256(_salt, _rating) output with the previously submitted rating secret and if they match, sets the task role properties rated to true and rating to _rating.

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum
_ratinguint80-50 rating score (in increments of 10, .e.g 0, 10, 20, 30, 40 or 50)
_saltbytes32Salt value used to generate the rating secret

setAdministrationRole

Set new colony admin role. Can be called by root role or architecture role.

Parameters

NameTypeDescription
_permissionDomainIduint256Domain in which the caller has root/architecture role
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_useraddressUser we want to give an admin role to
_domainIduint256Domain in which we are giving user the role
_setToboolThe state of the role permission (true assign the permission, false revokes it)

setAllTaskPayouts

Set _token payout for all roles in task _id to the respective amounts.

Note: Can only call if evaluator and worker are unassigned or manager, otherwise need signature.

Parameters

NameTypeDescription
_iduint256Id of the task
_tokenaddressAddress of the token, 0x0 value indicates Ether
_managerAmountuint256Payout amount for manager
_evaluatorAmountuint256Payout amount for evaluator
_workerAmountuint256Payout amount for worker

setArchitectureRole

Set new colony architecture role. Can be called by root role or architecture role.

Parameters

NameTypeDescription
_permissionDomainIduint256Domain in which the caller has root/architecture role
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_useraddressUser we want to give an architecture role to
_domainIduint256Domain in which we are giving user the role
_setToboolThe state of the role permission (true assign the permission, false revokes it)

setFundingRole

Set new colony funding role. Can be called by root role or architecture role.

Parameters

NameTypeDescription
_permissionDomainIduint256Domain in which the caller has root/architecture role
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_useraddressUser we want to give an funding role to
_domainIduint256Domain in which we are giving user the role
_setToboolThe state of the role permission (true assign the permission, false revokes it)

setPaymentDomain

Sets the domain on an existing payment. Secured function to authorised members

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action.
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_iduint256Payment identifier
_domainIduint256Id of the new domain to set

setPaymentPayout

Sets the payout for a given token on an existing payment. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_iduint256Payment identifier
_tokenaddressAddress of the token, 0x0 value indicates Ether
_amountuint256Payout amount

setPaymentRecipient

Sets the recipient on an existing payment. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_iduint256Payment identifier
_recipientaddressAddress of the payment recipient

setPaymentSkill

Sets the skill on an existing payment. Secured function to authorised members.

Parameters

NameTypeDescription
_permissionDomainIduint256The domainId in which I have the permission to take this action
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId
_iduint256Payment identifier
_skillIduint256Id of the new skill to set

setRewardInverse

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

Parameters

NameTypeDescription
_rewardInverseuint256The inverse of the reward

setRootRole

Set new colony root role. Can be called by root role only.

Parameters

NameTypeDescription
_useraddressUser we want to give an root role to
_setToboolThe state of the role permission (true assign the permission, false revokes it)

setTaskBrief

Set the hash for the task brief, aka task work specification, which identifies the task brief content in ddb. Allowed before a task is finalized.

Parameters

NameTypeDescription
_iduint256Id of the task
_specificationHashbytes32Unique hash of the task brief in ddb

setTaskDomain

Set the domain for task _id.

Parameters

NameTypeDescription
_iduint256Id of the task
_domainIduint256Id of the domain

setTaskDueDate

Set the due date on task _id. Allowed before a task is finalized.

Parameters

NameTypeDescription
_iduint256Id of the task
_dueDateuint256Due date as seconds since unix epoch

setTaskEvaluatorPayout

Set _token payout for evaluator in task _id to _amount.

Parameters

NameTypeDescription
_iduint256Id of the task
_tokenaddressAddress of the token, 0x0 value indicates Ether
_amountuint256Payout amount

setTaskEvaluatorRole

Assigning evaluator role. Can only be set if there is no one currently assigned to be an evaluator. Manager of the task and user we want to assign role to both need to agree. Managers can assign themselves to this role, if there is no one currently assigned to it.

Note: This function can only be called through executeTaskRoleAssignment.

Parameters

NameTypeDescription
_iduint256Id of the task
_useraddressAddress of the user we want to give a evaluator role to

setTaskManagerPayout

Set _token payout for manager in task _id to _amount.

Parameters

NameTypeDescription
_iduint256Id of the task
_tokenaddressAddress of the token, 0x0 value indicates Ether
_amountuint256Payout amount

setTaskManagerRole

Assigning manager role. Current manager and user we want to assign role to both need to agree. User we want to set here also needs to be an admin. Note that the domain proof data comes at the end here to not interfere with the assembly argument unpacking.

Note: This function can only be called through executeTaskRoleAssignment.

Parameters

NameTypeDescription
_iduint256Id of the task
_useraddressAddress of the user we want to give a manager role to
_permissionDomainIduint256The domain ID in which _user has the Administration permission
_childSkillIndexuint256The index that the _domainId is relative to _permissionDomainId

setTaskSkill

Set the skill for task _id.

Note: Currently we only allow one skill per task although we have provisioned for an array of skills in Task struct. Allowed before a task is finalized.

Parameters

NameTypeDescription
_iduint256Id of the task
_skillIduint256Id of the skill which has to be a global skill

setTaskWorkerPayout

Set _token payout for worker in task _id to _amount.

Parameters

NameTypeDescription
_iduint256Id of the task
_tokenaddressAddress of the token, 0x0 value indicates Ether
_amountuint256Payout amount

setTaskWorkerRole

Assigning worker role. Can only be set if there is no one currently assigned to be a worker. Manager of the task and user we want to assign role to both need to agree.

Note: This function can only be called through executeTaskRoleAssignment.

Parameters

NameTypeDescription
_iduint256Id of the task
_useraddressAddress of the user we want to give a worker role to

startNextRewardPayout

Add a new payment in the colony. Can only be called by users with root permission. All tokens will be locked, and can be unlocked by calling waiveRewardPayout or claimRewardPayout.

Parameters

NameTypeDescription
_tokenaddressAddress of the token used for reward payout
keybytesSome Reputation hash tree key
valuebytesReputation value
branchMaskuint256The branchmask of the proof
siblingsbytes32[]The siblings of the proof

submitTaskDeliverable

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.

Note: Set the task.deliverableHash and task.completionTimestamp properties.

Parameters

NameTypeDescription
_iduint256Id of the task
_deliverableHashbytes32Unique hash of the task deliverable content in ddb

submitTaskDeliverableAndRating

Submit the task deliverable for Worker and rating for Manager.

Note: Internally call submitTaskDeliverable and submitTaskWorkRating in sequence.

Parameters

NameTypeDescription
_iduint256Id of the task
_deliverableHashbytes32Unique hash of the task deliverable content in ddb
_ratingSecretbytes32Rating secret for manager

submitTaskWorkRating

Submit a hashed secret of the rating for work in task _id which was performed by user with task role id _role. Allowed within 5 days period starting which whichever is first from either the deliverable being submitted or the dueDate been reached. Allowed only for evaluator to rate worker and for worker to rate manager performance. Once submitted ratings can not be changed or overwritten.

Parameters

NameTypeDescription
_iduint256Id of the task
_roleuint8Id of the role, as defined in TaskRole enum
_ratingSecretbytes32keccak256 hash of a salt and 0-50 rating score (in increments of 10, .e.g 0, 10, 20, 30, 40 or 50). Can be generated via IColony.generateSecret helper function.

upgrade

Upgrades a colony to a new Colony contract version _newVersion.

Note: Downgrades are not allowed, i.e. _newVersion should be higher than the currect colony version.

Parameters

NameTypeDescription
_newVersionuintThe target version for the upgrade

verifyReputationProof

Helper function that can be used by a client to verify the correctness of a patricia proof they have been supplied with.

Note: For more detail about branchMask and siblings, examine the PatriciaTree implementation. While public, likely only to be used by the Colony contracts, as it checks that the user is proving their own reputation in the current colony. The verifyProof function can be used to verify any proof, though this function is not currently exposed on the Colony's EtherRouter.

Parameters

NameTypeDescription
keybytesThe key of the element the proof is for.
valuebytesThe value of the element that the proof is for.
branchMaskuint256The branchmask of the proof
siblingsbytes32[]The siblings of the proof

Return Parameters

NameTypeDescription
isValidboolTrue if the proof is valid, false otherwise.

version

Get the Colony contract version. Starts from 1 and is incremented with every deployed contract change.

Return Parameters

NameTypeDescription
colonyVersionuint256Version number

Support

Questions? Problems? Existential dilemmas? We’re here to help!

Improve this doc.

All improvements to documentation are welcome and encouraged. Submit a PR for documentation on GitHub.