feat(creditline): add vendor payment on loan approval#32
Closed
divicbold47 wants to merge 1 commit into
Closed
Conversation
Member
|
@divicbold47 fix ci issues |
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.
close #19
Add vendor payment support to the Creditline contract so approved loans actually transfer the funded amount to the vendor.
Files Changed
types.rs
lib.rs
events.rs
errors.rs
tests.rs
What Changed
Added vendor_paid: bool to Loan
Added pay_vendor() public entrypoint
Added internal vendor payment flow in pay_vendor_internal()
Integrated vendor payment into approve_loan() so approving a pending loan:
funds the vendor with the pool contribution
marks the loan as Active
sets vendor_paid = true
writes the updated loan
Added VENDOR_PAID event emission with loan/vendor/amount details
Added new error VendorAlreadyPaid
Added tests for:
successful approval and vendor payment
direct pay_vendor() flow
prevention of duplicate vendor payment
Testing
Verified modified files have no diagnostics errors
Could not execute cargo test in the current container because cargo is not installed on PATH
Notes
This addresses the issue where approved loans were not actually paying vendors
Uses stored token contract and liquidity pool fund flow for vendor payment