From 2aa10a2a73ddbca56f036b540c4883f9e59419b8 Mon Sep 17 00:00:00 2001 From: Songu3020 Date: Sat, 27 Jun 2026 08:51:59 +0100 Subject: [PATCH] Example commit message --- contracts/predictify-hybrid/src/markets.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contracts/predictify-hybrid/src/markets.rs b/contracts/predictify-hybrid/src/markets.rs index 997c06e2..36ebb4fb 100644 --- a/contracts/predictify-hybrid/src/markets.rs +++ b/contracts/predictify-hybrid/src/markets.rs @@ -125,10 +125,17 @@ impl MarketCreator { // Process market creation fee // Market creator flow does not have the generated market id yet in this helper path. // Use the generated id after creation in higher-level flows when event metadata is required. - let _ = MarketUtils::process_creation_fee(env, &admin)?; + let _ = MarketUtils::process_creation_fee(env, &admin)?; + + // Pre-flight check: ensure sufficient storage rent budget to prevent under-funded archives + let min_rent_budget = env.storage().persistent().max_ttl(); + if env.ledger().sequence() + min_rent_budget > u32::MAX { + return Err(Error::InsufficientStorageRentBudget); + } // Store market env.storage().persistent().set(&market_id, &market); + env.storage().persistent().extend_ttl(&market_id, min_rent_budget, min_rent_budget); Ok(market_id) }