Skip to content

[Docs] No cross-contract error-code reference; numeric contracterror codes collide across the four contracts #1158

Description

@grantfox-oss

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

Why this matters

Each contract numbers its contracterror enum independently from 1: e.g. code 7 = InvalidRepaymentAmount in RemittanceNFT (lib.rs:16), InvalidAmount in LoanManager (lib.rs:42), and InsufficientLiquidity in LendingPool (lib.rs:19); only GovernanceError namespaces (4001+). The backend/indexer decode raw numeric codes from any of the four contracts, so a decoded code N is ambiguous and there is no single doc mapping code -> meaning per contract (lending_pool also skips code 8). No error-code reference file exists in the repo.

Acceptance criteria

  • Add an error-code reference (e.g. contracts/ERROR_CODES.md) tabulating every contracterror variant, its numeric code, and contract of origin
  • Recommend/adopt per-contract numeric namespacing (as multisig already does) or document why codes are reused
  • Reference the doc from contracts/README.md

Files to touch

  • contracts/remittance_nft/src/lib.rs
  • contracts/loan_manager/src/lib.rs
  • contracts/lending_pool/src/lib.rs
  • contracts/multisig_governance/src/lib.rs

Out of scope

  • Replacing panics with enums (already done)
  • Backend API error codes

Metadata

Metadata

Assignees

No one assigned

    Labels

    contractsIssues related to smart contractsdocsDocumentationdocumentationImprovements or additions to documentationenhancementNew feature or request

    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