Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
806d2a8
Remove non valid TODOs
zguesmi Jul 21, 2025
3ca0ff7
Install diamond contracts
zguesmi Jul 21, 2025
1d21f59
Generate typechains for diamond contractsd
zguesmi Jul 21, 2025
c8059a0
Target default evm version (shanghai)
zguesmi Jul 21, 2025
c1f2311
Make deployment work
zguesmi Jul 22, 2025
d67fdda
Add coments
zguesmi Jul 22, 2025
885cbae
Cleazn
zguesmi Jul 22, 2025
86ed12a
Commit old deployment logs
zguesmi Jul 22, 2025
a6d2970
Merge branch 'feature/diamond' into feature/diamond-migration-src
zguesmi Jul 22, 2025
4e6d5a5
Add deployment logs
zguesmi Jul 22, 2025
d883375
Update logs
zguesmi Jul 22, 2025
b4eb54f
Refactor proxy script
zguesmi Jul 23, 2025
c6ae31d
Fix tests
zguesmi Jul 23, 2025
f09046c
Add coments
zguesmi Jul 23, 2025
7149902
Add fallback and receive to proxy
zguesmi Jul 23, 2025
aa988a7
Clean
zguesmi Jul 23, 2025
0dcc70c
Cleazn
zguesmi Jul 23, 2025
364a071
Remove init() filter
zguesmi Jul 23, 2025
d622401
Remove DimaondInit from facets
zguesmi Jul 23, 2025
f4064a8
Fix tests
zguesmi Jul 23, 2025
ba006f7
Cleazn
zguesmi Jul 23, 2025
cd1ef4d
Update changelog
zguesmi Jul 23, 2025
652669d
Clean deploy file
zguesmi Jul 23, 2025
9a75aa6
Fix diff
zguesmi Jul 23, 2025
4c74150
Fix coverage task
zguesmi Jul 23, 2025
9e296bd
Clean
zguesmi Jul 23, 2025
dcd1030
Deploy on Arbitrum sepolia
zguesmi Jul 23, 2025
9b05d83
Add .env template
zguesmi Jul 23, 2025
a84ce1e
Copy Diamond contract source code
zguesmi Jul 24, 2025
0607c5b
Remove diamond from dependency compiler config
zguesmi Jul 24, 2025
625798d
Fix test
zguesmi Jul 24, 2025
0562f98
Adapt Diamond contract
zguesmi Jul 24, 2025
368c297
Clean poxy scripts
zguesmi Jul 24, 2025
fe356a3
Migrate contracts to Diamond pattern - Part1 (#222)
zguesmi Jul 24, 2025
d378b89
Merge branch 'feature/diamond' into feature/diamond-migration-part2
zguesmi Jul 24, 2025
673c789
Remove deployment file
zguesmi Jul 24, 2025
afd3bf8
Update changelog
zguesmi Jul 24, 2025
940478e
Add comment
zguesmi Jul 24, 2025
3ccfc47
Fix fallback and receive functions in Diamond contract (#223)
zguesmi Jul 24, 2025
5a261ed
Update diamond contract license
zguesmi Jul 24, 2025
7c8972a
Remove unused contract
zguesmi Jul 24, 2025
9f2c309
Add Diamond unit tests
zguesmi Jul 24, 2025
4894ead
Update changelog
zguesmi Jul 24, 2025
f81399f
Merge branch 'feature/diamond' into feature/diamond-migration-part3-d…
zguesmi Jul 24, 2025
0152a1d
Fix coverage task
zguesmi Jul 24, 2025
4446222
Add revert test
zguesmi Jul 24, 2025
6d07510
Fix copyright headers
zguesmi Jul 25, 2025
f82d8cf
Add Diamond contract unit tests (#224)
zguesmi Jul 25, 2025
1da7dd1
feat: Remove ENS modules and related files/dep from the project (#225)
Le-Caignec Jul 25, 2025
287cc9c
refactor:format contracts (#227)
Le-Caignec Jul 25, 2025
c83fed7
feat: replace erc1538 naming to diamond proxy naming - part 1 (#229)
gfournieriExec Jul 25, 2025
b6a5a16
feat: replace erc1538 naming to diamond proxy naming - part 2 (#230)
gfournieriExec Jul 25, 2025
f7f791c
Update copyright headers
zguesmi Jul 25, 2025
4eab903
Format all solidity files
zguesmi Jul 25, 2025
8988fd0
Update changelog
zguesmi Jul 25, 2025
5544abf
Format all solidity files (#233)
zguesmi Jul 25, 2025
59f7eaa
feat: rename-part-3 (#234)
Le-Caignec Jul 25, 2025
1a547e7
feat: refactor upgrade-helper to use DiamondCut for module updates
Le-Caignec Jul 25, 2025
ecd4a36
Use erc7201 storage pattern
zguesmi Jul 25, 2025
c69de7d
feat: update workflow to trigger only on pull requests
Le-Caignec Jul 25, 2025
64bfac3
feat: update changelog and refactor encodeModuleProxyUpdate function …
Le-Caignec Jul 25, 2025
b75885d
Update storage variables references
zguesmi Jul 25, 2025
c49b4c1
Unify make v6 and v8 store contract code as similar as possible
zguesmi Jul 26, 2025
8d9f564
Format
zguesmi Jul 26, 2025
27a6d0a
Use same format everywhere
zguesmi Jul 26, 2025
b1c3c62
Clean
zguesmi Jul 26, 2025
b875702
Fix compilation
zguesmi Jul 26, 2025
69d873d
Fix tests
zguesmi Jul 26, 2025
cf87ba8
chore: Add prettierignore file
zguesmi Jul 26, 2025
a9ece58
Fix format function
zguesmi Jul 26, 2025
aaf7224
chore: Do some cleaning
zguesmi Jul 26, 2025
dda7229
Move interfaces forlder to the root
zguesmi Jul 26, 2025
ec9a929
Move FaceBase inside facets/
zguesmi Jul 26, 2025
d0c3eee
refactor: Move facets to rool folder
zguesmi Jul 26, 2025
f11adcd
Refactor: Update tests and config
zguesmi Jul 26, 2025
b2a7c9c
refactor: update occurences
zguesmi Jul 26, 2025
8c53199
refactor: Update occurences
zguesmi Jul 26, 2025
11db51a
refactor: Rename variable
zguesmi Jul 26, 2025
9cd64d6
feat: Target latest EVM version
zguesmi Jul 26, 2025
ec43dde
Add comments to store mappings
zguesmi Jul 28, 2025
1e89ce3
feat: Use namespaced storage (#236)
zguesmi Jul 28, 2025
72ab9d8
Merge branch 'feature/diamond' into feature/namespaced-storage-fix-build
zguesmi Jul 28, 2025
be12cd4
Update changelog
zguesmi Jul 28, 2025
efa1d22
fix: Fix build with new storage layout (#237)
zguesmi Jul 28, 2025
4741469
Merge branch 'feature/diamond' into feature/contracts-file-tree
zguesmi Jul 28, 2025
fe198f0
Add EOF line
zguesmi Jul 28, 2025
08d616d
feat: refactor addModulesToProxy to use new factory classes and valid…
Le-Caignec Jul 28, 2025
dffdcc1
refactor: Adapt contracts file tree (#238)
zguesmi Jul 28, 2025
68194cf
Restore retrocompatibility with iexec-sdk
zguesmi Jul 28, 2025
e1d26e7
Merge branch 'feature/diamond' into feature/evm-version
zguesmi Jul 28, 2025
4bbbb30
Merge branch 'feature/evm-version' into feature/pr-reviews
zguesmi Jul 28, 2025
13a462a
Add TODOs
zguesmi Jul 28, 2025
fdc739a
Add TODO
zguesmi Jul 28, 2025
01471a6
Add tests
zguesmi Jul 28, 2025
27baacb
Force evm version to shanghai
zguesmi Jul 28, 2025
b173aef
feat: Target latest EVM version (#239)
zguesmi Jul 28, 2025
1a0e5e1
Revert "Force evm version to shanghai"
zguesmi Jul 28, 2025
fb28761
Apply reviews
zguesmi Jul 28, 2025
d867adf
Merge branch 'feature/diamond' into feature/pr-reviews
zguesmi Jul 28, 2025
02ad77f
Use utility function everywhere
zguesmi Jul 28, 2025
f2a3211
Comment parameter names to save a little gas
zguesmi Jul 28, 2025
3b43823
feat: Restore compatibility with iExec SDK. (#240)
zguesmi Jul 28, 2025
7c758c9
Merge branch 'feature/diamond' into fix/fix-uprade-helper-script
zguesmi Jul 28, 2025
b4963d2
feat: refactor upgrade-helper to use DiamondCut for module updates (#…
zguesmi Jul 28, 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
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PRIVATE_KEY=
ARBISCAN_API_KEY=
2 changes: 1 addition & 1 deletion .github/workflows/deploy-smart-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
echo "Deploying to: ${{ inputs.network }} with ${{ inputs.environment }} environment"
npm run deploy -- --network ${{ inputs.network }}

- name: Update config.json with ERC1538Proxy address
- name: Update config.json with Diamond proxy address
if: inputs.network != 'hardhat'
run: npx hardhat run scripts/tools/update-config.ts --network ${{ inputs.network }}

Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
on:
push:
branches:
- feature/*
- bugfix/*
- develop
- release/*
- hotfix/*
- main
- v5
pull_request:

jobs:
# Note: changing the name of the job disables Slither checks with the error:
Expand Down Expand Up @@ -48,7 +40,7 @@ jobs:
- name: Run static analysis with Slither
uses: crytic/slither-action@v0.4.0
with:
target: "contracts/tools/testing/slither/"
target: 'contracts/tools/testing/slither/'
solc-version: '0.8.21'
slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/
fail-on: none # TODO set this to high or other
Expand Down
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

artifacts/
audit/
build/
cache/
coverage/
coverage.json
deployments/
node_modules/
typechain/
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
'tools/testing/ERC1271Mock.sol',
'tools/testing/TestClient.sol',
'tools/testing/TestReceiver.sol',
'modules/delegates/SignatureVerifier.sol',
'facets/SignatureVerifier.sol',
],
istanbulFolder: BASE_FOLDER,
};
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@

## vNEXT

- Migrate proxy to Diamond pattern (ERC-2535):
- Restore compatibility with iExec SDK. (#240)
- Target latest EVM version (#239)
- Adapt contracts file tree (#238)
- Use namespaced storage (#236, #237)
- Fix script folder (#235)
- Format all solidity files (#233)
- Rename ERC1538 architure to diamond Proxy architecture(#226, #229, #230, #234)
- Remove ENS module (#225)
- Add Diamond contract unit tests (#224)
- Fix `fallback` and `receive` (#223)
- Migrate contracts (#222)

- Add Github Action CI in order to publish NPM package

### Updated contracts

- [x] `IexecPoco2Delegate.sol`

### Features
<!-- TODO update this with v5.5.1 release notes -->
- Add gitub action workflow for deployment (#218)
- Fix new testnets chain name (#217)
- Deploy on new testnet chains using CreateX factory (#216)
- Add CreateX factory for new chain deployment (#215)
- Support Arbitrum & Avalanche Fuji testnets (#215)
- Housekeeping (#207, )
- Housekeeping (#208)
- Add Halborn "Poco v5.5 & Voucher v1.0" audit report (#205)
- Refactor Factory deployer (#206)
- Enable native tests on CI (#204)
Expand Down
2 changes: 1 addition & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"v5": {
"factory": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"factoryType": "createx",
"ERC1538Proxy": "0x14B465079537655E1662F012e99EBa3863c8B9E0",
"DiamondProxy": "0x14B465079537655E1662F012e99EBa3863c8B9E0",
"salt": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
Expand Down
94 changes: 94 additions & 0 deletions contracts/Diamond.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.0;

//*************************************************************************************\
//* Adapted from Nick Mudge <nick@perfectabstractions.com> (https://twitter.com/mudgen)
//* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
//*
//* Implementation of a diamond.
//*************************************************************************************/

// Diamond proxy implementation adapted from Mudgen's to redirect
// `receive` and `fallback` calls to the implementations in facets.
// See diff at: https://github.com/iExecBlockchainComputing/PoCo/pull/223/commits/0562f982

import {LibDiamond} from "@mudgen/diamond-1/contracts/libraries/LibDiamond.sol";
import {IDiamondCut} from "@mudgen/diamond-1/contracts/interfaces/IDiamondCut.sol";
import {IDiamondLoupe} from "@mudgen/diamond-1/contracts/interfaces/IDiamondLoupe.sol";
import {IERC173} from "@mudgen/diamond-1/contracts/interfaces/IERC173.sol";
import {IERC165} from "@mudgen/diamond-1/contracts/interfaces/IERC165.sol";

// When no function exists for function called
error FunctionNotFound(bytes4 _functionSelector);

// This is used in diamond constructor
// more arguments are added to this struct
// this avoids stack too deep errors
struct DiamondArgs {
address owner;
address init;
bytes initCalldata;
}

contract Diamond {
constructor(IDiamondCut.FacetCut[] memory _diamondCut, DiamondArgs memory _args) payable {
LibDiamond.setContractOwner(_args.owner);
LibDiamond.diamondCut(_diamondCut, _args.init, _args.initCalldata);

// Code can be added here to perform actions and set state variables.
}

/**
* `fallback` function must be added to the diamond with selector `0xffffffff`.
* The function is defined in IexecEscrow(Native/Token) facet.
*/
fallback() external payable {
_fallback();
}

/**
* `receive` function must be added to the diamond with selector `0x00000000`.
* The function is defined in IexecEscrow(Native/Token) facet.
*/
receive() external payable {
_fallback();
}

// Find facet for function that is called and execute the
// function if a facet is found and return any value.
function _fallback() internal {
LibDiamond.DiamondStorage storage ds;
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
// get diamond storage
assembly {
ds.slot := position
}
// get facet from function selector
address facet = ds.facetAddressAndSelectorPosition[msg.sig].facetAddress;
if (facet == address(0)) {
facet = ds.facetAddressAndSelectorPosition[0xffffffff].facetAddress;
}
if (facet == address(0)) {
revert FunctionNotFound(msg.sig);
}
// Execute external function from facet using delegatecall and return any value.
assembly {
// copy function selector and any arguments
calldatacopy(0, 0, calldatasize())
// execute function call using the facet
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
// get any return value
returndatacopy(0, 0, returndatasize())
// return any return value or error back to the caller
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
}
73 changes: 30 additions & 43 deletions contracts/IexecInterfaceNative.sol
Original file line number Diff line number Diff line change
@@ -1,50 +1,37 @@
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

/******************************************************************************
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
******************************************************************************/

pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

import "./modules/interfaces/IOwnable.sol";
import "./modules/interfaces/IexecAccessors.sol";
import "./modules/interfaces/IexecCategoryManager.sol";
import "./modules/interfaces/IexecERC20.sol";
import "./modules/interfaces/IexecEscrowNative.sol";
import "./modules/interfaces/IexecMaintenance.sol";
import "./modules/interfaces/IexecOrderManagement.sol";
import "./modules/interfaces/IexecPoco1.sol";
import "./modules/interfaces/IexecPoco2.sol";
import "./modules/interfaces/IexecRelay.sol";
import "./modules/interfaces/IexecTokenSpender.sol";
import "./modules/interfaces/ENSIntegration.sol";

import "./interfaces/IOwnable.sol";
import "./interfaces/IexecAccessors.sol";
import "./interfaces/IexecCategoryManager.sol";
import "./interfaces/IexecERC20.sol";
import "./interfaces/IexecEscrowNative.sol";
import "./interfaces/IexecConfiguration.sol";
import "./interfaces/IexecOrderManagement.sol";
import "./interfaces/IexecPoco1.sol";
import "./interfaces/IexecPoco2.sol";
import "./interfaces/IexecRelay.sol";
import "./interfaces/IexecTokenSpender.sol";

/**
* A global interface that aggregates all the interfaces needed to interact with
* the PoCo contracts in native mode.
* @dev Referenced in the SDK with the current path `contracts/IexecInterfaceNative.sol`.
* Changing the name or the path would cause a breaking change in the SDK.
*/
interface IexecInterfaceNative is
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
{
}
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecConfiguration,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{}
74 changes: 29 additions & 45 deletions contracts/IexecInterfaceNativeABILegacy.sol
Original file line number Diff line number Diff line change
@@ -1,52 +1,36 @@
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

/******************************************************************************
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
******************************************************************************/

pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

import "./modules/interfaces/IOwnable.sol";
import "./modules/interfaces/IexecAccessors.sol";
import "./modules/interfaces/IexecAccessorsABILegacy.sol";
import "./modules/interfaces/IexecCategoryManager.sol";
import "./modules/interfaces/IexecERC20.sol";
import "./modules/interfaces/IexecEscrowNative.sol";
import "./modules/interfaces/IexecMaintenance.sol";
import "./modules/interfaces/IexecOrderManagement.sol";
import "./modules/interfaces/IexecPoco1.sol";
import "./modules/interfaces/IexecPoco2.sol";
import "./modules/interfaces/IexecRelay.sol";
import "./modules/interfaces/IexecTokenSpender.sol";
import "./modules/interfaces/ENSIntegration.sol";

import "./interfaces/IOwnable.sol";
import "./interfaces/IexecAccessors.sol";
import "./interfaces/IexecAccessorsABILegacy.sol";
import "./interfaces/IexecCategoryManager.sol";
import "./interfaces/IexecERC20.sol";
import "./interfaces/IexecEscrowNative.sol";
import "./interfaces/IexecConfiguration.sol";
import "./interfaces/IexecOrderManagement.sol";
import "./interfaces/IexecPoco1.sol";
import "./interfaces/IexecPoco2.sol";
import "./interfaces/IexecRelay.sol";
import "./interfaces/IexecTokenSpender.sol";

/**
* TODO: Remove this interface in the future when IexecInterfaceTokenABILegacy is removed.
*/
interface IexecInterfaceNativeABILegacy is
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
{
}
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecConfiguration,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{}
Loading