Skip to content

Commit

Permalink
Merge pull request #1108 from lukso-network/86bz433jz
Browse files Browse the repository at this point in the history
Create page "Choose LSP7 vs LSP8" + re-organise sidebar for Digital Assets in Learn
  • Loading branch information
CJ42 authored Aug 1, 2024
2 parents 931f420 + 07c14a8 commit 0a69ad4
Show file tree
Hide file tree
Showing 25 changed files with 209 additions and 52 deletions.
146 changes: 146 additions & 0 deletions docs/learn/digital-assets/choose-lsp7-vs-lsp8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
sidebar_label: '❓ Choose between LSP7 or LSP8'
sidebar_position: 2
description: Discover which standard is best suited for your token or NFT project between LSP7 or LSP8.
---

# Choose between LSP7 or LSP8

This page provides guidance on which standard and combination to choose for your project. Both LSP7 and LSP8 coupled with the `LSP4TokenType` data key allow to create NFT collections on LUKSO. From simple to more complex!

## Available Options

There are 4 x main popular combination of LSP7 / LSP8 + the `LSP4TokenType`.

<table id="token-nft-combinations">
<tr>
<th rowspan="2">Description</th>
<th colspan="2">Standard</th>
<th colspan="3">LSP4 Token Type</th>
</tr>
<tr>
<th>LSP7</th>
<th>LSP8</th>
<th>(0) Token</th>
<th>(1) NFT</th>
<th>(2) Collection</th>
</tr>
<tr>
<td>Fungible Token</td>
<td>✓</td>
<td></td>
<td>✓</td>
<td></td>
<td></td>
</tr>
<tr>
<td>_"NFT-like"_ digital item with multiple ownable quantities</td>
<td>✓</td>
<td></td>
<td></td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>A collection of unique items</td>
<td></td>
<td>✓</td>
<td>✓</td>
<td></td>
<td></td>
</tr>
<tr>
<td>An _"umbrella"_ collection containing multiple sub-collections</td>
<td></td>
<td>✓</td>
<td></td>
<td></td>
<td>✓</td>
</tr>
</table>

```mermaid
flowchart TD
Start{"LSP4TokenType"}
LSP7Token("LSP7 Token (e.g., **Dollar**, Euro)")
LSP8Decision{"LSP7 or LSP8 NFT"}
LSP8NFT("LSP8 NFT (e.g., mixed collection)")
NFT("Unique NFT (e.g., unique watch collection, each watch is a one of a kind)")
XYZ("NFT with multiple ownable quantities (e.g., t-shirt collection, same design in multiple quantities)")
supportsInterface("supportsInterface")
Start -->|"0"| LSP7Token
Start -->|"1"| LSP8Decision
Start -->|"2"| LSP8NFT
LSP8Decision --> supportsInterface
supportsInterface -->|"LSP7"| XYZ
supportsInterface -->|"LSP8"| NFT
```

## Fungible Token

![LSP7 Token Type Token (0)](/img/learn/lsp7-token-type-token.png)

### Characteristics

- divisible (unless `decimals()` overwritten to `0`).
- 18 decimals by default (unless overwritten to have less decimals, like USDT for example which has 6 decimals).
- The `LSP4Metadata` represents the metadata of the fungible token.

### Example Use Cases

- a digital currency
- a meme coin
- a share in a com
- a voting token.
- a reward token.
- a utility token.

---

## Multiple Ownable Digital Items

![LSP7 Token Type NFT (1)](/img/learn/lsp7-token-type-nft.png)

### Characteristics

- Non divisible (decimals is `0`).
- Each items can't be uniquely identified by an ID in the collection. They are all the same.
- All items share the same metadata. There is no metadata specific per item.
- The `LSP4Metadata` represents the metadata of each item (they are all the same).

### Example Use Cases

- a contract with 500 x digital t-shirts.
- a contract with 1000 x digital tickets.

---

## Standard NFT Collection

![LSP8 Token Type NFT (1)](/img/learn/lsp8-token-type-nft.png)

### Characteristics

- The `LSP4Metadata` represents the metadata of the whole NFT Collection.
- All the NFTs live in the same smart contract.
- Each NFT can be uniquely identified by a `tokenId` in the collection.
- Each NFT can have its own custom metadata. This can be set via:
- `setDataForTokenId(...)` for each NFT.
- by setting the `LSP8MetadataBaseURI` and appending the `tokenId` to the base URI.

### Example Use Cases

- a collection of unique watches with their serial number.
- a collection of unique digital art pieces.

---

## Collection of Sub-Collections

![LSP8 Token Type Collection (2)](/img/learn/lsp8-token-type-collection.png)

### Characteristics

- Each tokenId is a of `LSP8TokenIdFormat` of `Address`.
- Each sub-collection is a smart contract that can be either an LSP7 or LSP8
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: 'Introduction to implementation cascade and sense protocol of nfts

:::success Useful Tip

The [guide section](../create-lsp7-token.md) will walk you through uploading images and metadata to Cascade and Sense protocol on [LUKSO Testnet](../../../networks/testnet/parameters.md).
The [guide section](../../digital-assets/token/create-lsp7-token.md) will walk you through uploading images and metadata to Cascade and Sense protocol on [LUKSO Testnet](../../../networks/testnet/parameters.md).

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You can find all the contracts, sample metadata, and scripts of the guide within

:::info Contract Deployment

If you want to learn more about the contract deployment itself, please have a look at the [Create LSP7 Token](../create-lsp7-token.md) guides before you continue.
If you want to learn more about the contract deployment itself, please have a look at the [Create LSP7 Token](../../digital-assets/token/create-lsp7-token.md) guides before you continue.

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ After you retrieved the key and value of your [ERC725Y](../../../standards/lsp-b

:::tip Sample Implementation

You can follow our [Deploy Token With Metadata](../../universal-profile/interactions/batch-transactions.md#deploy-a-token--set-metadata) and [Set NFT Metadata](./set-nft-metadata.md) Guides to set or update contract metadata.
You can follow our [Deploy Token With Metadata](../../universal-profile/interactions/batch-transactions.md#deploy-a-token--set-metadata) and [Set NFT Metadata](../nft/set-nft-metadata.md) Guides to set or update contract metadata.

:::
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
label: '🌅 Create an NFT Collection'
collapsed: true
position: 5
position: 4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_label: '👾 Collection with LSP7'
sidebar_position: 4
sidebar_position: 2
description: Learn how to create an NFT Collection on LUKSO using LSP7 Digital Asset standard.
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_label: '🗃 Collection with LSP8'
sidebar_position: 3
sidebar_position: 1
description: Learn how to create an NFT Collection on LUKSO using LSP8 Identifiable Digital Asset standard.
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_label: '🃏 Collection of Subcollections'
description: 'Learn how to create a NFT collection where each NFT is a contract'
sidebar_position: 9
sidebar_position: 3
---

# Create NFT Collection with a contract address as tokenId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
sidebar_label: '🖼️ Migrate ERC721 to LSP8'
sidebar_position: 8
sidebar_label: 'Migrate from ERC721 to LSP8'
sidebar_position: 6
description: Learn how to migrate your ERC721 token to the LSP8 Identifiable Digital Asset standard on LUKSO.
---

import Erc721LSP8Table from '@site/src/components/Erc721LSP8Table';

# 🖼️ Migrate ERC721 to LSP8

[LSP8IdentifiableDigitalAsset](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md) is a new token standard that offers a wider range of functionality compared to [ERC721](https://eips.ethereum.org/EIPS/eip-721), as described in the [standard section](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md). For migrating from ERC721 to LSP8, developers need to be aware of several key differences.
[LSP8IdentifiableDigitalAsset](../../../standards/tokens/LSP8-Identifiable-Digital-Asset.md) is a new token standard that offers a wider range of functionality compared to [ERC721](https://eips.ethereum.org/EIPS/eip-721), as described in the [standard section](../../../standards/tokens/LSP8-Identifiable-Digital-Asset.md). For migrating from ERC721 to LSP8, developers need to be aware of several key differences.

:::info

If you need more details about the interface differences between ERC721 and LSP8, please visit our [contract overview](../../contracts/overview/DigitalAssets/#comparisons-with-erc20--erc721) page.
If you need more details about the interface differences between ERC721 and LSP8, please visit our [contract overview](../../../contracts/overview/DigitalAssets#comparisons-with-erc20--erc721) page.

:::

Expand All @@ -35,7 +35,7 @@ contract MyERC721Token is ERC721 {

To create an LSP8 NFT, `LSP8` is imported from [@lukso/lsp8-contracts](https://www.npmjs.com/package/@lukso/lsp8-contracts) package, and inherited.

The constructor arguments definitions can be found explained in the [constructor API](../../contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md#constructor) section.
The constructor arguments definitions can be found explained in the [constructor API](../../../contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md#constructor) section.

```js
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -68,17 +68,17 @@ ERC721: `function transferFrom(address from, address to, uint256 tokenId);`

LSP8: `function transfer(address from, address to, bytes32 tokenId, bool force, bytes data);`

- For LSP8, **mint and transfer functions will have a `force` additional field**. For full compatibility with ERC721 behavior (where the recipient can be any address), set this to `true`. Setting it to `false` will only allow the transfer to smart contract addresses supporting the LSP1 interfaceId. (Check [LSP1UniversalReceiver section](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md#lsp1-token-hooks) in LSP8IdentifiableDigitalAsset for more info).
- For LSP8, **mint and transfer functions will have a `force` additional field**. For full compatibility with ERC721 behavior (where the recipient can be any address), set this to `true`. Setting it to `false` will only allow the transfer to smart contract addresses supporting the LSP1 interfaceId. (Check [LSP1UniversalReceiver section](../../../standards/tokens/LSP8-Identifiable-Digital-Asset.md#lsp1-token-hooks) in LSP8IdentifiableDigitalAsset for more info).

- For LSP8, **mint, transfer, and burn functions will have `data` as an additional field**. For full compatibility with ERC721 behavior, set this to empty bytes. This data will only be relevant when the recipient is a smart contract address supporting the LSP1 interfaceId (Check [LSP1UniversalReceiver section](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md#lsp1-token-hooks)in LSP8IdentifiableDigitalAsset for more info), where the data will be sent and the recipient can act on it (e.g., reject the transfer, forward the tokens to a vault, etc.).
- For LSP8, **mint, transfer, and burn functions will have `data` as an additional field**. For full compatibility with ERC721 behavior, set this to empty bytes. This data will only be relevant when the recipient is a smart contract address supporting the LSP1 interfaceId (Check [LSP1UniversalReceiver section](../../../standards/tokens/LSP8-Identifiable-Digital-Asset.md#lsp1-token-hooks)in LSP8IdentifiableDigitalAsset for more info), where the data will be sent and the recipient can act on it (e.g., reject the transfer, forward the tokens to a vault, etc.).

- **LSP8 metadata is generic**, in contrast to ERC721 where the metadata is limited to name and symbol and tokenURI. The [generic key-value store](../../standards/lsp-background/erc725.md#erc725y-generic-data-keyvalue-store) in LSP8 allows for storing any possible data.
- **LSP8 metadata is generic**, in contrast to ERC721 where the metadata is limited to name and symbol and tokenURI. The [generic key-value store](../../../standards/lsp-background/erc725.md#erc725y-generic-data-keyvalue-store) in LSP8 allows for storing any possible data.

## Interacting with Contracts

:::info

To check function definitions and explanations of behavior and each parameter, check [API Reference](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md) section.
To check function definitions and explanations of behavior and each parameter, check [API Reference](../../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md) section.

:::

Expand All @@ -90,7 +90,7 @@ To interact with LSP8IdentifiableDigitalAsset contract, different functions shou

:::info

To check event definitions and explanations of behavior and each parameter, check [API Reference](../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md) section.
To check event definitions and explanations of behavior and each parameter, check [API Reference](../../../contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md) section.

:::

Expand All @@ -116,7 +116,7 @@ const symbol = await token.symbol();
const tokenURI = await token.tokenURI(tokenId);
```

In LSP8, the token name and symbol can be retrieved with [getData](../../contracts/contracts/ERC725/ERC725.md#getdata) function, since LSP8 uses a generic metadata key value store:
In LSP8, the token name and symbol can be retrieved with [getData](../../../contracts/contracts/ERC725/ERC725.md#getdata) function, since LSP8 uses a generic metadata key value store:

```javascript
// LSP8
Expand All @@ -134,7 +134,7 @@ const symbol = ethers.toUtf8String(symbolValue);

:::info

To learn more about setting and creating the LSP4Metadata JSON, check the [metadata](../digital-assets/metadata-management/metadata-preparation.md) section.
To learn more about setting and creating the LSP4Metadata JSON, check the [metadata](../../digital-assets/metadata-management/metadata-preparation.md) section.

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/learn/digital-assets/retrieve-token-type.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_label: '🔍 Detect Token Type'
sidebar_position: 6
sidebar_position: 3
description: Retrieve LUKSO LSP token types and detect if an asset is a Token, an NFT, or a collection.
---

Expand Down
3 changes: 3 additions & 0 deletions docs/learn/digital-assets/token/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
label: '🪙 Create a Token'
collapsed: true
position: 3
Loading

0 comments on commit 0a69ad4

Please sign in to comment.