Skip to content

[Contracts] LoanManager refinance_loan returns InsufficientScore for an insufficient-collateral condition #6

Closed

Description

@grantfox-oss

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

Why this matters

In loan_manager/src/lib.rs refinance_loan, the check if loan.collateral_amount < new_amount { return Err(LoanError::InsufficientScore); } returns the wrong error variant. A dedicated InsufficientCollateral = 26 variant already exists in the LoanError enum but is unused here, so callers receive a misleading error and cannot distinguish a credit-score failure from a collateral shortfall.

Acceptance criteria

  • Return LoanError::InsufficientCollateral for the collateral coverage check in refinance_loan
  • Audit other LoanError returns for similarly misused variants
  • Add a test asserting refinance with insufficient collateral returns InsufficientCollateral
  • Confirm InsufficientCollateral is actually exercised somewhere after the fix

Files to touch

  • loan_manager/src/lib.rs

Out of scope

  • Reworking refinance collateral ratio policy
  • Adding new error variants

Activity

  1. added
    bugSomething isn't working
    GrantFox OSSIssue tracked in GrantFox OSS
    Maybe RewardedIssue may be eligible for a GrantFox reward
    on Jun 17, 2026
  2. Godbrand0 commented on Jun 17, 2026

    @Godbrand0
    Contributor

    hello, i would like to work on this issue

  3. Dopezapha commented on Jun 20, 2026

    @Dopezapha
    Contributor

    Hey maintainer, I would love to work on this issue. Kindly assign me the issue. Thanks

  4. grantfox-oss commented on Jun 20, 2026

    @grantfox-oss
    Author

    🦊 GrantFox — @Godbrand0 has been assigned to this issue as part of the Official Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #6)
    2. Your PR will be reviewed by the LabsCrypt maintainers

    Good luck! Track your progress on GrantFox.

  5. grantfox-oss commented on Jun 23, 2026

    @grantfox-oss
    Author

    🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign campaign!

    @Godbrand0's PR #43 was approved and merged by @ogazboiz.

    🏆 @Godbrand0: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (83 total points). Track your full progress on GrantFox.

    👏 Great work, @Godbrand0! Keep contributing to LabsCrypt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions