Skip to content

fix: resolve merge conflict, structured config keys, admin events, do…#328

Merged
hman38705 merged 2 commits into
solutions-plug:mainfrom
manuelusman73-png:fix/issues-183-184-185-186
Mar 27, 2026
Merged

fix: resolve merge conflict, structured config keys, admin events, do…#328
hman38705 merged 2 commits into
solutions-plug:mainfrom
manuelusman73-png:fix/issues-183-184-185-186

Conversation

@manuelusman73-png

Copy link
Copy Markdown
Contributor

fix: analytics stub, config key collisions, admin events, double-refund guard (#183–186)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Summary

This PR resolves four issues across types.rs, markets.rs, and events.rs.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

#183 — Fix broken count_bets_for_outcome analytics

The Market struct had an unresolved merge conflict in types.rs that stripped the winner_counts: Map<u32, u32> field introduced by the
fix/issue-24-precise-winner-tracking branch. This prevented compilation and left count_bets_for_outcome non-functional. The conflict is resolved by keeping the
winner_counts field. A second conflict in OracleConfig (duplicate struct definition with an Option variant leaking below the markers) is also cleaned up.

#184 — Structured DataKey::Config(ConfigKey) for creation deposit storage

get_creation_deposit and set_creation_deposit were using ConfigKey::CreationDeposit directly as a storage key alongside DataKey::MarketCount in the same
persistent store. Since Soroban serializes #[contracttype] enums by discriminant index, two different enum types with overlapping discriminants can collide. A
Config(ConfigKey) variant is added to markets.rs's local DataKey enum and both functions are updated to route through it.

#185 — Emit events for administrative state changes

set_creator_reputation and set_creation_deposit performed silent state mutations with no on-chain trace. Two new emit functions are added to events.rs (rep_set,
dep_set), each carrying both the old and new values. Both setters now read the current value before writing and emit after a successful store.

#186 — Prevent double-refund in release_creation_deposit

The function transferred creation_deposit tokens but never zeroed the field, allowing repeated calls to drain the contract. Fixed by applying strict Checks-
Effects-Interactions: market.creation_deposit is set to 0 and persisted via update_market before the token_client.transfer call. Subsequent calls hit
creation_deposit == 0 and skip the transfer entirely.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Files changed

  • contracts/predict-iq/src/types.rs — resolved merge conflicts
  • contracts/predict-iq/src/modules/markets.rs — config key wrapping, admin events, CEI fix
  • contracts/predict-iq/src/modules/events.rs — emit_creator_reputation_set, emit_creation_deposit_set

Closes #183
Closes #184
Closes #185
Closes #186

…uble-refund guard

- solutions-plug#183: resolve types.rs merge conflict to enable winner_counts field;
  count_bets_for_outcome now reads market.winner_counts per outcome
- solutions-plug#184: add DataKey::Config(ConfigKey) variant in markets.rs; route
  get/set_creation_deposit through DataKey::Config to avoid key collisions
- solutions-plug#185: emit rep_set and dep_set events with old+new values from
  set_creator_reputation and set_creation_deposit
- solutions-plug#186: apply CEI in release_creation_deposit — zero creation_deposit
  and persist before token transfer to prevent double-refund
@drips-wave

drips-wave Bot commented Mar 27, 2026

Copy link
Copy Markdown

@manuelusman73-png Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@hman38705
hman38705 merged commit c97487c into solutions-plug:main Mar 27, 2026
1 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants