This project is a simple ERC20 token implementation built with Hardhat and TypeScript. This project is a work in progress and will expand with time.
VToken (VARY) is a basic ERC20 token contract deployed on a local Hardhat network. The token has an initial supply of 1000 tokens minted to the deployer's address.
- Solidity ^0.8.30
- Hardhat
- OpenZeppelin Contracts
- ERC20-compliant token contract (
VToken.sol) - Custom name (VToken) and symbol (VARY)
- Deployment script with automatic address persistence (
scripts/deploy.ts) - Balance checking (
scripts/checkBalance.ts) - Token transfer (
scripts/transfer.ts)
- Node.js (^20 recommended)
pnpmpackage manager (^10)
pnpm install
pnpm run compile compiles the Solidity smart contracts using Hardhat.
pnpm run node starts a local Hardhat blockchain node for development and testing
pnpm run deploy:local deploys the VToken contract to the local network with 1,000 initial tokens and automatically saves the generated contract address to the .env file.
pnpm checkBalance:local displays the current VToken balance of the deployer account.
pnpm transfer:local transfers 100 VTokens from the deployer account to a receiver account (the second account from the hadrhat-generated list) and displays the before/after balances for both accounts.
approveAllowanceAndTransfer:local lets the owner approve a spender to transfer tokens on their behalf. It sets an allowance amount, executes the transfer and logs the allowance before and after.