Solidity Contract Template based on CoolCatsNFT @coolcatsnft
Source: https://etherscan.io/address/0x1a92f7381b9f03921564a437210bb9396471050c#contracts
The CoolCatsNFT contract is very well written and very gas efficient. Consider using this approach if you're creating NFTs off-chain. Can cost as low as $100 at 14 October 2021 ETH Price of $3,527. CoolCatsNFT team deployed this contract for $55.59 at $1,983 ETH Price from 27 June 2021.
The trick is to just use _safeMint without using _setTokenURI at all. Hence no ERC721Metadata.sol imported. tokenURI function will just concatenate the baseURI with the token id when calling the function.
Curated by @marcelc63 - marcelchristianis.com Each functions have been annotated based on my own research and findings from https://medium.com/coinmonks/what-i-learned-from-building-cool-cats-nft-4057f279d400
Feel free to use and modify as you see appropriate
Please do the followings
- Modify any code that's labeled with TODO
- Change the baseURI in deploy.js, run.js, and test.js
- Make sure to create your own .env and modify hardhat.config.js accordingly with your deployment URL and accounts private key.
- Remove the comments and annotation
- Contract that CoolCatsNFT used
- Complete commentary on core functions
- Deployment Script
- Testing Script
// To test
npx hardhat run scripts/run.js
npx hardhat test
// To deploy to Rinkeby testnet
npx hardhart run scripts/deploy.js --network rinkeby