EtherVault is a decentralized finance (DeFi) platform that allows users to stake Ethereum (ETH) and earn Vagabond (VGB) tokens as rewards. The project demonstrates a complete staking ecosystem with a React frontend and Solidity smart contracts.
- 🔒 Secure ETH Staking: Stake your ETH securely with minimum 0.01 ETH
 - 💎 VGB Token Rewards: Earn VGB tokens at 10% APR
 - ⏱️ No Lock-up Period: Withdraw your ETH anytime
 - 📈 Time-weighted Rewards: Longer stakes = Higher rewards
 - 🎨 Modern UI: Clean, responsive interface with real-time updates
 
- React with Vite
 - Wagmi/Viem for blockchain interactions
 - Material UI for sleek components
 - Framer Motion for animations
 
- Solidity ^0.8.28
 - OpenZeppelin contracts for security
 - Foundry for development and testing
 
// Staking Contract - Handles ETH staking and VGB rewards
contract StakingContract {
    mapping(address => uint256) public Balances;
    
    // Core Functions
    function stake() external payable;
    function unstake(uint256 _amount) external;
    function getRewards(address _address) external view returns (uint256);
    function claimRewards() external;
}
// VGB Token - ERC20 token for rewards
contract VagabondCoin is ERC20 {
    address public stakingContract;
    
    constructor(address _stakingContract) ERC20("Vagabond", "VGB") {
        stakingContract = _stakingContract;
    }
}Rewards are calculated using a time-weighted formula:
// Time-weighted reward calculation
reward = (stakedAmount * 10 * stakingDuration) / (365 days * 100)| Stake Amount | Duration | VGB Reward | 
|---|---|---|
| 1 ETH | 30 days | 0.0082 VGB | 
| 5 ETH | 90 days | 0.123 VGB | 
| 10 ETH | 180 days | 0.493 VGB | 
- ✅ Reentrancy Protection: Guards against reentrant attacks
 - ✅ Pausable: Emergency stop functionality
 - ✅ Access Control: Owner-only sensitive functions
 - ✅ Emergency Withdrawal: Recovery of stuck funds
 - ✅ Integer Overflow Protection: Safe math operations
 
# Clone the repository
git clone https://github.com/YourUsername/EtherVault.git
cd EtherVault
# Install frontend dependencies
cd frontend
npm install
# Start frontend development server
npm run dev
# Setup backend (in another terminal)
cd backend
forge install
forge buildThe project is deployed on the Sepolia testnet: https://sepolia.etherscan.io/address/0xA685c85311B78C9319c397252d6CCDcd58EdcB59#code https://sepolia.etherscan.io/address/0xd01c85418F6Bf3b945ea1668E4Dfd4D4361Ab58D