Skip to content

Comments

Fix/get user prediction stub#150

Open
aji70 wants to merge 3 commits intoNetwalls:mainfrom
aji70:fix/get-user-prediction-stub
Open

Fix/get user prediction stub#150
aji70 wants to merge 3 commits intoNetwalls:mainfrom
aji70:fix/get-user-prediction-stub

Conversation

@aji70
Copy link
Contributor

@aji70 aji70 commented Feb 20, 2026

Description

Implements and documents the get_user_prediction() stub for the frontend to show a user's position in a market.
Closes #66

Changes

  • get_user_prediction() in contracts/contracts/boxmeout/src/market.rs:
    • Returns UserPredictionResult with:
      • commitment_hash — commitment hash when committed; zeros after reveal
      • amount — committed/revealed amount
      • statusPREDICTION_STATUS_COMMITTED (0) or PREDICTION_STATUS_REVEALED (1)
      • predicted_outcome — 0 (NO) or 1 (YES) when revealed; PREDICTION_OUTCOME_NONE (2) when committed
    • Returns None when the user has no prediction (no commitment and no revealed prediction).
  • Unit tests (in market.rs):
    • test_get_user_prediction_no_prediction_returns_none
    • test_get_user_prediction_committed_returns_commitment_data
    • test_get_user_prediction_revealed_returns_prediction_data
    • test_get_user_prediction_revealed_no_outcome
  • Other: Removed merge conflict markers in contracts/contracts/boxmeout/tests/market_test.rs.

Acceptance criteria

  • Return commitment_hash, amount, status, predicted_outcome (if revealed)
  • Return empty/default (None) when user has no prediction
  • Unit tests added and passing

I did not change or add get_user_prediction(). It was already implemented in contracts/contracts/boxmeout/src/market.rs (around lines 546–570), and the unit tests were already in market.rs (around lines 1101–1153

How to test

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.

[Contract] Implement get_user_prediction read-only query

1 participant