fix: implement MarketFactory C-05 through C-08 - #1174
Merged
Ehonrie merged 2 commits intoJul 29, 2026
Conversation
- C-01 (Netwalls#1019): add MarketInfo/MarketData to shared/src/types.rs, and fix two pre-existing compile breaks in the shared crate blocking any build: a misplaced #![no_std]/duplicate `pub mod types` in lib.rs, and an unsupported Option<Outcome> struct field (soroban-sdk's #[contracttype] derive has no ScVal conversion for Option<CustomEnum>; replaced with an explicit Outcome::Undetermined sentinel variant). - C-02 (Netwalls#1020): MarketFactory::initialize — stores admin, market wasm hash, and treasury; reverts with ContractError::AlreadyInitialized on a second call. - C-03 (Netwalls#1021): MarketFactory::create_market — validates end_time/lock_time, deploys a Market instance via env.deployer(), generates a collision-resistant market_id, and emits market_created with the full MarketInfo. - C-04 (Netwalls#1022): MarketFactory::get_market — read-only lookup by market_id. Also fixes market_factory/src/lib.rs, which referenced a non-existent `boxmeout_shared` crate (the actual dependency is named `shared`) and had a duplicated/syntactically broken get_market_address definition, both of which meant the crate did not compile at all beforehand. Tests deploy against a minimal, dependency-free dummy contract wasm (market_factory/test_fixtures/dummy.wasm) purely to exercise the real deploy_v2() path; it is not the production Market contract. Note: `cargo test -p shared` still fails due to pre-existing, unrelated breakage in shared/src/events.rs's own test module (deprecated Events::publish API, outdated ContractEvents methods) — reproducible on unmodified main and out of scope here. market_factory's tests do not depend on shared's test target and pass cleanly: cargo test -p market_factory -> 7 passed; 0 failed.
Builds on the C-01–C-04 foundation (initialize/create_market/get_market and the MarketInfo storage layout). - C-05 (Netwalls#1023): MarketFactory::list_markets — bounded, stably-ordered (creation order) pagination; limit capped at MAX_PAGE_SIZE (50) regardless of the requested value; out-of-range offset returns an empty Vec instead of panicking. - C-06 (Netwalls#1024): MarketFactory::list_active_markets — filters by env.ledger().timestamp() vs each market's end_time. - C-07 (Netwalls#1025): MarketFactory::set_admin — requires current_admin.require_auth() and rejects with ContractError::Unauthorized if it doesn't match stored admin. - C-08 (Netwalls#1026): MarketFactory::pause_factory / unpause_factory — admin-only toggle. Also wires the paused check into create_market (added here since that's this issue's stated acceptance criterion: "create_market reverts while paused"); existing markets remain readable while paused. cargo test -p market_factory -> 17 passed; 0 failed (7 from the C-01–C-04 PR + 10 new for C-05–C-08).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1023, #1024, #1025, #1026.