A decentralized staking platform built on Ethereum Sepolia testnet that allows users to stake ETH and earn ORCA token emissions in real-time.
- Overview
- Features
- Project Structure
- Prerequisites
- Quick Start
- Components
- Environment Variables
- Testing
- Deployment
- Contributing
- License
ORCA Staking is a full-stack Web3 application that enables users to:
- Stake ETH into a smart contract
- Earn ORCA tokens as rewards based on staking duration and amount
- Unstake ETH at any time
- Claim rewards anytime to receive accumulated ORCA tokens
The platform consists of:
- Smart Contracts: Solidity contracts deployed on Sepolia testnet
- Frontend: React-based web application with wallet integration
- Real-time Updates: Automatic balance and reward tracking
- π Wallet Integration: Connect with MetaMask or any injected wallet
- π° ETH Staking: Stake ETH with simple interface
- π Reward System: Earn ORCA tokens at 1 ORCA per second per ETH staked
- π Real-time Dashboard: View staked amount, pending rewards, and pool statistics
- π Instant Unstaking: Unstake your ETH anytime
- β‘ Fast Transactions: Optimized for low gas fees
- π‘οΈ Secure: Built with OpenZeppelin contracts and best practices
Web3_Week_23.1/
βββ orca-staking-frontend/ # React frontend application
β βββ src/
β β βββ components/ # UI components
β β βββ hooks/ # Custom React hooks
β β βββ config/ # Configuration files
β β βββ abi/ # Contract ABIs
β β βββ utils/ # Utility functions
β βββ package.json
β
βββ StakingContract_Orca/ # Solidity smart contracts
βββ src/ # Contract source files
βββ script/ # Deployment scripts
βββ test/ # Test files
βββ foundry.toml # Foundry configuration
Before you begin, ensure you have:
- Node.js (v18 or higher)
- npm or yarn
- Foundry (for contract development)
- MetaMask or compatible Web3 wallet
- Sepolia ETH (for testing - get from faucets)
git clone <repository-url>
cd Web3_Week_23.1VITE_STAKING_CONTRACT_ADDRESS=0x...
VITE_ORCA_TOKEN_ADDRESS=0x...
VITE_RPC_URL=https://sepolia.infura.io/v3/YOUR_KEY
VITE_TARGET_CHAIN_ID=11155111
VITE_TARGET_NETWORK_NAME=SepoliaPRIVATE_KEY=0x...
RPC_URL=https://sepolia.infura.io/v3/YOUR_KEY
ETHERSCAN_API_KEY=YOUR_KEYcd orca-staking-frontend
npm installcd StakingContract_Orca
forge installcd StakingContract_Orca
forge script script/DeployContracts.s.sol:DeployOriginal --rpc-url sepolia --broadcast --slowcd orca-staking-frontend
npm run devVisit http://localhost:5173 in your browser.
-
StakingContract_Original: Main staking contract
stake(uint256): Stake ETHunstake(uint256): Unstake ETHclaimRewards(): Claim accumulated ORCA rewardsgetRewards(): View pending rewards
-
OrcaCoin: ERC20 reward token
- Standard ERC20 functionality
- Minting restricted to staking contract
- Account Overview: Real-time staking statistics
- Stake Tab: Interface for staking ETH
- Unstake Tab: Interface for unstaking ETH
- Claim Tab: Interface for claiming rewards
- Wallet Integration: MetaMask and injected wallet support
| Variable | Description | Example |
|---|---|---|
VITE_STAKING_CONTRACT_ADDRESS |
Deployed staking contract address | 0x... |
VITE_ORCA_TOKEN_ADDRESS |
Deployed ORCA token address | 0x... |
VITE_RPC_URL |
RPC endpoint URL | https://sepolia.infura.io/v3/... |
VITE_TARGET_CHAIN_ID |
Network chain ID | 11155111 (Sepolia) |
VITE_TARGET_NETWORK_NAME |
Network name | Sepolia |
| Variable | Description |
|---|---|
PRIVATE_KEY |
Deployer private key (with 0x prefix) |
RPC_URL |
RPC endpoint for deployment |
ETHERSCAN_API_KEY |
Etherscan API key for verification (optional) |
cd StakingContract_Orca
forge testforge test -vvv- Fund your deployer wallet with Sepolia ETH
- Set environment variables
- Run deployment script:
forge script script/DeployContracts.s.sol:DeployOriginal \
--rpc-url sepolia \
--broadcast \
--slow \
--verifyAfter deployment, update the frontend .env file with the new contract addresses.
- Reward Rate: 1 ORCA per second per ETH staked
- Calculation:
rewards = (timeDiff * amountStaked * REWARD_PER_SEC_PER_ETH) / 1e18 - Accumulation: Rewards accumulate in real-time and can be claimed anytime
- OpenZeppelin contracts for standard implementations
- Access control on minting functions
- Input validation on all functions
- Safe math operations
This project is licensed under the Unlicense - see the LICENSE files in each directory for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For issues and questions:
- Check the component-specific READMEs
- Review the test files for usage examples
- Open an issue on GitHub
Note: This is a testnet deployment. Do not use real funds on mainnet without proper auditing.