Skip to content

Implement seed_market — initial AMM liquidity seeding#302

Merged
GoSTEAN merged 4 commits intoNetwalls:mainfrom
utilityjnr:utility
Mar 26, 2026
Merged

Implement seed_market — initial AMM liquidity seeding#302
GoSTEAN merged 4 commits intoNetwalls:mainfrom
utilityjnr:utility

Conversation

@utilityjnr
Copy link
Copy Markdown
Contributor

closes #257

Implements operator role management in the MarketFactory Soroban contract, allowing delegated market creation without exposing superadmin access.

Changes
factory.rs

DataKey::IsOperator(Address) — typed storage key for role membership
grant_operator(admin, operator) — admin-only, sets key to true, emits OperatorGrantedEvent
revoke_operator(admin, operator) — admin-only, sets key to false, emits OperatorRevokedEvent
is_operator(address) — pure read, returns bool
assert_admin_or_operator(env, caller) — shared internal helper used by create_market
factory_test.rs

Rewrote test file with shared setup_factory / future_times helpers
Added 9 operator-specific tests covering all acceptance criteria
Fixed unused import warnings in oracle_test.rs and market_test.rs to pass cargo clippy --all-targets -D warnings
Fixed unused inner variable binding in amm.rs buy_shares that would fail clippy

Your Actual Name and others added 4 commits February 24, 2026 14:15
- Add BlockchainIndexerService for monitoring smart contract events
- Implement event polling and processing from Stellar RPC
- Add state management with database checkpoints
- Create admin API endpoints for indexer control
- Add comprehensive error handling with DLQ
- Implement 7 event type handlers (market_created, pool_created, shares_bought, etc.)
- Add automatic startup and graceful shutdown
- Create comprehensive unit and integration tests

Features:
- Real-time event monitoring from blockchain
- Batch processing (10 ledgers per cycle)
- Checkpoint system for resume capability
- Dead Letter Queue for failed events
- Admin-only control endpoints
- Statistics and monitoring
- Manual reprocessing support

API Endpoints:
- GET /api/indexer/status - Get indexer statistics
- POST /api/indexer/start - Start indexer
- POST /api/indexer/stop - Stop indexer
- POST /api/indexer/reprocess - Reprocess from ledger

Event Types:
- market_created - Market creation confirmation
- pool_created - AMM pool initialization
- shares_bought - Share purchase confirmation
- shares_sold - Share sale confirmation
- market_resolved - Market resolution
- attestation_submitted - Oracle attestation
- distribution_executed - Treasury distribution

Tests:
- 8+ unit tests with comprehensive coverage
- 10+ integration tests for all endpoints
- Authentication and authorization tests
- Error handling and validation tests

Documentation:
- Complete architecture documentation
- API specifications
- Configuration guide
- Troubleshooting guide
- Implementation summary
@utilityjnr utilityjnr changed the title Utility Implement seed_market — initial AMM liquidity seeding Mar 26, 2026
@GoSTEAN GoSTEAN merged commit c2ee7ee into Netwalls:main Mar 26, 2026
0 of 2 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

Development

Successfully merging this pull request may close these issues.

Issue #7 — grant_operator / revoke_operator / is_operator

2 participants