From b1876d5568d38c293ff54b888a51ac5eac08d8c5 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Tue, 26 Mar 2024 23:48:07 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Lucas Tortora <85233773+lucas-tortora@users.noreply.github.com> --- .../how-tos/core-contracts/nft/introduction.md | 4 ++-- .../docs/how-tos/core-contracts/nft/mint-nft.md | 16 ++++++++-------- .../how-tos/core-contracts/nft/use-as-erc721.md | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/introduction.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/introduction.md index d2fe8352998..506f0dfef13 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/introduction.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/introduction.md @@ -11,7 +11,7 @@ import DocCardList from '@theme/DocCardList'; # Native NFT and ERC721 -The IOTA L1 has functionality to create NFTs, also called native NFTs. To use these NFTs on L2, you have -a ERC20 contract called `ERC721NFTs` which contains all L1 NFTs owned by the chain. The following guides will show you how to [mint your own L1 NFT from L2](./mint-nft.md), and [use](./use-as-erc721.md) it with the `ERC721NFTs` contract. +The IOTA L1 can create NFTs, also called native NFTs. To use these NFTs on L2, you have +an ERC20 contract called `ERC721NFTs`, which contains all L1 NFTs owned by the chain. The following guides will show you how to [mint your own L1 NFT from L2](./mint-nft.md) and [use](./use-as-erc721.md) it with the `ERC721NFTs` contract. \ No newline at end of file diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/mint-nft.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/mint-nft.md index 2bceee58a13..d889d7972a2 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/mint-nft.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/mint-nft.md @@ -11,7 +11,7 @@ import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_int # Mint an NFT ## About NFTs -The Stardust update allows you to create your own NFT. There ias also the [IRC27](/tips/tips/TIP-0027) for NFTs. This guide will show you how to create an IRC27 L1 NFT using a L2 smart contract. +The Stardust update allows you to create your own NFTs. You can also use [IRC27](/tips/tips/TIP-0027) for NFTs. This guide will show you how to create an IRC27 L1 NFT using a L2 smart contract. ## Example Code @@ -23,7 +23,7 @@ The Stardust update allows you to create your own NFT. There ias also the [IRC27 ISCAgentID memory agentID = ISC.sandbox.getSenderAccount(); ``` -3. Create a `IRC27Metadata` struct intitialised with all the needed data: +3. Create an `IRC27Metadata` struct with all the needed data: ```solidity IRC27NFTMetadata memory metadata = IRC27NFTMetadata({ @@ -35,9 +35,9 @@ IRC27NFTMetadata memory metadata = IRC27NFTMetadata({ }); ``` -4. Create all the data for the core contract call. To do that, we create a new `ISCDict` with 2 parameters like specified in the reference docs for [`mintNFT`](../../../reference/core-contracts/accounts.md#mintnfti-immutabledata-a-agentid-c-collectionid-w-withdrawonmint) -`I` is the immutable metadata we fill with the IRC27 metadata and -`a` is the AgendID of the owner of the NFT +4. Create all the data for the core contract call. To do so, you should create a new `ISCDict` with 2 parameters like specified in the reference docs for [`mintNFT`](../../../reference/core-contracts/accounts.md#mintnfti-immutabledata-a-agentid-c-collectionid-w-withdrawonmint) +* `I` is the immutable metadata we fill with the IRC27 metadata and +* `a` is the AgendID of the owner of the NFT ```solidity ISCDict memory params = ISCDict(new ISCDictItem[](2)); @@ -47,11 +47,11 @@ params.items[1] = ISCDictItem("a", agentID.data); :::info IRC27NFTMetadataToString -The full example below contains the `IRC27NFTMetadataToString` which just converts the IRC27Metadata struct into a string. +The full example below calls the `IRC27NFTMetadataToString` function, which simply converts the IRC27Metadata struct into a string. ::: -5. Call the magic contract `call` function with all the parameters. We need to specify the core contract we want to call, which in our case is [`account`](../../../reference/core-contracts/accounts.md) and the function for [minting an NFT](../../../reference/core-contracts/accounts.md#mintnfti-immutabledata-a-agentid-c-collectionid-w-withdrawonmint) +5. Call the magic contract `call` function with all the parameters. You should specify the core contract you want to call, which in this case is the [`account`](../../../reference/core-contracts/accounts.md) contract, and the function for [minting an NFT](../../../reference/core-contracts/accounts.md#mintnfti-immutabledata-a-agentid-c-collectionid-w-withdrawonmint) ```solidity ISCDict memory ret = ISC.sandbox.call( @@ -62,7 +62,7 @@ ISCDict memory ret = ISC.sandbox.call( ); ``` -6. The call return value will contain a mintID which we can use in for example another contract function to get the actual L1 NFT ID once it got created with the [`accounts.NFTIDbyMintID`](../../../reference/core-contracts/accounts.md#nftidbymintidd-mintid) function +6. The call return value will contain a `mintID` which we can use in, for example, another contract function to get the actual L1 NFT ID once it is created using the [`accounts.NFTIDbyMintID`](../../../reference/core-contracts/accounts.md#nftidbymintidd-mintid) function ```solidity function getNFTIDFromMintID(bytes memory mintID) public view returns (bytes memory) { diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/use-as-erc721.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/use-as-erc721.md index b36261c06eb..2263adca84c 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/use-as-erc721.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/nft/use-as-erc721.md @@ -10,11 +10,11 @@ tags: # Use as ERC721 ## About the `ERC721NFTs` contract -The `ERC721NFTs` contract is a harcoded contract at address `0x1074030000000000000000000000000000000000`. Every L1 NFT owned by the chain can be accessed through it. In this example we will show you how to use it by taking `transferFrom` as an example. +The `ERC721NFTs` contract is a hardcoded contract at address `0x1074030000000000000000000000000000000000`. Every L1 NFT owned by the chain can be accessed through it. In this example, we will show you how to use it by using `transferFrom`. ## Example Code -1. ERC721 uses `tokenID` for almost all interactions with it. So we first convert our `NFTID` to a `tokenID`: +1. ERC721 uses the `tokenID` for almost all interactions with it. So first, you should convert the `NFTID` to a `tokenID`: ```solidity uint256 tokenID = uint256(NFTID.unwrap(nftID)); @@ -22,11 +22,11 @@ uint256 tokenID = uint256(NFTID.unwrap(nftID)); :::info Token ID to NFT ID -To go the other way around and convert a Token ID to an NFT ID, you can use the ISCTypes.asNFTID() function, by either using (`using ISCTypes for uint256;`) it on token ID like `tokenID.asNFTID();` or passing it to function like `ISCTypes.asNFTID(tokenID)`. +You can use the ISCTypes.asNFTID() function to convert a Token ID to an NFT ID, by either using it on a token ID `tokenID.asNFTID();` or passing it to function `ISCTypes.asNFTID(tokenID)`. ::: -2. Transfer the token with ID `tokenID`, by using the `ERC20NFTs` contract, which is exposed in the library as `ISC.nfts`, and calling the standard `transferFrom` function +2. Transfer the token with ID `tokenID`, by using the `ERC20NFTs` contract, which is exposed in the library as `ISC.nfts`, and calling the standard `transferFrom` function: ```solidity ISC.nfts.transferFrom(msg.sender, _destination, tokenID);