Skip to content

dgsmith7/NFT-Contract

Repository files navigation

NFT-Contract

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

NFT Contract

This is a solidity contract for a basic NFT with mint price, token supply limit, and royalties based on OpenZeppelin ERC721 and extensions. It is built with node js, npm, and hardhat and includes unit tests.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

Product Name Screen Shot

(back to top)

Built With

  • Solidity
  • Hardhat
  • Ethers
  • Node
  • Npm
  • Mocha
  • Chai
  • OpenZeppelin

(back to top)

Getting Started

This is an example of how you may set up this project locally, if you like. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
npm install npm@latest -g

Installation

Feel free to use the contract without going through all of these steps. But, follow the instructions below if you would like to install the project on your local machine so you can see the unit testing results, generate gas reports, see testing coverage, and deploy to a testnet or real net with this code, or just tinker around with hardhat (see the Patrick Collins video link in the acknowledgments at bottom).

  1. Create a directory on your local machine where you want the project, then navigate to that directory.

  2. Clone the repo

git clone https://github.com/your_username_/Project-Name.git
  1. Install NPM packages. This command will look in the package.json folder and install the needed dependencies.
npm install
  1. Make your own .env file as depicted below, substituting the real info where you see lowercase in the example below. Then save it in the top level of the directory. The gitignore file contains .env so this info will not go to the repo. You will need to obtain API keys from several websites to accomplish this. Security: Notice that you DO NOT see my .env file pushed to the repo. This is for a reason. Keep these values secret and DO NOT push them to github. And PLEASE DO NOT use a Metamask wallet that has real currency in it. Make a new wallet that will never hold real currency and use it for the testing. If you are only planning to use the hardhat network, and not a testnet, there is no need to provide any of the info in this file (unless you want gas reports in USD, then provide the coinmarketcap info).
REPORT_GAS=true
ETHERSCAN_API_KEY=enter you etherscan api key here
ALCHEMY_API_KEY=enter your Alchemy api key here
STUNT_WALLET_ADDRESS=enter your Metamask testing wallet address here (don't use a wallet with real currency)
STUNT_WALLET_PRIVATE_KEY=enter your Metamask testing wallet private key here (don't use a wallet with real currency)
COINMARKETCAP_API_KEY=enter your coinmarketcap api key here
POLYGONSCAN_API_KEY=enter you polygonscan API api here
  1. To compile the contract:
npx hardhat compile
  1. To run unit tests:
npx hardhat test

The results will be displayed in the terminal window. A gas report will be generated and written to .gas-report.txt'. If you have provided a coinmarketcap api key, then USD values will be provided.

  1. To generate coverage report:
npx hardhat coverage

The results will be displayed in the terminal window. Fancier reports will be stored in a directory called 'coverage'. A great way to view them is the spin up a local http server and open index.html in the 'coverage' directory.

  1. To deploy:
npm run deploy

The terminal will display several messages as the contract deploys, verifies (if on a testnet), and mints three tokens. You should then be able to search that contract address on OpenSea testnet and view the tokens. Look in notes.txt to see the results from my attempt in late July. You can try the links there, but they may not persist.

  1. Please provide feedback to me if you see any errors in these instructions, the code, or the repo at large. Happy hardhatting!

(back to top)

Usage

You may confidently download and use this contract (courseNFTContract.sol), which has been verified, in your own NFT projects. This is really designed to be used from a front end that will make the appropriate calls to compile, deploy and interact with the contract, generate the digital art and upload it to IPFS, and pass in the proper IPFS URLs to the contract and to each token as minted.

See my other repo for a full stack working project - coming soon. Full stack project

(back to top)

Roadmap

  • Set NFT price at depoyment
  • Set token supply limit at deployment
  • Set metadata (IPFS link) at deployment
  • Unit tested with Hardhat toolbox
  • Staging tested on Mumbai and OpenSea test network

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

David G. Smith - @davidgailsmith - david@davidgailsmith.com

Project Link: https://github.com/dgsmith7/NFT-Contract

(back to top)

Acknowledgments

(back to top)

About

This is a solidity contract for a basic NFT with mint price, token supply limit, and royalties based on OpenZeppelin ERC721 and extensions. It is built with node js, npm, and hardhat and includes unit tests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors