An Ethereum-based decentralized application (dApp) that allows users to seamlessly buy and sell ERC-20 tokens (Token G9
) in exchange for ETH using a vendor smart contract and an ERC-20 contract.
Please visit the live demo at group9-evm.vercel.app.
- Frontend: Next.js 15, TailwindCSS, DaisyUI
- Wallet Integration: Reownkit, wagmi, viem
- Smart Contracts: Solidity, Hardhat, OpenZeppelin
- Deployment: Vercel (frontend), Sepolia testnet (contracts)
- Buy tokens by sending ETH to the
Vendor
contract - Sell tokens back to the contract in exchange for ETH
- Real-time balances for ETH and tokens
- Wallet integration via Reownkit for seamless Web3 experience
Clone and install dependencies:
git clone https://github.com/segment7/token-vendor.git
cd token-vendor
yarn install
Run the local blockchain and deploy:
# Start local Hardhat chain
yarn chain
# Deploy contracts
yarn deploy
Start the frontend:
yarn start
Access at http://localhost:3000
- TokenG9.sol – Custom ERC-20 token, initial supply: 1000 G9 tokens
- Vendor.sol – Vendor contract with the following key functions:
buyTokens()
(payable)sellTokens()
withdraw()
(owner only)
Events:
BuyTokens
(buyer, ethAmount, tokenAmount)SellTokens
(seller, ethAmount, tokenAmount)
- Scaffold-ETH 2 - Open-source Ethereum dapps toolkit
Created and customized by Group 9
Built with 💙 for the EVM Bootcamp