Skip to content

Commit

Permalink
Merge pull request #242 from ERC725Alliance/develop
Browse files Browse the repository at this point in the history
chore: release v6.0.0
  • Loading branch information
frozeman committed Oct 10, 2023
2 parents 7358a08 + ff9535f commit aef27d2
Show file tree
Hide file tree
Showing 27 changed files with 1,653 additions and 4,326 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/solc_version.yml
Expand Up @@ -17,16 +17,23 @@ jobs:
strategy:
matrix:
solc: [
"0.8.5",
"0.8.6",
"0.8.7",
"0.8.8",
"0.8.9",
# "0.8.10" skipped as default in hardhat.config.ts
"0.8.10",
"0.8.11",
"0.8.12",
"0.8.13",
"0.8.14",
"0.8.15",
"0.8.16",
"0.8.17",
# "0.8.17", # skipped as default in hardhat.config.ts
"0.8.18",
"0.8.19",
"0.8.20",
"0.8.21"
]
steps:
- uses: actions/checkout@v3
Expand All @@ -51,6 +58,7 @@ jobs:
- name: Compile Smart Contracts
run: |
solc contracts/**/*.sol \
@openzeppelin/=node_modules/@openzeppelin/ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/
solc contracts/**/*.sol --allow-paths $(pwd)/node_modules/ \
@openzeppelin/=$(pwd)/node_modules/@openzeppelin/ \
solidity-bytes-utils/=$(pwd)/node_modules/solidity-bytes-utils/ \
../=$(pwd)/contracts/
2 changes: 2 additions & 0 deletions implementations/.solhint.json
Expand Up @@ -3,6 +3,8 @@
"rules": {
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"no-unused-import": "error",
"no-global-import": "error",
"reason-string": ["warn", { "maxLength": 120 }],
"no-empty-blocks": ["off"]
}
Expand Down
14 changes: 14 additions & 0 deletions implementations/CHANGELOG.md
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.0.0](https://github.com/ERC725Alliance/ERC725/compare/v5.2.0...v6.0.0) (2023-10-10)

### ⚠ BREAKING CHANGES

- Replace revert reason strings by custom `error` in `OwnableUnset` and inside `constructor` / `initialize(...)` functions for `address(0)` checks ([#236](https://github.com/ERC725Alliance/ERC725/pull/236))

### Perf

- Implement Gas Optimisations & QA from Code4Rena audit contest ([#235](https://github.com/ERC725Alliance/ERC725/pull/235))

### Bug Fixes

- fix minimum pragma `solc` version required to `0.8.4` for ERC725Y and `0.8.5` for ERC725X and ERC725 ([1afd0dd](https://github.com/ERC725Alliance/ERC725/pull/236/commits/1afd0dd1af4d7008907c0fd74cf0ad3fdf3ddbe5) and [dbc0f61](https://github.com/ERC725Alliance/ERC725/pull/236/commits/dbc0f61027b81a2a583cf25f1e2af4da4897b955))

### [5.2.0](https://github.com/ERC725Alliance/ERC725/compare/v5.1.0...v5.2.0) (2023-07-25)

- Improve Natspec comments of smart contracts ([#229](https://github.com/ERC725Alliance/ERC725/pull/229))
Expand Down
15 changes: 8 additions & 7 deletions implementations/contracts/ERC725.sol
@@ -1,15 +1,17 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725XCore} from "./ERC725XCore.sol";
import {ERC725YCore} from "./ERC725YCore.sol";

// constants
import {_INTERFACEID_ERC725X, _INTERFACEID_ERC725Y} from "./constants.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title ERC725 bundle.
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -27,15 +29,14 @@ contract ERC725 is ERC725XCore, ERC725YCore {
* - `initialOwner` CANNOT be the zero address.
*/
constructor(address initialOwner) payable {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}

/**
* @inheritdoc ERC165
* @inheritdoc ERC725XCore
*/
function supportsInterface(
bytes4 interfaceId
Expand Down
2 changes: 1 addition & 1 deletion implementations/contracts/ERC725Init.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {ERC725InitAbstract} from "./ERC725InitAbstract.sol";
Expand Down
15 changes: 8 additions & 7 deletions implementations/contracts/ERC725InitAbstract.sol
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {
Initializable
} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand All @@ -13,6 +12,9 @@ import {ERC725YCore} from "./ERC725YCore.sol";
// constants
import {_INTERFACEID_ERC725X, _INTERFACEID_ERC725Y} from "./constants.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title Inheritable Proxy Implementation of ERC725 bundle
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -35,15 +37,14 @@ abstract contract ERC725InitAbstract is
function _initialize(
address initialOwner
) internal virtual onlyInitializing {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}

/**
* @inheritdoc ERC165
* @inheritdoc ERC725XCore
*/
function supportsInterface(
bytes4 interfaceId
Expand Down
12 changes: 7 additions & 5 deletions implementations/contracts/ERC725X.sol
@@ -1,10 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725XCore} from "./ERC725XCore.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title Deployable implementation with `constructor` of ERC725X, a generic executor.
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -23,10 +26,9 @@ contract ERC725X is ERC725XCore {
* - `initialOwner` CANNOT be the zero address.
*/
constructor(address initialOwner) payable {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}
}
33 changes: 27 additions & 6 deletions implementations/contracts/ERC725XCore.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// interfaces
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
Expand All @@ -24,7 +24,17 @@ import {
OPERATION_4_DELEGATECALL
} from "./constants.sol";

import "./errors.sol";
import {
ERC725X_InsufficientBalance,
ERC725X_UnknownOperationType,
ERC725X_MsgValueDisallowedInStaticCall,
ERC725X_MsgValueDisallowedInDelegateCall,
ERC725X_CreateOperationsRequireEmptyRecipientAddress,
ERC725X_ContractDeploymentFailed,
ERC725X_NoContractBytecodeProvided,
ERC725X_ExecuteParametersLengthMismatch,
ERC725X_ExecuteParametersEmptyArray
} from "./errors.sol";

/**
* @title Core implementation of ERC725X sub-standard, a generic executor.
Expand Down Expand Up @@ -62,6 +72,9 @@ abstract contract ERC725XCore is OwnableUnset, ERC165, IERC725X {
* - SHOULD only be callable by the {owner} of the contract.
* - The contract MUST have in its balance **at least the sum of all the `values`** to transfer and execute successfully each calldata payloads.
*
* @custom:warning
* - The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4).
*
* @custom:events
* - {Executed} event, when a call is made with `operationType` 0 (CALL), 3 (STATICCALL) or 4 (DELEGATECALL)
* - {ContractCreated} event, when deploying a contract with `operationType` 1 (CREATE) or 2 (CREATE2)
Expand Down Expand Up @@ -102,21 +115,25 @@ abstract contract ERC725XCore is OwnableUnset, ERC165, IERC725X {

// Deploy with CREATE
if (operationType == OPERATION_1_CREATE) {
if (target != address(0))
if (target != address(0)) {
revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
}
return _deployCreate(value, data);
}

// Deploy with CREATE2
if (operationType == OPERATION_2_CREATE2) {
if (target != address(0))
if (target != address(0)) {
revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
}
return _deployCreate2(value, data);
}

// STATICCALL
if (operationType == OPERATION_3_STATICCALL) {
if (value != 0) revert ERC725X_MsgValueDisallowedInStaticCall();
if (value != 0) {
revert ERC725X_MsgValueDisallowedInStaticCall();
}
return _executeStaticCall(target, data);
}

Expand All @@ -133,7 +150,9 @@ abstract contract ERC725XCore is OwnableUnset, ERC165, IERC725X {
// - run selfdestruct in the context of this contract
//
if (operationType == OPERATION_4_DELEGATECALL) {
if (value != 0) revert ERC725X_MsgValueDisallowedInDelegateCall();
if (value != 0) {
revert ERC725X_MsgValueDisallowedInDelegateCall();
}
return _executeDelegateCall(target, data);
}

Expand Down Expand Up @@ -236,6 +255,8 @@ abstract contract ERC725XCore is OwnableUnset, ERC165, IERC725X {
* @param target The address on which delegatecall is executed
* @param data The data to be sent with the delegatecall
* @return result The data returned from the delegatecall
*
* @custom:warning The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4).
*/
function _executeDelegateCall(
address target,
Expand Down
2 changes: 1 addition & 1 deletion implementations/contracts/ERC725XInit.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {ERC725XInitAbstract} from "./ERC725XInitAbstract.sol";
Expand Down
12 changes: 7 additions & 5 deletions implementations/contracts/ERC725XInitAbstract.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.5;

// modules
import {
Expand All @@ -8,6 +8,9 @@ import {
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725XCore} from "./ERC725XCore.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title Inheritable Proxy Implementation of ERC725X, a generic executor.
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -27,10 +30,9 @@ abstract contract ERC725XInitAbstract is Initializable, ERC725XCore {
function _initialize(
address initialOwner
) internal virtual onlyInitializing {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}
}
13 changes: 7 additions & 6 deletions implementations/contracts/ERC725Y.sol
@@ -1,11 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;

// modules
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725YCore} from "./ERC725YCore.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title Deployable implementation with `constructor` of ERC725Y, a generic data key/value store.
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -22,10 +24,9 @@ contract ERC725Y is ERC725YCore {
* - `initialOwner` CANNOT be the zero address.
*/
constructor(address initialOwner) payable {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}
}
8 changes: 6 additions & 2 deletions implementations/contracts/ERC725YCore.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;

// interfaces
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
Expand All @@ -12,7 +12,11 @@ import {OwnableUnset} from "./custom/OwnableUnset.sol";
// constants
import {_INTERFACEID_ERC725Y} from "./constants.sol";

import "./errors.sol";
import {
ERC725Y_MsgValueDisallowed,
ERC725Y_DataKeysValuesLengthMismatch,
ERC725Y_DataKeysValuesEmptyArray
} from "./errors.sol";

/**
* @title Core implementation of ERC725Y sub-standard, a general data key/value store.
Expand Down
2 changes: 1 addition & 1 deletion implementations/contracts/ERC725YInit.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;

// modules
import {ERC725YInitAbstract} from "./ERC725YInitAbstract.sol";
Expand Down
12 changes: 7 additions & 5 deletions implementations/contracts/ERC725YInitAbstract.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;

// modules
import {
Expand All @@ -8,6 +8,9 @@ import {
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725YCore} from "./ERC725YCore.sol";

// errors
import {OwnableCannotSetZeroAddressAsOwner} from "./errors.sol";

/**
* @title Inheritable Proxy Implementation of ERC725Y, a generic data key/value store
* @author Fabian Vogelsteller <fabian@lukso.network>
Expand All @@ -25,10 +28,9 @@ abstract contract ERC725YInitAbstract is Initializable, ERC725YCore {
function _initialize(
address initialOwner
) internal virtual onlyInitializing {
require(
initialOwner != address(0),
"Ownable: new owner is the zero address"
);
if (initialOwner == address(0)) {
revert OwnableCannotSetZeroAddressAsOwner();
}
OwnableUnset._setOwner(initialOwner);
}
}

0 comments on commit aef27d2

Please sign in to comment.