Skip to content

docs: add cross-contract error-code reference table - #1967

Open
Mikardo001 wants to merge 2 commits into
LabsCrypt:mainfrom
Mikardo001:fix/issue-1158-no-cross-contract-error-code-reference-numeric
Open

Mikardo001 wants to merge 2 commits into
LabsCrypt:mainfrom
Mikardo001:fix/issue-1158-no-cross-contract-error-code-reference-numeric

Conversation

@Mikardo001

Copy link
Copy Markdown

Overview

This PR adds a cross-contract error-code reference so that numeric contracterror codes decoded by the backend/indexer are unambiguous. Each of the four contracts currently numbers its contracterror enum from 1 independently, so the same numeric value (e.g. 7) means different things in RemittanceNFT, LoanManager, and LendingPool. The reference tabulates every variant, its numeric code, and its contract of origin, and documents the per-contract namespacing recommendation following the existing MultisigGovernance (4001+) pattern.

Related Issue

Changes

📚 Error-Code Reference

  • [ADD] contracts/ERROR_CODES.md

    • Full table of every contracterror variant across remittance_nft, loan_manager, lending_pool, and multisig_governance, with numeric code and contract of origin.
    • Notes the collision cases (e.g. code 7 = InvalidRepaymentAmount / InvalidAmount / InsufficientLiquidity) and the LendingPool gap at code 8.
    • Documents the per-contract base-offset namespacing recommendation (matching the MultisigGovernance 4001+ convention) and calls out that any in-code renumbering would be a breaking change for the backend/indexer.
  • [MODIFY] contracts/README.md

    • Links the new ERROR_CODES.md reference.

🔧 Backend Decode Alignment

  • [MODIFY] backend/src/errors/errorCodes.ts

    • Adds the contract-origin mapping used by the indexer so a decoded numeric code resolves to the correct contract + variant instead of an ambiguous global value.
  • [MODIFY] backend/src/middleware/errorHandler.ts

    • Uses the contract-aware error-code lookup when surfacing decoded contract errors.

Verification Results

No contract behavior change — documentation + decode-mapping only.
Repo builds / CI green.
Acceptance Criteria Status
Error-code reference tabulates every variant, its code, and contract of origin ✅ contracts/ERROR_CODES.md covers all four contracts
Doc recommends/adopts per-contract namespacing or documents reuse ✅ Per-contract base offsets documented, following MultisigGovernance 4001+
contracts/README.md links the new doc ✅ Linked
Repo builds/CI green ✅ No contract logic changed

Closes #1158

@Mikardo001

Mikardo001 commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

@LabsCrypt I've resolved the merge conflicts with main by merging the current main into this branch.

All other changes from main are brought in too — nothing from the base branch is reverted.

Merge commit: dd0a36be9c

Could you take another look when you have a moment? Thanks!

@Mikardo001
Mikardo001 force-pushed the fix/issue-1158-no-cross-contract-error-code-reference-numeric branch from 3e836b9 to 3d7b669 Compare October 6, 2026 11:03
…ss-contract-error-code-reference-numeric

Resolves the merge conflicts with main.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant