A next-generation DeFi staking protocol that rewards long-term ERC-20 token holders while penalizing early withdrawals — built with Solidity, Foundry, and Next.js.
Live Demo: Coming Soon | Deployed on: Sepolia Testnet
YieldLock is a decentralized finance (DeFi) protocol that enables users to stake ERC-20 tokens and earn rewards based on lock duration. The longer the lock period, the higher the APY. Early withdrawals trigger a penalty, creating a trustless, incentive-aligned staking mechanism entirely governed by smart contracts.
It’s like a “crypto time deposit” — but without banks, paperwork, or intermediaries.
- ⏱️ Time-Based Staking: Choose from five lock durations with increasing APYs.
- 📈 Dynamic Rewards: Real-time reward accrual based on staking duration.
- 🔄 Flexible Claiming: Claim earned rewards anytime without unstaking.
- 🛡️ Security-First Contracts: Built with OpenZeppelin libraries and protected against reentrancy.
- 🧑💼 Admin Controls: Update APY, penalties, and lock terms without redeploying.
- 📊 Detailed Analytics: View positions, rewards, penalties, and history from a responsive dashboard.
YieldLock uses a modular, full-stack design for scalability and maintainability:
┌───────────────────────────────────────────────┐
│ Frontend (Next.js) │
│ Wallet Connection │ Dashboard │ Admin Panel │
└───────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────┐
│ Web3 Integration Layer │
│ wagmi + RainbowKit + viem + TanStack Query │
└───────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────┐
│ Ethereum Blockchain │
│ Token.sol │ Staking.sol │ IStaking.sol │
└───────────────────────────────────────────────┘
📘 For detailed architecture and code explanations, see Technical Overview.
| Lock Period | APY | Early Withdrawal Penalty |
|---|---|---|
| Flexible | 0% | 0% |
| 30 Days | 5% | 2% |
| 90 Days | 8% | 5% |
| 180 Days | 12% | 8% |
| 365 Days | 18% | 12% |
📊 More on reward calculation: Tokenomics
- Node.js ≥ 18
- Foundry (Forge, Cast, Anvil)
- MetaMask wallet
- Infura or Alchemy RPC URL
git clone https://github.com/atahabilder1/yield-lock.git
cd yield-lock
forge install
npm installCreate a .env file:
cp .env.example .env
nano .envRun a local blockchain and deploy contracts:
anvil
forge test -vv
forge script script/DeployStaking.s.sol --rpc-url http://localhost:8545 --broadcastRun the frontend:
cd frontend
npm run devVisit → http://localhost:3000
- ✅ ReentrancyGuard – Prevents reentrancy attacks
- ✅ Checks-Effects-Interactions – Safe external calls
- ✅ Access Control – Owner-only critical functions
- ✅ Emergency Controls – System-wide pause and emergency withdrawals
See SECURITY.md for full details and our bug bounty program.
Comprehensive test suite:
forge test -vv
forge test --gas-report- 39+ tests across Token and Staking contracts
- 100% smart contract coverage
- Fuzz testing for edge cases
- Gas usage reporting and optimization checks
- 🏛️ DAO governance for parameter management
- 📱 Native iOS/Android apps
- 🌉 Multi-chain support (Polygon, Arbitrum, Base)
- 🪙 NFT-based staking positions
- 🤖 AI-powered APY optimization
See the full vision: Technical Overview → Roadmap
This project is released under the MIT License.
Built with ❤️ by Anik Tahabilder