Smart contracts for staking native XFI tokens to CrossFi validators with Oracle integration for MPX conversion.
The Native Staking system allows users to stake their native XFI tokens to validators in the CrossFi network. The system includes:
- Two-step unstaking - Initiated by users, completed by operators
- Reward claiming - Two-step process with backend integration
- Validator management - Add, update status, and migrate between validators
- Emergency withdrawal - Safety feature for urgent situations
- Oracle integration - XFI/MPX price conversion
The system consists of three main components:
- Core contracts: NativeStaking for staking operations
- Periphery contracts: UnifiedOracle for price feeds
- Libraries: Utilities for validation and price conversion
Detailed documentation is available in the /docs
directory:
- System Architecture - Component overview and interactions
- Contract Flows - Detailed operation flows with diagrams
- Deployment Guide - Step-by-step deployment instructions
- Oracle Integration - Price feed and conversion details
- Role-Based Access - Role configuration and management
- Foundry
- Node.js 16+
- Clone the repository
- Copy
.env.example
to.env
and configure your environment - Install dependencies:
forge install
forge test
For development deployment:
forge script script/DeployNativeStakingDev.s.sol:DeployNativeStakingDev --broadcast --rpc-url $RPC_URL -vvv
For production deployment, see the Deployment Guide.
This code is pending audit and is not recommended for production use until a thorough security review has been completed.
MIT