Skip to content

Commit

Permalink
Merge pull request #227 from ERC725Alliance/develop
Browse files Browse the repository at this point in the history
chore: release 5.1.0
  • Loading branch information
frozeman authored Jun 21, 2023
2 parents 7171a0e + 31574e1 commit edd8833
Show file tree
Hide file tree
Showing 40 changed files with 3,288 additions and 1,738 deletions.
30 changes: 2 additions & 28 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,14 @@
<!-- Changes that potentially causes other components to fail (changes in interfaceIds, function signatures, behavior, etc ..) --->
<!---
## ⚠️ BREAKING CHANGES
---->

<!---
## 🚀 Feature
---->

<!---
## 🐛 Bug
---->

<!---
## ♻️ Refactor
---->

<!---
## 🧪 Tests
---->

<!---
## ⚡️ Performance
---->

<!---
## 🎨 Style
---->

<!---
## 📄 Documentation
---->

<!---
## 📦 Build
---->

<!---
## 🤖 CI
---->

Expand All @@ -63,6 +36,7 @@ Fixes #???? <!-- Fill in with issue number -->

- [ ] Wrote Tests
- [ ] Wrote Documentation
- [ ] Ran `npm run lint`
- [ ] Ran `npm run lint` && `npm run lint:solidity`
- [ ] Ran `npm run format` (prettier)
- [ ] Ran `npm run build`
- [ ] Ran `npm run test`
5 changes: 4 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run Solhint Linter
- name: Run Solidity Linter
run: npm run lint:solidity

- name: Run ESLint on JS/TS files
run: npm run lint

- name: Compile contracts
Expand Down
12 changes: 12 additions & 0 deletions implementations/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"ignorePatterns": ["artifacts/", "cache/", "types/"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint/eslint-plugin", "prettier"],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/no-explicit-any": "off"
}
}
5 changes: 4 additions & 1 deletion implementations/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.md
/artifacts
/cache
/types
/coverage
5 changes: 3 additions & 2 deletions implementations/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": ["*.js", "*.ts"],
Expand All @@ -13,8 +14,8 @@
"files": "*.sol",
"options": {
"tabWidth": 4,
"printWidth": 100,
"compiler": "0.8.10"
"printWidth": 80,
"compiler": "0.8.17"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions implementations/.solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
skipFiles: ['helpers']
};
skipFiles: ['helpers'],
};
1 change: 1 addition & 0 deletions implementations/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.19.0
27 changes: 22 additions & 5 deletions implementations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,35 @@

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.

## [5.1.0](https://github.com/ERC725Alliance/ERC725/compare/v5.0.0...v5.1.0) (2023-06-21)

### Features

- Allow to fund ERC725 contracts on deployment ([#213](https://github.com/ERC725Alliance/ERC725/pull/213))

### Refactor

- Remove deprecated constants for overloaded function selectors ([#219](https://github.com/ERC725Alliance/ERC725/pull/219))

### Build

- Upgrade to 0.8.17 for default solc compiler version ([#221](https://github.com/ERC725Alliance/ERC725/pull/221))

- Upgrade `@openzeppelin/contracts` to 4.9.2 ([#224](https://github.com/ERC725Alliance/ERC725/pull/224))

## [5.0.0](https://github.com/ERC725Alliance/ERC725/compare/v4.2.0...v5.0.0) (2023-04-26)

### ⚠ BREAKING CHANGES

- Remove function overloading and rename overloaded functions to add "Batch" keyword: ([#209](https://github.com/ERC725Alliance/ERC725/pull/209))
- `setData(bytes32[],bytes[])` --> `setDataBatch(bytes32[],bytes[])`
- `getData(bytes32[])` --> `getDataBatch(bytes32[])`
- `execute(uint256[],address[],uint256[],bytes[])` --> `executeBatch(uint256[],address[],uint256[],bytes[])`

- `setData(bytes32[],bytes[])` --> `setDataBatch(bytes32[],bytes[])`
- `getData(bytes32[])` --> `getDataBatch(bytes32[])`
- `execute(uint256[],address[],uint256[],bytes[])` --> `executeBatch(uint256[],address[],uint256[],bytes[])`

- Change interfaceId of ERC725X and ERC725Y: ([#209](https://github.com/ERC725Alliance/ERC725/pull/209))
- ERC725X from `0x570ef073` to `0x7545acac`
- ERC725Y from `0x714df77c` to `0x629aa694`
- ERC725X from `0x570ef073` to `0x7545acac`
- ERC725Y from `0x714df77c` to `0x629aa694`

### Refactor

Expand Down
15 changes: 6 additions & 9 deletions implementations/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# @erc725/smart-contracts &middot; [![npm version](https://img.shields.io/npm/v/@erc725/smart-contracts.svg?style=flat)](https://www.npmjs.com/package/@erc725/smart-contracts) [![Coverage Status](https://coveralls.io/repos/github/ERC725Alliance/ERC725/badge.svg?branch=develop)](https://coveralls.io/github/ERC725Alliance/ERC725?branch=develop)


**This package is currently in BETA, use with caution!**

This package contains an implementation of ERC725 to make it as easy as possible to get started.\
Expand All @@ -12,7 +11,6 @@ The package has the following contracts:
- `ERC725Y.sol`: The data part of ERC725, allows to attach any key-value data to a smart contract. Uses [ERC173](https://eips.ethereum.org/EIPS/eip-173) as a basis.
- `ERC725.sol`: Combines both implementations: `ERC725X.sol` and `ERC725Y.sol`.


## Usage

To use in your project install via npm
Expand Down Expand Up @@ -63,14 +61,13 @@ npm run lint

### Interface IDs

The table below contains a list of [ERC165]() interface IDs used by the [Solidity implementations of the ERC725 smart contracts]().

| Interface Name | Interface ID | Description |
| :------------------------------------------------------------------------------------------------------------------------ | :----------- | :------------------------------------------------------ |
| ERC725X | `0x44c028fe` | General executor |
| ERC725Y | `0x714df77c` | General key-value store |
| [ERC165](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md) | `0x01ffc9a7` | Standard Interface Detection for Contracts |
The table below contains a list of [ERC165](https://eips.ethereum.org/EIPS/eip-165) interface IDs used by the [Solidity implementations of the ERC725 smart contracts](./contracts/).

| Interface Name | Interface ID | Description |
| :--------------------------------------------------------------------- | :----------- | :----------------------------------------- |
| ERC725X | `0x7545acac` | General executor |
| ERC725Y | `0x629aa694` | General key-value store |
| [ERC165](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md) | `0x01ffc9a7` | Standard Interface Detection for Contracts |

### Solc Contract details

Expand Down
18 changes: 5 additions & 13 deletions implementations/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ const OPERATION_TYPE = {
DELEGATECALL: 4,
};

const FUNCTIONS_SELECTOR = {
EXECUTE: '0x44c028fe',
EXECUTE_BATCH: '0x31858452',
SETDATA: '0x7f23690c',
SETDATA_BATCH: '0x97902421',
};

const Errors = {
ERC725X: {
'0x0df9a8f8': {
Expand Down Expand Up @@ -55,8 +48,8 @@ const Errors = {
},
'0xe9ad2b5f': {
error: 'ERC725X_ExecuteParametersEmptyArray()',
message: 'ERC725X: Parameters cannot be an empty array'
}
message: 'ERC725X: Parameters cannot be an empty array',
},
},
ERC725Y: {
'0x3bcc8979': {
Expand All @@ -65,12 +58,12 @@ const Errors = {
},
'0x97da5f95': {
error: 'ERC725Y_DataKeysValuesEmptyArray()',
message: 'ERC725Y: Parameters cannot be an empty array'
message: 'ERC725Y: Parameters cannot be an empty array',
},
'0xf36ba737': {
error: 'ERC725Y_MsgValueDisallowed()',
message: 'ERC725Y: Sending value to setData functions is not allowed'
}
message: 'ERC725Y: Sending value to setData functions is not allowed',
},
},
};

Expand Down Expand Up @@ -117,5 +110,4 @@ module.exports = {
OPERATION_TYPE,
Errors,
EventSignatures,
FUNCTIONS_SELECTOR,
};
24 changes: 12 additions & 12 deletions implementations/contracts/ERC725.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ import {_INTERFACEID_ERC725X, _INTERFACEID_ERC725Y} from "./constants.sol";
/**
* @title ERC725 bundle
* @author Fabian Vogelsteller <fabian@lukso.network>
* @dev Bundles ERC725X and ERC725Y together into one smart contract
* @dev Bundles ERC725X and ERC725Y together into one smart contract.
* This implementation does not have by default a:
* - `receive() external payable {}`
* - or `fallback() external payable {}`
*/
contract ERC725 is ERC725XCore, ERC725YCore {
/**
* @notice Sets the owner of the contract
* @param newOwner the owner of the contract
*/
constructor(address newOwner) {
require(newOwner != address(0), "Ownable: new owner is the zero address");
constructor(address newOwner) payable {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
OwnableUnset._setOwner(newOwner);
}

// NOTE this implementation has not by default: receive() external payable {}

/**
* @inheritdoc ERC165
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC725XCore, ERC725YCore)
returns (bool)
{
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC725XCore, ERC725YCore) returns (bool) {
return
interfaceId == _INTERFACEID_ERC725X ||
interfaceId == _INTERFACEID_ERC725Y ||
Expand Down
9 changes: 5 additions & 4 deletions implementations/contracts/ERC725Init.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {ERC725InitAbstract} from "./ERC725InitAbstract.sol";
/**
* @title Deployable Proxy Implementation of ERC725 bundle
* @author Fabian Vogelsteller <fabian@lukso.network>
* @dev Bundles ERC725XInit and ERC725YInit together into one smart contract
* @dev Bundles ERC725XInit and ERC725YInit together into one smart contract.
* This implementation does not have by default a:
* - `receive() external payable {}`
* - or `fallback() external payable {}`
*/
contract ERC725Init is ERC725InitAbstract {
/**
Expand All @@ -21,9 +24,7 @@ contract ERC725Init is ERC725InitAbstract {
* @notice Sets the owner of the contract
* @param newOwner the owner of the contract
*/
function initialize(address newOwner) public virtual initializer {
function initialize(address newOwner) public payable virtual initializer {
ERC725InitAbstract._initialize(newOwner);
}

// NOTE this implementation has not by default: receive() external payable {}
}
31 changes: 16 additions & 15 deletions implementations/contracts/ERC725InitAbstract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ pragma solidity ^0.8.0;

// modules
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {
Initializable
} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUnset} from "./custom/OwnableUnset.sol";
import {ERC725XCore} from "./ERC725XCore.sol";
import {ERC725YCore} from "./ERC725YCore.sol";
Expand All @@ -16,13 +18,16 @@ import {_INTERFACEID_ERC725X, _INTERFACEID_ERC725Y} from "./constants.sol";
* @author Fabian Vogelsteller <fabian@lukso.network>
* @dev Bundles ERC725XInit and ERC725YInit together into one smart contract
*/
abstract contract ERC725InitAbstract is Initializable, ERC725XCore, ERC725YCore {
function _initialize(address newOwner)
internal
virtual
onlyInitializing
{
require(newOwner != address(0), "Ownable: new owner is the zero address");
abstract contract ERC725InitAbstract is
Initializable,
ERC725XCore,
ERC725YCore
{
function _initialize(address newOwner) internal virtual onlyInitializing {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
OwnableUnset._setOwner(newOwner);
}

Expand All @@ -31,13 +36,9 @@ abstract contract ERC725InitAbstract is Initializable, ERC725XCore, ERC725YCore
/**
* @inheritdoc ERC165
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC725XCore, ERC725YCore)
returns (bool)
{
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC725XCore, ERC725YCore) returns (bool) {
return
interfaceId == _INTERFACEID_ERC725X ||
interfaceId == _INTERFACEID_ERC725Y ||
Expand Down
7 changes: 5 additions & 2 deletions implementations/contracts/ERC725X.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ contract ERC725X is ERC725XCore {
* @notice Sets the owner of the contract
* @param newOwner the owner of the contract
*/
constructor(address newOwner) {
require(newOwner != address(0), "Ownable: new owner is the zero address");
constructor(address newOwner) payable {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
OwnableUnset._setOwner(newOwner);
}
}
Loading

0 comments on commit edd8833

Please sign in to comment.