A decentralized staking rewards protocol on Base Layer 2 that enables users to stake ETH or ERC-20 tokens to earn custom reward tokens, with protocol fees generating on-chain revenue for ecosystem development through the Talent Protocol Base Builders leaderboard.
- Overview
- Features
- Architecture
- Project Structure
- Getting Started
- Development
- Testing
- Deployment
- Contributing
- Roadmap
- License
BaseStaker is a comprehensive decentralized finance (DeFi) protocol designed for the Base Layer 2 network. It provides a secure, non-custodial staking mechanism where users can deposit ETH or ERC-20 tokens to earn yield through custom reward tokens. The protocol incorporates a sustainable economic model with protocol fees on staking operations, contributing to ecosystem growth and supporting the Talent Protocol Base Builders leaderboard.
This project serves as a complete solution for DeFi staking, combining smart contract infrastructure with future frontend interfaces to provide users with an intuitive way to participate in decentralized staking.
- Multi-Asset Staking: Support for native ETH and any ERC-20 token staking
- APR-Based Rewards: Configurable reward rates with predictable yield calculations
- Time-Weighted Rewards: Accurate reward accumulation based on staking duration
- Flexible Reward Tokens: Support for custom ERC-20 tokens as rewards
- Protocol Fees: 0.5% fee on stake/unstake operations directed to treasury
- Treasury Management: Automated fee collection for ecosystem development
- Talent Protocol Integration: Revenue contribution to Base Builders leaderboard
- Non-Custodial Design: Users maintain full control of their assets
- Reentrancy Protection: Comprehensive security measures against common attacks
- Emergency Controls: Owner-controlled pause and emergency withdrawal capabilities
- Access Control: Role-based permissions for administrative functions
- Input Validation: Minimum stake thresholds and balance verification
- Foundry Framework: Modern Ethereum development toolchain
- Comprehensive Testing: Full test coverage with gas optimization
- Modular Architecture: Clean separation of concerns for maintainability
- Deployment Scripts: Automated deployment for testnet and mainnet
graph TB
subgraph "User Layer"
U[Users]
F[Frontend Interface<br/>Planned]
end
subgraph "Smart Contract Layer"
BS[BaseStaker Contract]
end
subgraph "Infrastructure Layer"
BC[Base Chain L2]
OZ[OpenZeppelin Libraries]
FS[Forge Standard]
end
subgraph "External Integrations"
TP[Talent Protocol<br/>Base Builders]
RT[Reward Token Contracts]
ST[Staking Token Contracts]
end
U --> F
F --> BS
BS --> BC
BS --> OZ
BS --> FS
BS --> TP
BS --> RT
BS --> ST
style BS fill:#e1f5fe
style BC fill:#f3e5f5
style TP fill:#c8e6c9
graph TD
A[BaseStaker Contract] --> B[Staking Module]
A --> C[Rewards Module]
A --> D[Fee Module]
A --> E[Security Module]
B --> F[ETH Handler]
B --> G[ERC-20 Handler]
C --> H[APR Calculator]
C --> I[Time-Weighted Accumulator]
D --> J[Treasury Distributor]
D --> K[Talent Protocol Distributor]
E --> L[Reentrancy Guard]
E --> M[Access Control]
E --> N[Emergency Controls]
style A fill:#e1f5fe
style J fill:#c8e6c9
style K fill:#c8e6c9
sequenceDiagram
participant User
participant Frontend
participant BaseStaker
participant Treasury
participant TalentProtocol
User->>Frontend: Initiate Stake/Unstake
Frontend->>BaseStaker: Execute Transaction
alt Staking Operation
BaseStaker->>BaseStaker: Calculate Protocol Fee (0.5%)
BaseStaker->>Treasury: Transfer Fee Portion
BaseStaker->>TalentProtocol: Transfer Fee Portion
BaseStaker->>BaseStaker: Update User Stake
BaseStaker->>BaseStaker: Initialize Reward Tracking
end
alt Reward Claiming
BaseStaker->>BaseStaker: Calculate Pending Rewards
BaseStaker->>User: Transfer Reward Tokens
end
alt Unstaking Operation
BaseStaker->>BaseStaker: Calculate Protocol Fee (0.5%)
BaseStaker->>Treasury: Transfer Fee Portion
BaseStaker->>TalentProtocol: Transfer Fee Portion
BaseStaker->>User: Return Staked Amount
end
BaseStaker/
├── contract-solidity/ # Smart contract codebase
│ ├── src/
│ │ └── BaseStaker.sol # Main staking contract
│ ├── test/
│ │ └── BaseStaker.t.sol # Contract tests
│ ├── script/
│ │ └── DeployBaseStaker.s.sol # Deployment scripts
│ ├── lib/
│ │ ├── forge-std/ # Foundry testing utilities
│ │ └── openzeppelin-contracts/ # Security libraries
│ ├── deploy-basestaker-mainnet.sh
│ ├── deploy-basestaker-testnet.sh
│ └── foundry.toml # Foundry configuration
├── frontend/ # Frontend application (planned)
│ ├── src/
│ ├── public/
│ └── package.json
├── docs/ # Documentation (planned)
├── .github/ # GitHub workflows and templates
└── README.md # This file
- Foundry - Ethereum development framework
- Node.js (for future frontend development)
- Git - Version control
- Access to Base chain RPC endpoint
-
Clone the repository:
git clone <repository-url> cd BaseStaker
-
Set up smart contracts:
cd contract-solidity forge install forge build -
Environment configuration: Create a
.envfile in thecontract-soliditydirectory:# Base Sepolia Testnet BASE_SEPOLIA_RPC_URL=https://sepolia.base.org BASESCAN_API_KEY=your_basescan_api_key # Base Mainnet BASE_RPC_URL=https://mainnet.base.org
The smart contracts are located in the contract-solidity directory and use the Foundry framework.
Build the contracts:
cd contract-solidity
forge buildRun development server:
forge test --watchCode formatting:
forge fmtThe frontend will be built using modern web technologies and will provide:
- User dashboard for staking operations
- Real-time reward tracking
- Transaction history
- Administrative controls
Run the comprehensive test suite:
cd contract-solidity
forge testRun tests with detailed gas reporting:
forge test --gas-reportRun specific test files:
forge test --match-path test/BaseStaker.t.solGenerate coverage report:
forge coverage- Staking functionality (ETH and ERC-20)
- Reward calculation accuracy
- Fee distribution
- Security controls
- Emergency scenarios
- Access control
Deploy to Base Sepolia testnet:
cd contract-solidity
./deploy-basestaker-testnet.shCurrent Testnet Address: 0xfeEfd505E894eA194Aa6Cf6c0226d9Dce9F41323
Deploy to Base mainnet:
cd contract-solidity
./deploy-basestaker-mainnet.shFor custom deployment parameters:
forge script script/DeployBaseStaker.s.sol \
--rpc-url <RPC_URL> \
--private-key <PRIVATE_KEY> \
--broadcast \
--verify \
--etherscan-api-key <API_KEY>We welcome contributions from developers, security researchers, and community members. This project is designed to be educational and collaborative.
-
Code Contributions
- Bug fixes and improvements
- New features and enhancements
- Test coverage improvements
-
Documentation
- Technical documentation
- User guides and tutorials
- API documentation
-
Testing
- Additional test cases
- Security testing
- Performance optimization
-
Research
- Economic analysis
- Security audits
- Protocol improvements
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes with comprehensive tests
- Ensure all tests pass:
forge test - Format code:
forge fmt - Submit a pull request with detailed description
- Follow Solidity style guidelines
- Write comprehensive tests for new functionality
- Update documentation for significant changes
- Maintain backward compatibility where possible
- Consider gas optimization in contract changes
- Core staking functionality
- Multi-asset support (ETH + ERC-20)
- APR-based reward system
- Protocol fee implementation
- Comprehensive security measures
- Testnet deployment
- User dashboard interface
- Wallet integration
- Real-time reward tracking
- Transaction history
- Mobile-responsive design
- Multi-reward token support
- Staking pools with different APYs
- Governance integration
- Cross-chain functionality
- Advanced analytics dashboard
- DeFi protocol integrations
- NFT staking rewards
- Partnership programs
- Advanced treasury management
- Mainnet deployment
- Security audit completion
- Community governance
- Performance optimization
- Global marketing campaign
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License allows for broad use of this software while maintaining attribution requirements. This choice enables maximum collaboration and adoption within the blockchain and DeFi communities.

