Skip to content

fix: implement MarketFactory C-05 through C-08 - #1174

Merged
Ehonrie merged 2 commits into
Netwalls:mainfrom
unrealtim-tech:fix/market-factory-c05-c08
Jul 29, 2026
Merged

fix: implement MarketFactory C-05 through C-08#1174
Ehonrie merged 2 commits into
Netwalls:mainfrom
unrealtim-tech:fix/market-factory-c05-c08

Conversation

@unrealtim-tech

@unrealtim-tech unrealtim-tech commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

MJigah and others added 2 commits July 29, 2026 04:58
- 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).
@Ehonrie
Ehonrie merged commit 53eb6d0 into Netwalls:main Jul 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants