This project demonstrates a basic smart contract usage. The project is designed to give basic concepts of smart contracts to the participants of Web3Disrupt.
This smart contract consist of following components:
- Coffee Smart Contract.
- Coffee ERC-20 Token.
- Coffee ERC-721 Token.
The smart contract consist of following functions,
- Donate tokens worth a coffee to the owner.
- Minting an NFT to the donar address.
- Set price of the coffee.
- Withdraw amount from the smart contract to owner account.
Make sure to install nodejs
# Check node and npm versions
node -v # v16.14
npm -v # v8.19
# Clone repo
git clone https://github.com/khuzama98/Web3Distrupt-Workshop
# Install development dependencies
npm install
Before running any command, you need to create a .env
file and set all necessary environment
variables. Follow the example in .env.example
.
If you don't already have a mnemonic, use this bip39 to generate one.
If you don't already have an infura key, use this infura to generate one.
Try running some of the following tasks:
# Get help screen
npx hardhat help
# Run to compile contracts
npx hardhat compile
# Run to generate typechain types
npx hardhat typechain
# Run hardhat tests
npx hardhat test
# Run hardhat tests with gas report
GAS_REPORT=true npx hardhat test
# Run a local hardhat network
npx hardhat node
# Run script to deploy contracts locally
npx hardhat run scripts/deploy.ts
# Run script to deploy contracts to a network specified in `hardhat.config.ts`
npx hardhat run scripts/deploy.ts --network goerli
# Run script to verify contract to the network they are deployed to
# - Make sure to update the script with valid addresses and args
# - Make sure to set api keys of explorer in `.env` file, checkout `.env.example` for example
npx hardhat run scripts/verify.ts --network goerli
# Run to clean artifacts, cache etc
npm run clean
These contracts are NOT
production ready and are ONLY
for demo and educational purposes.
- starter-kits - list of some of the cool templates
- hardhat-template - most used hardhat template across the smart contract ecosystem
- hardhat-js-starterkit - hardhat template in JavaScript
- hardhat-ts-template - hardhat template with common utils