Skip to content

Conversation

@SynnekOG
Copy link

Pull Request

Summary

This PR introduces a set of reusable modifiers in LiquidityManagerV2 to enforce stricter validation, access control, and safety checks across liquidity management functions.

Changes

  • Section Header
    • Added Modifiers section with NatSpec header for clarity and organization.
  • New Modifiers
    • onlyFactory: restricts function calls to the factory contract.
    • validTokenPair: ensures both token addresses are valid and distinct.
    • onlySupportedTokens: restricts operations to supported token pairs.
    • validAmount: checks that provided amounts are greater than zero.
    • deadlineCheck: enforces deadlines to mitigate stale transactions.
  • Formatting
    • Applied forge fmt for consistent code style.

Motivation

Modifiers reduce code duplication and make function-level validation more readable and maintainable.
They ensure:

  • Security: Unauthorized callers or invalid token pairs are blocked early.
  • Robustness: Prevents accidental zero amounts or expired transactions.
  • Clarity: Clearly expresses preconditions for function execution.

Next Steps

  • Apply these modifiers to liquidity-related functions (addLiquidity, removeLiquidity, initializePool, etc.).
  • Expand modifiers as needed for role-based permissions and protocol safety guarantees.

@Neros0 Neros0 self-requested a review September 15, 2025 22:49
@Neros0 Neros0 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 15, 2025
@Neros0 Neros0 merged commit 56fd9c7 into CraftMeme:main Sep 15, 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