Skip to content

Virgillu/ForgeVault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solidity Foundry Tests License Audit

🏦 ForgeVault

A professional-grade ERC-4626 Tokenized Vault with yield harvesting, performance fees, and comprehensive security controls.

ForgeVault is a production-ready yield-bearing vault that allows users to deposit assets and earn yield through integrated strategies. Built with Foundry and following OpenZeppelin standards.

✨ Key Features

  • 🏦 ERC-4626 Standard: Fully compliant with the industry-standard tokenized vault interface.
  • 📈 Yield Harvesting: Automatic yield distribution with a configurable performance fee (max 5%).
  • 🔒 Security First: Built with OpenZeppelin's ReentrancyGuard, AccessControl, and Pausable.
  • Gas Optimized: Efficient deposit/withdraw patterns (~132k gas per deposit).
  • 🧪 Battle-Tested: 40 comprehensive unit and integration tests, all passing.
  • 🔐 Slippage Protection: Built-in safeguards against front-running attacks.

🚀 Deployed Contracts (Sepolia Testnet)

✅ Quality & Security

Metric Status
Test Coverage 40/40 tests passing
Code Audit Self-conducted audit report available
CI/CD Automated testing via GitHub Actions
Contract Address Status
MyToken 0xF16eD8b9E44Fa707901031ACcf4Dd2Dac38C9c10 ✅ Verified
ForgeVault 0x610E80Db537f658da8157ACf3d1C7FD141E0Bf16 ✅ Verified

Try it on Sepolia

# Set your wallet address
export MY_ADDRESS=0xYourWalletAddressHere

# Get test tokens (1000 MTK with 18 decimals)
cast send 0xF16eD8b9E44Fa707901031ACcf4Dd2Dac38C9c10 \
  "mint(address,uint256)" $MY_ADDRESS 1000000000000000000 \
  --rpc-url sepolia

# Approve vault to spend tokens
cast send 0xF16eD8b9E44Fa707901031ACcf4Dd2Dac38C9c10 \
  "approve(address,uint256)" 0x610E80Db537f658da8157ACf3d1C7FD141E0Bf16 1000000000000000000 \
  --rpc-url sepolia

# Deposit to vault
cast send 0x610E80Db537f658da8157ACf3d1C7FD141E0Bf16 \
  "deposit(uint256,address)" 1000000000000000000 $MY_ADDRESS \
  --rpc-url sepolia

# Check your balance
cast call 0x610E80Db537f658da8157ACf3d1C7FD141E0Bf16 \
  "balanceOf(address)" $MY_ADDRESS --rpc-url sepolia

✨ Features

Feature	Description
🏦 ERC-4626 Compliant	Industry standard for tokenized vaults
📈 Yield Harvesting	Automatic yield distribution with configurable fees (max 5%)
🔒 Security First	ReentrancyGuard, AccessControl, Pausable
⛽ Gas Optimized	~132k gas per deposit
🧪 100% Test Coverage	40 passing tests
🔐 Slippage Protection	Built-in front-running protection

📊 Architecture

┌─────────────────────────────────────────────────────────────┐
│                        ForgeVault                            │
│  ┌─────────────┐  ┌──────────────┐  ┌───────────────────┐  │
│  │  ERC-4626   │  │ AccessControl│  │  ReentrancyGuard  │  │
│  └─────────────┘  └──────────────┘  └───────────────────┘  │
│                           │                                  │
│  ┌────────────────────────▼────────────────────────────┐    │
│  │                 Yield Mechanism                      │    │
│  │  • harvest() → Claim & distribute yield              │    │
│  │  • Performance fee: 1% (configurable)               │    │
│  │  • Total yield earned: tracked on-chain             │    │
│  └─────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────┘

🚀 Quick Start

Prerequisites

# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

Installation

# Clone the repository
git clone https://github.com/Virgillu/ForgeVault.git
cd ForgeVault

# Install dependencies
forge install

# Build the project
forge build

# Run tests
forge test

# Generate coverage report
forge coverage

📊 Test Results
$ forge test
Ran 40 tests for 3 suites: 40 passed, 0 failed

Test Suite	Tests	Status
ForgeVaultCore.t.sol	18	✅ Passing
ForgeVaultYield.t.sol	11	✅ Passing
ForgeVaultIntegration.t.sol	11	✅ Passing

🔒 Security Audit

A comprehensive security audit report is available here.

Audit Summary:

✅ 0 Critical issues
✅ 0 High-risk issues
⚠️ 1 Medium, 3 Low, 2 Informational findings
✅ 100% test coverage

📁 Project Structure
ForgeVault/
├── src/
│   ├── ForgeVault.sol          # Core vault contract
│   └── MyToken.sol             # Test ERC-20 token
├── test/
│   ├── unit/
│   │   ├── ForgeVaultCore.t.sol
│   │   └── ForgeVaultYield.t.sol
│   └── integration/
│       └── ForgeVaultIntegration.t.sol
├── docs/
│   └── AUDIT_REPORT.md          # Security audit
├── script/
│   └── DeployForgeVault.s.sol  # Deployment script
├── .github/workflows/
│   └── test.yml                 # CI/CD pipeline
├── foundry.toml
└── README.md

📄 License  MIT License

📫 Contact

Author: Virgillu
Email: virgilsnape@gmail.com
GitHub: @Virgillu

About

A professional-grade implementation of the ERC-4626 Tokenized Vault standard for gas-efficient asset management and yield optimization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors