Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f34d071
feat: Update IexecPocoAccessorsFacet and related scripts for enhanced…
gfournierPro Sep 18, 2025
4a44957
feat: Remove useless file
gfournierPro Sep 22, 2025
99b1b47
feat: Refactor deal and task accessors in IexecPocoAccessorsFacet
gfournierPro Sep 22, 2025
be36a3a
feat: Update Arbitrum RPC URL in Hardhat configuration
gfournierPro Sep 22, 2025
7c7fe07
feat: move new upgrades scripts in accessors subfolder
gfournierPro Sep 22, 2025
8b261fd
feat: refactor deployment script for IexecPocoAccessorsFacet
gfournierPro Sep 22, 2025
b27b116
feat: change to pure instead of view
gfournierPro Sep 22, 2025
9e1d7eb
feat: remove commented code for IexecAccessorsFacet in deploy script
gfournierPro Sep 22, 2025
27f02ab
Merge branch 'main' into feature/new-viewer-fct
Le-Caignec Sep 22, 2025
2939683
feat: remove blockNumber configuration for Arbitrum forking
gfournierPro Sep 22, 2025
99acad3
fix: remove commented code in update proxy script for IexecPocoAccess…
gfournierPro Sep 22, 2025
359d32c
refactor: remove unused functionsToRemove array in update proxy script
gfournierPro Sep 22, 2025
aa5d0e1
refactor: remove deployment record update for IexecPocoAccessorsFacet…
gfournierPro Sep 22, 2025
cc99fa1
feat: implement deployment and update logic for IexecPocoAccessorsFac…
gfournierPro Sep 22, 2025
ce727e7
refactor: simplify old accessor facets identification in deploy script
gfournierPro Sep 22, 2025
22b517e
refactor: update variable names for clarity in deploy and update scri…
gfournierPro Sep 22, 2025
78d8a97
refactor: replace function selector retrieval with linkContractToProx…
gfournierPro Sep 22, 2025
706cbb0
fix: add boundary check for category index in viewCategory function a…
gfournierPro Sep 23, 2025
5033eb9
refactor: remove unnecessary local fork block mining in deploy script…
gfournierPro Sep 23, 2025
f4204dc
refactor: streamline diamond proxy interaction and enhance logging in…
gfournierPro Sep 23, 2025
49a5e4b
refactor: simplify old accessor facets removal logic in deploy script…
gfournierPro Sep 23, 2025
c46526a
refactor: update proxy owner signer logic to conditionally use impers…
gfournierPro Sep 23, 2025
b1105fd
fix: ensure retro-compatibility by reverting without reason in viewCa…
gfournierPro Sep 23, 2025
999aac0
refactor: fix log message formatting and enhance removal logging for …
gfournierPro Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 162 additions & 1 deletion contracts/facets/IexecPocoAccessorsFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.0;

import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol";
import {PocoStorageLib, IRegistry} from "../libs/PocoStorageLib.v8.sol";
import {FacetBase} from "./FacetBase.v8.sol";
import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol";
import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol";
Expand All @@ -25,6 +25,7 @@ contract IexecPocoAccessorsFacet is
using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder;
using IexecLibOrders_v5 for IexecLibOrders_v5.RequestOrder;

