This project demonstrates an ERC-20 token splitter implemented with Hardhat. It includes:
- An ERC-20 token contract.
- A splitter contract that allows splitting tokens among multiple recipients.
- Frontend code (HTML, CSS, JavaScript) to interact with the contracts.
-
Install dependencies:
npm install
-
Compile contracts:
npx hardhat compile
-
Start a local Hardhat node:
npx hardhat node
-
Deploy contracts (in a separate terminal):
npx hardhat run scripts/deploy.js --network localhost
This will deploy the contracts to the local Hardhat network and output the contract addresses.
-
Open
frontend/index.htmlin your browser. -
Connect your MetaMask wallet.
-
Enter the token address and recipient addresses.
-
Enter the amounts to split.
-
Click "Split Tokens" to initiate the token splitting.
contracts/Token.sol: A basic ERC-20 token contract.
contracts/Splitter.sol: The splitter contract that handles splitting tokens among multiple recipients.
scripts/deploy.js: Deploys the ERC-20 token and splitter contracts to the network.
frontend/index.html: Main HTML file for the frontend.frontend/script.js: JavaScript file for interacting with the contracts.frontend/style.css: CSS file for styling the frontend.
npx hardhat help # Show available tasks
npx hardhat test # Run tests
REPORT_GAS=true npx hardhat test # Run tests with gas reporting
npx hardhat node # Start a local Hardhat node