Skip to content

CONTRACTS: Add Batch Operations Support #420

@truthixify

Description

@truthixify

Description

Implement batch operations for common actions like issuing multiple tokens, logging multiple attendance records, or managing multiple user roles to improve gas efficiency and user experience.

Files to Modify

  • contracts/manage_hub/src/lib.rs - Add batch operation endpoints
  • contracts/manage_hub/src/membership_token.rs - Add batch token operations
  • contracts/manage_hub/src/attendance_log.rs - Add batch attendance logging
  • contracts/access_control/src/lib.rs - Add batch role management
  • contracts/access_control/src/access_control.rs - Implement batch role logic
  • contracts/common_types/src/types.rs - Add batch operation data structures

Key Changes Required

  1. Batch Data Structures - Create batch request structures in common_types/src/types.rs for different operation types
  2. Batch Token Operations - Add batch functions to membership_token.rs with proper validation and size limits
  3. Batch Attendance Logging - Implement batch attendance operations in attendance_log.rs with optimized storage patterns
  4. Batch Role Management - Add batch role operations to access_control.rs with proper authorization checks
  5. Gas Optimization - Implement batch size limits and gas estimation functions to prevent transaction failures
  6. Partial Success Handling - Design the batch operations to handle scenarios where some operations succeed and others fail
  7. Batch Events - Emit appropriate events for batch operations including success/failure counts

Acceptance Criteria

  • Add batch_issue_tokens function with max 50 tokens per batch
  • Add batch_log_attendance function with max 100 entries per batch
  • Add batch_set_roles function with max 25 roles per batch
  • Implement proper validation for batch operations
  • Add gas estimation functions for batch operations
  • Include comprehensive batch operation tests
  • Add partial success handling (some operations succeed, others fail)
  • Implement batch operation events and logging

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions