This repository contains the Fuse Liquid Staking Pool smart contract, an upgradeable implementation that allows users to stake Fuse tokens and receive liquid staking tokens in return. The protocol automatically delegates stakes to validators and distributes staking rewards.
- Liquid Staking: Users can stake Fuse tokens and receive liquid staking tokens representing their share of the staking pool.
- Validator Management: The protocol supports multiple validators with automatic stake distribution.
- Upgradeable: The contract uses UUPS (Universal Upgradeable Proxy Standard) for future upgrades.
- Reward Distribution: Staking rewards are automatically compounded and distributed to token holders.
- Protocol Fees: A configurable fee on staking rewards supports protocol development.
- Safety Features: Includes staking limits, pause functionality, and reentrancy protection.
- deposit(): Stake Fuse tokens and receive liquid staking tokens
- withdraw(): Exchange liquid staking tokens for staked Fuse tokens
- update(): Claim and restake rewards, update exchange rate
- addValidator()/removeValidator(): Manage validator list (owner only)
- setSystemStakeLimit(): Configure protocol staking limits (owner only)
- changeProtocolFeeBasis(): Adjust protocol fee percentage (owner only)
The contract emits events for key operations including:
- Deposits and withdrawals
- Validator management
- Protocol fee distribution
- System parameter changes
- Pause/unpause operations
- Node.js
- Yarn or npm
- Hardhat
- Clone the repository
- Install dependencies:
yarn install
Run the test suite:
yarn testConfigure your deployment parameters in hardhat.config.js and run:
yarn hardhat deployAfter deployment, users can interact with the contract through:
- Depositing Fuse tokens via the
deposit()function or fallback - Withdrawing by calling
withdraw()with the amount of liquid tokens - Managing validators and protocol parameters (owner only)
The contract includes several security features:
- Reentrancy protection
- Upgradeability controlled by owner
- Pause functionality
- Input validation
- SafeMath operations
The Liquid Staking Pool was a customized fork of JinFinance contracts, comprehensive tests and deployments were added
MIT License - See SPDX identifier in contract source.