Skip to content

feat(course-registry): add course ownership transfer#75

Open
Joeloo1 wants to merge 1 commit into
learnault:mainfrom
drips-projects:Transfer-course-ownership
Open

feat(course-registry): add course ownership transfer#75
Joeloo1 wants to merge 1 commit into
learnault:mainfrom
drips-projects:Transfer-course-ownership

Conversation

@Joeloo1
Copy link
Copy Markdown

@Joeloo1 Joeloo1 commented May 31, 2026

Summary

  • Implements transfer_ownership(env, current_instructor, new_instructor, course_id) in contracts/course-registry/src/lib.rs
  • Enforces current_instructor.require_auth() and asserts the caller matches the stored instructor before making any changes
  • Updates the instructor field on the persisted Course struct and emits an OwnershipTransferred event
  • Adds 6 tests covering: success path, event emission, non-instructor rejection, nonexistent course, post-transfer metadata update by the new owner, and before/after instructor field assertion

Test plan

  • test_transfer_ownership_success — instructor field updated correctly
  • test_transfer_ownership_emits_eventOwnershipTransferred event emitted
  • test_transfer_ownership_non_instructor_panics — unauthorized caller rejected
  • test_transfer_ownership_nonexistent_course_panics — invalid course ID panics
  • test_transfer_ownership_new_instructor_can_update_metadata — new owner can call update_metadata post-transfer (acceptance criterion)
  • test_transfer_ownership_updates_instructor_field — old address removed, new address stored
  • All 42 tests pass (cargo test -p course-registry)

Closes #58

Implements transfer_ownership() allowing the current instructor to
transfer a course to a new address. Enforces require_auth() and
instructor identity checks, updates the stored Course struct, and
emits an OwnershipTransferred event. Adds 6 tests covering the happy
path, auth rejection, nonexistent course, event emission, and
post-transfer metadata update by the new owner.

Closes learnault#58
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@Joeloo1 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CourseRegistry] Transfer course ownership

1 participant