Skip to content

Commit 06f0be3

Browse files
committed
Merge branch 'develop' into feature/deployment-ci
2 parents 0100b06 + 1d2c8f7 commit 06f0be3

File tree

181 files changed

+4978
-5939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+4978
-5939
lines changed

.env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
DEPLOYER_PRIVATE_KEY=
33
EXPLORER_API_KEY=
44
IS_VERIFICATION_API_V2=
5+
ARBISCAN_API_KEY=
56

67
# Local development
78
FUJI_RPC_URL=

.github/workflows/main.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
on:
2-
push:
3-
branches:
4-
- feature/*
5-
- bugfix/*
6-
- develop
7-
- release/*
8-
- hotfix/*
9-
- main
10-
- v5
2+
pull_request:
113
workflow_call:
124

135
concurrency:
@@ -53,7 +45,7 @@ jobs:
5345
- name: Run static analysis with Slither
5446
uses: crytic/[email protected]
5547
with:
56-
target: "contracts/tools/testing/slither/"
48+
target: 'contracts/tools/testing/slither/'
5749
solc-version: '0.8.21'
5850
slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/
5951
fail-on: none # TODO set this to high or other

.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
artifacts/
3+
audit/
4+
build/
5+
cache/
6+
coverage/
7+
coverage.json
8+
deployments/
9+
node_modules/
10+
typechain/

.solcover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
'tools/testing/ERC1271Mock.sol',
2222
'tools/testing/TestClient.sol',
2323
'tools/testing/TestReceiver.sol',
24-
'modules/delegates/SignatureVerifier.sol',
24+
'facets/SignatureVerifier.sol',
2525
],
2626
istanbulFolder: BASE_FOLDER,
2727
};

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,33 @@
22

33
## vNEXT
44

5+
- 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)
10+
- Fix script folder (#235)
11+
- Format all solidity files (#233)
12+
- Rename ERC1538 architure to diamond Proxy architecture(#226, #229, #230, #234)
13+
- Remove ENS module (#225)
14+
- Add Diamond contract unit tests (#224)
15+
- Fix `fallback` and `receive` (#223)
16+
- Migrate contracts (#222)
17+
518
- Add Github Action CI in order to publish NPM package
619

720
### Updated contracts
821

922
- [x] `IexecPoco2Delegate.sol`
1023

1124
### Features
25+
<!-- TODO update this with v5.5.1 release notes -->
1226
- Add gitub action workflow for deployment (#218)
1327
- Fix new testnets chain name (#217)
1428
- Deploy on new testnet chains using CreateX factory (#216)
1529
- Add CreateX factory for new chain deployment (#215)
1630
- Support Arbitrum & Avalanche Fuji testnets (#215)
17-
- Housekeeping (#207, )
31+
- Housekeeping (#208)
1832
- Add Halborn "Poco v5.5 & Voucher v1.0" audit report (#205)
1933
- Refactor Factory deployer (#206)
2034
- Enable native tests on CI (#204)

config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"v5": {
176176
"factory": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
177177
"factoryType": "createx",
178-
"ERC1538Proxy": "0x13F6853E08B151ea5e1b4E4001f55071be5A96Ae",
178+
"DiamondProxy": "0x14B465079537655E1662F012e99EBa3863c8B9E0",
179179
"salt": "0x00000000244df0848122154315af71fe140f3db0fe014031783b094600000000"
180180
}
181181
},

contracts/Diamond.sol

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
pragma solidity ^0.8.0;
5+
6+
//*************************************************************************************\
7+
//* Adapted from Nick Mudge <[email protected]> (https://twitter.com/mudgen)
8+
//* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
9+
//*
10+
//* Implementation of a diamond.
11+
//*************************************************************************************/
12+
13+
// Diamond proxy implementation adapted from Mudgen's to redirect
14+
// `receive` and `fallback` calls to the implementations in facets.
15+
// See diff at: https://github.com/iExecBlockchainComputing/PoCo/pull/223/commits/0562f982
16+
17+
import {LibDiamond} from "@mudgen/diamond-1/contracts/libraries/LibDiamond.sol";
18+
import {IDiamondCut} from "@mudgen/diamond-1/contracts/interfaces/IDiamondCut.sol";
19+
import {IDiamondLoupe} from "@mudgen/diamond-1/contracts/interfaces/IDiamondLoupe.sol";
20+
import {IERC173} from "@mudgen/diamond-1/contracts/interfaces/IERC173.sol";
21+
import {IERC165} from "@mudgen/diamond-1/contracts/interfaces/IERC165.sol";
22+
23+
// When no function exists for function called
24+
error FunctionNotFound(bytes4 _functionSelector);
25+
26+
// This is used in diamond constructor
27+
// more arguments are added to this struct
28+
// this avoids stack too deep errors
29+
struct DiamondArgs {
30+
address owner;
31+
address init;
32+
bytes initCalldata;
33+
}
34+
35+
contract Diamond {
36+
constructor(IDiamondCut.FacetCut[] memory _diamondCut, DiamondArgs memory _args) payable {
37+
LibDiamond.setContractOwner(_args.owner);
38+
LibDiamond.diamondCut(_diamondCut, _args.init, _args.initCalldata);
39+
40+
// Code can be added here to perform actions and set state variables.
41+
}
42+
43+
/**
44+
* `fallback` function must be added to the diamond with selector `0xffffffff`.
45+
* The function is defined in IexecEscrow(Native/Token) facet.
46+
*/
47+
fallback() external payable {
48+
_fallback();
49+
}
50+
51+
/**
52+
* `receive` function must be added to the diamond with selector `0x00000000`.
53+
* The function is defined in IexecEscrow(Native/Token) facet.
54+
*/
55+
receive() external payable {
56+
_fallback();
57+
}
58+
59+
// Find facet for function that is called and execute the
60+
// function if a facet is found and return any value.
61+
function _fallback() internal {
62+
LibDiamond.DiamondStorage storage ds;
63+
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
64+
// get diamond storage
65+
assembly {
66+
ds.slot := position
67+
}
68+
// get facet from function selector
69+
address facet = ds.facetAddressAndSelectorPosition[msg.sig].facetAddress;
70+
if (facet == address(0)) {
71+
facet = ds.facetAddressAndSelectorPosition[0xffffffff].facetAddress;
72+
}
73+
if (facet == address(0)) {
74+
revert FunctionNotFound(msg.sig);
75+
}
76+
// Execute external function from facet using delegatecall and return any value.
77+
assembly {
78+
// copy function selector and any arguments
79+
calldatacopy(0, 0, calldatasize())
80+
// execute function call using the facet
81+
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
82+
// get any return value
83+
returndatacopy(0, 0, returndatasize())
84+
// return any return value or error back to the caller
85+
switch result
86+
case 0 {
87+
revert(0, returndatasize())
88+
}
89+
default {
90+
return(0, returndatasize())
91+
}
92+
}
93+
}
94+
}

contracts/IexecInterfaceNative.sol

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,37 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
12
// SPDX-License-Identifier: Apache-2.0
23

3-
/******************************************************************************
4-
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
5-
* *
6-
* Licensed under the Apache License, Version 2.0 (the "License"); *
7-
* you may not use this file except in compliance with the License. *
8-
* You may obtain a copy of the License at *
9-
* *
10-
* http://www.apache.org/licenses/LICENSE-2.0 *
11-
* *
12-
* Unless required by applicable law or agreed to in writing, software *
13-
* distributed under the License is distributed on an "AS IS" BASIS, *
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15-
* See the License for the specific language governing permissions and *
16-
* limitations under the License. *
17-
******************************************************************************/
18-
194
pragma solidity ^0.6.0;
205
pragma experimental ABIEncoderV2;
216

22-
import "./modules/interfaces/IOwnable.sol";
23-
import "./modules/interfaces/IexecAccessors.sol";
24-
import "./modules/interfaces/IexecCategoryManager.sol";
25-
import "./modules/interfaces/IexecERC20.sol";
26-
import "./modules/interfaces/IexecEscrowNative.sol";
27-
import "./modules/interfaces/IexecMaintenance.sol";
28-
import "./modules/interfaces/IexecOrderManagement.sol";
29-
import "./modules/interfaces/IexecPoco1.sol";
30-
import "./modules/interfaces/IexecPoco2.sol";
31-
import "./modules/interfaces/IexecRelay.sol";
32-
import "./modules/interfaces/IexecTokenSpender.sol";
33-
import "./modules/interfaces/ENSIntegration.sol";
34-
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";
3518

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+
*/
3625
interface IexecInterfaceNative is
37-
IOwnable,
38-
IexecAccessors,
39-
IexecCategoryManager,
40-
IexecERC20,
41-
IexecEscrowNative,
42-
IexecMaintenance,
43-
IexecOrderManagement,
44-
IexecPoco1,
45-
IexecPoco2,
46-
IexecRelay,
47-
IexecTokenSpender,
48-
ENSIntegration
49-
{
50-
}
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: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,36 @@
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
12
// SPDX-License-Identifier: Apache-2.0
23

3-
/******************************************************************************
4-
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
5-
* *
6-
* Licensed under the Apache License, Version 2.0 (the "License"); *
7-
* you may not use this file except in compliance with the License. *
8-
* You may obtain a copy of the License at *
9-
* *
10-
* http://www.apache.org/licenses/LICENSE-2.0 *
11-
* *
12-
* Unless required by applicable law or agreed to in writing, software *
13-
* distributed under the License is distributed on an "AS IS" BASIS, *
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15-
* See the License for the specific language governing permissions and *
16-
* limitations under the License. *
17-
******************************************************************************/
18-
194
pragma solidity ^0.6.0;
205
pragma experimental ABIEncoderV2;
216

22-
import "./modules/interfaces/IOwnable.sol";
23-
import "./modules/interfaces/IexecAccessors.sol";
24-
import "./modules/interfaces/IexecAccessorsABILegacy.sol";
25-
import "./modules/interfaces/IexecCategoryManager.sol";
26-
import "./modules/interfaces/IexecERC20.sol";
27-
import "./modules/interfaces/IexecEscrowNative.sol";
28-
import "./modules/interfaces/IexecMaintenance.sol";
29-
import "./modules/interfaces/IexecOrderManagement.sol";
30-
import "./modules/interfaces/IexecPoco1.sol";
31-
import "./modules/interfaces/IexecPoco2.sol";
32-
import "./modules/interfaces/IexecRelay.sol";
33-
import "./modules/interfaces/IexecTokenSpender.sol";
34-
import "./modules/interfaces/ENSIntegration.sol";
35-
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";
3619

20+
/**
21+
* TODO: Remove this interface in the future when IexecInterfaceTokenABILegacy is removed.
22+
*/
3723
interface IexecInterfaceNativeABILegacy is
38-
IOwnable,
39-
IexecAccessors,
40-
IexecAccessorsABILegacy,
41-
IexecCategoryManager,
42-
IexecERC20,
43-
IexecEscrowNative,
44-
IexecMaintenance,
45-
IexecOrderManagement,
46-
IexecPoco1,
47-
IexecPoco2,
48-
IexecRelay,
49-
IexecTokenSpender,
50-
ENSIntegration
51-
{
52-
}
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+
{}

0 commit comments

Comments
 (0)