This is Hardhat project including Solidity Smart concracts and Testing files.
First, npm install and install packages.
npm install
# or
npm iSecond, create .env file and write some config vars according to .env.example
(To use chainlink VRF, you should click this, create subscription and get subscription id)
# 1. RPC URL (
SEPOLIA_RPC_URL=""
# or
MUMBAI_RPC_URL= ""
# 2. Your wallet account's private key
PRIVATE_KEY= ""
# 3. Chainlink VRF subscription id
SUBSCRIPTION_ID =
Now you are ready to go!
If you prefer Remix, just copy the contracts/Trypto_for_remix.sol file and paste on Remix
If you want to write, compile, deploy and test with Hardhat, keep eyes on me!
You should write npx hardhat compile for comipile first,
and npx hardhat run --network mumbai scripts/deploy.ts for deploying.
(for sepolia, npx hardhat run --network sepolia scripts/deploy.ts)
# compile
npx hardhat compile
# deploy
npx hardhat run --network mumbai scripts/deploy.ts
# or
npx hardhat run --network sepolia scripts/deploy.ts
If it is successfully depolyed, you will get contract address(CA) on your console.
Contract Trypto Successfuuly Deployed with unlock timestamp 1685519621 deployed to 0xe1340bFAbB988C10bcD58051a5f96F4eA0028576
Hardhat provides testing tools for smart contracts.
npx hardhat test
We already made some testing units for Trypto1.sol, except for chainlink products(VRF, Automation, Data Feed).
If you customize or make your own tests, modify or create `tests/Trypto1.sepc.ts'.
Hardhat provide local testnet so that your contracts are deployed to hardhat local-network and be tested.
To learn more about Chainlink products we use (VRF, DataFeed, Automation), take a look at the following resources :
To learn and practice simple contract codes for studying chainlink products, take a look at the following references :