diff --git a/docs/contracts/contracts/ERC725/ERC725.md b/docs/contracts/contracts/ERC725/ERC725.md new file mode 100644 index 0000000000..bc624a42a1 --- /dev/null +++ b/docs/contracts/contracts/ERC725/ERC725.md @@ -0,0 +1,748 @@ +# ERC725 + +:::info Solidity contract + +[`ERC725.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) + +::: + +> 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. + +## Methods + +### constructor + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#constructor) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) + +::: + +```solidity +constructor(address initialOwner); +``` + +_Deploying an ERC725 smart contract and setting address `initialOwner` as the contract owner._ + +Deploy a new ERC725 contract with the provided `initialOwner` as the contract [`owner`](#owner). + +
+ +**Requirements:** + +- `initialOwner` CANNOT be the zero address. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | -------------------------- | +| `initialOwner` | `address` | the owner of the contract. | + +### execute + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#execute) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `execute(uint256,address,uint256,bytes)` +- Function selector: `0x44c028fe` + +::: + +```solidity +function execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) external payable returns (bytes); +``` + +_Calling address `target` using `operationType`, transferring `value` wei and data: `data`. _ + +Generic executor function to: + +- send native tokens to any address. + +- interact with any contract by passing an abi-encoded function call in the `data` parameter. + +- deploy a contract by providing its creation bytecode in the `data` parameter. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. +- if a `value` is provided, the contract MUST have at least this amount to transfer to `target` from its balance and execute successfully. +- if the operation type is `STATICCALL` (`3`) or `DELEGATECALL` (`4`), `value` transfer is disallowed and SHOULD be 0. +- `target` SHOULD be `address(0)` when deploying a new contract via `operationType` `CREATE` (`1`), or `CREATE2` (`2`). + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event when a call is made with `operationType` 0 (CALL), 3 (STATICCALL) or 4 (DELEGATECALL). +- [`ContractCreated`](#contractcreated) event when deploying a new contract with `operationType` 1 (CREATE) or 2 (CREATE2). + +
+ +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `operationType` | `uint256` | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 | +| `target` | `address` | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2) | +| `value` | `uint256` | The amount of native tokens to transfer (in Wei) | +| `data` | `bytes` | The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------- | +| `0` | `bytes` | - | + +### executeBatch + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#executebatch) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` +- Function selector: `0x31858452` + +::: + +```solidity +function executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) external payable returns (bytes[]); +``` + +_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. + +
+ +**Requirements:** + +- All the array parameters provided MUST be equal and have the same length. +- SHOULD only be callable by the [`owner`](#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. + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event, when a call is made with `operationType` 0 (CALL), 3 (STATICCALL) or 4 (DELEGATECALL) +- [`ContractCreated`](#contractcreated) event, when deploying a contract with `operationType` 1 (CREATE) or 2 (CREATE2) + +
+ +#### Parameters + +| Name | Type | Description | +| ---------------- | :---------: | --------------------------------------------------------------------------------------------------------------- | +| `operationsType` | `uint256[]` | The list of operations type used: `CALL = 0`; `CREATE = 1`; `CREATE2 = 2`; `STATICCALL = 3`; `DELEGATECALL = 4` | +| `targets` | `address[]` | The list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2). | +| `values` | `uint256[]` | The list of native token amounts to transfer (in Wei). | +| `datas` | `bytes[]` | The list of calldata, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `bytes[]` | - | + +### getData + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#getdata) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#getdatabatch) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### owner + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#owner) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#renounceownership) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### setData + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#setdata) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#setdatabatch) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#supportsinterface) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#transferownership) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### ContractCreated + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#contractcreated) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Event signature: `ContractCreated(uint256,address,uint256,bytes32)` +- Event hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` + +::: + +```solidity +event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +``` + +_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._ + +Emitted when a new contract was created and deployed. + +#### Parameters + +| Name | Type | Description | +| ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | +| `contractAddress` **`indexed`** | `address` | The created contract address. | +| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | +| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#datachanged) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### Executed + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#executed) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Event signature: `Executed(uint256,address,uint256,bytes4)` +- Event hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` + +::: + +```solidity +event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +``` + +_Called address `target` using `operationType` with `value` wei and `data`._ + +Emitted when calling an address `target` (EOA or contract) with `value`. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The low-level call opcode used to call the `target` address (`CALL`, `STATICALL` or `DELEGATECALL`). | +| `target` **`indexed`** | `address` | The address to call. `target` will be unused if a contract is created (operation types 1 and 2). | +| `value` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | +| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#ownershiptransferred) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +--- + +## Errors + +### ERC725X_ContractDeploymentFailed + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_contractdeploymentfailed) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_ContractDeploymentFailed()` +- Error hash: `0x0b07489b` + +::: + +```solidity +error ERC725X_ContractDeploymentFailed(); +``` + +Reverts when contract deployment failed via [`execute`](#execute) or [`executeBatch`](#executebatch) functions, This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_CreateOperationsRequireEmptyRecipientAddress + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_createoperationsrequireemptyrecipientaddress) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` +- Error hash: `0x3041824a` + +::: + +```solidity +error ERC725X_CreateOperationsRequireEmptyRecipientAddress(); +``` + +Reverts when passing a `to` address that is not `address(0)` (= address zero) while deploying a contract via [`execute`](#execute) or [`executeBatch`](#executebatch) functions. This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_ExecuteParametersEmptyArray + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_executeparametersemptyarray) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +### ERC725X_ExecuteParametersLengthMismatch + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +### ERC725X_InsufficientBalance + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_insufficientbalance) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` +- Error hash: `0x0df9a8f8` + +::: + +```solidity +error ERC725X_InsufficientBalance(uint256 balance, uint256 value); +``` + +Reverts when trying to send more native tokens `value` than available in current `balance`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `balance` | `uint256` | The balance of native tokens of the ERC725X smart contract. | +| `value` | `uint256` | The amount of native tokens sent via `ERC725X.execute(...)`/`ERC725X.executeBatch(...)` that is greater than the contract's `balance`. | + +### ERC725X_MsgValueDisallowedInDelegateCall + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_msgvaluedisallowedindelegatecall) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_MsgValueDisallowedInDelegateCall()` +- Error hash: `0x5ac83135` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInDelegateCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `delegatecall` (`operationType == 4`). Sending native tokens via `staticcall` is not allowed because `msg.value` is persisting. + +### ERC725X_MsgValueDisallowedInStaticCall + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_msgvaluedisallowedinstaticcall) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` +- Error hash: `0x72f2bc6a` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInStaticCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `staticcall` (`operationType == 3`). Sending native tokens via `staticcall` is not allowed because it is a state changing operation. + +### ERC725X_NoContractBytecodeProvided + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_nocontractbytecodeprovided) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_NoContractBytecodeProvided()` +- Error hash: `0xb81cd8d9` + +::: + +```solidity +error ERC725X_NoContractBytecodeProvided(); +``` + +Reverts when no contract bytecode was provided as parameter when trying to deploy a contract via [`execute`](#execute) or [`executeBatch`](#executebatch). This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_UnknownOperationType + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725x_unknownoperationtype) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725X_UnknownOperationType(uint256)` +- Error hash: `0x7583b3bc` + +::: + +```solidity +error ERC725X_UnknownOperationType(uint256 operationTypeProvided); +``` + +Reverts when the `operationTypeProvided` is none of the default operation types available. (CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4) + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------ | +| `operationTypeProvided` | `uint256` | The unrecognised operation type number provided to `ERC725X.execute(...)`/`ERC725X.executeBatch(...)`. | + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-725-undefined**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-725-undefined.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**ERC725**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/ERC725) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md new file mode 100644 index 0000000000..601b3202c8 --- /dev/null +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -0,0 +1,1057 @@ +# LSP7Burnable + +:::info Solidity contract + +[`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) + +::: + +> LSP7 token extension that allows token holders to destroy both their own tokens and those that they have an allowance for as an operator. + +## Methods + +### authorizeOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#authorizeoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `authorizeOperator(address,uint256)` +- Function selector: `0x47980aa3` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to: 1. either call {revokeOperator} first, and then re-call {authorizeOperator} with the new amount. 2. or use the non-standard functions {increaseAllowance} or {decreaseAllowance}. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | + +### authorizedAmountFor + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#authorizedamountfor) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | -------------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +### balanceOf + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#balanceof) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +### burn + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#burn) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `burn(address,uint256,bytes)` +- Function selector: `0x44d17187` + +::: + +```solidity +function burn(address from, uint256 amount, bytes data) external nonpayable; +``` + +See internal [`_burn`](#_burn) function for details. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `from` | `address` | - | +| `amount` | `uint256` | - | +| `data` | `bytes` | - | + +### decimals + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#decimals) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +### decreaseAllowance + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#decreaseallowance) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `decreaseAllowance(address,uint256)` +- Function selector: `0xa457c2d7` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. + +::: + +```solidity +function decreaseAllowance( + address operator, + uint256 substractedAmount +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`substractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the zero address. +- `operator` must have allowance for the caller of at least `substractedAmount`. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. +- [`RevokeOperator`](#revokeoperator) event if `substractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------------- | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | the operator to decrease allowance for `msg.sender` | +| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. | + +### getData + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#getdata) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#getdatabatch) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### increaseAllowance + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#increaseallowance) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `increaseAllowance(address,uint256)` +- Function selector: `0x39509351` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the same address as `msg.sender` +- `operator` cannot be the zero address. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance + +
+ +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | --------------------------------------------------------------------------- | +| `operator` | `address` | the operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance | + +### owner + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#owner) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#renounceownership) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### revokeOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#revokeoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `revokeOperator(address)` +- Function selector: `0xfad8b32a` + +::: + +```solidity +function revokeOperator(address operator) external nonpayable; +``` + +Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens on behalf of the token owner (the caller of the function `msg.sender`). See also [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | + +### setData + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#setdata) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#setdatabatch) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#supportsinterface) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### totalSupply + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#totalsupply) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#transfer) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +### transferBatch + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#transferbatch) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `allowNonLSP1Recipient` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#transferownership) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### AuthorizedOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#authorizedoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Event signature: `AuthorizedOperator(address,address,uint256)` +- Event hash: `0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#datachanged) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#ownershiptransferred) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RevokedOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#revokedoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Event signature: `RevokedOperator(address,address)` +- Event hash: `0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | + +### Transfer + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#transfer) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `allowNonLSP1Recipient` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +--- + +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP4TokenNameNotEditable + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp4tokennamenoteditable) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP4TokenSymbolNotEditable + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp4tokensymbolnoteditable) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP7AmountExceedsAuthorizedAmount + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7AmountExceedsBalance + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7amountexceedsbalance) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7CannotSendToSelf + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7cannotsendtoself) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7CannotSendToSelf()` +- Error hash: `0xb9afb000` + +::: + +```solidity +error LSP7CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` or `to` in a token transfer. + +### LSP7CannotSendWithAddressZero + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7cannotsendwithaddresszero) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +### LSP7CannotUseAddressZeroAsOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +### LSP7DecreasedAllowanceBelowZero + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7decreasedallowancebelowzero) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +### LSP7InvalidTransferBatch + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7invalidtransferbatch) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7NotifyTokenReceiverIsEOA + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7TokenOwnerCannotBeOperator + +:::note Links + +- Specification details in [**LSP-7-Burnable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Burnable.md#lsp7tokenownercannotbeoperator) +- Solidity implementation in [**LSP7Burnable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Burnable) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md new file mode 100644 index 0000000000..fb2f7f6a14 --- /dev/null +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -0,0 +1,1095 @@ +# LSP7CappedSupply + +:::info Solidity contract + +[`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) + +::: + +LSP7 token extension to add a max token supply cap. + +## Methods + +### authorizeOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#authorizeoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `authorizeOperator(address,uint256)` +- Function selector: `0x47980aa3` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to: 1. either call {revokeOperator} first, and then re-call {authorizeOperator} with the new amount. 2. or use the non-standard functions {increaseAllowance} or {decreaseAllowance}. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | + +### authorizedAmountFor + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#authorizedamountfor) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | -------------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +### balanceOf + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#balanceof) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +### decimals + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#decimals) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +### decreaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#decreaseallowance) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `decreaseAllowance(address,uint256)` +- Function selector: `0xa457c2d7` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. + +::: + +```solidity +function decreaseAllowance( + address operator, + uint256 substractedAmount +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`substractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the zero address. +- `operator` must have allowance for the caller of at least `substractedAmount`. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. +- [`RevokeOperator`](#revokeoperator) event if `substractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------------- | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | the operator to decrease allowance for `msg.sender` | +| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. | + +### getData + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#getdata) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#getdatabatch) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### increaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#increaseallowance) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `increaseAllowance(address,uint256)` +- Function selector: `0x39509351` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the same address as `msg.sender` +- `operator` cannot be the zero address. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance + +
+ +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | --------------------------------------------------------------------------- | +| `operator` | `address` | the operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance | + +### owner + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#owner) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#renounceownership) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### revokeOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#revokeoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `revokeOperator(address)` +- Function selector: `0xfad8b32a` + +::: + +```solidity +function revokeOperator(address operator) external nonpayable; +``` + +Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens on behalf of the token owner (the caller of the function `msg.sender`). See also [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | + +### setData + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#setdata) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#setdatabatch) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#supportsinterface) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### tokenSupplyCap + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#tokensupplycap) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `tokenSupplyCap()` +- Function selector: `0x52058d8a` + +::: + +```solidity +function tokenSupplyCap() external view returns (uint256); +``` + +_The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`._ + +Get the maximum number of tokens that can exist to circulate. Once [`totalSupply`](#totalsupply) reaches reaches [`totalSuuplyCap`](#totalsuuplycap), it is not possible to mint more tokens. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------ | +| `0` | `uint256` | The maximum number of tokens that can exist in the contract. | + +### totalSupply + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#totalsupply) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#transfer) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +### transferBatch + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#transferbatch) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `allowNonLSP1Recipient` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#transferownership) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### AuthorizedOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#authorizedoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Event signature: `AuthorizedOperator(address,address,uint256)` +- Event hash: `0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#datachanged) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#ownershiptransferred) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RevokedOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#revokedoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Event signature: `RevokedOperator(address,address)` +- Event hash: `0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | + +### Transfer + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#transfer) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `allowNonLSP1Recipient` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +--- + +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP4TokenNameNotEditable + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp4tokennamenoteditable) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP4TokenSymbolNotEditable + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp4tokensymbolnoteditable) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP7AmountExceedsAuthorizedAmount + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7AmountExceedsBalance + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7amountexceedsbalance) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7CannotSendToSelf + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7cannotsendtoself) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7CannotSendToSelf()` +- Error hash: `0xb9afb000` + +::: + +```solidity +error LSP7CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` or `to` in a token transfer. + +### LSP7CannotSendWithAddressZero + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7cannotsendwithaddresszero) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +### LSP7CannotUseAddressZeroAsOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +### LSP7CappedSupplyCannotMintOverCap + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7cappedsupplycannotmintovercap) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7CappedSupplyCannotMintOverCap()` +- Error hash: `0xeacbf0d1` + +::: + +```solidity +error LSP7CappedSupplyCannotMintOverCap(); +``` + +_Cannot mint anymore as total supply reached the maximum cap._ + +Reverts when trying to mint tokens but the [`totalSupply`](#totalsupply) has reached the maximum [`tokenSupplyCap`](#tokensupplycap). + +### LSP7CappedSupplyRequired + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7cappedsupplyrequired) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7CappedSupplyRequired()` +- Error hash: `0xacf1d8c5` + +::: + +```solidity +error LSP7CappedSupplyRequired(); +``` + +_The `tokenSupplyCap` must be set and cannot be `0`._ + +Reverts when setting `0` for the [`tokenSupplyCap`](#tokensupplycap). The max token supply MUST be set to a number greater than 0. + +### LSP7DecreasedAllowanceBelowZero + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7decreasedallowancebelowzero) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +### LSP7InvalidTransferBatch + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7invalidtransferbatch) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7NotifyTokenReceiverIsEOA + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7TokenOwnerCannotBeOperator + +:::note Links + +- Specification details in [**LSP-7-CappedSupply**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CappedSupply.md#lsp7tokenownercannotbeoperator) +- Solidity implementation in [**LSP7CappedSupply**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CappedSupply) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md new file mode 100644 index 0000000000..f9b892e032 --- /dev/null +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -0,0 +1,1241 @@ +# LSP7CompatibleERC20 + +:::info Solidity contract + +[`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) + +::: + +LSP7 extension, for compatibility for clients / tools that expect ERC20. + +## Methods + +### allowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#allowance) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `allowance(address,address)` +- Function selector: `0xdd62ed3e` + +::: + +```solidity +function allowance( + address tokenOwner, + address operator +) external view returns (uint256); +``` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +### approve + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#approve) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `approve(address,uint256)` +- Function selector: `0x095ea7b3` + +::: + +```solidity +function approve( + address operator, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### authorizeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#authorizeoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `authorizeOperator(address,uint256)` +- Function selector: `0x47980aa3` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to: 1. either call {revokeOperator} first, and then re-call {authorizeOperator} with the new amount. 2. or use the non-standard functions {increaseAllowance} or {decreaseAllowance}. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | + +### authorizedAmountFor + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#authorizedamountfor) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | -------------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +### balanceOf + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#balanceof) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +### decimals + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#decimals) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +### decreaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#decreaseallowance) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `decreaseAllowance(address,uint256)` +- Function selector: `0xa457c2d7` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. + +::: + +```solidity +function decreaseAllowance( + address operator, + uint256 substractedAmount +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`substractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the zero address. +- `operator` must have allowance for the caller of at least `substractedAmount`. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. +- [`RevokeOperator`](#revokeoperator) event if `substractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------------- | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | the operator to decrease allowance for `msg.sender` | +| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. | + +### getData + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#getdata) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#getdatabatch) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### increaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#increaseallowance) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `increaseAllowance(address,uint256)` +- Function selector: `0x39509351` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the same address as `msg.sender` +- `operator` cannot be the zero address. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance + +
+ +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | --------------------------------------------------------------------------- | +| `operator` | `address` | the operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance | + +### name + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#name) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `name()` +- Function selector: `0x06fdde03` + +::: + +```solidity +function name() external view returns (string); +``` + +Returns the name of the token. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | --------------------- | +| `0` | `string` | The name of the token | + +### owner + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#owner) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#renounceownership) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### revokeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#revokeoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `revokeOperator(address)` +- Function selector: `0xfad8b32a` + +::: + +```solidity +function revokeOperator(address operator) external nonpayable; +``` + +Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens on behalf of the token owner (the caller of the function `msg.sender`). See also [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | + +### setData + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#setdata) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#setdatabatch) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#supportsinterface) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### symbol + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#symbol) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `symbol()` +- Function selector: `0x95d89b41` + +::: + +```solidity +function symbol() external view returns (string); +``` + +Returns the symbol of the token, usually a shorter version of the name. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------------------- | +| `0` | `string` | The symbol of the token | + +### totalSupply + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#totalsupply) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `transfer(address,uint256)` +- Function selector: `0xa9059cbb` + +::: + +:::info + +This function uses the `allowNonLSP1Recipient` parameter as `true` so that EOA and any contract can receive tokens. + +::: + +```solidity +function transfer( + address to, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `to` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transferbatch) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `allowNonLSP1Recipient` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +### transferFrom + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transferfrom) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `transferFrom(address,address,uint256)` +- Function selector: `0x23b872dd` + +::: + +:::info + +This function uses the `allowNonLSP1Recipient` parameter as `true` so that EOA and any contract can receive tokens. + +::: + +```solidity +function transferFrom( + address from, + address to, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `from` | `address` | - | +| `to` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transferownership) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### Approval + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#approval) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `Approval(address,address,uint256)` +- Event hash: `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` + +::: + +```solidity +event Approval(address indexed owner, address indexed spender, uint256 value); +``` + +ERC20 `Approval` event emitted when `owner` enables `spender` for `value` tokens. To provide compatibility with indexing ERC20 events. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | --------------------------------------------------------- | +| `owner` **`indexed`** | `address` | The account giving approval | +| `spender` **`indexed`** | `address` | The account receiving approval | +| `value` | `uint256` | The amount of tokens `spender` has access to from `owner` | + +### AuthorizedOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#authorizedoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `AuthorizedOperator(address,address,uint256)` +- Event hash: `0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#datachanged) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#ownershiptransferred) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RevokedOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#revokedoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `RevokedOperator(address,address)` +- Event hash: `0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | + +### Transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `allowNonLSP1Recipient` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +--- + +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP4TokenNameNotEditable + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp4tokennamenoteditable) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP4TokenSymbolNotEditable + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp4tokensymbolnoteditable) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP7AmountExceedsAuthorizedAmount + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7AmountExceedsBalance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7amountexceedsbalance) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7CannotSendToSelf + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7cannotsendtoself) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7CannotSendToSelf()` +- Error hash: `0xb9afb000` + +::: + +```solidity +error LSP7CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` or `to` in a token transfer. + +### LSP7CannotSendWithAddressZero + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7cannotsendwithaddresszero) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +### LSP7CannotUseAddressZeroAsOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +### LSP7DecreasedAllowanceBelowZero + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7decreasedallowancebelowzero) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +### LSP7InvalidTransferBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7invalidtransferbatch) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7NotifyTokenReceiverIsEOA + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7TokenOwnerCannotBeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20.md#lsp7tokenownercannotbeoperator) +- Solidity implementation in [**LSP7CompatibleERC20**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md new file mode 100644 index 0000000000..795861faf6 --- /dev/null +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -0,0 +1,1295 @@ +# LSP7CompatibleERC20Mintable + +:::info Solidity contract + +[`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) + +::: + +> LSP7CompatibleERC20 deployable preset contract with a public {mint} function callable only by the contract {owner}. + +## Methods + +### constructor + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#constructor) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) + +::: + +```solidity +constructor(string name_, string symbol_, address newOwner_); +``` + +_Deploying a `LSP7CompatibleERC20Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and address `newOwner_` as the token contract owner._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | -------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | + +### allowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#allowance) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `allowance(address,address)` +- Function selector: `0xdd62ed3e` + +::: + +```solidity +function allowance( + address tokenOwner, + address operator +) external view returns (uint256); +``` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +### approve + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#approve) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `approve(address,uint256)` +- Function selector: `0x095ea7b3` + +::: + +```solidity +function approve( + address operator, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### authorizeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#authorizeoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `authorizeOperator(address,uint256)` +- Function selector: `0x47980aa3` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to: 1. either call {revokeOperator} first, and then re-call {authorizeOperator} with the new amount. 2. or use the non-standard functions {increaseAllowance} or {decreaseAllowance}. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | + +### authorizedAmountFor + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#authorizedamountfor) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | -------------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +### balanceOf + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#balanceof) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +### decimals + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#decimals) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +### decreaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#decreaseallowance) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `decreaseAllowance(address,uint256)` +- Function selector: `0xa457c2d7` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. + +::: + +```solidity +function decreaseAllowance( + address operator, + uint256 substractedAmount +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`substractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the zero address. +- `operator` must have allowance for the caller of at least `substractedAmount`. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. +- [`RevokeOperator`](#revokeoperator) event if `substractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------------- | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | the operator to decrease allowance for `msg.sender` | +| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. | + +### getData + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#getdata) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#getdatabatch) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### increaseAllowance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#increaseallowance) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `increaseAllowance(address,uint256)` +- Function selector: `0x39509351` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the same address as `msg.sender` +- `operator` cannot be the zero address. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance + +
+ +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | --------------------------------------------------------------------------- | +| `operator` | `address` | the operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance | + +### mint + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#mint) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `mint(address,uint256,bool,bytes)` +- Function selector: `0x7580d920` + +::: + +```solidity +function mint( + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `to` | `address` | - | +| `amount` | `uint256` | - | +| `allowNonLSP1Recipient` | `bool` | - | +| `data` | `bytes` | - | + +### name + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#name) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `name()` +- Function selector: `0x06fdde03` + +::: + +```solidity +function name() external view returns (string); +``` + +Returns the name of the token. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | --------------------- | +| `0` | `string` | The name of the token | + +### owner + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#owner) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#renounceownership) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### revokeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#revokeoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `revokeOperator(address)` +- Function selector: `0xfad8b32a` + +::: + +```solidity +function revokeOperator(address operator) external nonpayable; +``` + +Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens on behalf of the token owner (the caller of the function `msg.sender`). See also [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | + +### setData + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#setdata) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#setdatabatch) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#supportsinterface) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### symbol + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#symbol) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `symbol()` +- Function selector: `0x95d89b41` + +::: + +```solidity +function symbol() external view returns (string); +``` + +Returns the symbol of the token, usually a shorter version of the name. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------------------- | +| `0` | `string` | The symbol of the token | + +### totalSupply + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#totalsupply) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `transfer(address,uint256)` +- Function selector: `0xa9059cbb` + +::: + +:::info + +This function uses the `allowNonLSP1Recipient` parameter as `true` so that EOA and any contract can receive tokens. + +::: + +```solidity +function transfer( + address to, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `to` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transferbatch) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `allowNonLSP1Recipient` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +### transferFrom + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transferfrom) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `transferFrom(address,address,uint256)` +- Function selector: `0x23b872dd` + +::: + +:::info + +This function uses the `allowNonLSP1Recipient` parameter as `true` so that EOA and any contract can receive tokens. + +::: + +```solidity +function transferFrom( + address from, + address to, + uint256 amount +) external nonpayable returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `from` | `address` | - | +| `to` | `address` | - | +| `amount` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transferownership) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### Approval + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#approval) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `Approval(address,address,uint256)` +- Event hash: `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` + +::: + +```solidity +event Approval(address indexed owner, address indexed spender, uint256 value); +``` + +ERC20 `Approval` event emitted when `owner` enables `spender` for `value` tokens. To provide compatibility with indexing ERC20 events. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | --------------------------------------------------------- | +| `owner` **`indexed`** | `address` | The account giving approval | +| `spender` **`indexed`** | `address` | The account receiving approval | +| `value` | `uint256` | The amount of tokens `spender` has access to from `owner` | + +### AuthorizedOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#authorizedoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `AuthorizedOperator(address,address,uint256)` +- Event hash: `0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#datachanged) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#ownershiptransferred) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RevokedOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#revokedoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `RevokedOperator(address,address)` +- Event hash: `0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | + +### Transfer + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#transfer) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `allowNonLSP1Recipient` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +--- + +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP4TokenNameNotEditable + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp4tokennamenoteditable) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP4TokenSymbolNotEditable + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp4tokensymbolnoteditable) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP7AmountExceedsAuthorizedAmount + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7AmountExceedsBalance + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7amountexceedsbalance) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7CannotSendToSelf + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7cannotsendtoself) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7CannotSendToSelf()` +- Error hash: `0xb9afb000` + +::: + +```solidity +error LSP7CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` or `to` in a token transfer. + +### LSP7CannotSendWithAddressZero + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7cannotsendwithaddresszero) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +### LSP7CannotUseAddressZeroAsOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +### LSP7DecreasedAllowanceBelowZero + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7decreasedallowancebelowzero) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +### LSP7InvalidTransferBatch + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7invalidtransferbatch) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7NotifyTokenReceiverIsEOA + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7TokenOwnerCannotBeOperator + +:::note Links + +- Specification details in [**LSP-7-CompatibleERC20Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-CompatibleERC20Mintable.md#lsp7tokenownercannotbeoperator) +- Solidity implementation in [**LSP7CompatibleERC20Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7CompatibleERC20Mintable) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md new file mode 100644 index 0000000000..693aa36f76 --- /dev/null +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -0,0 +1,1092 @@ +# LSP7Mintable + +:::info Solidity contract + +[`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) + +::: + +> LSP7DigitalAsset deployable preset contract with a public {mint} function callable only by the contract {owner}. + +## Methods + +### constructor + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#constructor) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) + +::: + +```solidity +constructor( + string name_, + string symbol_, + address newOwner_, + bool isNonDivisible_ +); +``` + +_Deploying a `LSP7Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and address `newOwner_` as the token contract owner._ + +#### Parameters + +| Name | Type | Description | +| ----------------- | :-------: | -------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | +| `isNonDivisible_` | `bool` | - | + +### authorizeOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#authorizeoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `authorizeOperator(address,uint256)` +- Function selector: `0x47980aa3` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to: 1. either call {revokeOperator} first, and then re-call {authorizeOperator} with the new amount. 2. or use the non-standard functions {increaseAllowance} or {decreaseAllowance}. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | + +### authorizedAmountFor + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#authorizedamountfor) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | -------------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +### balanceOf + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#balanceof) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +### decimals + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#decimals) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +### decreaseAllowance + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#decreaseallowance) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `decreaseAllowance(address,uint256)` +- Function selector: `0xa457c2d7` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. + +::: + +```solidity +function decreaseAllowance( + address operator, + uint256 substractedAmount +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`substractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the zero address. +- `operator` must have allowance for the caller of at least `substractedAmount`. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. +- [`RevokeOperator`](#revokeoperator) event if `substractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------------- | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | the operator to decrease allowance for `msg.sender` | +| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. | + +### getData + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#getdata) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#getdatabatch) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### increaseAllowance + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#increaseallowance) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `increaseAllowance(address,uint256)` +- Function selector: `0x39509351` + +::: + +:::info + +This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. + +
+ +**Requirements:** + +- `operator` cannot be the same address as `msg.sender` +- `operator` cannot be the zero address. + +
+ +
+ +**Emitted events:** + +- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance + +
+ +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | --------------------------------------------------------------------------- | +| `operator` | `address` | the operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance | + +### mint + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#mint) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `mint(address,uint256,bool,bytes)` +- Function selector: `0x7580d920` + +::: + +```solidity +function mint( + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `to` | `address` | - | +| `amount` | `uint256` | - | +| `allowNonLSP1Recipient` | `bool` | - | +| `data` | `bytes` | - | + +### owner + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#owner) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#renounceownership) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +### revokeOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#revokeoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `revokeOperator(address)` +- Function selector: `0xfad8b32a` + +::: + +```solidity +function revokeOperator(address operator) external nonpayable; +``` + +Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens on behalf of the token owner (the caller of the function `msg.sender`). See also [`authorizedAmountFor`](#authorizedamountfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | + +### setData + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#setdata) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#setdatabatch) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::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; +``` + +_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. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#supportsinterface) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### totalSupply + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#totalsupply) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +### transfer + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#transfer) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +### transferBatch + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#transferbatch) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `allowNonLSP1Recipient` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#transferownership) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +--- + +## Events + +### AuthorizedOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#authorizedoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Event signature: `AuthorizedOperator(address,address,uint256)` +- Event hash: `0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#datachanged) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#ownershiptransferred) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RevokedOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#revokedoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Event signature: `RevokedOperator(address,address)` +- Event hash: `0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | + +### Transfer + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#transfer) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `allowNonLSP1Recipient` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +--- + +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP4TokenNameNotEditable + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp4tokennamenoteditable) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP4TokenSymbolNotEditable + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp4tokensymbolnoteditable) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +### LSP7AmountExceedsAuthorizedAmount + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7AmountExceedsBalance + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7amountexceedsbalance) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +### LSP7CannotSendToSelf + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7cannotsendtoself) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7CannotSendToSelf()` +- Error hash: `0xb9afb000` + +::: + +```solidity +error LSP7CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` or `to` in a token transfer. + +### LSP7CannotSendWithAddressZero + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7cannotsendwithaddresszero) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +### LSP7CannotUseAddressZeroAsOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +### LSP7DecreasedAllowanceBelowZero + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7decreasedallowancebelowzero) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +### LSP7InvalidTransferBatch + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7invalidtransferbatch) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7NotifyTokenReceiverIsEOA + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +### LSP7TokenOwnerCannotBeOperator + +:::note Links + +- Specification details in [**LSP-7-Mintable**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-Mintable.md#lsp7tokenownercannotbeoperator) +- Solidity implementation in [**LSP7Mintable**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7Mintable) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. diff --git a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md new file mode 100644 index 0000000000..f79aa64313 --- /dev/null +++ b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md @@ -0,0 +1,1276 @@ +# LSP9Vault + +:::info Soldity contract + +[`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) + +::: + +> Implementation of LSP9Vault built on top of [ERC725], [LSP-1-UniversalReceiver] + +Could be owned by an EOA or by a contract and is able to receive and send assets. Also allows for registering received assets by levereging the key-value storage. + +## Methods + +### constructor + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#constructor) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) + +::: + +```solidity +constructor(address newOwner); +``` + +_New owner set, `newOwner`._ + +Sets the owner of the contract and sets the `SupportedStandards:LSP9Vault` Data Key. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------ | +| `newOwner` | `address` | The new owner of the contract. | + +### fallback + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#fallback) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) + +::: + +```solidity +fallback() external payable; +``` + +Forwards the call to an extension contract (address). This address can be retrieved from the ERC725Y data key-value store using the data key below (function selector appended to the prefix): `_LSP17_FALLBACK_EXTENSIONS_HANDLER_ + function-selector`. If there is no extension stored under the data key, return. +The call to the extension is appended with bytes20 (msg.sender) and bytes32 (msg.value). +Returns the return value on success and revert in case of failure. +If the `msg.data` is shorter than 4 bytes do not check for an extension and return. +Executed when: + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens with some calldata. + +
+ +**Emitted events:** + +- [`ValueReceived`](#valuereceived) when receiving native tokens. + +
+ +### receive + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#receive) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) + +::: + +```solidity +receive() external payable; +``` + +Executed: + +- When receiving some native tokens without any additional data. + +- On empty calls to the contract. + +
+ +**Emitted events:** + +- [`ValueReceived`](#valuereceived) when receiving native tokens. + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#renounce_ownership_confirmation_delay) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` +- Function selector: `0xead3fbdf` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +### RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#renounce_ownership_confirmation_period) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` +- Function selector: `0x01bfba61` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +### acceptOwnership + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#acceptownership) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `acceptOwnership()` +- Function selector: `0x79ba5097` + +::: + +```solidity +function acceptOwnership() external nonpayable; +``` + +Transfer ownership of the contract from the current [`owner()`](#`owner) to the [`pendingOwner()`](#`pendingowner). Once this function is called: + +- the current [`owner()`](#`owner) will loose access to the functions restricted to the [`owner()`](#`owner) only. + +- the [`pendingOwner()`](#`pendingowner) will gain access to the functions restricted to the [`owner()`](#`owner) only. + +
+ +**Requirements:** + +- When notifying the previous owner via LSP1, the typeId used MUST be `keccak256('LSP9OwnershipTransferred_SenderNotification')` +- When notifying the new owner via LSP1, the typeId used MUST be `keccak256('LSP9OwnershipTransferred_RecipientNotification')` + +
+ +### batchCalls + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#batchcalls) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. It is not possible to send value along the functions call due to the use of `delegatecall`. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------------------------ | +| `results` | `bytes[]` | An array of values returned by the executed functions. | + +### execute + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#execute) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `execute(uint256,address,uint256,bytes)` +- Function selector: `0x44c028fe` + +::: + +:::info + +The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault. + +::: + +```solidity +function execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) external payable returns (bytes); +``` + +_Calling address `target` using `operationType`, transferring `value` wei and data: `data`. _ + +Generic executor function to: + +- send native tokens to any address. + +- interact with any contract by passing an abi-encoded function call in the `data` parameter. + +- deploy a contract by providing its creation bytecode in the `data` parameter. + +
+ +**Emitted events:** + +- [`Executed`](#executed) event, when a call is executed under `operationType` 0 and 3. +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType` 1 and 2. +- [`ValueReceived`](#valuereceived) event, when receives native token. + +
+ +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `operationType` | `uint256` | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 | +| `target` | `address` | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2) | +| `value` | `uint256` | The amount of native tokens to transfer (in Wei) | +| `data` | `bytes` | The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------- | +| `0` | `bytes` | - | + +### executeBatch + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#executebatch) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` +- Function selector: `0x31858452` + +::: + +:::info + +The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault. + +::: + +```solidity +function executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) external payable returns (bytes[]); +``` + +_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. + +
+ +**Emitted events:** + +- [`Executed`](#executed) event, when a call is executed under `operationType` 0 and 3. +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType` 1 and 2. +- [`ValueReceived`](#valuereceived) event, when receives native token. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------------- | :---------: | --------------------------------------------------------------------------------------------------------------- | +| `operationsType` | `uint256[]` | The list of operations type used: `CALL = 0`; `CREATE = 1`; `CREATE2 = 2`; `STATICCALL = 3`; `DELEGATECALL = 4` | +| `targets` | `address[]` | The list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2). | +| `values` | `uint256[]` | The list of native token amounts to transfer (in Wei). | +| `datas` | `bytes[]` | The list of calldata, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `bytes[]` | - | + +### getData + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#getdata) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_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 data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +### getDataBatch + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#getdatabatch) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_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 + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +### owner + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#owner) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### pendingOwner + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#pendingowner) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `pendingOwner()` +- Function selector: `0xe30c3978` + +::: + +```solidity +function pendingOwner() external view returns (address); +``` + +The address that ownership of the contract is transferred to. This address may use [`acceptOwnership()`](#acceptownership) to gain ownership of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +### renounceOwnership + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#renounceownership) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Renounce ownership of the contract in a two step process. + +1. the first call will initiate the process of renouncing ownership. + +2. the second is used as a confirmation and will leave the contract without an owner. + +### setData + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#setdata) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +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`. _ + +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. + +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +### setDataBatch + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#setdatabatch) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +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`. _ + +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. + +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| 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`. | + +### supportsInterface + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#supportsinterface) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. If the contract doesn't support the `interfaceId`, it forwards the call to the `supportsInterface` extension according to LSP17, and checks if the extension implements the interface defined by `interfaceId`. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +### transferOwnership + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#transferownership) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the [`universalReceiver()`](#`universalreceiver) function on the `newOwner` contract. + +
+ +**Requirements:** + +- When notifying the new owner via LSP1, the typeId used MUST be `keccak256('LSP9OwnershipTransferStarted')` + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------------- | +| `newOwner` | `address` | the address of the new owner. | + +### universalReceiver + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#universalreceiver) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `universalReceiver(bytes32,bytes)` +- Function selector: `0x6bb56a14` + +::: + +```solidity +function universalReceiver( + bytes32 typeId, + bytes receivedData +) external payable returns (bytes returnedValues); +``` + +_Forwards the call to the addresses stored in the [ERC725Y] storage under the the Vault version of [LSP1UniversalReceiverDelegate] Data Key and the `typeId` Key (param) respectively. The call will be discarded if no addresses are set._ + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) when this function gets executed successfully. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | -------------------------- | +| `typeId` | `bytes32` | The type of call received. | +| `receivedData` | `bytes` | The data received. | + +#### Returns + +| Name | Type | Description | +| ---------------- | :-----: | ------------------------------------------------------------------------------------------------------------------------------ | +| `returnedValues` | `bytes` | The ABI encoded return value of the the Vault version of [LSP1UniversalReceiverDelegate] call and the LSP1TypeIdDelegate call. | + +## Events + +### ContractCreated + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#contractcreated) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `ContractCreated(uint256,address,uint256,bytes32)` +- Event hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` + +::: + +```solidity +event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +``` + +_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._ + +Emitted when a new contract was created and deployed. + +#### Parameters + +| Name | Type | Description | +| ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | +| `contractAddress` **`indexed`** | `address` | The created contract address. | +| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | +| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | + +### DataChanged + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#datachanged) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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 for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +### Executed + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#executed) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `Executed(uint256,address,uint256,bytes4)` +- Event hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` + +::: + +```solidity +event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +``` + +_Called address `target` using `operationType` with `value` wei and `data`._ + +Emitted when calling an address `target` (EOA or contract) with `value`. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The low-level call opcode used to call the `target` address (`CALL`, `STATICALL` or `DELEGATECALL`). | +| `target` **`indexed`** | `address` | The address to call. `target` will be unused if a contract is created (operation types 1 and 2). | +| `value` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | +| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | + +### OwnershipRenounced + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#ownershiprenounced) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `OwnershipRenounced()` +- Event hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` + +::: + +```solidity +event OwnershipRenounced(); +``` + +emitted when the ownership of the contract has been renounced. + +### OwnershipTransferStarted + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#ownershiptransferstarted) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `OwnershipTransferStarted(address,address)` +- Event hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` + +::: + +```solidity +event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); +``` + +emitted when starting the `transferOwnership(..)` 2-step process. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### OwnershipTransferred + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#ownershiptransferred) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +### RenounceOwnershipStarted + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#renounceownershipstarted) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `RenounceOwnershipStarted()` +- Event hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` + +::: + +```solidity +event RenounceOwnershipStarted(); +``` + +emitted when starting the `renounceOwnership(..)` 2-step process. + +### UniversalReceiver + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#universalreceiver) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` +- Event hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` + +::: + +```solidity +event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 indexed typeId, bytes receivedData, bytes returnedValue); +``` + +_Emitted when the universalReceiver function is succesfully executed_ + +#### Parameters + +| Name | Type | Description | +| ---------------------- | :-------: | ------------------------------------------------------- | +| `from` **`indexed`** | `address` | The address calling the universalReceiver function | +| `value` **`indexed`** | `uint256` | The amount sent to the universalReceiver function | +| `typeId` **`indexed`** | `bytes32` | The hash of a specific standard or a hook | +| `receivedData` | `bytes` | The arbitrary data passed to universalReceiver function | +| `returnedValue` | `bytes` | The value returned by the universalReceiver function | + +### ValueReceived + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#valuereceived) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Event signature: `ValueReceived(address,uint256)` +- Event hash: `0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493` + +::: + +```solidity +event ValueReceived(address indexed sender, uint256 indexed value); +``` + +_Emitted when receiving native tokens._ + +#### Parameters + +| Name | Type | Description | +| ---------------------- | :-------: | ------------------------------------- | +| `sender` **`indexed`** | `address` | The address of the sender. | +| `value` **`indexed`** | `uint256` | The amount of native tokens received. | + +## Errors + +### CannotTransferOwnershipToSelf + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#cannottransferownershiptoself) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `CannotTransferOwnershipToSelf()` +- Error hash: `0x43b248cd` + +::: + +```solidity +error CannotTransferOwnershipToSelf(); +``` + +reverts when trying to transfer ownership to the address(this) + +### ERC725X_ContractDeploymentFailed + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_contractdeploymentfailed) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_ContractDeploymentFailed()` +- Error hash: `0x0b07489b` + +::: + +```solidity +error ERC725X_ContractDeploymentFailed(); +``` + +Reverts when contract deployment failed via [`execute`](#execute) or [`executeBatch`](#executebatch) functions, This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_CreateOperationsRequireEmptyRecipientAddress + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_createoperationsrequireemptyrecipientaddress) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` +- Error hash: `0x3041824a` + +::: + +```solidity +error ERC725X_CreateOperationsRequireEmptyRecipientAddress(); +``` + +Reverts when passing a `to` address that is not `address(0)` (= address zero) while deploying a contract via [`execute`](#execute) or [`executeBatch`](#executebatch) functions. This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_ExecuteParametersEmptyArray + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_executeparametersemptyarray) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +### ERC725X_ExecuteParametersLengthMismatch + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +### ERC725X_InsufficientBalance + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_insufficientbalance) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` +- Error hash: `0x0df9a8f8` + +::: + +```solidity +error ERC725X_InsufficientBalance(uint256 balance, uint256 value); +``` + +Reverts when trying to send more native tokens `value` than available in current `balance`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `balance` | `uint256` | The balance of native tokens of the ERC725X smart contract. | +| `value` | `uint256` | The amount of native tokens sent via `ERC725X.execute(...)`/`ERC725X.executeBatch(...)` that is greater than the contract's `balance`. | + +### ERC725X_MsgValueDisallowedInStaticCall + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_msgvaluedisallowedinstaticcall) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` +- Error hash: `0x72f2bc6a` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInStaticCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `staticcall` (`operationType == 3`). Sending native tokens via `staticcall` is not allowed because it is a state changing operation. + +### ERC725X_NoContractBytecodeProvided + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_nocontractbytecodeprovided) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_NoContractBytecodeProvided()` +- Error hash: `0xb81cd8d9` + +::: + +```solidity +error ERC725X_NoContractBytecodeProvided(); +``` + +Reverts when no contract bytecode was provided as parameter when trying to deploy a contract via [`execute`](#execute) or [`executeBatch`](#executebatch). This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +### ERC725X_UnknownOperationType + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725x_unknownoperationtype) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725X_UnknownOperationType(uint256)` +- Error hash: `0x7583b3bc` + +::: + +```solidity +error ERC725X_UnknownOperationType(uint256 operationTypeProvided); +``` + +Reverts when the `operationTypeProvided` is none of the default operation types available. (CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4) + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------ | +| `operationTypeProvided` | `uint256` | The unrecognised operation type number provided to `ERC725X.execute(...)`/`ERC725X.executeBatch(...)`. | + +### ERC725Y_DataKeysValuesLengthMismatch + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +### ERC725Y_MsgValueDisallowed + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#erc725y_msgvaluedisallowed) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +### LSP1DelegateNotAllowedToSetDataKey + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#lsp1delegatenotallowedtosetdatakey) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `LSP1DelegateNotAllowedToSetDataKey(bytes32)` +- Error hash: `0x199611f1` + +::: + +```solidity +error LSP1DelegateNotAllowedToSetDataKey(bytes32 dataKey); +``` + +_Couldn't set the Data Key: `dataKey`._ + +Reverts when the Vault version of [LSP1UniversalReceiverDelegate] sets LSP1/6/17 Data Keys. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The data key that the Vault version of [LSP1UniversalReceiverDelegate] is not allowed to set. | + +### NoExtensionFoundForFunctionSelector + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#noextensionfoundforfunctionselector) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +### NotInRenounceOwnershipInterval + +:::note Links + +- Specification details in [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#notinrenounceownershipinterval) +- Solidity implementation in [**LSP9Vault**](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x8b9bf507` + +::: + +```solidity +error NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +reverts when trying to renounce ownership before the initial confirmation delay + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------- | +| `renounceOwnershipStart` | `uint256` | - | +| `renounceOwnershipEnd` | `uint256` | - | + + + + + +[ERC-725]: https://github.com/ERC725Alliance/ERC725/blob/main/docs/ERC-725.md +[LSP-0-ERC725Account]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-0-ERC725Account.md +[LSP-1-UniversalReceiver]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-1-UniversalReceiver.md +[LSP-2-ERC725YJSONSchema]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-2-ERC725YJSONSchema.md +[LSP-3-UniversalProfile-Metadata]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md +[LSP-4-DigitalAsset-Metadata]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-4-DigitalAsset-Metadata.md +[LSP-5-ReceivedAssets]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-5-ReceivedAssets.md +[LSP-6-KeyManager]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-6-KeyManager.md +[LSP-7-DigitalAsset]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-7-DigitalAsset.md +[LSP-8-IdentifiableDigitalAsset]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md +[LSP-9-Vault.md]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-9-Vault.md.md +[LSP-10-ReceivedVaults]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-10-ReceivedVaults.md +[LSP-11-BasicSocialRecovery]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-11-BasicSocialRecovery.md +[LSP-12-IssuedAssets]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-12-IssuedAssets.md +[LSP-14-Ownable2Step]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-14-Ownable2Step.md +[LSP-15-TransactionRelayServiceAPI]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-15-TransactionRelayServiceAPI.md +[LSP-16-UniversalFactory]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-16-UniversalFactory.md +[LSP-17-ContractExtension]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-17-ContractExtension.md +[LSP-20-CallVerification]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-20-CallVerification.md + + + +[ERC725]: https://docs.lukso.tech/standards/lsp-background/erc725 +[UniversalProfile]: https://docs.lukso.tech/standards/universal-profile/introduction +[LSP0ERC725Account]: https://docs.lukso.tech/standards/universal-profile/lsp0-erc725account +[LSP1UniversalReceiver]: https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver +[LSP1UniversalReceiverDelegate]: https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver-delegate +[LSP2ERC725YJSONSchema]: https://docs.lukso.tech/standards/generic-standards/lsp2-json-schema +[LSP4DigitalAssetMetadata]: https://docs.lukso.tech/standards/nft-2.0/LSP4-Digital-Asset-Metadata +[LSP5ReceivedVaults]: https://docs.lukso.tech/standards/universal-profile/lsp5-received-assets +[LSP6KeyManager]: https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager +[LSP7DigitalAsset]: https://docs.lukso.tech/standards/nft-2.0/LSP7-Digital-Asset +[LSP8IdentifiableDigitalAsset]: https://docs.lukso.tech/standards/nft-2.0/LSP8-Identifiable-Digital-Asset +[LSP10ReceivedVaults]: https://docs.lukso.tech/standards/universal-profile/lsp10-received-vaults +[LSP14Ownable2Step]: https://docs.lukso.tech/standards/generic-standards/lsp14-ownable-2-step +[LSP17ContractExtension]: https://docs.lukso.tech/standards/generic-standards/lsp17-contract-extension +[LSP20CallVerification]: https://docs.lukso.tech/standards/generic-standards/lsp20-call-verification + + + +[`ERC725.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725.sol +[`ERC725Init.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725Init.sol +[`ERC725InitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725InitAbstract +[`IERC725X.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/interfaces/IERC725X.sol +[`ERC725XInit.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725XInit.sol +[`ERC725XInitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725XInitAbstract.sol +[`IERC725Y.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/interfaces/IERC725Y.sol +[`ERC725YInit.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725YInit.sol +[`ERC725YInitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725YInitAbstract.sol + + + +[`Create2.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Create2.sol +[`ECDSA.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol +[`ERC165Checker.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/ERC165Checker.sol +[`Address.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol +[`ERC165.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/ERC165.sol +[`Initializable.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/proxy/utils/Initializable.sol +[`EnumerableSet.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol +[`ERC725Y.sol`]: https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725Y.sol +[`ERC725YCore.sol`]: https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725YCore.sol +[`ERC725X.sol`]: https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725X.sol +[`ERC725XCore.sol`]: https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725XCore.sol +[`OwnableUnset.sol`]: https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/custom/OwnableUnset.sol +[`BytesLib.sol`]: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol + + + +[`LSP0ERC725AccountCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +[`LSP0Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0Utils.sol +[`LSP0ERC725AccountInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +[`ILSP0ERC725Account.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +[`LSP0ERC725Account.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +[`LSP0ERC725AccountInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +[`LSP0Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0Constants.sol +[`UniversalProfileInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfileInitAbstract.sol +[`UniversalProfile.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfile.sol +[`UniversalProfileInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfileInit.sol +[`LSP1UniversalReceiverDelegateUP.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +[`LSP1Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Utils.sol +[`LSP1UniversalReceiverDelegateVault.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +[`ILSP1UniversalReceiver.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +[`LSP1Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Constants.sol +[`LSP1Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Errors.sol +[`LSP4DigitalAssetMetadataInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +[`LSP4DigitalAssetMetadata.sol`]: chttps://github.com/code-423n4/2023-06-lukso/tree/main/ontracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +[`LSP4Compatibility.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +[`LSP4Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +[`ILSP4Compatibility.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +[`LSP4Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +[`LSP6SetDataModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +[`LSP6KeyManagerCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +[`LSP6ExecuteModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +[`LSP6Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Utils.sol +[`LSP6Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Constants.sol +[`ILSP6KeyManager.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/ILSP6KeyManager.sol +[`LSP6Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Errors.sol +[`LSP6OwnershipModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +[`LSP6KeyManagerInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +[`LSP6KeyManager.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManager.sol +[`LSP6KeyManagerInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +[`LSP7DigitalAssetCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +[`LSP7CompatibleERC20InitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +[`LSP7CompatibleERC20.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +[`ILSP7DigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +[`LSP7DigitalAssetInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +[`LSP7CappedSupply.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +[`LSP7CappedSupplyInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +[`LSP7DigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +[`LSP7MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +[`LSP7CompatibleERC20MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +[`LSP7Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +[`LSP7CompatibleERC20Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +[`LSP7Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7Errors.sol +[`LSP7CompatibleERC20MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +[`LSP7MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +[`ILSP7CompatibleERC20.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +[`ILSP7Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +[`LSP7Burnable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +[`LSP7BurnableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +[`LSP7Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7Constants.sol +[`LSP8IdentifiableDigitalAssetCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +[`LSP8CompatibleERC721InitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +[`LSP8CompatibleERC721.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +[`ILSP8IdentifiableDigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +[`LSP8EnumerableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +[`LSP8Enumerable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +[`LSP8CappedSupplyInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +[`LSP8CappedSupply.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +[`LSP8IdentifiableDigitalAssetInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +[`LSP8MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +[`ILSP8CompatibleERC721.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +[`LSP8IdentifiableDigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +[`LSP8CompatibleERC721MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.s +[`LSP8Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +[`LSP8CompatibleERC721Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +[`LSP8CompatibleERC721MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +[`LSP8Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +[`LSP8MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +[`LSP8Burnable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +[`ILSP8Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +[`LSP8Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.s +[`LSP14Ownable2Step.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +[`ILSP14Ownable2Step.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +[`LSP14Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Constants.sol +[`LSP14Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Errors.sol +[`LSP17Extendable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Extendable.sol +[`LSP17Extension.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Extension.sol +[`LSP17Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Constants.sol +[`LSP17Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Errors.sol +[`LSP17Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Utils.sol +[`LSP20CallVerification.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20CallVerification.sol +[`ILSP20CallVerifier.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +[`LSP20Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20Constants.sol +[`LSP20Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20Errors.sol +[`LSP2Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +[`LSP5Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP5ReceivedAssets/LSP5Utils.sol +[`LSP5Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP5ReceivedAssets/LSP5Constants.sol +[`LSP10Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Utils.sol +[`LSP10Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Constants.sol + + diff --git a/docs/contracts/introduction.md b/docs/contracts/introduction.md index 73f74a5cfd..727a332f04 100644 --- a/docs/contracts/introduction.md +++ b/docs/contracts/introduction.md @@ -80,7 +80,7 @@ The **Digital Asset (Token and NFT 2.0)** contracts are the newest advanced vers These contracts are not just related to one specific section and could be used with the **Universal Profile**, **Digital Asset**, and **NFT 2.0** contracts. -- **[LSP9Vault](../standards/smart-contracts/lsp9-vault.md)**: a contract representing a **Vault** able to execute and hold assets could be owned by an LSP0ERC725Account contract. +- **[LSP9Vault](../contracts/contracts/LSP9Vault/LSP9Vault.md)**: a contract representing a **Vault** able to execute and hold assets could be owned by an LSP0ERC725Account contract. - **[LSP1UniversalReceiverDelegateVault](./contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md)**: a contract that allows the vault to react to the calls it receives (Normal transaction, Token transfer, etc.). - **LSP14Ownable2Step** - **LSP17ContractExtension** diff --git a/docs/faq/help.md b/docs/faq/help.md index 598dacb17c..cfdd8855fd 100644 --- a/docs/faq/help.md +++ b/docs/faq/help.md @@ -1,11 +1,37 @@ --- -title: Help -description: Help on Frequently Asked Questions +sidebar_label: 'Help Center' sidebar_position: 5 --- -# Help +# Help Center + +## How to stay up to date about LUKSO? + +You can follow LUKSO on [Twitter](https://twitter.com/lukso_io), read the latest article on [Medium](https://medium.com/lukso) articles, and follow the announcements on the LUKSO [Discord](https://discord.gg/lukso) server. + +## Where can I read the LUKSO Whitepaper? + +Here is the link to read and download the [Official LUKSO Whitepaper](https://uploads-ssl.webflow.com/629f44560745074760731ba4/62b200bfe0af12186845519a_LUKSO_Whitepaper_V1-1.pdf). ## My question is not here. Where can I ask it? -If you can't find an answer to your question, you can head to our [Discord](https://discord.gg/lukso) server. We have development-related channels where you can ask technical questions. We will add the most asked question to this list. +If you can't find an answer to your question, you can head to our [Discord](https://discord.gg/lukso) server. We have various open channels where you can ask technical questions: + +- `validators`: Node and Network related questions +- `dev-chat`: Questions about tools, backend, and dApps +- `standards`: Questsions about LSPs and their integration +- `documentation`: Improvement proposals for our technical guides + +In addition, the most frequently asked questions will be added to this list. + +## Where can I report regular issues for repositories and tools? + +You can open an issue on any open code repository of the [LUKSO Network's GitHub](https://github.com/lukso-network) page. We are also preparing workflows to handle global issues and improvement proposals. In case you want to give feedback to private source code, like our Universal Profile Extension, please create an issue on our global [GitHub Issue Tracker](https://github.com/lukso-network/issue-tracker). + +## Where can security issues be reported to? + +Suppose it's a vulnerability or something that should not be shared with the public, please reach out to official team members within our developer channel on [Discord](https://discord.gg/lukso). You can send a friend request in order to exchange more detailed information. We are also preparing a workflow to handle investigations and bug bounties in a unified format. + +## Does LUKSO have grants or bug bounties? + +We're happy to compensate if there are severe findings and vulnerabilities discovered. The compensation will depend on the scope of the error or bug. We do not share precise bounty amounts beforehand because of the wide range of possible discoveries. diff --git a/docs/guides/key-manager/execute-relay-transactions.md b/docs/guides/key-manager/execute-relay-transactions.md index 9893f37c39..dd8351ab67 100644 --- a/docs/guides/key-manager/execute-relay-transactions.md +++ b/docs/guides/key-manager/execute-relay-transactions.md @@ -64,9 +64,11 @@ To encode a transaction, we need the address of the Universal Profile smart cont import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json'; import { EIP191Signer } from '@lukso/eip191-signer.js'; -import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; import Web3 from 'web3'; +// This is the version relative to the LSP6 standard, defined as the number 6. +import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; + const web3 = new Web3('https://rpc.testnet.lukso.network'); const universalProfileAddress = '0x...'; const msgValue = 0; // Amount of native tokens to be sent @@ -85,9 +87,11 @@ const controllerAccount = web3.eth.accounts.wallet.add(controllerPrivateKey); import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json'; import { EIP191Signer } from '@lukso/eip191-signer.js'; -import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; import { ethers } from 'ethers'; +// This is the version relative to the LSP6 standard, defined as the number 6. +import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; + const provider = new ethers.providers.JsonRpcProvider( 'https://rpc.testnet.lukso.network', ); @@ -222,7 +226,7 @@ const abiPayload = universalProfile.interface.encodeFunctionData('execute', [ :::tip ERC725X execute -You can find more information about the [ERC725X `execute` call here](../../standards/smart-contracts/erc725-contract#execute---erc725x). +You can find more information about the [ERC725X `execute` call here](../../contracts/contracts/ERC725/ERC725.md#execute). ::: @@ -243,7 +247,7 @@ For more information check: [**How to sign relay transactions?**](../../standard ```typescript title="Sign the transaction" -const chainId = await web3.eth.getChainId(); // will be 2828 on L16 +const chainId = await web3.eth.getChainId(); let encodedMessage = web3.utils.encodePacked( { value: LSP6_VERSION, type: 'uint256' }, @@ -268,7 +272,7 @@ let { signature } = await eip191Signer.signDataWithIntendedValidator( ```typescript title="Sign the transaction" -const { chainId } = await provider.getNetwork(); // will be 2828 on L16 +const { chainId } = await provider.getNetwork(); let encodedMessage = ethers.utils.solidityPack( ['uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'bytes'], @@ -361,9 +365,11 @@ You can find more information about the [LSP6KeyManager `executeRelayCall` here] import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json'; import { EIP191Signer } from '@lukso/eip191-signer.js'; -import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; import Web3 from 'web3'; +// This is the version relative to the LSP6 standard, defined as the number 6. +import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; + const web3 = new Web3('https://rpc.testnet.lukso.network'); const universalProfileAddress = '0x...'; const msgValue = 0; // Amount of native tokens to be sent @@ -435,9 +441,11 @@ const executeRelayCallTransaction = await keyManager.methods import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json'; import { EIP191Signer } from '@lukso/eip191-signer.js'; -import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; import { ethers } from 'ethers'; +// This is the version relative to the LSP6 standard, defined as the number 6. +import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants'; + const provider = new ethers.providers.JsonRpcProvider( 'https://rpc.testnet.lukso.network', ); diff --git a/docs/guides/universal-profile/transfer-lyx.md b/docs/guides/universal-profile/transfer-lyx.md index bda7b2850f..18530f6775 100644 --- a/docs/guides/universal-profile/transfer-lyx.md +++ b/docs/guides/universal-profile/transfer-lyx.md @@ -31,7 +31,7 @@ We previously saw how to use `setData(...)` to update data in our UP contract's ### Basics of the `execute(...)` function -The [`execute(operation,to,value,data)`](../../standards/smart-contracts/erc725-contract.md#execute---erc725x) function from [ERC725X](../../standards/lsp-background/erc725.md#erc725x---generic-executor) enable us to use our UP to interact with other addresses, such as transferring LYX or calling other smart contracts. This function takes four arguments (see [ERC725 API docs](../../standards/smart-contracts/erc725-contract.md#execute---erc725x)). +The [`execute(operation,to,value,data)`](../../contracts/contracts/ERC725/ERC725.md#execute) function from [ERC725X](../../standards/lsp-background/erc725.md#erc725x---generic-executor) enable us to use our UP to interact with other addresses, such as transferring LYX or calling other smart contracts. This function takes four arguments (see [ERC725 API docs](../../contracts/contracts/ERC725/ERC725.md#execute)). We can use this function to transfer LYX from our UP to any address (including another UP). Transferring LYX from our UP is as simple as making a standard [`CALL`](../../standards/universal-profile/lsp6-key-manager.md#permission-values) to any `address`, attaching some **value** to the call. @@ -187,12 +187,7 @@ const amount = web3.utils.toWei('3'); // amount of LYX we want to transfer // calldata executed at the target (here nothing, just a plain LYX transfer) const data = '0x'; // empty data -await myUP.methods.execute( - OPERATION_CALL, - recipient, - amount, - data, -).send({ +await myUP.methods.execute(OPERATION_CALL, recipient, amount, data).send({ from: myEOA.address, gasLimit: 300_000, }); @@ -208,14 +203,7 @@ const recipient = '0x...'; // address of the recipient (any address, including a const amount = ethers.utils.parseEther('3'); // amount of LYX we want to transfer const data = '0x'; // calldata executed at the target (here nothing, just a plain LYX transfer) -await myUP - .connect(myEOA) - .execute( - OPERATION_CALL, - recipient, - amount, - data, - ); +await myUP.connect(myEOA).execute(OPERATION_CALL, recipient, amount, data); ``` @@ -247,12 +235,7 @@ const amount = web3.utils.toWei('3'); // calldata executed at the target (here nothing, just a plain LYX transfer) const data = '0x'; -await myUP.methods.execute( - OPERATION_CALL, - recipient, - amount, - data, -).send({ +await myUP.methods.execute(OPERATION_CALL, recipient, amount, data).send({ from: myEOA.address, gasLimit: 300_000, }); @@ -282,14 +265,7 @@ const amount = ethers.utils.parseEther('3'); // amount of LYX we want to transfe // calldata executed at the target (here nothing, just a plain LYX transfer) const data = '0x'; -await myUP - .connect(myEOA) - .execute( - OPERATION_CALL, - recipient, - amount, - data, - ); +await myUP.connect(myEOA).execute(OPERATION_CALL, recipient, amount, data); ``` diff --git a/docs/guides/vault/create-a-vault.md b/docs/guides/vault/create-a-vault.md index 616d7bcf63..dc163fa7e5 100644 --- a/docs/guides/vault/create-a-vault.md +++ b/docs/guides/vault/create-a-vault.md @@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem'; # Create a Vault -This guide will teach you how to deploy an **[LSP9Vault](../../standards/smart-contracts/lsp9-vault.md)** contract. This contract can be used to **hold assets** such as tokens and NFTs. Also can be used with a [UniversalProfile](../../standards/universal-profile/introduction.md) and a [KeyManager](../../standards/universal-profile/lsp6-key-manager.md) to **restrict some addresses** (protocols, friends, etc..) to execute and setData on it, instead of setting or executing directly on the profile. +This guide will teach you how to deploy an **[LSP9Vault](../../contracts/contracts/LSP9Vault/LSP9Vault.md)** contract. This contract can be used to **hold assets** such as tokens and NFTs. Also can be used with a [UniversalProfile](../../standards/universal-profile/introduction.md) and a [KeyManager](../../standards/universal-profile/lsp6-key-manager.md) to **restrict some addresses** (protocols, friends, etc..) to execute and setData on it, instead of setting or executing directly on the profile. ![Guide - How to create an LSP9Vault](/img/guides/lsp9/LSP9VaultGuide.jpeg) diff --git a/docs/guides/vault/edit-vault-data.md b/docs/guides/vault/edit-vault-data.md index 213fee9b23..d722fd6738 100644 --- a/docs/guides/vault/edit-vault-data.md +++ b/docs/guides/vault/edit-vault-data.md @@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem'; # Edit Vault Data -This guide will teach you how to set data to an **[LSP9Vault](../../standards/smart-contracts/lsp9-vault.md)** contract through a UniversalProfile owned by an LSP6KeyManager. Any data can be attached to the vault, and since it supports the **[LSP1-UniversalReceiver](../../standards/generic-standards/lsp1-universal-receiver.md)** standard, we will set the [**Universal Receiver Delegate**](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md) address inside the storage. +This guide will teach you how to set data to an **[LSP9Vault](../../contracts/contracts/LSP9Vault/LSP9Vault.md)** contract through a UniversalProfile owned by an LSP6KeyManager. Any data can be attached to the vault, and since it supports the **[LSP1-UniversalReceiver](../../standards/generic-standards/lsp1-universal-receiver.md)** standard, we will set the [**Universal Receiver Delegate**](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md) address inside the storage. ## Setting Data (Universal Receiver Delegate) diff --git a/docs/guides/vault/interact-with-contracts.md b/docs/guides/vault/interact-with-contracts.md index 1449e05e00..8e19847d6e 100644 --- a/docs/guides/vault/interact-with-contracts.md +++ b/docs/guides/vault/interact-with-contracts.md @@ -388,4 +388,4 @@ await universalProfile -In the code snippet above, we interacted with `myCoolfunction(..)` function on the **targetContract** contract through the Vault's [execute](../../standards/smart-contracts/lsp9-vault.md#execute) function. The call was encoded and executed through the Universal Profile. +In the code snippet above, we interacted with `myCoolfunction(..)` function on the **targetContract** contract through the Vault's [execute](../../contracts/contracts/LSP9Vault/LSP9Vault.md#execute) function. The call was encoded and executed through the Universal Profile. diff --git a/docs/standards/nft-2.0/LSP7-Digital-Asset.md b/docs/standards/nft-2.0/LSP7-Digital-Asset.md index af3fec0afe..a5c2f4a888 100644 --- a/docs/standards/nft-2.0/LSP7-Digital-Asset.md +++ b/docs/standards/nft-2.0/LSP7-Digital-Asset.md @@ -56,51 +56,60 @@ The current token standards don't enable attaching metadata to the contract in a To ensure a flexible and generic asset representation, the token contract should use the **[LSP4-DigitalAsset-Metadata](./LSP4-Digital-Asset-Metadata.md)**. In this way, any information could be attached to the token contract. -### Force Boolean +### LSP1 Token Hooks -It is expected in the LUKSO's ecosystem to use **[smart contract-based accounts](../universal-profile/lsp0-erc725account.md)** to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens, but they will be used mainly to control these accounts and not to hold them. +:::caution -To ensure a **safe asset transfer**, an additional boolean parameter was added to the [transfer](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#transfer) and mint functions: +When LSP7 assets are transfered, the LSP7 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#_notifytokenreceiver). -- If set to **False**, the transfer will only pass if the recipient is a smart contract that implements the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard. +**These methods will make external calls** to the [`universalReceiver(...)`](../smart-contracts/lsp0-erc725-account.md#universalreceiver) functions of both the sender and recipient. -![Token Force Boolean False](/img/standards/lsp7/tokens-force-false.jpeg) +This function could perform more complex logic, like delegating the call to the `LSP1UniversalReceiverDelegate` contract. This contract can contain custom logic for each user. For instance, a user could decide to re-transfer the tokens to another address once they are transferred to his UP. -:::note +::: -It's advised to set the **force** bool as **False** when transferring or minting tokens to avoid sending them to the wrong address. +The current token standards act as **registry contracts** that keep track of each address's balance. They do not implement functionalities to **notify the recipient** that it has received some tokens or to **notify the sender** that it has sent some tokens. -::: +During an **ERC20 token transfer**, the sender's balance is decreased, and the recipient's balance is increased without further interaction. -- If set to **TRUE**, the transfer will not be dependent on the recipient, meaning **smart contracts** not implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard and **EOAs** will be able to receive the tokens. +![ERC20 Transfer](/img/standards/lsp7/erc20-transfer.jpeg) -![Token Force Boolean True](/img/standards/lsp7/tokens-force-true.jpeg) +During an **LSP7 token transfer**, as well as updating the balances, both the sender and recipient are informed of the transfer by calling their **[`universalReceiver(...)`](../generic-standards/lsp1-universal-receiver.md#lsp1---universal-receiver)** function (if these are both smart contracts). -Implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard will give a sign that the contract knows how to handle the tokens received. +![LSP7DigitalAsset Transfer](/img/standards/lsp7/lsp7-transfer.jpeg) -### Token Hooks +In this way, users are **informed** about the token transfers and can decide how to **react on the transfer**, either by accepting or rejecting the tokens, or implementing a custom logic to run on each transfer with the help of **[LSP1-UniversalReceiverDelegate](../generic-standards/lsp1-universal-receiver-delegate.md)**. -:::caution +If the sender and recipient are smart contracts that implement the LSP1 standard, the LSP7 token contract will notify them using the following `bytes32 typeIds` when calling their `universalReceiver(...)` function. -When LSP7 assets are transfered, the LSP7 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#_notifytokenreceiver). +| address notified | `bytes32` typeId used | description | +| ---------------------- | -------------------------------------------------------------------- | ----------------------------------------------- | +| Token sender (`from`) | `0x429ac7a06903dbc9c13dfcb3c9d11df8194581fa047c96d7a4171fc7402958ea` | `keccak256('LSP7Tokens_SenderNotification')` | +| Token recipient (`to`) | `0x20804611b3e2ea21c480dc465142210acf4a2485947541770ec1fb87dee4a55c` | `keccak256('LSP7Tokens_RecipientNotification')` | -**These methods will make external calls** to the [`universalReceiver(...)`](../smart-contracts/lsp0-erc725-account.md#universalreceiver) functions of both the sender and recipient. +### `allowNonLSP1Recipient` boolean -This function could perform more complex logic, like delegating the call to the `LSP1UniversalReceiverDelegate` contract. This contract can contain custom logic for each user. For instance, a user could decide to re-transfer the tokens to another address once they are transferred to his UP. +:::success + +It is advised to set the `allowNonLSP1Recipient` boolean to `false` when transferring or minting tokens to avoid sending them to the wrong address. + +For instance, if the wrong address was pasted by mistake by the user in the input field of a dApp. ::: -The current token standards act as **registry contracts** that keep track of each address's balance. They do not implement functionalities to **notify the recipient** that it has received some tokens or to **notify the sender** that it has sent some tokens. +It is expected in the LUKSO's ecosystem to use **[smart contract-based accounts](../universal-profile/lsp0-erc725account.md)** to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens, but they will be used mainly to control these accounts and not to hold them. -During an **ERC20 token transfer**, the sender's balance is decreased, and the recipient's balance is increased without further interaction. +To ensure a **safe asset transfer**, an additional boolean parameter was added to the [`transfer(...)``](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md#transfer) and `_mint(...)` functions: -![ERC20 Transfer](/img/standards/lsp7/erc20-transfer.jpeg) +- If set to `false`, the transfer will only pass if the recipient is a smart contract that implements the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard. -During an **LSP7 token transfer**, as well as updating the balances, both the sender and recipient are informed of the transfer by calling the **[`universalReceiever(...)`](../generic-standards/lsp1-universal-receiver.md#lsp1---universal-receiver)** function on their profiles. +![Token Force Boolean False](/img/standards/lsp7/tokens-force-false.jpeg) -![LSP7DigitalAsset Transfer](/img/standards/lsp7/lsp7-transfer.jpeg) +- If set to `true`, the transfer will not be dependent on the recipient, meaning **smart contracts** not implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard and **EOAs** will be able to receive the tokens. -In this way, users are **informed** about the token transfers and can decide how to **react on the transfer**, either by accepting or rejecting the tokens, or implementing a custom logic to run on each transfer with the help of **[LSP1-UniversalReceiverDelegate](../generic-standards/lsp1-universal-receiver-delegate.md)**. +![Token Force Boolean True](/img/standards/lsp7/tokens-force-true.jpeg) + +Implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard will give a sign that the contract knows how to handle the tokens received. ## References diff --git a/docs/standards/nft-2.0/LSP8-Identifiable-Digital-Asset.md b/docs/standards/nft-2.0/LSP8-Identifiable-Digital-Asset.md index 7e39c9a58a..410d163dd2 100644 --- a/docs/standards/nft-2.0/LSP8-Identifiable-Digital-Asset.md +++ b/docs/standards/nft-2.0/LSP8-Identifiable-Digital-Asset.md @@ -32,7 +32,7 @@ Non-Fungible assets such as **[ERC721](https://eips.ethereum.org/EIPS/eip-721)** This standard was based on **[ERC721](https://eips.ethereum.org/EIPS/eip-20)** and **[ERC1155](https://eips.ethereum.org/EIPS/eip-777)** with additional features mentioned below: -### Bytes32 TokenId +### Bytes32 TokenId Type The current NFT standards such as **[ERC721](https://eips.ethereum.org/EIPS/eip-721)** and **[ERC1155](https://eips.ethereum.org/EIPS/eip-1155)** **lack asset representation** as they define the tokenIds **as Numbers** `(uint256)`. Each token from the NFT collection will be defined and queried based on this tokenId, which is normally incremental. @@ -76,51 +76,59 @@ The Metadata defined by the **ERC725Y Data Keys** can be set for **each tokenId* ::: -### Force Boolean +### LSP1 Token Hooks -It is expected in the LUKSO's ecosystem to use **smart contract based accounts** to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens but they will be mainly used to control these accounts and not to hold tokens. +:::caution -To ensure a **safe asset transfer**, an additional boolean parameter was added to the [transfer](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#transfer) and mint functions: +When LSP8 assets are transfered, the LSP8 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokenreceiver). -- If set to **False**, the transfer will only pass if the recipient is a smart contract that implements the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard. +**These methods will make external calls** to the [`universalReceiver(...)`](../smart-contracts/lsp0-erc725-account.md#universalreceiver) functions of both the sender and recipient. -![Token Force Boolean False](/img/standards/lsp7/tokens-force-false.jpeg) +This function could perform more complex logic, like delegating the call to the `LSP1UniversalReceiverDelegate` contract. This contract can contain custom logic for each user. For instance, a user could decide to re-transfer the tokens to another address once they are transferred to his UP. -:::note +::: -It's advised to set the **force** bool as **False** when transferring or minting tokens to avoid sending them to the wrong address. +The current NFTs standards act as **registry contracts** that keep track of the ownership of each tokenId. They do not implement functionalities to **notify the recipient** that it has received some tokens or to **notify the sender** that it has sent some tokens. -::: +During an **ERC721 token transfer**, the ownership of the tokenId is changed from the sender address to the recipient address without further interaction. -- If set to **True**, the transfer will not be dependent on the recipient, meaning **smart contracts** not implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard and **EOAs** will be able to receive the tokens. +![ERC721 Transfer](/img/standards/lsp8/erc721-transfer.jpeg) -![Token Force Boolean True](/img/standards/lsp7/tokens-force-true.jpeg) +During an **LSP8 token transfer**, as well as updating the tokenId ownership, both the sender and recipient are informed of the transfer by calling the **[`universalReceiever(...)`](../generic-standards/lsp1-universal-receiver.md#lsp1---universal-receiver)** function on their profiles. -Implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard will give a sign that the contract knows how to handle the tokens received. +![LSP8 Transfer](/img/standards/lsp8/lsp8-transfer.jpeg) -### Token Hooks +In this way, users are **informed** about the NFT transfer and can decide how to **react on the transfer**, either by accepting or rejecting the NFT, or implementing a custom logic to run on each transfer with the help of **[LSP1-UniversalReceiverDelegate](../generic-standards/lsp1-universal-receiver-delegate.md)**. -:::caution +If the sender and recipient are smart contracts that implement the LSP1 standard, the LSP8 token contract will notify them using the following `bytes32 typeIds` when calling their `universalReceiver(...)` function. -When LSP8 assets are transfered, the LSP8 contract will notify the token sender and recipient using [`_notifyTokenSender(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokensender) and [`_notifyTokenReceiver(...)`](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#_notifytokenreceiver). +| address notified | `bytes32` typeId used | description | +| ---------------------- | -------------------------------------------------------------------- | ----------------------------------------------- | +| Token sender (`from`) | `0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00` | `keccak256('LSP8Tokens_SenderNotification')` | +| Token recipient (`to`) | `0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d` | `keccak256('LSP8Tokens_RecipientNotification')` | -**These methods will make external calls** to the [`universalReceiver(...)`](../smart-contracts/lsp0-erc725-account.md#universalreceiver) functions of both the sender and recipient. +### `allowNonLSP1Recipient` boolean -This function could perform more complex logic, like delegating the call to the `LSP1UniversalReceiverDelegate` contract. This contract can contain custom logic for each user. For instance, a user could decide to re-transfer the tokens to another address once they are transferred to his UP. +:::success +It is advised to set the `allowNonLSP1Recipient` boolean to `false` when transferring or minting tokens to avoid sending them to the wrong address. + +For instance, if the wrong address was pasted by mistake by the user in the input field of a dApp. ::: -The current NFTs standards act as **registry contracts** that keep track of the ownership of each tokenId. They do not implement functionalities to **notify the recipient** that it has received some tokens or to **notify the sender** that it has sent some tokens. +It is expected in the LUKSO's ecosystem to use **smart contract based accounts** to operate on the blockchain, which includes receiving and sending tokens. EOAs can receive tokens but they will be mainly used to control these accounts and not to hold tokens. -During an **ERC721 token transfer**, the ownership of the tokenId is changed from the sender address to the recipient address without further interaction. +To ensure a **safe asset transfer**, an additional boolean parameter was added to the [`transfer(...)``](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md#transfer) and `_mint(...)` functions: -![ERC721 Transfer](/img/standards/lsp8/erc721-transfer.jpeg) +- If set to `false`, the transfer will only pass if the recipient is a smart contract that implements the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard. -During an **LSP8 token transfer**, as well as updating the tokenId owenrship, both the sender and recipient are informed of the transfer by calling the **[`universalReceiever(...)`](../generic-standards/lsp1-universal-receiver.md#lsp1---universal-receiver)** function on their profiles. +![Token Force Boolean False](/img/standards/lsp7/tokens-force-false.jpeg) -![LSP8 Transfer](/img/standards/lsp8/lsp8-transfer.jpeg) +- If set to `true`, the transfer will not be dependent on the recipient, meaning **smart contracts** not implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard and **EOAs** will be able to receive the tokens. -In this way, users are **informed** about the NFT transfers and can decide how to **react on the transfer**, either by accepting or rejecting the tokens, or implementing a custom logic to run on each transfer with the help of **[LSP1-UniversalReceiverDelegate](../generic-standards/lsp1-universal-receiver-delegate.md)**. +![Token Force Boolean True](/img/standards/lsp7/tokens-force-true.jpeg) + +Implementing the **[LSP1-UniversalReceiver](../generic-standards/lsp1-universal-receiver.md)** standard will give a sign that the contract knows how to handle the tokens received. ## References diff --git a/docs/standards/smart-contracts/erc725-contract.md b/docs/standards/smart-contracts/erc725-contract.md deleted file mode 100644 index cd83619d74..0000000000 --- a/docs/standards/smart-contracts/erc725-contract.md +++ /dev/null @@ -1,329 +0,0 @@ ---- -title: ERC725 -sidebar_position: 3 ---- - -# ERC725 - -:::info Solidity contract - -[`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/develop/implementations/contracts/ERC725.sol) - -::: - -The **ERC725** is the contract combining: - -- **ERC725X**: contract that allow a generic execution using different types of operations. - -- **ERC725Y**: contract that allow for a generic data storage in a smart contract. - -:::note -ERC725 contract also contains the method from [ERC165](https://eips.ethereum.org/EIPS/eip-165): - -```solidity -function supportsInterface(bytes4 interfaceId) public view returns (bool) -``` - -::: - ---- - -## Functions - -### constructor - -```solidity -constructor(address initialOwner) -``` - -Sets the **initial owner** of the contract. - -#### Parameters: - -| Name | Type | Description | -| :------------- | :-------- | :----------------------------------------------- | -| `initialOwner` | `address` | The address to set as the owner of the contract. | - -### owner - -```solidity -function owner() public view returns (address owner) -``` - -Returns the address of the current owner of the smart contract. - -#### Return Values: - -| Name | Type | Description | -| :------ | :-------- | :--------------------------------- | -| `owner` | `address` | The current owner of the contract. | - -### transferOwnership - -```solidity -function transferOwnership(address newOwner) public { -``` - -Transfers the ownership of the contract to the `newOwner` address. - -_Triggers the **[OwnershipTransferred](#ownershiptransferred)** event when ownership is transferred._ - -#### Parameters: - -| Name | Type | Description | -| :--------- | :-------- | :----------------------------------------------- | -| `newOwner` | `address` | The address to set as the owner of the contract. | - -### execute - ERC725X - -```solidity -function execute( - uint256 operationType, - address target, - uint256 value, - bytes memory data -) public payable returns (bytes memory result) -``` - -Executes a call on any other smart contracts, transfers value, or deploys a new smart contract. - -The `operationType` can be the following: - -- `0` for `CALL` -- `1` for `CREATE` -- `2` for `CREATE2` -- `3` for `STATICCALL` -- `4` for `DELEGATECALL` - -_Triggers the **[Executed](#executed)** event when a call is successfully executed using `CALL/STATICCALL/DELEGATECALL` operations._ - -_Triggers the **[ContractCreated](#contractcreated)** event when a smart contract is created using `CREATE/CREATE2` operations._ - -:::note -The `execute(...)` function can only be called by the current owner of the contract. - -The operation types `staticcall` (`3`) and `delegatecall` (`4`) do not allow to transfer value. -::: - -#### Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :----------------------------------------------------------------------------------------------------------------------- | -| `operationType` | `uint256` | The type of operation that needs to be executed. | -| `target` | `address` | The address to interact with. The address `to` will be unused if a contract is created (operations 1 & 2). | -| `value` | `uint256` | The amount of native tokens to transfer with the transaction (in Wei). | -| `data` | `bytes` | The calldata (ABI-encoded payload of a function to run on an other contract), or the bytecode of the contract to deploy. | - -#### Return Values: - -| Name | Type | Description | -| :------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | `bytes` | The data that was returned by the function called on the external contract, or the address of the contract created (operations 1 & 2). | - -### execute (Array) - ERC725X - -```solidity -function execute( - uint256[] memory operationsType, - address[] memory targets, - uint256[] memory values, - bytes[] memory datas -) public payable returns (bytes[] memory results) -``` - -Executes batch of calls on any other smart contracts, transfers value, or deploys a new smart contract. - -_Triggers the **[Executed](#executed)** event on each call iteration when a call is successfully executed using `CALL/STATICCALL/DELEGATECALL` operations._ - -_Triggers the **[ContractCreated](#contractcreated)** event on each contract creation iteration when a smart contract is created using `CREATE/CREATE2` operations._ - -:::note -The `execute(...)` function can only be called by the current owner of the contract. -::: - -#### Parameters: - -| Name | Type | Description | -| :--------------- | :---------- | :----------------------------------------------------------------------------------------------------------------------------------------- | -| `operationsType` | `uint256[]` | The list of operation that needs to be executed. | -| `targets` | `address[]` | The list of addresses to interact with. The addresses `targets` will be unused if a contract is created (operations 1 & 2). | -| `values` | `uint256[]` | The list of amount of native tokens to transfer with the transaction (in Wei). | -| `datas` | `bytes[]` | The list of calldata (ABI-encoded payload of a function to run on an other contract), or the list of bytecodes of the contracts to deploy. | - -#### Return Values: - -| Name | Type | Description | -| :------- | :-------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | `bytes[]` | The array of data that was returned by the functions called on the external contract, or the addresses of the contracts created (operations 1 & 2). | - -### setData - ERC725Y - -```solidity -function setData( - bytes32 dataKey, - bytes memory dataValue -) public -``` - -Sets a value in the account storage for a particular data key. - -_Triggers the **[DataChanged](#datachanged)** event when successfully setting the data._ - -:::note -The `setData(...)` function can only be called by the current owner of the contract. -::: - -#### Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :------------------------------------------- | -| `dataKey` | `bytes32` | The data key for which the data will be set. | -| `dataValue` | `bytes` | The data to be set. | - -### getData - ERC725Y - -```solidity -function getData(bytes32 dataKey) public view returns (bytes memory dataValue) -``` - -Retrieves the value set for the given data key. - -#### Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :---------------------------------- | -| `dataKey` | `bytes32` | The data key to retrieve data from. | - -#### Return Values: - -| Name | Type | Description | -| :---------- | :------ | :----------------------------------- | -| `dataValue` | `bytes` | The data for the requested data key. | - -### setData (Array) - ERC725Y - -```solidity -function setData( - bytes32[] memory dataKeys, - bytes[] memory dataValues -) public -``` - -Sets an array of data at multiple data keys in the account storage. - -_Triggers the **[DataChanged](#datachanged)** event when successfully setting each data key/value pair._ - -:::note -The `setData(...)` function can only be called by the current owner of the contract. -::: - -#### Parameters: - -| Name | Type | Description | -| :----------- | :---------- | :----------------------------------- | -| `dataKeys` | `bytes32[]` | The data keys for which to set data. | -| `dataValues` | `bytes[]` | The array of data to set. | - -### getData (Array) - ERC725Y - -```solidity -function getData(bytes32[] memory dataKeys) public view returns (bytes[] memory dataValues) -``` - -Retrieves an array of values for multiple given data keys. - -#### Parameters: - -| Name | Type | Description | -| :--------- | :---------- | :----------------------------------- | -| `dataKeys` | `bytes32[]` | The data keys to retrieve data from. | - -#### Return Values: - -| Name | Type | Description | -| :----------- | :-------- | :------------------------------------------------ | -| `dataValues` | `bytes[]` | An array of the data for the requested data keys. | - -## Events - -### OwnershipTransferred - -```solidity -event OwnershipTransferred( - address previousOwner, - address newOwner, -) -``` - -_**MUST** be fired when **[transferOwnership(...)](#transferownership)** function is successfully executed._ - -#### Values: - -| Name | Type | Description | -| :-------------- | :-------- | :---------------------------------- | -| `previousOwner` | `address` | The previous owner of the contract. | -| `newOwner` | `address` | The new owner of the contract. | - -### Executed - -```solidity -event Executed( - uint256 operationType, - address target, - uint256 value, - bytes4 selector -) -``` - -_**MUST** be fired when **[`execute(...)`](#execute)** function creates a new call using the `CALL`, `STATICCALL`, or `DELEGATECALL` operation._ - -#### Values: - -| Name | Type | Description | -| :-------------- | :-------- | :--------------------------------------------------------------------------------- | -| `operationType` | `uint256` | Either **0** (for `CALL`), **3** (for `STATICCALL`) or **3** (for `DELEGATECALL`). | -| `target` | `address` | The smart contract or address that was called. | -| `value` | `uint256` | The value transferred. | -| `selector` | `bytes4` | The bytes4 selector of the function called on the `target` address. | - -### ContractCreated - -```solidity -event ContractCreated( - uint256 operationType, - address contractAddress, - uint256 value, - bytes32 salt -) -``` - -_**MUST** be fired when the **[`execute(...)`](#execute)** function creates a new contract using the `CREATE` or `CREATE2` operation._ - -#### Values: - -| Name | Type | Description | -| :-------------- | :-------- | :---------------------------------------------------------------------------------------- | -| `operationType` | `uint256` | Either **1** (for `CREATE`) or **2** (for `CREATE2`). | -| `to` | `address` | The address of the created contract. | -| `value` | `uint256` | The value sent to the contract. | -| `salt` | `bytes32` | The salt used in `CREATE2` operation. Will be `bytes32(0)` in case of `CREATE` operation. | - -### DataChanged - -```solidity -event DataChanged(bytes32 dataKey, bytes dataValue) -``` - -_**MUST** be fired when the **[`setData(...)`](#setdata)** function is successfully executed._ - -#### Values: - -| Name | Type | Description | -| :---------- | :-------- | :------------------------------------ | -| `dataKey` | `bytes32` | The data key which data value is set. | -| `dataValue` | `bytes` | The data value to set. | - -## References - -- [ERC725 (Standard Specification, GitHub)](https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md) -- [Solidity implementations (GitHub)](https://github.com/ERC725Alliance/ERC725/tree/develop/implementations) diff --git a/docs/standards/smart-contracts/lsp9-vault.md b/docs/standards/smart-contracts/lsp9-vault.md deleted file mode 100644 index 49e2ea704d..0000000000 --- a/docs/standards/smart-contracts/lsp9-vault.md +++ /dev/null @@ -1,502 +0,0 @@ ---- -title: LSP9Vault -sidebar_position: 11 ---- - -# LSP9Vault - -:::info Solidity contract - -[`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/main/contracts/LSP9Vault/LSP9Vault.sol) - -::: - -The **LSP9Vault** contract is an implementation of the **[LSP9-Vault Standard](#)**. - -This contract can be used as a **vault** that can **hold assets** and **interact with other smart contracts**, as it has all the functions of the **[LSP0ERC725Account](./lsp0-erc725-account.md)** contract, except for the **`isValidSignature(...)`** function. - -:::note -_LSP9Vault contract also contains the methods from the [ERC165 Standard](https://eips.ethereum.org/EIPS/eip-165):_ - -```solidity -function supportsInterface(bytes4 interfaceId) public view returns (bool) -``` - -::: - ---- - -## Functions - -### constructor - -```solidity -constructor(address initialOwner) -``` - -Sets the **initial owner** of the contract, the **[SupportedStandards:LSP9Vault ](#)** data key in the vault storage. - -If the `initialOwner` is an **[LSP0ERC725Account](./lsp0-erc725-account.md)** contract, the **[`universalReceiver(...)`](./lsp0-erc725-account.md#universalreceiver)** function will be called on the **LSP0ERC725Account** contract to inform the account about the **newly owned vault**. - -#### Parameters: - -| Name | Type | Description | -| :------------- | :-------- | :----------------------------------------------- | -| `initialOwner` | `address` | The address to set as the owner of the contract. | - -### owner - -```solidity -function owner() public view returns (address owner) -``` - -Returns the address of the current vault owner. - -#### Return Values: - -| Name | Type | Description | -| :------ | :-------- | :------------------------------ | -| `owner` | `address` | The current owner of the vault. | - -### pendingOwner - -```solidity -function pendingOwner() public view returns (address) -``` - -Return the address of the pending owner that was initiated by [`transferOwnership(address)`](#transferownership). - -> **NB:** if no ownership transfer is in progress, the `pendingOwner` MUST be `address(0)`. - -#### Return Values: - -| Name | Type | Description | -| :------------- | :-------- | :------------------------------- | -| `pendingOwner` | `address` | The address of the pending owner | - -### transferOwnership - -```solidity -function transferOwnership(address newOwner) public -``` - -Initiate an ownership transfer by setting the `newOwner` as `pendingOwner`. - -Requirements: - -- Can only be called by the current owner. -- The `newOwner` to be set as the `pendingOwner` cannot be `address(this)`. - -#### Parameters: - -| Name | Type | Description | -| :--------- | :-------- | :------------------------------------ | -| `newOwner` | `address` | The address to set as `pendingOwner`. | - -### acceptOwnership - -```solidity -function acceptOwnership() public -``` - -Transfers ownership of the contract to the `pendingOwner` address. Can only be called by the `pendingOwner`. - -_Triggers the **[OwnershipTransferred](#ownershiptransferred)** event once the new owner has claimed ownership._ - -### renounceOwnership - -```solidity -function renounceOwnership() public -``` - -Since renouncing ownership is a sensitive operation, it is done as a two step process by calling `renounceOwnership(..)` twice. First to initiate the process, second as a confirmation. - -The current block number is saved as a part of initiation because the following behaviour is wanted: - -- The first 100 blocks after the saved block is the pending period, if you call `renounceOwnership(..)` during this period, the transaction will be reverted. -- the following 100 blocks is the period when you can confirm the renouncement of the contract by calling `renounceOwnership(..)` the second time. - -_Triggers the **[RenounceOwnershipInitiated](#renounceownershipinitiated)** event in the first call._ - -_Triggers the **[OwnershipTransferred](#ownershiptransferred)** event after successfully renouncing ownership._ - -:::warning -Leaves the contract without an owner. Once ownership of the contract is renounced, it won't be possible to call the functions restricted to the owner only. -::: - -### fallback - -```solidity -fallback() external payable -``` - -Executed when value is transferred to the contract or when function identifier doesn't match any of the available functions. - -_Triggers the **[ValueReceived](#valuereceived)** event when a native token is received._ - -### execute - -```solidity -function execute( - uint256 operationType, - address target, - uint256 value, - bytes memory data -) public payable returns (bytes memory result) -``` - -Executes a call on any other smart contracts, transfers value, or deploys a new smart contract. - -The following `operationType` MUST exist: - -- `0` for `CALL` -- `1` for `CREATE` -- `2` for `CREATE2` -- `3` for `STATICCALL` - -_Triggers the **[Executed](#executed)** event when a call is successfully executed using `CALL/STATICCALL` operations._ - -_Triggers the **[ContractCreated](#contractcreated)** event when a smart contract is created using `CREATE/CREATE2` operations._ - -:::note -The `execute(...)` function can only be called by the current owner of the vault. - -The operation type `staticcall` (`3`) does not allow to transfer value. -::: - -#### Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :----------------------------------------------------------------------------------------------------------------------- | -| `operationType` | `uint256` | The type of operation that needs to be executed. | -| `target` | `address` | The address to interact with. `target` will be unused if a contract is created (operation 1 & 2). | -| `value` | `uint256` | The amount of native tokens to transfer with the transaction (in Wei). | -| `data` | `bytes` | The calldata (ABI-encoded payload of a function to run on an other contract), or the bytecode of the contract to deploy. | - -#### Return Values: - -| Name | Type | Description | -| :------- | :------ | :-------------------------------------------------------------------------------------------------- | -| `result` | `bytes` | The returned data of the called function, or the address of the contract created (operation 1 & 2). | - -### setData - -```solidity -function setData( - bytes32 key, - bytes memory value -) public -``` - -Sets the data of a single data `key` as **bytes** to the vault's storage. - -_Triggers the **[DataChanged](#datachanged)** event when successfully setting the data._ - -:::note -The `setData(...)` function can only be called by the current owner of the contract and the LSP1UniversalReceiverDelegateVault contract. -::: - -#### Parameters: - -| Name | Type | Description | -| :------ | :-------- | :---------------------------------- | -| `key` | `bytes32` | The data key for which to set data. | -| `value` | `bytes` | The data to set as bytes. | - -### getData - -```solidity -function getData(bytes32 key) public view returns (bytes memory value) -``` - -Retrieves the data that was set for a particular data `key`. - -#### Parameters: - -| Name | Type | Description | -| :---- | :-------- | :---------------------------------- | -| `key` | `bytes32` | The data key to retrieve data from. | - -#### Return Values: - -| Name | Type | Description | -| :------ | :------ | :----------------------------------- | -| `value` | `bytes` | The data for the requested data key. | - -### executeBatch - -```solidity -function executeBatch( - uint256[] memory operationsType, - address[] memory targets, - uint256[] memory values, - bytes[] memory memory datas -) public payable returns (bytes memory result) -``` - -Same as [`execute(uint256,address,uint256,bytes)`](#execute---erc725x) but executes a batch of calls on any other smart contracts, transferring values, or deploying new smart contracts. - -The values in the list of `operationsType` can be one of the following: - -- `0` for `CALL` -- `1` for `CREATE` -- `2` for `CREATE2` -- `3` for `STATICCALL` -- `4` for `DELEGATECALL` - -_Triggers the **[Executed](#executed)** event on every successful call that used operation type `CALL`, `STATICCALL` or `DELEGATECALL`._ - -_Triggers the **[ContractCreated](#contractcreated)** event on every newly created smart contract that used operation `CREATE` or `CREATE2`._ - -:::note -The `executeBatch(uint256[],address[],uint256[],bytes[])` function can only be called by the current owner of the contract. - -The operation types `staticcall` (`3`) and `delegatecall` (`4`) do not allow to transfer value. -::: - -#### Parameters: - -| Name | Type | Description | -| :--------------- | :---------- | :------------------------------------------------------------------------------------------------------------------------ | -| `operationsType` | `uint256[]` | The type of operations that need to be executed. | -| `targets` | `address[]` | The addresses to interact with. Unused if a contract is created (operations 1 & 2). | -| `values` | `uint256[]` | The amount of native tokens to transfer with the transaction (in Wei). | -| `datas` | `bytes[]` | The calldatas (ABI-encoded payloads of functions to run on other contracts), or the bytecodes of the contracts to deploy. | - -#### Return Values: - -| Name | Type | Description | -| :-------- | :-------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | -| `results` | `bytes[]` | The datas that were returned by the functions called on the external contracts, or the addresses of the contracts created (operations 1 & 2). | - -### setDataBatch - -```solidity -function setDataBatch( - bytes32[] memory keys, - bytes[] memory values -) public -``` - -Sets an array of data at multiple data keys in the vault storage. - -_Triggers the **[DataChanged](#datachanged)** event when successfully setting the data._ - -:::note -The `setDataBatch(...)` function can only be called by the current owner of the contract and the LSP1UniversalReceiverDelegateVault contract. -::: - -#### Parameters: - -| Name | Type | Description | -| :------- | :---------- | :----------------------------------- | -| `keys` | `bytes32[]` | The data keys for which to set data. | -| `values` | `bytes[]` | The array of data to set. | - -### getDataBatch - -```solidity -function getDataBatch(bytes32[] memory keys) public view returns (bytes[] memory values) -``` - -Retrieves an array of data for multiple given data keys. - -#### Parameters: - -| Name | Type | Description | -| :----- | :---------- | :----------------------------------- | -| `keys` | `bytes32[]` | The data keys to retrieve data from. | - -#### Return Values: - -| Name | Type | Description | -| :------- | :-------- | :------------------------------------------------ | -| `values` | `bytes[]` | An array of the data for the requested data keys. | - -### universalReceiver - -```solidity -function universalReceiver( - bytes32 typeId, - bytes memory data -) public payable returns (bytes memory result) -``` - -Forwards the call to the **UniversalReceiverDelegate** contract if its address is stored at the [LSP1UniversalReceiverDelegate](../generic-standards/lsp1-universal-receiver.md#extension) data Key. -The contract being called is expected to be an **[LSP1UniversalReceiverDelegateVault](../../contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md)**, supporting [LSP1UniversalReceiverDelegate InterfaceId](../../contracts/interface-ids.md) using ERC165. - -_Triggers the **[UniversalReceiver](#universalreceiver-1)** event when this function gets successfully executed._ - -#### Parameters: - -| Name | Type | Description | -| :------- | :-------- | :----------------------------- | -| `typeId` | `bytes32` | The type of transfer received. | -| `data` | `bytes` | The data received. | - -#### Return Values: - -| Name | Type | Description | -| :------- | :------ | :------------------------------------- | -| `result` | `bytes` | Can be used to encode response values. | - -## Events - -### OwnershipTransferStarted - -```solidity -event OwnershipTransferred( - address indexed currentOwner, - address indexed newOwner, -) -``` - -_**MUST** be fired when the **[`transferOwnership(...)`](#transferownership)** function is successfully initiated._ - -#### Values: - -| Name | Type | Description | -| :------------- | :-------- | :--------------------------------------- | -| `currentOwner` | `address` | The current owner of the contract. | -| `newOwner` | `address` | The potential new owner of the contract. | - -### OwnershipTransferred - -```solidity -event OwnershipTransferred( - address indexed previousOwner, - address indexed newOwner, -) -``` - -_**MUST** be fired when the **[`transferOwnership(...)`](#transferownership)** function is successfully executed._ - -#### Values: - -| Name | Type | Description | -| :-------------- | :-------- | :---------------------------------- | -| `previousOwner` | `address` | The previous owner of the contract. | -| `newOwner` | `address` | The new owner of the contract. | - -### RenounceOwnershipStarted - -```solidity -event RenounceOwnershipStarted() -``` - -_**MUST** be fired when the **[`renounceOwnership()`](#renounceownership)** process is initiated._ - -### OwnershipRenounced - -```solidity -event OwnershipRenounced() -``` - -_**MUST** be fired when the **[`renounceOwnership()`](#renounceownership)** process is confirmed._ - -### ValueReceived - -```solidity -event ValueReceived( - address sender, - uint256 value -) -``` - -_**MUST** be fired when when a native token is received via **[`fallback(...)`](#fallback)** function._ - -#### Values: - -| Name | Type | Description | -| :------- | :-------- | :------------------------- | -| `sender` | `address` | The address of the sender. | -| `value` | `uint256` | The amount sent. | - -### Executed - -```solidity -event Executed( - uint256 operation, - address target, - uint256 value, - bytes4 selector -) -``` - -_**MUST** be fired when the **[`execute(...)`](#execute)** function creates a new call using the `CALL` or `STATICCALL` operation._ - -#### Values: - -| Name | Type | Description | -| :---------- | :-------- | :---------------------------------------------------------------- | -| `operation` | `uint256` | The operation executed. | -| `target` | `address` | The smart contract or address interacted with. | -| `value` | `uint256` | The value transferred. | -| `selector` | `bytes4` | The bytes4 selector of the function executed at the `to` address. | - -### ContractCreated - -```solidity -event ContractCreated( - uint256 operation, - address contractAddress, - uint256 value -) -``` - -_**MUST** be fired when the **[`execute(...)`](#execute)** function creates a new contract using the `CREATE` or `CREATE2` operation._ - -#### Values: - -| Name | Type | Description | -| :---------- | :-------- | :----------------------------------- | -| `operation` | `uint256` | The operation executed. | -| `to` | `address` | The address of the created contract. | -| `value` | `uint256` | The value sent to the contract. | - -### DataChanged - -```solidity -event DataChanged(bytes32 dataKey, bytes dataValue) -``` - -_**MUST** be fired when the **[`setData(...)`](#setdata)** function is successfully executed._ - -#### Values: - -| Name | Type | Description | -| :---------- | :-------- | :------------------------------------ | -| `dataKey` | `bytes32` | The data key which data value is set. | -| `dataValue` | `bytes` | The data value to set. | - -:::info -The `DataChanged` event will emit only the first 256 bytes of `dataValue` (for large values set in the ERC725Y storage). -::: - -### UniversalReceiver - -```solidity -event UniversalReceiver( - address from, - uint256 value, - bytes32 typeId, - bytes receivedData - bytes returnedValue, -) -``` - -_**MUST** be fired when the **[`universalReceiver(...)`](#universalreceiver)** function is successfully executed._ - -#### Values: - -| Name | Type | Description | -| :-------------- | :-------- | :-------------------------------------------------------------- | -| `from` | `address` | The address calling the **universalReceiver** function. | -| `value` | `uint256` | The amount of value sent to the **universalReceiver** function. | -| `typeId` | `bytes32` | The hash of a specific standard or a hook. | -| `receivedData` | `bytes` | The arbitrary data passed to **universalReceiver** function. | -| `returnedValue` | `bytes` | The value returned by the **universalReceiver** function. | - -## References - -- [Solidity implementations (GitHub)](https://github.com/lukso-network/lsp-universalprofile-smart-contracts/tree/develop/contracts) diff --git a/docs/standards/universal-profile/lsp6-key-manager.md b/docs/standards/universal-profile/lsp6-key-manager.md index b829afb7d3..a10a3e19f2 100644 --- a/docs/standards/universal-profile/lsp6-key-manager.md +++ b/docs/standards/universal-profile/lsp6-key-manager.md @@ -435,7 +435,7 @@ The convenience function [`getData(...)`](../../tools/erc725js/classes/ERC725.md ::: -You can obtain the list of controllers that have some permissions on the linked ERC725Account by reading the `AddressPermission[]` data key via [`getData(...)`](../smart-contracts/erc725-contract.md#getdata---erc725y). +You can obtain the list of controllers that have some permissions on the linked ERC725Account by reading the `AddressPermission[]` data key via [`getData(...)`](../../contracts/contracts/ERC725/ERC725.md#getdata). - **key:** `0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3` - **value return:** the total number of address that have some permissions set (= array length) @@ -842,7 +842,7 @@ The relay transactions are signed using the [**version 0 of EIP191**](https://gi | `0x19` | Byte used to ensure that the _relay call signed data_ is not a valid RLP. | | `0x00` | The [**version 0 of EIP191**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md#version-0x00). | | `KeyManager address` | The address of the Key Manager that will execute the relay call. | -| `LSP6_VERSION` | The varsion of the Key Manager that will execute the relay call, as a `uint256`. (Current version of LSP6 Key Manager is **6**) | +| `LSP6_VERSION` | The version of the Key Manager that will execute the relay call, as a `uint256`. (Current version of LSP6 Key Manager is **6**) | | `chainId` | The chain id of the blockchain where the Key Manager is deployed, as `uint256`. | | `nonce` | The unique [**nonce**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#getnonce) for the payload. | | `validityTimestamps` | Two `uint128` timestamps concatenated, the first timestamp determines from when the payload can be executed, the second timestamp delimits the end of the validity of the payload. If `validityTimestamps` is 0, the checks of the timestamps are skipped | diff --git a/docusaurus.config.js b/docusaurus.config.js index a65a7a55fa..8a3e229ca0 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -114,6 +114,10 @@ module.exports = { from: '/standards/smart-contracts/lsp8-identifiable-digital-asset', to: '/contracts/contracts/LSP8IdentifiableDigitalAsset', }, + { + from: '/standards/smart-contracts/lsp9-vault', + to: '/contracts/contracts/LSP9Vault', + }, { from: '/standards/smart-contracts/lsp14-ownable-2-step', to: '/contracts/contracts/LSP14Ownable2Step',