Skip to content

[Contracts] RemittanceNFT decrease_score and set_min_repayment_amount panic instead of returning typed NftError #1152

Description

@grantfox-oss

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

Why this matters

remittance_nft/src/lib.rs:715-721 decrease_score returns () and panics via unwrap_or_else(|_| panic!(unauthorized minter)) / expect(user does not have an NFT), and set_min_repayment_amount (693-697) does panic!(negative amount). Every sibling mutator (mint, update_score, seize_collateral, burn, transfer, apply_score_delta) returns Result<(), NftError> with typed variants, so these two break the contract's error API and give callers no structured error (cross-contract callers can only observe a generic trap).

Acceptance criteria

  • decrease_score returns Result<(), NftError> using UnauthorizedMinter and NftNotFound instead of panicking
  • set_min_repayment_amount returns an error variant (e.g. a new InvalidAmount/BelowMinimum) for negative input instead of panic!
  • Existing should_panic tests updated to assert the typed errors

Files to touch

  • contracts/remittance_nft/src/lib.rs

Out of scope

  • Changing decrease_score scoring/floor logic (tracked separately)
  • Altering MultisigGovernance error handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    contractsIssues related to smart contractsenhancementNew feature or requestnftNFT functionalityrustPull requests that update rust code

    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