Skip to content

Commit

Permalink
Merge pull request #1115 from lukso-network/86bzjrbfm
Browse files Browse the repository at this point in the history
Changed Migrate to a subsection in sidebar
  • Loading branch information
CJ42 authored Aug 9, 2024
2 parents a9df912 + e85bc4e commit 0782066
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 45 deletions.
4 changes: 2 additions & 2 deletions docs/learn/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ The benefits offered by the LUKSO Token standards are summarized in the table be
:::success
Interested to migrate? Visit our guides:

- [Migrate ERC20 to LSP7](./digital-assets/token/migrate-erc20-to-lsp7.md)
- [Migrate ERC721 to LSP8](./digital-assets/nft/migrate-erc721-to-lsp8.md)
- [Migrate ERC20 to LSP7](./migrate/migrate-erc20-to-lsp7.md)
- [Migrate ERC721 to LSP8](./migrate/migrate-erc721-to-lsp8.md)
:::

## Building on LUKSO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
sidebar_label: 'Migrate from ERC20 to LSP7'
sidebar_position: 7
sidebar_label: '🪙 ERC20 to LSP7'
sidebar_position: 2
description: Learn how to migrate your ERC20 token to the LSP7 Digital Asset standard on LUKSO.
---

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

# 🪙 Migrate ERC20 to LSP7

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

:::info

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

:::

Expand All @@ -35,7 +35,7 @@ contract MyERC20Token is ERC20 {

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

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

```solidity title="LSP7 Token"
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -67,17 +67,17 @@ ERC20: `function transferFrom(address from, address to, uint256 amount);`

LSP7: `function transfer(address from, address to, uint256 amount, bool force, bytes data);`

- For LSP7, **mint and transfer functions will have a `force` additional field**. For full compatibility with ERC20 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/LSP7-Digital-Asset.md#lsp1-token-hooks) in LSP7DigitalAsset for more info).
- For LSP7, **mint and transfer functions will have a `force` additional field**. For full compatibility with ERC20 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/LSP7-Digital-Asset.md#lsp1-token-hooks) in LSP7DigitalAsset for more info).

- For LSP7, **mint, transfer, and burn functions will have `data` as an additional field**. For full compatibility with ERC20 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/LSP7-Digital-Asset.md#lsp1-token-hooks) in LSP7DigitalAsset 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 LSP7, **mint, transfer, and burn functions will have `data` as an additional field**. For full compatibility with ERC20 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/LSP7-Digital-Asset.md#lsp1-token-hooks) in LSP7DigitalAsset 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.).

- **LSP7 metadata is generic**, in contrast to ERC20 where the metadata is limited to name and symbol. The [generic key-value store](../../../standards/lsp-background/erc725.md#erc725y-generic-data-keyvalue-store) in LSP7 allows for storing any possible data.
- **LSP7 metadata is generic**, in contrast to ERC20 where the metadata is limited to name and symbol. The [generic key-value store](../../standards/lsp-background/erc725.md#erc725y-generic-data-keyvalue-store) in LSP7 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/LSP7DigitalAsset/LSP7DigitalAsset.md) section.
To check function definitions and explanations of behavior and each parameter, check [API Reference](../../contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md) section.

:::

Expand All @@ -89,7 +89,7 @@ To interact with LSP7DigitalAsset contract, different functions should be called

:::info

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

:::

Expand All @@ -113,7 +113,7 @@ const name = await token.name();
const symbol = await token.symbol();
```

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

```javascript
// LSP7
Expand All @@ -131,7 +131,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
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
sidebar_label: 'Migrate from ERC721 to LSP8'
sidebar_position: 6
sidebar_label: '🌅 ERC721 to LSP8'
sidebar_position: 3
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
Loading

0 comments on commit 0782066

Please sign in to comment.