Giter Site home page Giter Site logo

777rob / basic-nfts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from polygon-academy/basicnfts

0.0 0.0 0.0 840 KB

Basic smart contract + frontend for deploying NFTs on Polygon

License: MIT License

Dockerfile 1.20% Shell 4.46% JavaScript 91.94% Solidity 0.46% HTML 0.91% CSS 0.08% Less 0.45% TypeScript 0.49%

basic-nfts's Introduction

๐Ÿ— Scaffold-ETH - ๐ŸŸฃ Polygon NFT Example

Build, mint, and send around your own ERC721 (NFT) on Mumbai (testnet) and then on Polygon/Matic mainnet!

๐ŸŽฅ Watch the speed run video!

๐Ÿƒโ€โ™€๏ธ Quick Start

Required: Node plus Yarn and Git

git clone https://github.com/austintgriffith/scaffold-eth.git matic-nft-tutorial
cd matic-nft-tutorial

It is very important that you checkout the matic-nft-tutorial branch of ๐Ÿ— scaffold-eth:

git checkout matic-nft-tutorial
yarn install

First, be sure to check that you're deploying on mumbai by changing the defaultNetwork in packages/hardhat/hardhat.config.js:

image1

๐Ÿ” We will need to generate a deployer account:

yarn generate

๐Ÿ™Ž This will create a new mnemonic and you can get this deployer address using the command:

yarn account

Go to https://faucet.matic.network to get some Mumbai-MATIC (testnet currency).

Confirm that your account has the funds needed for the rest of the tutorial: (check on https://mumbai.polygonscan.com)

Compile and deploy your NFT contract:

yarn deploy

To point the frontend at mumbai we will also need to edit targetNetwork in packages/react-app/src/App.jsx:

image2

Start the frontend with:

yarn start

๐Ÿ“ฑ Open http://localhost:3000 to see the app


Minting:

โœ๏ธ Edit the mint script mint.js in packages/hardhat/scripts and update the toAddress to your frontend address (wallet address in the top right or localhost:3000).

nft1

in a new terminal window run the mint script:

cd matic-nft-tutorial
yarn mint

nft2

๐Ÿ‘€ You should see your collectibles show up on the frontend if you minted to the correct address:

nft3

๐Ÿ‘› Open an incognito window and navigate to http://localhost:3000 (You'll notice it has a new wallet address).

๐ŸŽŸ Send an NFT to the incognito window address:

nft5

๐Ÿ•ต๐Ÿปโ€โ™‚๏ธ Inspect the Debug Contracts tab to figure out what address is the owner of YourCollectible?

๐Ÿ’ผ Edit your deployment script deploy.js in packages/hardhat/scripts

๐Ÿ” Edit your smart contract YourCollectible.sol in packages/hardhat/contracts

๐Ÿ“ Edit your frontend App.jsx in packages/react-app/src

โฌ‡๏ธ Installing a new package to your frontend? You need to cd packages/react-app and then yarn add PACKAGE

๐Ÿ“ก Mainnet Deploy!

๐Ÿ›ฐ Ready to deploy to MATIC mainnet?

Change the defaultNetwork in packages/hardhat/hardhat.config.js to matic

image4

๐Ÿ‘› View your deployer address using yarn account to ensure you have some Matic. (You can exchange for Matic tokens on UniSwap using the bridge: https://wallet.matic.network/bridge).

nft8

๐Ÿ‘จโ€๐ŸŽค Deploy your NFT smart contract:

yarn deploy

โœ๏ธ Edit your frontend App.jsx in packages/react-app/src to change the targetNetwork to Matic:

image5

You should see the correct network in the frontend:

image8

๐ŸŽซ Ready to mint a batch of "L2" NFTs for reals?

โœ๏ธ Edit the mint script mint.js in packages/hardhat/scripts and update the toAddress to your MetaMask address (or other secure mainnet wallet).

yarn mint

Once minted, you should be able to see them in your Frontend.

nft11

๐ŸŸ Open Sea

Check out your contract on OpenSea's Matic viewer (Under "My Collections")

image6

๐Ÿ” Maticscan Contract

Feel free to also check your contract address on Polygonscan (extractible from the terminal where you deployed the contract).

๐Ÿ›ณ Ship the app!

โš™๏ธ build and upload your frontend and share the url with your friends...

# build it:

yarn build

# upload it:

yarn surge

yarn s3

yarn ipfs

nft14

๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ Share your public url with a friend and ask them for their address to send them a collectible :)

nft15


FAQs

What happens if I run into a chainID error? Under packages/hardhat/deployments, make sure that your chainID for your desired chain to deploy to is correct. The chainID file is located under their respective chain folders. For Matic, the correct chainID is 134. For Mumbai, the correct chainID is 80001.

What happens if I run into a gas error? This can be caused by many things. First check if you do have enough gas to deploy on your various networks. Then, try to raise the gasPrice as shown below under packages/hardhat/hardhat.config.js.

image7

Documentation

For a more in-depth explanation, documentation, quick start guide, tutorials, tips and many more resources, visit our documentation site: docs.scaffoldeth.io

๐Ÿ’ฌ Support Chat

Join the telegram support chat ๐Ÿ’ฌ to ask questions and find others building with ๐Ÿ— scaffold-eth!

basic-nfts's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.