This is an experimental NFT (ERC721) project, used for learning purposes only. The project covers both the art and the solidity contract creation. To make things a bit more interesting I choose to use Typescript for my contract tests.
- Tech Stack
- Project Structure
- Art assets, orignal svg file and png layer images
- NFT Contract
- Project instructions
- Hardhat (as dev enviroment)
- Web3Storage (as data layer IPFS)
- Ethernal (as block explorer)
- Solidity (as EVM smart-contract language)
- Open Zepelin (as smart contract library)
- Typescript (as general purpose language used in tests and scripts)
- Mocha (as test framewor)
- Chai JS (as test assert library)
├── nft-art
└── nft-layers -- home for the NFT layers
└── project -- hardhat project code
├── contracts
├── ignition
├── scripts
└── test
The original image was created using inkscape, and this youtube tutorial.
The layers were exported from inkscape by using the batch-export plugin, and then they were renamed to comply with hashlips_art_engine name convention.
"* maxSupply, bumpSupply and bumpSupplyAvaiable\n are avaiable only to the contract owner"
classDiagram
class Ownable {
- address _owner
+ onlyOwner()
+ owner() address
+ transferOwnership(address newOwner)
}
class CyberNorseWarriros {
- uint256 _maxSupply
- uint256 _lastTokenID
- struct _currentBatch
- struct _nextBatch
+ *maxSupply() uint256
+ *bumpSupplyAvaiable() bool
+ *bumpSupply(uint256 newSupplySize, string newMetadataURI)
+ safeMint(address to)
}
Ownable |>-- CyberNorseWarriros
The actual code lives under the project
sub-folder, so to proper compile, test and deploy the NFT contract you must be inside the project
folder.
Before running the application make sure you have added added the information regarding the contract owner and the NFT metadata URI to the the .env file. Fell free to use .env.example as inspiration.
cd project
npx hardhat compile
npx hardhat test --typecheck
or to test a single file
npx hardhat test ./test/CyberNorseWarriors.ts --typecheck
For that we will need 2 terminal windows, one to run the hardhat node and another to trigger the contract deploy via hardhat ignition.
In the frist terminal window you should type
npx hardhat node
In the second terminal window you must type:
npx hardhat ignition deploy ./ignition/modules/CyberNorseWarriors.ts --network localhost