Problem Statement
stake-vault/src/lib.rs::get_multiplier returns a raw u32 representing basis points (100=1.0x, 120=1.2x, 200=2.0x). Cross-contract callers (e.g., quest-engine::review_submission) hardcode the meaning: let learner_amount = if calculated_boost > base_learner_amount { base_learner_amount } else { calculated_boost }; — this comparison is meaningless without knowing the divisor (100).
Calling get_multiplier from a new contract without reading the source code in detail can lead to silent bugs in payout scaling.
Why It Matters
- Cross-contract semantics encoded in numeric interpretation is fragile.
- New contributors will be confused why "200" returns for "2.0x."
- Opaque
u32 makes integration test assertions brittle.
Expected Outcome
- Define a
pub enum MultiplierBps { None = 100, Low = 120, High = 200 } (or similar) and have get_multiplier return it.
- Update QuestEngine to consume the enum and compute payouts accordingly.
- Document the basis-points convention in the rustdoc for
get_multiplier.
- Provide a
MultiplierBps::as_bps() -> u32 accessor.
Acceptance Criteria
- QuestEngine tests still pass.
- New test: enum round-trip preserves numeric value.
- Readme updated.
Implementation Notes
- Use Soroban's
#[contracttype] for the enum so it's serializable if ever stored.
- Survey all call sites before migration.
Files / Modules Affected
contracts/stake-vault/src/lib.rs
contracts/stake-vault/src/types.rs
contracts/quest-engine/src/lib.rs
contracts/stake-vault/README.md
Dependencies
None.
Difficulty
Medium.
Estimated Effort
3–4 hours.
Suggested Labels
api, quality, P2, stake-vault, quest-engine
Problem Statement
stake-vault/src/lib.rs::get_multiplierreturns a rawu32representing basis points (100=1.0x, 120=1.2x, 200=2.0x). Cross-contract callers (e.g.,quest-engine::review_submission) hardcode the meaning:let learner_amount = if calculated_boost > base_learner_amount { base_learner_amount } else { calculated_boost };— this comparison is meaningless without knowing the divisor (100).Calling
get_multiplierfrom a new contract without reading the source code in detail can lead to silent bugs in payout scaling.Why It Matters
u32makes integration test assertions brittle.Expected Outcome
pub enum MultiplierBps { None = 100, Low = 120, High = 200 }(or similar) and haveget_multiplierreturn it.get_multiplier.MultiplierBps::as_bps() -> u32accessor.Acceptance Criteria
Implementation Notes
#[contracttype]for the enum so it's serializable if ever stored.Files / Modules Affected
contracts/stake-vault/src/lib.rscontracts/stake-vault/src/types.rscontracts/quest-engine/src/lib.rscontracts/stake-vault/README.mdDependencies
None.
Difficulty
Medium.
Estimated Effort
3–4 hours.
Suggested Labels
api,quality,P2,stake-vault,quest-engine