Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync main to release v8.0.0 #263

Merged
merged 50 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
81d16d9
chore(deps-dev): bump undici from 5.21.0 to 5.26.3 in /implementations
dependabot[bot] Oct 16, 2023
3568145
chore(deps): bump @babel/traverse in /implementations
dependabot[bot] Oct 18, 2023
bdaf72f
chore(deps-dev): bump axios from 1.5.1 to 1.6.1 in /implementations
dependabot[bot] Nov 11, 2023
ae58cba
chore(deps-dev): bump follow-redirects in /implementations
dependabot[bot] Jan 10, 2024
ee0948a
feat: add internal `_setDataBatch` function without owner modifier
CJ42 Jan 31, 2024
bcfaabe
Merge pull request #250 from ERC725Alliance/feat/setdatabatch-internal
CJ42 Jan 31, 2024
9b0bc58
updating the erc725 use case page
mustafademiray May 7, 2024
1403482
old version mention
mustafademiray May 7, 2024
f23a64e
old version removal
mustafademiray May 7, 2024
59540e2
Merge pull request #251 from mustafademiray/develop
frozeman May 8, 2024
84b5519
Re-arrange section (#252)
YamenMerhi Aug 6, 2024
01e5c00
refactor!: remove `ERC725XCore` and share logic across Standard and I…
CJ42 Aug 21, 2024
c60aedb
refactor!: remove `ERC725YCore` and duplicate logic across Standard a…
CJ42 Aug 21, 2024
c1c5e2f
refactor!: inheritance of `ERC725` of standard and init version
CJ42 Aug 21, 2024
fc8377b
refactor!: remove and deprecate `OwnableUnset` in favour of OZ
CJ42 Aug 22, 2024
f77f9a2
refactor!: use `ERC165Upgradeable` for the Init version
CJ42 Aug 22, 2024
1c7300b
refactor: remove unecessary `OwnableUpgradeable` in ERC725InitAbstrac…
CJ42 Sep 2, 2024
f53e7ee
build: upgrade OZ dependency to latest patch version
CJ42 Sep 2, 2024
5b8c2a1
refactor: re-add custom errors for setting zero address as owner on d…
CJ42 Sep 2, 2024
2d4ca59
Merge pull request #243 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 3, 2024
4f4e43a
Merge pull request #244 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 3, 2024
46989a5
Merge pull request #245 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 3, 2024
2ef0fd3
Merge pull request #249 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 3, 2024
7b257e9
chore(deps): bump undici from 5.26.3 to 5.28.4 in /implementations
dependabot[bot] Sep 3, 2024
b5df44e
chore(deps): bump braces from 3.0.2 to 3.0.3 in /implementations
dependabot[bot] Sep 3, 2024
78cf4d8
Merge pull request #254 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 6, 2024
4928b12
chore(deps-dev): bump axios from 1.6.1 to 1.7.7 in /implementations
dependabot[bot] Sep 6, 2024
48e25e5
chore(deps): bump follow-redirects in /implementations
dependabot[bot] Sep 3, 2024
38409c4
Merge pull request #255 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 6, 2024
7c49101
Merge pull request #256 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 6, 2024
d4e1cdb
Merge pull request #257 from ERC725Alliance/dependabot/npm_and_yarn/i…
CJ42 Sep 6, 2024
bfa19d2
chore: upgrade linter dependencies
CJ42 Sep 2, 2024
749f1c5
chore(deps-dev): bump undici from 5.21.0 to 5.26.3 in /implementations
dependabot[bot] Oct 16, 2023
8a5244b
chore(deps): bump @babel/traverse in /implementations
dependabot[bot] Oct 18, 2023
f616d6c
chore(deps-dev): bump axios from 1.5.1 to 1.6.1 in /implementations
dependabot[bot] Nov 11, 2023
57d60f9
chore(deps-dev): bump follow-redirects in /implementations
dependabot[bot] Jan 10, 2024
eca4edc
chore(deps): bump undici from 5.26.3 to 5.28.4 in /implementations
dependabot[bot] Sep 3, 2024
a22fe9b
chore(deps): bump follow-redirects in /implementations
dependabot[bot] Sep 3, 2024
6a8d4de
chore(deps): bump braces from 3.0.2 to 3.0.3 in /implementations
dependabot[bot] Sep 3, 2024
0b185bf
chore(deps-dev): bump axios from 1.6.1 to 1.7.7 in /implementations
dependabot[bot] Sep 6, 2024
072261d
test: add more tests for `ERC725` to ensure it supports both X and Y …
CJ42 Sep 8, 2024
1047659
docs: add extra comment for calling overriden `_initialize` function …
CJ42 Oct 7, 2024
0e1a57e
Merge pull request #253 from ERC725Alliance/refactor/reove-ownableunset
CJ42 Oct 9, 2024
bc197c5
ci: add latest solidity versions to test for compiling
CJ42 Sep 6, 2024
eed5f15
ci: add workflow to run slither
CJ42 Sep 9, 2024
d7a0a86
ci: updaten version of all github actions to v4
CJ42 Sep 9, 2024
38669e2
Merge pull request #260 from ERC725Alliance/ci/latest-solc-versions
CJ42 Oct 10, 2024
096f0c7
Merge pull request #262 from ERC725Alliance/ci/slither-workflow
CJ42 Oct 10, 2024
a3b7a6f
test: fix incorrect check for interface ID tests of ERC725
CJ42 Oct 10, 2024
3c81263
Merge pull request #264 from ERC725Alliance/test/fix
CJ42 Oct 10, 2024
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
244 changes: 122 additions & 122 deletions docs/ERC-725.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ requires: 165, 173

## Abstract

The following describes two standards that allow for a generic data storage in a smart contract and a generic execution through a smart contract. These can be used seperate or in conjunction and can serve as building blocks for smart contract accounts, upgradable meta data and other means.
The following describes two standards that allow for generic data storage in a smart contract and a generic execution through a smart contract. These can be used separately or in conjunction and can serve as building blocks for smart contract accounts, upgradable metadata, and other means.

## Motivation

The initial motivation came out of the need to create a smart contract account system thats flexible enough to be viable long term, but also defined enough to be standardised. They are a generic set of two standardised building blocks to be used in all forms of smart contracts.
The initial motivation came out of the need to create a smart contract account system that's flexible enough to be viable long-term but also defined enough to be standardized. They are a generic set of two standardized building blocks to be used in all forms of smart contracts.

This standard consists of two sub standards, a generic data key/value store (ERC725Y) and a generic execute function (ERC725X). Both of which in combination allow for a very flexible and long lasting account system. The account version of ERC725 is standardised under [LSP0 ERC725Account](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-0-ERC725Account.md).
This standard consists of two sub-standards, a generic data key/value store (ERC725Y) and a generic execute function (ERC725X). Both of these in combination allow for a very flexible and long-lasting account system. The account version of ERC725 is standardised under [LSP0 ERC725Account](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-0-ERC725Account.md).

These standards (ERC725 X and Y) can also be used separately to enhance NFTs and Token meta data or other types of smart contracts. ERC725X allows for a generic execution through a smart contract, functioning as an account or actor.
These standards (ERC725 X and Y) can also be used separately to enhance NFTs and Token metadata or other types of smart contracts. ERC725X allows for a generic execution through a smart contract, functioning as an account or actor.

## Specification

Expand All @@ -39,6 +39,110 @@ And the event:

---

### ERC725Y

**ERC725Y** interface id according to [ERC165]: `0x629aa694`.

Smart contracts implementing the ERC725Y standard MUST implement the [ERC165] `supportsInterface(..)` function and MUST support the ERC165 and ERC725Y interface ids.

### Methods

Smart contracts implementing the ERC725Y standard MUST implement all of the functions listed below:

#### getData

```solidity
function getData(bytes32 dataKey) external view returns(bytes memory)
```

Function Selector: `0x54f6127f`

Gets the data set for the given data key.

_Parameters:_

- `dataKey`: the data key which value to retrieve.

_Returns:_ `bytes` , The data for the requested data key.

#### getDataBatch

```solidity
function getDataBatch(bytes32[] memory dataKeys) external view returns(bytes[] memory)
```

Function Selector: `0xdedff9c6`

Gets array of data at multiple given data keys.

_Parameters:_

- `dataKeys`: the data keys which values to retrieve.

_Returns:_ `bytes[]` , array of data values for the requested data keys.

#### setData

```solidity
function setData(bytes32 dataKey, bytes memory dataValue) external payable
```

Function Selector: `0x7f23690c`

Sets data as bytes in the storage for a single data key.

_Parameters:_

- `dataKey`: the data key which value to set.
- `dataValue`: the data to store.

_Requirements:_

- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

#### setDataBatch

```solidity
function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external payable
```

Function Selector: `0x97902421`

Sets array of data at multiple data keys. MUST only be called by the current owner of the contract.

_Parameters:_

- `dataKeys`: the data keys which values to set.
- `dataValues`: the array of bytes to set.

_Requirements:_

- Array parameters MUST have the same length.
- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

### Events

#### DataChanged

```solidity
event DataChanged(bytes32 indexed dataKey, bytes dataValue)
```

MUST be triggered when a data key is successfully set.

### ERC725Y Data keys

Data keys, are the way to retrieve values via `getData()`. These `bytes32` values can be freely chosen, or defined by a standard.
A common way to define data keys is the hash of a word, e.g. `keccak256('ERCXXXMyNewKeyType')` which results in: `0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047`

The [LSP2 ERC725JSONSchema standard](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md) is a more explicit ERC725Y data key standard, that defines key types and value types, and their encoding and decoding.

---

### ERC725X

**ERC725X** interface id according to [ERC165]: `0x7545acac`.
Expand Down Expand Up @@ -152,145 +256,32 @@ event ContractCreated(uint256 indexed operationType, address indexed contractAdd

MUST be triggered when `execute` creates a new contract using the `operationType` `1`, `2`.

---

### ERC725Y

**ERC725Y** interface id according to [ERC165]: `0x629aa694`.

Smart contracts implementing the ERC725Y standard MUST implement the [ERC165] `supportsInterface(..)` function and MUST support the ERC165 and ERC725Y interface ids.

### Methods

Smart contracts implementing the ERC725Y standard MUST implement all of the functions listed below:

#### getData

```solidity
function getData(bytes32 dataKey) external view returns(bytes memory)
```

Function Selector: `0x54f6127f`

Gets the data set for the given data key.

_Parameters:_

- `dataKey`: the data key which value to retrieve.

_Returns:_ `bytes` , The data for the requested data key.

#### getDataBatch

```solidity
function getData(bytes32[] memory dataKeys) external view returns(bytes[] memory)
```

Function Selector: `0xdedff9c6`

Gets array of data at multiple given data keys.

_Parameters:_

- `dataKeys`: the data keys which values to retrieve.

_Returns:_ `bytes[]` , array of data values for the requested data keys.

#### setData

```solidity
function setData(bytes32 dataKey, bytes memory dataValue) external payable
```

Function Selector: `0x7f23690c`

Sets data as bytes in the storage for a single data key.

_Parameters:_

- `dataKey`: the data key which value to set.
- `dataValue`: the data to store.

_Requirements:_

- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

#### setDataBatch

```solidity
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues) external payable
```

Function Selector: `0x97902421`

Sets array of data at multiple data keys. MUST only be called by the current owner of the contract.

_Parameters:_

- `dataKeys`: the data keys which values to set.
- `dataValues`: the array of bytes to set.

_Requirements:_

- Array parameters MUST have the same length.
- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

### Events

#### DataChanged

```solidity
event DataChanged(bytes32 indexed dataKey, bytes dataValue)
```

MUST be triggered when a data key was successfully set.

### ERC725Y Data keys

Data keys, are the way to retrieve values via `getData()`. These `bytes32` values can be freely chosen, or defined by a standard.
A common way to define data keys is the hash of a word, e.g. `keccak256('ERCXXXMyNewKeyType')` which results in: `0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047`

The [LSP2 ERC725JSONSchema standard](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md) is a more explicit ERC725Y data key standard, that defines key types and value types, and their encoding and decoding.

## Rationale

The generic way of storing data key with values was chosen to allow upgradablity over time. Stored data values can be changed over time. Other smart contract protocols can then interpret this data in new ways and react to interactions from a ERC725 smart contract differently.
The generic way of storing data keys with values was chosen to allow upgradability over time. Stored data values can be changed over time. Other smart contract protocols can then interpret this data in new ways and react to interactions from an ERC725 smart contract differently.

The data stored in an ERC725Y smart contract is not only readable/writable by off chain applications, but also by other smart contracts. Function overloading was used to allow for the retrievable for single and multiple keys, to keep gas costs minimal for both uses cases.
The data stored in an ERC725Y smart contract is not only readable/writable by off-chain applications, but also by other smart contracts. Function overloading was used to allow for the retrievable for single and multiple keys, to keep gas costs minimal for both use cases.

## Backwards Compatibility

All contracts since ERC725v2 from 2018/19 should be compatible to the current version of the standard. Mainly interface ID and Event parameters have changed, while `getDataBatch(bytes32[])` and `setDataBatch(bytes32[], bytes[])` was added as an efficient way to set/get multiple keys at once. The same applies for execution, as `executeBatch(..[])` was added as an efficient way to batch calls.
All contracts since ERC725v2 from 2018/19 should be compatible with the current version of the standard. Mainly interface ID and Event parameters have changed, while `getDataBatch(bytes32[])` and `setDataBatch(bytes32[], bytes[])` were added as an efficient way to set/get multiple keys at once. The same applies to execution, as `executeBatch(..[])` was added as an efficient way to batch calls.

## Reference Implementation

Reference implementations can be found [here](../assets/eip-725)

## Security Considerations

This contract allows generic executions, therefore special care need to be take care to prevent re-entrancy attacks and other forms of call chain attacks.
This contract allows generic executions, therefore special care should be taken to prevent re-entrancy attacks and other forms of call chain attacks.

When using the operation type `4` for `delegatecall`, it is important to consider that the called contracts can alter the state of the calling contract and also change owner variables and ERC725Y data storge entries at will. Additionally calls to `selfdestruct` are possible and other harmful state changing operations.
When using the operation type `4` for `delegatecall`, it is important to consider that the called contracts can alter the state of the calling contract and also change owner variables and ERC725Y data storage entries at will. Additionally calls to `selfdestruct` are possible and other harmful state-changing operations.

### Solidity Interfaces

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.5.0 <0.7.0;

interface IERC725X /* is ERC165, ERC173 */ {
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 value, bytes32 indexed salt);
event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector);

function execute(uint256 operationType, address target, uint256 value, bytes memory data) external payable returns(bytes memory);

function executeBatch(uint256[] memory operationsType, address[] memory targets, uint256[] memory values, bytes memory datas) external payable returns(bytes[] memory);
}


