/** * Copyright 2017–2019, LaborX PTY * Licensed under the AGPL Version 3 license. */ pragma solidity ^0.4.25; interface WorkflowBase { /// @param _contractHost smart contract address that will be requested for payments function registerContract(bytes32 _contractId, address _contractHost) external returns (uint); function addWorkflowData( bytes32 _contractId, address _contractHost, bytes _data ) external returns (uint _budget, uint _upfront); function precalculateWorkflowData( bytes32 _contractId, address _contractHost, bytes _data ) external view returns (uint _budget, uint _upfront); /// @notice Gets upfront amount from tasks that have not been finished (completed) yet /// @param _contractId contract identifier /// @param _contractHost contract smart contract address function getUnspentUpfrontAmount(bytes32 _contractId, address _contractHost) external view returns (uint); } interface WorkflowContractBlacklistable { function isAllowedContractHost(address _contractHost) external view returns (bool); function addContractHost(address _contractHost) external returns (uint); function removeContractHost(address _contractHost) external returns (uint); } interface WorkflowCheckpointBase { /// @notice Gets numbers of how much employer will pay for a task `_taskId` in contract `_contractId` at `_contract` /// @param _contractId contract ID /// @param _contract address of a smart contract /// @param _taskId task ID to confirm to /// @param _skippedPenalties penalty IDs that will be skipped during payment calculations /// @return _totalValue how much task costs /// @return _paymentValue how much should be paid immediately /// @return _depositValue how much should be additionally deposited function getTaskCompletionReward( bytes32 _contractId, address _contract, uint32 _taskId, uint32[] _skippedPenalties ) public view returns ( uint _totalValue, uint _paymentValue, uint _depositValue, uint _paidValue ); /// @dev Gets task details. /// @return /// @return _values[0] budget amount /// @return _values[1] paid amount /// @return _values[2] upfront amount /// @return _values[3] withdraw fee amount of paid amount function getTaskDetails( bytes32 _contractId, address _contract, uint32 _taskId ) external view returns (uint[] _values); function getTaskCompletionRewardWithoutPenalties( bytes32 _contractId, address _contract, uint32 _taskId ) public view returns ( uint _totalValue, uint _paymentValue, uint _depositValue, uint _paidValue ); /// @notice Gets numbers of how much should be additionally deposited to the assignee received `_value` /// @param _contractId contract ID /// @param _contract address of a smart contract /// @param _value how much should be paid immediately /// @return _paymentValue how much should be paid immediately /// @return _depositValue how much should be additionally deposited function getTaskSinglePaymentReward( bytes32 _contractId, address _contract, uint _value ) public view returns (uint _paymentValue, uint _depositValue); function startTask(bytes32 _contractId, address _contract, uint32 _taskId) external returns (uint); function pauseTask(bytes32 _contractId, address _contract, uint32 _taskId) external returns (uint); function resumeTask(bytes32 _contractId, address _contract, uint32 _taskId) external returns (uint); /// @notice Prepaid expense to the assignee for task `_taskId` in context of contract `_contractId`. /// Assignee's penalties will not be applied to payment value. /// Employer should provide signature for releasing buyer's value from 'EscrowBaseInterface#releaseBuyerPayment' /// @param _contractId contract ID /// @param _contract address of a smart contract /// @param _taskId task ID for payment /// @param _expireAtBlock bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _salt bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _signature signature for releasing blocked amount. See 'EscrowBaseInterface#releaseBuyerPayment' /// @return result code of an operation function payPartialTaskExpenses( bytes32 _contractId, address _contract, uint32 _taskId, uint _value, uint _expireAtBlock, uint _salt, bytes _signature ) external payable returns (uint); /// @notice Confirms task `_taskId` completion in context of contract `_contractId` and frees /// budget to be send to the assignee. /// Assignee's penalties will not be applied to the final paycheck. /// Employer should provide signature for releasing buyer's value from 'EscrowBaseInterface#releaseBuyerPayment' /// @param _contractId contract ID /// @param _contract address of a smart contract /// @param _taskId task ID to confirm to /// @param _expireAtBlock bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _salt bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _signature signature for releasing blocked amount. See 'EscrowBaseInterface#releaseBuyerPayment' /// @return result code of an operation function completeTaskAndPay( bytes32 _contractId, address _contract, uint32 _taskId, uint _expireAtBlock, uint _salt, bytes _signature ) external payable returns (uint); function completeTask(bytes32 _contractId, address _contract, uint32 _taskId) external returns (uint); /// @notice Confirms task `_taskId` completion in context of contract `_contractId` and frees /// budget to be send to the assignee. /// Assignee's penalties could be skipped and they will not be applied to the final paycheck. /// Employer should provide signature for releasing buyer's value from 'EscrowBaseInterface#releaseBuyerPayment' /// @param _contractId contract ID /// @param _contract address of a smart contract /// @param _taskId task ID to confirm to /// @param _skippedPenalties penalty IDs that will be skipped during payment calculations /// @param _expireAtBlock bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _salt bound with signature. See 'EscrowBaseInterface#releaseBuyerPayment' /// @param _signature signature for releasing blocked amount. See 'EscrowBaseInterface#releaseBuyerPayment' /// @return result code of an operation function confirmTaskCompletion( bytes32 _contractId, address _contract, uint32 _taskId, uint32[] _skippedPenalties, uint _expireAtBlock, uint _salt, bytes _signature ) external payable returns (uint); function declineTaskAndSendToRework( bytes32 _contractId, address _contract, uint32 _taskId, string _reason ) external returns (uint); }