Skip to content

[RULE] Rule G006: Suggest payable Modifier on Admin-Only Functions #651

Description

@mijinummi

Labels: good-first-issue, gasguard-rules, bytecode, gasguard
Difficulty: Easy
Module: rules/g006_payable_admin.rs


🧠 Concept

Add rule G006 to recommend adding the payable modifier to strictly restricted administrative functions (onlyOwner, onlyAdmin).

⚠️ Problem

Non-payable functions generate explicit EVM bytecode checks (callvalue / iszero / revert) to verify that no ETH was sent, consuming ~24 extra gas per execution.

📁 Implementation Scope

  • rules/g006_payable_admin.rs
  • test/fixtures/g006_samples.sol

🛠️ Requirements

  1. Identify functions protected by access-control modifiers (e.g., onlyOwner).
  2. If the function is not marked payable, flag it with an optimization suggestion.

🎯 Acceptance Criteria

  • Correctly identifies restricted functions lacking payable.
  • Ignores public user-facing functions where ETH checks are necessary.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions