Skip to content

Commit

Permalink
build: upgrade @erc725/smart-contracts to 5.2.0 + generate new ABI …
Browse files Browse the repository at this point in the history
…docs (#691)

* build: upgrade `@erc725/smart-contracts` to version `5.2.0`

* docs: add auto generated docs for ERC725X and ERC725Y Natspec from `@erc725` package
  • Loading branch information
CJ42 authored Sep 4, 2023
1 parent 0216fec commit dc56820
Show file tree
Hide file tree
Showing 23 changed files with 1,737 additions and 635 deletions.
12 changes: 6 additions & 6 deletions docs/contracts/ERC725/ERC725.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

> ERC725 bundle.
Bundle ERC725X and ERC725Y together into one smart contract. This implementation does not have by default a `receive() external payable {}` or `fallback() external payable {}` function.
Bundle ERC725X and ERC725Y together into one smart contract.

## Public Methods

Expand Down Expand Up @@ -76,7 +76,7 @@ function execute(
) external payable returns (bytes);
```

_Calling address `target` using `operationType`, transferring `value` wei and data: `data`. _
_Calling address `target` using `operationType`, transferring `value` wei and data: `data`._

Generic executor function to:

Expand Down Expand Up @@ -143,7 +143,7 @@ function executeBatch(
) external payable returns (bytes[]);
```

_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`. _
_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`._

Batch executor function that behaves the same as [`execute`](#execute) but allowing multiple operations in the same transaction.

Expand Down Expand Up @@ -316,7 +316,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f
function setData(bytes32 dataKey, bytes dataValue) external payable;
```

_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`. _
_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._

Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data.

Expand Down Expand Up @@ -366,7 +366,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data
function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable;
```

_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`. _
_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._

Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction.

Expand Down Expand Up @@ -716,7 +716,7 @@ event ContractCreated(uint256 indexed operationType, address indexed contractAdd

_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._

Emitted whenever a contract is created
Emitted when a new contract was created and deployed.

#### Parameters

Expand Down
8 changes: 4 additions & 4 deletions docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function execute(
) external payable returns (bytes);
```

_Calling address `target` using `operationType`, transferring `value` wei and data: `data`. _
_Calling address `target` using `operationType`, transferring `value` wei and data: `data`._

Generic executor function to:

Expand Down Expand Up @@ -359,7 +359,7 @@ function executeBatch(
) external payable returns (bytes[]);
```

_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`. _
_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`._

Batch executor function that behaves the same as [`execute`](#execute) but allowing multiple operations in the same transaction.

Expand Down Expand Up @@ -629,7 +629,7 @@ Renounce ownership of the contract in a 2-step process.
function setData(bytes32 dataKey, bytes dataValue) external payable;
```

_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`. _
_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._

Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data.

Expand Down Expand Up @@ -674,7 +674,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data
function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable;
```

_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`. _
_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._

Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction.

Expand Down
147 changes: 120 additions & 27 deletions docs/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ When marked as 'public', a method can be called both externally and internally,
function getData(bytes32 dataKey) external view returns (bytes dataValue);
```

_Gets singular data at a given `dataKey`_
_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._

Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`.

#### Parameters

| Name | Type | Description |
| --------- | :-------: | ------------------------------- |
| `dataKey` | `bytes32` | The key which value to retrieve |
| Name | Type | Description |
| --------- | :-------: | --------------------------------------------- |
| `dataKey` | `bytes32` | The data key for which to retrieve the value. |

#### Returns

| Name | Type | Description |
| ----------- | :-----: | -------------------------- |
| `dataValue` | `bytes` | The data stored at the key |
| Name | Type | Description |
| ----------- | :-----: | ---------------------------------------------------- |
| `dataValue` | `bytes` | The bytes value stored under the specified data key. |

<br/>

Expand All @@ -71,7 +73,9 @@ function getDataBatch(
) external view returns (bytes[] dataValues);
```

_Gets array of data for multiple given keys_
_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._

Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`.

#### Parameters

Expand Down Expand Up @@ -167,18 +171,42 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f

:::

:::caution Warning

**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**.

:::

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

_Sets singular data for a given `dataKey`_
_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._

Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data.

<blockquote>

**Requirements:**

- SHOULD only be callable by the [`owner`](#owner).

</blockquote>

<blockquote>

**Emitted events:**

- [`DataChanged`](#datachanged) event.

</blockquote>

#### Parameters

| Name | Type | Description |
| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dataKey` | `bytes32` | The key to retrieve stored value |
| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. |
| Name | Type | Description |
| ----------- | :-------: | ------------------------------------------ |
| `dataKey` | `bytes32` | The data key for which to set a new value. |
| `dataValue` | `bytes` | The new bytes value to set. |

<br/>

Expand All @@ -193,20 +221,42 @@ _Sets singular data for a given `dataKey`_

:::

:::caution Warning

**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**.

:::

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

Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal
_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._

Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction.

<blockquote>

**Requirements:**

- SHOULD only be callable by the [`owner`](#owner) of the contract.

</blockquote>

<blockquote>

0. Emits a [`DataChanged`](#datachanged) event.
**Emitted events:**

- [`DataChanged`](#datachanged) event **for each data key/value pair set**.

</blockquote>

#### Parameters

| Name | Type | Description |
| ------------ | :---------: | ---------------------------------------- |
| `dataKeys` | `bytes32[]` | The array of data keys for values to set |
| `dataValues` | `bytes[]` | The array of values to set |
| Name | Type | Description |
| ------------ | :---------: | ---------------------------------------------------- |
| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. |
| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. |

<br/>

Expand Down Expand Up @@ -324,6 +374,25 @@ This pattern is useful in inheritance.
function _getData(bytes32 dataKey) internal view returns (bytes dataValue);
```

Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage,
represented as a mapping of `bytes32` data keys mapped to their `bytes` data values.

```solidity
mapping(bytes32 => bytes) _store
```

#### Parameters

| Name | Type | Description |
| --------- | :-------: | ----------------------------------------------------------------------- |
| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. |

#### Returns

| Name | Type | Description |
| ----------- | :-----: | ----------------------------------------------------------------------------- |
| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. |

<br/>

### \_setData
Expand All @@ -332,6 +401,28 @@ function _getData(bytes32 dataKey) internal view returns (bytes dataValue);
function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable;
```

Write a `dataValue` to the underlying ERC725Y storage, represented as a mapping of
`bytes32` data keys mapped to their `bytes` data values.

```solidity
mapping(bytes32 => bytes) _store
```

<blockquote>

**Emitted events:**

- [`DataChanged`](#datachanged) event emitted after a successful `setData` call.

</blockquote>

#### Parameters

| Name | Type | Description |
| ----------- | :-------: | ------------------------------------------------------------------------------- |
| `dataKey` | `bytes32` | A bytes32 data key to write the associated `bytes` value to the store. |
| `dataValue` | `bytes` | The `bytes` value to associate with the given `dataKey` in the ERC725Y storage. |

<br/>

## Events
Expand All @@ -351,14 +442,16 @@ function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable;
event DataChanged(bytes32 indexed dataKey, bytes dataValue);
```

_Emitted when data at a key is changed_
_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._

Emitted when data at a specific `dataKey` was changed to a new value `dataValue`.

#### Parameters

| Name | Type | Description |
| ----------------------- | :-------: | ------------------------------------ |
| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set |
| `dataValue` | `bytes` | The data value to set |
| Name | Type | Description |
| ----------------------- | :-------: | -------------------------------------------- |
| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. |
| `dataValue` | `bytes` | The value to set for the given data key. |

<br/>

Expand Down Expand Up @@ -403,7 +496,7 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
error ERC725Y_DataKeysValuesEmptyArray();
```

reverts when one of the array parameter provided to `setDataBatch` is an empty array
Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array.

<br/>

Expand All @@ -422,7 +515,7 @@ reverts when one of the array parameter provided to `setDataBatch` is an empty a
error ERC725Y_DataKeysValuesLengthMismatch();
```

reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch.
Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function.

<br/>

Expand All @@ -441,6 +534,6 @@ reverts when there is not the same number of elements in the lists of data keys
error ERC725Y_MsgValueDisallowed();
```

reverts when sending value to the `setData(..)` functions
Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function.

<br/>
Loading

0 comments on commit dc56820

Please sign in to comment.