Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions contracts/predictify-hybrid/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ impl AdminInitializer {
/// control over the contract. Consider using a multi-signature wallet
/// or governance contract for production deployments.
pub fn initialize(env: &Env, admin: &Address) -> Result<(), Error> {
// Require the proposed admin to authorize becoming the contract admin.
admin.require_auth();

// Validate all initialization parameters atomically before any state changes.
AdminInitializer::validate_initialization_params(env, admin)?;

Expand Down Expand Up @@ -353,7 +350,7 @@ impl AdminInitializer {
Environment::Mainnet => ConfigManager::get_mainnet_config(env),
Environment::Custom => ConfigManager::get_development_config(env),
};
ConfigManager::validate_config(env, &config)?;
crate::config::ConfigValidator::validate_contract_config(&config)?;

// Initialize basic admin setup
AdminInitializer::initialize(env, admin)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#![cfg(test)]

use alloc::format;
use soroban_sdk::{symbol_short, testutils::Events, Env, Symbol, Vec};

use crate::event_topic_compat::{
Expand Down
12 changes: 11 additions & 1 deletion contracts/predictify-hybrid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ mod category_tags_tests;
mod tie_resolution_tests;
#[cfg(test)]
mod force_resolve_tests;
#[cfg(test)]
mod settlement_conservation;
// #[cfg(any())]
// mod statistics_tests;

Expand Down Expand Up @@ -2518,6 +2520,10 @@ impl PredictifyHybrid {
panic_with_error!(env, Error::MarketNotFound);
});

if market.state == MarketState::Resolved {
panic_with_error!(env, Error::MarketResolved);
}

// Check if market has ended
if env.ledger().timestamp() < market.end_time {
panic_with_error!(env, Error::MarketClosed);
Expand Down Expand Up @@ -2689,6 +2695,10 @@ impl PredictifyHybrid {
panic_with_error!(env, Error::MarketNotFound);
});

if market.state == MarketState::Resolved {
panic_with_error!(env, Error::MarketResolved);
}

// Check if market has ended
if env.ledger().timestamp() < market.end_time {
panic_with_error!(env, Error::MarketClosed);
Expand Down Expand Up @@ -4374,7 +4384,7 @@ impl PredictifyHybrid {
// ── Budget guard: abort before host runs out of CPU instructions ───────
// Threshold of 100 000 instructions gives enough headroom to finish the
// current iteration and write the updated market back to storage.
let budget_guard = BudgetGuard::new(&env, 100_000);
let budget_guard = BudgetGuard::new(&env, 5_000_000);

// ── 1. Distribute to Voters ────────────────────────────────────────────
let mut voter_count = 0u32;
Expand Down
Loading
Loading