// ========= Deal and Task Accessors =========
/**
* Get a deal created by PoCo classic facet.
* @param id The ID of the deal.
Expand Down Expand Up @@ -73,4 +74,164 @@ contract IexecPocoAccessorsFacet is
_toTypedDataHash(requestOrder.hash())
);
}

function viewConsumed(bytes32 _id) external view returns (uint256 consumed) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_consumed[_id];
}

function viewPresigned(bytes32 _id) external view returns (address signer) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_presigned[_id];
}

function viewContribution(
bytes32 _taskid,
address _worker
) external view returns (IexecLibCore_v5.Contribution memory) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_contributions[_taskid][_worker];
}

function viewScore(address _worker) external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_workerScores[_worker];
}

function resultFor(bytes32 id) external view returns (bytes memory) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
IexecLibCore_v5.Task storage task = $.m_tasks[id];
require(task.status == IexecLibCore_v5.TaskStatusEnum.COMPLETED, "task-pending");
return task.resultsCallback; // Expansion - result separation
}

// ========= SRLC Token and Account Accessors =========

function name() external view returns (string memory) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_name;
}

function symbol() external view returns (string memory) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_symbol;
}

function decimals() external view returns (uint8) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_decimals;
}

function totalSupply() external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_totalSupply;
}

function balanceOf(address account) external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_balances[account];
}

function frozenOf(address account) external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_frozens[account];
}

function allowance(address account, address spender) external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_allowances[account][spender];
}

function viewAccount(address account) external view returns (IexecLibCore_v5.Account memory) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return IexecLibCore_v5.Account($.m_balances[account], $.m_frozens[account]);
}

function token() external view returns (address) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return address($.m_baseToken);
}

// ========= Category Accessors =========

function viewCategory(
uint256 _catid
) external view returns (IexecLibCore_v5.Category memory category) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
if (_catid >= $.m_categories.length) {
revert(); // Intentionally revert without reason instead of panic for retro-compatibility with the old interface
}
return $.m_categories[_catid];
}

function countCategory() external view returns (uint256 count) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_categories.length;
}

// ========= Registry Accessors =========

function appregistry() external view returns (IRegistry) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_appregistry;
}

function datasetregistry() external view returns (IRegistry) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_datasetregistry;
}

function workerpoolregistry() external view returns (IRegistry) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_workerpoolregistry;
}

function teebroker() external view returns (address) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_teebroker;
}

function callbackgas() external view returns (uint256) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_callbackgas;
}

// ========= Constants Accessors =========

function contribution_deadline_ratio() external pure returns (uint256) {
return CONTRIBUTION_DEADLINE_RATIO;
}

function reveal_deadline_ratio() external pure returns (uint256) {
return REVEAL_DEADLINE_RATIO;
}

function final_deadline_ratio() external pure returns (uint256) {
return FINAL_DEADLINE_RATIO;
}

function workerpool_stake_ratio() external pure returns (uint256) {
return WORKERPOOL_STAKE_RATIO;
}

function kitty_ratio() external pure returns (uint256) {
return KITTY_RATIO;
}

function kitty_min() external pure returns (uint256) {
return KITTY_MIN;
}

function kitty_address() external pure returns (address) {
return KITTY_ADDRESS;
}

function groupmember_purpose() external pure returns (uint256) {
return GROUPMEMBER_PURPOSE;
}

function eip712domain_separator() external view returns (bytes32) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
return $.m_eip712DomainSeparator;
}
}
48 changes: 48 additions & 0 deletions contracts/interfaces/IexecPocoAccessors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ pragma solidity ^0.8.0;

import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol";
import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol";
import {IRegistry} from "../libs/PocoStorageLib.v8.sol";

interface IexecPocoAccessors {
// ========= Deal and Task Accessors =========
function viewDeal(bytes32 id) external view returns (IexecLibCore_v5.Deal memory);

function viewTask(bytes32 id) external view returns (IexecLibCore_v5.Task memory);
Expand All @@ -17,4 +19,50 @@ interface IexecPocoAccessors {
IexecLibOrders_v5.WorkerpoolOrder calldata workerpoolOrder,
IexecLibOrders_v5.RequestOrder calldata requestOrder
) external view returns (uint256);

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

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

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

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

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

// ========= SRLC Token and Account Accessors =========
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function frozenOf(address account) external view returns (uint256);
function allowance(address account, address spender) external view returns (uint256);
function viewAccount(address account) external view returns (IexecLibCore_v5.Account memory);
function token() external view returns (address);

// ========= Category Accessors =========
function viewCategory(uint256 _catid) external view returns (IexecLibCore_v5.Category memory);
function countCategory() external view returns (uint256);

// ========= Registry Accessors =========
function appregistry() external view returns (IRegistry);
function datasetregistry() external view returns (IRegistry);
function workerpoolregistry() external view returns (IRegistry);
function teebroker() external view returns (address);
function callbackgas() external view returns (uint256);

// ========= Constants Accessors =========
function contribution_deadline_ratio() external view returns (uint256);
function reveal_deadline_ratio() external view returns (uint256);
function final_deadline_ratio() external view returns (uint256);
function workerpool_stake_ratio() external view returns (uint256);
function kitty_ratio() external view returns (uint256);
function kitty_min() external view returns (uint256);
function kitty_address() external view returns (address);
function groupmember_purpose() external view returns (uint256);
function eip712domain_separator() external view returns (bytes32);
}
2 changes: 0 additions & 2 deletions deploy/0_deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
DiamondLoupeFacet__factory,
Diamond__factory,
IexecAccessorsABILegacyFacet__factory,
IexecAccessorsFacet__factory,
IexecAccessors__factory,
IexecCategoryManagerFacet__factory,
IexecCategoryManager__factory,
Expand Down Expand Up @@ -93,7 +92,6 @@ export default async function deploy() {
const isArbitrumMainnet = (await ethers.provider.getNetwork()).chainId === 42161n;
const facets = [
new IexecAccessorsABILegacyFacet__factory(),
new IexecAccessorsFacet__factory(),
new IexecCategoryManagerFacet__factory(),
new IexecConfigurationExtraFacet__factory(),
new IexecConfigurationFacet__factory(iexecLibOrders),
Expand Down
12 changes: 12 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const isNativeChainType = chainConfig.isNativeChain();
const isLocalFork = process.env.LOCAL_FORK == 'true';
const isFujiFork = process.env.FUJI_FORK == 'true';
const isArbitrumSepoliaFork = process.env.ARBITRUM_SEPOLIA_FORK == 'true';
const isArbitrumFork = process.env.ARBITRUM_FORK == 'true';
const bellecourBlockscoutUrl = 'https://blockscout.bellecour.iex.ec';

/**
Expand Down Expand Up @@ -119,6 +120,13 @@ const config: HardhatUserConfig = {
},
...arbitrumSepoliaBaseConfig,
}),

...(isArbitrumFork && {
forking: {
url: process.env.ARBITRUM_RPC_URL || 'https://arbitrum.gateway.tenderly.co',
},
...arbitrumBaseConfig,
}),
},
'external-hardhat': {
...defaultHardhatNetworkParams,
Expand All @@ -139,6 +147,10 @@ const config: HardhatUserConfig = {
accounts: 'remote', // Override defaults accounts for impersonation
...arbitrumSepoliaBaseConfig,
}),
...(isArbitrumFork && {
accounts: 'remote', // Override defaults accounts for impersonation
...arbitrumBaseConfig,
}),
},
'dev-native': {
chainId: 65535,
Expand Down
Loading