Skip to content

Latest commit

 

History

History
1212 lines (861 loc) · 24.5 KB

index.md

File metadata and controls

1212 lines (861 loc) · 24.5 KB

Solidity API

IexecLibCore_v5

Account

Tools

struct Account {
  uint256 stake;
  uint256 locked;
}

Category

struct Category {
  string name;
  string description;
  uint256 workClockTimeRef;
}

Resource

Clerk - Deals

struct Resource {
  address pointer;
  address owner;
  uint256 price;
}

Deal

struct Deal {
  struct IexecLibCore_v5.Resource app;
  struct IexecLibCore_v5.Resource dataset;
  struct IexecLibCore_v5.Resource workerpool;
  uint256 trust;
  uint256 category;
  bytes32 tag;
  address requester;
  address beneficiary;
  address callback;
  string params;
  uint256 startTime;
  uint256 botFirst;
  uint256 botSize;
  uint256 workerStake;
  uint256 schedulerRewardRatio;
  address sponsor;
}

DealBoost

Simplified deals for PoCo Boost module.

struct DealBoost {
  address appOwner;
  uint96 appPrice;
  address datasetOwner;
  uint96 datasetPrice;
  address workerpoolOwner;
  uint96 workerpoolPrice;
  address requester;
  uint96 workerReward;
  address callback;
  uint40 deadline;
  uint16 botFirst;
  uint16 botSize;
  bytes3 shortTag;
  address sponsor;
}

TaskStatusEnum

Tasks

enum TaskStatusEnum {
  UNSET,
  ACTIVE,
  REVEALING,
  COMPLETED,
  FAILED
}

Task

struct Task {
  enum IexecLibCore_v5.TaskStatusEnum status;
  bytes32 dealid;
  uint256 idx;
  uint256 timeref;
  uint256 contributionDeadline;
  uint256 revealDeadline;
  uint256 finalDeadline;
  bytes32 consensusValue;
  uint256 revealCounter;
  uint256 winnerCounter;
  address[] contributors;
  bytes32 resultDigest;
  bytes results;
  uint256 resultsTimestamp;
  bytes resultsCallback;
}

Consensus

Consensus

struct Consensus {
  mapping(bytes32 => uint256) group;
  uint256 total;
}

ContributionStatusEnum

Consensus

enum ContributionStatusEnum {
  UNSET,
  CONTRIBUTED,
  PROVED,
  REJECTED
}

Contribution

struct Contribution {
  enum IexecLibCore_v5.ContributionStatusEnum status;
  bytes32 resultHash;
  bytes32 resultSeal;
  address enclaveChallenge;
  uint256 weight;
}

IexecLibOrders_v5

EIP712DOMAIN_TYPEHASH

bytes32 EIP712DOMAIN_TYPEHASH

APPORDER_TYPEHASH

bytes32 APPORDER_TYPEHASH

DATASETORDER_TYPEHASH

bytes32 DATASETORDER_TYPEHASH

WORKERPOOLORDER_TYPEHASH

bytes32 WORKERPOOLORDER_TYPEHASH

REQUESTORDER_TYPEHASH

bytes32 REQUESTORDER_TYPEHASH

APPORDEROPERATION_TYPEHASH

bytes32 APPORDEROPERATION_TYPEHASH

DATASETORDEROPERATION_TYPEHASH

bytes32 DATASETORDEROPERATION_TYPEHASH

WORKERPOOLORDEROPERATION_TYPEHASH

bytes32 WORKERPOOLORDEROPERATION_TYPEHASH

REQUESTORDEROPERATION_TYPEHASH

bytes32 REQUESTORDEROPERATION_TYPEHASH

OrderOperationEnum

enum OrderOperationEnum {
  SIGN,
  CLOSE
}

EIP712Domain

struct EIP712Domain {
  string name;
  string version;
  uint256 chainId;
  address verifyingContract;
}

AppOrder

struct AppOrder {
  address app;
  uint256 appprice;
  uint256 volume;
  bytes32 tag;
  address datasetrestrict;
  address workerpoolrestrict;
  address requesterrestrict;
  bytes32 salt;
  bytes sign;
}

DatasetOrder

struct DatasetOrder {
  address dataset;
  uint256 datasetprice;
  uint256 volume;
  bytes32 tag;
  address apprestrict;
  address workerpoolrestrict;
  address requesterrestrict;
  bytes32 salt;
  bytes sign;
}

WorkerpoolOrder

struct WorkerpoolOrder {
  address workerpool;
  uint256 workerpoolprice;
  uint256 volume;
  bytes32 tag;
  uint256 category;
  uint256 trust;
  address apprestrict;
  address datasetrestrict;
  address requesterrestrict;
  bytes32 salt;
  bytes sign;
}

RequestOrder

struct RequestOrder {
  address app;
  uint256 appmaxprice;
  address dataset;
  uint256 datasetmaxprice;
  address workerpool;
  uint256 workerpoolmaxprice;
  address requester;
  uint256 volume;
  bytes32 tag;
  uint256 category;
  uint256 trust;
  address beneficiary;
  address callback;
  string params;
  bytes32 salt;
  bytes sign;
}

AppOrderOperation

struct AppOrderOperation {
  struct IexecLibOrders_v5.AppOrder order;
  enum IexecLibOrders_v5.OrderOperationEnum operation;
  bytes sign;
}

DatasetOrderOperation

struct DatasetOrderOperation {
  struct IexecLibOrders_v5.DatasetOrder order;
  enum IexecLibOrders_v5.OrderOperationEnum operation;
  bytes sign;
}

WorkerpoolOrderOperation

struct WorkerpoolOrderOperation {
  struct IexecLibOrders_v5.WorkerpoolOrder order;
  enum IexecLibOrders_v5.OrderOperationEnum operation;
  bytes sign;
}

RequestOrderOperation

struct RequestOrderOperation {
  struct IexecLibOrders_v5.RequestOrder order;
  enum IexecLibOrders_v5.OrderOperationEnum operation;
  bytes sign;
}

hash

function hash(struct IexecLibOrders_v5.EIP712Domain _domain) public pure returns (bytes32 domainhash)

hash

function hash(struct IexecLibOrders_v5.AppOrder _apporder) public pure returns (bytes32 apphash)

hash

function hash(struct IexecLibOrders_v5.DatasetOrder _datasetorder) public pure returns (bytes32 datasethash)

hash

function hash(struct IexecLibOrders_v5.WorkerpoolOrder _workerpoolorder) public pure returns (bytes32 workerpoolhash)

hash

function hash(struct IexecLibOrders_v5.RequestOrder _requestorder) public pure returns (bytes32 requesthash)

hash

function hash(struct IexecLibOrders_v5.AppOrderOperation _apporderoperation) public pure returns (bytes32)

hash

function hash(struct IexecLibOrders_v5.DatasetOrderOperation _datasetorderoperation) public pure returns (bytes32)

hash

function hash(struct IexecLibOrders_v5.WorkerpoolOrderOperation _workerpoolorderoperation) public pure returns (bytes32)

hash

function hash(struct IexecLibOrders_v5.RequestOrderOperation _requestorderoperation) public pure returns (bytes32)

DelegateBase

Every module must inherit from this contract.

IexecOrderManagementDelegate

manageAppOrder

function manageAppOrder(struct IexecLibOrders_v5.AppOrderOperation _apporderoperation) external

manageDatasetOrder

function manageDatasetOrder(struct IexecLibOrders_v5.DatasetOrderOperation _datasetorderoperation) external

manageWorkerpoolOrder

function manageWorkerpoolOrder(struct IexecLibOrders_v5.WorkerpoolOrderOperation _workerpoolorderoperation) external

manageRequestOrder

function manageRequestOrder(struct IexecLibOrders_v5.RequestOrderOperation _requestorderoperation) external

IexecEscrow

Transfer

event Transfer(address from, address to, uint256 value)

Lock

event Lock(address owner, uint256 amount)

Unlock

event Unlock(address owner, uint256 amount)

Reward

event Reward(address owner, uint256 amount, bytes32 ref)

Seize

event Seize(address owner, uint256 amount, bytes32 ref)

Matching

struct Matching {
  bytes32 apporderHash;
  address appOwner;
  bytes32 datasetorderHash;
  address datasetOwner;
  bytes32 workerpoolorderHash;
  address workerpoolOwner;
  bytes32 requestorderHash;
  bool hasDataset;
}

IexecPoco1Delegate

verifySignature

function verifySignature(address _identity, bytes32 _hash, bytes _signature) external view returns (bool)

verifyPresignature

function verifyPresignature(address _identity, bytes32 _hash) external view returns (bool)

verifyPresignatureOrSignature

function verifyPresignatureOrSignature(address _identity, bytes32 _hash, bytes _signature) external view returns (bool)

matchOrders

function matchOrders(struct IexecLibOrders_v5.AppOrder _apporder, struct IexecLibOrders_v5.DatasetOrder _datasetorder, struct IexecLibOrders_v5.WorkerpoolOrder _workerpoolorder, struct IexecLibOrders_v5.RequestOrder _requestorder) external returns (bytes32)

Match orders. The requester gets debited.

Parameters

Name Type Description
_apporder struct IexecLibOrders_v5.AppOrder The app order.
_datasetorder struct IexecLibOrders_v5.DatasetOrder The dataset order.
_workerpoolorder struct IexecLibOrders_v5.WorkerpoolOrder The workerpool order.
_requestorder struct IexecLibOrders_v5.RequestOrder The requester order.

sponsorMatchOrders

function sponsorMatchOrders(struct IexecLibOrders_v5.AppOrder _apporder, struct IexecLibOrders_v5.DatasetOrder _datasetorder, struct IexecLibOrders_v5.WorkerpoolOrder _workerpoolorder, struct IexecLibOrders_v5.RequestOrder _requestorder) external returns (bytes32)

Sponsor match orders for a requester. Unlike the standard matchOrders(..) hook where the requester pays for the deal, this current hook makes it possible for any msg.sender to pay for a third party requester.

Be aware that anyone seeing a valid request order on the network (via an off-chain public marketplace, via a sponsorMatchOrders(..) pending transaction in the mempool or by any other means) might decide to call the standard matchOrders(..) hook which will result in the requester being debited instead. Therefore, such a front run would result in a loss of some of the requester funds deposited in the iExec account (a loss value equivalent to the price of the deal).

Parameters

Name Type Description
_apporder struct IexecLibOrders_v5.AppOrder The app order.
_datasetorder struct IexecLibOrders_v5.DatasetOrder The dataset order.
_workerpoolorder struct IexecLibOrders_v5.WorkerpoolOrder The workerpool order.
_requestorder struct IexecLibOrders_v5.RequestOrder The requester order.

IexecPoco2Delegate

initialize

function initialize(bytes32 _dealid, uint256 idx) public returns (bytes32)

contribute

function contribute(bytes32 _taskid, bytes32 _resultHash, bytes32 _resultSeal, address _enclaveChallenge, bytes _enclaveSign, bytes _authorizationSign) external

contributeAndFinalize

function contributeAndFinalize(bytes32 _taskid, bytes32 _resultDigest, bytes _results, bytes _resultsCallback, address _enclaveChallenge, bytes _enclaveSign, bytes _authorizationSign) external

reveal

function reveal(bytes32 _taskid, bytes32 _resultDigest) external

reopen

function reopen(bytes32 _taskid) external

finalize

function finalize(bytes32 _taskid, bytes _results, bytes _resultsCallback) external

claim

function claim(bytes32 _taskid) public

initializeArray

function initializeArray(bytes32[] _dealid, uint256[] _idx) external returns (bool)

claimArray

function claimArray(bytes32[] _taskid) external returns (bool)

initializeAndClaimArray

function initializeAndClaimArray(bytes32[] _dealid, uint256[] _idx) external returns (bool)

IexecPocoAccessorsDelegate

viewDeal

function viewDeal(bytes32 id) external view returns (struct IexecLibCore_v5.Deal deal)

Get a deal created by PoCo module.

Parameters

Name Type Description
id bytes32 The ID of the deal.

viewTask

function viewTask(bytes32 id) external view returns (struct IexecLibCore_v5.Task)

Get task created in Classic mode.

Parameters

Name Type Description
id bytes32 id of the task

computeDealVolume

function computeDealVolume(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external view returns (uint256)

Computes the volume of the "not yet created" deal based on the provided orders. This function should only be used if the deal is not yet created. For existing deals, use the deal accessors instead.

Parameters

Name Type Description
appOrder struct IexecLibOrders_v5.AppOrder The application order.
datasetOrder struct IexecLibOrders_v5.DatasetOrder The dataset order.
workerpoolOrder struct IexecLibOrders_v5.WorkerpoolOrder The workerpool order.
requestOrder struct IexecLibOrders_v5.RequestOrder The request order.

Return Values

Name Type Description
[0] uint256 The computed deal volume.

IexecPocoCommonDelegate

IexecPocoBoostAccessorsDelegate

Access to PoCo Boost tasks must be done with PoCo Classic IexecAccessors.

viewDealBoost

function viewDealBoost(bytes32 id) external view returns (struct IexecLibCore_v5.DealBoost deal)

Get a deal created by PoCo Boost module.

Parameters

Name Type Description
id bytes32 The ID of the deal.

IexecPocoBoostDelegate

Works for deals with requested trust = 0.

matchOrdersBoost

function matchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)

