Skip to content

[Contracts] LoanManager approve_loan overrides the borrower-requested term with the default term #5

@grantfox-oss

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

request_loan in loan_manager/src/lib.rs validates and stores term_ledgers: term from the borrower, but approve_loan overwrites it with let term_ledgers = Self::read_default_term(&env); and sets loan.term_ledgers = term_ledgers / due_date = sequence + term_ledgers. The borrower's requested and validated term is discarded, and min/max term limits checked elsewhere never bind the actual approved term.

Acceptance criteria

  • Approve using the loan's stored term_ledgers (or document why the default overrides it and enforce min/max term at request time accordingly)
  • Ensure min_term/max_term limits validated in request_loan actually govern the approved due_date
  • Add a test that requests a non-default term and asserts the approved loan's due_date reflects it
  • Update request_loan/approve_loan doc comments to match the real behavior

Files to touch

  • loan_manager/src/lib.rs

Out of scope

  • Adding variable-rate terms
  • Refinance term semantics

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't workinghardAdvanced / high-difficulty issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions