Description
A cross-contract call from the CourseRegistry to the RewardPool. When a learner marks their final module as complete, the contract calls distribute_reward on the RewardPool so learners are instantly compensated without manual intervention.
User Story
As the Learnault Protocol,
I want to automatically trigger a USDC reward when a learner finishes a course,
so that learners are instantly compensated for their educational progress without manual intervention.
Requirements and Context
- Files:
contracts/course-registry/src/lib.rs, contracts/course-registry/src/test.rs
- After incrementing a learner's progress, check if
progress == total_modules
- If true, initialize
RewardPoolClient and call distribute_reward with the predefined course payout amount
Suggested Implementation
// IN FUNCTION: complete_module(env: Env, learner: Address, course_id: u32)
// 1. // ... progress increment logic ...
// 2. if new_progress == course.total_modules {
// 3. let reward_pool = RewardPoolClient::new(&env, &reward_pool_address);
// 4. let base_reward = 10_0000000; // e.g., 10 USDC
// 5. reward_pool.distribute_reward(&env.current_contract_address(), &learner, &base_reward);
// 6. emit CourseCompleted event.
// 7. }
Acceptance Criteria
Submission Guidelines
- Branch:
feat/course-completion-payout
- Depends on:
RewardPool distribute_reward function
- PR:
feat(course-registry): trigger USDC payout on course completion
Description
A cross-contract call from the CourseRegistry to the RewardPool. When a learner marks their final module as complete, the contract calls
distribute_rewardon the RewardPool so learners are instantly compensated without manual intervention.User Story
As the Learnault Protocol,
I want to automatically trigger a USDC reward when a learner finishes a course,
so that learners are instantly compensated for their educational progress without manual intervention.
Requirements and Context
contracts/course-registry/src/lib.rs,contracts/course-registry/src/test.rsprogress == total_modulesRewardPoolClientand calldistribute_rewardwith the predefined course payout amountSuggested Implementation
Acceptance Criteria
Submission Guidelines
feat/course-completion-payoutRewardPool distribute_reward functionfeat(course-registry): trigger USDC payout on course completion