I made this example project to practice writing advanced solidity contracts, interacting with web3 wallets via ethers.js and using NEXT.JS and React. This project allows users to create organization tokens, add vesting schedules for members and for those members to claim their token once vesting is complete.
After cloning the repo, you will want to do the following to get the code running on your computer.
- Inside the project directory, in the terminal type:
npm i
- Run
npx hardhat compile
andnpx hardhat test
to compile solidity code and verify it works - Open two additional terminals in your VS code
- In the second terminal type:
npx hardhat node
- In the third terminal, type:
npx hardhat run --network localhost scripts/deploy.ts
- Create a
.env.local
file in the root folder and putNEXT_PUBLIC_VESTING_SERVICE_CONTRACT_ADDRESS=%{Deployed contract adress}%
, filling in the address deploy script printed - Back in the first terminal, type
npm run dev
to launch the front-end.
After this, the project will be running on your localhost. Typically at http://localhost:3000/
In your browser, pull up your Metamask (or similar) wallet, and import some accounts using private keys generated by hardhat, printed in the terminal where you ran npx hardhat node
.
Then add hardhat local network to Metamask:
- Network Name
HardhatNetwork
(can be anything really) - RPC url
http://127.0.0.1:8545
(check the node terminal, this might be different) - Chain ID
31337
Now you should be able to to connect to the web UI and interact with the dApp via your web3 wallet.
See a quick demo here
- Solidity
- Hardhat
- Typescript
- Next.js
- React
- Typechain
- Ethers.js
- HTML
- CSS