Issue #19:
Developer Goal: Drastically reduce market creation and betting gas costs by minimizing the ledger footprint of the Market and Bet structs.
Technical Context: Ledger storage on Soroban is expensive. Default Rust serialization (XDR) can be verbose. Using bit-packing and Bytes instead of Vec<String> for metadata can save significant costs.
Detailed Requirements:
- Metadata Compression: Store the market
description and options as a single Bytes object containing a compressed JSON or a custom binary format.
- Bit-Packing:
- Combined
MarketStatus (u8), WinningOutcome (u8), and Tier (u8) into a single u32 "Header" field.
- Pack boolean flags (is_disputed, is_cancelled, has_oracle) into bit-flags (0x01, 0x02, etc.).
- Storage Pruning: Implement a "Garbage Collection" function that allows any user to delete
Bet data for markets that have been Resolved for more than 180 days, rewarding the caller with a tiny "Clean-up Fee".
Verification Checklist:
Issue #19:
Developer Goal: Drastically reduce market creation and betting gas costs by minimizing the ledger footprint of the
MarketandBetstructs.Technical Context: Ledger storage on Soroban is expensive. Default Rust serialization (XDR) can be verbose. Using bit-packing and
Bytesinstead ofVec<String>for metadata can save significant costs.Detailed Requirements:
descriptionandoptionsas a singleBytesobject containing a compressed JSON or a custom binary format.MarketStatus(u8),WinningOutcome(u8), andTier(u8) into a singleu32"Header" field.Betdata for markets that have beenResolvedfor more than 180 days, rewarding the caller with a tiny "Clean-up Fee".Verification Checklist:
create_marketbefore and after optimization. Aim for >20% reduction.git checkout -b features/issue-19-Precision-Optimized Binary Storagedevelopbranchv