Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
## vNEXT

- Migrate proxy to Diamond pattern (ERC-2535):
- 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
Expand Down
29 changes: 14 additions & 15 deletions contracts/Diamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pragma solidity ^0.8.0;
// `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";
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);
Expand All @@ -33,7 +33,6 @@ struct DiamondArgs {
}

contract Diamond {

constructor(IDiamondCut.FacetCut[] memory _diamondCut, DiamondArgs memory _args) payable {
LibDiamond.setContractOwner(_args.owner);
LibDiamond.diamondCut(_diamondCut, _args.init, _args.initCalldata);
Expand All @@ -45,7 +44,7 @@ contract Diamond {
* `fallback` function must be added to the diamond with selector `0xffffffff`.
* The function is defined in IexecEscrow(Native/Token) facet.
*/
fallback() external payable{
fallback() external payable {
_fallback();
}

Expand All @@ -71,25 +70,25 @@ contract Diamond {
if (facet == address(0)) {
facet = ds.facetAddressAndSelectorPosition[0xffffffff].facetAddress;
}
if(facet == address(0)) {
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
// 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())
}
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
}
28 changes: 12 additions & 16 deletions contracts/IexecInterfaceNative.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,17 @@ 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";


interface IexecInterfaceNative is
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
{
}
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{}
30 changes: 13 additions & 17 deletions contracts/IexecInterfaceNativeABILegacy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,18 @@ 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";


interface IexecInterfaceNativeABILegacy is
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
{
}
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowNative,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{}
31 changes: 14 additions & 17 deletions contracts/IexecInterfaceToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,21 @@ 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";


interface IexecInterfaceToken is
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowToken,
IexecEscrowTokenSwap,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
IOwnable,
IexecAccessors,
IexecCategoryManager,
IexecERC20,
IexecEscrowToken,
IexecEscrowTokenSwap,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{
receive() external override(IexecEscrowToken, IexecEscrowTokenSwap) payable;
fallback() external override(IexecEscrowToken, IexecEscrowTokenSwap) payable;
receive() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
fallback() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
}
33 changes: 15 additions & 18 deletions contracts/IexecInterfaceTokenABILegacy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,22 @@ 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";


interface IexecInterfaceTokenABILegacy is
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowToken,
IexecEscrowTokenSwap,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender,
ENSIntegration
IOwnable,
IexecAccessors,
IexecAccessorsABILegacy,
IexecCategoryManager,
IexecERC20,
IexecEscrowToken,
IexecEscrowTokenSwap,
IexecMaintenance,
IexecOrderManagement,
IexecPoco1,
IexecPoco2,
IexecRelay,
IexecTokenSpender
{
receive() external override(IexecEscrowToken, IexecEscrowTokenSwap) payable;
fallback() external override(IexecEscrowToken, IexecEscrowTokenSwap) payable;
receive() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
fallback() external payable override(IexecEscrowToken, IexecEscrowTokenSwap);
}
35 changes: 0 additions & 35 deletions contracts/modules/delegates/ENSIntegrationDelegate.sol

This file was deleted.

26 changes: 0 additions & 26 deletions contracts/modules/interfaces/ENSIntegration.sol

This file was deleted.

Loading