Description
resolve_market in lib.rs emits multiple events (MarketResolvedEvent, OracleResultEvent, FeeCollectedEvent). Off-chain indexers depend on order. Add a test that captures env.events().all() and asserts the expected sequence.
Requirements and Context
- Use
env.events() introspection
- Assert ordering and topic shapes
- Document the ordering contract in
lib.rs rustdoc
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b test/resolve-market-event-ordering
- Implement changes
contracts/predictify-hybrid/tests/resolve_market_event_order.rs (new)
contracts/predictify-hybrid/src/lib.rs (only doc comments)
- Test and commit
cargo test -p predictify-hybrid resolve_market_event_order -- --nocapture
- Cover edge cases: tie outcome, single-winner outcome
- Include test output and notes in the PR
Example commit message
test: lock event emission order in resolve_market
Acceptance Criteria
Guidelines
- Avoid using exact ledger timestamps in assertions
- Minimum 95% coverage of touched files
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
resolve_marketinlib.rsemits multiple events (MarketResolvedEvent,OracleResultEvent,FeeCollectedEvent). Off-chain indexers depend on order. Add a test that capturesenv.events().all()and asserts the expected sequence.Requirements and Context
env.events()introspectionlib.rsrustdocSuggested Execution
contracts/predictify-hybrid/tests/resolve_market_event_order.rs(new)contracts/predictify-hybrid/src/lib.rs(only doc comments)cargo test -p predictify-hybrid resolve_market_event_order -- --nocaptureExample commit message
Acceptance Criteria
lib.rsunwrap()introducedGuidelines