ERC721 Exercise 1
Intro
Your goal is to create an ERC721 token (NFT), based on OpenZeppelin ERC721.sol contract,
deploy it to your local hardhat chain, and test it.
Accounts
- 0 - Deployer
- 1 - User1
- 2 - User2
Tasks
Task 1
Create your contract under the ./contracts/erc721-1 folder:
- Import and inherit from OpenZeppelin
ERC721.solcontract - Choose your token NAME and SYMBOl
- Implement an external
mint()function according the following properties:- Max Supply = 10,000
- Mint Price = 0.1 ETH
- Keep track of the current supply using a public state variable
Task 2
Testing:
- Deploy your contract from the deployer account
- Mint 5 tokens from
Deployer - Mint 3 Tokens from
User1 - Test that every account has the right amount of tokens
- Transfer 1 token from
User1toUser2(Token ID 6) - Make sure that the token that was transfered is now owned by
User2 - From
Deployer: approveUser1to spend one of the tokens (Token ID 3) - Test that
User1has the right approval that was granted by theDeployer - From
User1: transfer to yourself the token that was approved by theDeployer - Test that
User1owns the transfered token - Test that every user has the right amount of tokens
Links that might be useful
- ERC721 Standard on Ethereum Website https://eips.ethereum.org/EIPS/eip-721
- ERC721 Source code on Github https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol
- Hardhat Tests https://hardhat.org/tutorial/testing-contracts