Skip to content

Role-Based Access Control for Contract Operations #480

Description

@Kingsman-99

Description

Beyond a single admin, the contract needs distinct roles — Creator, Auditor, and Operator — each with a scoped set of permitted operations. This prevents over-privileged accounts from performing actions outside their remit.

Technical Context

Add a Role enum to types.rs with variants Admin, Operator, Auditor. Store role assignments under RoleAssignment(address, role) in storage::persistent inside contracts/split/src/lib.rs. Add grant_role and revoke_role (admin-only) and a require_role helper. Gate each entry point with the appropriate role check.

Acceptance Criteria

  • grant_role and revoke_role are admin-only and emit RoleGranted/RoleRevoked events
  • create_invoice requires Creator or Admin role
  • release_payment requires Operator or Admin role
  • get_invoice is callable by any role including Auditor
  • Assigning the same role twice to an address is a no-op
  • All CI checks (cargo build --target wasm32-unknown-unknown, cargo test, cargo clippy) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions