https://github.com/vana-com/vana-smart-contracts/pull/7/
DLPRootMetric - New Contract
DLPRootMetrics is a contract that handles performance rating calculations and metrics for DLPs (Decentralized Liquidity Providers) in the system. Key functionalities include:
- Managing epoch performance ratings for DLPs
- Calculating top-performing DLPs based on both stake and performance metrics
- Estimating reward percentages and APY for DLPs
- Maintaining a scoring system with configurable weights between stake-based and performance-based ratings
The contract uses a dual rating system where:
- Stake Rating: Based on the amount staked
- Performance Rating: Based on DLP's performance metrics
Events
EpochPerformanceRatingsSaved(uint256 indexed epochId, uint256 totalPerformanceRating, bool isFinalized)
DlpEpochPerformanceRatingSaved(uint256 indexed epochId, uint256 indexed dlpId, uint256 performanceRating)
RatingPercentagesUpdated(RatingType ratingType, uint256 percentage)
DataRegistry Changes
Modified Events
- ProofAdded event updated:
- Old:
event ProofAdded(uint256 indexed fileId, uint256 indexed proofIndex)
- New:
event ProofAdded(uint256 indexed fileId, uint256 indexed proofIndex, uint256 indexed dlpId, uint256 score)
- Old:
DLPRootSmartContract Changes
Architectural Changes
The main architectural change in this update is the separation of responsibilities between DLPRoot and DLPRootMetrics. A significant portion of the rating and performance calculation logic has been moved from DLPRoot to DLPRootMetrics, making the system more modular.
Previously, DLPRoot handled both stake management and performance calculations. Now:
- DLPRootMetrics: Responsible for performance ratings and metrics calculations
- DLPRoot: Focuses on stake management, basic DLP operations, and interfacing with treasury contracts
The reward distribution system has been significantly reworked. DLPRoot now works with separate treasury contracts for rewards and stakes, with reward calculations including both performance-based and stake-based components.
Modified Events
- EpochCreated
- Old:
event EpochCreated(uint256 epochId)
- New:
event EpochCreated(uint256 epochId, uint256 startBlock, uint256 endBlock, uint256 rewardAmount)
- Old:
- DlpRewardClaimed
- Old:
event EpochDlpScoreSaved(uint256 indexed epochId, uint256 indexed dlpId, uint256 totalStakesScore);
- New:
event DlpRewardClaimed(uint256 indexed dlpId, uint256 indexed epochId, uint256 rewardAmount, uint256 stakersRewardAmount)
- Old:
New Events
DlpBecameSubEligible(uint256 indexed dlpId)
DlpBecomeIneligible(uint256 indexed dlpId)
StakeRewardClaimed(uint256 indexed stakeId, uint256 indexed epochId, uint256 amount, bool isFinal)
event EpochOverridden(uint256 epochId, uint256 startBlock, uint256 endBlock, uint256 rewardAmount);
event DlpRewardClaimed(uint256 indexed dlpId, uint256 indexed epochId, uint256 rewardAmount, uint256 stakersRewardAmount);
Note: All performance-related events are now emitted by DLPRootMetrics instead of DLPRoot, reflecting the new separation of concerns in the system architecture.