Skip to content

Conversation

@SynnekOG
Copy link

Summary

This PR enhances the MultiSigContractV2 contract with custom error handling and documentation improvements.
By introducing explicit errors and a clear Natspec section header, we improve both the readability and runtime efficiency of the contract.

Changes

  • Added Natspec section header for Custom Errors in MultiSigContractV2.
  • Defined new custom errors:
    • MultiSigContract__OnlyFactoryTokenContract()
      ↳ Thrown when a restricted function is called by a non-factory token contract.
    • MultiSigContract__OnlySigner()
      ↳ Thrown when a non-authorized signer attempts to act.
    • MultiSigContract__AlreadySigned()
      ↳ Thrown when a signer attempts to sign an action more than once.
  • Ran forge fmt to ensure consistent formatting.

Motivation

  • Gas efficiency: Custom errors are more efficient than require with revert strings.
  • Clarity: Explicitly named errors improve developer experience and make reverts easier to interpret.
  • Maintainability: Structured error management simplifies extending the contract with additional rules in the future.

Next Steps

  • Replace existing require statements with the new custom errors.
  • Extend testing to ensure each error is correctly triggered under invalid conditions.
  • Add developer documentation covering error usage patterns.

✅ Improves contract robustness, readability, and developer tooling alignment.

@2PykeETH 2PykeETH self-requested a review September 25, 2025 15:18
@2PykeETH 2PykeETH added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 25, 2025
@2PykeETH 2PykeETH merged commit b6a9646 into CraftMeme:main Sep 25, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants