Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial: Cross-chain NFT marketplace #1634

Merged
merged 8 commits into from
Jul 15, 2024

Conversation

salaheldinsoliman
Copy link
Contributor

@salaheldinsoliman salaheldinsoliman commented Jun 27, 2024

Description of change

A cross-chain NFT marketplace: Part I

Links to any relevant issues

fixes #1625

Type of change

  • Documentation Enhancement

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own changes
  • I have made sure that added/changed links still work
  • I have commented my code, particularly in hard-to-understand areas

Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Copy link
Contributor

@jorgemmsilva jorgemmsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, could use a few hardhat tests and not just manual testing with scripts, but it's quite nice 👍

In this series of tutorials, we will be building a cross-chain NFT marketplace using IOTA Smart Contracts (ISC). The marketplace will allow users to trade NFTs on ShimmerEVM Testnet, BNB Testnet, and Shimmer Testnet.

Part I will cover the setup of the project and the deployment of the NFT marketplace contract on the ShimmerEVM Testnet.
In part II, we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet and list them on the marketplace.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet

this is confusing. I think we should make it clear that we're talking about "L1 Shimmer testnet NFTs", maybe moving it into a separate sentence. Or dropping the L1 part in this tutorial entirely

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In part II, we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet and list them on the marketplace.
The second part of the series will focus on bridging NFTs from Layer 1 networks, like the Shimmer and BNB Testnets, to the ShimmerEVM Testnet and listing them on the marketplace you created in part I.

Copy link
Collaborator

@lucas-tortora lucas-tortora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start :) Please use references for the imports, and explain the contracts and scripts step by step. The idea for tutorials is to teach the user how to do this, more than how to clone the repo and run the scripts. So we need to walk them step by step so they can build their own implementation, while using the repository as an example.

@@ -249,4 +249,24 @@ module.exports = [
],
},
],
[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be a good idea to move this tutorial into the ISC docs directly, under a new folder called tutorials. There are currently no links pointing to the tutorial section, as lots are outdated.

wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the other tutorials are outdated it would be a good idea to separate them yes, until they are given a review to refresh them

@@ -0,0 +1,572 @@
# Cross-chain NFT Marketplace: Part I

In this series of tutorials, we will be building a cross-chain NFT marketplace using IOTA Smart Contracts (ISC). The marketplace will allow users to trade NFTs on ShimmerEVM Testnet, BNB Testnet, and Shimmer Testnet.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this series of tutorials, we will be building a cross-chain NFT marketplace using IOTA Smart Contracts (ISC). The marketplace will allow users to trade NFTs on ShimmerEVM Testnet, BNB Testnet, and Shimmer Testnet.
This is the first part of a three-part series that will guide you as you build a cross-chain NFT marketplace using IOTA Smart Contracts (ISC). The marketplace will allow users to trade NFTs on the ShimmerEVM Testnet, BNB Testnet, and Shimmer L1 Testnet.

In this series of tutorials, we will be building a cross-chain NFT marketplace using IOTA Smart Contracts (ISC). The marketplace will allow users to trade NFTs on ShimmerEVM Testnet, BNB Testnet, and Shimmer Testnet.

Part I will cover the setup of the project and the deployment of the NFT marketplace contract on the ShimmerEVM Testnet.
In part II, we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet and list them on the marketplace.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In part II, we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet and list them on the marketplace.
The second part of the series will focus on bridging NFTs from Layer 1 networks, like the Shimmer and BNB Testnets, to the ShimmerEVM Testnet and listing them on the marketplace you created in part I.


Part I will cover the setup of the project and the deployment of the NFT marketplace contract on the ShimmerEVM Testnet.
In part II, we will bridge NFTs from BNB Testnet and Shimmer Testnet to the ShimmerEVM Testnet and list them on the marketplace.
Finally, in part III, we will deploy another instance of the marketplace on the BNB Testnet, making the marketplace truly cross-chain by making the contract handle cross-chain transactions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Finally, in part III, we will deploy another instance of the marketplace on the BNB Testnet, making the marketplace truly cross-chain by making the contract handle cross-chain transactions.
Finally, in part III, you will deploy another instance of the marketplace on the BNB Testnet, making the marketplace truly cross-chain.

});
```
This will deploy the MyERC721 contract to the ShimmerEVM Testnet and save the contract address to a file.
run it by executing:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run it by executing:
You can run the script by executing the following command:


### mint_nft.js

After deploying the MyERC721 contract, let's mint an NFT by running the following script:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After deploying the MyERC721 contract, let's mint an NFT by running the following script:
After you have deployed the `MyERC721` contract, you are ready to mint an NFT using the following script:

Comment on lines 387 to 414
```javascript
const fs = require('fs');
const path = require('path');

async function createNFT(myERC721Address) {

const MyERC721 = await ethers.getContractFactory("MyERC721");
const myERC721 = MyERC721.attach(myERC721Address);

const tx = await myERC721.mint();
await tx.wait(); // Wait for the transaction to be mined
}

async function main() {
// Read the contract address from the file
const addressPath = path.join(__dirname, 'addresses', 'MyERC721.txt');
const myERC721Address = fs.readFileSync(addressPath, 'utf8').trim();

await createNFT(myERC721Address);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```javascript
const fs = require('fs');
const path = require('path');
async function createNFT(myERC721Address) {
const MyERC721 = await ethers.getContractFactory("MyERC721");
const myERC721 = MyERC721.attach(myERC721Address);
const tx = await myERC721.mint();
await tx.wait(); // Wait for the transaction to be mined
}
async function main() {
// Read the contract address from the file
const addressPath = path.join(__dirname, 'addresses', 'MyERC721.txt');
const myERC721Address = fs.readFileSync(addressPath, 'utf8').trim();
await createNFT(myERC721Address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
```
```javascript reference
https://github.com/iota-community/ISC-Cross-Chain-NFT-Marketplace/blob/main/scripts/mint_nft.js
```

process.exit(1);
});
```
execute the script by running:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
execute the script by running:
You can run the script by executing the following command:

Comment on lines 420 to 422


### approve_myERC721_for_marketplace.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### approve_myERC721_for_marketplace.js
### approve_myERC721_for_marketplace.js

Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Copy link
Collaborator

@lucas-tortora lucas-tortora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing improvement !!! Last batch of comments on my end :) Btw, you don't need to add the suggestions manually; if you go to the Files tab, hit Add suggestion to batch to the ones you'd like to include and then commit them all at once.

Co-authored-by: Lucas Tortora <85233773+lucas-tortora@users.noreply.github.com>
@salaheldinsoliman
Copy link
Contributor Author

Amazing improvement !!! Last batch of comments on my end :) Btw, you don't need to add the suggestions manually; if you go to the Files tab, hit Add suggestion to batch to the ones you'd like to include and then commit them all at once.

@lucas-tortora All thanks to your comments!
With adding the suggestions manually, I wanted to do that myself in my first article/PR to avoid repeating the same mistakes in future PRs

@salaheldinsoliman salaheldinsoliman merged commit 75303f7 into main Jul 15, 2024
9 checks passed
@salaheldinsoliman salaheldinsoliman deleted the feat/NFT-cross-chain-tutorial branch July 15, 2024 09:45
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Tutorial: Cross-Chain NFT Market place
3 participants