TimeLockedBond is a smart contract deployed on the Sepolia testnet. It allows users to deposit ETH for a fixed duration, with the ability for the contract owner to deduct penalties or fees. The project includes a user-friendly frontend for both users and administrators.
- User Deposits: Users can lock ETH for a fixed duration.
- Admin Deductions: The contract owner can deduct penalties with reasons.
- Withdrawal: Users can withdraw their ETH after the lock duration.
- Frontend Integration: Includes
index.htmlfor users andadmin.htmlfor administrators.
- Node.js: v20.x or newer
- npm: Comes with Node.js
- MetaMask: Browser extension
- Sepolia ETH: Obtain from faucets
- Alchemy API Key: For Sepolia network access
Run the following command in the project directory:
npm installCreate a .env file in the project root with the following:
ALCHEMY_API_KEY=your_alchemy_api_key_here
PRIVATE_KEY=your_private_key_hereImportant: Never commit your .env file to version control.
To deploy the contract to Sepolia, run:
npm run deploy:sepoliaReplace the contract address in index.html and admin.html:
const contractAddress = "0x4a5f3678606424017C719C83561D17AbCC7eb9a1";You can open index.html and admin.html directly in your browser, or use a local web server:
npx serve .or
npx http-server .- Open MetaMask and switch to the "Sepolia test network".
- Ensure you have Sepolia ETH in your wallet.
- Use the account associated with your private key for admin functions.
- Users: Use
index.htmlto deposit ETH and check bond status. - Admins: Use
admin.htmlto manage deductions and view contract details.
- Contract Address:
0x4a5f3678606424017C719C83561D17AbCC7eb9a1 - Network: Sepolia Testnet
- Duration: 2 minutes (for testing purposes)
-
Transaction Reverts:
- Ensure the depositor has sufficient balance.
- Verify the deduction amount does not exceed the available balance.
-
MetaMask Connection:
- Ensure MetaMask is connected to the Sepolia network.
- Check if the wallet has sufficient Sepolia ETH.
-
Contract Address Mismatch:
- Verify the contract address in the frontend matches the deployed address.
This project is built using Hardhat 3 Beta. To learn more, visit the Hardhat documentation.
For feedback or contributions, join the Hardhat 3 Beta Telegram group or open an issue in the GitHub repository.
This project is licensed under the MIT License.