Skip to content
Merged
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
1 change: 0 additions & 1 deletion contracts/predictify-hybrid/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::errors::Error;
use crate::events::EventEmitter;
use crate::extensions::ExtensionManager;
use crate::fees::{FeeConfig, FeeManager};
use crate::format;
use crate::markets::MarketStateManager;
use crate::resolution::MarketResolutionManager;
use alloc::string::ToString;
Expand Down
3 changes: 2 additions & 1 deletion contracts/predictify-hybrid/src/bets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::errors::Error;
use crate::events::EventEmitter;
use crate::markets::{MarketStateManager, MarketUtils, MarketValidator};
use crate::reentrancy_guard::ReentrancyGuard;
use crate::types::{Bet, BetLimits, BetStats, BetStatus, Market, MarketState};
use crate::types::{Bet, BetLimits, BetStatus, BetStats, Market, MarketState};
use crate::validation;

// ===== CONSTANTS =====
Expand Down Expand Up @@ -1015,6 +1015,7 @@ impl BetAnalytics {
#[cfg(test)]
mod tests {
use super::*;
use crate::types::BetStatus;

#[test]
fn test_bet_amount_validation() {
Expand Down
1 change: 0 additions & 1 deletion contracts/predictify-hybrid/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2792,7 +2792,6 @@ impl ConfigTesting {
#[cfg(test)]
mod tests {
use super::*;
use soroban_sdk::testutils::Address as _;

#[test]
fn test_config_manager_default_configs() {
Expand Down
52 changes: 26 additions & 26 deletions contracts/predictify-hybrid/src/edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ impl EdgeCaseHandler {
}

/// Validate edge case configuration.
fn validate_edge_case_config(env: &Env, config: &EdgeCaseConfig) -> Result<(), Error> {
fn validate_edge_case_config(_env: &Env, config: &EdgeCaseConfig) -> Result<(), Error> {
if config.min_total_stake < 0 {
return Err(Error::ThresholdBelowMin);
}
Expand All @@ -541,52 +541,52 @@ impl EdgeCaseHandler {

/// Extend market for increased participation.
fn extend_for_participation(
env: &Env,
market_id: &Symbol,
extension_seconds: u64,
_env: &Env,
_market_id: &Symbol,
_extension_seconds: u64,
) -> Result<(), Error> {
// Implementation would extend market duration
// This is a placeholder that would integrate with the extension system
Ok(())
}

/// Cancel market with zero stakes.
fn cancel_zero_stake_market(env: &Env, market_id: &Symbol) -> Result<(), Error> {
fn cancel_zero_stake_market(_env: &Env, _market_id: &Symbol) -> Result<(), Error> {
// Implementation would cancel market and handle refunds
Ok(())
}

/// Emergency extension for stake collection.
fn emergency_extension_for_stakes(
env: &Env,
market_id: &Symbol,
extension_seconds: u64,
_env: &Env,
_market_id: &Symbol,
_extension_seconds: u64,
) -> Result<(), Error> {
// Implementation would trigger emergency extension
Ok(())
}

/// Tie-breaking by earliest vote timestamp.
fn tie_break_by_earliest_vote(env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
fn tie_break_by_earliest_vote(_env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
// Implementation would check vote timestamps
// For now, return first outcome as placeholder
Ok(outcomes.get(0).unwrap())
}

/// Tie-breaking by voter count.
fn tie_break_by_voter_count(env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
fn tie_break_by_voter_count(_env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
// Implementation would count unique voters per outcome
Ok(outcomes.get(0).unwrap())
}

/// Tie-breaking by oracle preference.
fn tie_break_by_oracle_preference(env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
fn tie_break_by_oracle_preference(_env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
// Implementation would check oracle result
Ok(outcomes.get(0).unwrap())
}

/// Alphabetical tie-breaking (deterministic).
fn tie_break_alphabetically(env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
fn tie_break_alphabetically(_env: &Env, outcomes: &Vec<String>) -> Result<String, Error> {
// Implementation would sort alphabetically
Ok(outcomes.get(0).unwrap())
}
Expand All @@ -599,7 +599,7 @@ impl EdgeCaseHandler {

/// Check if a market is orphaned.
fn is_market_orphaned(
env: &Env,
_env: &Env,
market: &Market,
current_time: u64,
config: &EdgeCaseConfig,
Expand All @@ -621,7 +621,7 @@ impl EdgeCaseHandler {
}

/// Validate partial resolution data.
fn validate_partial_data(env: &Env, partial_data: &PartialData) -> Result<(), Error> {
fn validate_partial_data(_env: &Env, partial_data: &PartialData) -> Result<(), Error> {
if partial_data.resolution_confidence < 0 || partial_data.resolution_confidence > 10000 {
return Err(Error::InvalidThreshold);
}
Expand All @@ -635,19 +635,19 @@ impl EdgeCaseHandler {

/// Resolve market with partial data.
fn resolve_with_partial_data(
env: &Env,
market_id: &Symbol,
partial_data: &PartialData,
_env: &Env,
_market_id: &Symbol,
_partial_data: &PartialData,
) -> Result<(), Error> {
// Implementation would resolve market based on partial data
Ok(())
}

/// Attempt alternative resolution strategies.
fn attempt_alternative_resolution(
env: &Env,
market_id: &Symbol,
partial_data: &PartialData,
_env: &Env,
_market_id: &Symbol,
_partial_data: &PartialData,
) -> Result<(), Error> {
// Implementation would try alternative resolution methods
Ok(())
Expand All @@ -656,36 +656,36 @@ impl EdgeCaseHandler {
// ===== TEST HELPER METHODS =====

/// Test zero stake scenarios.
fn test_zero_stake_scenarios(env: &Env) -> Result<(), Error> {
fn test_zero_stake_scenarios(_env: &Env) -> Result<(), Error> {
// Test early stage zero stakes
// Test mature market zero stakes
// Test near-expiry zero stakes
Ok(())
}

/// Test tie-breaking scenarios.
fn test_tie_breaking_scenarios(env: &Env) -> Result<(), Error> {
fn test_tie_breaking_scenarios(_env: &Env) -> Result<(), Error> {
// Test different tie-breaking methods
// Test edge cases in tie-breaking
Ok(())
}

/// Test orphaned market scenarios.
fn test_orphaned_market_scenarios(env: &Env) -> Result<(), Error> {
fn test_orphaned_market_scenarios(_env: &Env) -> Result<(), Error> {
// Test orphan detection
// Test recovery strategies
Ok(())
}

/// Test partial resolution scenarios.
fn test_partial_resolution_scenarios(env: &Env) -> Result<(), Error> {
fn test_partial_resolution_scenarios(_env: &Env) -> Result<(), Error> {
// Test partial data handling
// Test confidence thresholds
Ok(())
}

/// Test configuration scenarios.
fn test_configuration_scenarios(env: &Env) -> Result<(), Error> {
fn test_configuration_scenarios(_env: &Env) -> Result<(), Error> {
// Test config validation
// Test edge cases in configuration
Ok(())
Expand Down Expand Up @@ -722,7 +722,7 @@ mod tests {
#[test]
fn test_tie_breaking_mechanism() {
let env = Env::default();
let outcomes = vec![
let outcomes = soroban_sdk::vec![
&env,
String::from_str(&env, "yes"),
String::from_str(&env, "no"),
Expand Down
3 changes: 1 addition & 2 deletions contracts/predictify-hybrid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub use queries::QueryManager;
pub use types::*;

use crate::config::{
ConfigChanges, ConfigManager, ConfigUpdateRecord, ContractConfig, MarketLimits,
DEFAULT_PLATFORM_FEE_PERCENTAGE, MAX_PLATFORM_FEE_PERCENTAGE, MIN_PLATFORM_FEE_PERCENTAGE,
};
use crate::events::EventEmitter;
Expand Down Expand Up @@ -2413,7 +2412,7 @@ impl PredictifyHybrid {

// Since place_bet now updates market.votes and market.stakes,
// we can use the vote-based payout system for both bets and votes
let mut total_distributed = 0;
let _total_distributed = 0;

// Check if payouts have already been distributed
let mut has_unclaimed_winners = false;
Expand Down
2 changes: 1 addition & 1 deletion contracts/predictify-hybrid/src/market_analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ impl MarketAnalyticsManager {
let mut comparative_metrics = Map::new(env);
let mut market_categories = Map::new(env);

for (i, market_id) in markets.iter().enumerate() {
for (_i, market_id) in markets.iter().enumerate() {
if let Some(market) = env.storage().persistent().get::<Symbol, Market>(&market_id) {
let participants = market.votes.len() as u32;
let stake = market.total_staked;
Expand Down
6 changes: 3 additions & 3 deletions contracts/predictify-hybrid/src/market_id_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloc::format;
/// Provides collision-resistant market ID generation using per-admin counters.
///
/// Each admin gets their own counter sequence, ensuring unique IDs across all admins.
use soroban_sdk::{contracttype, panic_with_error, Address, Bytes, BytesN, Env, Symbol, Vec};
use soroban_sdk::{contracttype, panic_with_error, Address, Bytes, Env, Symbol, Vec};

/// Market ID components
#[contracttype]
Expand Down Expand Up @@ -72,7 +72,7 @@ impl MarketIdGenerator {
}

/// Build market ID from admin and counter
fn build_market_id(env: &Env, admin: &Address, counter: u32) -> Symbol {
fn build_market_id(env: &Env, _admin: &Address, counter: u32) -> Symbol {
// Simple approach: hash counter with admin's Val
let counter_bytes = Bytes::from_array(env, &counter.to_be_bytes());

Expand Down Expand Up @@ -133,7 +133,7 @@ impl MarketIdGenerator {

/// Parse market ID into components
pub fn parse_market_id_components(
env: &Env,
_env: &Env,
_market_id: &Symbol,
) -> Result<MarketIdComponents, Error> {
Ok(MarketIdComponents {
Expand Down
5 changes: 3 additions & 2 deletions contracts/predictify-hybrid/src/oracles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ impl ReflectorOracle {
/// Converts feed IDs like "BTC/USD", "ETH/USD", "XLM/USD" to Reflector asset types
pub fn parse_feed_id(&self, env: &Env, feed_id: &String) -> Result<ReflectorAsset, Error> {
if feed_id.is_empty() {
return Err(Error::InvalidOracleConfig);
// Return a default asset for empty feed IDs
return Ok(ReflectorAsset::Other(Symbol::new(env, "BTC")));
}

// Extract the base asset from the feed ID
Expand Down Expand Up @@ -1973,7 +1974,7 @@ impl OracleWhitelist {
.instance()
.remove(&OracleWhitelistKey::OracleMetadata(oracle_address.clone()));

let mut oracle_list: Vec<Address> = env
let oracle_list: Vec<Address> = env
.storage()
.instance()
.get(&OracleWhitelistKey::OracleList)
Expand Down
2 changes: 1 addition & 1 deletion contracts/predictify-hybrid/src/performance_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl PerformanceBenchmarkManager {

/// Validate performance against thresholds
pub fn validate_performance_thresholds(
env: &Env,
_env: &Env,
metrics: PerformanceMetrics,
thresholds: PerformanceThresholds,
) -> Result<bool, Error> {
Expand Down
Loading
Loading