From c335a0cf60f11ba1ce8ef9362a4f2f2abd79a232 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 14:51:37 +0200 Subject: [PATCH 01/17] refactor: convert IexecPocoCommon to the DealVolumeLib library The abstract contract was a stateless helper over diamond storage that used nothing from FacetBase, so inheriting it forced three facets into a base they did not need. A library expresses the same thing without the inheritance edge, and `internal` library functions are inlined, so the call sites keep their previous cost. The function loses its leading underscore, which marked it as internal to a contract and means nothing in a library. The two `using IexecLibOrders_v5` directives were unreferenced and are dropped. No ABI change: the contract exported no ABI entries, having only internal members. --- contracts/facets/IexecPoco1Facet.sol | 12 +++------- contracts/facets/IexecPocoAccessorsFacet.sol | 6 ++--- contracts/facets/IexecPocoBoostFacet.sol | 6 ++--- .../DealVolumeLib.sol} | 22 ++++++++----------- 4 files changed, 18 insertions(+), 28 deletions(-) rename contracts/{abstract/IexecPocoCommon.sol => libs/DealVolumeLib.sol} (71%) diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index fc49c5244..f3f024aef 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -12,7 +12,7 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {IexecPocoCommon} from "../abstract/IexecPocoCommon.sol"; +import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; struct Matching { @@ -26,13 +26,7 @@ struct Matching { bool hasDataset; } -contract IexecPoco1Facet is - IexecPoco1, - IexecPoco1Errors, - IexecEscrow, - SignatureVerifier, - IexecPocoCommon -{ +contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, SignatureVerifier { using Math for uint256; using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; @@ -379,7 +373,7 @@ contract IexecPoco1Facet is /** * Check availability */ - uint256 volume = _computeDealVolume( + uint256 volume = DealVolumeLib.computeDealVolume( _apporder.volume, ids.apporderHash, ids.hasDataset, diff --git a/contracts/facets/IexecPocoAccessorsFacet.sol b/contracts/facets/IexecPocoAccessorsFacet.sol index 1a8a5b40e..d22dbc59c 100644 --- a/contracts/facets/IexecPocoAccessorsFacet.sol +++ b/contracts/facets/IexecPocoAccessorsFacet.sol @@ -11,13 +11,13 @@ import {IApp} from "../registries/apps/IApp.v8.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol"; import {IRegistry} from "../registries/IRegistry.sol"; -import {IexecPocoCommon} from "../abstract/IexecPocoCommon.sol"; +import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; /** * @title Getters contract for PoCo facets. */ -contract IexecPocoAccessorsFacet is IexecPocoAccessors, SignatureVerifier, IexecPocoCommon { +contract IexecPocoAccessorsFacet is IexecPocoAccessors, SignatureVerifier { using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder; @@ -60,7 +60,7 @@ contract IexecPocoAccessorsFacet is IexecPocoAccessors, SignatureVerifier, Iexec IexecLibOrders_v5.RequestOrder calldata requestOrder ) external view override returns (uint256) { return - _computeDealVolume( + DealVolumeLib.computeDealVolume( appOrder.volume, _toTypedDataHash(appOrder.hash()), datasetOrder.dataset != address(0), diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index e7b5d5b10..94a671e4c 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -15,7 +15,7 @@ import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {IexecPocoCommon} from "../abstract/IexecPocoCommon.sol"; +import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; @@ -27,7 +27,7 @@ import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; * @title PoCo Boost to reduce latency and increase throughput of deals. * @notice Works for deals with requested trust = 0. */ -contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier, IexecPocoCommon { +contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { using ECDSA for bytes32; using MessageHashUtils for bytes32; using Math for uint256; @@ -268,7 +268,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier, * - but trying to use as little gas as possible * - Overflows: Solidity 0.8 has built in overflow checking */ - uint256 volume = _computeDealVolume( + uint256 volume = DealVolumeLib.computeDealVolume( appOrder.volume, appOrderTypedDataHash, hasDataset, diff --git a/contracts/abstract/IexecPocoCommon.sol b/contracts/libs/DealVolumeLib.sol similarity index 71% rename from contracts/abstract/IexecPocoCommon.sol rename to contracts/libs/DealVolumeLib.sol index ca596aade..8fb63289e 100644 --- a/contracts/abstract/IexecPocoCommon.sol +++ b/contracts/libs/DealVolumeLib.sol @@ -4,22 +4,18 @@ pragma solidity ^0.8.0; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; -import {FacetBase} from "./FacetBase.sol"; +import {PocoStorageLib} from "./PocoStorageLib.sol"; -// TODO convert to library -abstract contract IexecPocoCommon is FacetBase { +/** + * @title Compute the volume of a deal from the volumes of the orders it matches. + */ +library DealVolumeLib { using Math for uint256; - using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder; - using IexecLibOrders_v5 for IexecLibOrders_v5.RequestOrder; /** - * @notice Internal function to compute the deal volume considering the minimum - * remaining volume across all provided orders. This ensures that the deal volume - * does not exceed the available volume of any individual order. + * @notice Compute the deal volume considering the minimum remaining volume + * across all provided orders. This ensures that the deal volume does not + * exceed the available volume of any individual order. * * @param appOrderVolume The volume of the app order. * @param appOrderTypedDataHash The typed data hash of the app order. @@ -32,7 +28,7 @@ abstract contract IexecPocoCommon is FacetBase { * @param requestOrderTypedDataHash The typed data hash of the request order. * @return The minimum volume available across all orders. */ - function _computeDealVolume( + function computeDealVolume( uint256 appOrderVolume, bytes32 appOrderTypedDataHash, bool hasDataset, From 83eb716d45cdba29825996bde50277553e66e12b Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 14:54:25 +0200 Subject: [PATCH 02/17] refactor: convert SignatureVerifier to the SignatureVerificationLib library Like the deal volume helper, the abstract contract was a stateless helper over diamond storage and imposed itself as a base on five facets. A library removes that inheritance edge; `internal` library functions are inlined, so the 66 call sites keep their previous cost. The one member it did take from FacetBase, the GROUPMEMBER_PURPOSE constant, is redeclared in the library, since a library cannot inherit. The functions lose their leading underscores, which marked them as internal to a contract and mean nothing in a library. IexecPocoAccessorsFacet and IexecOrderManagementFacet reached FacetBase only through SignatureVerifier and use it (the deadline ratios, the kitty constants, _msgSender), so they now declare it directly. The other three facets still reach it through IexecEscrow. No ABI change: the contract exported no ABI entries, having only internal members. --- .../facets/IexecOrderManagementFacet.sol | 37 +++++--- contracts/facets/IexecPoco1Facet.sol | 88 +++++++++++++------ contracts/facets/IexecPoco2Facet.sol | 12 +-- contracts/facets/IexecPocoAccessorsFacet.sol | 13 +-- contracts/facets/IexecPocoBoostFacet.sol | 88 ++++++++++++++----- .../SignatureVerificationLib.sol} | 33 +++---- 6 files changed, 179 insertions(+), 92 deletions(-) rename contracts/{abstract/SignatureVerifier.sol => libs/SignatureVerificationLib.sol} (87%) diff --git a/contracts/facets/IexecOrderManagementFacet.sol b/contracts/facets/IexecOrderManagementFacet.sol index aac00b7da..5fc77af9b 100644 --- a/contracts/facets/IexecOrderManagementFacet.sol +++ b/contracts/facets/IexecOrderManagementFacet.sol @@ -4,12 +4,13 @@ pragma solidity ^0.8.0; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; -import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; +import {FacetBase} from "../abstract/FacetBase.sol"; +import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; import {IexecOrderManagement} from "../interfaces/IexecOrderManagement.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; -contract IexecOrderManagementFacet is IexecOrderManagement, SignatureVerifier { +contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder; @@ -29,15 +30,17 @@ contract IexecOrderManagementFacet is IexecOrderManagement, SignatureVerifier { address owner = IERC5313(_apporderoperation.order.app).owner(); require( owner == _msgSender() || - _verifySignature( + SignatureVerificationLib.verifySignature( owner, - _toTypedDataHash(_apporderoperation.hash()), + SignatureVerificationLib.toTypedDataHash(_apporderoperation.hash()), _apporderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 apporderHash = _toTypedDataHash(_apporderoperation.order.hash()); + bytes32 apporderHash = SignatureVerificationLib.toTypedDataHash( + _apporderoperation.order.hash() + ); if (_apporderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[apporderHash] = owner; emit SignedAppOrder(apporderHash); @@ -54,15 +57,17 @@ contract IexecOrderManagementFacet is IexecOrderManagement, SignatureVerifier { address owner = IERC5313(_datasetorderoperation.order.dataset).owner(); require( owner == _msgSender() || - _verifySignature( + SignatureVerificationLib.verifySignature( owner, - _toTypedDataHash(_datasetorderoperation.hash()), + SignatureVerificationLib.toTypedDataHash(_datasetorderoperation.hash()), _datasetorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 datasetorderHash = _toTypedDataHash(_datasetorderoperation.order.hash()); + bytes32 datasetorderHash = SignatureVerificationLib.toTypedDataHash( + _datasetorderoperation.order.hash() + ); if (_datasetorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[datasetorderHash] = owner; emit SignedDatasetOrder(datasetorderHash); @@ -79,15 +84,17 @@ contract IexecOrderManagementFacet is IexecOrderManagement, SignatureVerifier { address owner = IERC5313(_workerpoolorderoperation.order.workerpool).owner(); require( owner == _msgSender() || - _verifySignature( + SignatureVerificationLib.verifySignature( owner, - _toTypedDataHash(_workerpoolorderoperation.hash()), + SignatureVerificationLib.toTypedDataHash(_workerpoolorderoperation.hash()), _workerpoolorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 workerpoolorderHash = _toTypedDataHash(_workerpoolorderoperation.order.hash()); + bytes32 workerpoolorderHash = SignatureVerificationLib.toTypedDataHash( + _workerpoolorderoperation.order.hash() + ); if (_workerpoolorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[workerpoolorderHash] = owner; emit SignedWorkerpoolOrder(workerpoolorderHash); @@ -106,15 +113,17 @@ contract IexecOrderManagementFacet is IexecOrderManagement, SignatureVerifier { address owner = _requestorderoperation.order.requester; require( owner == _msgSender() || - _verifySignature( + SignatureVerificationLib.verifySignature( owner, - _toTypedDataHash(_requestorderoperation.hash()), + SignatureVerificationLib.toTypedDataHash(_requestorderoperation.hash()), _requestorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 requestorderHash = _toTypedDataHash(_requestorderoperation.order.hash()); + bytes32 requestorderHash = SignatureVerificationLib.toTypedDataHash( + _requestorderoperation.order.hash() + ); if (_requestorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[requestorderHash] = owner; emit SignedRequestOrder(requestorderHash); diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index f3f024aef..c6eef9b77 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -13,7 +13,7 @@ import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; -import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; +import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; struct Matching { bytes32 apporderHash; @@ -26,7 +26,7 @@ struct Matching { bool hasDataset; } -contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, SignatureVerifier { +contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { using Math for uint256; using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; @@ -41,14 +41,14 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return _verifySignature(_identity, _hash, _signature); + return SignatureVerificationLib.verifySignature(_identity, _hash, _signature); } function verifyPresignature( address _identity, bytes32 _hash ) external view override returns (bool) { - return _verifyPresignature(_identity, _hash); + return SignatureVerificationLib.verifyPresignature(_identity, _hash); } function verifyPresignatureOrSignature( @@ -56,7 +56,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return _verifySignatureOrPresignature(_identity, _hash, _signature); + return SignatureVerificationLib.verifySignatureOrPresignature(_identity, _hash, _signature); } /** @@ -79,7 +79,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature bytes32 dealId ) external view override { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - bytes32 datasetOrderHash = _toTypedDataHash(datasetOrder.hash()); + bytes32 datasetOrderHash = SignatureVerificationLib.toTypedDataHash(datasetOrder.hash()); // Check if dataset order is not revoked or fully consumed. // Note: This should be the first check because it is the most important // and the most likely to occur (users revoking their dataset orders). @@ -88,7 +88,13 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature } // Check dataset order signature (including presign and ERC-1271). address datasetOwner = IERC5313(datasetOrder.dataset).owner(); - if (!_verifySignatureOrPresignature(datasetOwner, datasetOrderHash, datasetOrder.sign)) { + if ( + !SignatureVerificationLib.verifySignatureOrPresignature( + datasetOwner, + datasetOrderHash, + datasetOrder.sign + ) + ) { revert IncompatibleDatasetOrder("Invalid dataset order signature"); } // The deal should exist. @@ -101,12 +107,17 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature revert IncompatibleDatasetOrder("Deal already has a dataset"); } // The deal's app should be allowed by order restriction. - if (!_isAccountAuthorizedByRestriction(datasetOrder.apprestrict, deal.app.pointer)) { + if ( + !SignatureVerificationLib.isAccountAuthorizedByRestriction( + datasetOrder.apprestrict, + deal.app.pointer + ) + ) { revert IncompatibleDatasetOrder("App restriction not satisfied"); } // The deal's workerpool should be allowed by order restriction. if ( - !_isAccountAuthorizedByRestriction( + !SignatureVerificationLib.isAccountAuthorizedByRestriction( datasetOrder.workerpoolrestrict, deal.workerpool.pointer ) @@ -114,7 +125,12 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature revert IncompatibleDatasetOrder("Workerpool restriction not satisfied"); } // The deal's requester should be allowed by order restriction. - if (!_isAccountAuthorizedByRestriction(datasetOrder.requesterrestrict, deal.requester)) { + if ( + !SignatureVerificationLib.isAccountAuthorizedByRestriction( + datasetOrder.requesterrestrict, + deal.requester + ) + ) { revert IncompatibleDatasetOrder("Requester restriction not satisfied"); } // The deal's tag should include all activated tag bits of the dataset order. @@ -247,58 +263,70 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature require(_requestorder.app == _apporder.app, "iExecV5-matchOrders-0x10"); require(_requestorder.dataset == _datasetorder.dataset, "iExecV5-matchOrders-0x11"); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _requestorder.workerpool, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x12" ); // requestorder.workerpool is a restriction require( - _isAccountAuthorizedByRestriction(_apporder.datasetrestrict, _datasetorder.dataset), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + _apporder.datasetrestrict, + _datasetorder.dataset + ), "iExecV5-matchOrders-0x13" ); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _apporder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x14" ); require( - _isAccountAuthorizedByRestriction(_apporder.requesterrestrict, _requestorder.requester), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + _apporder.requesterrestrict, + _requestorder.requester + ), "iExecV5-matchOrders-0x15" ); require( - _isAccountAuthorizedByRestriction(_datasetorder.apprestrict, _apporder.app), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + _datasetorder.apprestrict, + _apporder.app + ), "iExecV5-matchOrders-0x16" ); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _datasetorder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x17" ); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _datasetorder.requesterrestrict, _requestorder.requester ), "iExecV5-matchOrders-0x18" ); require( - _isAccountAuthorizedByRestriction(_workerpoolorder.apprestrict, _apporder.app), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + _workerpoolorder.apprestrict, + _apporder.app + ), "iExecV5-matchOrders-0x19" ); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _workerpoolorder.datasetrestrict, _datasetorder.dataset ), "iExecV5-matchOrders-0x1a" ); require( - _isAccountAuthorizedByRestriction( + SignatureVerificationLib.isAccountAuthorizedByRestriction( _workerpoolorder.requesterrestrict, _requestorder.requester ), @@ -313,19 +341,23 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature ids.hasDataset = _datasetorder.dataset != address(0); // app - ids.apporderHash = _toTypedDataHash(_apporder.hash()); + ids.apporderHash = SignatureVerificationLib.toTypedDataHash(_apporder.hash()); ids.appOwner = IERC5313(_apporder.app).owner(); require($.m_appregistry.isRegistered(_apporder.app), "iExecV5-matchOrders-0x20"); require( - _verifySignatureOrPresignature(ids.appOwner, ids.apporderHash, _apporder.sign), + SignatureVerificationLib.verifySignatureOrPresignature( + ids.appOwner, + ids.apporderHash, + _apporder.sign + ), "iExecV5-matchOrders-0x21" ); // dataset if (ids.hasDataset) { // only check if dataset is enabled - ids.datasetorderHash = _toTypedDataHash(_datasetorder.hash()); + ids.datasetorderHash = SignatureVerificationLib.toTypedDataHash(_datasetorder.hash()); ids.datasetOwner = IERC5313(_datasetorder.dataset).owner(); require( @@ -333,7 +365,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature "iExecV5-matchOrders-0x30" ); require( - _verifySignatureOrPresignature( + SignatureVerificationLib.verifySignatureOrPresignature( ids.datasetOwner, ids.datasetorderHash, _datasetorder.sign @@ -343,7 +375,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature } // workerpool - ids.workerpoolorderHash = _toTypedDataHash(_workerpoolorder.hash()); + ids.workerpoolorderHash = SignatureVerificationLib.toTypedDataHash(_workerpoolorder.hash()); ids.workerpoolOwner = IERC5313(_workerpoolorder.workerpool).owner(); require( @@ -351,7 +383,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature "iExecV5-matchOrders-0x40" ); require( - _verifySignatureOrPresignature( + SignatureVerificationLib.verifySignatureOrPresignature( ids.workerpoolOwner, ids.workerpoolorderHash, _workerpoolorder.sign @@ -360,9 +392,9 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow, Signature ); // request - ids.requestorderHash = _toTypedDataHash(_requestorder.hash()); + ids.requestorderHash = SignatureVerificationLib.toTypedDataHash(_requestorder.hash()); require( - _verifySignatureOrPresignature( + SignatureVerificationLib.verifySignatureOrPresignature( _requestorder.requester, ids.requestorderHash, _requestorder.sign diff --git a/contracts/facets/IexecPoco2Facet.sol b/contracts/facets/IexecPoco2Facet.sol index 9028615e9..70d921867 100644 --- a/contracts/facets/IexecPoco2Facet.sol +++ b/contracts/facets/IexecPoco2Facet.sol @@ -10,9 +10,9 @@ import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IexecPoco2} from "../interfaces/IexecPoco2.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; +import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; -contract IexecPoco2Facet is IexecPoco2, IexecEscrow, SignatureVerifier { +contract IexecPoco2Facet is IexecPoco2, IexecEscrow { modifier onlyScheduler(bytes32 _taskId) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); require(_msgSender() == $.m_deals[$.m_tasks[_taskId].dealid].workerpool.owner); @@ -119,7 +119,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow, SignatureVerifier { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -131,7 +131,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow, SignatureVerifier { // Check enclave signature require( _enclaveChallenge == address(0) || - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(_resultHash, _resultSeal), _enclaveSign @@ -206,7 +206,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow, SignatureVerifier { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -218,7 +218,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow, SignatureVerifier { // Check enclave signature require( _enclaveChallenge == address(0) || - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(resultHash, resultSeal), _enclaveSign diff --git a/contracts/facets/IexecPocoAccessorsFacet.sol b/contracts/facets/IexecPocoAccessorsFacet.sol index d22dbc59c..fa922ee14 100644 --- a/contracts/facets/IexecPocoAccessorsFacet.sol +++ b/contracts/facets/IexecPocoAccessorsFacet.sol @@ -12,12 +12,13 @@ import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol"; import {IRegistry} from "../registries/IRegistry.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; -import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; +import {FacetBase} from "../abstract/FacetBase.sol"; +import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; /** * @title Getters contract for PoCo facets. */ -contract IexecPocoAccessorsFacet is IexecPocoAccessors, SignatureVerifier { +contract IexecPocoAccessorsFacet is IexecPocoAccessors, FacetBase { using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder; @@ -62,14 +63,14 @@ contract IexecPocoAccessorsFacet is IexecPocoAccessors, SignatureVerifier { return DealVolumeLib.computeDealVolume( appOrder.volume, - _toTypedDataHash(appOrder.hash()), + SignatureVerificationLib.toTypedDataHash(appOrder.hash()), datasetOrder.dataset != address(0), datasetOrder.volume, - _toTypedDataHash(datasetOrder.hash()), + SignatureVerificationLib.toTypedDataHash(datasetOrder.hash()), workerpoolOrder.volume, - _toTypedDataHash(workerpoolOrder.hash()), + SignatureVerificationLib.toTypedDataHash(workerpoolOrder.hash()), requestOrder.volume, - _toTypedDataHash(requestOrder.hash()) + SignatureVerificationLib.toTypedDataHash(requestOrder.hash()) ); } diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index 94a671e4c..af9c5e92a 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -17,7 +17,7 @@ import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; +import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; // // Not deployed yet! @@ -27,7 +27,7 @@ import {SignatureVerifier} from "../abstract/SignatureVerifier.sol"; * @title PoCo Boost to reduce latency and increase throughput of deals. * @notice Works for deals with requested trust = 0. */ -contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { +contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { using ECDSA for bytes32; using MessageHashUtils for bytes32; using Math for uint256; @@ -161,52 +161,86 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { // Check all possible restrictions. address workerpool = workerpoolOrder.workerpool; require( - _isAccountAuthorizedByRestriction(requestOrder.workerpool, workerpool), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + requestOrder.workerpool, + workerpool + ), "PocoBoost: Workerpool restricted by request order" ); require( - _isAccountAuthorizedByRestriction(appOrder.datasetrestrict, dataset), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + appOrder.datasetrestrict, + dataset + ), "PocoBoost: Dataset restricted by app order" ); require( - _isAccountAuthorizedByRestriction(appOrder.workerpoolrestrict, workerpool), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + appOrder.workerpoolrestrict, + workerpool + ), "PocoBoost: Workerpool restricted by app order" ); address requester = requestOrder.requester; require( - _isAccountAuthorizedByRestriction(appOrder.requesterrestrict, requester), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + appOrder.requesterrestrict, + requester + ), "PocoBoost: Requester restricted by app order" ); require( - _isAccountAuthorizedByRestriction(datasetOrder.apprestrict, app), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + datasetOrder.apprestrict, + app + ), "PocoBoost: App restricted by dataset order" ); require( - _isAccountAuthorizedByRestriction(datasetOrder.workerpoolrestrict, workerpool), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + datasetOrder.workerpoolrestrict, + workerpool + ), "PocoBoost: Workerpool restricted by dataset order" ); require( - _isAccountAuthorizedByRestriction(datasetOrder.requesterrestrict, requester), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + datasetOrder.requesterrestrict, + requester + ), "PocoBoost: Requester restricted by dataset order" ); require( - _isAccountAuthorizedByRestriction(workerpoolOrder.apprestrict, app), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + workerpoolOrder.apprestrict, + app + ), "PocoBoost: App restricted by workerpool order" ); require( - _isAccountAuthorizedByRestriction(workerpoolOrder.datasetrestrict, dataset), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + workerpoolOrder.datasetrestrict, + dataset + ), "PocoBoost: Dataset restricted by workerpool order" ); require( - _isAccountAuthorizedByRestriction(workerpoolOrder.requesterrestrict, requester), + SignatureVerificationLib.isAccountAuthorizedByRestriction( + workerpoolOrder.requesterrestrict, + requester + ), "PocoBoost: Requester restricted by workerpool order" ); // Check ownership, registration, and signatures for app and dataset. require($.m_appregistry.isRegistered(app), "PocoBoost: App not registered"); address appOwner = IERC5313(app).owner(); - bytes32 appOrderTypedDataHash = _toTypedDataHash(appOrder.hash()); + bytes32 appOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash(appOrder.hash()); require( - _verifySignatureOrPresignature(appOwner, appOrderTypedDataHash, appOrder.sign), + SignatureVerificationLib.verifySignatureOrPresignature( + appOwner, + appOrderTypedDataHash, + appOrder.sign + ), "PocoBoost: Invalid app order signature" ); bool hasDataset = dataset != address(0); @@ -215,9 +249,11 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { if (hasDataset) { require($.m_datasetregistry.isRegistered(dataset), "PocoBoost: Dataset not registered"); datasetOwner = IERC5313(dataset).owner(); - datasetOrderTypedDataHash = _toTypedDataHash(datasetOrder.hash()); + datasetOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( + datasetOrder.hash() + ); require( - _verifySignatureOrPresignature( + SignatureVerificationLib.verifySignatureOrPresignature( datasetOwner, datasetOrderTypedDataHash, datasetOrder.sign @@ -231,18 +267,26 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { "PocoBoost: Workerpool not registered" ); address workerpoolOwner = IERC5313(workerpool).owner(); - bytes32 workerpoolOrderTypedDataHash = _toTypedDataHash(workerpoolOrder.hash()); + bytes32 workerpoolOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( + workerpoolOrder.hash() + ); require( - _verifySignatureOrPresignature( + SignatureVerificationLib.verifySignatureOrPresignature( workerpoolOwner, workerpoolOrderTypedDataHash, workerpoolOrder.sign ), "PocoBoost: Invalid workerpool order signature" ); - bytes32 requestOrderTypedDataHash = _toTypedDataHash(requestOrder.hash()); + bytes32 requestOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( + requestOrder.hash() + ); require( - _verifySignatureOrPresignature(requester, requestOrderTypedDataHash, requestOrder.sign), + SignatureVerificationLib.verifySignatureOrPresignature( + requester, + requestOrderTypedDataHash, + requestOrder.sign + ), "PocoBoost: Invalid request order signature" ); @@ -394,7 +438,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { address workerpoolOwner = deal.workerpoolOwner; // Check scheduler or TEE broker signature require( - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( enclaveChallenge != address(0) && $.m_teebroker != address(0) ? $.m_teebroker : workerpoolOwner, @@ -407,7 +451,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow, SignatureVerifier { // Check enclave signature require( enclaveChallenge == address(0) || - _verifySignatureOfEthSignedMessage( + SignatureVerificationLib.verifySignatureOfEthSignedMessage( enclaveChallenge, abi.encodePacked( msg.sender, diff --git a/contracts/abstract/SignatureVerifier.sol b/contracts/libs/SignatureVerificationLib.sol similarity index 87% rename from contracts/abstract/SignatureVerifier.sol rename to contracts/libs/SignatureVerificationLib.sol index b7d9e2211..726c08f7a 100644 --- a/contracts/abstract/SignatureVerifier.sol +++ b/contracts/libs/SignatureVerificationLib.sol @@ -6,19 +6,23 @@ pragma solidity ^0.8.0; import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; -import {FacetBase} from "./FacetBase.sol"; import {IERC734} from "../external/interfaces/IERC734.sol"; -import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; +import {PocoStorageLib} from "./PocoStorageLib.sol"; -// TODO convert to library -abstract contract SignatureVerifier is FacetBase { +/** + * @title Verify order and contribution signatures, presignatures and restrictions. + */ +library SignatureVerificationLib { using ECDSA for bytes32; + // Used with ERC-734 Key Manager identity contract for authorization management. + uint256 private constant GROUPMEMBER_PURPOSE = 4; + /** * Hash a Typed Data using the configured domain. * @param structHash The original structure hash. */ - function _toTypedDataHash(bytes32 structHash) internal view returns (bytes32) { + function toTypedDataHash(bytes32 structHash) internal view returns (bytes32) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); return MessageHashUtils.toTypedDataHash($.m_eip712DomainSeparator, structHash); } @@ -29,13 +33,13 @@ abstract contract SignatureVerifier is FacetBase { * @param message The original message that was signed. * @param signature The signature to be verified. */ - function _verifySignatureOfEthSignedMessage( + function verifySignatureOfEthSignedMessage( address account, bytes memory message, bytes calldata signature ) internal view returns (bool) { return - _verifySignature( + verifySignature( account, MessageHashUtils.toEthSignedMessageHash(keccak256(message)), signature @@ -54,7 +58,7 @@ abstract contract SignatureVerifier is FacetBase { * @param messageHash The message hash that was signed. * @param signature The signature to be verified. */ - function _verifySignature( + function verifySignature( address account, bytes32 messageHash, bytes calldata signature @@ -88,10 +92,7 @@ abstract contract SignatureVerifier is FacetBase { * @param account The expected presigner account. * @param messageHash The message hash that was presigned. */ - function _verifyPresignature( - address account, - bytes32 messageHash - ) internal view returns (bool) { + function verifyPresignature(address account, bytes32 messageHash) internal view returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); return account != address(0) && account == $.m_presigned[messageHash]; } @@ -102,14 +103,14 @@ abstract contract SignatureVerifier is FacetBase { * @param messageHash The message hash that was signed or presigned. * @param signature The signature to be verified. Not required for a presignature. */ - function _verifySignatureOrPresignature( + function verifySignatureOrPresignature( address account, bytes32 messageHash, bytes calldata signature ) internal view returns (bool) { return - _verifyPresignature(account, messageHash) || - _verifySignature(account, messageHash, signature); + verifyPresignature(account, messageHash) || + verifySignature(account, messageHash, signature); } /** @@ -129,7 +130,7 @@ abstract contract SignatureVerifier is FacetBase { * that might whitelist a given address in a group. * @param account An address to be checked. */ - function _isAccountAuthorizedByRestriction( + function isAccountAuthorizedByRestriction( address restriction, address account ) internal view returns (bool) { From dea53ef58ac5be0084b9167d256b611199a850c5 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 14:56:56 +0200 Subject: [PATCH 03/17] chore: point the docgen exclusions and the architecture note at the new libraries The two converted helpers moved out of `contracts/abstract/`, so the docgen exclude list named files that no longer exist. Both libraries are still excluded for the same reason as before: they expose only internal members, so they would document nothing. --- .agents/context/architecture.md | 2 +- hardhat.config.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.agents/context/architecture.md b/.agents/context/architecture.md index b1c3b2f2e..3080c517d 100644 --- a/.agents/context/architecture.md +++ b/.agents/context/architecture.md @@ -7,7 +7,7 @@ - Protocol logic: `contracts/facets/*Facet.sol` - External API declarations: `contracts/interfaces/` - `contracts/IexecInterfaceToken.sol` aggregates them into the single interface downstream tools compile against -- Shared helpers: `contracts/abstract/` (`FacetBase`, `IexecPocoCommon`, `SignatureVerifier`, …) +- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`DealVolumeLib`, `SignatureVerificationLib`, …) - Storage lives in one struct accessed through `contracts/libs/PocoStorageLib.sol`, shared by every facet: **never reorder or remove an existing variable, only append**. `npm run check-storage-layout` is the CI gate. - Adding or removing a facet means editing two hand-maintained lists: `utils/proxy-tools.ts#getAllLocalFacetFunctions` (selector-to-name map used by upgrades) and the facet groups in `scripts/tools/sol-to-uml.mjs`. diff --git a/hardhat.config.ts b/hardhat.config.ts index da827a4ec..439dc6b69 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -166,12 +166,12 @@ const config: HardhatUserConfig = { outputDir: 'docs/solidity', templates: 'docs/solidity/templates', exclude: [ - 'abstract/IexecPocoCommon.sol', // contains only internal/private - 'abstract/SignatureVerifier.sol', // contains only internal/private 'external/', 'facets/IexecAccessorsABILegacyFacet.sol', // not relevant // TODO: put all events and soldoc inside interfaces and use them instead of contracts. 'interfaces/', // interesting for events but too much doc duplication if enabled + 'libs/DealVolumeLib.sol', // contains only internal/private + 'libs/SignatureVerificationLib.sol', // contains only internal/private 'tools/', 'Diamond.sol', // not relevant ], From 536364b567d5d741904b46f63d983a21e520cc6b Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:13:45 +0200 Subject: [PATCH 04/17] refactor: rename SignatureVerificationLib to SignatureLib The shorter name matches the other helper libraries and lets 29 of the 66 call sites fit back on a single line. --- .agents/context/architecture.md | 2 +- .../facets/IexecOrderManagementFacet.sol | 28 ++++---- contracts/facets/IexecPoco1Facet.sol | 57 ++++++++------- contracts/facets/IexecPoco2Facet.sol | 10 +-- contracts/facets/IexecPocoAccessorsFacet.sol | 10 +-- contracts/facets/IexecPocoBoostFacet.sol | 69 ++++++------------- ...reVerificationLib.sol => SignatureLib.sol} | 2 +- hardhat.config.ts | 2 +- 8 files changed, 74 insertions(+), 106 deletions(-) rename contracts/libs/{SignatureVerificationLib.sol => SignatureLib.sol} (99%) diff --git a/.agents/context/architecture.md b/.agents/context/architecture.md index 3080c517d..788e22339 100644 --- a/.agents/context/architecture.md +++ b/.agents/context/architecture.md @@ -7,7 +7,7 @@ - Protocol logic: `contracts/facets/*Facet.sol` - External API declarations: `contracts/interfaces/` - `contracts/IexecInterfaceToken.sol` aggregates them into the single interface downstream tools compile against -- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`DealVolumeLib`, `SignatureVerificationLib`, …) +- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`DealVolumeLib`, `SignatureLib`, …) - Storage lives in one struct accessed through `contracts/libs/PocoStorageLib.sol`, shared by every facet: **never reorder or remove an existing variable, only append**. `npm run check-storage-layout` is the CI gate. - Adding or removing a facet means editing two hand-maintained lists: `utils/proxy-tools.ts#getAllLocalFacetFunctions` (selector-to-name map used by upgrades) and the facet groups in `scripts/tools/sol-to-uml.mjs`. diff --git a/contracts/facets/IexecOrderManagementFacet.sol b/contracts/facets/IexecOrderManagementFacet.sol index 5fc77af9b..bf444ad74 100644 --- a/contracts/facets/IexecOrderManagementFacet.sol +++ b/contracts/facets/IexecOrderManagementFacet.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; import {FacetBase} from "../abstract/FacetBase.sol"; -import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; +import {SignatureLib} from "../libs/SignatureLib.sol"; import {IexecOrderManagement} from "../interfaces/IexecOrderManagement.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; @@ -30,17 +30,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_apporderoperation.order.app).owner(); require( owner == _msgSender() || - SignatureVerificationLib.verifySignature( + SignatureLib.verifySignature( owner, - SignatureVerificationLib.toTypedDataHash(_apporderoperation.hash()), + SignatureLib.toTypedDataHash(_apporderoperation.hash()), _apporderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 apporderHash = SignatureVerificationLib.toTypedDataHash( - _apporderoperation.order.hash() - ); + bytes32 apporderHash = SignatureLib.toTypedDataHash(_apporderoperation.order.hash()); if (_apporderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[apporderHash] = owner; emit SignedAppOrder(apporderHash); @@ -57,15 +55,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_datasetorderoperation.order.dataset).owner(); require( owner == _msgSender() || - SignatureVerificationLib.verifySignature( + SignatureLib.verifySignature( owner, - SignatureVerificationLib.toTypedDataHash(_datasetorderoperation.hash()), + SignatureLib.toTypedDataHash(_datasetorderoperation.hash()), _datasetorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 datasetorderHash = SignatureVerificationLib.toTypedDataHash( + bytes32 datasetorderHash = SignatureLib.toTypedDataHash( _datasetorderoperation.order.hash() ); if (_datasetorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { @@ -84,15 +82,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_workerpoolorderoperation.order.workerpool).owner(); require( owner == _msgSender() || - SignatureVerificationLib.verifySignature( + SignatureLib.verifySignature( owner, - SignatureVerificationLib.toTypedDataHash(_workerpoolorderoperation.hash()), + SignatureLib.toTypedDataHash(_workerpoolorderoperation.hash()), _workerpoolorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 workerpoolorderHash = SignatureVerificationLib.toTypedDataHash( + bytes32 workerpoolorderHash = SignatureLib.toTypedDataHash( _workerpoolorderoperation.order.hash() ); if (_workerpoolorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { @@ -113,15 +111,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = _requestorderoperation.order.requester; require( owner == _msgSender() || - SignatureVerificationLib.verifySignature( + SignatureLib.verifySignature( owner, - SignatureVerificationLib.toTypedDataHash(_requestorderoperation.hash()), + SignatureLib.toTypedDataHash(_requestorderoperation.hash()), _requestorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 requestorderHash = SignatureVerificationLib.toTypedDataHash( + bytes32 requestorderHash = SignatureLib.toTypedDataHash( _requestorderoperation.order.hash() ); if (_requestorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index c6eef9b77..145cca40a 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -13,7 +13,7 @@ import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; -import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; +import {SignatureLib} from "../libs/SignatureLib.sol"; struct Matching { bytes32 apporderHash; @@ -41,14 +41,14 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return SignatureVerificationLib.verifySignature(_identity, _hash, _signature); + return SignatureLib.verifySignature(_identity, _hash, _signature); } function verifyPresignature( address _identity, bytes32 _hash ) external view override returns (bool) { - return SignatureVerificationLib.verifyPresignature(_identity, _hash); + return SignatureLib.verifyPresignature(_identity, _hash); } function verifyPresignatureOrSignature( @@ -56,7 +56,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return SignatureVerificationLib.verifySignatureOrPresignature(_identity, _hash, _signature); + return SignatureLib.verifySignatureOrPresignature(_identity, _hash, _signature); } /** @@ -79,7 +79,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 dealId ) external view override { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - bytes32 datasetOrderHash = SignatureVerificationLib.toTypedDataHash(datasetOrder.hash()); + bytes32 datasetOrderHash = SignatureLib.toTypedDataHash(datasetOrder.hash()); // Check if dataset order is not revoked or fully consumed. // Note: This should be the first check because it is the most important // and the most likely to occur (users revoking their dataset orders). @@ -89,7 +89,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { // Check dataset order signature (including presign and ERC-1271). address datasetOwner = IERC5313(datasetOrder.dataset).owner(); if ( - !SignatureVerificationLib.verifySignatureOrPresignature( + !SignatureLib.verifySignatureOrPresignature( datasetOwner, datasetOrderHash, datasetOrder.sign @@ -108,7 +108,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // The deal's app should be allowed by order restriction. if ( - !SignatureVerificationLib.isAccountAuthorizedByRestriction( + !SignatureLib.isAccountAuthorizedByRestriction( datasetOrder.apprestrict, deal.app.pointer ) @@ -117,7 +117,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // The deal's workerpool should be allowed by order restriction. if ( - !SignatureVerificationLib.isAccountAuthorizedByRestriction( + !SignatureLib.isAccountAuthorizedByRestriction( datasetOrder.workerpoolrestrict, deal.workerpool.pointer ) @@ -126,7 +126,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // The deal's requester should be allowed by order restriction. if ( - !SignatureVerificationLib.isAccountAuthorizedByRestriction( + !SignatureLib.isAccountAuthorizedByRestriction( datasetOrder.requesterrestrict, deal.requester ) @@ -263,70 +263,67 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { require(_requestorder.app == _apporder.app, "iExecV5-matchOrders-0x10"); require(_requestorder.dataset == _datasetorder.dataset, "iExecV5-matchOrders-0x11"); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _requestorder.workerpool, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x12" ); // requestorder.workerpool is a restriction require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _apporder.datasetrestrict, _datasetorder.dataset ), "iExecV5-matchOrders-0x13" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _apporder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x14" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _apporder.requesterrestrict, _requestorder.requester ), "iExecV5-matchOrders-0x15" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - _datasetorder.apprestrict, - _apporder.app - ), + SignatureLib.isAccountAuthorizedByRestriction(_datasetorder.apprestrict, _apporder.app), "iExecV5-matchOrders-0x16" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _datasetorder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x17" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _datasetorder.requesterrestrict, _requestorder.requester ), "iExecV5-matchOrders-0x18" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _workerpoolorder.apprestrict, _apporder.app ), "iExecV5-matchOrders-0x19" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _workerpoolorder.datasetrestrict, _datasetorder.dataset ), "iExecV5-matchOrders-0x1a" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( _workerpoolorder.requesterrestrict, _requestorder.requester ), @@ -341,12 +338,12 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { ids.hasDataset = _datasetorder.dataset != address(0); // app - ids.apporderHash = SignatureVerificationLib.toTypedDataHash(_apporder.hash()); + ids.apporderHash = SignatureLib.toTypedDataHash(_apporder.hash()); ids.appOwner = IERC5313(_apporder.app).owner(); require($.m_appregistry.isRegistered(_apporder.app), "iExecV5-matchOrders-0x20"); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( ids.appOwner, ids.apporderHash, _apporder.sign @@ -357,7 +354,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { // dataset if (ids.hasDataset) { // only check if dataset is enabled - ids.datasetorderHash = SignatureVerificationLib.toTypedDataHash(_datasetorder.hash()); + ids.datasetorderHash = SignatureLib.toTypedDataHash(_datasetorder.hash()); ids.datasetOwner = IERC5313(_datasetorder.dataset).owner(); require( @@ -365,7 +362,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { "iExecV5-matchOrders-0x30" ); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( ids.datasetOwner, ids.datasetorderHash, _datasetorder.sign @@ -375,7 +372,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // workerpool - ids.workerpoolorderHash = SignatureVerificationLib.toTypedDataHash(_workerpoolorder.hash()); + ids.workerpoolorderHash = SignatureLib.toTypedDataHash(_workerpoolorder.hash()); ids.workerpoolOwner = IERC5313(_workerpoolorder.workerpool).owner(); require( @@ -383,7 +380,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { "iExecV5-matchOrders-0x40" ); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( ids.workerpoolOwner, ids.workerpoolorderHash, _workerpoolorder.sign @@ -392,9 +389,9 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { ); // request - ids.requestorderHash = SignatureVerificationLib.toTypedDataHash(_requestorder.hash()); + ids.requestorderHash = SignatureLib.toTypedDataHash(_requestorder.hash()); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( _requestorder.requester, ids.requestorderHash, _requestorder.sign diff --git a/contracts/facets/IexecPoco2Facet.sol b/contracts/facets/IexecPoco2Facet.sol index 70d921867..e3f939a41 100644 --- a/contracts/facets/IexecPoco2Facet.sol +++ b/contracts/facets/IexecPoco2Facet.sol @@ -10,7 +10,7 @@ import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IexecPoco2} from "../interfaces/IexecPoco2.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; +import {SignatureLib} from "../libs/SignatureLib.sol"; contract IexecPoco2Facet is IexecPoco2, IexecEscrow { modifier onlyScheduler(bytes32 _taskId) { @@ -119,7 +119,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -131,7 +131,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check enclave signature require( _enclaveChallenge == address(0) || - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(_resultHash, _resultSeal), _enclaveSign @@ -206,7 +206,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -218,7 +218,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check enclave signature require( _enclaveChallenge == address(0) || - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(resultHash, resultSeal), _enclaveSign diff --git a/contracts/facets/IexecPocoAccessorsFacet.sol b/contracts/facets/IexecPocoAccessorsFacet.sol index fa922ee14..021a00b6d 100644 --- a/contracts/facets/IexecPocoAccessorsFacet.sol +++ b/contracts/facets/IexecPocoAccessorsFacet.sol @@ -13,7 +13,7 @@ import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol"; import {IRegistry} from "../registries/IRegistry.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {FacetBase} from "../abstract/FacetBase.sol"; -import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; +import {SignatureLib} from "../libs/SignatureLib.sol"; /** * @title Getters contract for PoCo facets. @@ -63,14 +63,14 @@ contract IexecPocoAccessorsFacet is IexecPocoAccessors, FacetBase { return DealVolumeLib.computeDealVolume( appOrder.volume, - SignatureVerificationLib.toTypedDataHash(appOrder.hash()), + SignatureLib.toTypedDataHash(appOrder.hash()), datasetOrder.dataset != address(0), datasetOrder.volume, - SignatureVerificationLib.toTypedDataHash(datasetOrder.hash()), + SignatureLib.toTypedDataHash(datasetOrder.hash()), workerpoolOrder.volume, - SignatureVerificationLib.toTypedDataHash(workerpoolOrder.hash()), + SignatureLib.toTypedDataHash(workerpoolOrder.hash()), requestOrder.volume, - SignatureVerificationLib.toTypedDataHash(requestOrder.hash()) + SignatureLib.toTypedDataHash(requestOrder.hash()) ); } diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index af9c5e92a..8d50c5ab2 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -17,7 +17,7 @@ import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import {SignatureVerificationLib} from "../libs/SignatureVerificationLib.sol"; +import {SignatureLib} from "../libs/SignatureLib.sol"; // // Not deployed yet! @@ -161,71 +161,50 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check all possible restrictions. address workerpool = workerpoolOrder.workerpool; require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - requestOrder.workerpool, - workerpool - ), + SignatureLib.isAccountAuthorizedByRestriction(requestOrder.workerpool, workerpool), "PocoBoost: Workerpool restricted by request order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - appOrder.datasetrestrict, - dataset - ), + SignatureLib.isAccountAuthorizedByRestriction(appOrder.datasetrestrict, dataset), "PocoBoost: Dataset restricted by app order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - appOrder.workerpoolrestrict, - workerpool - ), + SignatureLib.isAccountAuthorizedByRestriction(appOrder.workerpoolrestrict, workerpool), "PocoBoost: Workerpool restricted by app order" ); address requester = requestOrder.requester; require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - appOrder.requesterrestrict, - requester - ), + SignatureLib.isAccountAuthorizedByRestriction(appOrder.requesterrestrict, requester), "PocoBoost: Requester restricted by app order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - datasetOrder.apprestrict, - app - ), + SignatureLib.isAccountAuthorizedByRestriction(datasetOrder.apprestrict, app), "PocoBoost: App restricted by dataset order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( datasetOrder.workerpoolrestrict, workerpool ), "PocoBoost: Workerpool restricted by dataset order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( datasetOrder.requesterrestrict, requester ), "PocoBoost: Requester restricted by dataset order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - workerpoolOrder.apprestrict, - app - ), + SignatureLib.isAccountAuthorizedByRestriction(workerpoolOrder.apprestrict, app), "PocoBoost: App restricted by workerpool order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( - workerpoolOrder.datasetrestrict, - dataset - ), + SignatureLib.isAccountAuthorizedByRestriction(workerpoolOrder.datasetrestrict, dataset), "PocoBoost: Dataset restricted by workerpool order" ); require( - SignatureVerificationLib.isAccountAuthorizedByRestriction( + SignatureLib.isAccountAuthorizedByRestriction( workerpoolOrder.requesterrestrict, requester ), @@ -234,9 +213,9 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check ownership, registration, and signatures for app and dataset. require($.m_appregistry.isRegistered(app), "PocoBoost: App not registered"); address appOwner = IERC5313(app).owner(); - bytes32 appOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash(appOrder.hash()); + bytes32 appOrderTypedDataHash = SignatureLib.toTypedDataHash(appOrder.hash()); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( appOwner, appOrderTypedDataHash, appOrder.sign @@ -249,11 +228,9 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { if (hasDataset) { require($.m_datasetregistry.isRegistered(dataset), "PocoBoost: Dataset not registered"); datasetOwner = IERC5313(dataset).owner(); - datasetOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( - datasetOrder.hash() - ); + datasetOrderTypedDataHash = SignatureLib.toTypedDataHash(datasetOrder.hash()); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( datasetOwner, datasetOrderTypedDataHash, datasetOrder.sign @@ -267,22 +244,18 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { "PocoBoost: Workerpool not registered" ); address workerpoolOwner = IERC5313(workerpool).owner(); - bytes32 workerpoolOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( - workerpoolOrder.hash() - ); + bytes32 workerpoolOrderTypedDataHash = SignatureLib.toTypedDataHash(workerpoolOrder.hash()); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( workerpoolOwner, workerpoolOrderTypedDataHash, workerpoolOrder.sign ), "PocoBoost: Invalid workerpool order signature" ); - bytes32 requestOrderTypedDataHash = SignatureVerificationLib.toTypedDataHash( - requestOrder.hash() - ); + bytes32 requestOrderTypedDataHash = SignatureLib.toTypedDataHash(requestOrder.hash()); require( - SignatureVerificationLib.verifySignatureOrPresignature( + SignatureLib.verifySignatureOrPresignature( requester, requestOrderTypedDataHash, requestOrder.sign @@ -438,7 +411,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { address workerpoolOwner = deal.workerpoolOwner; // Check scheduler or TEE broker signature require( - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( enclaveChallenge != address(0) && $.m_teebroker != address(0) ? $.m_teebroker : workerpoolOwner, @@ -451,7 +424,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check enclave signature require( enclaveChallenge == address(0) || - SignatureVerificationLib.verifySignatureOfEthSignedMessage( + SignatureLib.verifySignatureOfEthSignedMessage( enclaveChallenge, abi.encodePacked( msg.sender, diff --git a/contracts/libs/SignatureVerificationLib.sol b/contracts/libs/SignatureLib.sol similarity index 99% rename from contracts/libs/SignatureVerificationLib.sol rename to contracts/libs/SignatureLib.sol index 726c08f7a..29d3de380 100644 --- a/contracts/libs/SignatureVerificationLib.sol +++ b/contracts/libs/SignatureLib.sol @@ -12,7 +12,7 @@ import {PocoStorageLib} from "./PocoStorageLib.sol"; /** * @title Verify order and contribution signatures, presignatures and restrictions. */ -library SignatureVerificationLib { +library SignatureLib { using ECDSA for bytes32; // Used with ERC-734 Key Manager identity contract for authorization management. diff --git a/hardhat.config.ts b/hardhat.config.ts index 439dc6b69..74bf9e0b5 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -171,7 +171,7 @@ const config: HardhatUserConfig = { // TODO: put all events and soldoc inside interfaces and use them instead of contracts. 'interfaces/', // interesting for events but too much doc duplication if enabled 'libs/DealVolumeLib.sol', // contains only internal/private - 'libs/SignatureVerificationLib.sol', // contains only internal/private + 'libs/SignatureLib.sol', // contains only internal/private 'tools/', 'Diamond.sol', // not relevant ], From 737221a994843c584b1471e753d5e591e3663de7 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:35:35 +0200 Subject: [PATCH 05/17] refactor: hold the protocol constants in ConstantsLib Converting SignatureVerifier to a library forced a second declaration of GROUPMEMBER_PURPOSE, because a library cannot inherit FacetBase and a contract constant is not reachable from outside the contract at any visibility: solc rejects FacetBase.GROUPMEMBER_PURPOSE from a library with "Member not found or not visible after argument-dependent lookup". A library constant has no such restriction, so ConstantsLib becomes the single declaration of all eight protocol constants. FacetBase keeps the eight names as aliases of the library's values, so the 31 bare uses in the facets and the eight public getters on IexecPocoAccessorsFacet are untouched. No ABI change. Constant folding is preserved: the deployed bytecode still holds one PUSH each for 1e9, the kitty address and the stake ratio, and the same count of the literal 4. Four facets grew between 8 and 48 bytes of jump-offset churn under viaIR; the largest, IexecPocoBoostFacet, sits at 16665 of the 24576-byte limit. --- contracts/abstract/FacetBase.sol | 27 ++++++++++++--------------- contracts/libs/ConstantsLib.sol | 28 ++++++++++++++++++++++++++++ contracts/libs/SignatureLib.sol | 6 ++---- 3 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 contracts/libs/ConstantsLib.sol diff --git a/contracts/abstract/FacetBase.sol b/contracts/abstract/FacetBase.sol index cc3b877e5..bd675390a 100644 --- a/contracts/abstract/FacetBase.sol +++ b/contracts/abstract/FacetBase.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; +import {ConstantsLib} from "../libs/ConstantsLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; @@ -13,21 +14,17 @@ import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; * @dev Every facet must inherit from this contract. */ abstract contract FacetBase { - // Poco - Constants - uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; - uint256 internal constant REVEAL_DEADLINE_RATIO = 2; - uint256 internal constant FINAL_DEADLINE_RATIO = 10; - uint256 internal constant WORKERPOOL_STAKE_RATIO = 30; - uint256 internal constant KITTY_RATIO = 10; - uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE - - // Seized funds of workerpools that do not honor their deals are sent - // out to this kitty address. - // It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1). - address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23; - - // Used with ERC-734 Key Manager identity contract for authorization management. - uint256 internal constant GROUPMEMBER_PURPOSE = 4; + // Protocol constants, kept reachable under their bare names by the facets + // that inherit this contract. {ConstantsLib} is the single declaration. + uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = + ConstantsLib.CONTRIBUTION_DEADLINE_RATIO; + uint256 internal constant REVEAL_DEADLINE_RATIO = ConstantsLib.REVEAL_DEADLINE_RATIO; + uint256 internal constant FINAL_DEADLINE_RATIO = ConstantsLib.FINAL_DEADLINE_RATIO; + uint256 internal constant WORKERPOOL_STAKE_RATIO = ConstantsLib.WORKERPOOL_STAKE_RATIO; + uint256 internal constant KITTY_RATIO = ConstantsLib.KITTY_RATIO; + uint256 internal constant KITTY_MIN = ConstantsLib.KITTY_MIN; + address internal constant KITTY_ADDRESS = ConstantsLib.KITTY_ADDRESS; + uint256 internal constant GROUPMEMBER_PURPOSE = ConstantsLib.GROUPMEMBER_PURPOSE; modifier onlyOwner() { require(_msgSender() == owner(), "Ownable: caller is not the owner"); diff --git a/contracts/libs/ConstantsLib.sol b/contracts/libs/ConstantsLib.sol new file mode 100644 index 000000000..b998fc8a9 --- /dev/null +++ b/contracts/libs/ConstantsLib.sol @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +pragma solidity ^0.8.0; + +/** + * @title Protocol constants. + * @dev Declared in a library rather than in a base contract so that libraries + * can read them too: a library cannot inherit, and a contract constant is not + * reachable from outside the contract at any visibility. + */ +library ConstantsLib { + // Poco - Constants + uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; + uint256 internal constant REVEAL_DEADLINE_RATIO = 2; + uint256 internal constant FINAL_DEADLINE_RATIO = 10; + uint256 internal constant WORKERPOOL_STAKE_RATIO = 30; + uint256 internal constant KITTY_RATIO = 10; + uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE + + // Seized funds of workerpools that do not honor their deals are sent + // out to this kitty address. + // It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1). + address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23; + + // Used with ERC-734 Key Manager identity contract for authorization management. + uint256 internal constant GROUPMEMBER_PURPOSE = 4; +} diff --git a/contracts/libs/SignatureLib.sol b/contracts/libs/SignatureLib.sol index 29d3de380..5cc493713 100644 --- a/contracts/libs/SignatureLib.sol +++ b/contracts/libs/SignatureLib.sol @@ -7,6 +7,7 @@ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC734} from "../external/interfaces/IERC734.sol"; +import {ConstantsLib} from "./ConstantsLib.sol"; import {PocoStorageLib} from "./PocoStorageLib.sol"; /** @@ -15,9 +16,6 @@ import {PocoStorageLib} from "./PocoStorageLib.sol"; library SignatureLib { using ECDSA for bytes32; - // Used with ERC-734 Key Manager identity contract for authorization management. - uint256 private constant GROUPMEMBER_PURPOSE = 4; - /** * Hash a Typed Data using the configured domain. * @param structHash The original structure hash. @@ -144,7 +142,7 @@ library SignatureLib { try IERC734(restriction).keyHasPurpose( // ERC734 identity contract restriction bytes32(uint256(uint160(account))), - GROUPMEMBER_PURPOSE + ConstantsLib.GROUPMEMBER_PURPOSE ) returns (bool success) { return success; From 563aaa1a5b4e4b08af97bd10caa8724793f288ad Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:46:47 +0200 Subject: [PATCH 06/17] Revert "refactor: hold the protocol constants in ConstantsLib" This reverts commit 737221a9. The constants move is deferred to the next PR, so SignatureLib keeps its own GROUPMEMBER_PURPOSE for now and FacetBase carries a TODO recording why the duplicate exists and what replaces it. --- contracts/abstract/FacetBase.sol | 32 ++++++++++++++++++++------------ contracts/libs/ConstantsLib.sol | 28 ---------------------------- contracts/libs/SignatureLib.sol | 6 ++++-- 3 files changed, 24 insertions(+), 42 deletions(-) delete mode 100644 contracts/libs/ConstantsLib.sol diff --git a/contracts/abstract/FacetBase.sol b/contracts/abstract/FacetBase.sol index bd675390a..65cf25983 100644 --- a/contracts/abstract/FacetBase.sol +++ b/contracts/abstract/FacetBase.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.0; -import {ConstantsLib} from "../libs/ConstantsLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; @@ -14,17 +13,26 @@ import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; * @dev Every facet must inherit from this contract. */ abstract contract FacetBase { - // Protocol constants, kept reachable under their bare names by the facets - // that inherit this contract. {ConstantsLib} is the single declaration. - uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = - ConstantsLib.CONTRIBUTION_DEADLINE_RATIO; - uint256 internal constant REVEAL_DEADLINE_RATIO = ConstantsLib.REVEAL_DEADLINE_RATIO; - uint256 internal constant FINAL_DEADLINE_RATIO = ConstantsLib.FINAL_DEADLINE_RATIO; - uint256 internal constant WORKERPOOL_STAKE_RATIO = ConstantsLib.WORKERPOOL_STAKE_RATIO; - uint256 internal constant KITTY_RATIO = ConstantsLib.KITTY_RATIO; - uint256 internal constant KITTY_MIN = ConstantsLib.KITTY_MIN; - address internal constant KITTY_ADDRESS = ConstantsLib.KITTY_ADDRESS; - uint256 internal constant GROUPMEMBER_PURPOSE = ConstantsLib.GROUPMEMBER_PURPOSE; + // TODO move these constants to a ConstantsLib library and reference them as + // ConstantsLib. in the next PR. A library cannot inherit this contract + // and solc rejects FacetBase. from outside the contract at any + // visibility, which is why SignatureLib redeclares GROUPMEMBER_PURPOSE today. + + // Poco - Constants + uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; + uint256 internal constant REVEAL_DEADLINE_RATIO = 2; + uint256 internal constant FINAL_DEADLINE_RATIO = 10; + uint256 internal constant WORKERPOOL_STAKE_RATIO = 30; + uint256 internal constant KITTY_RATIO = 10; + uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE + + // Seized funds of workerpools that do not honor their deals are sent + // out to this kitty address. + // It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1). + address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23; + + // Used with ERC-734 Key Manager identity contract for authorization management. + uint256 internal constant GROUPMEMBER_PURPOSE = 4; modifier onlyOwner() { require(_msgSender() == owner(), "Ownable: caller is not the owner"); diff --git a/contracts/libs/ConstantsLib.sol b/contracts/libs/ConstantsLib.sol deleted file mode 100644 index b998fc8a9..000000000 --- a/contracts/libs/ConstantsLib.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.8.0; - -/** - * @title Protocol constants. - * @dev Declared in a library rather than in a base contract so that libraries - * can read them too: a library cannot inherit, and a contract constant is not - * reachable from outside the contract at any visibility. - */ -library ConstantsLib { - // Poco - Constants - uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; - uint256 internal constant REVEAL_DEADLINE_RATIO = 2; - uint256 internal constant FINAL_DEADLINE_RATIO = 10; - uint256 internal constant WORKERPOOL_STAKE_RATIO = 30; - uint256 internal constant KITTY_RATIO = 10; - uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE - - // Seized funds of workerpools that do not honor their deals are sent - // out to this kitty address. - // It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1). - address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23; - - // Used with ERC-734 Key Manager identity contract for authorization management. - uint256 internal constant GROUPMEMBER_PURPOSE = 4; -} diff --git a/contracts/libs/SignatureLib.sol b/contracts/libs/SignatureLib.sol index 5cc493713..29d3de380 100644 --- a/contracts/libs/SignatureLib.sol +++ b/contracts/libs/SignatureLib.sol @@ -7,7 +7,6 @@ import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC734} from "../external/interfaces/IERC734.sol"; -import {ConstantsLib} from "./ConstantsLib.sol"; import {PocoStorageLib} from "./PocoStorageLib.sol"; /** @@ -16,6 +15,9 @@ import {PocoStorageLib} from "./PocoStorageLib.sol"; library SignatureLib { using ECDSA for bytes32; + // Used with ERC-734 Key Manager identity contract for authorization management. + uint256 private constant GROUPMEMBER_PURPOSE = 4; + /** * Hash a Typed Data using the configured domain. * @param structHash The original structure hash. @@ -142,7 +144,7 @@ library SignatureLib { try IERC734(restriction).keyHasPurpose( // ERC734 identity contract restriction bytes32(uint256(uint160(account))), - ConstantsLib.GROUPMEMBER_PURPOSE + GROUPMEMBER_PURPOSE ) returns (bool success) { return success; From 0216491bcb4705fe7ad7ddb475c3a5bacd95367b Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:49:02 +0200 Subject: [PATCH 07/17] refactor: merge DealVolumeLib into SignatureLib and rename it CommonLib The two libraries served the same five facets and each held helpers that are stateless reads over diamond storage, so one library keeps the import lists shorter without changing what the facets can reach. computeDealVolume goes last, after the signature and restriction helpers. The deployed bytecode of every facet is byte-identical to before the merge, and no ABI changes: internal library functions are inlined either way. --- .agents/context/architecture.md | 2 +- contracts/abstract/FacetBase.sol | 5 +- .../facets/IexecOrderManagementFacet.sol | 30 ++++----- contracts/facets/IexecPoco1Facet.sol | 67 ++++++++----------- contracts/facets/IexecPoco2Facet.sol | 10 +-- contracts/facets/IexecPocoAccessorsFacet.sol | 13 ++-- contracts/facets/IexecPocoBoostFacet.sol | 55 ++++++--------- .../libs/{SignatureLib.sol => CommonLib.sol} | 46 ++++++++++++- contracts/libs/DealVolumeLib.sol | 53 --------------- hardhat.config.ts | 3 +- 10 files changed, 122 insertions(+), 162 deletions(-) rename contracts/libs/{SignatureLib.sol => CommonLib.sol} (74%) delete mode 100644 contracts/libs/DealVolumeLib.sol diff --git a/.agents/context/architecture.md b/.agents/context/architecture.md index 788e22339..fbf66a1e4 100644 --- a/.agents/context/architecture.md +++ b/.agents/context/architecture.md @@ -7,7 +7,7 @@ - Protocol logic: `contracts/facets/*Facet.sol` - External API declarations: `contracts/interfaces/` - `contracts/IexecInterfaceToken.sol` aggregates them into the single interface downstream tools compile against -- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`DealVolumeLib`, `SignatureLib`, …) +- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`CommonLib`, `PocoStorageLib`, …) - Storage lives in one struct accessed through `contracts/libs/PocoStorageLib.sol`, shared by every facet: **never reorder or remove an existing variable, only append**. `npm run check-storage-layout` is the CI gate. - Adding or removing a facet means editing two hand-maintained lists: `utils/proxy-tools.ts#getAllLocalFacetFunctions` (selector-to-name map used by upgrades) and the facet groups in `scripts/tools/sol-to-uml.mjs`. diff --git a/contracts/abstract/FacetBase.sol b/contracts/abstract/FacetBase.sol index 65cf25983..2cd15a438 100644 --- a/contracts/abstract/FacetBase.sol +++ b/contracts/abstract/FacetBase.sol @@ -14,9 +14,8 @@ import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; */ abstract contract FacetBase { // TODO move these constants to a ConstantsLib library and reference them as - // ConstantsLib. in the next PR. A library cannot inherit this contract - // and solc rejects FacetBase. from outside the contract at any - // visibility, which is why SignatureLib redeclares GROUPMEMBER_PURPOSE today. + // ConstantsLib. in the next PR. + // CommonLib redeclares GROUPMEMBER_PURPOSE temporarily. // Poco - Constants uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7; diff --git a/contracts/facets/IexecOrderManagementFacet.sol b/contracts/facets/IexecOrderManagementFacet.sol index bf444ad74..d1249f3dc 100644 --- a/contracts/facets/IexecOrderManagementFacet.sol +++ b/contracts/facets/IexecOrderManagementFacet.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; import {FacetBase} from "../abstract/FacetBase.sol"; -import {SignatureLib} from "../libs/SignatureLib.sol"; +import {CommonLib} from "../libs/CommonLib.sol"; import {IexecOrderManagement} from "../interfaces/IexecOrderManagement.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; @@ -30,15 +30,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_apporderoperation.order.app).owner(); require( owner == _msgSender() || - SignatureLib.verifySignature( + CommonLib.verifySignature( owner, - SignatureLib.toTypedDataHash(_apporderoperation.hash()), + CommonLib.toTypedDataHash(_apporderoperation.hash()), _apporderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 apporderHash = SignatureLib.toTypedDataHash(_apporderoperation.order.hash()); + bytes32 apporderHash = CommonLib.toTypedDataHash(_apporderoperation.order.hash()); if (_apporderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[apporderHash] = owner; emit SignedAppOrder(apporderHash); @@ -55,17 +55,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_datasetorderoperation.order.dataset).owner(); require( owner == _msgSender() || - SignatureLib.verifySignature( + CommonLib.verifySignature( owner, - SignatureLib.toTypedDataHash(_datasetorderoperation.hash()), + CommonLib.toTypedDataHash(_datasetorderoperation.hash()), _datasetorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 datasetorderHash = SignatureLib.toTypedDataHash( - _datasetorderoperation.order.hash() - ); + bytes32 datasetorderHash = CommonLib.toTypedDataHash(_datasetorderoperation.order.hash()); if (_datasetorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[datasetorderHash] = owner; emit SignedDatasetOrder(datasetorderHash); @@ -82,15 +80,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = IERC5313(_workerpoolorderoperation.order.workerpool).owner(); require( owner == _msgSender() || - SignatureLib.verifySignature( + CommonLib.verifySignature( owner, - SignatureLib.toTypedDataHash(_workerpoolorderoperation.hash()), + CommonLib.toTypedDataHash(_workerpoolorderoperation.hash()), _workerpoolorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 workerpoolorderHash = SignatureLib.toTypedDataHash( + bytes32 workerpoolorderHash = CommonLib.toTypedDataHash( _workerpoolorderoperation.order.hash() ); if (_workerpoolorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { @@ -111,17 +109,15 @@ contract IexecOrderManagementFacet is IexecOrderManagement, FacetBase { address owner = _requestorderoperation.order.requester; require( owner == _msgSender() || - SignatureLib.verifySignature( + CommonLib.verifySignature( owner, - SignatureLib.toTypedDataHash(_requestorderoperation.hash()), + CommonLib.toTypedDataHash(_requestorderoperation.hash()), _requestorderoperation.sign ), "invalid-sender-or-signature" ); - bytes32 requestorderHash = SignatureLib.toTypedDataHash( - _requestorderoperation.order.hash() - ); + bytes32 requestorderHash = CommonLib.toTypedDataHash(_requestorderoperation.order.hash()); if (_requestorderoperation.operation == IexecLibOrders_v5.OrderOperationEnum.SIGN) { $.m_presigned[requestorderHash] = owner; emit SignedRequestOrder(requestorderHash); diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index 145cca40a..4ebcc6407 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -12,8 +12,7 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; -import {SignatureLib} from "../libs/SignatureLib.sol"; +import {CommonLib} from "../libs/CommonLib.sol"; struct Matching { bytes32 apporderHash; @@ -41,14 +40,14 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return SignatureLib.verifySignature(_identity, _hash, _signature); + return CommonLib.verifySignature(_identity, _hash, _signature); } function verifyPresignature( address _identity, bytes32 _hash ) external view override returns (bool) { - return SignatureLib.verifyPresignature(_identity, _hash); + return CommonLib.verifyPresignature(_identity, _hash); } function verifyPresignatureOrSignature( @@ -56,7 +55,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 _hash, bytes calldata _signature ) external view override returns (bool) { - return SignatureLib.verifySignatureOrPresignature(_identity, _hash, _signature); + return CommonLib.verifySignatureOrPresignature(_identity, _hash, _signature); } /** @@ -79,7 +78,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { bytes32 dealId ) external view override { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - bytes32 datasetOrderHash = SignatureLib.toTypedDataHash(datasetOrder.hash()); + bytes32 datasetOrderHash = CommonLib.toTypedDataHash(datasetOrder.hash()); // Check if dataset order is not revoked or fully consumed. // Note: This should be the first check because it is the most important // and the most likely to occur (users revoking their dataset orders). @@ -89,7 +88,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { // Check dataset order signature (including presign and ERC-1271). address datasetOwner = IERC5313(datasetOrder.dataset).owner(); if ( - !SignatureLib.verifySignatureOrPresignature( + !CommonLib.verifySignatureOrPresignature( datasetOwner, datasetOrderHash, datasetOrder.sign @@ -108,16 +107,13 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // The deal's app should be allowed by order restriction. if ( - !SignatureLib.isAccountAuthorizedByRestriction( - datasetOrder.apprestrict, - deal.app.pointer - ) + !CommonLib.isAccountAuthorizedByRestriction(datasetOrder.apprestrict, deal.app.pointer) ) { revert IncompatibleDatasetOrder("App restriction not satisfied"); } // The deal's workerpool should be allowed by order restriction. if ( - !SignatureLib.isAccountAuthorizedByRestriction( + !CommonLib.isAccountAuthorizedByRestriction( datasetOrder.workerpoolrestrict, deal.workerpool.pointer ) @@ -126,7 +122,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // The deal's requester should be allowed by order restriction. if ( - !SignatureLib.isAccountAuthorizedByRestriction( + !CommonLib.isAccountAuthorizedByRestriction( datasetOrder.requesterrestrict, deal.requester ) @@ -263,67 +259,64 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { require(_requestorder.app == _apporder.app, "iExecV5-matchOrders-0x10"); require(_requestorder.dataset == _datasetorder.dataset, "iExecV5-matchOrders-0x11"); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _requestorder.workerpool, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x12" ); // requestorder.workerpool is a restriction require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _apporder.datasetrestrict, _datasetorder.dataset ), "iExecV5-matchOrders-0x13" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _apporder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x14" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _apporder.requesterrestrict, _requestorder.requester ), "iExecV5-matchOrders-0x15" ); require( - SignatureLib.isAccountAuthorizedByRestriction(_datasetorder.apprestrict, _apporder.app), + CommonLib.isAccountAuthorizedByRestriction(_datasetorder.apprestrict, _apporder.app), "iExecV5-matchOrders-0x16" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _datasetorder.workerpoolrestrict, _workerpoolorder.workerpool ), "iExecV5-matchOrders-0x17" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _datasetorder.requesterrestrict, _requestorder.requester ), "iExecV5-matchOrders-0x18" ); require( - SignatureLib.isAccountAuthorizedByRestriction( - _workerpoolorder.apprestrict, - _apporder.app - ), + CommonLib.isAccountAuthorizedByRestriction(_workerpoolorder.apprestrict, _apporder.app), "iExecV5-matchOrders-0x19" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _workerpoolorder.datasetrestrict, _datasetorder.dataset ), "iExecV5-matchOrders-0x1a" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( _workerpoolorder.requesterrestrict, _requestorder.requester ), @@ -338,23 +331,19 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { ids.hasDataset = _datasetorder.dataset != address(0); // app - ids.apporderHash = SignatureLib.toTypedDataHash(_apporder.hash()); + ids.apporderHash = CommonLib.toTypedDataHash(_apporder.hash()); ids.appOwner = IERC5313(_apporder.app).owner(); require($.m_appregistry.isRegistered(_apporder.app), "iExecV5-matchOrders-0x20"); require( - SignatureLib.verifySignatureOrPresignature( - ids.appOwner, - ids.apporderHash, - _apporder.sign - ), + CommonLib.verifySignatureOrPresignature(ids.appOwner, ids.apporderHash, _apporder.sign), "iExecV5-matchOrders-0x21" ); // dataset if (ids.hasDataset) { // only check if dataset is enabled - ids.datasetorderHash = SignatureLib.toTypedDataHash(_datasetorder.hash()); + ids.datasetorderHash = CommonLib.toTypedDataHash(_datasetorder.hash()); ids.datasetOwner = IERC5313(_datasetorder.dataset).owner(); require( @@ -362,7 +351,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { "iExecV5-matchOrders-0x30" ); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( ids.datasetOwner, ids.datasetorderHash, _datasetorder.sign @@ -372,7 +361,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { } // workerpool - ids.workerpoolorderHash = SignatureLib.toTypedDataHash(_workerpoolorder.hash()); + ids.workerpoolorderHash = CommonLib.toTypedDataHash(_workerpoolorder.hash()); ids.workerpoolOwner = IERC5313(_workerpoolorder.workerpool).owner(); require( @@ -380,7 +369,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { "iExecV5-matchOrders-0x40" ); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( ids.workerpoolOwner, ids.workerpoolorderHash, _workerpoolorder.sign @@ -389,9 +378,9 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { ); // request - ids.requestorderHash = SignatureLib.toTypedDataHash(_requestorder.hash()); + ids.requestorderHash = CommonLib.toTypedDataHash(_requestorder.hash()); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( _requestorder.requester, ids.requestorderHash, _requestorder.sign @@ -402,7 +391,7 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { /** * Check availability */ - uint256 volume = DealVolumeLib.computeDealVolume( + uint256 volume = CommonLib.computeDealVolume( _apporder.volume, ids.apporderHash, ids.hasDataset, diff --git a/contracts/facets/IexecPoco2Facet.sol b/contracts/facets/IexecPoco2Facet.sol index e3f939a41..0eac27b57 100644 --- a/contracts/facets/IexecPoco2Facet.sol +++ b/contracts/facets/IexecPoco2Facet.sol @@ -10,7 +10,7 @@ import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IexecPoco2} from "../interfaces/IexecPoco2.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {SignatureLib} from "../libs/SignatureLib.sol"; +import {CommonLib} from "../libs/CommonLib.sol"; contract IexecPoco2Facet is IexecPoco2, IexecEscrow { modifier onlyScheduler(bytes32 _taskId) { @@ -119,7 +119,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -131,7 +131,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check enclave signature require( _enclaveChallenge == address(0) || - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(_resultHash, _resultSeal), _enclaveSign @@ -206,7 +206,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check that the worker + taskid + enclave combo is authorized to contribute (scheduler signature) require( - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( (_enclaveChallenge != address(0) && $.m_teebroker != address(0)) ? $.m_teebroker : deal.workerpool.owner, @@ -218,7 +218,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { // Check enclave signature require( _enclaveChallenge == address(0) || - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( _enclaveChallenge, abi.encodePacked(resultHash, resultSeal), _enclaveSign diff --git a/contracts/facets/IexecPocoAccessorsFacet.sol b/contracts/facets/IexecPocoAccessorsFacet.sol index 021a00b6d..f4c0bc5fc 100644 --- a/contracts/facets/IexecPocoAccessorsFacet.sol +++ b/contracts/facets/IexecPocoAccessorsFacet.sol @@ -11,9 +11,8 @@ import {IApp} from "../registries/apps/IApp.v8.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol"; import {IRegistry} from "../registries/IRegistry.sol"; -import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {FacetBase} from "../abstract/FacetBase.sol"; -import {SignatureLib} from "../libs/SignatureLib.sol"; +import {CommonLib} from "../libs/CommonLib.sol"; /** * @title Getters contract for PoCo facets. @@ -61,16 +60,16 @@ contract IexecPocoAccessorsFacet is IexecPocoAccessors, FacetBase { IexecLibOrders_v5.RequestOrder calldata requestOrder ) external view override returns (uint256) { return - DealVolumeLib.computeDealVolume( + CommonLib.computeDealVolume( appOrder.volume, - SignatureLib.toTypedDataHash(appOrder.hash()), + CommonLib.toTypedDataHash(appOrder.hash()), datasetOrder.dataset != address(0), datasetOrder.volume, - SignatureLib.toTypedDataHash(datasetOrder.hash()), + CommonLib.toTypedDataHash(datasetOrder.hash()), workerpoolOrder.volume, - SignatureLib.toTypedDataHash(workerpoolOrder.hash()), + CommonLib.toTypedDataHash(workerpoolOrder.hash()), requestOrder.volume, - SignatureLib.toTypedDataHash(requestOrder.hash()) + CommonLib.toTypedDataHash(requestOrder.hash()) ); } diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index 8d50c5ab2..6857a0cde 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -15,9 +15,8 @@ import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; import {IexecEscrow} from "../abstract/IexecEscrow.sol"; -import {DealVolumeLib} from "../libs/DealVolumeLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import {SignatureLib} from "../libs/SignatureLib.sol"; +import {CommonLib} from "../libs/CommonLib.sol"; // // Not deployed yet! @@ -161,50 +160,44 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check all possible restrictions. address workerpool = workerpoolOrder.workerpool; require( - SignatureLib.isAccountAuthorizedByRestriction(requestOrder.workerpool, workerpool), + CommonLib.isAccountAuthorizedByRestriction(requestOrder.workerpool, workerpool), "PocoBoost: Workerpool restricted by request order" ); require( - SignatureLib.isAccountAuthorizedByRestriction(appOrder.datasetrestrict, dataset), + CommonLib.isAccountAuthorizedByRestriction(appOrder.datasetrestrict, dataset), "PocoBoost: Dataset restricted by app order" ); require( - SignatureLib.isAccountAuthorizedByRestriction(appOrder.workerpoolrestrict, workerpool), + CommonLib.isAccountAuthorizedByRestriction(appOrder.workerpoolrestrict, workerpool), "PocoBoost: Workerpool restricted by app order" ); address requester = requestOrder.requester; require( - SignatureLib.isAccountAuthorizedByRestriction(appOrder.requesterrestrict, requester), + CommonLib.isAccountAuthorizedByRestriction(appOrder.requesterrestrict, requester), "PocoBoost: Requester restricted by app order" ); require( - SignatureLib.isAccountAuthorizedByRestriction(datasetOrder.apprestrict, app), + CommonLib.isAccountAuthorizedByRestriction(datasetOrder.apprestrict, app), "PocoBoost: App restricted by dataset order" ); require( - SignatureLib.isAccountAuthorizedByRestriction( - datasetOrder.workerpoolrestrict, - workerpool - ), + CommonLib.isAccountAuthorizedByRestriction(datasetOrder.workerpoolrestrict, workerpool), "PocoBoost: Workerpool restricted by dataset order" ); require( - SignatureLib.isAccountAuthorizedByRestriction( - datasetOrder.requesterrestrict, - requester - ), + CommonLib.isAccountAuthorizedByRestriction(datasetOrder.requesterrestrict, requester), "PocoBoost: Requester restricted by dataset order" ); require( - SignatureLib.isAccountAuthorizedByRestriction(workerpoolOrder.apprestrict, app), + CommonLib.isAccountAuthorizedByRestriction(workerpoolOrder.apprestrict, app), "PocoBoost: App restricted by workerpool order" ); require( - SignatureLib.isAccountAuthorizedByRestriction(workerpoolOrder.datasetrestrict, dataset), + CommonLib.isAccountAuthorizedByRestriction(workerpoolOrder.datasetrestrict, dataset), "PocoBoost: Dataset restricted by workerpool order" ); require( - SignatureLib.isAccountAuthorizedByRestriction( + CommonLib.isAccountAuthorizedByRestriction( workerpoolOrder.requesterrestrict, requester ), @@ -213,13 +206,9 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check ownership, registration, and signatures for app and dataset. require($.m_appregistry.isRegistered(app), "PocoBoost: App not registered"); address appOwner = IERC5313(app).owner(); - bytes32 appOrderTypedDataHash = SignatureLib.toTypedDataHash(appOrder.hash()); + bytes32 appOrderTypedDataHash = CommonLib.toTypedDataHash(appOrder.hash()); require( - SignatureLib.verifySignatureOrPresignature( - appOwner, - appOrderTypedDataHash, - appOrder.sign - ), + CommonLib.verifySignatureOrPresignature(appOwner, appOrderTypedDataHash, appOrder.sign), "PocoBoost: Invalid app order signature" ); bool hasDataset = dataset != address(0); @@ -228,9 +217,9 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { if (hasDataset) { require($.m_datasetregistry.isRegistered(dataset), "PocoBoost: Dataset not registered"); datasetOwner = IERC5313(dataset).owner(); - datasetOrderTypedDataHash = SignatureLib.toTypedDataHash(datasetOrder.hash()); + datasetOrderTypedDataHash = CommonLib.toTypedDataHash(datasetOrder.hash()); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( datasetOwner, datasetOrderTypedDataHash, datasetOrder.sign @@ -244,18 +233,18 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { "PocoBoost: Workerpool not registered" ); address workerpoolOwner = IERC5313(workerpool).owner(); - bytes32 workerpoolOrderTypedDataHash = SignatureLib.toTypedDataHash(workerpoolOrder.hash()); + bytes32 workerpoolOrderTypedDataHash = CommonLib.toTypedDataHash(workerpoolOrder.hash()); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( workerpoolOwner, workerpoolOrderTypedDataHash, workerpoolOrder.sign ), "PocoBoost: Invalid workerpool order signature" ); - bytes32 requestOrderTypedDataHash = SignatureLib.toTypedDataHash(requestOrder.hash()); + bytes32 requestOrderTypedDataHash = CommonLib.toTypedDataHash(requestOrder.hash()); require( - SignatureLib.verifySignatureOrPresignature( + CommonLib.verifySignatureOrPresignature( requester, requestOrderTypedDataHash, requestOrder.sign @@ -285,7 +274,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { * - but trying to use as little gas as possible * - Overflows: Solidity 0.8 has built in overflow checking */ - uint256 volume = DealVolumeLib.computeDealVolume( + uint256 volume = CommonLib.computeDealVolume( appOrder.volume, appOrderTypedDataHash, hasDataset, @@ -411,7 +400,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { address workerpoolOwner = deal.workerpoolOwner; // Check scheduler or TEE broker signature require( - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( enclaveChallenge != address(0) && $.m_teebroker != address(0) ? $.m_teebroker : workerpoolOwner, @@ -424,7 +413,7 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // Check enclave signature require( enclaveChallenge == address(0) || - SignatureLib.verifySignatureOfEthSignedMessage( + CommonLib.verifySignatureOfEthSignedMessage( enclaveChallenge, abi.encodePacked( msg.sender, diff --git a/contracts/libs/SignatureLib.sol b/contracts/libs/CommonLib.sol similarity index 74% rename from contracts/libs/SignatureLib.sol rename to contracts/libs/CommonLib.sol index 29d3de380..bc38622c3 100644 --- a/contracts/libs/SignatureLib.sol +++ b/contracts/libs/CommonLib.sol @@ -6,14 +6,17 @@ pragma solidity ^0.8.0; import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; +import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IERC734} from "../external/interfaces/IERC734.sol"; import {PocoStorageLib} from "./PocoStorageLib.sol"; /** - * @title Verify order and contribution signatures, presignatures and restrictions. + * @title Helpers shared by the PoCo facets: signature verification, address + * restrictions and deal volume computation. */ -library SignatureLib { +library CommonLib { using ECDSA for bytes32; + using Math for uint256; // Used with ERC-734 Key Manager identity contract for authorization management. uint256 private constant GROUPMEMBER_PURPOSE = 4; @@ -152,4 +155,43 @@ library SignatureLib { } return false; } + + /** + * @notice Compute the deal volume considering the minimum remaining volume + * across all provided orders. This ensures that the deal volume does not + * exceed the available volume of any individual order. + * + * @param appOrderVolume The volume of the app order. + * @param appOrderTypedDataHash The typed data hash of the app order. + * @param hasDataset Indicates if there is a dataset order. + * @param datasetOrderVolume The volume of the dataset order. + * @param datasetOrderTypedDataHash The typed data hash of the dataset order. + * @param workerpoolOrderVolume The volume of the workerpool order. + * @param workerpoolOrderTypedDataHash The typed data hash of the workerpool order. + * @param requestOrderVolume The volume of the request order. + * @param requestOrderTypedDataHash The typed data hash of the request order. + * @return The minimum volume available across all orders. + */ + function computeDealVolume( + uint256 appOrderVolume, + bytes32 appOrderTypedDataHash, + bool hasDataset, + uint256 datasetOrderVolume, + bytes32 datasetOrderTypedDataHash, + uint256 workerpoolOrderVolume, + bytes32 workerpoolOrderTypedDataHash, + uint256 requestOrderVolume, + bytes32 requestOrderTypedDataHash + ) internal view returns (uint256) { + PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); + return + (appOrderVolume - $.m_consumed[appOrderTypedDataHash]) + .min( + hasDataset + ? datasetOrderVolume - $.m_consumed[datasetOrderTypedDataHash] + : type(uint256).max + ) + .min(workerpoolOrderVolume - $.m_consumed[workerpoolOrderTypedDataHash]) + .min(requestOrderVolume - $.m_consumed[requestOrderTypedDataHash]); + } } diff --git a/contracts/libs/DealVolumeLib.sol b/contracts/libs/DealVolumeLib.sol deleted file mode 100644 index 8fb63289e..000000000 --- a/contracts/libs/DealVolumeLib.sol +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-FileCopyrightText: 2024-2025 IEXEC BLOCKCHAIN TECH -// SPDX-License-Identifier: Apache-2.0 - -pragma solidity ^0.8.0; - -import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; -import {PocoStorageLib} from "./PocoStorageLib.sol"; - -/** - * @title Compute the volume of a deal from the volumes of the orders it matches. - */ -library DealVolumeLib { - using Math for uint256; - - /** - * @notice Compute the deal volume considering the minimum remaining volume - * across all provided orders. This ensures that the deal volume does not - * exceed the available volume of any individual order. - * - * @param appOrderVolume The volume of the app order. - * @param appOrderTypedDataHash The typed data hash of the app order. - * @param hasDataset Indicates if there is a dataset order. - * @param datasetOrderVolume The volume of the dataset order. - * @param datasetOrderTypedDataHash The typed data hash of the dataset order. - * @param workerpoolOrderVolume The volume of the workerpool order. - * @param workerpoolOrderTypedDataHash The typed data hash of the workerpool order. - * @param requestOrderVolume The volume of the request order. - * @param requestOrderTypedDataHash The typed data hash of the request order. - * @return The minimum volume available across all orders. - */ - function computeDealVolume( - uint256 appOrderVolume, - bytes32 appOrderTypedDataHash, - bool hasDataset, - uint256 datasetOrderVolume, - bytes32 datasetOrderTypedDataHash, - uint256 workerpoolOrderVolume, - bytes32 workerpoolOrderTypedDataHash, - uint256 requestOrderVolume, - bytes32 requestOrderTypedDataHash - ) internal view returns (uint256) { - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - return - (appOrderVolume - $.m_consumed[appOrderTypedDataHash]) - .min( - hasDataset - ? datasetOrderVolume - $.m_consumed[datasetOrderTypedDataHash] - : type(uint256).max - ) - .min(workerpoolOrderVolume - $.m_consumed[workerpoolOrderTypedDataHash]) - .min(requestOrderVolume - $.m_consumed[requestOrderTypedDataHash]); - } -} diff --git a/hardhat.config.ts b/hardhat.config.ts index 74bf9e0b5..5ad7052ca 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -170,8 +170,7 @@ const config: HardhatUserConfig = { 'facets/IexecAccessorsABILegacyFacet.sol', // not relevant // TODO: put all events and soldoc inside interfaces and use them instead of contracts. 'interfaces/', // interesting for events but too much doc duplication if enabled - 'libs/DealVolumeLib.sol', // contains only internal/private - 'libs/SignatureLib.sol', // contains only internal/private + 'libs/CommonLib.sol', // contains only internal/private 'tools/', 'Diamond.sol', // not relevant ], From bad00efd6a06d6267b3cea33dad92542a8ffa935 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:49:38 +0200 Subject: [PATCH 08/17] chore: record the pending renames as TODOs The library and facet names still carry suffixes the next PR removes: IexecLibCore_v5 becomes CoreLib, IexecLibOrders_v5 becomes OrdersLib and IexecEscrowTokenFacet becomes IexecEscrowFacet. IexecInterfaceToken already carried its own note. --- contracts/facets/IexecEscrowTokenFacet.sol | 1 + contracts/libs/IexecLibCore_v5.sol | 1 + contracts/libs/IexecLibOrders_v5.sol | 1 + 3 files changed, 3 insertions(+) diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index cbc21929a..3305c1f47 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -23,6 +23,7 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; * RLC, and the ERC-20 methods move it between accounts. The balance moves of the * escrow itself (lock, unlock, reward, seize) run over the same ledger. */ +// TODO rename to IexecEscrowFacet contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, IexecEscrow { /*************************************************************************** * Deposit and withdraw functions * diff --git a/contracts/libs/IexecLibCore_v5.sol b/contracts/libs/IexecLibCore_v5.sol index aca6f5f40..d77746fac 100644 --- a/contracts/libs/IexecLibCore_v5.sol +++ b/contracts/libs/IexecLibCore_v5.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; +// TODO rename to CoreLib library IexecLibCore_v5 { /** * Tools diff --git a/contracts/libs/IexecLibOrders_v5.sol b/contracts/libs/IexecLibOrders_v5.sol index a5ba8b13f..587e93089 100644 --- a/contracts/libs/IexecLibOrders_v5.sol +++ b/contracts/libs/IexecLibOrders_v5.sol @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; +// TODO rename to OrdersLib library IexecLibOrders_v5 { // bytes32 public constant EIP712DOMAIN_TYPEHASH = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'); // bytes32 public constant APPORDER_TYPEHASH = keccak256('AppOrder(address app,uint256 appprice,uint256 volume,bytes32 tag,address datasetrestrict,address workerpoolrestrict,address requesterrestrict,bytes32 salt)'); From 19345257b6170b3a538a5cc0800ec60dcbae1009 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:56:52 +0200 Subject: [PATCH 09/17] chore: clean --- contracts/libs/CommonLib.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/libs/CommonLib.sol b/contracts/libs/CommonLib.sol index bc38622c3..d394735e0 100644 --- a/contracts/libs/CommonLib.sol +++ b/contracts/libs/CommonLib.sol @@ -11,8 +11,8 @@ import {IERC734} from "../external/interfaces/IERC734.sol"; import {PocoStorageLib} from "./PocoStorageLib.sol"; /** - * @title Helpers shared by the PoCo facets: signature verification, address - * restrictions and deal volume computation. + * @title Helpers shared by the PoCo facets (signature verification, address + * restriction checks, deal volume computation, ...) */ library CommonLib { using ECDSA for bytes32; From d02c9dfb086a771f333636ccacc6dc5151b4fb51 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:06:12 +0200 Subject: [PATCH 10/17] refactor: convert IexecEscrow to the EscrowLib library The last of the three stateless helpers over diamond storage leaves contracts/abstract/, which now holds FacetBase alone. The four facets that inherited the escrow declare FacetBase directly instead; each of them uses it. IexecEscrowTestContract becomes a plain wrapper around the library. The library declares the five events it emits. solc 0.8.21 cannot compile a qualified `emit IexecEscrowEvents.Lock(...)` when userdoc is requested and docgen always requests it, so a second declaration is the only option; IexecEscrowEvents stays as the declaration that feeds IexecInterfaceToken, whose ABI is unchanged. Events now follow the emit path, so the dead entries disappear from the facet ABIs: IexecPoco1Facet drops from six events to Transfer and Lock, and IexecPoco2Facet and IexecPocoBoostFacet drop Approval. IexecEscrowTokenFacet is the exception. It reaches the events through IexecEscrowToken and also emits Transfer through the library, so its ABI lists Transfer twice and typechain generates 14 duplicate-identifier errors for it. Moving _mint, _burn and _approve into the library removes the duplicate; that is recorded as a TODO on the contract and deferred to the next PR. The members lose their leading underscores, which marked them as internal to a contract, so _transfer is now EscrowLib.transfer. The revert strings still read "IexecEscrow: ..." because tests assert on them. --- .../facets/IexecEscrowTokenFacet.json | 25 +++++ abis/contracts/facets/IexecPoco1Facet.json | 94 ------------------- abis/contracts/facets/IexecPoco2Facet.json | 25 ----- .../contracts/facets/IexecPocoBoostFacet.json | 25 ----- .../IexecEscrow.json => libs/EscrowLib.json} | 25 ----- .../IexecEscrowTokenFacet.json | 1 + .../IexecPoco1Facet.sol/IexecPoco1Facet.json | 4 - .../IexecPoco2Facet.sol/IexecPoco2Facet.json | 1 - .../IexecPocoBoostFacet.json | 1 - .../EscrowLib.sol/EscrowLib.json} | 1 - .../IexecEscrowTestContract.json | 1 - .../IexecPocoBoostCompositeFacet.json | 1 - .../testing/slither/Slither.sol/Slither.json | 1 - .../SlitherBoost.sol/SlitherBoost.json | 1 - contracts/facets/IexecEscrowTokenFacet.sol | 13 ++- contracts/facets/IexecPoco1Facet.sol | 12 ++- contracts/facets/IexecPoco2Facet.sol | 39 ++++---- contracts/facets/IexecPocoBoostFacet.sol | 32 ++++--- .../IexecEscrow.sol => libs/EscrowLib.sol} | 30 +++--- .../tools/testing/IexecEscrowTestContract.sol | 14 +-- 20 files changed, 107 insertions(+), 239 deletions(-) rename abis/contracts/{abstract/IexecEscrow.json => libs/EscrowLib.json} (81%) rename abis/human-readable-abis/contracts/{abstract/IexecEscrow.sol/IexecEscrow.json => libs/EscrowLib.sol/EscrowLib.json} (78%) rename contracts/{abstract/IexecEscrow.sol => libs/EscrowLib.sol} (77%) diff --git a/abis/contracts/facets/IexecEscrowTokenFacet.json b/abis/contracts/facets/IexecEscrowTokenFacet.json index 94c219396..d7d8980b0 100644 --- a/abis/contracts/facets/IexecEscrowTokenFacet.json +++ b/abis/contracts/facets/IexecEscrowTokenFacet.json @@ -139,6 +139,31 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/abis/contracts/facets/IexecPoco1Facet.json b/abis/contracts/facets/IexecPoco1Facet.json index 04119f496..e72e4b473 100644 --- a/abis/contracts/facets/IexecPoco1Facet.json +++ b/abis/contracts/facets/IexecPoco1Facet.json @@ -10,31 +10,6 @@ "name": "IncompatibleDatasetOrder", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -116,31 +91,6 @@ "name": "OrdersMatched", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Reward", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -160,31 +110,6 @@ "name": "SchedulerNotice", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Seize", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -210,25 +135,6 @@ "name": "Transfer", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Unlock", - "type": "event" - }, { "inputs": [ { diff --git a/abis/contracts/facets/IexecPoco2Facet.json b/abis/contracts/facets/IexecPoco2Facet.json index c5dd7eb13..e379af17d 100644 --- a/abis/contracts/facets/IexecPoco2Facet.json +++ b/abis/contracts/facets/IexecPoco2Facet.json @@ -23,31 +23,6 @@ "name": "AccurateContribution", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/abis/contracts/facets/IexecPocoBoostFacet.json b/abis/contracts/facets/IexecPocoBoostFacet.json index f4e8ddc06..753f46048 100644 --- a/abis/contracts/facets/IexecPocoBoostFacet.json +++ b/abis/contracts/facets/IexecPocoBoostFacet.json @@ -15,31 +15,6 @@ "name": "SafeCastOverflowedUintDowncast", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/abis/contracts/abstract/IexecEscrow.json b/abis/contracts/libs/EscrowLib.json similarity index 81% rename from abis/contracts/abstract/IexecEscrow.json rename to abis/contracts/libs/EscrowLib.json index 0c2a6141e..f8f92b4b0 100644 --- a/abis/contracts/abstract/IexecEscrow.json +++ b/abis/contracts/libs/EscrowLib.json @@ -1,29 +1,4 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json b/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json index 31b0d5cc0..35fad85c2 100644 --- a/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json +++ b/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json @@ -7,6 +7,7 @@ "event Reward(address,uint256,bytes32)", "event Seize(address,uint256,bytes32)", "event Transfer(address indexed,address indexed,uint256)", + "event Transfer(address indexed,address indexed,uint256)", "event Unlock(address,uint256)", "function approve(address,uint256) returns (bool)", "function approveAndCall(address,uint256,bytes) returns (bool)", diff --git a/abis/human-readable-abis/contracts/facets/IexecPoco1Facet.sol/IexecPoco1Facet.json b/abis/human-readable-abis/contracts/facets/IexecPoco1Facet.sol/IexecPoco1Facet.json index 4cd2ca141..0ac7214c8 100644 --- a/abis/human-readable-abis/contracts/facets/IexecPoco1Facet.sol/IexecPoco1Facet.json +++ b/abis/human-readable-abis/contracts/facets/IexecPoco1Facet.sol/IexecPoco1Facet.json @@ -1,14 +1,10 @@ [ "error IncompatibleDatasetOrder(string)", - "event Approval(address indexed,address indexed,uint256)", "event DealSponsored(bytes32,address)", "event Lock(address,uint256)", "event OrdersMatched(bytes32,bytes32,bytes32,bytes32,bytes32,uint256)", - "event Reward(address,uint256,bytes32)", "event SchedulerNotice(address indexed,bytes32)", - "event Seize(address,uint256,bytes32)", "event Transfer(address indexed,address indexed,uint256)", - "event Unlock(address,uint256)", "function assertDatasetDealCompatibility(tuple(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),bytes32) view", "function matchOrders(tuple(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),tuple(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),tuple(address,uint256,uint256,bytes32,uint256,uint256,address,address,address,bytes32,bytes),tuple(address,uint256,address,uint256,address,uint256,address,uint256,bytes32,uint256,uint256,address,address,string,bytes32,bytes)) returns (bytes32)", "function sponsorMatchOrders(tuple(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),tuple(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),tuple(address,uint256,uint256,bytes32,uint256,uint256,address,address,address,bytes32,bytes),tuple(address,uint256,address,uint256,address,uint256,address,uint256,bytes32,uint256,uint256,address,address,string,bytes32,bytes)) returns (bytes32)", diff --git a/abis/human-readable-abis/contracts/facets/IexecPoco2Facet.sol/IexecPoco2Facet.json b/abis/human-readable-abis/contracts/facets/IexecPoco2Facet.sol/IexecPoco2Facet.json index 00476c8a4..19ef5ebb3 100644 --- a/abis/human-readable-abis/contracts/facets/IexecPoco2Facet.sol/IexecPoco2Facet.json +++ b/abis/human-readable-abis/contracts/facets/IexecPoco2Facet.sol/IexecPoco2Facet.json @@ -1,7 +1,6 @@ [ "error MathOverflowedMulDiv()", "event AccurateContribution(address indexed,bytes32 indexed)", - "event Approval(address indexed,address indexed,uint256)", "event FaultyContribution(address indexed,bytes32 indexed)", "event Lock(address,uint256)", "event Reward(address,uint256,bytes32)", diff --git a/abis/human-readable-abis/contracts/facets/IexecPocoBoostFacet.sol/IexecPocoBoostFacet.json b/abis/human-readable-abis/contracts/facets/IexecPocoBoostFacet.sol/IexecPocoBoostFacet.json index c6025282e..a9b60c326 100644 --- a/abis/human-readable-abis/contracts/facets/IexecPocoBoostFacet.sol/IexecPocoBoostFacet.json +++ b/abis/human-readable-abis/contracts/facets/IexecPocoBoostFacet.sol/IexecPocoBoostFacet.json @@ -1,6 +1,5 @@ [ "error SafeCastOverflowedUintDowncast(uint8,uint256)", - "event Approval(address indexed,address indexed,uint256)", "event DealSponsoredBoost(bytes32,address)", "event Lock(address,uint256)", "event OrdersMatched(bytes32,bytes32,bytes32,bytes32,bytes32,uint256)", diff --git a/abis/human-readable-abis/contracts/abstract/IexecEscrow.sol/IexecEscrow.json b/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json similarity index 78% rename from abis/human-readable-abis/contracts/abstract/IexecEscrow.sol/IexecEscrow.json rename to abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json index ca70d06c7..1c6711547 100644 --- a/abis/human-readable-abis/contracts/abstract/IexecEscrow.sol/IexecEscrow.json +++ b/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json @@ -1,5 +1,4 @@ [ - "event Approval(address indexed,address indexed,uint256)", "event Lock(address,uint256)", "event Reward(address,uint256,bytes32)", "event Seize(address,uint256,bytes32)", diff --git a/abis/human-readable-abis/contracts/tools/testing/IexecEscrowTestContract.sol/IexecEscrowTestContract.json b/abis/human-readable-abis/contracts/tools/testing/IexecEscrowTestContract.sol/IexecEscrowTestContract.json index a52f7811a..8ba4f7fbf 100644 --- a/abis/human-readable-abis/contracts/tools/testing/IexecEscrowTestContract.sol/IexecEscrowTestContract.json +++ b/abis/human-readable-abis/contracts/tools/testing/IexecEscrowTestContract.sol/IexecEscrowTestContract.json @@ -1,5 +1,4 @@ [ - "event Approval(address indexed,address indexed,uint256)", "event Lock(address,uint256)", "event Reward(address,uint256,bytes32)", "event Seize(address,uint256,bytes32)", diff --git a/abis/human-readable-abis/contracts/tools/testing/IexecPocoBoostCompositeFacet.sol/IexecPocoBoostCompositeFacet.json b/abis/human-readable-abis/contracts/tools/testing/IexecPocoBoostCompositeFacet.sol/IexecPocoBoostCompositeFacet.json index 7570d62e0..c05089d16 100644 --- a/abis/human-readable-abis/contracts/tools/testing/IexecPocoBoostCompositeFacet.sol/IexecPocoBoostCompositeFacet.json +++ b/abis/human-readable-abis/contracts/tools/testing/IexecPocoBoostCompositeFacet.sol/IexecPocoBoostCompositeFacet.json @@ -1,6 +1,5 @@ [ "error SafeCastOverflowedUintDowncast(uint8,uint256)", - "event Approval(address indexed,address indexed,uint256)", "event DealSponsoredBoost(bytes32,address)", "event Lock(address,uint256)", "event OrdersMatched(bytes32,bytes32,bytes32,bytes32,bytes32,uint256)", diff --git a/abis/human-readable-abis/contracts/tools/testing/slither/Slither.sol/Slither.json b/abis/human-readable-abis/contracts/tools/testing/slither/Slither.sol/Slither.json index a96ed7baf..64a34952a 100644 --- a/abis/human-readable-abis/contracts/tools/testing/slither/Slither.sol/Slither.json +++ b/abis/human-readable-abis/contracts/tools/testing/slither/Slither.sol/Slither.json @@ -2,7 +2,6 @@ "error IncompatibleDatasetOrder(string)", "error MathOverflowedMulDiv()", "event AccurateContribution(address indexed,bytes32 indexed)", - "event Approval(address indexed,address indexed,uint256)", "event DealSponsored(bytes32,address)", "event FaultyContribution(address indexed,bytes32 indexed)", "event Lock(address,uint256)", diff --git a/abis/human-readable-abis/contracts/tools/testing/slither/SlitherBoost.sol/SlitherBoost.json b/abis/human-readable-abis/contracts/tools/testing/slither/SlitherBoost.sol/SlitherBoost.json index b5161b0f3..02b2f7a96 100644 --- a/abis/human-readable-abis/contracts/tools/testing/slither/SlitherBoost.sol/SlitherBoost.json +++ b/abis/human-readable-abis/contracts/tools/testing/slither/SlitherBoost.sol/SlitherBoost.json @@ -1,6 +1,5 @@ [ "error SafeCastOverflowedUintDowncast(uint8,uint256)", - "event Approval(address indexed,address indexed,uint256)", "event DealSponsoredBoost(bytes32,address)", "event Lock(address,uint256)", "event OrdersMatched(bytes32,bytes32,bytes32,bytes32,bytes32,uint256)", diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index 3305c1f47..85338c7ff 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {FacetBase} from "../abstract/FacetBase.sol"; -import {IexecEscrow} from "../abstract/IexecEscrow.sol"; +import {EscrowLib} from "../libs/EscrowLib.sol"; import {IexecEscrowToken} from "../interfaces/IexecEscrowToken.sol"; import {IexecTokenSpender} from "../interfaces/IexecTokenSpender.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; @@ -24,7 +24,12 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; * escrow itself (lock, unlock, reward, seize) run over the same ledger. */ // TODO rename to IexecEscrowFacet -contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, IexecEscrow { +// TODO move _mint, _burn and _approve into EscrowLib. This contract inherits the +// escrow events through IexecEscrowToken and also emits Transfer through the +// library, so its ABI lists Transfer twice and typechain generates duplicate +// identifiers for it. Moving the three writers into the library lets +// IexecEscrowToken drop `is IexecEscrowEvents`, which removes the duplicate. +contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase { /*************************************************************************** * Deposit and withdraw functions * ***************************************************************************/ @@ -217,7 +222,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, IexecEscr ***************************************************************************/ function transfer(address recipient, uint256 amount) external override returns (bool) { - _transfer(_msgSender(), recipient, amount); + EscrowLib.transfer(_msgSender(), recipient, amount); return true; } @@ -250,7 +255,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, IexecEscr uint256 amount ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _transfer(sender, recipient, amount); + EscrowLib.transfer(sender, recipient, amount); _approve(sender, _msgSender(), $.m_allowances[sender][_msgSender()] - amount); return true; } diff --git a/contracts/facets/IexecPoco1Facet.sol b/contracts/facets/IexecPoco1Facet.sol index 4ebcc6407..03e4d9566 100644 --- a/contracts/facets/IexecPoco1Facet.sol +++ b/contracts/facets/IexecPoco1Facet.sol @@ -11,7 +11,8 @@ import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; import {IexecPoco1Errors} from "../interfaces/IexecPoco1Errors.sol"; -import {IexecEscrow} from "../abstract/IexecEscrow.sol"; +import {FacetBase} from "../abstract/FacetBase.sol"; +import {EscrowLib} from "../libs/EscrowLib.sol"; import {CommonLib} from "../libs/CommonLib.sol"; struct Matching { @@ -25,7 +26,7 @@ struct Matching { bool hasDataset; } -contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { +contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, FacetBase { using Math for uint256; using IexecLibOrders_v5 for IexecLibOrders_v5.AppOrder; using IexecLibOrders_v5 for IexecLibOrders_v5.DatasetOrder; @@ -455,9 +456,12 @@ contract IexecPoco1Facet is IexecPoco1, IexecPoco1Errors, IexecEscrow { /** * Lock */ - lock(_sponsor, (deal.app.price + deal.dataset.price + deal.workerpool.price) * volume); + EscrowLib.lock( + _sponsor, + (deal.app.price + deal.dataset.price + deal.workerpool.price) * volume + ); //slither-disable-next-line divide-before-multiply - lock( + EscrowLib.lock( deal.workerpool.owner, ((deal.workerpool.price * WORKERPOOL_STAKE_RATIO) / 100) * volume // ORDER IS IMPORTANT HERE! ); diff --git a/contracts/facets/IexecPoco2Facet.sol b/contracts/facets/IexecPoco2Facet.sol index 0eac27b57..6071f99c3 100644 --- a/contracts/facets/IexecPoco2Facet.sol +++ b/contracts/facets/IexecPoco2Facet.sol @@ -9,10 +9,11 @@ import {IOracleConsumer} from "../external/interfaces/IOracleConsumer.sol"; import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IexecPoco2} from "../interfaces/IexecPoco2.sol"; -import {IexecEscrow} from "../abstract/IexecEscrow.sol"; +import {FacetBase} from "../abstract/FacetBase.sol"; +import {EscrowLib} from "../libs/EscrowLib.sol"; import {CommonLib} from "../libs/CommonLib.sol"; -contract IexecPoco2Facet is IexecPoco2, IexecEscrow { +contract IexecPoco2Facet is IexecPoco2, FacetBase { modifier onlyScheduler(bytes32 _taskId) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); require(_msgSender() == $.m_deals[$.m_tasks[_taskId].dealid].workerpool.owner); @@ -30,17 +31,17 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { uint256 poolstake = (deal.workerpool.price * WORKERPOOL_STAKE_RATIO) / 100; // Seize the payer of the task - seize(deal.sponsor, taskPrice, _taskid); + EscrowLib.seize(deal.sponsor, taskPrice, _taskid); // dapp reward if (deal.app.price > 0) { - reward(deal.app.owner, deal.app.price, _taskid); + EscrowLib.reward(deal.app.owner, deal.app.price, _taskid); } // data reward if (deal.dataset.price > 0 && deal.dataset.pointer != address(0)) { - reward(deal.dataset.owner, deal.dataset.price, _taskid); + EscrowLib.reward(deal.dataset.owner, deal.dataset.price, _taskid); } // unlock pool stake - unlock(deal.workerpool.owner, poolstake); + EscrowLib.unlock(deal.workerpool.owner, poolstake); // pool reward performed by consensus manager // Retrieve part of the kitty @@ -48,8 +49,8 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { if (kitty > 0) { // Get a fraction of the kitty where KITTY_MIN <= fraction <= kitty kitty = Math.min(Math.max((kitty * KITTY_RATIO) / 100, KITTY_MIN), kitty); - seize(KITTY_ADDRESS, kitty, _taskid); - reward(deal.workerpool.owner, kitty, _taskid); + EscrowLib.seize(KITTY_ADDRESS, kitty, _taskid); + EscrowLib.reward(deal.workerpool.owner, kitty, _taskid); } } @@ -60,10 +61,10 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { uint256 taskPrice = deal.app.price + deal.dataset.price + deal.workerpool.price; uint256 poolstake = (deal.workerpool.price * WORKERPOOL_STAKE_RATIO) / 100; - unlock(deal.sponsor, taskPrice); // Refund the payer of the task - seize(deal.workerpool.owner, poolstake, _taskid); + EscrowLib.unlock(deal.sponsor, taskPrice); // Refund the payer of the task + EscrowLib.seize(deal.workerpool.owner, poolstake, _taskid); // Reward kitty and lock value on it. - rewardAndLock(KITTY_ADDRESS, poolstake, _taskid); // → Kitty / Burn + EscrowLib.rewardAndLock(KITTY_ADDRESS, poolstake, _taskid); // → Kitty / Burn } /*************************************************************************** @@ -146,7 +147,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { task.contributors.push(_msgSender()); // Lock contribution. - lock(_msgSender(), deal.workerStake); + EscrowLib.lock(_msgSender(), deal.workerStake); emit TaskContribute(_taskid, _msgSender(), _resultHash); @@ -359,7 +360,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { for (uint256 i = 0; i < task.contributors.length; ++i) { address worker = task.contributors[i]; // Unlock contribution - unlock(worker, $.m_deals[task.dealid].workerStake); + EscrowLib.unlock(worker, $.m_deals[task.dealid].workerStake); } emit TaskClaimed(_taskid); @@ -447,9 +448,9 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { totalReward = totalReward - workerReward; // Unlock contribution - unlock(worker, deal.workerStake); + EscrowLib.unlock(worker, deal.workerStake); // Reward for contribution - reward(worker, workerReward, _taskid); + EscrowLib.reward(worker, workerReward, _taskid); // Only reward if replication happened if (task.contributors.length > 1) { @@ -466,7 +467,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { else { // No Reward // Seize contribution - seize(worker, deal.workerStake, _taskid); + EscrowLib.seize(worker, deal.workerStake, _taskid); // Always punish bad contributors { @@ -483,7 +484,7 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { } // totalReward now contains the scheduler share // Reward for scheduling. - reward(deal.workerpool.owner, totalReward, _taskid); + EscrowLib.reward(deal.workerpool.owner, totalReward, _taskid); } /* @@ -498,9 +499,9 @@ contract IexecPoco2Facet is IexecPoco2, IexecEscrow { uint256 workerReward = (deal.workerpool.price * (100 - deal.schedulerRewardRatio)) / 100; uint256 schedulerReward = deal.workerpool.price - workerReward; // Reward for contribution. - reward(_msgSender(), workerReward, _taskid); + EscrowLib.reward(_msgSender(), workerReward, _taskid); // Reward for scheduling. - reward(deal.workerpool.owner, schedulerReward, _taskid); + EscrowLib.reward(deal.workerpool.owner, schedulerReward, _taskid); } /** diff --git a/contracts/facets/IexecPocoBoostFacet.sol b/contracts/facets/IexecPocoBoostFacet.sol index 6857a0cde..e43fa35be 100644 --- a/contracts/facets/IexecPocoBoostFacet.sol +++ b/contracts/facets/IexecPocoBoostFacet.sol @@ -14,7 +14,8 @@ import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol"; import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol"; import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol"; import {IexecPocoBoost} from "../interfaces/IexecPocoBoost.sol"; -import {IexecEscrow} from "../abstract/IexecEscrow.sol"; +import {FacetBase} from "../abstract/FacetBase.sol"; +import {EscrowLib} from "../libs/EscrowLib.sol"; import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; import {CommonLib} from "../libs/CommonLib.sol"; @@ -26,7 +27,7 @@ import {CommonLib} from "../libs/CommonLib.sol"; * @title PoCo Boost to reduce latency and increase throughput of deals. * @notice Works for deals with requested trust = 0. */ -contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { +contract IexecPocoBoostFacet is IexecPocoBoost, FacetBase { using ECDSA for bytes32; using MessageHashUtils for bytes32; using Math for uint256; @@ -334,12 +335,15 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { $.m_consumed[workerpoolOrderTypedDataHash] = workerpoolOrderConsumed + volume; $.m_consumed[requestOrderTypedDataHash] = requestOrderConsumed + volume; // Lock deal price from sponsor balance. - lock(sponsor, (appPrice + datasetPrice + workerpoolPrice) * volume); + EscrowLib.lock(sponsor, (appPrice + datasetPrice + workerpoolPrice) * volume); // Lock deal stake from scheduler balance. // Order is important here. First get percentage by task then // multiply by volume. //slither-disable-next-line divide-before-multiply - lock(workerpoolOwner, ((workerpoolPrice * WORKERPOOL_STAKE_RATIO) / 100) * volume); + EscrowLib.lock( + workerpoolOwner, + ((workerpoolPrice * WORKERPOOL_STAKE_RATIO) / 100) * volume + ); // Notify workerpool. emit SchedulerNoticeBoost( workerpool, @@ -440,21 +444,21 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { uint96 workerPoolPrice = deal.workerpoolPrice; // Seize requester - seize(deal.requester, appPrice + datasetPrice + workerPoolPrice, taskId); + EscrowLib.seize(deal.requester, appPrice + datasetPrice + workerPoolPrice, taskId); uint96 workerReward = deal.workerReward; // Reward worker - reward(msg.sender, workerReward, taskId); + EscrowLib.reward(msg.sender, workerReward, taskId); // Reward app developer if (appPrice > 0) { - reward(deal.appOwner, appPrice, taskId); + EscrowLib.reward(deal.appOwner, appPrice, taskId); } // Reward dataset provider if (datasetPrice > 0) { - reward(deal.datasetOwner, datasetPrice, taskId); + EscrowLib.reward(deal.datasetOwner, datasetPrice, taskId); } // Unlock scheduler stake - unlock(workerpoolOwner, (workerPoolPrice * WORKERPOOL_STAKE_RATIO) / 100); + EscrowLib.unlock(workerpoolOwner, (workerPoolPrice * WORKERPOOL_STAKE_RATIO) / 100); // Reward scheduler uint256 kitty = $.m_frozens[KITTY_ADDRESS]; if (kitty > 0) { @@ -463,9 +467,9 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { // @dev As long as `KITTY_RATIO = 10`, we can introduce this small kitty / KITTY_RATIO // optimization for `kitty * KITTY_RATIO / 100` ).min(kitty); // 3. but no more than available - seize(KITTY_ADDRESS, kitty, taskId); + EscrowLib.seize(KITTY_ADDRESS, kitty, taskId); } - reward( + EscrowLib.reward( workerpoolOwner, workerPoolPrice - // reward with workerReward + // sheduler base reward @@ -513,11 +517,11 @@ contract IexecPocoBoostFacet is IexecPocoBoost, IexecEscrow { uint96 workerPoolPrice = deal.workerpoolPrice; uint256 workerpoolTaskStake = (workerPoolPrice * WORKERPOOL_STAKE_RATIO) / 100; // Refund the payer of the task by unlocking the locked funds. - unlock(deal.sponsor, deal.appPrice + deal.datasetPrice + workerPoolPrice); + EscrowLib.unlock(deal.sponsor, deal.appPrice + deal.datasetPrice + workerPoolPrice); // Seize task stake from workerpool. - seize(deal.workerpoolOwner, workerpoolTaskStake, taskId); + EscrowLib.seize(deal.workerpoolOwner, workerpoolTaskStake, taskId); // Reward kitty and lock the rewarded amount. - rewardAndLock(KITTY_ADDRESS, workerpoolTaskStake, taskId); + EscrowLib.rewardAndLock(KITTY_ADDRESS, workerpoolTaskStake, taskId); emit TaskClaimed(taskId); } diff --git a/contracts/abstract/IexecEscrow.sol b/contracts/libs/EscrowLib.sol similarity index 77% rename from contracts/abstract/IexecEscrow.sol rename to contracts/libs/EscrowLib.sol index 3a51fadaf..dfade1f9d 100644 --- a/contracts/abstract/IexecEscrow.sol +++ b/contracts/libs/EscrowLib.sol @@ -2,16 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; -import {IexecEscrowEvents} from "../interfaces/IexecEscrowEvents.sol"; -import {FacetBase} from "./FacetBase.sol"; - -// TODO convert to library +import {PocoStorageLib} from "./PocoStorageLib.sol"; /** * @title Manage (lock/unlock/reward/seize) user funds. + * @dev The events are declared here rather than taken from {IexecEscrowEvents} + * because solc 0.8.21 cannot compile a qualified `emit Other.Event(...)` when + * userdoc is requested, and docgen always requests it. A library publishes an + * event in the ABI of every contract that emits it along an inlined path, so + * {IexecEscrowEvents} stays as the single declaration feeding the aggregate + * interface. */ -abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { +library EscrowLib { + event Transfer(address indexed from, address indexed to, uint256 value); + event Reward(address owner, uint256 amount, bytes32 ref); + event Seize(address owner, uint256 amount, bytes32 ref); + event Lock(address owner, uint256 amount); + event Unlock(address owner, uint256 amount); + /** * Lock some value of an account. * @param account The account where the value should be locked. @@ -19,7 +27,7 @@ abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { */ function lock(address account, uint256 value) internal { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _transfer(account, address(this), value); + transfer(account, address(this), value); $.m_frozens[account] += value; emit Lock(account, value); } @@ -31,7 +39,7 @@ abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { */ function unlock(address account, uint256 value) internal { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _transfer(address(this), account, value); + transfer(address(this), account, value); $.m_frozens[account] -= value; emit Unlock(account, value); } @@ -43,7 +51,7 @@ abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { * @param ref A reference of the reward context. */ function reward(address account, uint256 value, bytes32 ref) internal { - _transfer(address(this), account, value); + transfer(address(this), account, value); emit Reward(account, value, ref); } @@ -79,7 +87,7 @@ abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { * Transfer value from a spender account to a receiver account. * @notice * This is the single implementation of an sRLC balance move. It backs both - * the escrow operations declared below (lock, unlock, reward) and the ERC-20 + * the escrow operations declared above (lock, unlock, reward) and the ERC-20 * entry points of {IexecEscrowTokenFacet}. * A self-transfer is a no-op on the balances and is not rejected. * @@ -87,7 +95,7 @@ abstract contract IexecEscrow is FacetBase, IexecEscrowEvents { * @param to The address of the receiver account. * @param value The value to transfer. */ - function _transfer(address from, address to, uint256 value) internal { + function transfer(address from, address to, uint256 value) internal { require(from != address(0), "IexecEscrow: Transfer from empty address"); require(to != address(0), "IexecEscrow: Transfer to empty address"); PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); diff --git a/contracts/tools/testing/IexecEscrowTestContract.sol b/contracts/tools/testing/IexecEscrowTestContract.sol index 4d20a5a34..0fe184fba 100644 --- a/contracts/tools/testing/IexecEscrowTestContract.sol +++ b/contracts/tools/testing/IexecEscrowTestContract.sol @@ -3,28 +3,28 @@ pragma solidity ^0.8.0; -import {IexecEscrow} from "../../abstract/IexecEscrow.sol"; +import {EscrowLib} from "../../libs/EscrowLib.sol"; import {PocoStorageLib} from "../../libs/PocoStorageLib.sol"; /** * @notice a wrapper contract to make internal functions of - * IexecEscrow testable. + * EscrowLib testable. */ -contract IexecEscrowTestContract is IexecEscrow { +contract IexecEscrowTestContract { function lock_(address account, uint256 value) external { - lock(account, value); + EscrowLib.lock(account, value); } function unlock_(address account, uint256 value) external { - unlock(account, value); + EscrowLib.unlock(account, value); } function reward_(address account, uint256 value, bytes32 ref) external { - reward(account, value, ref); + EscrowLib.reward(account, value, ref); } function seize_(address account, uint256 value, bytes32 ref) external { - seize(account, value, ref); + EscrowLib.seize(account, value, ref); } // Helper functions used in unit tests. From d1de9fa018756acf516cb4a4091d8b95051f88c6 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:13:31 +0200 Subject: [PATCH 11/17] chore: clean comment --- contracts/facets/IexecEscrowTokenFacet.sol | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index 85338c7ff..b6d608ce4 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -24,11 +24,7 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; * escrow itself (lock, unlock, reward, seize) run over the same ledger. */ // TODO rename to IexecEscrowFacet -// TODO move _mint, _burn and _approve into EscrowLib. This contract inherits the -// escrow events through IexecEscrowToken and also emits Transfer through the -// library, so its ABI lists Transfer twice and typechain generates duplicate -// identifiers for it. Moving the three writers into the library lets -// IexecEscrowToken drop `is IexecEscrowEvents`, which removes the duplicate. +// TODO move _mint, _burn and _approve into EscrowLib. contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase { /*************************************************************************** * Deposit and withdraw functions * From 588de351565759e36f2fdbce60e5faf666df50d7 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:15:48 +0200 Subject: [PATCH 12/17] docs: regenerate the solidity docs and the UML diagrams The IexecEscrow section becomes EscrowLib and now documents the five events the library declares. The class diagrams pick up CommonLib, EscrowLib and the facets that reach FacetBase directly. sol-to-uml.mjs named IexecEscrow as a base contract of the IexecEscrows diagram; it is EscrowLib now. --- docs/solidity/index.md | 41 +- docs/uml/class-uml-IexecEscrows.svg | 1202 ++++++------ docs/uml/class-uml-IexecPocoBoostFacet.svg | 1519 ++++++++-------- docs/uml/class-uml-IexecPocoFacets.svg | 1921 ++++++++++---------- docs/uml/class-uml-dir-libs.svg | 1254 +++++++------ scripts/tools/sol-to-uml.mjs | 2 +- 6 files changed, 2965 insertions(+), 2974 deletions(-) diff --git a/docs/solidity/index.md b/docs/solidity/index.md index 6734cf1c7..5a7936282 100644 --- a/docs/solidity/index.md +++ b/docs/solidity/index.md @@ -12,8 +12,6 @@ Changing the name or the path would cause a breaking change in the SDK._ _Every facet must inherit from this contract._ -## IexecEscrow - ## IexecCategoryManagerFacet ### createCategory @@ -795,6 +793,45 @@ function broadcastWorkerpoolOrder(struct IexecLibOrders_v5.WorkerpoolOrder _work function broadcastRequestOrder(struct IexecLibOrders_v5.RequestOrder _requestorder) external ``` +## EscrowLib + +_The events are declared here rather than taken from {IexecEscrowEvents} +because solc 0.8.21 cannot compile a qualified `emit Other.Event(...)` when +userdoc is requested, and docgen always requests it. A library publishes an +event in the ABI of every contract that emits it along an inlined path, so +{IexecEscrowEvents} stays as the single declaration feeding the aggregate +interface._ + +### Transfer + +```solidity +event Transfer(address from, address to, uint256 value) +``` + +### Reward + +```solidity +event Reward(address owner, uint256 amount, bytes32 ref) +``` + +### Seize + +```solidity +event Seize(address owner, uint256 amount, bytes32 ref) +``` + +### Lock + +```solidity +event Lock(address owner, uint256 amount) +``` + +### Unlock + +```solidity +event Unlock(address owner, uint256 amount) +``` + ## IexecLibCore_v5 ### Account diff --git a/docs/uml/class-uml-IexecEscrows.svg b/docs/uml/class-uml-IexecEscrows.svg index e96b334d3..0e3177c4d 100644 --- a/docs/uml/class-uml-IexecEscrows.svg +++ b/docs/uml/class-uml-IexecEscrows.svg @@ -4,60 +4,273 @@ - + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() - - + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() + + -4 - -<<Abstract>> -IexecEscrow -contracts/abstract/IexecEscrow.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    _transfer(from: address, to: address, value: uint256) - - - -4->3 - - +8 + +IexecEscrowTokenFacet +contracts/facets/IexecEscrowTokenFacet.sol + +Internal: +    _executeOperation(sender: address, data: bytes) +    _validateMatchOrders(sender: address, data: bytes) +    _deposit(from: address, amount: uint256) +    _withdraw(to: address, amount: uint256) +    _mint(account: address, amount: uint256) +    _burn(account: address, amount: uint256) +    _approve(owner: address, spender: address, amount: uint256) +External: +    <<payable>> null() +    <<payable>> null() +    deposit(amount: uint256): bool +    depositFor(amount: uint256, target: address): bool +    depositForArray(amounts: uint256[], targets: address[]): bool +    withdraw(amount: uint256): bool +    withdrawTo(amount: uint256, target: address): bool +    recover(): uint256 <<onlyOwner>> +    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool +    transfer(recipient: address, amount: uint256): bool +    approve(spender: address, value: uint256): bool +    approveAndCall(spender: address, value: uint256, extraData: bytes): bool +    transferFrom(sender: address, recipient: address, amount: uint256): bool +    increaseAllowance(spender: address, addedValue: uint256): bool +    decreaseAllowance(spender: address, subtractedValue: uint256): bool + + + +8->3 + + - + -25 +23 + +<<Interface>> +IexecEscrowToken +contracts/interfaces/IexecEscrowToken.sol + +External: +     null() +     null() +     deposit(uint256): bool +     depositFor(uint256, address): bool +     depositForArray(uint256[], address[]): bool +     withdraw(uint256): bool +     withdrawTo(uint256, address): bool +     recover(): uint256 +     transfer(address, uint256): bool +     approve(address, uint256): bool +     transferFrom(address, address, uint256): bool +     increaseAllowance(address, uint256): bool +     decreaseAllowance(address, uint256): bool +     approveAndCall(address, uint256, bytes): bool + + + +8->23 + + + + + +26 + +<<Interface>> +IexecPoco1 +contracts/interfaces/IexecPoco1.sol + +External: +     verifySignature(address, bytes32, bytes): bool +     verifyPresignature(address, bytes32): bool +     verifyPresignatureOrSignature(address, bytes32, bytes): bool +     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +Public: +    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> DealSponsored(dealId: bytes32, sponsor: address) + + + +8->26 + + + + + +33 + +<<Interface>> +IexecTokenSpender +contracts/interfaces/IexecTokenSpender.sol + +External: +     receiveApproval(address, uint256, address, bytes): bool + + + +8->33 + + + + + +35 + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +    transfer(from: address, to: address, value: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) + + + +8->35 + + + + + +50 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 + + + +8->50 + + + + + +61 + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) + + + +8->61 + + + + + +62 + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + + + +8->62 + + + + + +22 <<Interface>> IexecEscrowEvents @@ -71,641 +284,428 @@    <<event>> Lock(owner: address, amount: uint256)    <<event>> Unlock(owner: address, amount: uint256) - - -4->25 - - - - - -62 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) - - - -4->62 - - - - - -63 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) - - - -4->63 - - - - - -11 - -IexecEscrowTokenFacet -contracts/facets/IexecEscrowTokenFacet.sol - -Internal: -    _executeOperation(sender: address, data: bytes) -    _validateMatchOrders(sender: address, data: bytes) -    _deposit(from: address, amount: uint256) -    _withdraw(to: address, amount: uint256) -    _mint(account: address, amount: uint256) -    _burn(account: address, amount: uint256) -    _approve(owner: address, spender: address, amount: uint256) -External: -    <<payable>> null() -    <<payable>> null() -    deposit(amount: uint256): bool -    depositFor(amount: uint256, target: address): bool -    depositForArray(amounts: uint256[], targets: address[]): bool -    withdraw(amount: uint256): bool -    withdrawTo(amount: uint256, target: address): bool -    recover(): uint256 <<onlyOwner>> -    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool -    transfer(recipient: address, amount: uint256): bool -    approve(spender: address, value: uint256): bool -    approveAndCall(spender: address, value: uint256, extraData: bytes): bool -    transferFrom(sender: address, recipient: address, amount: uint256): bool -    increaseAllowance(spender: address, addedValue: uint256): bool -    decreaseAllowance(spender: address, subtractedValue: uint256): bool - - - -11->4 - - + + +23->22 + + - + -26 - -<<Interface>> -IexecEscrowToken -contracts/interfaces/IexecEscrowToken.sol - -External: -     null() -     null() -     deposit(uint256): bool -     depositFor(uint256, address): bool -     depositForArray(uint256[], address[]): bool -     withdraw(uint256): bool -     withdrawTo(uint256, address): bool -     recover(): uint256 -     transfer(address, uint256): bool -     approve(address, uint256): bool -     transferFrom(address, address, uint256): bool -     increaseAllowance(address, uint256): bool -     decreaseAllowance(address, uint256): bool -     approveAndCall(address, uint256, bytes): bool - - - -11->26 - - - - - -29 - -<<Interface>> -IexecPoco1 -contracts/interfaces/IexecPoco1.sol - -External: -     verifySignature(address, bytes32, bytes): bool -     verifyPresignature(address, bytes32): bool -     verifyPresignatureOrSignature(address, bytes32, bytes): bool -     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -Public: -    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> DealSponsored(dealId: bytes32, sponsor: address) - - +24 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 + + -11->29 - - +26->50 + + - - -36 - -<<Interface>> -IexecTokenSpender -contracts/interfaces/IexecTokenSpender.sol - -External: -     receiveApproval(address, uint256, address, bytes): bool - - - -11->36 - - - - - -51 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 - - - -11->51 - - - - - -11->62 - - - - - -11->63 - - - - + + +53 + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + -26->25 - - - - - -27 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 - - - -29->51 - - +26->53 + + - + 54 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -29->54 - - + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +26->54 + + - + 55 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -29->55 - - + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +26->55 + + - + 56 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -29->56 - - + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes + + + +26->56 + + - - -57 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes - - - -29->57 - - + + +35->61 + + + + + +35->62 + + - + -37 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol +36 + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol - + -53 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address - - +52 + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address + + + +50->52 + + + + -51->53 - - +50->53 + + - + -51->54 - - +50->54 + + - + -51->55 - - +50->55 + + - + -51->56 - - +50->56 + + - + + +57 + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes + + -51->57 - - +50->57 + + - + 58 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes - - + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes + + -51->58 - - +50->58 + + - + 59 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes - - + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes + + -51->59 - - +50->59 + + - + 60 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes - - + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes + + -51->60 - - - - - -61 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes - - - -51->61 - - +50->60 + + - + -52 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 - - +51 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 + + + +51->50 + + + + -52->51 - - +52->50 + + - + -53->51 - - +53->50 + + - + -54->51 - - +54->50 + + - + -55->51 - - +55->50 + + - + -56->51 - - +56->50 + + - + +57->50 + + + + + 57->51 - - + + - + + +57->53 + + + + -58->51 - - +58->50 + + - - -58->52 - - + + +58->51 + + - + 58->54 - - + + - + -59->51 - - +59->50 + + - - -59->52 - - + + +59->51 + + - + 59->55 - - + + - + -60->51 - - +60->50 + + - - -60->52 - - + + +60->51 + + - + 60->56 - - + + - - -61->51 - - + + +61->62 + + + + + +62->24 + + + + + +62->36 + + - + -61->52 - - +62->61 + + - - -61->57 - - + + +63 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool 62->63 - - - - - -63->27 - - - - - -63->37 - - - - - -63->62 - - - - - -64 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - - -63->64 - - + + diff --git a/docs/uml/class-uml-IexecPocoBoostFacet.svg b/docs/uml/class-uml-IexecPocoBoostFacet.svg index 55a6dcefd..4eefbacf7 100644 --- a/docs/uml/class-uml-IexecPocoBoostFacet.svg +++ b/docs/uml/class-uml-IexecPocoBoostFacet.svg @@ -4,890 +4,831 @@ - - + + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() - - + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() + + -4 - -<<Abstract>> -IexecEscrow -contracts/abstract/IexecEscrow.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    _transfer(from: address, to: address, value: uint256) - - - -4->3 - - - - - -25 - -<<Interface>> -IexecEscrowEvents -contracts/interfaces/IexecEscrowEvents.sol - -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Approval(owner: address, spender: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) - - - -4->25 - - - - - -62 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) - - - -4->62 - - - - - -63 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) - - - -4->63 - - - - +67 + +<<Interface>> +IOracleConsumer +contracts/external/interfaces/IOracleConsumer.sol + +External: +     receiveResult(taskId: bytes32, resultsCallback: bytes) + + -5 - -<<Abstract>> -IexecPocoCommon -contracts/abstract/IexecPocoCommon.sol - -Internal: -    _computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 - - - -5->3 - - - - - -51 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 - - - -5->51 - - - - - -5->62 - - - - - -5->63 - - - - - -6 - -<<Abstract>> -SignatureVerifier -contracts/abstract/SignatureVerifier.sol - -Internal: -    _toTypedDataHash(structHash: bytes32): bytes32 -    _verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool -    _verifySignature(account: address, messageHash: bytes32, signature: bytes): bool -    _verifyPresignature(account: address, messageHash: bytes32): bool -    _verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool -    _isAccountAuthorizedByRestriction(restriction: address, account: address): bool - - - -6->3 - - - - - -6->62 - - +15 + +IexecPocoBoostFacet +contracts/facets/IexecPocoBoostFacet.sol + +Private: +    _matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder, sponsor: address): bytes32 +    requireTaskExistsAndUnset(taskStatus: IexecLibCore_v5.TaskStatusEnum, taskIndex: uint256, botSize: uint16) +External: +    matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +    sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +    pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) +    claimBoost(dealId: bytes32, index: uint256) + + + +15->3 + + - - -6->63 - - + + +15->67 + + - + -68 - -<<Interface>> -IOracleConsumer -contracts/external/interfaces/IOracleConsumer.sol - -External: -     receiveResult(taskId: bytes32, resultsCallback: bytes) - - - -18 - -IexecPocoBoostFacet -contracts/facets/IexecPocoBoostFacet.sol - -Private: -    _matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder, sponsor: address): bytes32 -    requireTaskExistsAndUnset(taskStatus: IexecLibCore_v5.TaskStatusEnum, taskIndex: uint256, botSize: uint16) -External: -    matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -    sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -    pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) -    claimBoost(dealId: bytes32, index: uint256) - - - -18->4 - - +30 + +<<Interface>> +IexecPocoBoost +contracts/interfaces/IexecPocoBoost.sol + +External: +     matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +     pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) +     claimBoost(dealId: bytes32, index: uint256) +Public: +    <<event>> SchedulerNoticeBoost(workerpool: address, dealId: bytes32, app: address, dataset: address, category: uint256, tag: bytes32, params: string, beneficiary: address) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> ResultPushedBoost(dealId: bytes32, index: uint256, results: bytes) +    <<event>> TaskClaimed(taskid: bytes32) +    <<event>> DealSponsoredBoost(dealId: bytes32, sponsor: address) + + + +15->30 + + - - -18->5 - - + + +34 + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + + + +15->34 + + - + + +35 + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +    transfer(from: address, to: address, value: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) + + -18->6 - - +15->35 + + - - -18->68 - - + + +36 + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol + + + +15->36 + + - + -33 - -<<Interface>> -IexecPocoBoost -contracts/interfaces/IexecPocoBoost.sol - -External: -     matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -     pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) -     claimBoost(dealId: bytes32, index: uint256) -Public: -    <<event>> SchedulerNoticeBoost(workerpool: address, dealId: bytes32, app: address, dataset: address, category: uint256, tag: bytes32, params: string, beneficiary: address) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> ResultPushedBoost(dealId: bytes32, index: uint256, results: bytes) -    <<event>> TaskClaimed(taskid: bytes32) -    <<event>> DealSponsoredBoost(dealId: bytes32, sponsor: address) - - +44 + +<<Struct>> +DealBoost +contracts/libs/IexecLibCore_v5.sol + +appOwner: address +appPrice: uint96 +datasetOwner: address +datasetPrice: uint96 +workerpoolOwner: address +workerpoolPrice: uint96 +requester: address +workerReward: uint96 +callback: address +deadline: uint40 +botFirst: uint16 +botSize: uint16 +shortTag: bytes3 +sponsor: address + + -18->33 - - - - - -37 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol - - - -18->37 - - +15->44 + + - + 45 - -<<Struct>> -DealBoost -contracts/libs/IexecLibCore_v5.sol - -appOwner: address -appPrice: uint96 -datasetOwner: address -datasetPrice: uint96 -workerpoolOwner: address -workerpoolPrice: uint96 -requester: address -workerReward: uint96 -callback: address -deadline: uint40 -botFirst: uint16 -botSize: uint16 -shortTag: bytes3 -sponsor: address - - - -18->45 - - + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 + + + +15->45 + + - + 46 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 - - - -18->46 - - + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes + + + +15->46 + + - - -47 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes - - - -18->47 - - + + +50 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 + + + +15->50 + + - - -18->51 - - + + +53 + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +15->53 + + - + 54 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -18->54 - - + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +15->54 + + - + 55 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -18->55 - - + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +15->55 + + - + 56 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes + + + +15->56 + + + + + +61 + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) + + + +15->61 + + + + + +62 + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + + + +15->62 + + + + + +78 + +<<Interface>> +IWorkerpool +contracts/registries/workerpools/IWorkerpool.v8.sol + +External: +     owner(): address +     m_workerpoolDescription(): string +     m_schedulerRewardRatioPolicy(): uint256 +     m_workerStakeRatioPolicy(): uint256 + + + +15->78 + + + + + +24 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 + + + +30->50 + + + + -18->56 - - +30->53 + + - - -57 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes - - + -18->57 - - +30->54 + + - + -18->62 - - +30->55 + + - + -18->63 - - - - - -79 - -<<Interface>> -IWorkerpool -contracts/registries/workerpools/IWorkerpool.v8.sol - -External: -     owner(): address -     m_workerpoolDescription(): string -     m_schedulerRewardRatioPolicy(): uint256 -     m_workerStakeRatioPolicy(): uint256 - - - -18->79 - - +30->56 + + - - -27 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 - - - -33->51 - - + + +34->61 + + - - -33->54 - - + + +34->62 + + - - -33->55 - - + + +35->61 + + - - -33->56 - - + + +35->62 + + - - -33->57 - - + + +44->36 + + - - -45->37 - - + + +45->36 + + - - -46->37 - - + + +46->36 + + - - -47->37 - - + + +46->45 + + - - -47->46 - - + + +52 + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address + + + +50->52 + + - - -53 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address - - - -51->53 - - + + +50->53 + + - - -51->54 - - + + +50->54 + + - - -51->55 - - + + +50->55 + + - - -51->56 - - + + +50->56 + + - - -51->57 - - + + +57 + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes + + + +50->57 + + - + 58 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes - - - -51->58 - - + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes + + + +50->58 + + - + 59 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes - - - -51->59 - - + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes + + + +50->59 + + - + 60 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes - - - -51->60 - - + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes + + + +50->60 + + - - -61 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes - - - -51->61 - - + + +51 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 + + + +51->50 + + - - -52 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 - - - -52->51 - - + + +52->50 + + - - -53->51 - - + + +53->50 + + - - -54->51 - - + + +54->50 + + - - -55->51 - - + + +55->50 + + - - -56->51 - - + + +56->50 + + + + + +57->50 + + - + 57->51 - - + + + + + +57->53 + + + + + +58->50 + + - + 58->51 - - - - - -58->52 - - + + - + 58->54 - - + + + + + +59->50 + + - + 59->51 - - - - - -59->52 - - + + - + 59->55 - - + + + + + +60->50 + + - + 60->51 - - + + + + + +60->56 + + + + + +61->62 + + - + -60->52 - - +62->24 + + - + -60->56 - - +62->36 + + - - -61->51 - - - - - -61->52 - - - - - -61->57 - - + + +62->61 + + + + + +63 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool - + 62->63 - - - - - -63->27 - - - - - -63->37 - - - - - -63->62 - - - - - -64 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - - -63->64 - - + + diff --git a/docs/uml/class-uml-IexecPocoFacets.svg b/docs/uml/class-uml-IexecPocoFacets.svg index 2b01ae3df..49bedeb83 100644 --- a/docs/uml/class-uml-IexecPocoFacets.svg +++ b/docs/uml/class-uml-IexecPocoFacets.svg @@ -4,1106 +4,1053 @@ - + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() - - + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() + + -4 - -<<Abstract>> -IexecEscrow -contracts/abstract/IexecEscrow.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    _transfer(from: address, to: address, value: uint256) - - - -4->3 - - +10 + +<<Struct>> +Matching +contracts/facets/IexecPoco1Facet.sol + +apporderHash: bytes32 +appOwner: address +datasetorderHash: bytes32 +datasetOwner: address +workerpoolorderHash: bytes32 +workerpoolOwner: address +requestorderHash: bytes32 +hasDataset: bool + + + +11 + +IexecPoco1Facet +contracts/facets/IexecPoco1Facet.sol + +Private: +    _matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder, _sponsor: address): bytes32 +    _ignoreTeeFramework(tag: bytes32): bytes32 +External: +    verifySignature(_identity: address, _hash: bytes32, _signature: bytes): bool +    verifyPresignature(_identity: address, _hash: bytes32): bool +    verifyPresignatureOrSignature(_identity: address, _hash: bytes32, _signature: bytes): bool +    assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +    matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 +    sponsorMatchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 + + + +11->3 + + - - -25 - -<<Interface>> -IexecEscrowEvents -contracts/interfaces/IexecEscrowEvents.sol - -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Approval(owner: address, spender: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) - - - -4->25 - - + + +11->10 + + - - -62 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) - - - -4->62 - - + + +26 + +<<Interface>> +IexecPoco1 +contracts/interfaces/IexecPoco1.sol + +External: +     verifySignature(address, bytes32, bytes): bool +     verifyPresignature(address, bytes32): bool +     verifyPresignatureOrSignature(address, bytes32, bytes): bool +     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +Public: +    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> DealSponsored(dealId: bytes32, sponsor: address) + + + +11->26 + + - - -63 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) - - - -4->63 - - + + +27 + +<<Interface>> +IexecPoco1Errors +contracts/interfaces/IexecPoco1Errors.sol - - -5 - -<<Abstract>> -IexecPocoCommon -contracts/abstract/IexecPocoCommon.sol - -Internal: -    _computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 - - - -5->3 - - + + +11->27 + + - - -51 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 - - - -5->51 - - + + +34 + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + + + +11->34 + + - - -5->62 - - + + +35 + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +    transfer(from: address, to: address, value: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) + + + +11->35 + + - - -5->63 - - + + +36 + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol - - -6 - -<<Abstract>> -SignatureVerifier -contracts/abstract/SignatureVerifier.sol - -Internal: -    _toTypedDataHash(structHash: bytes32): bytes32 -    _verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool -    _verifySignature(account: address, messageHash: bytes32, signature: bytes): bool -    _verifyPresignature(account: address, messageHash: bytes32): bool -    _verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool -    _isAccountAuthorizedByRestriction(restriction: address, account: address): bool - - + -6->3 - - +11->36 + + - + + +43 + +<<Struct>> +Deal +contracts/libs/IexecLibCore_v5.sol + +app: Resource +dataset: Resource +workerpool: Resource +trust: uint256 +category: uint256 +tag: bytes32 +requester: address +beneficiary: address +callback: address +params: string +startTime: uint256 +botFirst: uint256 +botSize: uint256 +workerStake: uint256 +schedulerRewardRatio: uint256 +sponsor: address + + -6->62 - - +11->43 + + - - -6->63 - - - - - -13 - -<<Struct>> -Matching -contracts/facets/IexecPoco1Facet.sol - -apporderHash: bytes32 -appOwner: address -datasetorderHash: bytes32 -datasetOwner: address -workerpoolorderHash: bytes32 -workerpoolOwner: address -requestorderHash: bytes32 -hasDataset: bool - - - -14 - -IexecPoco1Facet -contracts/facets/IexecPoco1Facet.sol - -Private: -    _matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder, _sponsor: address): bytes32 -    _ignoreTeeFramework(tag: bytes32): bytes32 -External: -    verifySignature(_identity: address, _hash: bytes32, _signature: bytes): bool -    verifyPresignature(_identity: address, _hash: bytes32): bool -    verifyPresignatureOrSignature(_identity: address, _hash: bytes32, _signature: bytes): bool -    assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -    matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 -    sponsorMatchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 - - - -14->4 - - - - - -14->5 - - + + +50 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 + + + +11->50 + + - - -14->6 - - + + +53 + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +11->53 + + - - -14->13 - - + + +54 + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +11->54 + + - - -29 - -<<Interface>> -IexecPoco1 -contracts/interfaces/IexecPoco1.sol - -External: -     verifySignature(address, bytes32, bytes): bool -     verifyPresignature(address, bytes32): bool -     verifyPresignatureOrSignature(address, bytes32, bytes): bool -     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -Public: -    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> DealSponsored(dealId: bytes32, sponsor: address) - - + + +55 + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + -14->29 - - - - - -30 - -<<Interface>> -IexecPoco1Errors -contracts/interfaces/IexecPoco1Errors.sol +11->55 + + - + + +56 + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes + + -14->30 - - +11->56 + + - - -37 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + + +61 + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) + + + +11->61 + + - - -14->37 - - + + +62 + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + + + +11->62 + + - - -44 - -<<Struct>> -Deal -contracts/libs/IexecLibCore_v5.sol - -app: Resource -dataset: Resource -workerpool: Resource -trust: uint256 -category: uint256 -tag: bytes32 -requester: address -beneficiary: address -callback: address -params: string -startTime: uint256 -botFirst: uint256 -botSize: uint256 -workerStake: uint256 -schedulerRewardRatio: uint256 -sponsor: address - - - -14->44 - - + + +78 + +<<Interface>> +IWorkerpool +contracts/registries/workerpools/IWorkerpool.v8.sol + +External: +     owner(): address +     m_workerpoolDescription(): string +     m_schedulerRewardRatioPolicy(): uint256 +     m_workerStakeRatioPolicy(): uint256 + + + +11->78 + + - + + +12 + +IexecPoco2Facet +contracts/facets/IexecPoco2Facet.sol + +Internal: +    successWork(_dealid: bytes32, _taskid: bytes32) +    failedWork(_dealid: bytes32, _taskid: bytes32) +    checkConsensus(_taskid: bytes32, _consensus: bytes32) +    distributeRewards(_taskid: bytes32) +    distributeRewardsFast(_taskid: bytes32) +    executeCallback(_taskid: bytes32, _resultsCallback: bytes) +External: +    contribute(_taskid: bytes32, _resultHash: bytes32, _resultSeal: bytes32, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) +    contributeAndFinalize(_taskid: bytes32, _resultDigest: bytes32, _results: bytes, _resultsCallback: bytes, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) +    reveal(_taskid: bytes32, _resultDigest: bytes32) +    reopen(_taskid: bytes32) <<onlyScheduler>> +    finalize(_taskid: bytes32, _results: bytes, _resultsCallback: bytes) <<onlyScheduler>> +    initializeArray(_dealid: bytes32[], _idx: uint256[]): bool +    claimArray(_taskid: bytes32[]): bool +    initializeAndClaimArray(_dealid: bytes32[], _idx: uint256[]): bool +Public: +    <<modifier>> onlyScheduler(_taskId: bytes32) +    initialize(_dealid: bytes32, idx: uint256): bytes32 +    claim(_taskid: bytes32) + + + +12->3 + + + + + +28 + +<<Interface>> +IexecPoco2 +contracts/interfaces/IexecPoco2.sol + +External: +     initialize(dealId: bytes32, index: uint256): bytes32 +     claim(taskId: bytes32) +     contribute(taskId: bytes32, resultHash: bytes32, resultSeal: bytes32, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) +     contributeAndFinalize(taskId: bytes32, resultDigest: bytes32, results: bytes, resultsCallback: bytes, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) +     reveal(taskId: bytes32, resultDigest: bytes32) +     reopen(taskId: bytes32) +     finalize(taskId: bytes32, results: bytes, resultsCallback: bytes) +     initializeArray(dealIds: bytes32[], indexes: uint256[]): bool +     claimArray(taskIds: bytes32[]): bool +     initializeAndClaimArray(dealIds: bytes32[], indexes: uint256[]): bool +Public: +    <<event>> AccurateContribution(worker: address, taskid: bytes32) +    <<event>> FaultyContribution(worker: address, taskid: bytes32) +    <<event>> TaskInitialize(taskid: bytes32, workerpool: address) +    <<event>> TaskContribute(taskid: bytes32, worker: address, hash: bytes32) +    <<event>> TaskConsensus(taskid: bytes32, consensus: bytes32) +    <<event>> TaskReveal(taskid: bytes32, worker: address, digest: bytes32) +    <<event>> TaskReopen(taskid: bytes32) +    <<event>> TaskFinalize(taskid: bytes32, results: bytes) +    <<event>> TaskClaimed(taskid: bytes32) + + -14->51 - - +12->28 + + - - -54 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - + + +12->34 + + + + -14->54 - - +12->35 + + - - -55 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -14->55 - - + + +12->36 + + - - -56 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - + + +12->43 + + + + + +46 + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes + + -14->56 - - +12->46 + + - - -57 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes - - + + +47 + +<<Struct>> +Consensus +contracts/libs/IexecLibCore_v5.sol + +group: mapping(bytes32=>uint256) +total: uint256 + + + +12->47 + + + + + +49 + +<<Struct>> +Contribution +contracts/libs/IexecLibCore_v5.sol + +status: ContributionStatusEnum +resultHash: bytes32 +resultSeal: bytes32 +enclaveChallenge: address +weight: uint256 + + -14->57 - - +12->49 + + - + -14->62 - - +12->61 + + - + -14->63 - - - - - -79 - -<<Interface>> -IWorkerpool -contracts/registries/workerpools/IWorkerpool.v8.sol - -External: -     owner(): address -     m_workerpoolDescription(): string -     m_schedulerRewardRatioPolicy(): uint256 -     m_workerStakeRatioPolicy(): uint256 - - - -14->79 - - +12->62 + + - - -15 - -IexecPoco2Facet -contracts/facets/IexecPoco2Facet.sol - -Internal: -    successWork(_dealid: bytes32, _taskid: bytes32) -    failedWork(_dealid: bytes32, _taskid: bytes32) -    checkConsensus(_taskid: bytes32, _consensus: bytes32) -    distributeRewards(_taskid: bytes32) -    distributeRewardsFast(_taskid: bytes32) -    executeCallback(_taskid: bytes32, _resultsCallback: bytes) -External: -    contribute(_taskid: bytes32, _resultHash: bytes32, _resultSeal: bytes32, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) -    contributeAndFinalize(_taskid: bytes32, _resultDigest: bytes32, _results: bytes, _resultsCallback: bytes, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) -    reveal(_taskid: bytes32, _resultDigest: bytes32) -    reopen(_taskid: bytes32) <<onlyScheduler>> -    finalize(_taskid: bytes32, _results: bytes, _resultsCallback: bytes) <<onlyScheduler>> -    initializeArray(_dealid: bytes32[], _idx: uint256[]): bool -    claimArray(_taskid: bytes32[]): bool -    initializeAndClaimArray(_dealid: bytes32[], _idx: uint256[]): bool -Public: -    <<modifier>> onlyScheduler(_taskId: bytes32) -    initialize(_dealid: bytes32, idx: uint256): bytes32 -    claim(_taskid: bytes32) - - - -15->4 - - + + +24 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 + + + +26->50 + + - + -15->6 - - +26->53 + + - - -31 - -<<Interface>> -IexecPoco2 -contracts/interfaces/IexecPoco2.sol - -External: -     initialize(dealId: bytes32, index: uint256): bytes32 -     claim(taskId: bytes32) -     contribute(taskId: bytes32, resultHash: bytes32, resultSeal: bytes32, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) -     contributeAndFinalize(taskId: bytes32, resultDigest: bytes32, results: bytes, resultsCallback: bytes, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) -     reveal(taskId: bytes32, resultDigest: bytes32) -     reopen(taskId: bytes32) -     finalize(taskId: bytes32, results: bytes, resultsCallback: bytes) -     initializeArray(dealIds: bytes32[], indexes: uint256[]): bool -     claimArray(taskIds: bytes32[]): bool -     initializeAndClaimArray(dealIds: bytes32[], indexes: uint256[]): bool -Public: -    <<event>> AccurateContribution(worker: address, taskid: bytes32) -    <<event>> FaultyContribution(worker: address, taskid: bytes32) -    <<event>> TaskInitialize(taskid: bytes32, workerpool: address) -    <<event>> TaskContribute(taskid: bytes32, worker: address, hash: bytes32) -    <<event>> TaskConsensus(taskid: bytes32, consensus: bytes32) -    <<event>> TaskReveal(taskid: bytes32, worker: address, digest: bytes32) -    <<event>> TaskReopen(taskid: bytes32) -    <<event>> TaskFinalize(taskid: bytes32, results: bytes) -    <<event>> TaskClaimed(taskid: bytes32) - - - -15->31 - - + + +26->54 + + + + + +26->55 + + + + + +26->56 + + - + -15->37 - - +34->61 + + - + -15->44 - - +34->62 + + - - -47 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes - - + -15->47 - - +35->61 + + - - -48 - -<<Struct>> -Consensus -contracts/libs/IexecLibCore_v5.sol - -group: mapping(bytes32=>uint256) -total: uint256 - - - -15->48 - - - - - -50 - -<<Struct>> -Contribution -contracts/libs/IexecLibCore_v5.sol - -status: ContributionStatusEnum -resultHash: bytes32 -resultSeal: bytes32 -enclaveChallenge: address -weight: uint256 - - + -15->50 - - - - - -15->62 - - - - - -15->63 - - +35->62 + + - - -27 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 - - - -29->51 - - + + +42 + +<<Struct>> +Resource +contracts/libs/IexecLibCore_v5.sol + +pointer: address +owner: address +price: uint256 + + + +42->36 + + - + -29->54 - - +43->36 + + - - -29->55 - - + + +43->42 + + - - -29->56 - - + + +45 + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 + + + +45->36 + + - - -29->57 - - + + +46->36 + + - - -43 - -<<Struct>> -Resource -contracts/libs/IexecLibCore_v5.sol - -pointer: address -owner: address -price: uint256 - - + -43->37 - - +46->45 + + - - -44->37 - - + + +47->36 + + - - -44->43 - - + + +48 + +<<Enum>> +ContributionStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +CONTRIBUTED: 1 +PROVED: 2 +REJECTED: 3 + + + +48->36 + + - - -46 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 - - + -46->37 - - - - - -47->37 - - - - - -47->46 - - - - - -48->37 - - +49->36 + + - - -49 - -<<Enum>> -ContributionStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -CONTRIBUTED: 1 -PROVED: 2 -REJECTED: 3 - - - -49->37 - - - - - -50->37 - - + + +49->48 + + - - -50->49 - - + + +52 + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address + + + +50->52 + + - - -53 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address - - - -51->53 - - + + +50->53 + + - - -51->54 - - + + +50->54 + + - - -51->55 - - + + +50->55 + + - - -51->56 - - + + +50->56 + + - - -51->57 - - + + +57 + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes + + + +50->57 + + - + 58 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes - - - -51->58 - - + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes + + + +50->58 + + - + 59 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes - - - -51->59 - - + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes + + + +50->59 + + - + 60 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes - - - -51->60 - - + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes + + + +50->60 + + - - -61 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes - - - -51->61 - - + + +51 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 + + + +51->50 + + - - -52 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 - - - -52->51 - - + + +52->50 + + - - -53->51 - - + + +53->50 + + - - -54->51 - - + + +54->50 + + - - -55->51 - - + + +55->50 + + - - -56->51 - - + + +56->50 + + + + + +57->50 + + - + 57->51 - - + + + + + +57->53 + + + + + +58->50 + + - + 58->51 - - - - - -58->52 - - + + - + 58->54 - - + + + + + +59->50 + + - + 59->51 - - - - - -59->52 - - + + - + 59->55 - - + + + + + +60->50 + + - + 60->51 - - - - - -60->52 - - + + - + 60->56 - - + + - - -61->51 - - - - - -61->52 - - + + +61->62 + + - + -61->57 - - +62->24 + + + + + +62->36 + + + + + +62->61 + + + + + +63 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool - + 62->63 - - - - - -63->27 - - - - - -63->37 - - - - - -63->62 - - - - - -64 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - - -63->64 - - + + diff --git a/docs/uml/class-uml-dir-libs.svg b/docs/uml/class-uml-dir-libs.svg index 0875f7d38..8b2a0b1e1 100644 --- a/docs/uml/class-uml-dir-libs.svg +++ b/docs/uml/class-uml-dir-libs.svg @@ -4,725 +4,791 @@ - - + + UmlClassDiagram - + 0 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + + + +27 + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) + + + +0->27 + + + + + +28 + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + + + +0->28 + + 1 - -<<Struct>> -Account -contracts/libs/IexecLibCore_v5.sol - -stake: uint256 -locked: uint256 - - + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +    transfer(from: address, to: address, value: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) + + -1->0 - - +1->27 + + + + + +1->28 + + 2 - -<<Struct>> -Category -contracts/libs/IexecLibCore_v5.sol - -name: string -description: string -workClockTimeRef: uint256 - - - -2->0 - - + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol 3 - -<<Struct>> -DatasetInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_datasetName: string -m_datasetMultiaddr: bytes -m_datasetChecksum: bytes32 - - - -3->0 - - + +<<Struct>> +Account +contracts/libs/IexecLibCore_v5.sol + +stake: uint256 +locked: uint256 + + + +3->2 + + 4 - -<<Struct>> -AppInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_appName: string -m_appType: string -m_appMultiaddr: bytes -m_appChecksum: bytes32 -m_appMREnclave: bytes - - - -4->0 - - + +<<Struct>> +Category +contracts/libs/IexecLibCore_v5.sol + +name: string +description: string +workClockTimeRef: uint256 + + + +4->2 + + 5 - -<<Struct>> -WorkerpoolInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_workerpoolDescription: string -m_workerStakeRatioPolicy: uint256 -m_schedulerRewardRatioPolicy: uint256 - - - -5->0 - - + +<<Struct>> +DatasetInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_datasetName: string +m_datasetMultiaddr: bytes +m_datasetChecksum: bytes32 + + + +5->2 + + 6 - -<<Struct>> -Resource -contracts/libs/IexecLibCore_v5.sol - -pointer: address -owner: address -price: uint256 - - - -6->0 - - + +<<Struct>> +AppInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_appName: string +m_appType: string +m_appMultiaddr: bytes +m_appChecksum: bytes32 +m_appMREnclave: bytes + + + +6->2 + + 7 - -<<Struct>> -Deal -contracts/libs/IexecLibCore_v5.sol - -app: Resource -dataset: Resource -workerpool: Resource -trust: uint256 -category: uint256 -tag: bytes32 -requester: address -beneficiary: address -callback: address -params: string -startTime: uint256 -botFirst: uint256 -botSize: uint256 -workerStake: uint256 -schedulerRewardRatio: uint256 -sponsor: address - - - -7->0 - - - - - -7->6 - - + +<<Struct>> +WorkerpoolInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_workerpoolDescription: string +m_workerStakeRatioPolicy: uint256 +m_schedulerRewardRatioPolicy: uint256 + + + +7->2 + + 8 - -<<Struct>> -DealBoost -contracts/libs/IexecLibCore_v5.sol - -appOwner: address -appPrice: uint96 -datasetOwner: address -datasetPrice: uint96 -workerpoolOwner: address -workerpoolPrice: uint96 -requester: address -workerReward: uint96 -callback: address -deadline: uint40 -botFirst: uint16 -botSize: uint16 -shortTag: bytes3 -sponsor: address - - - -8->0 - - + +<<Struct>> +Resource +contracts/libs/IexecLibCore_v5.sol + +pointer: address +owner: address +price: uint256 + + + +8->2 + + 9 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 - - - -9->0 - - + +<<Struct>> +Deal +contracts/libs/IexecLibCore_v5.sol + +app: Resource +dataset: Resource +workerpool: Resource +trust: uint256 +category: uint256 +tag: bytes32 +requester: address +beneficiary: address +callback: address +params: string +startTime: uint256 +botFirst: uint256 +botSize: uint256 +workerStake: uint256 +schedulerRewardRatio: uint256 +sponsor: address + + + +9->2 + + + + + +9->8 + + 10 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes - - - -10->0 - - - - - -10->9 - - + +<<Struct>> +DealBoost +contracts/libs/IexecLibCore_v5.sol + +appOwner: address +appPrice: uint96 +datasetOwner: address +datasetPrice: uint96 +workerpoolOwner: address +workerpoolPrice: uint96 +requester: address +workerReward: uint96 +callback: address +deadline: uint40 +botFirst: uint16 +botSize: uint16 +shortTag: bytes3 +sponsor: address + + + +10->2 + + 11 - -<<Struct>> -Consensus -contracts/libs/IexecLibCore_v5.sol - -group: mapping(bytes32=>uint256) -total: uint256 - - - -11->0 - - + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 + + + +11->2 + + 12 - -<<Enum>> -ContributionStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -CONTRIBUTED: 1 -PROVED: 2 -REJECTED: 3 - - - -12->0 - - + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes + + + +12->2 + + + + + +12->11 + + 13 - -<<Struct>> -Contribution -contracts/libs/IexecLibCore_v5.sol - -status: ContributionStatusEnum -resultHash: bytes32 -resultSeal: bytes32 -enclaveChallenge: address -weight: uint256 - - - -13->0 - - - - + +<<Struct>> +Consensus +contracts/libs/IexecLibCore_v5.sol + +group: mapping(bytes32=>uint256) +total: uint256 + + -13->12 - - +13->2 + + 14 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 + +<<Enum>> +ContributionStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +CONTRIBUTED: 1 +PROVED: 2 +REJECTED: 3 + + + +14->2 + + + + + +15 + +<<Struct>> +Contribution +contracts/libs/IexecLibCore_v5.sol + +status: ContributionStatusEnum +resultHash: bytes32 +resultSeal: bytes32 +enclaveChallenge: address +weight: uint256 + + + +15->2 + + + + + +15->14 + + 16 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address - - - -14->16 - - - - - -17 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -14->17 - - + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 18 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -14->18 - - + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address + + + +16->18 + + 19 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes - - - -14->19 - - + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +16->19 + + 20 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes - - - -14->20 - - + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +16->20 + + 21 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes - - - -14->21 - - + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes + + + +16->21 + + 22 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes - - - -14->22 - - + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes + + + +16->22 + + 23 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes - - - -14->23 - - + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes + + + +16->23 + + 24 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes - - - -14->24 - - - - - -15 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 - - - -15->14 - - - - - -16->14 - - + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes + + + +16->24 + + - - -17->14 - - + + +25 + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes + + + +16->25 + + - - -18->14 - - + + +26 + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes + + + +16->26 + + - + + +17 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 + + -19->14 - - +17->16 + + - + -20->14 - - +18->16 + + - + -21->14 - - - - - -21->15 - - +19->16 + + - - -21->17 - - - - + -22->14 - - +20->16 + + - - -22->15 - - + + +21->16 + + - - -22->18 - - + + +22->16 + + - - -23->14 - - + + +23->16 + + - + -23->15 - - +23->17 + + 23->19 - - + + - - -24->14 - - + + +24->16 + + - + -24->15 - - +24->17 + + 24->20 - - + + - - -25 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) + + +25->16 + + - - -26 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) - - + -25->26 - - +25->17 + + - - -26->0 - - - - + -26->25 - - +25->21 + + + + + +26->16 + + + + + +26->17 + + + + + +26->22 + + + + + +27->28 + + + + + +28->2 + + + + + +28->27 + + diff --git a/scripts/tools/sol-to-uml.mjs b/scripts/tools/sol-to-uml.mjs index bbf1fe69f..0b7820954 100644 --- a/scripts/tools/sol-to-uml.mjs +++ b/scripts/tools/sol-to-uml.mjs @@ -13,7 +13,7 @@ await generateClassDiagramOfDirectory('registries'); await generateClassDiagramOfContracts(['IexecPoco1Facet', 'IexecPoco2Facet'], 'IexecPocoFacets'); -await generateClassDiagramOfContracts(['IexecEscrowTokenFacet', 'IexecEscrow'], 'IexecEscrows'); +await generateClassDiagramOfContracts(['IexecEscrowTokenFacet', 'EscrowLib'], 'IexecEscrows'); await generateClassDiagramOfContracts(['IexecPocoBoostFacet'], 'IexecPocoBoostFacet'); From 0d6428a7223dae5022e6940eb008e5c51054abed Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:21:27 +0200 Subject: [PATCH 13/17] chore: update archi file --- .agents/context/architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/context/architecture.md b/.agents/context/architecture.md index fbf66a1e4..99a05a790 100644 --- a/.agents/context/architecture.md +++ b/.agents/context/architecture.md @@ -7,7 +7,7 @@ - Protocol logic: `contracts/facets/*Facet.sol` - External API declarations: `contracts/interfaces/` - `contracts/IexecInterfaceToken.sol` aggregates them into the single interface downstream tools compile against -- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`, `IexecEscrow`) and `contracts/libs/` for stateless helper libraries (`CommonLib`, `PocoStorageLib`, …) +- Shared helpers: `contracts/abstract/` for inherited bases (`FacetBase`) and `contracts/libs/` for stateless helper libraries (`CommonLib`, `EscrowLib`, `PocoStorageLib`, …) - Storage lives in one struct accessed through `contracts/libs/PocoStorageLib.sol`, shared by every facet: **never reorder or remove an existing variable, only append**. `npm run check-storage-layout` is the CI gate. - Adding or removing a facet means editing two hand-maintained lists: `utils/proxy-tools.ts#getAllLocalFacetFunctions` (selector-to-name map used by upgrades) and the facet groups in `scripts/tools/sol-to-uml.mjs`. From 63f8f8f1a32906a2d860427e284989f68fac0756 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:49:25 +0200 Subject: [PATCH 14/17] fix: keep the Yul unused pruner enabled under coverage Coverage failed with 25 errors as soon as the shared helpers became libraries. The first failure is the real one, the other 24 cascade from it: TypeError: Cannot read properties of undefined (reading 'replace') at Function.linkBytecode (typechain/factories/.../IexecPocoAccessorsFacet__factory.ts) CommonLib and EscrowLib expose only internal functions, so their code is inlined and their addresses are never used at runtime. But solc's IR pipeline emits a linkersymbol reference for every library a contract uses and leaves the Yul unused pruner to drop it once it is unreachable. The main build runs that pruner, `optimizerSteps: 'u'`; .solcover.js disabled every step with `optimizerSteps: ''`, so the dead reference survived into the artifact. Typechain then generated the linkLibraryAddresses variant of the factory constructor for facets that need no linking, and deploy/0_deploy.ts builds those with a signer alone. The throw left CreateX half-deployed, so every later loadFixture re-ran against dirty state and failed with "Nonce too low. Expected nonce to be 1 but got 0". Enabling the pruner removes the reference. Verified: the only link reference left on the facets is IexecLibOrders_v5, which does have public functions and is linked in both builds; coverage compiles without the stack-too-deep that a full optimizer step list causes; and the totals are unchanged at 99.69 / 96.55 / 99.44 / 99.53, with CommonLib and EscrowLib at 100. --- .solcover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.solcover.js b/.solcover.js index 4d2eefc89..a06cea406 100644 --- a/.solcover.js +++ b/.solcover.js @@ -7,7 +7,7 @@ module.exports = { solcOptimizerDetails: { yul: true, yulDetails: { - optimizerSteps: '', + optimizerSteps: 'u', }, }, mocha: { From 26122c97e24b7d5682af58fa6d60c9ecf24cbce1 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Wed, 2 Sep 2026 11:06:13 +0200 Subject: [PATCH 15/17] chore: clean comment --- contracts/libs/EscrowLib.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contracts/libs/EscrowLib.sol b/contracts/libs/EscrowLib.sol index dfade1f9d..378c39443 100644 --- a/contracts/libs/EscrowLib.sol +++ b/contracts/libs/EscrowLib.sol @@ -6,14 +6,10 @@ import {PocoStorageLib} from "./PocoStorageLib.sol"; /** * @title Manage (lock/unlock/reward/seize) user funds. - * @dev The events are declared here rather than taken from {IexecEscrowEvents} - * because solc 0.8.21 cannot compile a qualified `emit Other.Event(...)` when - * userdoc is requested, and docgen always requests it. A library publishes an - * event in the ABI of every contract that emits it along an inlined path, so - * {IexecEscrowEvents} stays as the single declaration feeding the aggregate - * interface. */ library EscrowLib { + /// @dev The events are declared here rather than taken from {IexecEscrowEvents} + /// because solc 0.8.21 cannot compile `emit Other.Event(...)`. event Transfer(address indexed from, address indexed to, uint256 value); event Reward(address owner, uint256 amount, bytes32 ref); event Seize(address owner, uint256 amount, bytes32 ref); From 37c1199d3a137e0e3be0ca250d4b318262773660 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Wed, 2 Sep 2026 11:21:30 +0200 Subject: [PATCH 16/17] refactor: split the sRLC ledger out of EscrowLib into StakedRlcLib EscrowLib held two concerns. The storage says so: m_totalSupply, m_balances and m_allowances belong to the sRLC token, while m_frozens belongs to the escrow laid on top of it, and `lock` is literally a transfer followed by a bump of m_frozens. StakedRlcLib now owns every writer of the ledger: transfer, plus mint, burn and approve moved over from IexecEscrowTokenFacet, which had held a third of it since before the diamond migration. EscrowLib keeps lock, unlock, reward, seize and rewardAndLock, owns m_frozens alone, and defers every balance move to StakedRlcLib. IexecEscrowToken no longer inherits IexecEscrowEvents. It did so only to give the facet the event declarations it emitted; the facet now takes them from the libraries it calls. Without this the facet would have carried both Transfer and Approval twice in its ABI, since a library publishes an event in the ABI of every contract that emits it along an inlined path. The aggregate keeps the events by inheriting IexecEscrowEvents directly, and IexecInterfaceToken.json is byte-identical. This removes the duplicate Transfer entry left by the escrow conversion, so the 14 typechain duplicate-identifier errors are gone and `tsc --noEmit` is back to its 40, of which 6 are outside typechain and pre-existing. The three transfer revert strings move from the "IexecEscrow: " prefix to "ERC20: ", matching the mint, burn and approve messages that arrived with them; 20 assertions across 6 test files follow. --- .../facets/IexecEscrowTokenFacet.json | 113 -------------- .../interfaces/IexecEscrowToken.json | 138 ------------------ abis/contracts/libs/EscrowLib.json | 25 ---- abis/contracts/libs/StakedRlcLib.json | 52 +++++++ .../IexecEscrowTokenFacet.json | 5 - .../IexecEscrowToken.json | 6 - .../libs/EscrowLib.sol/EscrowLib.json | 1 - .../libs/StakedRlcLib.sol/StakedRlcLib.json | 4 + contracts/IexecInterfaceToken.sol | 2 + contracts/facets/IexecEscrowTokenFacet.sol | 62 +++----- contracts/interfaces/IexecEscrowToken.sol | 4 +- contracts/libs/EscrowLib.sol | 42 +----- contracts/libs/StakedRlcLib.sol | 87 +++++++++++ test/byContract/IexecERC20/IexecERC20.test.ts | 12 +- .../IexecEscrowToken-receiveApproval.test.ts | 2 +- test/byContract/IexecPoco/IexecPoco1.test.ts | 6 +- .../IexecPoco/IexecPoco2-contribute.test.ts | 2 +- .../IexecPocoBoost/IexecEscrow.test.ts | 12 +- .../IexecPocoBoost/IexecPocoBoost.test.ts | 6 +- 19 files changed, 197 insertions(+), 384 deletions(-) create mode 100644 abis/contracts/libs/StakedRlcLib.json create mode 100644 abis/human-readable-abis/contracts/libs/StakedRlcLib.sol/StakedRlcLib.json create mode 100644 contracts/libs/StakedRlcLib.sol diff --git a/abis/contracts/facets/IexecEscrowTokenFacet.json b/abis/contracts/facets/IexecEscrowTokenFacet.json index d7d8980b0..5adf3d767 100644 --- a/abis/contracts/facets/IexecEscrowTokenFacet.json +++ b/abis/contracts/facets/IexecEscrowTokenFacet.json @@ -45,75 +45,6 @@ "name": "Approval", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Lock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Reward", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Seize", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -139,50 +70,6 @@ "name": "Transfer", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Unlock", - "type": "event" - }, { "stateMutability": "payable", "type": "fallback" diff --git a/abis/contracts/interfaces/IexecEscrowToken.json b/abis/contracts/interfaces/IexecEscrowToken.json index 9796f8cf1..be1a4f1dd 100644 --- a/abis/contracts/interfaces/IexecEscrowToken.json +++ b/abis/contracts/interfaces/IexecEscrowToken.json @@ -20,144 +20,6 @@ "name": "UnsupportedOperation", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Lock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Reward", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "ref", - "type": "bytes32" - } - ], - "name": "Seize", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Unlock", - "type": "event" - }, { "stateMutability": "payable", "type": "fallback" diff --git a/abis/contracts/libs/EscrowLib.json b/abis/contracts/libs/EscrowLib.json index f8f92b4b0..cea6073dc 100644 --- a/abis/contracts/libs/EscrowLib.json +++ b/abis/contracts/libs/EscrowLib.json @@ -68,31 +68,6 @@ "name": "Seize", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/abis/contracts/libs/StakedRlcLib.json b/abis/contracts/libs/StakedRlcLib.json new file mode 100644 index 000000000..fe1bdc880 --- /dev/null +++ b/abis/contracts/libs/StakedRlcLib.json @@ -0,0 +1,52 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } +] diff --git a/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json b/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json index 35fad85c2..f267d464f 100644 --- a/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json +++ b/abis/human-readable-abis/contracts/facets/IexecEscrowTokenFacet.sol/IexecEscrowTokenFacet.json @@ -3,12 +3,7 @@ "error OperationFailed()", "error UnsupportedOperation(bytes4)", "event Approval(address indexed,address indexed,uint256)", - "event Lock(address,uint256)", - "event Reward(address,uint256,bytes32)", - "event Seize(address,uint256,bytes32)", "event Transfer(address indexed,address indexed,uint256)", - "event Transfer(address indexed,address indexed,uint256)", - "event Unlock(address,uint256)", "function approve(address,uint256) returns (bool)", "function approveAndCall(address,uint256,bytes) returns (bool)", "function decreaseAllowance(address,uint256) returns (bool)", diff --git a/abis/human-readable-abis/contracts/interfaces/IexecEscrowToken.sol/IexecEscrowToken.json b/abis/human-readable-abis/contracts/interfaces/IexecEscrowToken.sol/IexecEscrowToken.json index b1d2b9e51..f3fe78992 100644 --- a/abis/human-readable-abis/contracts/interfaces/IexecEscrowToken.sol/IexecEscrowToken.json +++ b/abis/human-readable-abis/contracts/interfaces/IexecEscrowToken.sol/IexecEscrowToken.json @@ -2,12 +2,6 @@ "error CallerIsNotTheRequester()", "error OperationFailed()", "error UnsupportedOperation(bytes4)", - "event Approval(address indexed,address indexed,uint256)", - "event Lock(address,uint256)", - "event Reward(address,uint256,bytes32)", - "event Seize(address,uint256,bytes32)", - "event Transfer(address indexed,address indexed,uint256)", - "event Unlock(address,uint256)", "function approve(address,uint256) returns (bool)", "function approveAndCall(address,uint256,bytes) returns (bool)", "function decreaseAllowance(address,uint256) returns (bool)", diff --git a/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json b/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json index 1c6711547..e70f2078f 100644 --- a/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json +++ b/abis/human-readable-abis/contracts/libs/EscrowLib.sol/EscrowLib.json @@ -2,6 +2,5 @@ "event Lock(address,uint256)", "event Reward(address,uint256,bytes32)", "event Seize(address,uint256,bytes32)", - "event Transfer(address indexed,address indexed,uint256)", "event Unlock(address,uint256)" ] diff --git a/abis/human-readable-abis/contracts/libs/StakedRlcLib.sol/StakedRlcLib.json b/abis/human-readable-abis/contracts/libs/StakedRlcLib.sol/StakedRlcLib.json new file mode 100644 index 000000000..c145a777d --- /dev/null +++ b/abis/human-readable-abis/contracts/libs/StakedRlcLib.sol/StakedRlcLib.json @@ -0,0 +1,4 @@ +[ + "event Approval(address indexed,address indexed,uint256)", + "event Transfer(address indexed,address indexed,uint256)" +] diff --git a/contracts/IexecInterfaceToken.sol b/contracts/IexecInterfaceToken.sol index 2d0803981..5d0a70ce5 100644 --- a/contracts/IexecInterfaceToken.sol +++ b/contracts/IexecInterfaceToken.sol @@ -7,6 +7,7 @@ import {IexecAccessorsABILegacy} from "./interfaces/IexecAccessorsABILegacy.sol" import {IexecCategoryManager} from "./interfaces/IexecCategoryManager.sol"; import {IexecConfiguration} from "./interfaces/IexecConfiguration.sol"; import {IexecConfigurationExtra} from "./interfaces/IexecConfigurationExtra.sol"; +import {IexecEscrowEvents} from "./interfaces/IexecEscrowEvents.sol"; import {IexecEscrowToken} from "./interfaces/IexecEscrowToken.sol"; import {IexecOrderManagement} from "./interfaces/IexecOrderManagement.sol"; import {IexecPoco1} from "./interfaces/IexecPoco1.sol"; @@ -34,6 +35,7 @@ interface IexecInterfaceToken is IexecCategoryManager, IexecConfiguration, IexecConfigurationExtra, + IexecEscrowEvents, IexecEscrowToken, IexecOrderManagement, IexecPoco1, diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index b6d608ce4..54a45a5e5 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.0; import {FacetBase} from "../abstract/FacetBase.sol"; import {EscrowLib} from "../libs/EscrowLib.sol"; +import {StakedRlcLib} from "../libs/StakedRlcLib.sol"; import {IexecEscrowToken} from "../interfaces/IexecEscrowToken.sol"; import {IexecTokenSpender} from "../interfaces/IexecTokenSpender.sol"; import {IexecPoco1} from "../interfaces/IexecPoco1.sol"; @@ -24,7 +25,6 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.sol"; * escrow itself (lock, unlock, reward, seize) run over the same ledger. */ // TODO rename to IexecEscrowFacet -// TODO move _mint, _burn and _approve into EscrowLib. contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase { /*************************************************************************** * Deposit and withdraw functions * @@ -39,13 +39,13 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase function deposit(uint256 amount) external override returns (bool) { _deposit(_msgSender(), amount); - _mint(_msgSender(), amount); + StakedRlcLib.mint(_msgSender(), amount); return true; } function depositFor(uint256 amount, address target) external override returns (bool) { _deposit(_msgSender(), amount); - _mint(target, amount); + StakedRlcLib.mint(target, amount); return true; } @@ -56,19 +56,19 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase require(amounts.length == targets.length, "invalid-array-length"); for (uint i = 0; i < amounts.length; ++i) { _deposit(_msgSender(), amounts[i]); - _mint(targets[i], amounts[i]); + StakedRlcLib.mint(targets[i], amounts[i]); } return true; } function withdraw(uint256 amount) external override returns (bool) { - _burn(_msgSender(), amount); + StakedRlcLib.burn(_msgSender(), amount); _withdraw(_msgSender(), amount); return true; } function withdrawTo(uint256 amount, address target) external override returns (bool) { - _burn(_msgSender(), amount); + StakedRlcLib.burn(_msgSender(), amount); _withdraw(target, amount); return true; } @@ -76,7 +76,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase function recover() external override onlyOwner returns (uint256) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); uint256 delta = $.m_baseToken.balanceOf(address(this)) - $.m_totalSupply; - _mint(owner(), delta); + StakedRlcLib.mint(owner(), delta); return delta; } @@ -142,7 +142,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); require(token == address($.m_baseToken), "wrong-token"); _deposit(sender, amount); - _mint(sender, amount); + StakedRlcLib.mint(sender, amount); if (data.length > 0) { _executeOperation(sender, data); } @@ -218,12 +218,12 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase ***************************************************************************/ function transfer(address recipient, uint256 amount) external override returns (bool) { - EscrowLib.transfer(_msgSender(), recipient, amount); + StakedRlcLib.transfer(_msgSender(), recipient, amount); return true; } function approve(address spender, uint256 value) external override returns (bool) { - _approve(_msgSender(), spender, value); + StakedRlcLib.approve(_msgSender(), spender, value); return true; } @@ -232,7 +232,7 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase uint256 value, bytes calldata extraData ) external override returns (bool) { - _approve(_msgSender(), spender, value); + StakedRlcLib.approve(_msgSender(), spender, value); require( IexecTokenSpender(spender).receiveApproval( _msgSender(), @@ -251,8 +251,8 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase uint256 amount ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - EscrowLib.transfer(sender, recipient, amount); - _approve(sender, _msgSender(), $.m_allowances[sender][_msgSender()] - amount); + StakedRlcLib.transfer(sender, recipient, amount); + StakedRlcLib.approve(sender, _msgSender(), $.m_allowances[sender][_msgSender()] - amount); return true; } @@ -261,7 +261,11 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase uint256 addedValue ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender] + addedValue); + StakedRlcLib.approve( + _msgSender(), + spender, + $.m_allowances[_msgSender()][spender] + addedValue + ); return true; } @@ -270,31 +274,11 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase uint256 subtractedValue ) external override returns (bool) { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - _approve(_msgSender(), spender, $.m_allowances[_msgSender()][spender] - subtractedValue); + StakedRlcLib.approve( + _msgSender(), + spender, + $.m_allowances[_msgSender()][spender] - subtractedValue + ); return true; } - - function _mint(address account, uint256 amount) internal { - require(account != address(0), "ERC20: mint to the zero address"); - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_totalSupply = $.m_totalSupply + amount; - $.m_balances[account] = $.m_balances[account] + amount; - emit Transfer(address(0), account, amount); - } - - function _burn(address account, uint256 amount) internal { - require(account != address(0), "ERC20: burn from the zero address"); - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_totalSupply = $.m_totalSupply - amount; - $.m_balances[account] = $.m_balances[account] - amount; - emit Transfer(account, address(0), amount); - } - - function _approve(address owner, address spender, uint256 amount) internal { - require(owner != address(0), "ERC20: approve from the zero address"); - require(spender != address(0), "ERC20: approve to the zero address"); - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - $.m_allowances[owner][spender] = amount; - emit Approval(owner, spender, amount); - } } diff --git a/contracts/interfaces/IexecEscrowToken.sol b/contracts/interfaces/IexecEscrowToken.sol index 5d0334198..a25b49ed8 100644 --- a/contracts/interfaces/IexecEscrowToken.sol +++ b/contracts/interfaces/IexecEscrowToken.sol @@ -3,9 +3,7 @@ pragma solidity ^0.8.0; -import {IexecEscrowEvents} from "./IexecEscrowEvents.sol"; - -interface IexecEscrowToken is IexecEscrowEvents { +interface IexecEscrowToken { error UnsupportedOperation(bytes4 selector); error OperationFailed(); error CallerIsNotTheRequester(); diff --git a/contracts/libs/EscrowLib.sol b/contracts/libs/EscrowLib.sol index 378c39443..f7d2edf22 100644 --- a/contracts/libs/EscrowLib.sol +++ b/contracts/libs/EscrowLib.sol @@ -3,14 +3,16 @@ pragma solidity ^0.8.0; import {PocoStorageLib} from "./PocoStorageLib.sol"; +import {StakedRlcLib} from "./StakedRlcLib.sol"; /** * @title Manage (lock/unlock/reward/seize) user funds. + * @notice The escrow layers on top of the sRLC ledger: it owns `m_frozens` and + * defers every balance move to {StakedRlcLib}. + * @dev The events are declared here rather than taken from {IexecEscrowEvents} + * because solc 0.8.21 cannot compile `emit Other.Event(...)`. */ library EscrowLib { - /// @dev The events are declared here rather than taken from {IexecEscrowEvents} - /// because solc 0.8.21 cannot compile `emit Other.Event(...)`. - event Transfer(address indexed from, address indexed to, uint256 value); event Reward(address owner, uint256 amount, bytes32 ref); event Seize(address owner, uint256 amount, bytes32 ref); event Lock(address owner, uint256 amount); @@ -23,7 +25,7 @@ library EscrowLib { */ function lock(address account, uint256 value) internal { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - transfer(account, address(this), value); + StakedRlcLib.transfer(account, address(this), value); $.m_frozens[account] += value; emit Lock(account, value); } @@ -35,7 +37,7 @@ library EscrowLib { */ function unlock(address account, uint256 value) internal { PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - transfer(address(this), account, value); + StakedRlcLib.transfer(address(this), account, value); $.m_frozens[account] -= value; emit Unlock(account, value); } @@ -47,7 +49,7 @@ library EscrowLib { * @param ref A reference of the reward context. */ function reward(address account, uint256 value, bytes32 ref) internal { - transfer(address(this), account, value); + StakedRlcLib.transfer(address(this), account, value); emit Reward(account, value, ref); } @@ -78,32 +80,4 @@ library EscrowLib { emit Reward(account, value, ref); emit Lock(account, value); } - - /** - * Transfer value from a spender account to a receiver account. - * @notice - * This is the single implementation of an sRLC balance move. It backs both - * the escrow operations declared above (lock, unlock, reward) and the ERC-20 - * entry points of {IexecEscrowTokenFacet}. - * A self-transfer is a no-op on the balances and is not rejected. - * - * @param from The address of the spender account. - * @param to The address of the receiver account. - * @param value The value to transfer. - */ - function transfer(address from, address to, uint256 value) internal { - require(from != address(0), "IexecEscrow: Transfer from empty address"); - require(to != address(0), "IexecEscrow: Transfer to empty address"); - PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); - uint256 fromBalance = $.m_balances[from]; - require(value <= fromBalance, "IexecEscrow: Transfer amount exceeds balance"); - // This block is guaranteed to not underflow because we check the from balance - // and guaranteed to not overflow because the total supply is capped and there - // is no minting involved. - unchecked { - $.m_balances[from] = fromBalance - value; - $.m_balances[to] += value; - } - emit Transfer(from, to, value); - } } diff --git a/contracts/libs/StakedRlcLib.sol b/contracts/libs/StakedRlcLib.sol new file mode 100644 index 000000000..fcbe1e41a --- /dev/null +++ b/contracts/libs/StakedRlcLib.sol @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +pragma solidity ^0.8.0; + +import {PocoStorageLib} from "./PocoStorageLib.sol"; + +/** + * @title The sRLC ledger. + * @notice sRLC ("Staked RLC") is the internal token of the PoCo protocol. It is + * not a standalone contract: its total supply, balances and allowances live in + * the PoCo storage. This library is the single owner of every write to them. + * @dev The events are declared here rather than taken from {IexecEscrowEvents} + * because solc 0.8.21 cannot compile `emit Other.Event(...)`. + */ +library StakedRlcLib { + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); + + /** + * Transfer value from a spender account to a receiver account. + * @notice + * This is the single implementation of an sRLC balance move. It backs both + * the escrow operations of {EscrowLib} and the ERC-20 entry points of + * {IexecEscrowTokenFacet}. + * A self-transfer is a no-op on the balances and is not rejected. + * + * @param from The address of the spender account. + * @param to The address of the receiver account. + * @param value The value to transfer. + */ + function transfer(address from, address to, uint256 value) internal { + require(from != address(0), "ERC20: Transfer from empty address"); + require(to != address(0), "ERC20: Transfer to empty address"); + PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); + uint256 fromBalance = $.m_balances[from]; + require(value <= fromBalance, "ERC20: Transfer amount exceeds balance"); + // This block is guaranteed to not underflow because we check the from balance + // and guaranteed to not overflow because the total supply is capped and there + // is no minting involved. + unchecked { + $.m_balances[from] = fromBalance - value; + $.m_balances[to] += value; + } + emit Transfer(from, to, value); + } + + /** + * Create sRLC and credit it to an account. + * @param account The account to credit. + * @param amount The amount to create. + */ + function mint(address account, uint256 amount) internal { + require(account != address(0), "ERC20: mint to the zero address"); + PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); + $.m_totalSupply = $.m_totalSupply + amount; + $.m_balances[account] = $.m_balances[account] + amount; + emit Transfer(address(0), account, amount); + } + + /** + * Destroy sRLC held by an account. + * @param account The account to debit. + * @param amount The amount to destroy. + */ + function burn(address account, uint256 amount) internal { + require(account != address(0), "ERC20: burn from the zero address"); + PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); + $.m_totalSupply = $.m_totalSupply - amount; + $.m_balances[account] = $.m_balances[account] - amount; + emit Transfer(account, address(0), amount); + } + + /** + * Set the allowance of a spender over an owner's sRLC. + * @param owner The account granting the allowance. + * @param spender The account receiving the allowance. + * @param amount The allowed amount. + */ + function approve(address owner, address spender, uint256 amount) internal { + require(owner != address(0), "ERC20: approve from the zero address"); + require(spender != address(0), "ERC20: approve to the zero address"); + PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage(); + $.m_allowances[owner][spender] = amount; + emit Approval(owner, spender, amount); + } +} diff --git a/test/byContract/IexecERC20/IexecERC20.test.ts b/test/byContract/IexecERC20/IexecERC20.test.ts index 26bfcd606..6b015f438 100644 --- a/test/byContract/IexecERC20/IexecERC20.test.ts +++ b/test/byContract/IexecERC20/IexecERC20.test.ts @@ -87,17 +87,17 @@ describe('ERC20', async () => { it('Should not transfer from the zero address', async () => { await expect( iexecPoco.connect(zeroAddressSigner).transfer(recipient.address, value), - ).to.be.revertedWith('IexecEscrow: Transfer from empty address'); + ).to.be.revertedWith('ERC20: Transfer from empty address'); }); it('Should not transfer to the zero address', async () => { await expect(iexecPocoAsHolder.transfer(ZeroAddress, value)).to.be.revertedWith( - 'IexecEscrow: Transfer to empty address', + 'ERC20: Transfer to empty address', ); }); it('Should not transfer when sender balance is too low', async () => { await expect( iexecPocoAsHolder.transfer(recipient.address, value + 1n), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); }); @@ -191,17 +191,17 @@ describe('ERC20', async () => { it('Should not transferFrom when owner is the zero address', async () => { await expect( iexecPocoAsSpender.transferFrom(ZeroAddress, spender.address, value), - ).to.be.revertedWith('IexecEscrow: Transfer from empty address'); + ).to.be.revertedWith('ERC20: Transfer from empty address'); }); it('Should not transferFrom to the zero address', async () => { await expect( iexecPocoAsSpender.transferFrom(holder.address, ZeroAddress, value), - ).to.be.revertedWith('IexecEscrow: Transfer to empty address'); + ).to.be.revertedWith('ERC20: Transfer to empty address'); }); it('Should not transferFrom when owner balance is too low', async () => { await expect( iexecPocoAsSpender.transferFrom(holder.address, spender.address, value + 1n), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); it('Should not transferFrom when spender allowance is too low', async () => { await iexecPocoAsHolder.approve(spender.address, value - 1n).then((tx) => tx.wait()); diff --git a/test/byContract/IexecEscrow/IexecEscrowToken-receiveApproval.test.ts b/test/byContract/IexecEscrow/IexecEscrowToken-receiveApproval.test.ts index c48eb1aa3..92c520dce 100644 --- a/test/byContract/IexecEscrow/IexecEscrowToken-receiveApproval.test.ts +++ b/test/byContract/IexecEscrow/IexecEscrowToken-receiveApproval.test.ts @@ -338,7 +338,7 @@ describe('IexecEscrowToken-receiveApproval', () => { insufficientAmount, await matchOrdersCalldata(orders), ), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); it('Should revert with unsupported operation error for unknown function selector', async () => { diff --git a/test/byContract/IexecPoco/IexecPoco1.test.ts b/test/byContract/IexecPoco/IexecPoco1.test.ts index 83a2690da..6cb07c235 100644 --- a/test/byContract/IexecPoco/IexecPoco1.test.ts +++ b/test/byContract/IexecPoco/IexecPoco1.test.ts @@ -999,7 +999,7 @@ describe('IexecPoco1', () => { expect(await iexecPoco.balanceOf(scheduler.address)).to.equal(schedulerStake); await signOrders(iexecWrapper.getDomain(), orders, ordersActors); await expect(iexecPocoAsRequester.matchOrders(...orders.toArray())).to.be.revertedWith( - 'IexecEscrow: Transfer amount exceeds balance', + 'ERC20: Transfer amount exceeds balance', ); }); @@ -1016,7 +1016,7 @@ describe('IexecPoco1', () => { expect(await iexecPoco.balanceOf(scheduler.address)).to.be.lessThan(schedulerStake); await signOrders(iexecWrapper.getDomain(), orders, ordersActors); await expect(iexecPocoAsRequester.matchOrders(...orders.toArray())).to.be.revertedWith( - 'IexecEscrow: Transfer amount exceeds balance', + 'ERC20: Transfer amount exceeds balance', ); }); }); @@ -1099,7 +1099,7 @@ describe('IexecPoco1', () => { await signOrders(iexecWrapper.getDomain(), orders, ordersActors); await expect( iexecPocoAsSponsor.sponsorMatchOrders(...orders.toArray()), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); }); diff --git a/test/byContract/IexecPoco/IexecPoco2-contribute.test.ts b/test/byContract/IexecPoco/IexecPoco2-contribute.test.ts index b9e5600d4..a8931ed6a 100644 --- a/test/byContract/IexecPoco/IexecPoco2-contribute.test.ts +++ b/test/byContract/IexecPoco/IexecPoco2-contribute.test.ts @@ -519,7 +519,7 @@ describe('IexecPoco2#contribute', () => { scheduler, ), ), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); }); }); diff --git a/test/byContract/IexecPocoBoost/IexecEscrow.test.ts b/test/byContract/IexecPocoBoost/IexecEscrow.test.ts index 7a38a6888..06aba2bf7 100644 --- a/test/byContract/IexecPocoBoost/IexecEscrow.test.ts +++ b/test/byContract/IexecPocoBoost/IexecEscrow.test.ts @@ -53,14 +53,14 @@ describe('IexecEscrow', function () { it('Should not lock funds for empty address', async function () { await expect(iexecEscrow.lock_(ZeroAddress, amount)).to.be.revertedWith( - 'IexecEscrow: Transfer from empty address', + 'ERC20: Transfer from empty address', ); }); it('Should not lock funds when insufficient balance', async function () { await expect( iexecEscrow.lock_(account.address, accountBalance + 1n), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); }); @@ -86,13 +86,13 @@ describe('IexecEscrow', function () { it('Should not unlock funds for empty address', async function () { await expect(iexecEscrow.unlock_(ZeroAddress, amount)).to.be.revertedWith( - 'IexecEscrow: Transfer to empty address', + 'ERC20: Transfer to empty address', ); }); it('Should not unlock funds when insufficient balance', async function () { await expect(iexecEscrow.unlock_(account.address, amount)).to.be.revertedWith( - 'IexecEscrow: Transfer amount exceeds balance', + 'ERC20: Transfer amount exceeds balance', ); }); }); @@ -117,13 +117,13 @@ describe('IexecEscrow', function () { it('Should not reward empty address', async function () { await expect(iexecEscrow.reward_(ZeroAddress, amount, HashZero)).to.be.revertedWith( - 'IexecEscrow: Transfer to empty address', + 'ERC20: Transfer to empty address', ); }); it('Should not reward when insufficient balance', async function () { await expect(iexecEscrow.reward_(account.address, amount, HashZero)).to.be.revertedWith( - 'IexecEscrow: Transfer amount exceeds balance', + 'ERC20: Transfer amount exceeds balance', ); }); }); diff --git a/test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts b/test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts index 6d798850a..05c2a1ec9 100644 --- a/test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts +++ b/test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts @@ -1277,7 +1277,7 @@ describe('IexecPocoBoost', function () { await signOrders(domain, orders, ordersActors); await expect( iexecPocoBoostInstance.matchOrdersBoost(...orders.toArray()), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); it('Should fail when scheduler has insufficient balance', async () => { @@ -1308,7 +1308,7 @@ describe('IexecPocoBoost', function () { await signOrders(domain, orders, ordersActors); await expect( iexecPocoBoostInstance.matchOrdersBoost(...orders.toArray()), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); it('Should fail when sponsor has insufficient balance', async () => { const dealPrice = (appPrice + datasetPrice + workerpoolPrice) * volume; @@ -1327,7 +1327,7 @@ describe('IexecPocoBoost', function () { iexecPocoBoostInstance .connect(sponsor) .sponsorMatchOrdersBoost(...orders.toArray()), - ).to.be.revertedWith('IexecEscrow: Transfer amount exceeds balance'); + ).to.be.revertedWith('ERC20: Transfer amount exceeds balance'); }); }); From caecad33212cacfb59cfa76cd368bca2baee9e45 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Wed, 2 Sep 2026 11:30:33 +0200 Subject: [PATCH 17/17] chore: update docs and uml --- contracts/facets/IexecEscrowTokenFacet.sol | 1 - docs/solidity/index.md | 36 +- docs/uml/class-uml-IexecEscrows.svg | 942 +++++++------- docs/uml/class-uml-IexecPocoBoostFacet.svg | 1087 ++++++++-------- docs/uml/class-uml-IexecPocoFacets.svg | 1349 ++++++++++---------- docs/uml/class-uml-dir-facets.svg | 53 +- docs/uml/class-uml-dir-libs.svg | 1063 +++++++-------- 7 files changed, 2324 insertions(+), 2207 deletions(-) diff --git a/contracts/facets/IexecEscrowTokenFacet.sol b/contracts/facets/IexecEscrowTokenFacet.sol index 54a45a5e5..2944e8dea 100644 --- a/contracts/facets/IexecEscrowTokenFacet.sol +++ b/contracts/facets/IexecEscrowTokenFacet.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {FacetBase} from "../abstract/FacetBase.sol"; -import {EscrowLib} from "../libs/EscrowLib.sol"; import {StakedRlcLib} from "../libs/StakedRlcLib.sol"; import {IexecEscrowToken} from "../interfaces/IexecEscrowToken.sol"; import {IexecTokenSpender} from "../interfaces/IexecTokenSpender.sol"; diff --git a/docs/solidity/index.md b/docs/solidity/index.md index 5a7936282..7cbd1227b 100644 --- a/docs/solidity/index.md +++ b/docs/solidity/index.md @@ -795,18 +795,11 @@ function broadcastRequestOrder(struct IexecLibOrders_v5.RequestOrder _requestord ## EscrowLib -_The events are declared here rather than taken from {IexecEscrowEvents} -because solc 0.8.21 cannot compile a qualified `emit Other.Event(...)` when -userdoc is requested, and docgen always requests it. A library publishes an -event in the ABI of every contract that emits it along an inlined path, so -{IexecEscrowEvents} stays as the single declaration feeding the aggregate -interface._ - -### Transfer +The escrow layers on top of the sRLC ledger: it owns `m_frozens` and +defers every balance move to {StakedRlcLib}. -```solidity -event Transfer(address from, address to, uint256 value) -``` +_The events are declared here rather than taken from {IexecEscrowEvents} +because solc 0.8.21 cannot compile `emit Other.Event(...)`._ ### Reward @@ -1297,6 +1290,27 @@ struct PocoStorage { } ``` +## StakedRlcLib + +sRLC ("Staked RLC") is the internal token of the PoCo protocol. It is +not a standalone contract: its total supply, balances and allowances live in +the PoCo storage. This library is the single owner of every write to them. + +_The events are declared here rather than taken from {IexecEscrowEvents} +because solc 0.8.21 cannot compile `emit Other.Event(...)`._ + +### Transfer + +```solidity +event Transfer(address from, address to, uint256 value) +``` + +### Approval + +```solidity +event Approval(address owner, address spender, uint256 value) +``` + ## IRegistry ### isRegistered diff --git a/docs/uml/class-uml-IexecEscrows.svg b/docs/uml/class-uml-IexecEscrows.svg index 0e3177c4d..25eb235b6 100644 --- a/docs/uml/class-uml-IexecEscrows.svg +++ b/docs/uml/class-uml-IexecEscrows.svg @@ -4,708 +4,716 @@ - - + + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() 8 - -IexecEscrowTokenFacet -contracts/facets/IexecEscrowTokenFacet.sol - -Internal: -    _executeOperation(sender: address, data: bytes) -    _validateMatchOrders(sender: address, data: bytes) -    _deposit(from: address, amount: uint256) -    _withdraw(to: address, amount: uint256) -    _mint(account: address, amount: uint256) -    _burn(account: address, amount: uint256) -    _approve(owner: address, spender: address, amount: uint256) -External: -    <<payable>> null() -    <<payable>> null() -    deposit(amount: uint256): bool -    depositFor(amount: uint256, target: address): bool -    depositForArray(amounts: uint256[], targets: address[]): bool -    withdraw(amount: uint256): bool -    withdrawTo(amount: uint256, target: address): bool -    recover(): uint256 <<onlyOwner>> -    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool -    transfer(recipient: address, amount: uint256): bool -    approve(spender: address, value: uint256): bool -    approveAndCall(spender: address, value: uint256, extraData: bytes): bool -    transferFrom(sender: address, recipient: address, amount: uint256): bool -    increaseAllowance(spender: address, addedValue: uint256): bool -    decreaseAllowance(spender: address, subtractedValue: uint256): bool + +IexecEscrowTokenFacet +contracts/facets/IexecEscrowTokenFacet.sol + +Internal: +    _executeOperation(sender: address, data: bytes) +    _validateMatchOrders(sender: address, data: bytes) +    _deposit(from: address, amount: uint256) +    _withdraw(to: address, amount: uint256) +External: +    <<payable>> null() +    <<payable>> null() +    deposit(amount: uint256): bool +    depositFor(amount: uint256, target: address): bool +    depositForArray(amounts: uint256[], targets: address[]): bool +    withdraw(amount: uint256): bool +    withdrawTo(amount: uint256, target: address): bool +    recover(): uint256 <<onlyOwner>> +    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool +    transfer(recipient: address, amount: uint256): bool +    approve(spender: address, value: uint256): bool +    approveAndCall(spender: address, value: uint256, extraData: bytes): bool +    transferFrom(sender: address, recipient: address, amount: uint256): bool +    increaseAllowance(spender: address, addedValue: uint256): bool +    decreaseAllowance(spender: address, subtractedValue: uint256): bool 8->3 - - + + - + 23 - -<<Interface>> -IexecEscrowToken -contracts/interfaces/IexecEscrowToken.sol - -External: -     null() -     null() -     deposit(uint256): bool -     depositFor(uint256, address): bool -     depositForArray(uint256[], address[]): bool -     withdraw(uint256): bool -     withdrawTo(uint256, address): bool -     recover(): uint256 -     transfer(address, uint256): bool -     approve(address, uint256): bool -     transferFrom(address, address, uint256): bool -     increaseAllowance(address, uint256): bool -     decreaseAllowance(address, uint256): bool -     approveAndCall(address, uint256, bytes): bool + +<<Interface>> +IexecEscrowToken +contracts/interfaces/IexecEscrowToken.sol + +External: +     null() +     null() +     deposit(uint256): bool +     depositFor(uint256, address): bool +     depositForArray(uint256[], address[]): bool +     withdraw(uint256): bool +     withdrawTo(uint256, address): bool +     recover(): uint256 +     transfer(address, uint256): bool +     approve(address, uint256): bool +     transferFrom(address, address, uint256): bool +     increaseAllowance(address, uint256): bool +     decreaseAllowance(address, uint256): bool +     approveAndCall(address, uint256, bytes): bool 8->23 - - + + - + 26 - -<<Interface>> -IexecPoco1 -contracts/interfaces/IexecPoco1.sol - -External: -     verifySignature(address, bytes32, bytes): bool -     verifyPresignature(address, bytes32): bool -     verifyPresignatureOrSignature(address, bytes32, bytes): bool -     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -Public: -    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> DealSponsored(dealId: bytes32, sponsor: address) + +<<Interface>> +IexecPoco1 +contracts/interfaces/IexecPoco1.sol + +External: +     verifySignature(address, bytes32, bytes): bool +     verifyPresignature(address, bytes32): bool +     verifyPresignatureOrSignature(address, bytes32, bytes): bool +     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +Public: +    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> DealSponsored(dealId: bytes32, sponsor: address) - + 8->26 - - + + - + 33 - -<<Interface>> -IexecTokenSpender -contracts/interfaces/IexecTokenSpender.sol - -External: -     receiveApproval(address, uint256, address, bytes): bool + +<<Interface>> +IexecTokenSpender +contracts/interfaces/IexecTokenSpender.sol + +External: +     receiveApproval(address, uint256, address, bytes): bool 8->33 - - - - - -35 - -<<Library>> -EscrowLib -contracts/libs/EscrowLib.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    transfer(from: address, to: address, value: uint256) -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) - - - -8->35 - - + + - + 50 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 - + 8->50 - - + + - + 61 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) - + 8->61 - - + + - + 62 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) - + 8->62 - - + + - - -22 - -<<Interface>> -IexecEscrowEvents -contracts/interfaces/IexecEscrowEvents.sol - -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Approval(owner: address, spender: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) - - - -23->22 - - + + +63 + +<<Library>> +StakedRlcLib +contracts/libs/StakedRlcLib.sol + +Internal: +    transfer(from: address, to: address, value: uint256) +    mint(account: address, amount: uint256) +    burn(account: address, amount: uint256) +    approve(owner: address, spender: address, amount: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +8->63 + + - + 24 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 - + 26->50 - - + + - + 53 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 26->53 - - + + - + 54 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 26->54 - - + + - + 55 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 26->55 - - + + - + 56 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes - + 26->56 - - + + + + + +35 + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +Public: +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) - + 35->61 - - + + - + 35->62 - - + + + + + +35->63 + + - + 36 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol - + 52 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address 50->52 - - + + 50->53 - - + + 50->54 - - + + 50->55 - - + + 50->56 - - + + - + 57 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes 50->57 - - + + - + 58 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes 50->58 - - + + - + 59 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes 50->59 - - + + - + 60 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes 50->60 - - + + - + 51 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 51->50 - - + + 52->50 - - + + 53->50 - - + + 54->50 - - + + 55->50 - - + + 56->50 - - + + 57->50 - - + + 57->51 - - + + 57->53 - - + + 58->50 - - + + 58->51 - - + + 58->54 - - + + 59->50 - - + + 59->51 - - + + 59->55 - - + + 60->50 - - + + 60->51 - - + + 60->56 - - + + 61->62 - - + + 62->24 - - + + 62->36 - - + + 62->61 - - + + - + -63 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - +64 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool + + -62->63 - - +62->64 + + + + + +63->61 + + + + + +63->62 + + diff --git a/docs/uml/class-uml-IexecPocoBoostFacet.svg b/docs/uml/class-uml-IexecPocoBoostFacet.svg index 4eefbacf7..e5cf871b5 100644 --- a/docs/uml/class-uml-IexecPocoBoostFacet.svg +++ b/docs/uml/class-uml-IexecPocoBoostFacet.svg @@ -4,831 +4,864 @@ - - + + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() - - + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() + + -67 - -<<Interface>> -IOracleConsumer -contracts/external/interfaces/IOracleConsumer.sol - -External: -     receiveResult(taskId: bytes32, resultsCallback: bytes) +68 + +<<Interface>> +IOracleConsumer +contracts/external/interfaces/IOracleConsumer.sol + +External: +     receiveResult(taskId: bytes32, resultsCallback: bytes) 15 - -IexecPocoBoostFacet -contracts/facets/IexecPocoBoostFacet.sol - -Private: -    _matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder, sponsor: address): bytes32 -    requireTaskExistsAndUnset(taskStatus: IexecLibCore_v5.TaskStatusEnum, taskIndex: uint256, botSize: uint16) -External: -    matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -    sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -    pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) -    claimBoost(dealId: bytes32, index: uint256) + +IexecPocoBoostFacet +contracts/facets/IexecPocoBoostFacet.sol + +Private: +    _matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder, sponsor: address): bytes32 +    requireTaskExistsAndUnset(taskStatus: IexecLibCore_v5.TaskStatusEnum, taskIndex: uint256, botSize: uint16) +External: +    matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +    sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +    pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) +    claimBoost(dealId: bytes32, index: uint256) 15->3 - - + + - + -15->67 - - +15->68 + + 30 - -<<Interface>> -IexecPocoBoost -contracts/interfaces/IexecPocoBoost.sol - -External: -     matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 -     pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) -     claimBoost(dealId: bytes32, index: uint256) -Public: -    <<event>> SchedulerNoticeBoost(workerpool: address, dealId: bytes32, app: address, dataset: address, category: uint256, tag: bytes32, params: string, beneficiary: address) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> ResultPushedBoost(dealId: bytes32, index: uint256, results: bytes) -    <<event>> TaskClaimed(taskid: bytes32) -    <<event>> DealSponsoredBoost(dealId: bytes32, sponsor: address) + +<<Interface>> +IexecPocoBoost +contracts/interfaces/IexecPocoBoost.sol + +External: +     matchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrdersBoost(appOrder: IexecLibOrders_v5.AppOrder, datasetOrder: IexecLibOrders_v5.DatasetOrder, workerpoolOrder: IexecLibOrders_v5.WorkerpoolOrder, requestOrder: IexecLibOrders_v5.RequestOrder): bytes32 +     pushResultBoost(dealId: bytes32, index: uint256, results: bytes, resultsCallback: bytes, authorizationSign: bytes, enclaveChallenge: address, enclaveSign: bytes) +     claimBoost(dealId: bytes32, index: uint256) +Public: +    <<event>> SchedulerNoticeBoost(workerpool: address, dealId: bytes32, app: address, dataset: address, category: uint256, tag: bytes32, params: string, beneficiary: address) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> ResultPushedBoost(dealId: bytes32, index: uint256, results: bytes) +    <<event>> TaskClaimed(taskid: bytes32) +    <<event>> DealSponsoredBoost(dealId: bytes32, sponsor: address) 15->30 - - + + 34 - -<<Library>> -CommonLib -contracts/libs/CommonLib.sol - -Private: -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    toTypedDataHash(structHash: bytes32): bytes32 -    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool -    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool -    verifyPresignature(account: address, messageHash: bytes32): bool -    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool -    isAccountAuthorizedByRestriction(restriction: address, account: address): bool -    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 15->34 - - + + 35 - -<<Library>> -EscrowLib -contracts/libs/EscrowLib.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    transfer(from: address, to: address, value: uint256) -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +Public: +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) 15->35 - - + + 36 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol 15->36 - - + + 44 - -<<Struct>> -DealBoost -contracts/libs/IexecLibCore_v5.sol - -appOwner: address -appPrice: uint96 -datasetOwner: address -datasetPrice: uint96 -workerpoolOwner: address -workerpoolPrice: uint96 -requester: address -workerReward: uint96 -callback: address -deadline: uint40 -botFirst: uint16 -botSize: uint16 -shortTag: bytes3 -sponsor: address + +<<Struct>> +DealBoost +contracts/libs/IexecLibCore_v5.sol + +appOwner: address +appPrice: uint96 +datasetOwner: address +datasetPrice: uint96 +workerpoolOwner: address +workerpoolPrice: uint96 +requester: address +workerReward: uint96 +callback: address +deadline: uint40 +botFirst: uint16 +botSize: uint16 +shortTag: bytes3 +sponsor: address 15->44 - - + + 45 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 15->45 - - + + 46 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes 15->46 - - + + 50 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 15->50 - - + + 53 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 15->53 - - + + 54 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 15->54 - - + + 55 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 15->55 - - + + 56 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes 15->56 - - + + 61 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) 15->61 - - + + 62 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) 15->62 - - - - - -78 - -<<Interface>> -IWorkerpool -contracts/registries/workerpools/IWorkerpool.v8.sol - -External: -     owner(): address -     m_workerpoolDescription(): string -     m_schedulerRewardRatioPolicy(): uint256 -     m_workerStakeRatioPolicy(): uint256 - - + + + + + +79 + +<<Interface>> +IWorkerpool +contracts/registries/workerpools/IWorkerpool.v8.sol + +External: +     owner(): address +     m_workerpoolDescription(): string +     m_schedulerRewardRatioPolicy(): uint256 +     m_workerStakeRatioPolicy(): uint256 + + -15->78 - - +15->79 + + 24 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 30->50 - - + + 30->53 - - + + 30->54 - - + + 30->55 - - + + 30->56 - - + + 34->61 - - + + 34->62 - - + + 35->61 - - + + 35->62 - - + + + + + +63 + +<<Library>> +StakedRlcLib +contracts/libs/StakedRlcLib.sol + +Internal: +    transfer(from: address, to: address, value: uint256) +    mint(account: address, amount: uint256) +    burn(account: address, amount: uint256) +    approve(owner: address, spender: address, amount: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +35->63 + + - + 44->36 - - + + - + 45->36 - - + + - + 46->36 - - + + - + 46->45 - - + + 52 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address - + 50->52 - - + + - + 50->53 - - + + - + 50->54 - - + + - + 50->55 - - + + - + 50->56 - - + + 57 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes - + 50->57 - - + + 58 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes - + 50->58 - - + + 59 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes - + 50->59 - - + + 60 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes - + 50->60 - - + + 51 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 - + 51->50 - - + + - + 52->50 - - + + - + 53->50 - - + + - + 54->50 - - + + - + 55->50 - - + + - + 56->50 - - + + - + 57->50 - - + + - + 57->51 - - + + - + 57->53 - - + + - + 58->50 - - + + - + 58->51 - - + + - + 58->54 - - + + - + 59->50 - - + + - + 59->51 - - + + - + 59->55 - - + + - + 60->50 - - + + - + 60->51 - - + + - + 60->56 - - + + - + 61->62 - - + + - + 62->24 - - + + - + 62->36 - - + + - + 62->61 - - + + - - -63 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - - -62->63 - - + + +64 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool + + + +62->64 + + + + + +63->61 + + + + + +63->62 + + diff --git a/docs/uml/class-uml-IexecPocoFacets.svg b/docs/uml/class-uml-IexecPocoFacets.svg index 49bedeb83..bca055427 100644 --- a/docs/uml/class-uml-IexecPocoFacets.svg +++ b/docs/uml/class-uml-IexecPocoFacets.svg @@ -4,1053 +4,1086 @@ - - + + UmlClassDiagram - + 3 - -<<Abstract>> -FacetBase -contracts/abstract/FacetBase.sol - -Internal: -   CONTRIBUTION_DEADLINE_RATIO: uint256 -   REVEAL_DEADLINE_RATIO: uint256 -   FINAL_DEADLINE_RATIO: uint256 -   WORKERPOOL_STAKE_RATIO: uint256 -   KITTY_RATIO: uint256 -   KITTY_MIN: uint256 -   KITTY_ADDRESS: address -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    owner(): address -    _msgSender(): address -Public: -    <<modifier>> onlyOwner() + +<<Abstract>> +FacetBase +contracts/abstract/FacetBase.sol + +Internal: +   CONTRIBUTION_DEADLINE_RATIO: uint256 +   REVEAL_DEADLINE_RATIO: uint256 +   FINAL_DEADLINE_RATIO: uint256 +   WORKERPOOL_STAKE_RATIO: uint256 +   KITTY_RATIO: uint256 +   KITTY_MIN: uint256 +   KITTY_ADDRESS: address +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    owner(): address +    _msgSender(): address +Public: +    <<modifier>> onlyOwner() 10 - -<<Struct>> -Matching -contracts/facets/IexecPoco1Facet.sol - -apporderHash: bytes32 -appOwner: address -datasetorderHash: bytes32 -datasetOwner: address -workerpoolorderHash: bytes32 -workerpoolOwner: address -requestorderHash: bytes32 -hasDataset: bool + +<<Struct>> +Matching +contracts/facets/IexecPoco1Facet.sol + +apporderHash: bytes32 +appOwner: address +datasetorderHash: bytes32 +datasetOwner: address +workerpoolorderHash: bytes32 +workerpoolOwner: address +requestorderHash: bytes32 +hasDataset: bool 11 - -IexecPoco1Facet -contracts/facets/IexecPoco1Facet.sol - -Private: -    _matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder, _sponsor: address): bytes32 -    _ignoreTeeFramework(tag: bytes32): bytes32 -External: -    verifySignature(_identity: address, _hash: bytes32, _signature: bytes): bool -    verifyPresignature(_identity: address, _hash: bytes32): bool -    verifyPresignatureOrSignature(_identity: address, _hash: bytes32, _signature: bytes): bool -    assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -    matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 -    sponsorMatchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 + +IexecPoco1Facet +contracts/facets/IexecPoco1Facet.sol + +Private: +    _matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder, _sponsor: address): bytes32 +    _ignoreTeeFramework(tag: bytes32): bytes32 +External: +    verifySignature(_identity: address, _hash: bytes32, _signature: bytes): bool +    verifyPresignature(_identity: address, _hash: bytes32): bool +    verifyPresignatureOrSignature(_identity: address, _hash: bytes32, _signature: bytes): bool +    assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +    matchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 +    sponsorMatchOrders(_apporder: IexecLibOrders_v5.AppOrder, _datasetorder: IexecLibOrders_v5.DatasetOrder, _workerpoolorder: IexecLibOrders_v5.WorkerpoolOrder, _requestorder: IexecLibOrders_v5.RequestOrder): bytes32 11->3 - - + + 11->10 - - + + 26 - -<<Interface>> -IexecPoco1 -contracts/interfaces/IexecPoco1.sol - -External: -     verifySignature(address, bytes32, bytes): bool -     verifyPresignature(address, bytes32): bool -     verifyPresignatureOrSignature(address, bytes32, bytes): bool -     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) -     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 -Public: -    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) -    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) -    <<event>> DealSponsored(dealId: bytes32, sponsor: address) + +<<Interface>> +IexecPoco1 +contracts/interfaces/IexecPoco1.sol + +External: +     verifySignature(address, bytes32, bytes): bool +     verifyPresignature(address, bytes32): bool +     verifyPresignatureOrSignature(address, bytes32, bytes): bool +     assertDatasetDealCompatibility(datasetOrder: IexecLibOrders_v5.DatasetOrder, dealId: bytes32) +     matchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +     sponsorMatchOrders(IexecLibOrders_v5.AppOrder, IexecLibOrders_v5.DatasetOrder, IexecLibOrders_v5.WorkerpoolOrder, IexecLibOrders_v5.RequestOrder): bytes32 +Public: +    <<event>> SchedulerNotice(workerpool: address, dealid: bytes32) +    <<event>> OrdersMatched(dealid: bytes32, appHash: bytes32, datasetHash: bytes32, workerpoolHash: bytes32, requestHash: bytes32, volume: uint256) +    <<event>> DealSponsored(dealId: bytes32, sponsor: address) 11->26 - - + + 27 - -<<Interface>> -IexecPoco1Errors -contracts/interfaces/IexecPoco1Errors.sol + +<<Interface>> +IexecPoco1Errors +contracts/interfaces/IexecPoco1Errors.sol 11->27 - - + + 34 - -<<Library>> -CommonLib -contracts/libs/CommonLib.sol - -Private: -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    toTypedDataHash(structHash: bytes32): bytes32 -    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool -    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool -    verifyPresignature(account: address, messageHash: bytes32): bool -    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool -    isAccountAuthorizedByRestriction(restriction: address, account: address): bool -    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 11->34 - - + + 35 - -<<Library>> -EscrowLib -contracts/libs/EscrowLib.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    transfer(from: address, to: address, value: uint256) -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +Public: +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) 11->35 - - + + 36 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol 11->36 - - + + 43 - -<<Struct>> -Deal -contracts/libs/IexecLibCore_v5.sol - -app: Resource -dataset: Resource -workerpool: Resource -trust: uint256 -category: uint256 -tag: bytes32 -requester: address -beneficiary: address -callback: address -params: string -startTime: uint256 -botFirst: uint256 -botSize: uint256 -workerStake: uint256 -schedulerRewardRatio: uint256 -sponsor: address + +<<Struct>> +Deal +contracts/libs/IexecLibCore_v5.sol + +app: Resource +dataset: Resource +workerpool: Resource +trust: uint256 +category: uint256 +tag: bytes32 +requester: address +beneficiary: address +callback: address +params: string +startTime: uint256 +botFirst: uint256 +botSize: uint256 +workerStake: uint256 +schedulerRewardRatio: uint256 +sponsor: address 11->43 - - + + 50 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 11->50 - - + + 53 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 11->53 - - + + 54 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 11->54 - - + + 55 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes 11->55 - - + + 56 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes 11->56 - - + + 61 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) 11->61 - - + + 62 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) 11->62 - - - - - -78 - -<<Interface>> -IWorkerpool -contracts/registries/workerpools/IWorkerpool.v8.sol - -External: -     owner(): address -     m_workerpoolDescription(): string -     m_schedulerRewardRatioPolicy(): uint256 -     m_workerStakeRatioPolicy(): uint256 - - + + + + + +79 + +<<Interface>> +IWorkerpool +contracts/registries/workerpools/IWorkerpool.v8.sol + +External: +     owner(): address +     m_workerpoolDescription(): string +     m_schedulerRewardRatioPolicy(): uint256 +     m_workerStakeRatioPolicy(): uint256 + + -11->78 - - +11->79 + + 12 - -IexecPoco2Facet -contracts/facets/IexecPoco2Facet.sol - -Internal: -    successWork(_dealid: bytes32, _taskid: bytes32) -    failedWork(_dealid: bytes32, _taskid: bytes32) -    checkConsensus(_taskid: bytes32, _consensus: bytes32) -    distributeRewards(_taskid: bytes32) -    distributeRewardsFast(_taskid: bytes32) -    executeCallback(_taskid: bytes32, _resultsCallback: bytes) -External: -    contribute(_taskid: bytes32, _resultHash: bytes32, _resultSeal: bytes32, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) -    contributeAndFinalize(_taskid: bytes32, _resultDigest: bytes32, _results: bytes, _resultsCallback: bytes, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) -    reveal(_taskid: bytes32, _resultDigest: bytes32) -    reopen(_taskid: bytes32) <<onlyScheduler>> -    finalize(_taskid: bytes32, _results: bytes, _resultsCallback: bytes) <<onlyScheduler>> -    initializeArray(_dealid: bytes32[], _idx: uint256[]): bool -    claimArray(_taskid: bytes32[]): bool -    initializeAndClaimArray(_dealid: bytes32[], _idx: uint256[]): bool -Public: -    <<modifier>> onlyScheduler(_taskId: bytes32) -    initialize(_dealid: bytes32, idx: uint256): bytes32 -    claim(_taskid: bytes32) + +IexecPoco2Facet +contracts/facets/IexecPoco2Facet.sol + +Internal: +    successWork(_dealid: bytes32, _taskid: bytes32) +    failedWork(_dealid: bytes32, _taskid: bytes32) +    checkConsensus(_taskid: bytes32, _consensus: bytes32) +    distributeRewards(_taskid: bytes32) +    distributeRewardsFast(_taskid: bytes32) +    executeCallback(_taskid: bytes32, _resultsCallback: bytes) +External: +    contribute(_taskid: bytes32, _resultHash: bytes32, _resultSeal: bytes32, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) +    contributeAndFinalize(_taskid: bytes32, _resultDigest: bytes32, _results: bytes, _resultsCallback: bytes, _enclaveChallenge: address, _enclaveSign: bytes, _authorizationSign: bytes) +    reveal(_taskid: bytes32, _resultDigest: bytes32) +    reopen(_taskid: bytes32) <<onlyScheduler>> +    finalize(_taskid: bytes32, _results: bytes, _resultsCallback: bytes) <<onlyScheduler>> +    initializeArray(_dealid: bytes32[], _idx: uint256[]): bool +    claimArray(_taskid: bytes32[]): bool +    initializeAndClaimArray(_dealid: bytes32[], _idx: uint256[]): bool +Public: +    <<modifier>> onlyScheduler(_taskId: bytes32) +    initialize(_dealid: bytes32, idx: uint256): bytes32 +    claim(_taskid: bytes32) 12->3 - - + + 28 - -<<Interface>> -IexecPoco2 -contracts/interfaces/IexecPoco2.sol - -External: -     initialize(dealId: bytes32, index: uint256): bytes32 -     claim(taskId: bytes32) -     contribute(taskId: bytes32, resultHash: bytes32, resultSeal: bytes32, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) -     contributeAndFinalize(taskId: bytes32, resultDigest: bytes32, results: bytes, resultsCallback: bytes, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) -     reveal(taskId: bytes32, resultDigest: bytes32) -     reopen(taskId: bytes32) -     finalize(taskId: bytes32, results: bytes, resultsCallback: bytes) -     initializeArray(dealIds: bytes32[], indexes: uint256[]): bool -     claimArray(taskIds: bytes32[]): bool -     initializeAndClaimArray(dealIds: bytes32[], indexes: uint256[]): bool -Public: -    <<event>> AccurateContribution(worker: address, taskid: bytes32) -    <<event>> FaultyContribution(worker: address, taskid: bytes32) -    <<event>> TaskInitialize(taskid: bytes32, workerpool: address) -    <<event>> TaskContribute(taskid: bytes32, worker: address, hash: bytes32) -    <<event>> TaskConsensus(taskid: bytes32, consensus: bytes32) -    <<event>> TaskReveal(taskid: bytes32, worker: address, digest: bytes32) -    <<event>> TaskReopen(taskid: bytes32) -    <<event>> TaskFinalize(taskid: bytes32, results: bytes) -    <<event>> TaskClaimed(taskid: bytes32) + +<<Interface>> +IexecPoco2 +contracts/interfaces/IexecPoco2.sol + +External: +     initialize(dealId: bytes32, index: uint256): bytes32 +     claim(taskId: bytes32) +     contribute(taskId: bytes32, resultHash: bytes32, resultSeal: bytes32, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) +     contributeAndFinalize(taskId: bytes32, resultDigest: bytes32, results: bytes, resultsCallback: bytes, enclaveChallenge: address, enclaveSign: bytes, authorizationSign: bytes) +     reveal(taskId: bytes32, resultDigest: bytes32) +     reopen(taskId: bytes32) +     finalize(taskId: bytes32, results: bytes, resultsCallback: bytes) +     initializeArray(dealIds: bytes32[], indexes: uint256[]): bool +     claimArray(taskIds: bytes32[]): bool +     initializeAndClaimArray(dealIds: bytes32[], indexes: uint256[]): bool +Public: +    <<event>> AccurateContribution(worker: address, taskid: bytes32) +    <<event>> FaultyContribution(worker: address, taskid: bytes32) +    <<event>> TaskInitialize(taskid: bytes32, workerpool: address) +    <<event>> TaskContribute(taskid: bytes32, worker: address, hash: bytes32) +    <<event>> TaskConsensus(taskid: bytes32, consensus: bytes32) +    <<event>> TaskReveal(taskid: bytes32, worker: address, digest: bytes32) +    <<event>> TaskReopen(taskid: bytes32) +    <<event>> TaskFinalize(taskid: bytes32, results: bytes) +    <<event>> TaskClaimed(taskid: bytes32) 12->28 - - + + 12->34 - - + + 12->35 - - + + 12->36 - - + + 12->43 - - + + 46 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes 12->46 - - + + 47 - -<<Struct>> -Consensus -contracts/libs/IexecLibCore_v5.sol - -group: mapping(bytes32=>uint256) -total: uint256 + +<<Struct>> +Consensus +contracts/libs/IexecLibCore_v5.sol + +group: mapping(bytes32=>uint256) +total: uint256 12->47 - - + + 49 - -<<Struct>> -Contribution -contracts/libs/IexecLibCore_v5.sol - -status: ContributionStatusEnum -resultHash: bytes32 -resultSeal: bytes32 -enclaveChallenge: address -weight: uint256 + +<<Struct>> +Contribution +contracts/libs/IexecLibCore_v5.sol + +status: ContributionStatusEnum +resultHash: bytes32 +resultSeal: bytes32 +enclaveChallenge: address +weight: uint256 12->49 - - + + 12->61 - - + + 12->62 - - + + 24 - -<<Interface>> -IexecHubV3Interface -contracts/interfaces/IexecHubV3Interface.sol - -External: -     viewScore(worker: address): uint256 + +<<Interface>> +IexecHubV3Interface +contracts/interfaces/IexecHubV3Interface.sol + +External: +     viewScore(worker: address): uint256 26->50 - - + + 26->53 - - + + 26->54 - - + + 26->55 - - + + 26->56 - - + + 34->61 - - + + 34->62 - - + + 35->61 - - + + 35->62 - - + + + + + +63 + +<<Library>> +StakedRlcLib +contracts/libs/StakedRlcLib.sol + +Internal: +    transfer(from: address, to: address, value: uint256) +    mint(account: address, amount: uint256) +    burn(account: address, amount: uint256) +    approve(owner: address, spender: address, amount: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +35->63 + + 42 - -<<Struct>> -Resource -contracts/libs/IexecLibCore_v5.sol - -pointer: address -owner: address -price: uint256 + +<<Struct>> +Resource +contracts/libs/IexecLibCore_v5.sol + +pointer: address +owner: address +price: uint256 - + 42->36 - - + + - + 43->36 - - + + - + 43->42 - - + + 45 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 - + 45->36 - - + + - + 46->36 - - + + - + 46->45 - - + + - + 47->36 - - + + 48 - -<<Enum>> -ContributionStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -CONTRIBUTED: 1 -PROVED: 2 -REJECTED: 3 + +<<Enum>> +ContributionStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +CONTRIBUTED: 1 +PROVED: 2 +REJECTED: 3 - + 48->36 - - + + - + 49->36 - - + + - + 49->48 - - + + 52 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address - + 50->52 - - + + - + 50->53 - - + + - + 50->54 - - + + - + 50->55 - - + + - + 50->56 - - + + 57 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes - + 50->57 - - + + 58 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes - + 50->58 - - + + 59 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes - + 50->59 - - + + 60 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes - + 50->60 - - + + 51 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 - + 51->50 - - + + - + 52->50 - - + + - + 53->50 - - + + - + 54->50 - - + + - + 55->50 - - + + - + 56->50 - - + + - + 57->50 - - + + - + 57->51 - - + + - + 57->53 - - + + - + 58->50 - - + + - + 58->51 - - + + - + 58->54 - - + + - + 59->50 - - + + - + 59->51 - - + + - + 59->55 - - + + - + 60->50 - - + + - + 60->51 - - + + - + 60->56 - - + + - + 61->62 - - + + - + 62->24 - - + + - + 62->36 - - + + - + 62->61 - - + + - - -63 - -<<Interface>> -IRegistry -contracts/registries/IRegistry.sol - -External: -     isRegistered(_entry: address): bool - - - -62->63 - - + + +64 + +<<Interface>> +IRegistry +contracts/registries/IRegistry.sol + +External: +     isRegistered(_entry: address): bool + + + +62->64 + + + + + +63->61 + + + + + +63->62 + + diff --git a/docs/uml/class-uml-dir-facets.svg b/docs/uml/class-uml-dir-facets.svg index 0809a3dd8..7518ea546 100644 --- a/docs/uml/class-uml-dir-facets.svg +++ b/docs/uml/class-uml-dir-facets.svg @@ -66,34 +66,31 @@ 4 - -IexecEscrowTokenFacet -contracts/facets/IexecEscrowTokenFacet.sol - -Internal: -    _executeOperation(sender: address, data: bytes) -    _validateMatchOrders(sender: address, data: bytes) -    _deposit(from: address, amount: uint256) -    _withdraw(to: address, amount: uint256) -    _mint(account: address, amount: uint256) -    _burn(account: address, amount: uint256) -    _approve(owner: address, spender: address, amount: uint256) -External: -    <<payable>> null() -    <<payable>> null() -    deposit(amount: uint256): bool -    depositFor(amount: uint256, target: address): bool -    depositForArray(amounts: uint256[], targets: address[]): bool -    withdraw(amount: uint256): bool -    withdrawTo(amount: uint256, target: address): bool -    recover(): uint256 <<onlyOwner>> -    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool -    transfer(recipient: address, amount: uint256): bool -    approve(spender: address, value: uint256): bool -    approveAndCall(spender: address, value: uint256, extraData: bytes): bool -    transferFrom(sender: address, recipient: address, amount: uint256): bool -    increaseAllowance(spender: address, addedValue: uint256): bool -    decreaseAllowance(spender: address, subtractedValue: uint256): bool + +IexecEscrowTokenFacet +contracts/facets/IexecEscrowTokenFacet.sol + +Internal: +    _executeOperation(sender: address, data: bytes) +    _validateMatchOrders(sender: address, data: bytes) +    _deposit(from: address, amount: uint256) +    _withdraw(to: address, amount: uint256) +External: +    <<payable>> null() +    <<payable>> null() +    deposit(amount: uint256): bool +    depositFor(amount: uint256, target: address): bool +    depositForArray(amounts: uint256[], targets: address[]): bool +    withdraw(amount: uint256): bool +    withdrawTo(amount: uint256, target: address): bool +    recover(): uint256 <<onlyOwner>> +    receiveApproval(sender: address, amount: uint256, token: address, data: bytes): bool +    transfer(recipient: address, amount: uint256): bool +    approve(spender: address, value: uint256): bool +    approveAndCall(spender: address, value: uint256, extraData: bytes): bool +    transferFrom(sender: address, recipient: address, amount: uint256): bool +    increaseAllowance(spender: address, addedValue: uint256): bool +    decreaseAllowance(spender: address, subtractedValue: uint256): bool diff --git a/docs/uml/class-uml-dir-libs.svg b/docs/uml/class-uml-dir-libs.svg index 8b2a0b1e1..7215ddc1d 100644 --- a/docs/uml/class-uml-dir-libs.svg +++ b/docs/uml/class-uml-dir-libs.svg @@ -4,791 +4,824 @@ - - + + UmlClassDiagram - + 0 - -<<Library>> -CommonLib -contracts/libs/CommonLib.sol - -Private: -   GROUPMEMBER_PURPOSE: uint256 - -Internal: -    toTypedDataHash(structHash: bytes32): bytes32 -    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool -    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool -    verifyPresignature(account: address, messageHash: bytes32): bool -    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool -    isAccountAuthorizedByRestriction(restriction: address, account: address): bool -    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 + +<<Library>> +CommonLib +contracts/libs/CommonLib.sol + +Private: +   GROUPMEMBER_PURPOSE: uint256 + +Internal: +    toTypedDataHash(structHash: bytes32): bytes32 +    verifySignatureOfEthSignedMessage(account: address, message: bytes, signature: bytes): bool +    verifySignature(account: address, messageHash: bytes32, signature: bytes): bool +    verifyPresignature(account: address, messageHash: bytes32): bool +    verifySignatureOrPresignature(account: address, messageHash: bytes32, signature: bytes): bool +    isAccountAuthorizedByRestriction(restriction: address, account: address): bool +    computeDealVolume(appOrderVolume: uint256, appOrderTypedDataHash: bytes32, hasDataset: bool, datasetOrderVolume: uint256, datasetOrderTypedDataHash: bytes32, workerpoolOrderVolume: uint256, workerpoolOrderTypedDataHash: bytes32, requestOrderVolume: uint256, requestOrderTypedDataHash: bytes32): uint256 27 - -<<Library>> -PocoStorageLib -contracts/libs/PocoStorageLib.sol - -Private: -   POCO_STORAGE_LOCATION: bytes32 - -Internal: -    getPocoStorage(): ($: PocoStorage) + +<<Library>> +PocoStorageLib +contracts/libs/PocoStorageLib.sol + +Private: +   POCO_STORAGE_LOCATION: bytes32 + +Internal: +    getPocoStorage(): ($: PocoStorage) 0->27 - - + + 28 - -<<Struct>> -PocoStorage -contracts/libs/PocoStorageLib.sol - -m_appregistry: IRegistry -m_datasetregistry: IRegistry -m_workerpoolregistry: IRegistry -m_baseToken: IERC20 -m_name: string -m_symbol: string -m_decimals: uint8 -m_totalSupply: uint256 -m_balances: mapping(address=>uint256) -m_frozens: mapping(address=>uint256) -m_allowances: mapping(address=>mapping(address=>uint256)) -m_eip712DomainSeparator: bytes32 -m_presigned: mapping(bytes32=>address) -m_consumed: mapping(bytes32=>uint256) -m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) -m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) -m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) -m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) -m_workerScores: mapping(address=>uint256) -m_teebroker: address -m_callbackgas: uint256 -m_categories: IexecLibCore_v5.Category[] -m_v3_iexecHub: IexecHubV3Interface -m_v3_scoreImported: mapping(address=>bool) -m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) + +<<Struct>> +PocoStorage +contracts/libs/PocoStorageLib.sol + +m_appregistry: IRegistry +m_datasetregistry: IRegistry +m_workerpoolregistry: IRegistry +m_baseToken: IERC20 +m_name: string +m_symbol: string +m_decimals: uint8 +m_totalSupply: uint256 +m_balances: mapping(address=>uint256) +m_frozens: mapping(address=>uint256) +m_allowances: mapping(address=>mapping(address=>uint256)) +m_eip712DomainSeparator: bytes32 +m_presigned: mapping(bytes32=>address) +m_consumed: mapping(bytes32=>uint256) +m_deals: mapping(bytes32=>IexecLibCore_v5.Deal) +m_tasks: mapping(bytes32=>IexecLibCore_v5.Task) +m_consensus: mapping(bytes32=>IexecLibCore_v5.Consensus) +m_contributions: mapping(bytes32=>mapping(address=>IexecLibCore_v5.Contribution)) +m_workerScores: mapping(address=>uint256) +m_teebroker: address +m_callbackgas: uint256 +m_categories: IexecLibCore_v5.Category[] +m_v3_iexecHub: IexecHubV3Interface +m_v3_scoreImported: mapping(address=>bool) +m_dealsBoost: mapping(bytes32=>IexecLibCore_v5.DealBoost) 0->28 - - + + 1 - -<<Library>> -EscrowLib -contracts/libs/EscrowLib.sol - -Internal: -    lock(account: address, value: uint256) -    unlock(account: address, value: uint256) -    reward(account: address, value: uint256, ref: bytes32) -    seize(account: address, value: uint256, ref: bytes32) -    rewardAndLock(account: address, value: uint256, ref: bytes32) -    transfer(from: address, to: address, value: uint256) -Public: -    <<event>> Transfer(from: address, to: address, value: uint256) -    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) -    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) -    <<event>> Lock(owner: address, amount: uint256) -    <<event>> Unlock(owner: address, amount: uint256) + +<<Library>> +EscrowLib +contracts/libs/EscrowLib.sol + +Internal: +    lock(account: address, value: uint256) +    unlock(account: address, value: uint256) +    reward(account: address, value: uint256, ref: bytes32) +    seize(account: address, value: uint256, ref: bytes32) +    rewardAndLock(account: address, value: uint256, ref: bytes32) +Public: +    <<event>> Reward(owner: address, amount: uint256, ref: bytes32) +    <<event>> Seize(owner: address, amount: uint256, ref: bytes32) +    <<event>> Lock(owner: address, amount: uint256) +    <<event>> Unlock(owner: address, amount: uint256) 1->27 - - + + 1->28 - - + + + + + +29 + +<<Library>> +StakedRlcLib +contracts/libs/StakedRlcLib.sol + +Internal: +    transfer(from: address, to: address, value: uint256) +    mint(account: address, amount: uint256) +    burn(account: address, amount: uint256) +    approve(owner: address, spender: address, amount: uint256) +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +1->29 + + 2 - -<<Library>> -IexecLibCore_v5 -contracts/libs/IexecLibCore_v5.sol + +<<Library>> +IexecLibCore_v5 +contracts/libs/IexecLibCore_v5.sol 3 - -<<Struct>> -Account -contracts/libs/IexecLibCore_v5.sol - -stake: uint256 -locked: uint256 + +<<Struct>> +Account +contracts/libs/IexecLibCore_v5.sol + +stake: uint256 +locked: uint256 - + 3->2 - - + + 4 - -<<Struct>> -Category -contracts/libs/IexecLibCore_v5.sol - -name: string -description: string -workClockTimeRef: uint256 + +<<Struct>> +Category +contracts/libs/IexecLibCore_v5.sol + +name: string +description: string +workClockTimeRef: uint256 - + 4->2 - - + + 5 - -<<Struct>> -DatasetInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_datasetName: string -m_datasetMultiaddr: bytes -m_datasetChecksum: bytes32 + +<<Struct>> +DatasetInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_datasetName: string +m_datasetMultiaddr: bytes +m_datasetChecksum: bytes32 - + 5->2 - - + + 6 - -<<Struct>> -AppInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_appName: string -m_appType: string -m_appMultiaddr: bytes -m_appChecksum: bytes32 -m_appMREnclave: bytes + +<<Struct>> +AppInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_appName: string +m_appType: string +m_appMultiaddr: bytes +m_appChecksum: bytes32 +m_appMREnclave: bytes - + 6->2 - - + + 7 - -<<Struct>> -WorkerpoolInfo -contracts/libs/IexecLibCore_v5.sol - -owner: address -m_workerpoolDescription: string -m_workerStakeRatioPolicy: uint256 -m_schedulerRewardRatioPolicy: uint256 + +<<Struct>> +WorkerpoolInfo +contracts/libs/IexecLibCore_v5.sol + +owner: address +m_workerpoolDescription: string +m_workerStakeRatioPolicy: uint256 +m_schedulerRewardRatioPolicy: uint256 - + 7->2 - - + + 8 - -<<Struct>> -Resource -contracts/libs/IexecLibCore_v5.sol - -pointer: address -owner: address -price: uint256 + +<<Struct>> +Resource +contracts/libs/IexecLibCore_v5.sol + +pointer: address +owner: address +price: uint256 - + 8->2 - - + + 9 - -<<Struct>> -Deal -contracts/libs/IexecLibCore_v5.sol - -app: Resource -dataset: Resource -workerpool: Resource -trust: uint256 -category: uint256 -tag: bytes32 -requester: address -beneficiary: address -callback: address -params: string -startTime: uint256 -botFirst: uint256 -botSize: uint256 -workerStake: uint256 -schedulerRewardRatio: uint256 -sponsor: address + +<<Struct>> +Deal +contracts/libs/IexecLibCore_v5.sol + +app: Resource +dataset: Resource +workerpool: Resource +trust: uint256 +category: uint256 +tag: bytes32 +requester: address +beneficiary: address +callback: address +params: string +startTime: uint256 +botFirst: uint256 +botSize: uint256 +workerStake: uint256 +schedulerRewardRatio: uint256 +sponsor: address - + 9->2 - - + + - + 9->8 - - + + 10 - -<<Struct>> -DealBoost -contracts/libs/IexecLibCore_v5.sol - -appOwner: address -appPrice: uint96 -datasetOwner: address -datasetPrice: uint96 -workerpoolOwner: address -workerpoolPrice: uint96 -requester: address -workerReward: uint96 -callback: address -deadline: uint40 -botFirst: uint16 -botSize: uint16 -shortTag: bytes3 -sponsor: address + +<<Struct>> +DealBoost +contracts/libs/IexecLibCore_v5.sol + +appOwner: address +appPrice: uint96 +datasetOwner: address +datasetPrice: uint96 +workerpoolOwner: address +workerpoolPrice: uint96 +requester: address +workerReward: uint96 +callback: address +deadline: uint40 +botFirst: uint16 +botSize: uint16 +shortTag: bytes3 +sponsor: address - + 10->2 - - + + 11 - -<<Enum>> -TaskStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -ACTIVE: 1 -REVEALING: 2 -COMPLETED: 3 -FAILED: 4 + +<<Enum>> +TaskStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +ACTIVE: 1 +REVEALING: 2 +COMPLETED: 3 +FAILED: 4 - + 11->2 - - + + 12 - -<<Struct>> -Task -contracts/libs/IexecLibCore_v5.sol - -status: TaskStatusEnum -dealid: bytes32 -idx: uint256 -timeref: uint256 -contributionDeadline: uint256 -revealDeadline: uint256 -finalDeadline: uint256 -consensusValue: bytes32 -revealCounter: uint256 -winnerCounter: uint256 -contributors: address[] -resultDigest: bytes32 -results: bytes -resultsTimestamp: uint256 -resultsCallback: bytes + +<<Struct>> +Task +contracts/libs/IexecLibCore_v5.sol + +status: TaskStatusEnum +dealid: bytes32 +idx: uint256 +timeref: uint256 +contributionDeadline: uint256 +revealDeadline: uint256 +finalDeadline: uint256 +consensusValue: bytes32 +revealCounter: uint256 +winnerCounter: uint256 +contributors: address[] +resultDigest: bytes32 +results: bytes +resultsTimestamp: uint256 +resultsCallback: bytes - + 12->2 - - + + - + 12->11 - - + + 13 - -<<Struct>> -Consensus -contracts/libs/IexecLibCore_v5.sol - -group: mapping(bytes32=>uint256) -total: uint256 + +<<Struct>> +Consensus +contracts/libs/IexecLibCore_v5.sol + +group: mapping(bytes32=>uint256) +total: uint256 - + 13->2 - - + + 14 - -<<Enum>> -ContributionStatusEnum -contracts/libs/IexecLibCore_v5.sol - -UNSET: 0 -CONTRIBUTED: 1 -PROVED: 2 -REJECTED: 3 + +<<Enum>> +ContributionStatusEnum +contracts/libs/IexecLibCore_v5.sol + +UNSET: 0 +CONTRIBUTED: 1 +PROVED: 2 +REJECTED: 3 - + 14->2 - - + + 15 - -<<Struct>> -Contribution -contracts/libs/IexecLibCore_v5.sol - -status: ContributionStatusEnum -resultHash: bytes32 -resultSeal: bytes32 -enclaveChallenge: address -weight: uint256 + +<<Struct>> +Contribution +contracts/libs/IexecLibCore_v5.sol + +status: ContributionStatusEnum +resultHash: bytes32 +resultSeal: bytes32 +enclaveChallenge: address +weight: uint256 - + 15->2 - - + + - + 15->14 - - + + 16 - -<<Library>> -IexecLibOrders_v5 -contracts/libs/IexecLibOrders_v5.sol - -Public: -   EIP712DOMAIN_TYPEHASH: bytes32 -   APPORDER_TYPEHASH: bytes32 -   DATASETORDER_TYPEHASH: bytes32 -   WORKERPOOLORDER_TYPEHASH: bytes32 -   REQUESTORDER_TYPEHASH: bytes32 -   APPORDEROPERATION_TYPEHASH: bytes32 -   DATASETORDEROPERATION_TYPEHASH: bytes32 -   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 -   REQUESTORDEROPERATION_TYPEHASH: bytes32 - -Public: -    hash(_domain: EIP712Domain): (domainhash: bytes32) -    hash(_apporder: AppOrder): (apphash: bytes32) -    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) -    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) -    hash(_requestorder: RequestOrder): (requesthash: bytes32) -    hash(_apporderoperation: AppOrderOperation): bytes32 -    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 -    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 -    hash(_requestorderoperation: RequestOrderOperation): bytes32 + +<<Library>> +IexecLibOrders_v5 +contracts/libs/IexecLibOrders_v5.sol + +Public: +   EIP712DOMAIN_TYPEHASH: bytes32 +   APPORDER_TYPEHASH: bytes32 +   DATASETORDER_TYPEHASH: bytes32 +   WORKERPOOLORDER_TYPEHASH: bytes32 +   REQUESTORDER_TYPEHASH: bytes32 +   APPORDEROPERATION_TYPEHASH: bytes32 +   DATASETORDEROPERATION_TYPEHASH: bytes32 +   WORKERPOOLORDEROPERATION_TYPEHASH: bytes32 +   REQUESTORDEROPERATION_TYPEHASH: bytes32 + +Public: +    hash(_domain: EIP712Domain): (domainhash: bytes32) +    hash(_apporder: AppOrder): (apphash: bytes32) +    hash(_datasetorder: DatasetOrder): (datasethash: bytes32) +    hash(_workerpoolorder: WorkerpoolOrder): (workerpoolhash: bytes32) +    hash(_requestorder: RequestOrder): (requesthash: bytes32) +    hash(_apporderoperation: AppOrderOperation): bytes32 +    hash(_datasetorderoperation: DatasetOrderOperation): bytes32 +    hash(_workerpoolorderoperation: WorkerpoolOrderOperation): bytes32 +    hash(_requestorderoperation: RequestOrderOperation): bytes32 18 - -<<Struct>> -EIP712Domain -contracts/libs/IexecLibOrders_v5.sol - -name: string -version: string -chainId: uint256 -verifyingContract: address + +<<Struct>> +EIP712Domain +contracts/libs/IexecLibOrders_v5.sol + +name: string +version: string +chainId: uint256 +verifyingContract: address - + 16->18 - - + + 19 - -<<Struct>> -AppOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appprice: uint256 -volume: uint256 -tag: bytes32 -datasetrestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +AppOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appprice: uint256 +volume: uint256 +tag: bytes32 +datasetrestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 16->19 - - + + 20 - -<<Struct>> -DatasetOrder -contracts/libs/IexecLibOrders_v5.sol - -dataset: address -datasetprice: uint256 -volume: uint256 -tag: bytes32 -apprestrict: address -workerpoolrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +DatasetOrder +contracts/libs/IexecLibOrders_v5.sol + +dataset: address +datasetprice: uint256 +volume: uint256 +tag: bytes32 +apprestrict: address +workerpoolrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 16->20 - - + + 21 - -<<Struct>> -WorkerpoolOrder -contracts/libs/IexecLibOrders_v5.sol - -workerpool: address -workerpoolprice: uint256 -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -apprestrict: address -datasetrestrict: address -requesterrestrict: address -salt: bytes32 -sign: bytes + +<<Struct>> +WorkerpoolOrder +contracts/libs/IexecLibOrders_v5.sol + +workerpool: address +workerpoolprice: uint256 +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +apprestrict: address +datasetrestrict: address +requesterrestrict: address +salt: bytes32 +sign: bytes - + 16->21 - - + + 22 - -<<Struct>> -RequestOrder -contracts/libs/IexecLibOrders_v5.sol - -app: address -appmaxprice: uint256 -dataset: address -datasetmaxprice: uint256 -workerpool: address -workerpoolmaxprice: uint256 -requester: address -volume: uint256 -tag: bytes32 -category: uint256 -trust: uint256 -beneficiary: address -callback: address -params: string -salt: bytes32 -sign: bytes + +<<Struct>> +RequestOrder +contracts/libs/IexecLibOrders_v5.sol + +app: address +appmaxprice: uint256 +dataset: address +datasetmaxprice: uint256 +workerpool: address +workerpoolmaxprice: uint256 +requester: address +volume: uint256 +tag: bytes32 +category: uint256 +trust: uint256 +beneficiary: address +callback: address +params: string +salt: bytes32 +sign: bytes - + 16->22 - - + + 23 - -<<Struct>> -AppOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: AppOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +AppOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: AppOrder +operation: OrderOperationEnum +sign: bytes - + 16->23 - - + + 24 - -<<Struct>> -DatasetOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: DatasetOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +DatasetOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: DatasetOrder +operation: OrderOperationEnum +sign: bytes - + 16->24 - - + + 25 - -<<Struct>> -WorkerpoolOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: WorkerpoolOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +WorkerpoolOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: WorkerpoolOrder +operation: OrderOperationEnum +sign: bytes - + 16->25 - - + + 26 - -<<Struct>> -RequestOrderOperation -contracts/libs/IexecLibOrders_v5.sol - -order: RequestOrder -operation: OrderOperationEnum -sign: bytes + +<<Struct>> +RequestOrderOperation +contracts/libs/IexecLibOrders_v5.sol + +order: RequestOrder +operation: OrderOperationEnum +sign: bytes - + 16->26 - - + + 17 - -<<Enum>> -OrderOperationEnum -contracts/libs/IexecLibOrders_v5.sol - -SIGN: 0 -CLOSE: 1 + +<<Enum>> +OrderOperationEnum +contracts/libs/IexecLibOrders_v5.sol + +SIGN: 0 +CLOSE: 1 - + 17->16 - - + + - + 18->16 - - + + - + 19->16 - - + + - + 20->16 - - + + - + 21->16 - - + + - + 22->16 - - + + - + 23->16 - - + + - + 23->17 - - + + - + 23->19 - - + + - + 24->16 - - + + - + 24->17 - - + + - + 24->20 - - + + - + 25->16 - - + + - + 25->17 - - + + - + 25->21 - - + + - + 26->16 - - + + - + 26->17 - - + + - + 26->22 - - + + - + 27->28 - - + + - + 28->2 - - + + - + 28->27 - - + + + + + +29->27 + + + + + +29->28 + +