Skip to content

feat: course metadata versioning and get_platform_fee access control … - #205

Merged
SYLVIANNORUKA merged 2 commits into
Hamplard-Hub:mainfrom
EDOHWARES:issue-67-70-course-versioning-fee-access
Jul 29, 2026
Merged

feat: course metadata versioning and get_platform_fee access control …#205
SYLVIANNORUKA merged 2 commits into
Hamplard-Hub:mainfrom
EDOHWARES:issue-67-70-course-versioning-fee-access

Conversation

@EDOHWARES

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR resolves issues #67 (Course Metadata Versioning) and #70 (get_platform_fee() Access Control).

1. Course Metadata Versioning (#67)

  • Course Struct: Added version: u32 field (starts at 1 upon registration).
  • Enrollment Struct: Added course_version: u32 field to immutably record the active course version at the time of enrollment (populated in both enroll() and re_enroll()).
  • update_course() Method: Added update_course(env, caller, course_id, new_price, new_max_capacity) in lib.rs allowing authorized instructors or admins to update course details while incrementing course.version.

2. Access Control for get_platform_fee() (#70)

  • Admin Authentication: Updated get_platform_fee(env: Env, admin: Address) -> u32 to require admin signature (admin.require_auth() and require_admin).
  • Security Model Documentation: Updated the contract header security model in lib.rs documenting the access control rationale to prevent business intelligence exposure.

Task Checklist

  • Add version: u32 field to Course struct in contracts/hamplard/src/lib.rs
  • Add course_version: u32 field to Enrollment struct in contracts/hamplard/src/lib.rs
  • Populate enrollment version in enroll() and re_enroll()
  • Implement update_course() function incrementing version on course updates
  • Restrict get_platform_fee() to admin-only access
  • Document get_platform_fee() access control in contract security model
  • Update existing tests and add unit tests verifying version tracking and fee access control

Test Verification

  • Executed full Soroban Rust test suite via cargo test:
    test result: ok. 123 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  • Added test coverage for:
    • test_course_metadata_versioning_across_updates
    • test_get_platform_fee_unauthorized_fails
    • test_update_course_unauthorized_fails

Closes #67
Closes #70
Closes #69
Closes #105

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@EDOHWARES Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@EDOHWARES
EDOHWARES force-pushed the issue-67-70-course-versioning-fee-access branch from 8139ca7 to 447e5cd Compare July 26, 2026 00:57
@EDOHWARES

Copy link
Copy Markdown
Contributor Author

@SYLVIANNORUKA , pls review PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment