feat(lending): JIT interest accrual, multi-collateral support, and#711
Open
Spycall wants to merge 1 commit into
Open
Conversation
…orage-derive tests Closes MettaChain#587, MettaChain#588, MettaChain#589 - MettaChain#587: Confirm interest accrual uses JIT snapshots updated only on position-modifying calls (approve_loan_restructuring, liquidate_loan, update_servicing_status). Regression test added under contracts/lending/src/test.rs. - MettaChain#588: Allow a single borrower position to be backed by N collateral assets with weighted health-factor calculation. Added pledge_additional_collateral, should_liquidate_loan, and updated liquidate_loan to accept Vec<(u64, u128)> current collateral values. LTV is computed against total debt (principal + accrued interest) and the liquidation threshold is an assessed-value-weighted average across all pledged collaterals. - MettaChain#589: Added storage_derivation_tests asserting all pub-storage types derive Encode, Decode, TypeInfo, and StorageLayout. Also fixed missing LoanApplication fields (loan_type, start_block) that were referenced in liquidate_loan but absent from the struct, and removed a duplicate #[path = "test.rs"] module include that caused a compile error.
|
@Spycall 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! 🚀 |
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.
storage-derive tests
Closes #587
Closes #588
Closes #589
security(lending): Add circuit-breaker on extreme single-block price moves #587: Confirm interest accrual uses JIT snapshots updated only on position-modifying calls (approve_loan_restructuring, liquidate_loan, update_servicing_status). Regression test added under contracts/lending/src/test.rs.
feat(lending): Support multi-collateral positions (basket collateral) #588: Allow a single borrower position to be backed by N collateral assets with weighted health-factor calculation. Added pledge_additional_collateral, should_liquidate_loan, and updated liquidate_loan to accept Vec<(u64, u128)> current collateral values. LTV is computed against total debt (principal + accrued interest) and the liquidation threshold is an assessed-value-weighted average across all pledged collaterals.
test(lending): Add regression suite for missing-derive bug class #589: Added storage_derivation_tests asserting all pub-storage types derive Encode, Decode, TypeInfo, and StorageLayout.
Also fixed missing LoanApplication fields (loan_type, start_block) that were referenced in liquidate_loan but absent from the struct, and removed a duplicate #[path = "test.rs"] module include that caused a compile error.