feat(quest-engine): deliver uncapped staking multiplier payouts - #103
Merged
Conversation
Kaylahray
approved these changes
Jul 29, 2026
Kaylahray
approved these changes
Jul 29, 2026
3 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.
fix(quest-engine): deliver real boosted payouts on Build Quest approvals
Problem
The staking multiplier was being fetched in
review_submissionbut the finallearner payout was silently capped back to
base_learner_amount. A learner witha 1.2x multiplier received exactly the same amount as an unstaked learner,
making staking incentives ineffective for B2B bounties.
Solution
Redesigned the approval payout in
review_submissionwith an explicit two-sourcefunding model:
fee(15%) → RewardPool +base_learner_amount→ learnerboost_delta(boosted_amount − base) → learnerThe quest escrow budget check (
remaining >= quest.reward_amount) is preservedunchanged. The boost delta is drawn from the RewardPool via
distribute_reward,which fails deterministically if the pool lacks sufficient balance — making the
funding constraint explicit and observable.
Basis-point math is unchanged:
boosted = (base * multiplier) / 100.Changes
contracts/quest-engine/src/lib.rslearner_amountback tobase_learner_amountreward_pool.distribute_reward(contract, learner, boost_delta)whenboost_delta > 0consumed_amountcontinues to track only what is drawn from the quest escrow(
quest.reward_amount), keeping budget accounting consistentcontracts/quest-engine/src/test.rsMockStakeVault200— a 200x (2.0×) multiplier vault for tier testingMockRewardPoolTransfer— a mock RewardPool that actually transferstokens, needed to verify end-to-end learner balances for boosted payouts
setup_with_boosted_multiplier()— wiresMockStakeVaultWithMultiplier(120x) +
MockRewardPoolTransferinto a full QuestEngine instancetest_review_submission_with_120_multiplierto pre-fund the pool forthe delta and assert the learner receives the real boosted amount (1020, not 850)
test_refund_after_capped_multiplier_returns_leftover_only→test_refund_after_boosted_multiplier_escrow_is_fully_consumedwith updatedassertions matching the new accounting model
New acceptance-criteria tests:
test_staked_learner_receives_more_than_non_stakedtest_basis_point_math_for_100_120_200_multiplierstest_review_submission_with_200_multiplier_draws_delta_from_pooltest_review_submission_fails_deterministically_when_pool_cannot_cover_boostPayout walkthrough (reward = 1000, multiplier = 120)
Test results
Full workspace: 202 tests, 0 failures.
Closes #87