A Decentralized Class Treasury Management System
Classfund is a Web3 application designed to bring transparency, accountability, and automation to class treasury management. Built on the Ethereum blockchain (deployed on Sepolia Testnet), it eliminates the need for manual bookkeeping and ensures that every contribution is recorded immutably.
- Decentralized Payments: Members can pay their dues directly via MetaMask using ETH.
- Role-Based Access:
- Treasurer: Can add/remove members, withdraw funds for class needs, and trigger new payment periods.
- Members: Can view total balance, track their personal contributions, and see the active period.
- Transparency Dashboard: A real-time transaction history that "listens" to blockchain events to show who has paid and when.
- Period Management: Tracks contributions across different timeframes (e.g., weekly or monthly).
- Smart Contract: Solidity (0.8.0)
- Frontend: Next.js 14+ (App Router)
- Blockchain Library: Ethers.js v6
- Styling: Tailwind CSS
- Wallet Integration: MetaMask (EIP-1193)
The contract consists of several key functions:
pay(): Allows whitelisted members to contribute funds.withdraw(uint amount): Restricted to the Treasurer for fund allocation.addMembers(address[]): Enables the Treasurer to whitelist new classmates.nextPeriod(): Increments the treasury cycle for organized reporting.
- Node.js installed.
- MetaMask extension installed in your browser.
- Some Sepolia Testnet ETH (you can get this from a faucet).
Clone the repository and install dependencies:
git clone [https://github.com/your-username/classfund-web3.git](https://github.com/nasd10/classfund-web3.git)
cd classfund-web3
npm installThe smart contract is already deployed on the Sepolia testnet at address 0x43c9c8ced4655a2b7ee26d680935cb0d82bdf071. The contract address is hardcoded in the application for simplicity.
Start the development server:
npm run devOpen http://localhost:3000 in your browser.
-
Connect Wallet: Click the "Connect Wallet" button and approve the connection in MetaMask. Ensure you are on the Sepolia testnet.
-
View Dashboard: Once connected, you can see the treasury balance, current period, and your total contributions.
-
Make a Payment: Enter the amount in ETH and click "Pay Dues" to contribute to the treasury.
-
Treasurer Functions (if you are the treasurer):
- Add new members by entering their addresses and clicking "Add Members".
- Withdraw funds by entering the amount and clicking "Withdraw".
- Advance to the next period by clicking "Next Period".
-
View Transactions: The transaction history updates in real-time as blockchain events are emitted.
- Network: Sepolia Testnet
- Contract Address:
0x43c9c8ced4655a2b7ee26d680935cb0d82bdf071 - Source Code: Available in the class-fund repo (https://github.com/nasd10/class-fund)
contracts/directory (if applicable)
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please open an issue on GitHub or contact the maintainers.
Built for transparent class treasury management.