interface IERC725Y /* is ERC165, ERC173 */ {
event DataChanged(bytes32 indexed dataKey, bytes dataValue);
Expand All @@ -302,6 +293,15 @@ interface IERC725Y /* is ERC165, ERC173 */ {
function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external;
}

interface IERC725X /* is ERC165, ERC173 */ {
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 value, bytes32 indexed salt);
event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector);

function execute(uint256 operationType, address target, uint256 value, bytes memory data) external payable returns(bytes memory);

function executeBatch(uint256[] memory operationsType, address[] memory targets, uint256[] memory values, bytes memory datas) external payable returns(bytes[] memory);
}

interface IERC725 /* is IERC725X, IERC725Y */ {

}
Expand Down
16 changes: 7 additions & 9 deletions docs/use-cases.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
Projects, please list your use cases for ERC725 below!
You can make a pull request to update the table.

NOTE: some implementation use the old version [ERC725v1](https://github.com/ethereum/EIPs/blob/ede8c26a77eb1ac8fa2d01d8743a8cf259d8d45b/EIPS/eip-725.md).

| Project | Use case description |
| --- | --- |
| [Origin](https://www.originprotocol.com/en) | Origin Protocol is using ERC725 as the foundation for users' identities on Origin. ERC725 was chosen to maximize interoperability with other projects and Dapps in the future. Origin users have public profiles with attestations for things like email, phone number, and social media accounts. |
| [Caelum Labs](https://caelumlabs.com/) | Caelum Labs plans to use ERC725 as a basic Local/National ID system for Ethereum based Blockchains. Our main goal is to use it to stablish trust between people, companies and public administration, so Smart Contracts can be used for any process between them |
| [Hydro](https://hydrogenplatform.com/hydro) | Hydro plans to provide a platform layer to facilitate and improve aspects of the dApp development process, including identity management. Accordingly, Hydro plans to offer developers a standard implementation of ERC725 in conjunction with other identity standards that can meet the specific needs of their applications. These identity standards are detailed in the [ERC 1484 reference repo](https://github.com/hydrogen-dev/ERC-1484). |
| [Wyre](https://www.sendwyre.com/) | Compatibility with ERC-725 & 735 into our on-chain verification contracts. Our implementation is for bridging the gap between the off-chain _regulated_ entities in Fintech, & the on-chain DeFi products/services today and in the future. Aimed to ensure extensibility given the permutations with verification based on Product/Service / Scale / Geography / etc... We've tested, but aim to be deploying 725 as an additional choice when the account has opted in for an on-chain verification token. This would be via our API, or via direct user-onboarding on Wyre's UI. As a regulated entity, we're planning on supporting 735, aimed at supporting progress toward on-chain verification. Less attack vectors for information, means mitigating security risks made possible with developer barriers to entry getting reduced more rapidly as the ecosystem matures. *Our proposal:* [ERC-DeFi Verification repo](https://github.com/sendwyre/yes-compliance-token/tree/master/docs) includes our ERC, full implementation/tests, an ELI5, DeFi licensing dictionary/terminology and more. |
| [LydianID](https://lydianid.lydianventures.com/product/) | LydianVentures is using ERC725/735 identities and attestations on several projects and created LydianID as an identity management Dapp. LydianID is currently being used by academic institutions to certify on blockchain the studies of their students, who can share the attestation with others. ERC725/735 identities are used in other projects where interoperability among several parties is required and a role-permission system is built with attestations. |
| [Smilo](https://www.smilo.io) | Smilo is using ERC725 identities and off-chain claims including Facial Biometrics. Our first implementation contains festival/opera/stadion facial authentication based on a DID + ticketnumber. We want to collaborate on a global standard to make interoperability work, and PII is shared in a secure way. |
| [LUKSO](https://lukso.network/) | LUKSO is a Blockchain infrastructure, providing a series of standards and solutions for physical and digital consumer goods, in order to foster transparency, circularity and new forms of responsible production and consumption. The [LSP Universal Profile smart contracts](https://github.com/lukso-network/lsp-universalprofile-smart-contracts) use ERC725. |
| [Universal Page](https://universal.page/) | The first marketplace and profile page editor for LUKSO. Almost every token drop is distributed and announced on this platform. The service comes with a feed, showing the latest news of transactions, sales, and listings, and even metrics. It also comes with metrics and stats for all assets, that people can browse through. To see owned assets, the platform has its own customizable page system where people can design a webpage containing all their Universal Profile information. |
| [TradeUP!](https://www.tradeup.live/) | Smart-contract secured escrow swaps, where users can trade LSP7 & LSP8 tokens between Universal Profiles on LUKSO. You can batch multiple tokens together within one trade, against another batch or single token. You can also propose/offer trades to certain Universal Profiles, and analyze historical trades. |
| [universalprofile.cloud](https://universalprofile.cloud/) | Search through platform independent blockchain accounts on LUKSO, or create your own Universal Profile! |
| [upturn](https://upturn.live/) | Upturn is a token creation tool that allows creators and brands to generate LSP tokens on LUKSO and distribute them to their fans and community. The goal is to make token deployment and adding custom functionality like royalties as easy as possible. |
| [SigmaSwap](https://app.sigmaswap.io/en) | First DeFi Bridge between LUKSO and Ethereum, delivering wrapped LYX on Ethereum. The bridge tool will extend support to Base and Astar chains, as well as deliver wUSDT on the LUKSO network, expected to be the first stable coin. |
| [Universal Grave](https://universalgrave.com/) | Universal Grave allows users to set up a Grave for all unwanted token they receive to their Universal Profile. Incoming assets are then automatically forwarded into the Grave’s smart contract. Users can still recover quality assets back to the UP, and soon directly list assets from their Grave for auction. |
| [Stakingverse](https://app.stakingverse.io/) | Stakingverse provides another non-custodial staking pool on LUKSO. Users can withdraw your tokens at any time, even directly from the smart-contract. |
Loading
Loading