feat(pool): include funded_amount in repayment_received event for audit trail (#135)#149
Closed
Micheal-Blessed wants to merge 3 commits into
Closed
Conversation
…it trail (TrusTrove#135) The repayment_received event now emits the original funded_amount retrieved from FundedInvoice storage, enabling off-chain indexing to reconstruct the full funding lifecycle (principal + yield). Changed: - events.rs: add funded_amount parameter to repayment_received event - lib.rs: pass funded_amount to event emission in receive_repayment - Deleted stale test snapshots (regenerated on next test run) Closes TrusTrove#135
Contributor
|
Resolve Merge conflict @Micheal-Blessed |
…ment-event-funded-amount # Conflicts: # contracts/pool/test_snapshots/test/test_deposit_after_yield_uses_updated_share_price.1.json # contracts/pool/test_snapshots/test/test_deposit_during_active_funding.1.json # contracts/pool/test_snapshots/test/test_deposit_when_deposits_zero_but_shares_exist.1.json # contracts/pool/test_snapshots/test/test_full_lifecycle_multiple_invoices.1.json # contracts/pool/test_snapshots/test/test_fund_invoice_allowed_when_below_cap.1.json # contracts/pool/test_snapshots/test/test_fund_invoice_fails_asset_mismatch.1.json # contracts/pool/test_snapshots/test/test_fund_invoice_fails_when_insufficient_liquidity.1.json # contracts/pool/test_snapshots/test/test_fund_invoice_reduces_available_liquidity.1.json # contracts/pool/test_snapshots/test/test_fund_invoice_rejects_above_cap.1.json # contracts/pool/test_snapshots/test/test_get_stats_after_funding.1.json # contracts/pool/test_snapshots/test/test_handle_default.1.json # contracts/pool/test_snapshots/test/test_handle_default_unauthorized_caller_panics.1.json # contracts/pool/test_snapshots/test/test_lp_position_reflects_current_share_price.1.json # contracts/pool/test_snapshots/test/test_multi_invoice_default_first_then_repay_second.1.json # contracts/pool/test_snapshots/test/test_multi_invoice_fund_two_repay_one_default_one.1.json # contracts/pool/test_snapshots/test/test_new_lp_deposits_after_multiple_yield_events.1.json # contracts/pool/test_snapshots/test/test_receive_repayment.1.json # contracts/pool/test_snapshots/test/test_receive_repayment_panics_when_amount_below_funded.1.json # contracts/pool/test_snapshots/test/test_receive_repayment_unauthorized_caller_panics.1.json # contracts/pool/test_snapshots/test/test_reducing_cap_mid_lifecycle_blocks_new_funding.1.json # contracts/pool/test_snapshots/test/test_series_of_defaults_erodes_lp_value.1.json # contracts/pool/test_snapshots/test/test_two_lps_one_withdraws_after_default.1.json # contracts/pool/test_snapshots/test/test_two_lps_receive_proportional_yield.1.json # contracts/pool/test_snapshots/test/test_utilization_rate_after_funding.1.json # contracts/pool/test_snapshots/test/test_utilization_rate_calculates_correctly.1.json # contracts/pool/test_snapshots/test/test_withdraw_after_default_partial.1.json # contracts/pool/test_snapshots/test/test_withdraw_fails_if_insufficient_liquidity.1.json # contracts/pool/test_snapshots/test/test_withdraw_full_after_default.1.json # contracts/pool/test_snapshots/test/test_yield_increases_share_price_after_repayment.1.json
|
@Micheal-Blessed 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
|
@K1NGD4VID Resolved, you can review. |
Contributor
|
resolve Merge Conflcit @Micheal-Blessed |
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.
Summary
The
repayment_receivedevent in the Pool contract now includes the originalfunded_amount(principal), enabling off-chain indexers to reconstruct the complete funding lifecycle for ROI and pool performance tracking.Problem
While the
InvoiceContractemitsinvoice_repaid, thePoolContractonly emitted a generic repayment event withamountandyield_amount. For off-chain indexing of pool performance and ROI, the original principal funded for each invoice is essential but was missing from the event.Changes
contracts/pool/src/events.rsfunded_amount: u128parameter to therepayment_receivedfunctionfunded_amountin the event data tuple:(amount, funded_amount, yield_amount)contracts/pool/src/lib.rsreceive_repayment, thefunded_amountis already read fromFundedInvoicestorage before the event emission — now passed directly to the event callTest Snapshots
cargo test -p trusttrove-pool)Event Data Format (After)
Where:
FundedInvoicestorage)amount - funded_amount)Acceptance Criteria
repayment_receivedevent now includes the original funded amountCloses #135