Skip to content

Incorrect Analytics in count_bets_for_outcome Stub #183

@hman38705

Description

@hman38705

Description
The count_bets_for_outcome analytics function (Line 166) is a stub that checks for a Bet record associated with the contract address (e.current_contract_address()). This is logically impossible as the contract itself never places bets. It returns 1 if a random key exists and 0 otherwise, providing zero analytical value to the protocol.

Requirements and context

  • Replace the stub with a real outcome-based counter (synchronized with Issue 24).
  • Ensure analytics accurately reflect per-outcome participation.

Suggested execution

  • Fork the repo and create a branch: git checkout -b fix/issue-80-analytics-fix
  • Implement real-time bet counters.

Implementation changes

  • Refactor markets.rs (around line 169) to fetch the actual counter from DataKey::OutcomeBetCount(market_id, outcome).

Test and commit

  • Verify that the function returns the correct count for multiple distinct outcomes in the same market.

Example commit message
fix: replace broken analytics stub with precise outcome bet counter

Guidelines

  • Data accuracy.
  • Timeframe: 24 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions