fix: data-warehouse-and-metrics-aggregation (closes #256)#313
Open
AYo101o wants to merge 1 commit intoFracverse:masterfrom
Open
fix: data-warehouse-and-metrics-aggregation (closes #256)#313AYo101o wants to merge 1 commit intoFracverse:masterfrom
AYo101o wants to merge 1 commit intoFracverse:masterfrom
Conversation
Contributor
|
@AYo101o Pls link the pr |
|
@AYo101o Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
Done |
Contributor
|
You will be unassign from this issue in 6 hrs, |
Contributor
|
@AYo101o Pls fix conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have implemented a mechanism to track and store cumulative performance metrics for the lending contract. This allows the system to monitor total loans issued, principal borrowed, interest earned, and liquidation performance.
Changes Made
Lending Contract
New PerformanceData Structure:
Added PerformanceData struct to track cumulative metrics:
total_loans_issued: Count of all loans created.
total_principal_borrowed: Total amount of all loans.
total_interest_earned: Total interest collected from repayments.
total_liquidations_count: Number of successful liquidations.
total_collateral_seized: Total value of collateral seized during liquidations.
Storage Integration:
Added DataKey::Performance for on-chain storage.
Initialized performance metrics to zero in the initialize function.
Tracking Logic:
borrow: Now increments total_loans_issued and adds the borrowed amount to total_principal_borrowed.
repay: Now adds the accrued interest to total_interest_earned.
liquidate: Now increments total_liquidations_count and adds the seized collateral value to total_collateral_seized.
Public Access:
Added get_performance_data public function to retrieve these metrics for UI or audit purposes.
Tests
test_performance_tracking: Verifies that metrics correctly accumulate after borrow and repay operations.
test_liquidation_performance: Verifies that liquidation-specific metrics are correctly tracked.
Closes #256