feat: course metadata versioning and get_platform_fee access control … - #205
Merged
SYLVIANNORUKA merged 2 commits intoJul 29, 2026
Conversation
|
@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! 🚀 |
EDOHWARES
force-pushed
the
issue-67-70-course-versioning-fee-access
branch
from
July 26, 2026 00:57
8139ca7 to
447e5cd
Compare
Contributor
Author
|
@SYLVIANNORUKA , pls review PR |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR resolves issues #67 (Course Metadata Versioning) and #70 (
get_platform_fee()Access Control).1. Course Metadata Versioning (#67)
CourseStruct: Addedversion: u32field (starts at1upon registration).EnrollmentStruct: Addedcourse_version: u32field to immutably record the active course version at the time of enrollment (populated in bothenroll()andre_enroll()).update_course()Method: Addedupdate_course(env, caller, course_id, new_price, new_max_capacity)inlib.rsallowing authorized instructors or admins to update course details while incrementingcourse.version.2. Access Control for
get_platform_fee()(#70)get_platform_fee(env: Env, admin: Address) -> u32to require admin signature (admin.require_auth()andrequire_admin).lib.rsdocumenting the access control rationale to prevent business intelligence exposure.Task Checklist
version: u32field toCoursestruct incontracts/hamplard/src/lib.rscourse_version: u32field toEnrollmentstruct incontracts/hamplard/src/lib.rsenroll()andre_enroll()update_course()function incrementing version on course updatesget_platform_fee()to admin-only accessget_platform_fee()access control in contract security modelTest Verification
cargo test:test result: ok. 123 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outtest_course_metadata_versioning_across_updatestest_get_platform_fee_unauthorized_failstest_update_course_unauthorized_failsCloses #67
Closes #70
Closes #69
Closes #105