# 🔥 OurToken - ERC20 Token Using Foundry
A blazing fast, fully tested ERC20 token project built using [Foundry](https://github.com/foundry-rs/foundry), OpenZeppelin, and Solidity. This project demonstrates how to create, test, and deploy an ERC20 token with modern Ethereum tooling.
---
## 🧱 Tech Stack
- [Foundry](https://github.com/foundry-rs/foundry) – Rust-based Ethereum dev toolkit
- Solidity (v0.8.19)
- [OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts)
- Forge (Testing & Scripting)
- Anvil (Local Ethereum Node)
- Cast (On-chain CLI Tools)
---
## 📦 Project Structure
ERC20-TOKEN/ ├── lib/ # Dependencies (OpenZeppelin, forge-std) ├── out/ # Forge build output ├── src/ │ └── OurToken.sol # ERC20 contract ├── script/ │ └── DeployOurToken.s.sol # Deployment script ├── test/ │ └── OurTokenTest.t.sol # Unit tests ├── foundry.toml # Foundry config └── README.md # You're here!
---
## 🔐 Contract Details
### ✅ `OurToken.sol`
```solidity
contract OurToken is ERC20 {
constructor(uint256 initialSupply) ERC20("OurToken", "OT") {
_mint(msg.sender, initialSupply);
}
}
- Token Name: OurToken
- Symbol: OT
- Supply: Configurable via constructor
- Standard: ERC20
# Clone this repo
git clone https://github.com/SaadAbdullah72/ERC20-TOKEN.git
cd ERC20-TOKEN
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
# Install dependencies
forge installforge buildforge test -vvvvIncludes tests for:
- ✅ Total supply
- ✅ Transfers
- ✅ Reverts on insufficient balance
- ✅ Allowances and approvals
- ✅
transferFromandapprove
Start Anvil (local node):
anvilDeploy using your script:
forge script script/DeployOurToken.s.sol:DeployOurToken \
--rpc-url http://localhost:8545 \
--private-key <your-private-key> \
--broadcast| Action | Command |
|---|---|
| 🧱 Build | forge build |
| ✅ Run tests | forge test |
| 🎨 Format code | forge fmt |
| 🧪 Gas snapshot | forge snapshot |
| 🚀 Run local node | anvil |
| 📦 Run script | forge script <script> |
| 🛠 Interact w/ chain | cast <command> |
MIT © 2025 Saad Abdullah Feel free to fork and build upon this!
Open issues, suggest improvements, or submit a PR. Contributions are welcome!