Skip to content

Commit 3b43823

Browse files
authored
feat: Restore compatibility with iExec SDK. (#240)
2 parents b173aef + f2a3211 commit 3b43823

30 files changed

+376
-257
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## vNEXT
44

55
- Migrate proxy to Diamond pattern (ERC-2535):
6+
- Restore compatibility with iExec SDK. (#240)
7+
- Target latest EVM version (#239)
8+
- Adapt contracts file tree (#238)
9+
- Use namespaced storage (#236, #237)
610
- Format all solidity files (#233)
711
- Rename ERC1538 architure to diamond Proxy architecture(#226, #229, #230, #234)
812
- Remove ENS module (#225)

contracts/IexecInterfaceNative.sol

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
pragma solidity ^0.6.0;
5+
pragma experimental ABIEncoderV2;
6+
7+
import "./interfaces/IOwnable.sol";
8+
import "./interfaces/IexecAccessors.sol";
9+
import "./interfaces/IexecCategoryManager.sol";
10+
import "./interfaces/IexecERC20.sol";
11+
import "./interfaces/IexecEscrowNative.sol";
12+
import "./interfaces/IexecConfiguration.sol";
13+
import "./interfaces/IexecOrderManagement.sol";
14+
import "./interfaces/IexecPoco1.sol";
15+
import "./interfaces/IexecPoco2.sol";
16+
import "./interfaces/IexecRelay.sol";
17+
import "./interfaces/IexecTokenSpender.sol";
18+
19+
/**
20+
* A global interface that aggregates all the interfaces needed to interact with
21+
* the PoCo contracts in native mode.
22+
* @dev Referenced in the SDK with the current path `contracts/IexecInterfaceNative.sol`.
23+
* Changing the name or the path would cause a breaking change in the SDK.
24+
*/
25+
interface IexecInterfaceNative is
26+
IOwnable,
27+
IexecAccessors,
28+
IexecCategoryManager,
29+
IexecERC20,
30+
IexecEscrowNative,
31+
IexecConfiguration,
32+
IexecOrderManagement,
33+
IexecPoco1,
34+
IexecPoco2,
35+
IexecRelay,
36+
IexecTokenSpender
37+
{}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
pragma solidity ^0.6.0;
5+
pragma experimental ABIEncoderV2;
6+
7+
import "./interfaces/IOwnable.sol";
8+
import "./interfaces/IexecAccessors.sol";
9+
import "./interfaces/IexecAccessorsABILegacy.sol";
10+
import "./interfaces/IexecCategoryManager.sol";
11+
import "./interfaces/IexecERC20.sol";
12+
import "./interfaces/IexecEscrowNative.sol";
13+
import "./interfaces/IexecConfiguration.sol";
14+
import "./interfaces/IexecOrderManagement.sol";
15+
import "./interfaces/IexecPoco1.sol";
16+
import "./interfaces/IexecPoco2.sol";
17+
import "./interfaces/IexecRelay.sol";
18+
import "./interfaces/IexecTokenSpender.sol";
19+
20+
/**
21+
* TODO: Remove this interface in the future when IexecInterfaceTokenABILegacy is removed.
22+
*/
23+
interface IexecInterfaceNativeABILegacy is
24+
IOwnable,
25+
IexecAccessors,
26+
IexecAccessorsABILegacy,
27+
IexecCategoryManager,
28+
IexecERC20,
29+
IexecEscrowNative,
30+
IexecConfiguration,
31+
IexecOrderManagement,
32+
IexecPoco1,
33+
IexecPoco2,
34+
IexecRelay,
35+
IexecTokenSpender
36+
{}

contracts/IexecInterfaceToken.sol

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
pragma solidity ^0.6.0;
5+
pragma experimental ABIEncoderV2;
6+
7+
import "./interfaces/IOwnable.sol";
8+
import "./interfaces/IexecAccessors.sol";
9+
import "./interfaces/IexecCategoryManager.sol";
10+
import "./interfaces/IexecERC20.sol";
11+
import "./interfaces/IexecEscrowToken.sol";
12+
import "./interfaces/IexecEscrowTokenSwap.sol";
13+
import "./interfaces/IexecConfiguration.sol";
14+
import "./interfaces/IexecOrderManagement.sol";
15+
import "./interfaces/IexecPoco1.sol";
16+
import "./interfaces/IexecPoco2.sol";
17+
import "./interfaces/IexecRelay.sol";
18+
import "./interfaces/IexecTokenSpender.sol";
19+
20+
/**
21+
* A global interface that aggregates all the interfaces needed to interact with
22+
* the PoCo contracts in token mode.
23+
* @dev Referenced in the SDK with the current path `contracts/IexecInterfaceToken.sol`.
24+
* Changing the name or the path would cause a breaking change in the SDK.
25+
*/
26+
interface IexecInterfaceToken is
27+
IOwnable,
28+
IexecAccessors,
29+
IexecCategoryManager,
30+
IexecERC20,
31+
IexecEscrowToken,
32+
IexecEscrowTokenSwap,
33+
IexecConfiguration,
34+
IexecOrderManagement,
35+
IexecPoco1,
36+
IexecPoco2,
37+
IexecRelay,
38+
IexecTokenSpender
39+
{
40+
receive() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
41+
fallback() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
pragma solidity ^0.6.0;
5+
pragma experimental ABIEncoderV2;
6+
7+
import "./interfaces/IOwnable.sol";
8+
import "./interfaces/IexecAccessors.sol";
9+
import "./interfaces/IexecAccessorsABILegacy.sol";
10+
import "./interfaces/IexecCategoryManager.sol";
11+
import "./interfaces/IexecERC20.sol";
12+
import "./interfaces/IexecEscrowToken.sol";
13+
import "./interfaces/IexecEscrowTokenSwap.sol";
14+
import "./interfaces/IexecConfiguration.sol";
15+
import "./interfaces/IexecOrderManagement.sol";
16+
import "./interfaces/IexecPoco1.sol";
17+
import "./interfaces/IexecPoco2.sol";
18+
import "./interfaces/IexecRelay.sol";
19+
import "./interfaces/IexecTokenSpender.sol";
20+
21+
/**
22+
* TODO: Remove this interface in the future.
23+
* Currently Used in the middleware:
24+
* https://github.com/iExecBlockchainComputing/iexec-commons-poco/blob/819cd008/generateContractWrappers#L7
25+
*/
26+
interface IexecInterfaceTokenABILegacy is
27+
IOwnable,
28+
IexecAccessors,
29+
IexecAccessorsABILegacy,
30+
IexecCategoryManager,
31+
IexecERC20,
32+
IexecEscrowToken,
33+
IexecEscrowTokenSwap,
34+
IexecConfiguration,
35+
IexecOrderManagement,
36+
IexecPoco1,
37+
IexecPoco2,
38+
IexecRelay,
39+
IexecTokenSpender
40+
{
41+
receive() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
42+
fallback() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
43+
}

contracts/Store.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,28 @@ abstract contract Store {
6161
// In order to use the protocol, users have to deposit RLC
6262
// and allow PoCo smart contracts to manage them. This state
6363
// variable keeps track of users balances.
64-
mapping(address => uint256) m_balances;
64+
mapping(address /* account */ => uint256 /* amount */) m_balances;
6565
// When a deal is created, the protocol temporarily locks an amount
6666
// of RLC tokens from the balances of both the requester and the workerpool owners.
6767
// This is to guarantee the payment of different actors later. Frozen funds
6868
// are released when the computation is completed and the result is pushed.
69-
mapping(address => uint256) m_frozens;
70-
mapping(address => mapping(address => uint256)) m_allowances;
69+
mapping(address /* account */ => uint256 /* amount */) m_frozens;
70+
mapping(address /* owner */ => mapping(address /* spender */ => uint256 /* amount */)) m_allowances;
7171
// EIP-712 domain hash.
7272
// Modified in IexecConfigurationFacet.updateDomainSeparator
7373
bytes32 m_eip712DomainSeparator;
7474
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
7575
// with a private key, it adds an entry to this mapping to provide presigned orders.
76-
mapping(bytes32 => address) m_presigned;
76+
mapping(bytes32 /* orderHash */ => address /* owner */) m_presigned;
7777
// Each order has a volume (>=1). This tracks how much is consumed from
7878
// the volume of each order. Mapping an order hash to its consumed amount.
79-
mapping(bytes32 => uint256) m_consumed;
79+
mapping(bytes32 /* orderHash */ => uint256 /* consumedAmount */) m_consumed;
8080
// a mapping to store PoCo classic deals.
81-
mapping(bytes32 => IexecLibCore_v5.Deal) m_deals;
82-
mapping(bytes32 => IexecLibCore_v5.Task) m_tasks; // per task
83-
mapping(bytes32 => IexecLibCore_v5.Consensus) m_consensus; // per task
84-
mapping(bytes32 => mapping(address => IexecLibCore_v5.Contribution)) m_contributions; // per task-worker
85-
mapping(address => uint256) m_workerScores; // per worker
81+
mapping(bytes32 /* dealId */ => IexecLibCore_v5.Deal) m_deals;
82+
mapping(bytes32 /* taskId */ => IexecLibCore_v5.Task) m_tasks;
83+
mapping(bytes32 /* taskId */ => IexecLibCore_v5.Consensus) m_consensus;
84+
mapping(bytes32 /* taskId */ => mapping(address /* worker */ => IexecLibCore_v5.Contribution)) m_contributions;
85+
mapping(address /* worker */ => uint256 /* score */) m_workerScores;
8686
// Poco - Settings
8787
// Address of a trusted TEE authority that manages enclave challenges.
8888
// Modified in IexecConfigurationFacet.setTeeBroker
@@ -95,7 +95,7 @@ abstract contract Store {
9595
// Backward compatibility
9696
// Modified in IexecConfigurationFacet.configure
9797
IexecHubInterface m_v3_iexecHub;
98-
mapping(address => bool) m_v3_scoreImported;
98+
mapping(address /* worker */ => bool) m_v3_scoreImported;
9999
}
100100

101101
function getPocoStorage() internal pure returns (PocoStorage storage $) {

contracts/Store.v8.sol

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,28 @@ abstract contract Store {
5555
// In order to use the protocol, users have to deposit RLC
5656
// and allow PoCo smart contracts to manage them. This state
5757
// variable keeps track of users balances.
58-
mapping(address => uint256) m_balances;
58+
mapping(address /* account */ => uint256 /* amount */) m_balances;
5959
// When a deal is created, the protocol temporarily locks an amount
6060
// of RLC tokens from the balances of both the requester and the workerpool owners.
6161
// This is to guarantee the payment of different actors later. Frozen funds
6262
// are released when the computation is completed and the result is pushed.
63-
mapping(address => uint256) m_frozens;
64-
mapping(address => mapping(address => uint256)) m_allowances;
63+
mapping(address /* account */ => uint256 /* amount */) m_frozens;
64+
mapping(address /* owner */ => mapping(address /* spender */ => uint256 /* amount */)) m_allowances;
6565
// EIP-712 domain hash.
6666
// Modified in IexecConfigurationFacet.updateDomainSeparator
6767
bytes32 m_eip712DomainSeparator;
6868
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
6969
// with a private key, it adds an entry to this mapping to provide presigned orders.
70-
mapping(bytes32 => address) m_presigned;
70+
mapping(bytes32 /* orderHash */ => address /* owner */) m_presigned;
7171
// Each order has a volume (>=1). This tracks how much is consumed from
7272
// the volume of each order. Mapping an order hash to its consumed amount.
73-
mapping(bytes32 => uint256) m_consumed;
73+
mapping(bytes32 /* orderHash */ => uint256 /* consumedAmount */) m_consumed;
7474
// a mapping to store PoCo classic deals.
75-
mapping(bytes32 => IexecLibCore_v5.Deal) m_deals;
76-
mapping(bytes32 => IexecLibCore_v5.Task) m_tasks; // per task
77-
mapping(bytes32 => IexecLibCore_v5.Consensus) m_consensus; // per task
78-
mapping(bytes32 => mapping(address => IexecLibCore_v5.Contribution)) m_contributions; // per task-worker
79-
mapping(address => uint256) m_workerScores; // per worker
75+
mapping(bytes32 /* dealId */ => IexecLibCore_v5.Deal) m_deals;
76+
mapping(bytes32 /* taskId */ => IexecLibCore_v5.Task) m_tasks;
77+
mapping(bytes32 /* taskId */ => IexecLibCore_v5.Consensus) m_consensus;
78+
mapping(bytes32 /* taskId */ => mapping(address /* worker */ => IexecLibCore_v5.Contribution)) m_contributions;
79+
mapping(address /* worker */ => uint256 /* score */) m_workerScores;
8080
// Poco - Settings
8181
// Address of a trusted TEE authority that manages enclave challenges.
8282
// Modified in IexecConfigurationFacet.setTeeBroker
@@ -89,10 +89,10 @@ abstract contract Store {
8989
// Backward compatibility
9090
// Modified in IexecConfigurationFacet.configure
9191
address m_v3_iexecHub; // IexecHubInterface
92-
mapping(address => bool) m_v3_scoreImported;
92+
mapping(address /* worker */ => bool) m_v3_scoreImported;
9393
// /!\ New storage variables not present in v6 store.
9494
// A mapping to store PoCo Boost deals.
95-
mapping(bytes32 => IexecLibCore_v5.DealBoost) m_dealsBoost;
95+
mapping(bytes32 /* dealId */ => IexecLibCore_v5.DealBoost) m_dealsBoost;
9696
}
9797

9898
function getPocoStorage() internal pure returns (PocoStorage storage $) {

contracts/interfaces/IexecAccessorsABILegacy.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ pragma experimental ABIEncoderV2;
66

77
import "../libs/IexecLibCore_v5.sol";
88

9+
/**
10+
* TODO: Remove this interface in the future.
11+
* Currently Used in the middleware:
12+
* https://github.com/iExecBlockchainComputing/iexec-commons-poco/blob/819cd008/src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java#L265
13+
*/
914
interface IexecAccessorsABILegacy {
1015
function viewAccountABILegacy(address _user) external view returns (uint256, uint256);
1116

contracts/interfaces/IexecInterfaceNative.sol

Lines changed: 0 additions & 31 deletions
This file was deleted.

contracts/interfaces/IexecInterfaceNativeABILegacy.sol

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)