This boost match orders is only compatible with trust <= 1. The requester gets debited.

Parameters

Name Type Description
appOrder struct IexecLibOrders_v5.AppOrder The order signed by the application developer.
datasetOrder struct IexecLibOrders_v5.DatasetOrder The order signed by the dataset provider.
workerpoolOrder struct IexecLibOrders_v5.WorkerpoolOrder The order signed by the workerpool manager.
requestOrder struct IexecLibOrders_v5.RequestOrder The order signed by the requester.

Return Values

Name Type Description
[0] bytes32 The ID of the deal.

sponsorMatchOrdersBoost

function sponsorMatchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)

Sponsor match orders boost for a requester. Unlike the standard matchOrdersBoost(..) hook where the requester pays for the deal, this current hook makes it possible for any msg.sender to pay for a third party requester.

Be aware that anyone seeing a valid request order on the network (via an off-chain public marketplace, via a sponsorMatchOrdersBoost(..) pending transaction in the mempool or by any other means) might decide to call the standard matchOrdersBoost(..) hook which will result in the requester being debited instead. Therefore, such a front run would result in a loss of some of the requester funds deposited in the iExec account (a loss value equivalent to the price of the deal).

Parameters

Name Type Description
appOrder struct IexecLibOrders_v5.AppOrder The app order.
datasetOrder struct IexecLibOrders_v5.DatasetOrder The dataset order.
workerpoolOrder struct IexecLibOrders_v5.WorkerpoolOrder The workerpool order.
requestOrder struct IexecLibOrders_v5.RequestOrder The requester order.

pushResultBoost

function pushResultBoost(bytes32 dealId, uint256 index, bytes results, bytes resultsCallback, bytes authorizationSign, address enclaveChallenge, bytes enclaveSign) external

Accept results of a task computed by a worker during Boost workflow.

Parameters

Name Type Description
dealId bytes32 The id of the target deal.
index uint256 The index of the target task of the deal.
results bytes The results of the task computed by the worker.
resultsCallback bytes The results of the task computed by the worker that will be forwarded as call data to the callback address set by the requester.
authorizationSign bytes The authorization signed by the scheduler. authorizing the worker to push a result.
enclaveChallenge address The enclave address which can produce enclave signature.
enclaveSign bytes The signature generated from the enclave.

claimBoost

function claimBoost(bytes32 dealId, uint256 index) external

Claim task to get a refund if task is not completed after deadline.

Parameters

Name Type Description
dealId bytes32 The ID of the deal.
index uint256 The index of the task.

DelegateBase

ENSIntegrationDelegate

setName

function setName(address _ens, string _name) external

IexecAccessorsDelegate

name

function name() external view returns (string)

symbol

function symbol() external view returns (string)

decimals

function decimals() external view returns (uint8)

totalSupply

function totalSupply() external view returns (uint256)

balanceOf

function balanceOf(address account) external view returns (uint256)

frozenOf

function frozenOf(address account) external view returns (uint256)

allowance

function allowance(address account, address spender) external view returns (uint256)

viewAccount

function viewAccount(address account) external view returns (struct IexecLibCore_v5.Account)

token

function token() external view returns (address)

viewDeal

function viewDeal(bytes32 _id) external view returns (struct IexecLibCore_v5.Deal deal)

viewConsumed

function viewConsumed(bytes32 _id) external view returns (uint256 consumed)

viewPresigned

function viewPresigned(bytes32 _id) external view returns (address signer)

viewTask

function viewTask(bytes32 _taskid) external view returns (struct IexecLibCore_v5.Task)

viewContribution

function viewContribution(bytes32 _taskid, address _worker) external view returns (struct IexecLibCore_v5.Contribution)

viewScore

function viewScore(address _worker) external view returns (uint256)

resultFor

function resultFor(bytes32 id) external view returns (bytes)

