Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
$ forge build$ forge test$ forge fmt$ forge snapshot$ anvil$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>$ cast <subcommand>$ forge --help
$ anvil --help
$ cast --helpalchemy sepolia rpc url
Updated README file
////////
A TimeLockedVault smart contract that allows users to deposit ERC20 tokens with a time lock. Users can only withdraw their tokens after the lock period has passed.
✅ Features:
-
Lock ERC20 tokens for a fixed duration.
-
Prevent early withdrawals.
-
Fully tested using Foundry's Forge framework.
This repository includes a custom smart contract called TimeLockedVault.sol, created as part of a feature implementation for locking ERC-20 token deposits with time-based withdrawal restrictions.
📄 File: src/TimeLockedVault.sol
This contract allows users to:
-
Deposit ERC-20 tokens with a lock duration
-
Enforce time-based withdrawal logic
-
Access locked balances and check unlock time
Unit tests are provided in test/TimeLockedVault.t.sol.
To run tests, run the following command
forge test --match-path test/TimeLockedVault.t.solTo run test - WLDHubItems.t.sol below command is used
forge test --match-path test/WLDHubItems.t.sol Ensure your .env is set up with RPC URL and private key if needed.
-
Contract: src/TimeLockedVault.sol
-
Test: test/TimeLockedVault.t.sol
-
Solidity ^0.8.20
-
Foundry (Forge)
If you decide to write a deploy script later (like TimeLockedVault.s.sol)
forge script script/TimeLockedVault.s.sol:TimeLockedVaultScript --rpc-url <your_rpc_url> --private-key <your_private_key>
////////