@colony/colony-js-client
Version:
Reference implementation of the Colony API
1,566 lines (1,485 loc) • 110 kB
Flow
/* @flow */
/* eslint-disable import/no-cycle */
import assert from 'assert';
import type BigNumber from 'bn.js';
import ContractClient from '@colony/colony-js-contract-client';
import { isValidAddress } from '@colony/colony-js-utils';
// eslint-disable-next-line max-len
import type { ContractClientConstructorArgs } from '@colony/colony-js-contract-client';
import ColonyNetworkClient from '../ColonyNetworkClient/index';
import TokenClient from '../TokenClient/index';
import TokenLockingClient from '../TokenLockingClient/index';
import GetTask from './callers/GetTask';
import GetExtensionAddress from './callers/GetExtensionAddress';
import AddExtension from './senders/AddExtension';
import AddPayment from './senders/AddPayment';
import AddTask from './senders/AddTask';
import AddExpenditure from './senders/AddExpenditure';
import MakePayment from './senders/MakePayment';
import MakePaymentFundedFromDomain from './senders/MakePaymentFundedFromDomain';
import RemoveExtension from './senders/RemoveExtension';
import TransferExpenditure from './senders/TransferExpenditure';
import DomainAuth, { getDomainIdFromPot } from './senders/DomainAuth';
import SetAdminRole from './senders/SetAdminRole';
import SetFounderRole from './senders/SetFounderRole';
import Upgrade from './senders/Upgrade';
import addRecoveryMethods from '../addRecoveryMethods';
import {
MAX_VERSION,
COLONY_ROLE_ADMINISTRATION,
COLONY_ROLE_ARCHITECTURE,
COLONY_ROLE_ARBITRATION,
COLONY_ROLE_FUNDING,
COLONY_ROLES,
DEFAULT_DOMAIN_ID,
EXPENDITURE_STATUSES,
FUNDING_POT_TYPES,
TASK_ROLE_EVALUATOR,
TASK_ROLE_MANAGER,
TASK_ROLE_WORKER,
TASK_ROLES,
TASK_STATUSES,
} from '../constants';
type Address = string;
type ColonyRole = $Keys<typeof COLONY_ROLES>;
type FundingPotTypes = $Keys<typeof FUNDING_POT_TYPES>;
type HexString = string;
type IPFSHash = string;
type TaskRole = $Keys<typeof TASK_ROLES>;
type TaskStatus = $Keys<typeof TASK_STATUSES>;
type ExpenditureStatus = $Keys<typeof EXPENDITURE_STATUSES>;
type AnyAddress = string;
// @note Deprecated in glider-rc.3, replaced with ColonyRoleSet
type ColonyAdministrationRoleSet = ContractClient.Event<{
address: Address, // The address that was either assigned or unassigned the colony `ADMINISTRATION` role.
setTo: boolean, // A boolean indicating whether the address was assigned or unassigned the colony `ADMINISTRATION` role.
}>;
// @note Deprecated in glider-rc.3, replaced with ColonyRoleSet
type ColonyArchitectureRoleSet = ContractClient.Event<{
address: Address, // The address that was either assigned or unassigned the colony `ARCHITECTURE` role.
setTo: boolean, // A boolean indicating whether the address was assigned or unassigned the colony `ARCHITECTURE` role.
}>;
type ColonyBootstrapped = ContractClient.Event<{
addresses: Array<Address>, // The array of users that received an initial amount of tokens and reputation.
amounts: Array<BigNumber>, // The array of corresponding token and reputation amounts each user recieved.
}>;
// @note Deprecated in glider-rc.3, replaced with ColonyRoleSet
type ColonyFundingRoleSet = ContractClient.Event<{
address: Address, // The address that was either assigned or unassigned the colony `FUNDING` role.
setTo: boolean, // A boolean indicating whether the address was assigned or unassigned the colony `FUNDING` role.
}>;
type ColonyFundsClaimed = ContractClient.Event<{
token: AnyAddress, // The address of the token contract (an empty address if Ether).
fee: BigNumber, // The fee deducted from the claim and added to the colony rewards pot.
payoutRemainder: BigNumber, // The remaining funds (after the fee) moved to the top-level domain pot.
}>;
type ColonyFundsMovedBetweenFundingPots = ContractClient.Event<{
fromPot: number, // The ID of the pot from which the funds were moved.
toPot: number, // The ID of the pot to which the funds were moved.
amount: BigNumber, // The amount of funds that were moved between pots.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
}>;
type ColonyInitialised = ContractClient.Event<{
colonyNetwork: Address, // The address of the Colony Network.
token: AnyAddress, // The address of the token contract.
}>;
type ColonyLabelRegistered = ContractClient.Event<{
colony: Address, // The address of the colony that was modified.
label: string, // The label that was registered for the colony.
}>;
type ColonyRewardInverseSet = ContractClient.Event<{
rewardInverse: BigNumber, // The reward inverse value that was set.
}>;
// @note Introduced in glider-rc.3, replacing existing role set events
type ColonyRoleSet = ContractClient.Event<{
address: Address, // The address for which the role was set.
domainId: number, // The domain in which the role was set.
role: ColonyRole, // The role which was set, one of: `ADMINISTRATION`, `ARBITRATION`, `ARCHITECTURE`, `FUNDING`, `RECOVERY` or `ROOT`.
setTo: boolean, // Whether the role was assigned (`true`) on unassigned (`false`).
}>;
// @note Deprecated in glider-rc.3, replaced with ColonyRoleSet
type ColonyRootRoleSet = ContractClient.Event<{
address: Address, // The address that was either assigned or unassigned the colony `ROOT` role.
setTo: boolean, // A boolean indicating whether the address was assigned or unassigned the colony `ROOT` role.
}>;
type ColonyUpgraded = ContractClient.Event<{
oldVersion: number, // The old version number of the colony.
newVersion: number, // The new version number of the colony.
}>;
type ColonyVersionAdded = ContractClient.Event<{
version: number, // The colony contract version that was added.
resolver: Address, // The address of the `Resolver` contract which will be used with the underlying `EtherRouter` contract.
}>;
type DomainAdded = ContractClient.Event<{
domainId: number, // The ID of the domain that was added.
}>;
type FundingPotAdded = ContractClient.Event<{
potId: number, // The ID of the pot that was added.
}>;
type Mint = ContractClient.Event<{
address: Address, // The address that initiated the mint event.
amount: BigNumber, // The amount of tokens that were minted.
}>;
type PaymentAdded = ContractClient.Event<{
paymentId: number, // The ID of the payment that was added.
}>;
type PayoutClaimed = ContractClient.Event<{
potId: number, // The ID of the pot that was modified.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
amount: BigNumber, // The task payout amount that was claimed.
}>;
type RecoveryRoleSet = ContractClient.Event<{
user: AnyAddress, // The address having the recovery role set
setTo: boolean, // Bool representing whether they now have the skill or not
}>;
type RewardPayoutClaimed = ContractClient.Event<{
rewardPayoutId: number, // The ID of the reward payout cycle.
user: Address, // The address of the user who claimed the reward payout.
fee: BigNumber, // The fee deducted from the claim and added to the colony rewards pot.
payoutRemainder: BigNumber, // The remaining payout amount (after the fee) transferred to the user.
}>;
type RewardPayoutCycleEnded = ContractClient.Event<{
payoutId: number, // The ID of the payout cycle that ended.
}>;
type RewardPayoutCycleStarted = ContractClient.Event<{
payoutId: number, // The ID of the payout cycle that started.
}>;
type SkillAdded = ContractClient.Event<{
skillId: number, // The ID of the skill that was added.
parentSkillId: number, // The ID of the parent skill.
}>;
type TaskAdded = ContractClient.Event<{
taskId: number, // The ID of the task that was added.
}>;
type TaskBriefSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
specificationHash: IPFSHash, // The specification hash that was set (an IPFS hash).
}>;
type TaskCanceled = ContractClient.Event<{
taskId: number, // The ID of the task that was canceled.
}>;
type TaskCompleted = ContractClient.Event<{
taskId: number, // The ID of the task that was completed.
}>;
type TaskDeliverableSubmitted = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
deliverableHash: IPFSHash, // The deliverable hash that was submitted (an IPFS hash).
}>;
type TaskDomainSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
domainId: number, // The ID of the domain that was set.
}>;
type TaskDueDateSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
dueDate: Date, // The due date that was set.
}>;
type TaskFinalized = ContractClient.Event<{
taskId: number, // The ID of the task that was finalized.
}>;
type TaskPayoutSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
role: TaskRole, // The role of the task that was modified (`MANAGER`, `EVALUATOR`, or `WORKER`).
token: AnyAddress, // The address of the token contract (an empty address if Ether).
amount: BigNumber, // The task payout amount that was set.
}>;
type TaskRoleUserSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
role: TaskRole, // The role of the task that was set (`MANAGER`, `EVALUATOR`, or `WORKER`).
user: Address, // The user that was assigned the task role.
}>;
type TaskSkillSet = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
skillId: number, // The ID of the skill that was set.
}>;
type TaskWorkRatingRevealed = ContractClient.Event<{
taskId: number, // The ID of the task that was modified.
role: TaskRole, // The role of the task that received the rating (`MANAGER`, `EVALUATOR`, or `WORKER`).
rating: number, // The value of the rating that was revealed (`1`, `2`, or `3`).
}>;
type TokenLocked = ContractClient.Event<{
token: AnyAddress, // The address of the token contract (an empty address if Ether).
lockCount: number, // The total lock count for the token.
}>;
type Transfer = ContractClient.Event<{
from: Address, // The address of the account that sent tokens.
to: Address, // The address of the account that received tokens.
value: BigNumber, // The amount of tokens that were transferred.
}>;
type ExpenditureAdded = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was created
}>;
type ExpenditureTransferred = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was transferred
owner: Address, // The address the expenditure was transferred to
}>;
type ExpenditureCancelled = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was cancelled
}>;
type ExpenditureFinalized = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was finalized
}>;
type ExpenditureRecipientSet = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was modified
slot: BigNumber, // The slot of the expenditure being modified
recipient: AnyAddress, // The address that will receive the payout from this slot
}>;
type ExpenditureSkillSet = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was modified
slot: BigNumber, // The slot of the expenditure being modified
skillId: BigNumber, // The skillId the slot will award upon payout
}>;
type ExpenditurePayoutSet = ContractClient.Event<{
expenditureId: number, // The ID of the expenditure that was modified
slot: BigNumber, // The slot of the expenditure being modified
token: Address, // The token the slot will pay out (NB a slot can have more than one token associated with it)
amount: BigNumber, // The amount of token that will be paid out
}>;
export default class ColonyClient extends ContractClient {
networkClient: ColonyNetworkClient;
tokenClient: TokenClient;
tokenLockingClient: TokenLockingClient;
events: {
ColonyAdministrationRoleSet: ColonyAdministrationRoleSet,
ColonyArchitectureRoleSet: ColonyArchitectureRoleSet,
ColonyBootstrapped: ColonyBootstrapped,
ColonyFundingRoleSet: ColonyFundingRoleSet,
ColonyFundsClaimed: ColonyFundsClaimed,
ColonyFundsMovedBetweenFundingPots: ColonyFundsMovedBetweenFundingPots,
ColonyInitialised: ColonyInitialised,
ColonyLabelRegistered: ColonyLabelRegistered,
ColonyRewardInverseSet: ColonyRewardInverseSet,
ColonyRoleSet: ColonyRoleSet,
ColonyRootRoleSet: ColonyRootRoleSet,
ColonyUpgraded: ColonyUpgraded,
ColonyVersionAdded: ColonyVersionAdded,
DomainAdded: DomainAdded,
FundingPotAdded: FundingPotAdded,
Mint: Mint,
PaymentAdded: PaymentAdded,
PayoutClaimed: PayoutClaimed,
RecoveryRoleSet: RecoveryRoleSet,
RewardPayoutClaimed: RewardPayoutClaimed,
RewardPayoutCycleEnded: RewardPayoutCycleEnded,
RewardPayoutCycleStarted: RewardPayoutCycleStarted,
SkillAdded: SkillAdded,
TaskAdded: TaskAdded,
TaskBriefSet: TaskBriefSet,
TaskCanceled: TaskCanceled,
TaskCompleted: TaskCompleted,
TaskDeliverableSubmitted: TaskDeliverableSubmitted,
TaskDomainSet: TaskDomainSet,
TaskDueDateSet: TaskDueDateSet,
TaskFinalized: TaskFinalized,
TaskPayoutSet: TaskPayoutSet,
TaskRoleUserSet: TaskRoleUserSet,
TaskSkillSet: TaskSkillSet,
TaskWorkRatingRevealed: TaskWorkRatingRevealed,
TokenLocked: TokenLocked,
Transfer: Transfer,
ExpenditureAdded: ExpenditureAdded,
ExpenditureTransferred: ExpenditureTransferred,
ExpenditureCancelled: ExpenditureCancelled,
ExpenditureFinalized: ExpenditureFinalized,
ExpenditureRecipientSet: ExpenditureRecipientSet,
ExpenditureSkillSet: ExpenditureSkillSet,
ExpenditurePayoutSet: ExpenditurePayoutSet,
};
/*
Add a colony contract version. This can only be called from the Meta Colony and only by the address assigned the colony `ROOT` role.
*/
addNetworkColonyVersion: ColonyClient.Sender<
{
version: number, // The colony contract version that will be added.
resolver: number, // The address of the `Resolver` contract which will be used with the underlying `EtherRouter` contract.
},
{
ColonyVersionAdded: ColonyVersionAdded,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IMetaColony.sol',
version: 'glider',
},
>;
/*
Add a domain to the colony.
*/
addDomain: ColonyClient.Sender<
{
parentDomainId: number, // The ID of the parent domain.
},
{
SkillAdded: SkillAdded,
DomainAdded: DomainAdded,
FundingPotAdded: FundingPotAdded,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Add a new expenditure within the colony.
*/
addExpenditure: ColonyClient.Sender<
{
domainId: ?number, // The ID of the domain (default value of `1`).
},
{
FundingPotAdded: FundingPotAdded,
ExpenditureAdded: ExpenditureAdded,
},
ColonyClient,
{
function: 'makeExpenditure',
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Add an extension contract.
*/
addExtension: ColonyClient.Sender<
{
contractName: string, // The name of the extension contract (`OneTxPayment` or `OldRoles`).
},
{},
ColonyClient,
{
version: 'glider',
},
>;
/*
Add a global skill. This can only be called from the Meta Colony and only by the address assigned the colony `ROOT` role.
*/
addGlobalSkill: ColonyClient.Sender<
{},
{
SkillAdded: SkillAdded,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IMetaColony.sol',
version: 'glider',
},
>;
/*
Add a payment to the colony.
*/
addPayment: ColonyClient.Sender<
{
recipient: Address, // The address that will receive the payment.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
amount: BigNumber, // The amount of tokens (or Ether) for the payment.
domainId: number, // The ID of the domain.
skillId: number, // The ID of the skill.
},
{
FundingPotAdded: FundingPotAdded,
PaymentAdded: PaymentAdded,
},
ColonyClient,
{
contract: 'ColonyPayment.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Add a new task within the colony.
*/
addTask: ColonyClient.Sender<
{
specificationHash: IPFSHash, // The specification hash of the task (an IPFS hash).
domainId: ?number, // The ID of the domain (default value of `1`).
skillId: ?number, // The ID of the skill (default value of `null`).
dueDate: ?Date, // The due date of the task (default value of `30` days from creation).
},
{
TaskSkillSet: TaskSkillSet,
TaskDueDateSet: TaskDueDateSet,
FundingPotAdded: FundingPotAdded,
TaskAdded: TaskAdded,
},
ColonyClient,
{
function: 'makeTask',
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Indicate approval to exit colony recovery mode. This function can only be called by an address assigned the colony `RECOVERY` role.
*/
approveExitRecovery: ColonyClient.Sender<
{},
{},
ColonyClient,
{
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Bootstrap the colony by giving an initial amount of tokens and reputation to selected addresses. This function can only be called by the address assigned the colony `ROOT` role when the `taskCount` for the colony is equal to `0`.
*/
bootstrapColony: ColonyClient.Sender<
{
addresses: Array<Address>, // The array of users that will recieve an initial amount of tokens and reputation.
amounts: Array<BigNumber>, // The array of corresponding token and reputation amounts each user will recieve.
},
{
ColonyBootstrapped: ColonyBootstrapped,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Cancel a task. Once a task is cancelled, no further changes to the task can be made.
*/
cancelTask: ColonyClient.MultisigSender<
{
taskId: number, // The ID of the task.
},
{
TaskCanceled: TaskCanceled,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Cancel an expenditure. Once an expenditure is cancelled, no further changes to the task can be made.
*/
cancelExpenditure: ColonyClient.Sender<
{
expenditureId: number, // The ID of the expenditure.
},
{
ExpenditureCancelled: ExpenditureCancelled,
},
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Claim funds that the colony has received by adding them to the funding pot of the root domain. A set fee is deducted from the funds claimed and added to the colony rewards pot. No fee is deducted when tokens native to the colony are claimed.
*/
claimColonyFunds: ColonyClient.Sender<
{
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
ColonyFundsClaimed: ColonyFundsClaimed,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Claim expenditure payout.
*/
claimExpenditurePayout: ColonyClient.Sender<
{
expenditureId: number, // The ID of the expenditure.
slot: BigNumber, // The slot of the expenditure being claimed
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
PayoutClaimed: PayoutClaimed,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Claim a payment.
*/
claimPayment: ColonyClient.Sender<
{
paymentId: number, // The ID of the payment.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
PayoutClaimed: PayoutClaimed,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Claim a reward payout.
*/
claimRewardPayout: ColonyClient.Sender<
{
payoutId: number, // The ID of the payout.
squareRoots: Array<BigNumber>, // The square roots of values used in the equation.
key: string, // The key of the element that the proof is for.
value: string, // The value of the element that the proof is for.
branchMask: HexString, // The branchmask of the proof.
siblings: Array<HexString>, // The siblings of the proof.
},
{
RewardPayoutClaimed: RewardPayoutClaimed,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Claim a payout assigned to a task role (`MANAGER`, `EVALUATOR`, or `WORKER`). This function can only be called by the address assigned the given task role after the task has been finalized.
*/
claimTaskPayout: ColonyClient.Sender<
{
taskId: number, // The ID of the task.
role: TaskRole, // The task role that is claiming the payout (`MANAGER`, `EVALUATOR`, or `WORKER`).
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
PayoutClaimed: PayoutClaimed,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Mark a task as complete. If the address assigned the task `WORKER` role fails to submit the task deliverable by the due date, this function must be called by the address assigned the task `MANAGER` role. This allows the task work to be rated and the task to be finalized.
*/
completeTask: ColonyClient.Sender<
{
taskId: number, // The ID of the task.
},
{
TaskCompleted: TaskCompleted,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Deprecate a global skill. This can only be called from the Meta Colony and only by the address assigned the colony `ROOT` role.
*/
deprecateGlobalSkill: ColonyClient.Sender<
{
skillId: number, // The ID of the skill that will be deprecated.
},
{},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IMetaColony.sol',
version: 'glider',
},
>;
/*
Enter colony recovery mode. This function can only be called by a user assigned the colony `RECOVERY` role.
*/
enterRecoveryMode: ColonyClient.Sender<
{},
{},
ColonyClient,
{
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Exit colony recovery mode. This function can be called by anyone if enough whitelist approvals are given.
*/
exitRecoveryMode: ColonyClient.Sender<
{},
{},
ColonyClient,
{
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Finalize an expenditure. Once an expenditure is finalized, no further changes to the payment can be made by the owner and the address that is assigned to the slots can claim the payments once the timeout has expired.
*/
finalizeExpenditure: ColonyClient.Sender<
{
expenditureId: number, // The ID of the expenditure
},
{ ExpenditureFinalized: ExpenditureFinalized },
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Finalize a payment. Once a payment is finalized, no further changes to the payment can be made and the address that is assigned the payment can claim the payment.
*/
finalizePayment: ColonyClient.Sender<
{
paymentId: number, // The ID of the payment.
},
{},
ColonyClient,
{
contract: 'ColonyPayment.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Finalize a reward payout cycle. This function can only be called when the reward payout cycle has finished, i.e. 60 days have passed since the creation of the reward payout cycle.
*/
finalizeRewardPayout: ColonyClient.Sender<
{
payoutId: number, // The ID of the reward payout cycle.
},
{
RewardPayoutCycleEnded: RewardPayoutCycleEnded,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Finalize a task. Once a task is finalized, no further changes to the task can be made and each user assigned a task role can claim the payout assigned to their role.
*/
finalizeTask: ColonyClient.Sender<
{
taskId: number, // The ID of the task.
},
{
TaskFinalized: TaskFinalized,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Generate a secret for task ratings. This function returns a keccak256 hash created from the input parameters.
*/
generateSecret: ColonyClient.Caller<
{
salt: string, // The string that will be used to generate a secret.
value: number, // The task rating that will be hidden (`1`, `2`, or `3`).
},
{
secret: HexString, // A keccak256 hash that keeps the task rating hidden.
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the address of the authority contract associated with the colony contract.
*/
getAuthorityAddress: ColonyClient.Caller<
{},
{
address: Address, // The address of the authority contract associated with the colony contract.
},
ColonyClient,
{
function: 'authority',
contract: 'auth.sol',
// eslint-disable-next-line max-len
contractPath: 'https://github.com/dapphub/dappsys-monolithic/blob/de9114c5fa1b881bf16b1414e7ed90cd3cb2e361',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the address of the Colony Network contract.
*/
getColonyNetworkAddress: ColonyClient.Caller<
{},
{
address: Address, // The address of the Colony Network contract.
},
ColonyClient,
{
function: 'getColonyNetwork',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about a domain.
*/
getDomain: ColonyClient.Caller<
{
domainId: number, // The ID of the domain.
},
{
skillId: number, // The ID of the local skill.
potId: number, // The ID of the funding pot.
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total number of domains in the colony. The return value is also the ID of the last domain created.
*/
getDomainCount: ColonyClient.Caller<
{},
{
count: number, // The total number of domains.
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about an expenditure.
*/
getExpenditure: ColonyClient.Caller<
{
expenditureId: number, // The ID of the expenditure
},
{
status: ExpenditureStatus, // The expenditure status (`ACTIVE`, `CANCELLED` or `FINALIZED`).
owner: AnyAddress, // The owner of the expenditure.
potId: number, // The ID of the funding pot.
domainId: number, // The ID of the domain.
finalizedTimestamp: Date, // The date when the expenditure was finalized.
},
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Get the total number of expenditures.
*/
getExpenditureCount: ColonyClient.Caller<
{},
{
count: number, // The total number of payments.
},
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about an expenditure's slot
*/
getExpenditureSlot: ColonyClient.Caller<
{
expenditureId: number, // The ID of the expenditure
slot: BigNumber, // The number of the slot
},
{
recipient: AnyAddress, // The address of the recipient
claimDelay: BigNumber, // The time before the payout can be claimed
payoutModifier: BigNumber, // The ID of the funding pot.
skills: Array<number>, // An array of skill IDs.
},
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Get information about an expenditure's slot
*/
getExpenditureSlotPayout: ColonyClient.Caller<
{
expenditureId: number, // The ID of the expenditure
slot: BigNumber, // The number of the slot
token: AnyAddress, // The address of the token of the payout being queried
},
{
amount: BigNumber, // The amount being paid out
},
ColonyClient,
{
contract: 'ColonyExpenditure.sol',
interface: 'IColony.sol',
version: 'burgundy-glider',
},
>;
/*
Get the address of an extension contract associated with the colony address.
*/
getExtensionAddress: ColonyClient.Caller<
{
contractName: string, // The name of the extension contract.
},
{
address: Address, // The address of the extension contract.
},
ColonyClient,
{
version: 'glider',
},
>;
/*
Get information about a funding pot.
*/
getFundingPot: ColonyClient.Caller<
{
potId: number, // The ID of the funding pot.
},
{
type: FundingPotTypes, // The associated type of the funding pot (`DOMAIN`, `TASK`, `PAYMENT`, or `UNASSIGNED`).
typeId: number, // The id of the associated type (`domainId`, `taskId`, or `paymentId`).
payoutsWeCannotMake: number, // The total number of payouts that the funding pot cannot make.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the balance of a funding pot.
*/
getFundingPotBalance: ColonyClient.Caller<
{
potId: number, // The ID of the funding pot.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
balance: BigNumber, // The balance of tokens (or Ether) in the funding pot.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total number of funding pots.
*/
getFundingPotCount: ColonyClient.Caller<
{},
{
count: number, // The total number of funding pots.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the payout of a funding pot.
*/
getFundingPotPayout: ColonyClient.Caller<
{
potId: number, // The ID of the funding pot.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
payout: BigNumber, // The payout of tokens (or Ether) for the funding pot.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total amount of funds that are not in the colony rewards pot. This 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.
*/
getNonRewardPotsTotal: ColonyClient.Caller<
{
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
total: BigNumber, // The total amount of funds that are not in the colony rewards pot.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the address of the owner of the colony contract.
*/
getOwnerAddress: ColonyClient.Caller<
{},
{
address: Address, // The address of the owner of the colony contract.
},
ColonyClient,
{
function: 'owner',
contract: 'auth.sol',
// eslint-disable-next-line max-len
contractPath: 'https://github.com/dapphub/dappsys-monolithic/blob/de9114c5fa1b881bf16b1414e7ed90cd3cb2e361',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about a payment.
*/
getPayment: ColonyClient.Caller<
{
paymentId: number, // The ID of the payment.
},
{
recipient: Address, // The address of the assigned recipient.
finalized: boolean, // A boolean indicating whether or not the payment has been finalized.
potId: number, // The ID of the funding pot.
domainId: number, // The ID of the domain.
skills: Array<number>, // An array of skill IDs.
},
ColonyClient,
{
contract: 'ColonyPayment.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total number of payments.
*/
getPaymentCount: ColonyClient.Caller<
{},
{
count: number, // The total number of payments.
},
ColonyClient,
{
contract: 'ColonyPayment.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total number of addresses that are assigned the colony `RECOVERY` role.
*/
getRecoveryRolesCount: ColonyClient.Caller<
{},
{
count: number, // The total number of addresses that are assigned the colony `RECOVERY` role.
},
ColonyClient,
{
function: 'numRecoveryRoles',
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Get the inverse amount of the reward. If the fee is 1% (or 0.01), the inverse amount will be 100.
*/
getRewardInverse: ColonyClient.Caller<
{},
{
rewardInverse: BigNumber, // The inverse amount of the reward.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about a reward payout cycle.
*/
getRewardPayoutInfo: ColonyClient.Caller<
{
payoutId: number, // The ID of the reward payout cycle.
},
{
reputationState: string, // The reputation root hash at the time the reward payout was created.
colonyWideReputation: BigNumber, // The total reputation score throughout the colony.
totalTokens: BigNumber, // The total amount of tokens at the time the reward payout was created.
amount: BigNumber, // The total amount of tokens allocated for the reward payout.
tokenAddress: AnyAddress, // The address of the token contract (an empty address if Ether).
blockTimestamp: Date, // The timestamp at the time the reward payout was created.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about a task.
*/
getTask: ColonyClient.Caller<
{
taskId: number, // The ID of the task.
},
{
specificationHash: IPFSHash, // The specification hash of the task (an IPFS hash).
deliverableHash: IPFSHash, // The deliverable hash of the task (an IPFS hash).
status: TaskStatus, // The task status (`ACTIVE`, `CANCELLED` or `FINALIZED`).
dueDate: Date, // The final date that the task deliverable can be submitted.
potId: number, // The ID of the funding pot.
completionDate: Date, // The date when the task deliverable was submitted.
domainId: number, // The ID of the domain.
skillId: number, // The ID of the skill.
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the total number of tasks in the colony. The return value is also the ID of the last task created.
*/
getTaskCount: ColonyClient.Caller<
{},
{
count: number, // The total number of tasks.
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the task payout amount assigned to a task role. Multiple tokens can be used for task payouts, therefore the token must be specified when calling this function. In order to get the task payout amount in Ether, `token` must be an empty address.
*/
getTaskPayout: ColonyClient.Caller<
{
taskId: number, // The ID of the task.
role: TaskRole, // The task role (`MANAGER`, `EVALUATOR`, or `WORKER`).
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
amount: BigNumber, // The amount of tokens (or Ether) assigned to the task role as a payout.
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about a task role.
*/
getTaskRole: ColonyClient.Caller<
{
taskId: number, // The ID of the task.
role: TaskRole, // The role of the task (`MANAGER`, `EVALUATOR`, or `WORKER`).
},
{
address: Address, // The address that is assigned the task role.
rateFail: boolean, // A boolean indicating whether or not the assigned address failed to submit a rating.
rating: number, // The rating that the assigned address received (`1`, `2`, or `3`).
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the secret of a task work rating that has been submitted. If a task is in the commit period of the rating process, the work ratings are hidden in a keccak256 hash that was created from a `salt` and `value`. The rating secret can be retrieved but in order to reveal the secret, one would have to know both the `salt` and `value` used to generate the secret.
*/
getTaskWorkRatingSecret: ColonyClient.Caller<
{
taskId: number, // The ID of the task.
role: TaskRole, // The role that submitted the rating (`MANAGER`, `EVALUATOR`, or `WORKER`).
},
{
secret: HexString, // A keccak256 hash that keeps the task rating hidden.
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get information about the secrets of the task work ratings.
*/
getTaskWorkRatingSecretsInfo: ColonyClient.Caller<
{
taskId: number, // The ID of the task.
},
{
count: number, // The total number of secrets.
lastSubmitted: Date, // The date when the last secret was submitted.
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the address of the token contract that is the native token assigned to the colony. The native token is the token used to calculate reputation scores, i.e. `1` token earned for completing a task with a satisfactory rating (`2`) will result in `1` reputation point earned.
*/
getTokenAddress: ColonyClient.Caller<
{},
{
address: Address, // The address of the token contract assigned as the native token for the colony.
},
ColonyClient,
{
method: 'getToken',
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Get the version number of the colony contract. The version number starts at `1` and is incremented by `1` with every new version.
*/
getVersion: ColonyClient.Caller<
{},
{
version: number, // The version number of the colony contract.
},
ColonyClient,
{
function: 'version',
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Check whether an address has a role assigned.
*/
hasColonyRole: ColonyClient.Caller<
{
address: Address, // The address that will be checked for the role.
domainId: number, // The ID of the domain that the role is assigned.
role: ColonyRole, // The role that will be checked (`RECOVERY`, `ROOT`, `ARCHITECTURE`, `ADMINISTRATION`, `FUNDING`).
},
{
hasRole: boolean, // A boolean indicating whether or not the address has the role assigned.
},
ColonyClient,
{
function: 'hasUserRole',
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Check whether or not the colony is in recovery mode.
*/
isInRecoveryMode: ColonyClient.Caller<
{},
{
inRecoveryMode: boolean, // A boolean indicating whether or not the colony is in recovery mode.
},
ColonyClient,
{
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Make a payment in one transaction. This function is not included in the core contracts but instead it comes from the `OneTxPayment` extension contract. The `OneTxPayment` extension contract and the sender must both be assigned the colony `ADMINISTRATION` role.
*/
makePayment: ColonyClient.Sender<
{
recipient: Address, // The address that will receive the payment.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
amount: BigNumber, // The amount of tokens (or Ether) for the payment.
domainId: number, // The ID of the domain.
skillId: number, // The ID of the skill.
},
{
FundingPotAdded: FundingPotAdded,
PaymentAdded: PaymentAdded,
ColonyFundsMovedBetweenFundingPots: ColonyFundsMovedBetweenFundingPots,
Transfer: Transfer,
PayoutClaimed: PayoutClaimed,
},
ColonyClient,
{
contract: 'OneTxPayment.sol',
// eslint-disable-next-line max-len
contractPath: 'https://github.com/JoinColony/colonyNetwork/blob/glider-rc.3/contracts/extensions/OneTxPayment.sol',
version: 'glider',
},
>;
/*
Make a payment in one transaction. Like `makePayment` but just funded from the given domainId. This will throw if the given domain doesn't have enough funds
*/
makePaymentFundedFromDomain: ColonyClient.Sender<
{
recipient: Address, // The address that will receive the payment.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
amount: BigNumber, // The amount of tokens (or Ether) for the payment.
domainId: number, // The ID of the domain.
skillId: number, // The ID of the skill.
},
{
FundingPotAdded: FundingPotAdded,
PaymentAdded: PaymentAdded,
ColonyFundsMovedBetweenFundingPots: ColonyFundsMovedBetweenFundingPots,
Transfer: Transfer,
PayoutClaimed: PayoutClaimed,
},
ColonyClient,
{
contract: 'OneTxPayment.sol',
// eslint-disable-next-line max-len
contractPath: 'https://github.com/JoinColony/colonyNetwork/blob/glider-rc.3/contracts/extensions/OneTxPayment.sol',
version: 'glider',
},
>;
/*
Mint new tokens. This function can only be called if the address of the colony contract is the owner of the token contract. If this is the case, then this function can only be called by the address assigned the colony `ROOT` role.
*/
mintTokens: ColonyClient.Sender<
{
amount: BigNumber, // The amount of new tokens that will be minted.
},
{
Mint: Mint,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Mint tokens for the Colony Network. This can only be called from the Meta Colony and only by the address assigned the colony `ROOT` role.
*/
mintTokensForColonyNetwork: ColonyClient.Sender<
{
amount: BigNumber, // The amount of new tokens that will be minted.
},
{
Mint: Mint,
Transfer: Transfer,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IMetaColony.sol',
version: 'glider',
},
>;
/*
Move funds from one pot to another.
*/
moveFundsBetweenPots: ColonyClient.Sender<
{
fromPot: number, // The ID of the pot from which funds will be moved.
toPot: number, // The ID of the pot to which funds will be moved.
amount: BigNumber, // The amount of funds that will be moved between pots.
token: AnyAddress, // The address of the token contract (an empty address if Ether).
},
{
ColonyFundsMovedBetweenFundingPots: ColonyFundsMovedBetweenFundingPots,
},
ColonyClient,
{
contract: 'ColonyFunding.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Register an ENS label for the colony.
*/
registerColonyLabel: ColonyClient.Sender<
{
colonyName: string, // The ENS label that will be registered for the colony.
orbitDBPath: ?string, // The path of the OrbitDB database associated with the colony.
},
{
ColonyLabelRegistered: ColonyLabelRegistered,
},
ColonyClient,
{
contract: 'Colony.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Remove an extension contract.
*/
removeExtension: ColonyClient.Sender<
{
contractName: string, // The name of the extension contract (`OneTxPayment` or `OldRoles`).
},
{},
ColonyClient,
{
version: 'glider',
},
>;
/*
Remove the colony `RECOVERY` role from an address. This function can only be called by the colony `ROOT` role.
*/
removeRecoveryRole: ColonyClient.Sender<
{
address: Address, // The address that will be unassigned the colony `RECOVERY` role.
},
{},
ColonyClient,
{
contract: 'ContractRecovery.sol',
interface: 'IRecovery.sol',
version: 'glider',
},
>;
/*
Remove the task `EVALUATOR` role from an address. This function can only be called before the task is complete, i.e. either before the deliverable has been submitted or the address assigned the task `WORKER` role has failed to meet the deadline and the address assigned the task `MANAGER` role has marked the task as complete.
*/
removeTaskEvaluatorRole: ColonyClient.MultisigSender<
{
taskId: number, // The ID of the task.
},
{
TaskRoleUserSet: TaskRoleUserSet,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Remove the task `WORKER` role from an address. This function can only be called before the task is complete, i.e. either before the deliverable has been submitted or the address assigned the task `WORKER` role has failed to meet the deadline and the address assigned the task `MANAGER` role has marked the task as complete.
*/
removeTaskWorkerRole: ColonyClient.MultisigSender<
{
taskId: number, // The ID of the task.
},
{
TaskRoleUserSet: TaskRoleUserSet,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Reveal a submitted work rating. In order to reveal a work rating, the same `salt` and `value` used to generate the `secret` when the task work rating was submitted must be provided again here to reveal the task work rating.
*/
revealTaskWorkRating: ColonyClient.Sender<
{
taskId: number, // The ID of the task.
role: TaskRole, // The role that received the rating (`MANAGER` or `WORKER`).
rating: number, // The rating that was submitted (`1`, `2`, or `3`).
salt: string, // The string that was used to generate the secret.
},
{
TaskWorkRatingRevealed: TaskWorkRatingRevealed,
},
ColonyClient,
{
contract: 'ColonyTask.sol',
interface: 'IColony.sol',
version: 'glider',
},
>;
/*
Assign the colony `ADMIN` role to an address. This function is not included in the core contracts but instead it comes from the `OldRoles` extension contract. This function can only be called by an address assigned the colony `ROOT` (`FOUNDER`) role or an address assigned the colony `ADMIN` (`ARCHITECTURE`) role. There is no limit to the number of addresses that can be assigned the colony `ADMIN` role.
*/
setAdminRole: ColonyClient.Sender<
{
address: Address, // The address that will be assigned the colony `ADMIN` role.
setTo: boolean, // A boolean indicating whether the address will be assigned or unassigned the colony `ADMIN` role.
},
{
ColonyRoleSet: ColonyRoleSet,
},
ColonyClient,
{
contract: 'OldRoles.sol',
// eslint-disable-next-line max-len
contractPath: 'https://github.com/JoinColony/colonyNetwork/blob/glider-rc.3/contracts/extensions/OldRoles.sol',
version: 'glider',
},
>;
/*
Assign the colony `ADMINISTRATION` role to an address. The address calling the method must have permission within the domain that permission is being granted or a parent domain to the domain that permission is being granted. The address calling the method must already be assigned either the colony `ROOT` or `ARCHITECTURE` role within the domain or parent domain.
*/
setAdministrationRole: ColonyClient.Sender<
{
address: Address,