viewCategory

function viewCategory(uint256 _catid) external view returns (struct IexecLibCore_v5.Category category)

countCategory

function countCategory() external view returns (uint256 count)

appregistry

function appregistry() external view returns (contract IRegistry)

datasetregistry

function datasetregistry() external view returns (contract IRegistry)

workerpoolregistry

function workerpoolregistry() external view returns (contract IRegistry)

teebroker

function teebroker() external view returns (address)

callbackgas

function callbackgas() external view returns (uint256)

contribution_deadline_ratio

function contribution_deadline_ratio() external view returns (uint256)

reveal_deadline_ratio

function reveal_deadline_ratio() external view returns (uint256)

final_deadline_ratio

function final_deadline_ratio() external view returns (uint256)

workerpool_stake_ratio

function workerpool_stake_ratio() external view returns (uint256)

kitty_ratio

function kitty_ratio() external view returns (uint256)

kitty_min

function kitty_min() external view returns (uint256)

kitty_address

function kitty_address() external view returns (address)

groupmember_purpose

function groupmember_purpose() external view returns (uint256)

eip712domain_separator

function eip712domain_separator() external view returns (bytes32)

IexecCategoryManagerDelegate

createCategory

function createCategory(string name, string description, uint256 workClockTimeRef) external returns (uint256)

Methods

IexecERC20Core

Transfer

event Transfer(address from, address to, uint256 value)

Approval

event Approval(address owner, address spender, uint256 value)

IexecERC20Delegate

transfer

function transfer(address recipient, uint256 amount) external returns (bool)

approve

function approve(address spender, uint256 value) external returns (bool)

approveAndCall

function approveAndCall(address spender, uint256 value, bytes extraData) external returns (bool)

transferFrom

function transferFrom(address sender, address recipient, uint256 amount) external returns (bool)

increaseAllowance

function increaseAllowance(address spender, uint256 addedValue) external returns (bool)

decreaseAllowance

function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool)

IexecEscrowNativeDelegate

receive

receive() external payable

fallback

fallback() external payable

deposit

function deposit() external payable returns (bool)

depositFor

function depositFor(address target) external payable returns (bool)

depositForArray

function depositForArray(uint256[] amounts, address[] targets) external payable returns (bool)

withdraw

function withdraw(uint256 amount) external returns (bool)

withdrawTo

function withdrawTo(uint256 amount, address target) external returns (bool)

recover

function recover() external returns (uint256)

IexecEscrowTokenDelegate

receive

receive() external payable

fallback

fallback() external payable

deposit

function deposit(uint256 amount) external returns (bool)

depositFor

function depositFor(uint256 amount, address target) external returns (bool)

depositForArray

function depositForArray(uint256[] amounts, address[] targets) external returns (bool)

withdraw

function withdraw(uint256 amount) external returns (bool)

withdrawTo

function withdrawTo(uint256 amount, address target) external returns (bool)

recover

function recover() external returns (uint256)

receiveApproval

function receiveApproval(address sender, uint256 amount, address token, bytes) external returns (bool)

IexecMaintenanceDelegate

configure

function configure(address _token, string _name, string _symbol, uint8 _decimal, address _appregistryAddress, address _datasetregistryAddress, address _workerpoolregistryAddress, address _v3_iexecHubAddress) external

domain

function domain() external view returns (struct IexecLibOrders_v5.EIP712Domain)

updateDomainSeparator

function updateDomainSeparator() external

importScore

function importScore(address _worker) external

setTeeBroker

function setTeeBroker(address _teebroker) external

setCallbackGas

function setCallbackGas(uint256 _callbackgas) external

IexecMaintenanceExtraDelegate

changeRegistries

function changeRegistries(address _appregistryAddress, address _datasetregistryAddress, address _workerpoolregistryAddress) external

IexecRelayDelegate

broadcastAppOrder

function broadcastAppOrder(struct IexecLibOrders_v5.AppOrder _apporder) external

broadcastDatasetOrder

function broadcastDatasetOrder(struct IexecLibOrders_v5.DatasetOrder _datasetorder) external

broadcastWorkerpoolOrder

function broadcastWorkerpoolOrder(struct IexecLibOrders_v5.WorkerpoolOrder _workerpoolorder) external

broadcastRequestOrder

function broadcastRequestOrder(struct IexecLibOrders_v5.RequestOrder _requestorder) external