The StakingRewards
contract provides a mechanism for users to stake SPOT tokens and earn rewards in USDT. In addition to the standard staking rewards, the contract features an optional "revenue" stream that admins can activate to distribute additional USDT rewards to stakers. This contract is designed with security and flexibility in mind, incorporating various controls and timelocks to ensure proper governance and user protection.
-
Dual Reward System:
- Staking Rewards: Users earn rewards in USDT based on the amount of SPOT tokens they stake.
- Revenue Rewards: Admins can activate an additional stream of USDT rewards, distributed over a specified period, to provide extra incentives to stakers.
-
Penalty Mechanism:
- Users who withdraw their staked tokens before a predefined period (penalty days) incur a penalty, which is collected by the contract and can be withdrawn by the admins.
-
Timelocks for sensitive setters:
- Penalty Days Timelock: Changes to the penalty period require a waiting period before they take effect, providing a buffer for users to adapt to the changes.
- Withdrawal Wait Time Timelock: Similar to the penalty days, changes to the withdrawal wait time are also subject to a timelock to ensure transparency and prevent abrupt changes.
Timelock are implemented to guarantee users safety. Both of the setters will not incur in the timelock if the input value is lower than the current one.
-
Access Control:
- The contract uses role-based access control to manage permissions for setting parameters and distributing rewards. This ensures that only authorized addresses can perform critical operations.
-
Earning Passive Income:
- Users can stake their SPOT tokens to earn USDT rewards, providing a source of passive income.
-
Incentivized Staking:
- Admins can activate revenue rewards to incentivize staking during promotional periods or to boost overall staking activity.
Technical Specifications can be found in /docs/TechnicalSpecifications.html and in the NatSpec.
Follow these steps to run the project:
-
Install dependencies
npm install
-
Copy .env.example file into .env
cp .env.example .env
-
Compile the smart contracts
npx hardhat compile
-
Run the local development network
npx hardhat node
-
Deploy the smart contracts to the local network
Open a new terminal window and run:
npx hardhat run scripts/deploy.ts --network localhost
-
Run tests
npx hardhat test
-
Measure test coverage
npx hardhat coverage
-
Run a specific script
npx hardhat run scripts/<your-script>.ts
Replace <your-script>
with the name of the script you want to run.
Note: In order to run the deploy script, the .env variable ENVIRONMENT shall not be set to 'development'.
-
Clean the cache and artifacts
npx hardhat clean
-
Get help
npx hardhat help
Make sure to configure your hardhat.config.js
as needed for your specific setup and network requirements.