Skip to content

Commit

Permalink
docs: update auto-generated docs for LSP8 package
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Feb 5, 2024
1 parent 2626f19 commit 27d16ba
Show file tree
Hide file tree
Showing 9 changed files with 600 additions and 2,546 deletions.
2,283 changes: 0 additions & 2,283 deletions docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions docs/libraries/lsp1/contracts/LSP1Utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!-- This file is auto-generated. Do not edit! -->
<!-- Check `@lukso-network/lsp-smart-contracts/CONTRIBUTING.md#solidity-code-comments` for more information. -->

# LSP1Utils

:::info Standard Specifications

[`LSP-1-Utils.sol`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-Utils.sol.md)

:::
:::info Solidity implementation

[`LSP1Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/lsp1/contracts/LSP1Utils.sol)

:::

> LSP1 Utility library.
LSP1Utils is a library of utility functions that can be used to notify the `universalReceiver` function of a contract that implements LSP1 and retrieve informations related to LSP1 `typeId`. Based on LSP1 Universal Receiver standard.

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

### notifyUniversalReceiver

```solidity
function notifyUniversalReceiver(
address lsp1Implementation,
bytes32 typeId,
bytes data
) internal nonpayable;
```

Notify a contract at `lsp1Implementation` address by calling its `universalReceiver` function if this contract
supports the LSP1 interface.

#### Parameters

| Name | Type | Description |
| -------------------- | :-------: | -------------------------------------------------------------------------------------------------- |
| `lsp1Implementation` | `address` | The address of the contract to notify. |
| `typeId` | `bytes32` | A `bytes32` typeId. |
| `data` | `bytes` | Any optional data to send to the `universalReceiver` function to the `lsp1Implementation` address. |

<br/>

### getLSP1DelegateValue

```solidity
function getLSP1DelegateValue(
mapping(bytes32 => bytes) erc725YStorage
) internal view returns (bytes);
```

_Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate`._

Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
the value set under the `LSP1UniversalReceiverDelegate` data key.

#### Parameters

| Name | Type | Description |
| ---------------- | :-------------------------: | ----------------------------------------------------------- |
| `erc725YStorage` | `mapping(bytes32 => bytes)` | A reference to the ERC725Y storage mapping of the contract. |

#### Returns

| Name | Type | Description |
| ---- | :-----: | -------------------------------------------------------------------------- |
| `0` | `bytes` | The bytes value stored under the `LSP1UniversalReceiverDelegate` data key. |

<br/>

### getLSP1DelegateValueForTypeId

```solidity
function getLSP1DelegateValueForTypeId(
mapping(bytes32 => bytes) erc725YStorage,
bytes32 typeId
) internal view returns (bytes);
```

_Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate:<type-id>` for a specific `typeId`._

Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
the value set under the `LSP1UniversalReceiverDelegate:<bytes32>` data key for a specific LSP1 `typeId`.

#### Parameters

| Name | Type | Description |
| ---------------- | :-------------------------: | ----------------------------------------------------------- |
| `erc725YStorage` | `mapping(bytes32 => bytes)` | A reference to the ERC725Y storage mapping of the contract. |
| `typeId` | `bytes32` | A bytes32 LSP1 `typeId`; |

#### Returns

| Name | Type | Description |
| ---- | :-----: | ------------------------------------------------------------------------------------ |
| `0` | `bytes` | The bytes value stored under the `LSP1UniversalReceiverDelegate:<bytes32>` data key. |

<br/>
113 changes: 113 additions & 0 deletions docs/libraries/lsp10/contracts/LSP10Utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!-- This file is auto-generated. Do not edit! -->
<!-- Check `@lukso-network/lsp-smart-contracts/CONTRIBUTING.md#solidity-code-comments` for more information. -->

# LSP10Utils

:::info Standard Specifications

[`LSP-10-Utils.sol`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-10-Utils.sol.md)

:::
:::info Solidity implementation

[`LSP10Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/lsp10/contracts/LSP10Utils.sol)

:::

> LSP10 Utility library.
LSP5Utils is a library of functions that can be used to register and manage vaults received by an ERC725Y smart contract. Based on the LSP10 Received Vaults standard.

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

### generateReceivedVaultKeys

:::caution Warning

This function returns empty arrays when encountering errors. Otherwise the arrays will contain 3 data keys and 3 data values.

:::

```solidity
function generateReceivedVaultKeys(
address receiver,
address vaultAddress
) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues);
```

Generate an array of data keys/values pairs to be set on the receiver address after receiving vaults.

#### Parameters

| Name | Type | Description |
| -------------- | :-------: | ------------------------------------------------------------------------------ |
| `receiver` | `address` | The address receiving the vault and where the LSP10 data keys should be added. |
| `vaultAddress` | `address` | The address of the vault being received. |

#### Returns

| Name | Type | Description |
| ----------------- | :---------: | --------------------------------------------------------------------- |
| `lsp10DataKeys` | `bytes32[]` | An array data keys used to update the [LSP-10-ReceivedAssets] data. |
| `lsp10DataValues` | `bytes[]` | An array data values used to update the [LSP-10-ReceivedAssets] data. |

<br/>

### generateSentVaultKeys

:::caution Warning

Returns empty arrays when encountering errors. Otherwise the arrays must have at least 3 data keys and 3 data values.

:::

```solidity
function generateSentVaultKeys(
address sender,
address vaultAddress
) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues);
```

Generate an array of data key/value pairs to be set on the sender address after sending vaults.

#### Parameters

| Name | Type | Description |
| -------------- | :-------: | ------------------------------------------------------------------------------ |
| `sender` | `address` | The address sending the vault and where the LSP10 data keys should be updated. |
| `vaultAddress` | `address` | The address of the vault that is being sent. |

#### Returns

| Name | Type | Description |
| ----------------- | :---------: | --------------------------------------------------------------------- |
| `lsp10DataKeys` | `bytes32[]` | An array data keys used to update the [LSP-10-ReceivedAssets] data. |
| `lsp10DataValues` | `bytes[]` | An array data values used to update the [LSP-10-ReceivedAssets] data. |

<br/>

### getLSP10ArrayLengthBytes

```solidity
function getLSP10ArrayLengthBytes(contract IERC725Y erc725YContract) internal view returns (bytes);
```

Get the raw bytes value stored under the `_LSP10_VAULTS_ARRAY_KEY`.

#### Parameters

| Name | Type | Description |
| ----------------- | :-----------------: | ----------------------------------------------- |
| `erc725YContract` | `contract IERC725Y` | The contract to query the ERC725Y storage from. |

#### Returns

| Name | Type | Description |
| ---- | :-----: | ----------------------------------------------- |
| `0` | `bytes` | The raw bytes value stored under this data key. |

<br/>
115 changes: 115 additions & 0 deletions docs/libraries/lsp5/contracts/LSP5Utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<!-- This file is auto-generated. Do not edit! -->
<!-- Check `@lukso-network/lsp-smart-contracts/CONTRIBUTING.md#solidity-code-comments` for more information. -->

# LSP5Utils

:::info Standard Specifications

[`LSP-5-Utils.sol`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-5-Utils.sol.md)

:::
:::info Solidity implementation

[`LSP5Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/lsp5/contracts/LSP5Utils.sol)

:::

> LSP5 Utility library.
LSP5Utils is a library of functions that can be used to register and manage assets under an ERC725Y smart contract. Based on the LSP5 Received Assets standard.

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

### generateReceivedAssetKeys

:::caution Warning

Returns empty arrays when encountering errors. Otherwise the arrays must have 3 data keys and 3 data values.

:::

```solidity
function generateReceivedAssetKeys(
address receiver,
address assetAddress,
bytes4 assetInterfaceId
) internal view returns (bytes32[] lsp5DataKeys, bytes[] lsp5DataValues);
```

Generate an array of data key/value pairs to be set on the receiver address after receiving assets.

#### Parameters

| Name | Type | Description |
| ------------------ | :-------: | ----------------------------------------------------------------------------- |
| `receiver` | `address` | The address receiving the asset and where the LSP5 data keys should be added. |
| `assetAddress` | `address` | The address of the asset being received (_e.g: an LSP7 or LSP8 token_). |
| `assetInterfaceId` | `bytes4` | The interfaceID of the asset being received. |

#### Returns

| Name | Type | Description |
| ---------------- | :---------: | -------------------------------------------------------------------- |
| `lsp5DataKeys` | `bytes32[]` | An array Data Keys used to update the [LSP-5-ReceivedAssets] data. |
| `lsp5DataValues` | `bytes[]` | An array Data Values used to update the [LSP-5-ReceivedAssets] data. |

<br/>

### generateSentAssetKeys

:::caution Warning

Returns empty arrays when encountering errors. Otherwise the arrays must have at least 3 data keys and 3 data values.

:::

```solidity
function generateSentAssetKeys(
address sender,
address assetAddress
) internal view returns (bytes32[] lsp5DataKeys, bytes[] lsp5DataValues);
```

Generate an array of Data Key/Value pairs to be set on the sender address after sending assets.

#### Parameters

| Name | Type | Description |
| -------------- | :-------: | ----------------------------------------------------------------------------- |
| `sender` | `address` | The address sending the asset and where the LSP5 data keys should be updated. |
| `assetAddress` | `address` | The address of the asset that is being sent. |

#### Returns

| Name | Type | Description |
| ---------------- | :---------: | -------------------------------------------------------------------- |
| `lsp5DataKeys` | `bytes32[]` | An array Data Keys used to update the [LSP-5-ReceivedAssets] data. |
| `lsp5DataValues` | `bytes[]` | An array Data Values used to update the [LSP-5-ReceivedAssets] data. |

<br/>

### getLSP5ArrayLengthBytes

```solidity
function getLSP5ArrayLengthBytes(contract IERC725Y erc725YContract) internal view returns (bytes);
```

Get the raw bytes value stored under the `_LSP5_RECEIVED_ASSETS_ARRAY_KEY`.

#### Parameters

| Name | Type | Description |
| ----------------- | :-----------------: | ----------------------------------------------- |
| `erc725YContract` | `contract IERC725Y` | The contract to query the ERC725Y storage from. |

#### Returns

| Name | Type | Description |
| ---- | :-----: | ----------------------------------------------- |
| `0` | `bytes` | The raw bytes value stored under this data key. |

<br/>
33 changes: 19 additions & 14 deletions dodoc/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ export const dodocConfig = {
'lsp7/contracts/extensions/LSP7CompatibleERC20.sol',
'lsp7/contracts/presets/LSP7CompatibleERC20Mintable.sol',
'lsp7/contracts/presets/LSP7Mintable.sol',
'contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol',
'contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol',
'contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol',
'contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol',
'contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol',
'contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol',
'contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol',
'lsp8/contracts/LSP8IdentifiableDigitalAsset.sol',
'lsp8/contracts/extensions/LSP8Burnable.sol',
'lsp8/contracts/extensions/LSP8CappedSupply.sol',
'lsp8/contracts/extensions/LSP8CompatibleERC721.sol',
'lsp8/contracts/extensions/LSP8Enumerable.sol',
'lsp8/contracts/presets/LSP8CompatibleERC721Mintable.sol',
'lsp8/contracts/presets/LSP8Mintable.sol',

// libraries --------------------
'contracts/LSP1UniversalReceiver/LSP1Utils.sol',
'lsp1/contracts/LSP1Utils.sol',
'lsp2/contracts/LSP2Utils.sol',
'contracts/LSP5ReceivedAssets/LSP5Utils.sol',
'lsp5/contracts/LSP5Utils.sol',
'lsp6/contracts/LSP6Utils.sol',
'contracts/LSP10ReceivedVaults/LSP10Utils.sol',
'lsp10/contracts/LSP10Utils.sol',
'lsp17contractextension/contracts/LSP17Utils.sol',

// external --------------------
'@erc725/smart-contracts/contracts/ERC725.sol',
],
libraries: [
'contracts/LSP1UniversalReceiver/LSP1Utils.sol',
'lsp1/contracts/LSP1Utils.sol',
'lsp2/contracts/LSP2Utils.sol',
'lsp5/contracts/LSP5Utils.sol',
'lsp6/contracts/LSP6Utils.sol',
Expand Down Expand Up @@ -335,10 +335,15 @@ const generateContractSpecsDetails = (contractName: string) => {
if (value.endsWith(`${contractName}.sol`)) return value;
})[0];

if (contractPath.startsWith('lsp7/contracts')) {
// token contracts have preset and extension folders.
if (contractPath.startsWith('lsp7/contracts') || contractPath.startsWith('lsp8/contracts')) {
const lspNumber = contractPath[3];
const lspName = lspNumber === '8' ? 'IdentifiableDigitalAsset' : 'DigitalAsset';
const specsName = `LSP-${lspNumber}-${lspName}`;

return {
specsName: 'LSP-7-DigitalAsset',
specsLink: `${linkBase}lips/tree/main/LSPs/LSP-7-DigitalAsset.md`,
specsName: specsName,
specsLink: `${linkBase}lips/tree/main/LSPs/${specsName}.md`,
};
}

Expand Down

0 comments on commit 27d16ba

Please sign in to comment.