Skip to content

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

Merged
Kaylahray merged 5 commits into
learnault:mainfrom
drips-projects:Transfer-course-ownership
Jun 3, 2026
Merged

feat(course-registry): add course ownership transfer#75
Kaylahray merged 5 commits into
learnault:mainfrom
drips-projects:Transfer-course-ownership

Conversation

@Joeloo1
Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Contributor

@Kaylahray Kaylahray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix conflicts @Joeloo1

@Kaylahray
Copy link
Copy Markdown
Contributor

@Joeloo1

@Joeloo1 Joeloo1 requested a review from Kaylahray June 2, 2026 09:56
…ip tests

Restores the badge NFT test section that was accidentally replaced instead of appended, fixing the unclosed delimiter CI parse error.
@Kaylahray
Copy link
Copy Markdown
Contributor

@Joeloo1 Please fix Ci

Joeloo1 and others added 2 commits June 3, 2026 14:53
… test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Kaylahray Kaylahray merged commit 3ecf46a into learnault:main Jun 3, 2026
1 check passed
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

2 participants